Datasets:
Upload folder using huggingface_hub (part 2)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- md/dev/JhzzvJnL9t/JhzzvJnL9t.md +395 -0
- md/dev/JprM0p-q0Co/JprM0p-q0Co.md +597 -0
- md/dev/JtBRnrlOEFN/JtBRnrlOEFN.md +465 -0
- md/dev/JvIFpZOjLF4/JvIFpZOjLF4.md +391 -0
- md/dev/K0E_F0gFDgA/K0E_F0gFDgA.md +0 -0
- md/dev/K10zWxlEGI/K10zWxlEGI.md +532 -0
- md/dev/K2OixmPDou3/K2OixmPDou3.md +0 -0
- md/dev/K3BMejPSyQ/K3BMejPSyQ.md +546 -0
- md/dev/K48UYo0glaJ/K48UYo0glaJ.md +406 -0
- md/dev/K5qR1F14qPE/K5qR1F14qPE.md +446 -0
- md/dev/KLaDXLAzzFT/KLaDXLAzzFT.md +0 -0
- md/dev/KVYq2Ea90PC/KVYq2Ea90PC.md +457 -0
- md/dev/KVljrqehulG/KVljrqehulG.md +494 -0
- md/dev/KWCZfuqshd/KWCZfuqshd.md +199 -0
- md/dev/KmtVD97J43e/KmtVD97J43e.md +349 -0
- md/dev/KnCS9390Va/KnCS9390Va.md +334 -0
- md/dev/Kwm8I7dU-l5/Kwm8I7dU-l5.md +441 -0
- md/dev/KwmPfARgOTD/KwmPfARgOTD.md +0 -0
- md/dev/L3_SsSNMmy/L3_SsSNMmy.md +0 -0
- md/dev/LI2bhrE_2A/LI2bhrE_2A.md +420 -0
- md/dev/LKEYuYNOqx/LKEYuYNOqx.md +381 -0
- md/dev/LPB2BFZvncQ/LPB2BFZvncQ.md +827 -0
- md/dev/LQnyIk5dUA/LQnyIk5dUA.md +0 -0
- md/dev/LSKlp_aceOC/LSKlp_aceOC.md +271 -0
- md/dev/LV8OmADmoOe/LV8OmADmoOe.md +223 -0
- md/dev/LdVQGdXkkG/LdVQGdXkkG.md +287 -0
- md/dev/Loek7hfb46P/Loek7hfb46P.md +0 -0
- md/dev/LtKcMgGOeLt/LtKcMgGOeLt.md +430 -0
- md/dev/LvyJX20Rll/LvyJX20Rll.md +303 -0
- md/dev/LzQQ89U1qm_/LzQQ89U1qm_.md +443 -0
- md/dev/M2sNIiCC6C/M2sNIiCC6C.md +564 -0
- md/dev/MAMOi89bOL/MAMOi89bOL.md +235 -0
- md/dev/MCVfX7HgPO/MCVfX7HgPO.md +485 -0
- md/dev/MG3YN3z1J4M/MG3YN3z1J4M.md +329 -0
- md/dev/MR7XubKUFB/MR7XubKUFB.md +445 -0
- md/dev/MSBDFwGYwwt/MSBDFwGYwwt.md +297 -0
- md/dev/MWoZh1gvbxA/MWoZh1gvbxA.md +422 -0
- md/dev/MbCAOMGsZXC/MbCAOMGsZXC.md +239 -0
- md/dev/MeeQkFYVbzW/MeeQkFYVbzW.md +0 -0
- md/dev/MkbcAHIYgyS/MkbcAHIYgyS.md +555 -0
- md/dev/Mng8CQ9eBW/Mng8CQ9eBW.md +292 -0
- md/dev/MpJjrfSJ-Xs/MpJjrfSJ-Xs.md +346 -0
- md/dev/Ms6QZafNv01/Ms6QZafNv01.md +493 -0
- md/dev/Mspk_WYKoEH/Mspk_WYKoEH.md +0 -0
- md/dev/MtGmCCPJD-/MtGmCCPJD-.md +454 -0
- md/dev/N8MaByOzUfb/N8MaByOzUfb.md +492 -0
- md/dev/NAQvF08TcyG/NAQvF08TcyG.md +578 -0
- md/dev/NHeAUKlTO8/NHeAUKlTO8.md +404 -0
- md/dev/NPJznfA7ZC/NPJznfA7ZC.md +284 -0
- md/dev/NXHXoYMLIG/NXHXoYMLIG.md +310 -0
md/dev/JhzzvJnL9t/JhzzvJnL9t.md
ADDED
|
@@ -0,0 +1,395 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Out-of-Domain Intent Detection Considering Multi-turn Dialogue Contexts
|
| 2 |
+
|
| 3 |
+
Anonymous EMNLP submission
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Out-of-Domain (OOD) intent detection is vital for practical dialogue systems, and it usually requires considering multi-turn dialogue contexts. However, most previous OOD intent detection approaches are limited to single dialogue turns. In this paper, we introduce a contextaware OOD intent detection (Caro) framework to model multi-turn contexts in OOD intent detection tasks. Specifically, we follow the information bottleneck principle to extract robust representations from multi-turn dialogue contexts. Two different views are constructed for each input sample and the superfluous information not related to intent detection is removed using a multi-view information bottleneck loss. Moreover, we also explore utilizing unlabeled data in Caro. A two-stage training process is introduced to mine OOD samples from these unlabeled data, and these OOD samples are used to train the resulting model with a bootstrapping approach. Comprehensive experiments demonstrate that Caro establishes state-of-theart performances on multi-turn OOD detection tasks by improving the F1-OOD score of over $2 9 \%$ compared to the previous best method.
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
Intent detection is vital for dialogue systems (Chen et al., 2017). Recently, promising results have been reported for intent detection under the closed-world assumption (Shu et al., 2017), i.e., the training and testing distributions are assumed to be identical, and all testing intents are seen in the training process. However, this assumption may not be valid in practice (Dietterich, 2017), where a deployed system usually confronts an open-world (Fei and Liu, 2016; Scheirer et al., 2012), i.e., the testing distribution is subject to change and Out-of-Domain (OOD) intents that are not seen in the training process may emerge in testing. It is necessary to equip intent detection modules with OOD detection abilities to accurately classify seen In-Domain (IND)
|
| 12 |
+
|
| 13 |
+
intents while rejecting unseen OOD intents (Yan et al., 2020a).
|
| 14 |
+
|
| 15 |
+
Various methods are proposed to tackle the issue of OOD detection on classification problems (Geng et al., 2020). Existing approaches include using thresholds (Zhou et al., 2021) or $( k + 1 )$ -way classifiers ( $k$ is the number of IND classes) (Zhan et al., 2021). Promising results are reported to apply these OOD detection methods on intent detection modules (Zhou et al., 2022). However, most existing OOD intent detection studies only focus on singleturn inputs (Yan et al., 2020a; Lee and Shalyminov, 2019), i.e., only the most recently issued utterance is taken as the input. In real applications, completing a task usually necessitates multiple turns of conversations (Weld et al., 2021). Therefore, it is important to explicitly model multi-turn contexts when building OOD intent detection modules since users’ intents generally depend on turns of conversations (Qin et al., 2021).
|
| 16 |
+
|
| 17 |
+
However, it is non-trivial to directly extend previous methods to the multi-turn setting (Ghosal et al., 2021). Specifically, we usually experience long distance obstacles when modeling multi-turn dialogue contexts, i.e., some dialogues have extremely long histories filled with irrelevant noises for intent detection (Liu et al., 2021). It is challenging to directly apply previous OOD intent detection methods under this obstacle since the learned representations may contain superfluous information that is irrelevant for intent detection tasks (Federici et al., 2019).
|
| 18 |
+
|
| 19 |
+
Another challenge for OOD detection in multiturn settings is the absence of OOD samples in the training phase (Zeng et al., 2021a). Specifically, it is hard to refine learned representations for OOD detection without seeing any OOD training samples (Shen et al., 2021), and it is expensive to construct OOD samples before training, especially when multi-turn contexts are considered (Chen and Yu, 2021). Fortunately, unlabeled data (i.e., a mixture of IND and OOD samples) provide a convenient way to access OOD samples since these unlabeled data are almost “free” to collect from a deployed system. However, few studies have explored utilizing unlabeled data for OOD detection in the multi-turn setting.
|
| 20 |
+
|
| 21 |
+
In this study, we propose a novel context-aware OOD intent detection framework Caro to address the above challenges for OOD intent detection in multi-turn settings. Specifically, we follow the information bottleneck principle (Tishby et al., 2000) to tackle the long-distance obstacle exhibited in multi-turn contexts. Robust representations are extracted by retaining predictive information while discarding superfluous information unrelated to intent detection. This objective is achieved by optimizing an unsupervised multi-view information bottleneck loss, during which two views are built based on the global pooling approach and adaptive reception fields. A gating mechanism is introduced to adaptively aggregate these two views to obtain an assembled representation. Caro also introduces a two-stage self-training scheme to mine OOD samples from unlabeled data. Specifically, the first stage builds a preliminary OOD detector with OOD samples synthesized from IND data. The second stage uses this detector to select OOD samples from the unlabeled data and use these samples to further refine the OOD detector. We list our key contributions:
|
| 22 |
+
|
| 23 |
+
1. We propose a novel framework Caro to address a challenging yet under-explored problem of OOD intent detection considering multi-turn dialogue contexts.
|
| 24 |
+
|
| 25 |
+
2. Caro learns robust representations by building diverse views of inputs and optimizing an unsupervised multi-view loss following the information bottleneck principle. Moreover, Caro mines OOD samples from unlabeled data to further refine the OOD detector.
|
| 26 |
+
|
| 27 |
+
3. We extensively evaluate Caro on multi-turn dialogue datasets. Caro obtains state-of-the-art results, outperforming the best baseline by a large margin $( 2 9 . 6 \%$ in the F1-OOD score).
|
| 28 |
+
|
| 29 |
+
et al., 2021a; Zhou et al., 2022; Wu et al., 2022) and use these representations to develop density-based or distance-based OOD detectors (Lee et al., 2018; Tan et al., 2019; Liu et al., 2020; Podolskiy et al., 2021). Some works also try to build OOD detectors with generated pseudo OOD samples (Hendrycks et al., 2018; Shu et al., 2021; Zhan et al., 2021; Marek et al., 2021) or thresholds based approaches (Gal and Ghahramani, 2016; Lakshminarayanan et al., 2017; Ren et al., 2019; Gangal et al., 2020; Ryu et al., 2017).
|
| 30 |
+
|
| 31 |
+
Some OOD detection methods also make use of unlabeled data. Existing approaches either focus on utilizing unlabeled IND data (Xu et al., 2021; Jin et al., 2022) or adopting a self-supervised learning framework to handle mixtures of IND and OOD samples (Zeng et al., 2021b). These approaches do not explicitly model multi-turn contexts.
|
| 32 |
+
|
| 33 |
+
Modeling Multi-turn Dialogue Contexts is the foundation for various dialogue tasks (Li et al., 2020; Ghosal et al., 2021; Chen et al., 2021). However, few works focus on detecting OOD intents in the multi-turn setting. Lee and Shalyminov (2019) proposed to use counterfeit OOD turns extracted from multi-turn contexts to train the OOD detector, and Chen and Yu (2021) augmented seed OOD samples that span multiple turns to improve the OOD detection performance. Nevertheless, these approaches either suffer from the long distance obstacle or require expensive annotated OOD samples. In this study, we attempt to learn robust representation by explicitly identifying and discarding superfluous information.
|
| 34 |
+
|
| 35 |
+
Representation Learning is also related to our work. Recent approaches for representation learning include optimizing a contrastive loss (Caron et al., 2020; Gao et al., 2021) or maximizing the mutual information between features and input samples (Poole et al., 2019). However, these approaches cannot tackle the long distance obstacle exhibited in multi-turn contexts. In this study, we follow the information bottleneck principle (Tishby et al., 2000; Federici et al., 2019) to remove superfluous information from long contexts.
|
| 36 |
+
|
| 37 |
+
# 2 Related Work
|
| 38 |
+
|
| 39 |
+
OOD Detection is a widely investigated machine learning problem (Geng et al., 2020). Recent approaches try to improve the OOD detection performance by learning more robust representations on IND data (Zhou et al., 2021; Yan et al., 2020b; Zeng
|
| 40 |
+
|
| 41 |
+
# 3 Problem Setup
|
| 42 |
+
|
| 43 |
+
We start by formulating the problem: Given $k$ IND intent classes $\mathcal { T } = \{ I _ { i } \} _ { i = 1 } ^ { k }$ , we denote all samples that do not belong to these $k$ classes as the $( k + 1 )$ th intent $I _ { k + 1 }$ . Our training data contain a set of labeled IND samples ${ \mathcal { D } } _ { I } = \{ \langle x _ { i } , y _ { i } \rangle \}$ and a set of unlabeled samples $\mathcal { D } _ { U } = \{ \langle \widetilde { \pmb { x } } _ { i } , \widetilde { \pmb { y } } _ { i } \rangle \}$ , where $y _ { i } \in \mathcal { I }$ and $\widetilde { y _ { i } } \in \mathcal { T } \cup \{ I _ { k + 1 } \}$ is the label of input sample $\mathbf { \nabla } _ { \mathbf { x } _ { i } }$ and $\widetilde { \pmb { x } } _ { i }$ , respectively. $\widetilde { y _ { i } }$ labels are not observed eduring training. Our testing data contain a mixture of IND and OOD samples ${ \mathcal { D } } _ { T } = \{ \langle \widetilde { \pmb { x } } _ { i } , \widetilde { \ y } _ { i } \rangle \}$ , where $\widetilde { y _ { i } } \in \mathcal { T } \cup \left\{ I _ { k + 1 } \right\}$ . For a testing input $\widetilde { \pmb x }$ , our OOD intent detector aims to classify the intent label of $\widetilde { \pmb x }$ if it belongs to an IND intent or reject $\widetilde { \pmb x }$ if it belongs to the OOD intent $I _ { k + 1 }$ . We also assume a validation set ${ \mathcal { D } } _ { V }$ that only contains IND samples is available. Moreover, each input sample $_ { \pmb { x } }$ from $\mathcal { D } _ { I } , \mathcal { D } _ { U } , \mathcal { D } _ { V }$ , and $\mathcal { D } _ { T }$ consists of an utterance $\textbf { \em u }$ and a multi-turn dialogue history $\pmb { h } = \pmb { u } _ { 1 } , \ldots , \pmb { u } _ { t }$ $( t \geq 0 )$ prior of $\textbf { \em u }$ : ${ \pmb x } = \langle { \pmb h } , { \pmb u } \rangle$ . $\mathbf { \Delta } \mathbf { u } _ { i }$ is the utterance issued in each dialogue turn.
|
| 44 |
+
|
| 45 |
+
# 4 Method
|
| 46 |
+
|
| 47 |
+
Care tackles the OOD intent detection problem by training a $( k + 1 )$ -way classifier $F$ on $\mathcal { D } _ { I } \cup \mathcal { D } _ { U }$ Specifically, samples classified into the $( k + 1 )$ -th intent $I _ { k + 1 }$ are considered as OOD samples. There are mainly two challenges to be addressed in Caro: (1) How to alleviate the long distance obstacle and learn robust representations from multi-turn dialogue contexts; (2) How to effectively leverage unlabeled data for OOD intent detection. These two issues are tackled with two key ingredients in Caro (see Figure 1): 1. A multi-view information bottleneck method (Section 4.1); 2. A two-stage self-training scheme (Section 4.2).
|
| 48 |
+
|
| 49 |
+
# 4.1 Multi-View Information Bottleneck
|
| 50 |
+
|
| 51 |
+
The major challenge for learning robust representations from multi-turn dialogue contexts is the long distance obstacle, i.e., information that is irrelevant for intent detection may degenerate the extracted representation if the dialogue history $h$ becomes too long. In this study, we follow the information bottleneck principle (Tishby et al., 2000) to alleviate this issue, i.e., only the task-relevant information is retained in the extracted representations while all the superficial information is discarded. Specifically, we adopt a more general unsupervised multi-view setting for the information bottleneck method (Federici et al., 2019). For each input sample $\mathbf { \nabla } _ { \mathbf { x } _ { i } }$ , two semantic invariant views are constructed: $v _ { 1 } ( \pmb { x } _ { i } )$ , $v _ { 2 } ( \pmb { x } _ { i } )$ . These two views preserve the same task-relevant information (Zhao et al., 2017). The mutual information between $v _ { 1 } ( \pmb { x } _ { i } )$ and $v _ { 2 } ( \pmb { x } _ { i } )$ are maximized while the information not shared between $v _ { 1 } ( \pmb { x } _ { i } )$ and $v _ { 2 } ( \pmb { x } _ { i } )$ are eliminated.
|
| 52 |
+
|
| 53 |
+
To achieve this goal, we adopt the multi-view information bottleneck loss introduced by Federici et al. (2019).
|
| 54 |
+
|
| 55 |
+
Constructing Multiple Views for an input sample $_ { \pmb { x } }$ is the key to the success of the unsupervised information bottleneck method. In this study, we construct these two views $v _ { 1 } ( \pmb { x } _ { i } )$ , $v _ { 2 } ( \pmb { x } _ { i } )$ by adjusting the receptive fields of the final representation. This scheme is inspired by the observation in the neuroscience community that human brains process information with multiple receptive fields (Sceniak et al., 1999), i.e., the receptive field size for neurons is adapted based on input stimuli (Spillmann et al., 2015) so that different regions of inputs are emphasized (Pettet and Gilbert, 1992). This phenomenon has been demonstrated to be effective in modeling more robust features (Pandey et al., 2022) and inspired numerous successful neural models (Wang et al., 2021; Wei et al., 2017).
|
| 56 |
+
|
| 57 |
+
Specifically, for each input sample ${ \pmb x } = \langle { \pmb h } , { \pmb u } \rangle$ , we first concatenate all utterances in $_ { \pmb { x } }$ and then use a pre-trained BERT model $E$ (Devlin et al., 2018) to encode the sequence of concatenated tokens into a sequence of embedding vectors $E ( { \pmb x } ) =$ $[ e _ { 1 } , \cdots e _ { n } ]$ , where $\boldsymbol { e } _ { i } \in \mathbb { R } ^ { m }$ . The following two strategies are used to construct two different views:
|
| 58 |
+
|
| 59 |
+
1. Global Pooling builds view $v _ { 1 } ( \pmb { x } )$ with a mean-pooling layer on top of $[ e _ { 1 } , \cdots e _ { n } ]$ , $v _ { 1 } ( \pmb { x } )$ assumes each token embedding is equally weighted:
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
v _ { 1 } ( { \pmb x } ) = \sum _ { i = 1 } ^ { n } e _ { i } / n
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
2. Adaptive Reception Field builds view $v _ { 2 } ( { \pmb x } )$ by adapting the synaptic weight of each token embedding based on the input $_ { \pmb { x } }$ :
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
\begin{array} { r } { v _ { 2 } ( \pmb { x } ) = \displaystyle \sum _ { i = 1 } ^ { n } \frac { \exp ( \alpha _ { i } ) } { \sum _ { j = 1 } ^ { n } \exp ( \alpha _ { j } ) } \cdot \pmb { e } _ { i } } \\ { \alpha _ { i } = \sigma ( \pmb { w } _ { i } \cdot \mathrm { R e L U } ( \pmb { W } _ { 1 } \cdot \pmb { s } ) ) , } \end{array}
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
where $\textbf { \textit { s } } \in \mathbb { R } ^ { n m }$ is the concatenation of all $n$ embeddings $[ e _ { 1 } , \cdots e _ { n } ]$ . $\sigma$ is the Sigmoid activation function. ${ \pmb w } _ { i } \in \mathbb { R } ^ { 1 \times r _ { 1 } } ( i = 1 , \cdot \cdot \cdot n )$ and $\pmb { W } _ { 1 } \in \mathbb { R } ^ { r _ { 1 } \times n m }$ are learnable parameters. $r _ { 1 }$ is the size of the intermediate layer. Moreover, to enhance the generalization ability, we set a small value for $r _ { 1 }$ in our implementation to form a bottleneck structure in the weighting function (Hu et al., 2017).
|
| 72 |
+
|
| 73 |
+

|
| 74 |
+
Figure 1: Framework of Caro. For each input sample ${ \pmb x } = \langle { \pmb h } , { \pmb u } \rangle$ , two views $v _ { 1 } ( \pmb { x } )$ and $v _ { 2 } ( { \pmb x } )$ are obtained and a multi-view information bottleneck loss $\mathcal { L } _ { I B }$ is optimized to learn robust representations. A two-stage training process is introduced to mine OOD samples $\mathcal { D } _ { O }$ from unlabeled data $\mathcal { D } _ { U }$ , and optimize the cross entropy loss $\mathcal { L } _ { C E }$ with $\mathcal { D } _ { O } \cup \mathcal { D } _ { I }$
|
| 75 |
+
|
| 76 |
+
Optimizing Information Bottleneck is performed in an unsupervised setting based on the two views of each sample. Specifically, we assume the representation $z _ { i }$ of each view $v _ { i } ( { \pmb x } )$ , $( i = 1 , 2 )$ ) follows a distribution that is parameterized by an encoder $p ( z | v _ { i } )$ , where $v _ { i }$ is short for ${ v } _ { i } ( { \pmb x } )$ for abbreviation. To facilitate the computation, we model $p$ as factorized Gaussian distributions, i.e., $p ( z | v _ { i } ) = \mathcal { N } [ \mu ( v _ { i } ) , \Sigma ( v _ { i } ) ]$ , in which $\mu ( v _ { i } )$ and $\Sigma ( v _ { i } )$ are two neural networks that produce the mean and deviation, respectively. The following information bottleneck loss (Federici et al., 2019) is optimized to remove superfluous information in $v _ { 1 } ( \pmb { x } )$ and $v _ { 2 } ( { \pmb x } )$ :
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
\begin{array} { r } { \mathcal { L } _ { I B } = - I ( z _ { 1 } ; z _ { 2 } ) + \displaystyle \frac { 1 } { 2 } ( D _ { K L } [ p ( z | \pmb { v } _ { 1 } ) | | p ( z | \pmb { v } _ { 2 } ) ] } \\ { + D _ { K L } [ p ( z | \pmb { v } _ { 2 } ) | | p ( z | \pmb { v } _ { 1 } ) ] ) , } \end{array}
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
where $I$ calculates the mutual information of two random variables, and $D _ { K L }$ calculates the KL divergence between two distributions.
|
| 83 |
+
|
| 84 |
+
# 4.2 Two-stage Self-training
|
| 85 |
+
|
| 86 |
+
Although robust representations can be obtained with the help of the information bottleneck loss $\mathcal { L } _ { I B }$ from Section 4.1, we still lack the annotations for OOD samples to train the $( k + 1 )$ -way classifier $F$ for OOD detection. In this study, we tackle this issue with a two-stage self-training process, which mines OOD samples from the unlabeled data $\mathcal { D } _ { U }$ with a bootstrapping approach. Moreover, for each input sample $_ { \pmb { x } }$ , we also aggregate its two views $v _ { 1 } ( \pmb { x } )$ and $v _ { 2 } ( { \pmb x } )$ with a dynamic gate to obtain assembled representations in training.
|
| 87 |
+
|
| 88 |
+
Stage One synthesizes pseudo OOD samples $\mathcal { D } _ { P }$ by mixing up IND features. Specifically, samples from $\mathcal { D } _ { I }$ are first mapped into IND representation vectors, and pseudo OOD samples are obtained as convex combinations of these vectors (Zhan et al., 2021). A preliminary OOD detector $F$ is trained using the classical cross-entropy loss $\mathcal { L } _ { C E }$ on these synthesized pseudo OOD samples and labeled IND samples $\mathcal { D } _ { I }$ . This stage endows $F$ with a preliminary ability to predict the intent distribution of each input sample.
|
| 89 |
+
|
| 90 |
+
Stage Two predicts a pseudo label for each sample $\mathbf { \boldsymbol { x } } \in \mathcal { D } _ { U }$ using $F$ , and then collects samples that are assigned with the OOD label $I _ { k + 1 }$ as a set of mined OOD samples $\mathcal { D } _ { O }$ . With the help of $\mathcal { D } _ { O }$ we further train the classifier $F$ on the following loss:
|
| 91 |
+
|
| 92 |
+
$$
|
| 93 |
+
\mathcal { L } = \underset { \pmb { x } \in \mathcal { D } _ { I } \cup \mathcal { D } _ { O } } { \mathbb { E } } \mathcal { L } _ { C E } + \lambda \underset { \pmb { x } \in \mathcal { D } _ { U } } { \mathbb { E } } \mathcal { L } _ { I B }
|
| 94 |
+
$$
|
| 95 |
+
|
| 96 |
+
where $\lambda$ is a scalar hyper-parameter to control the weight of the information bottleneck loss.
|
| 97 |
+
|
| 98 |
+
Multi-view Aggregation is performed to obtain assembled representations for input samples. Specifically, whenever we need to extract the representation $v ( { \pmb x } )$ for an input sample $_ { \pmb { x } }$ in the training process, we use the following aggregation approach:
|
| 99 |
+
|
| 100 |
+
$$
|
| 101 |
+
\begin{array} { c } { { v ( { \pmb x } ) = \beta \otimes v _ { 1 } ( { \pmb x } ) + ( 1 - \beta ) \otimes v _ { 2 } ( { \pmb x } ) } } \\ { { \beta = \sigma ( \mathbf { W } _ { 3 } \cdot \mathrm { R e L U } ( \mathbf { W } _ { 2 } \cdot ( v _ { 1 } ( { \pmb x } ) + v _ { 2 } ( { \pmb x } ) ) ) ) } } \end{array}
|
| 102 |
+
$$
|
| 103 |
+
|
| 104 |
+
where $\otimes$ represents the element-wise product, $\mathbf { W } _ { 2 } \in \mathbb { R } ^ { r _ { 2 } \times m }$ and $\mathbf { W } _ { 3 } \in \mathbb { R } ^ { m \times r _ { 2 } }$ are learnable parameters. $r _ { 2 }$ is the size of the intermediate layer.
|
| 105 |
+
|
| 106 |
+
The training of Caro is given in Algorithm 1.
|
| 107 |
+
|
| 108 |
+
# 5 Experiments
|
| 109 |
+
|
| 110 |
+
# 5.1 Datasets
|
| 111 |
+
|
| 112 |
+
We perform experiments on two variants of the STAR dataset (Mosig et al., 2020), i.e., STAR-Full and STAR-Small. Specifically, STAR is a taskoriented dialogue dataset that has 150 intents. It is designed to model long context dependence, and provides explicit annotations of OOD intents. Following Chen and Yu (2021), we regard samples
|
| 113 |
+
|
| 114 |
+
Input: IND data $\mathcal { D } _ { I }$ , unlabeled data $\mathcal { D } _ { U }$ . Output: A trained OOD detector $F$ . // Stage 1
|
| 115 |
+
1 Synthesize pseudo OOD samples $\mathcal { D } _ { P }$ by mixing up IND representations.
|
| 116 |
+
2 Train $F$ using the cross-entropy loss $\mathcal { L } _ { C E }$ on $\mathcal { D } _ { I } \cup \mathcal { D } _ { P }$ . // Stage 2
|
| 117 |
+
3 Mine OOD samples $\mathcal { D } _ { O }$ from $\mathcal { D } _ { U }$ using $F$ .
|
| 118 |
+
4 Train $F$ using $\mathcal { L }$ (Eq. 4) on $\mathcal { D } _ { I }$ , $\mathcal { D } _ { O }$ , and $\mathcal { D } _ { U }$
|
| 119 |
+
|
| 120 |
+
Algorithm 1: The training process of Caro
|
| 121 |
+
Table 1: Dataset statistics.
|
| 122 |
+
|
| 123 |
+
<table><tr><td rowspan="2"></td><td colspan="2">Train</td><td rowspan="2">Valid Test Dv DT</td><td rowspan="2">#Avg.( Context Turns</td></tr><tr><td>D1</td><td>Du</td></tr><tr><td>STAR-Full</td><td>15.4K</td><td>7.9K</td><td>2.8K 2.9K</td><td>6.13</td></tr><tr><td>STAR-Small</td><td>7.7K</td><td>3.9K</td><td>2.8K 2.9K</td><td>6.12</td></tr></table>
|
| 124 |
+
|
| 125 |
+
from intents “out_of_scope”, “custom”, or “ambiguous” as OOD samples and all other samples as IND samples. We also filter out generic utterances (e.g., greetings) in the pre-processing stage.
|
| 126 |
+
|
| 127 |
+
STAR-Full contains all pre-processed samples from the original STAR dataset. To construct unlabeled data $\mathcal { D } _ { U }$ , we extract $30 \%$ of IND samples and all OOD samples from the training set. The intent labels of all these extracted samples are removed, and the remaining samples in the training set are used as the labeled data $\mathcal { D } _ { I }$ . STAR-Small is constructed similarly, except that we down-sample $50 \%$ of the training set. We aim to evaluate the performance of OOD detection in low-resource scenarios with STAR-Small. Table 1 shows the statistics of these datasets.
|
| 128 |
+
|
| 129 |
+
# 5.2 Metrics
|
| 130 |
+
|
| 131 |
+
Following Zhang et al. (2021b); Shu et al. (2021), the OOD intent detection performance of our model is evaluated using the macro F1-score (F1-All) over all testing samples (i.e., IND and OOD samples). The fine-grained performance of our model is also evaluated by the macro F1-score over all IND samples (F1-IND) and OOD samples (F1-OOD), respectively. We use macro F1-scores to handle the class imbalance issue of the test set.
|
| 132 |
+
|
| 133 |
+
# 5.3 Implementation Details
|
| 134 |
+
|
| 135 |
+
Our BERT backbone is initialized with the pretrained weights of BERT-based-uncased (Devlin et al., 2018). We use AdamW, and Adam (Kingma and Ba, 2014) to fine-tune the BERT backbone and all other modules with a learning rate of 1e-5 and 1e-4, respectively. The Jensen-Shannon mutual information estimator (Hjelm et al., 2018) is used to estimate the mutual information $I$ in Eq. 3. All results reported in our paper are averages of 3 runs with different random seeds. Hyper-parameters are searched based on IND intent classification performances on the validation set. See Appendix A for more implementation details. Note that Caro only introduces little computational overhead compared to other OOD detection models (See Appendix C).
|
| 136 |
+
|
| 137 |
+
# 5.4 Baselines
|
| 138 |
+
|
| 139 |
+
Our baselines can be classified into two categories based on whether they use unlabeled data. The first set of baselines only use labeled IND samples $\mathcal { D } _ { I }$ in training: 1. MSP: (Hendrycks and Gimpel, 2017) utilizes the maximum Softmax predictions of a $k$ -way IND classifier to detect OOD inputs. We set the OOD detection threshold to 0.5 following Zhang et al. (2021a); 2. SEG: (Yan et al., 2020b) proposes a semantic-enhanced Gaussian mixture model; 3. DOC: (Shu et al., 2017) employs $k$ 1- vs-rest Sigmoid classifiers and uses the maximum predictions to detect OOD intents; 4. ADB: (Zhang et al., 2021b) learns an adaptive decision boundaries for OOD detection; 5. DAADB: (Zhang et al., 2021c) improves the baseline ADB with distanceaware intent representations; 6. Outlier: (Zhan et al., 2021) mixes convex interpolated outliers and open-domain outliers to train a $( k + 1 )$ -way classifier for OOD detection; 7. CDA: (Lee and Shalyminov, 2019) utilizes counterfeit OOD turns to detect OOD samples.
|
| 140 |
+
|
| 141 |
+
The second set of baselines uses both labeled IND samples $\mathcal { D } _ { I }$ and unlabeled samples $\mathcal { D } _ { U }$ for training. Specifically, Zeng et al. (2021b) proposes a self-supervised contrastive learning framework ASS to model discriminative features from unlabeled data with an adversarial augmentation module. We implement three variants of ASS by using different detection modules: 1. $\mathbf { A S S + M S P }$ : uses the detection module from the baseline MSP; 2. $\mathbf { A S S + L O F }$ : (Lin and Xu, 2019) implements the OOD detector as the local outlier factor; 3. ASS+GDA: (Xu et al., 2020a) uses a generative distance-based classifier with Mahalanobis distance as the detection module.
|
| 142 |
+
|
| 143 |
+
Moreover, we also report the performance of a $( k + 1 )$ -way classifier trained on fully labeled IND and OOD samples (Oracle), i.e., we preserve all labels for samples in $\mathcal { D } _ { I }$ and $\mathcal { D } _ { U }$ . This model is generally regarded as the upper bound of our model since it uses all the annotations.
|
| 144 |
+
|
| 145 |
+
<table><tr><td colspan="2">Model</td><td colspan="3">STAR-Full</td><td colspan="3">STAR-Small</td></tr><tr><td colspan="2">Oracle</td><td>F1-All 50.1</td><td>F1-OOD 64.46</td><td>F1-IND 50</td><td>F1-All 46.54</td><td>F1-OOD 58.23</td><td>F1-IND 46.46</td></tr><tr><td rowspan="10">D1</td><td>MSP</td><td>40.83</td><td>19.74</td><td>40.97</td><td>37.17</td><td>18.1</td><td>37.31</td></tr><tr><td>MSP w/o h</td><td>17.29</td><td>14.12</td><td>17.31</td><td>17.12</td><td>13.49</td><td>17.14</td></tr><tr><td>SEG</td><td>17.45</td><td>6.85</td><td>17.53</td><td>11.66</td><td>7.39</td><td>11.69</td></tr><tr><td>SEG w/o h</td><td>0.06</td><td>2.77</td><td>0.04</td><td>0.05</td><td>2.27</td><td>0.04</td></tr><tr><td>DOC</td><td>26.53</td><td>16.80</td><td>26.60</td><td>3.47</td><td>11.78</td><td>3.41</td></tr><tr><td>DOC w/o h</td><td>11.31</td><td>14.16</td><td>11.29</td><td>0.08</td><td>11.04</td><td>0</td></tr><tr><td>ADB</td><td>44.64</td><td>20.56</td><td>44.80</td><td>41.36</td><td>18.23</td><td>41.51</td></tr><tr><td>ADB w/o h</td><td>23.27</td><td>17.63</td><td>23.30</td><td>20.08</td><td>21.27</td><td>20.07</td></tr><tr><td>DAADB</td><td>37.27</td><td>22.87</td><td>37.37</td><td>34.81</td><td>20.43</td><td>34.91</td></tr><tr><td>DAADB w/o h</td><td>17.87</td><td>15.15</td><td>17.88</td><td>16.34</td><td>17.03</td><td>16.33</td></tr><tr><td>Outlier</td><td>43.84</td><td>19.53</td><td>44.01</td><td>39.51</td><td>19.92</td><td>39.64</td></tr><tr><td>Outlier w/o h</td><td>23.35</td><td>16.75</td><td>23.39</td><td>19.56</td><td>15.42</td><td>19.59</td></tr><tr><td>CDA</td><td>43.76</td><td>5.26</td><td>44.03</td><td>40.02</td><td>10.48</td><td>40.22</td></tr><tr><td rowspan="4">D1+Du</td><td>ASS+MSP</td><td>41.97</td><td>25.15</td><td>42.08</td><td>40.85</td><td>19.47</td><td>40.99</td></tr><tr><td>ASS+LOF</td><td>39.87</td><td>17.65</td><td>40.02</td><td>39.54</td><td>18.49</td><td>39.68</td></tr><tr><td>ASS+GDA</td><td>43.73</td><td>21.24</td><td>43.88</td><td>40.86</td><td>16.72</td><td>41.02</td></tr><tr><td>Caro (ours)</td><td>48.75(±1.0)</td><td>54.75(±3.2)</td><td>48.71(±1.0)</td><td>45.02(±1.1)</td><td>46.78(±1.8)</td><td>45.01(±1.1)</td></tr></table>
|
| 146 |
+
|
| 147 |
+
Table 2: Performance of Caro and baselines. All results are averages of three runs and the best results are bolded. The standard deviation of the performance of Caro is provided in parentheses.
|
| 148 |
+
|
| 149 |
+
For fair comparisons, all baselines use the same pretrained BERT-base backbones as our model. Multi-turn dialogue contexts in all baselines are modeled by concatenating utterances in dialogue histories. Moreover, to further validate the importance of dialogue contexts for OOD detection, we also implement a single-turn variant for the first set of baselines by ignoring multi-turn dialogue contexts $( \mathbf { w } / \mathbf { 0 } \ \mathbf { \mathit { h } } )$ , i.e., only the latest user issued utterance $\textbf { \em u }$ is used as the input. Note that we do not implement the single-turn variant for the baseline CDA since CDA is specifically designed to utilize multi-turn contexts. See Appendix B for more details about baselines.
|
| 150 |
+
|
| 151 |
+
# 5.5 Main Results
|
| 152 |
+
|
| 153 |
+
The results for our model Caro and all baselines are shown in Table 2. It can be seen that Caro outperforms all other baselines on both datasets with large margins. We highlight several observations: 1. Methods that model multi-turns of dialogue histories (e.g., MSP, SEG, DOC, ADB, DA-ADB, and Outlier) generally outperform their single turn counter (i.e., models marked with “w/o $\mathbf { \mathit { h } } ^ { \prime \prime }$ ) with large margins. This validates our claim that it is necessary to consider multi-turn dialogue contexts for OOD intent detection since users’ intents may depend on prior turns. 2. Our method Caro outperforms all baselines that only use IND data $\mathcal { D } _ { I }$ . The performance gain demonstrates the advantage of incorporating unlabeled data for OOD detection, which can be used to learn compact representations for both IND and OOD intents. 3. Caro also outperforms baselines that utilize unlabeled data $\mathcal { D } _ { U }$ . This validates Caro’s effectiveness in tackling the long distance obstacle and modeling unlabeled samples. Our baselines are prone to capture irrelevant noises for OOD intent detection, while Caro incorporates multi-view information bottleneck loss to remove superfluous information.
|
| 154 |
+
|
| 155 |
+
We also analyze the effect of unlabeled data size (Appendix E) and $\lambda$ (Appendix F) on the OOD intent detection performance and carry out a case study (Appendix G).
|
| 156 |
+
|
| 157 |
+
# 5.6 Ablation Studies
|
| 158 |
+
|
| 159 |
+
To validate our motivation and model design, we ablate our model components and loss terms.
|
| 160 |
+
|
| 161 |
+
Model Components: Ablation studies are carried out to validate the effectiveness of each component in Caro. Specifically, the following variants are investigated: 1. w/o $\mathcal { D } _ { U }$ removes training stage two, i.e., only $\mathcal { D } _ { I }$ is used for training. 2. w/o MV ablates the multi-view construction approach introduced in Caro. Specifically, we adopt the approach used by Gao et al. (2021) to perform two dropouts with two different masks when constructing these two views. 3. w/o VA ablates the multi-view aggregation approach, i.e., the representations of two views are directly added instead of using the adaptive gate in Eq. 5. 4. w/o IB removes the information bottleneck loss $\mathcal { L } _ { I B }$ . We implement this variant by setting $\lambda = 0$ in Eq.4.
|
| 162 |
+
|
| 163 |
+
Table 3: Ablation on different components of Caro.
|
| 164 |
+
|
| 165 |
+
<table><tr><td>Model</td><td colspan="3">STAR-Full F1-Al1 F1-00D F1-IND</td><td colspan="3">STAR-Small F1-All F1-OOD F1-IND</td></tr><tr><td>Caro</td><td>48.75</td><td>54.75</td><td>48.71</td><td>45.02</td><td>46.78</td><td>45.01</td></tr><tr><td>w/o Du</td><td>45.97</td><td>21.45</td><td>46.14</td><td>42.24</td><td>23.23</td><td>42.37</td></tr><tr><td>w/o MV</td><td>47.71</td><td>53.35</td><td>47.67</td><td>44.42</td><td>38.89</td><td>44.46</td></tr><tr><td>w/o VA</td><td>47.34</td><td>50.85</td><td>47.32</td><td>44.14</td><td>43.88</td><td>44.15</td></tr><tr><td>w/o IB</td><td>48.23</td><td>49.37</td><td>48.22</td><td>44.14</td><td>37.06</td><td>44.19</td></tr></table>
|
| 166 |
+
|
| 167 |
+
Table 4: Ablation on the representation learning loss.
|
| 168 |
+
|
| 169 |
+
<table><tr><td>Model</td><td colspan="3">STAR-Full F1-All F1-OOD F1-IND</td><td colspan="3">STAR-Small F1-All F1-OOD F1-IND</td></tr><tr><td>Caro</td><td>48.75</td><td>54.75</td><td>48.71</td><td>45.02</td><td>46.78</td><td>45.01</td></tr><tr><td>InfoMax</td><td>47.27</td><td>49.92</td><td>47.25</td><td>44.27</td><td>36.66</td><td>44.32</td></tr><tr><td>MVI</td><td>48.46</td><td>51.99</td><td>48.44</td><td>44.70</td><td>36.16</td><td>44.76</td></tr><tr><td>CL</td><td>48.18</td><td>52.54</td><td>48.15</td><td>44.59</td><td>35.31</td><td>44.65</td></tr><tr><td>SimCSE</td><td>47.73</td><td>47.74</td><td>47.73</td><td>44.30</td><td>27.02</td><td>44.42</td></tr></table>
|
| 170 |
+
|
| 171 |
+
Results in Table 3 indicate that Caro outperforms all ablation variants. Specifically, we can also observe that: 1. Training models without unlabeled data (i.e., w/o $\mathcal { D } _ { U }$ ) degenerate the performance of Caro by a large margin. The F1-OOD score suffers an absolute decrease of $3 3 . 3 \%$ and $2 3 . 6 \%$ on STAR-FULL and STAR-Small, respectively. This validates our claim that effective utilization of unlabeled data improves the performance of OOD detection. 2. Our multi-view construction approach helps to improve the OOD detection performance (see w/o MV), and our multi-view aggregation approach also benefits the extracted representation (see w/o VA). 3. Removing the multi-view information bottleneck loss (i.e., w/o IB) degenerates the OOD performance. This validates our claim that multi-turn contexts may contain irrelevant noises for OOD intent detection.
|
| 172 |
+
|
| 173 |
+
Information Bottleneck Loss: We further demonstrate the effectiveness of our information bottleneck loss $\mathcal { L } _ { I B }$ by replacing $\mathcal { L } _ { I B }$ in Eq. 4 with other alternatives of representation learning. Specifically, assume $_ { \pmb { x } }$ is an input sample. 1. InfoMax (Poole et al., 2019) maximizes the mutual information between $_ { \pmb { x } }$ and its representation $_ z$ : $I ( { \pmb x } ; z )$ ; 2. MVI (Bachman et al., 2019) is similar to InfoMax except that it maximizes the mutual information between $_ { \pmb { x } }$ ’s two views $I ( v _ { 1 } ( { \pmb x } ) ; v _ { 2 } ( { \pmb x } ) )$ ; Note that both InfoMax and MVI do not attempt to remove superficial information from representations. 3. CL (Caron et al., 2020) uses a contrastive learning loss. Positive pairs in this variant are obtained using our multi-view construction approach. 4. SimCSE (Gao et al., 2021) is similar to CL except that it acquires positive pairs by two different dropouts on the BERT encoder.
|
| 174 |
+
|
| 175 |
+

|
| 176 |
+
Figure 2: Comparing representations obtained by different objectives on the STAR-Full dataset. A lower score means that the learned representation discards more superficial information. See Appendix D for measurements used to produce the graph.
|
| 177 |
+
|
| 178 |
+
Results in Table 4 show that the information bottleneck loss used in Caro performs better than all other variants. We also want to highlight that the approach of explicitly removing superficial information in Caro makes it outperform InfoMax and MVI by $4 . 8 3 \%$ and $2 . 7 6 \%$ , respectively, on the F1-OOD score. This validates our claim that long contexts may contain superficial information that degenerates intent detection, and the multi-view information bottleneck loss used in Caro effectively removes this superficial information.
|
| 179 |
+
|
| 180 |
+
Moreover, we also perform fine-grained analysis of the learned representations following Tishby et al. (2000). Specifically, for an input sample $_ { \pmb { x } }$ with a label of $y$ and an extracted representation of $_ z$ , two scores are calculated: 1. Observational information score (measured by $I ( { \pmb x } ; z ) )$ ; 2. Predictive ability score (measured by $I ( z ; y ) )$ . An ideal representation would be maximally predictive about the label while retaining a minimal amount of information from the observations (Tishby et al., 2000; Federici et al., 2019). Here we report the score of $I ( { \pmb x } ; z ) - I ( z ; y )$ for Caro, MVI and InforMax in Figure 2. It can be seen that the information bottleneck loss helps Caro to achieve the lowest $I ( { \pmb x } ; z ) - I ( z ; y )$ score. This indicates that representations learned in Caro retrain low observational information while achieving a relatively
|
| 181 |
+
|
| 182 |
+
<table><tr><td colspan="2">Context Len</td><td>F1-All</td><td>F1-00D</td><td>F1-IND</td></tr><tr><td rowspan="2">Long</td><td>w/o IB</td><td>44.14</td><td>37.06</td><td>44.19</td></tr><tr><td>wIB</td><td>45.02 (+0.88)</td><td>46.78 (+9.72)</td><td>45.01 (+0.82)</td></tr><tr><td rowspan="2">Short</td><td>w/o IB</td><td>43.61</td><td>40.68</td><td>43.63</td></tr><tr><td>wIB</td><td>43.70 (+0.09)</td><td>43.32 (+2.64)</td><td>43.70 (+0.07)</td></tr></table>
|
| 183 |
+
|
| 184 |
+
Table 5: Benefit of $\mathcal { L } _ { I B }$ under different context lengths on the STAR-Small dataset. Long context means retaining all the original dialogue contexts (6 turns on average), and short context means truncating contexts longer than 3 turns. Scores in parentheses is the performance improvement brought by $\mathcal { L } _ { I B }$
|
| 185 |
+
|
| 186 |
+

|
| 187 |
+
Figure 3: Difference of averaged weight score at each token index for testing samples from STAR-Full.
|
| 188 |
+
|
| 189 |
+

|
| 190 |
+
Figure 4: Difference of averaged aggregation weights at each dimension for testing samples in STAR-Full.
|
| 191 |
+
|
| 192 |
+
diversity of our two views (Section 4.1) by visualizing the distribution of weight score $\alpha _ { i }$ in Eq. 2. Specifically, we first calculate the average weight scores received at each token index for samples from the same intent (we use a max sequence length of 256). Then we choose two intents (i.e., weather_inform_forecast and trip_inform_simple_step_ask_proceed) and visualize the difference between their averaged weight score at each token index in Figure 3. It can be seen that weight scores change sharply across different intents and token indices. That means the view $v _ { 2 } ( { \pmb x } )$ constructed for each sample is diverse.
|
| 193 |
+
|
| 194 |
+
high predictive ability.
|
| 195 |
+
|
| 196 |
+
# 5.7 Further Analysis
|
| 197 |
+
|
| 198 |
+
Benefit of $\mathcal { L } _ { I B }$ in Different Context Lengths We also validate the benefit of our information bottleneck loss $\mathcal { L } _ { I B }$ (Eq. 3) under different context lengths. Specifically, we construct a variant of STAR-Small (denoted as “Short”) by truncating contexts longer than 3 turns, i.e., the dialogue histories before the latest 3 turns are discarded. We also denote the original STAR-Small dataset as “Long”, which has a maximum context length of 7 turns. Caro’s performance with and without $\mathcal { L } _ { I B }$ , i.e., “w IB” and “w/o IB” is tested on these two datasets.
|
| 199 |
+
|
| 200 |
+
Results in Table 5 show that Caro benefits more from $\mathcal { L } _ { I B }$ in longer contexts. Specifically, the longer the context, the larger improvement is brought by $\mathcal { L } _ { I B }$ on the OOD detection performance. This further validates our claim that our information bottleneck loss $\mathcal { L } _ { I B }$ helps remove superficial information unrelated to intent detection.
|
| 201 |
+
|
| 202 |
+
Diversity of Adaptive Reception Field Our multi-view information bottleneck objective expects two diverse views for each input sample (Federici et al., 2019). Here we validate the
|
| 203 |
+
|
| 204 |
+
Analysis of Aggregation Weights We also visualize the weight $\beta$ used in the multi-view aggregation process (Eq. 5). Specifically, we expect these two views in Eq. 5 to receive different weights. Concretely, we first calculate the averaged $\beta$ vector for all testing samples from STAR-Small. Then we calculate the difference of weights received by these two views $v _ { 1 } ( \pmb { x } )$ and $v _ { 2 } ( { \pmb x } )$ in Eq. 5, and visualize values in each dimension in Figure 4. It can be seen that diverse weights are used in the multi-view aggregation process.
|
| 205 |
+
|
| 206 |
+
# 6 Conclusion
|
| 207 |
+
|
| 208 |
+
In this paper, we propose Caro, a novel OOD intent detection framework to explore OOD detection in multi-turn settings. Caro learns robust representations by building diverse views of an input and optimise an unsupervised multi-view loss following the information bottleneck principle. OOD samples are mined from unlabeled data, which are used to train a $( k + 1 )$ -way multi-view classifier as the resulting OOD detector. Extensive experiments demonstrate that Caro is effective as modeling multi-turn contexts and outperforms SOTA baselines.
|
| 209 |
+
|
| 210 |
+
# Limitations
|
| 211 |
+
|
| 212 |
+
One major limitation of this work is its input modality. Specifically, our method is limited to textual inputs and ignores inputs in other modalities such as audio, vision, or robotic features. These modalities provide valuable information that can be used to build better OOD detectors. In future works, we will try to model multi-modal multi-turn contexts for OOD intent detection.
|
| 213 |
+
|
| 214 |
+
# Ethics Statement
|
| 215 |
+
|
| 216 |
+
This work does not present any direct ethical issues. In the proposed work, we seek to develop a contextaware method for OOD intent detection, and we believe this study leads to intellectual merits that benefit from a reliable application of NLU models. All experiments are conducted on open datasets.
|
| 217 |
+
|
| 218 |
+
# References
|
| 219 |
+
|
| 220 |
+
Philip Bachman, R Devon Hjelm, and William Buchwalter. 2019. Learning representations by maximizing mutual information across views. Advances in neural information processing systems, 32.
|
| 221 |
+
|
| 222 |
+
Mathilde Caron, Ishan Misra, Julien Mairal, Priya Goyal, Piotr Bojanowski, and Armand Joulin. 2020. Unsupervised learning of visual features by contrasting cluster assignments. Advances in Neural Information Processing Systems, 33:9912–9924.
|
| 223 |
+
|
| 224 |
+
Derek Chen and Zhou Yu. 2021. Gold: Improving out-of-scope detection in dialogues using data augmentation. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 429–442.
|
| 225 |
+
|
| 226 |
+
Hongshen Chen, Xiaorui Liu, Dawei Yin, and Jiliang Tang. 2017. A survey on dialogue systems: Recent advances and new frontiers. Acm Sigkdd Explorations Newsletter, 19(2):25–35.
|
| 227 |
+
|
| 228 |
+
Yulong Chen, Yang Liu, Liang Chen, and Yue Zhang. 2021. Dialogsum: A real-life scenario dialogue summarization dataset. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pages 5062–5074.
|
| 229 |
+
|
| 230 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2018. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805.
|
| 231 |
+
|
| 232 |
+
Thomas G Dietterich. 2017. Steps toward robust artificial intelligence. Ai Magazine, 38(3):3–24.
|
| 233 |
+
|
| 234 |
+
Marco Federici, Anjan Dutta, Patrick Forré, Nate Kushman, and Zeynep Akata. 2019. Learning robust representations via multi-view information bottleneck.
|
| 235 |
+
|
| 236 |
+
In International Conference on Learning Representations.
|
| 237 |
+
|
| 238 |
+
Geli Fei and Bing Liu. 2016. Breaking the closed world assumption in text classification. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 506–514.
|
| 239 |
+
|
| 240 |
+
Yarin Gal and Zoubin Ghahramani. 2016. Dropout as a bayesian approximation: Representing model uncertainty in deep learning. In international conference on machine learning, pages 1050–1059. PMLR.
|
| 241 |
+
|
| 242 |
+
Varun Gangal, Abhinav Arora, Arash Einolghozati, and Sonal Gupta. 2020. Likelihood ratios and generative classifiers for unsupervised out-of-domain detection in task oriented dialog. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 7764–7771.
|
| 243 |
+
|
| 244 |
+
Tianyu Gao, Xingcheng Yao, and Danqi Chen. 2021. SimCSE: Simple contrastive learning of sentence embeddings. In Empirical Methods in Natural Language Processing (EMNLP).
|
| 245 |
+
|
| 246 |
+
Chuanxing Geng, Sheng-jun Huang, and Songcan Chen. 2020. Recent advances in open set recognition: A survey. IEEE transactions on pattern analysis and machine intelligence, 43(10):3614–3631.
|
| 247 |
+
|
| 248 |
+
Deepanway Ghosal, Navonil Majumder, Rada Mihalcea, and Soujanya Poria. 2021. Exploring the role of context in utterance-level emotion, act and intent classification in conversations: An empirical study. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pages 1435–1449.
|
| 249 |
+
|
| 250 |
+
Dan Hendrycks and Kevin Gimpel. 2017. A baseline for detecting misclassified and out-of-distribution examples in neural networks. In International Conference on Learning Representations.
|
| 251 |
+
|
| 252 |
+
Dan Hendrycks, Mantas Mazeika, and Thomas Dietterich. 2018. Deep anomaly detection with outlier exposure. In International Conference on Learning Representations.
|
| 253 |
+
|
| 254 |
+
R Devon Hjelm, Alex Fedorov, Samuel LavoieMarchildon, Karan Grewal, Phil Bachman, Adam Trischler, and Yoshua Bengio. 2018. Learning deep representations by mutual information estimation and maximization. In International Conference on Learning Representations.
|
| 255 |
+
|
| 256 |
+
Jie Hu, Li Shen, Samuel Albanie, Gang Sun, and Enhua Wu. 2017. Squeeze-and-excitation networks. IEEE Transactions on Pattern Analysis and Machine Intelligence, 42:2011–2023.
|
| 257 |
+
|
| 258 |
+
Di Jin, Shuyang Gao, Seokhwan Kim, Yang Liu, and Dilek Hakkani-Tür. 2022. Towards textual out-of-domain detection without in-domain labels. IEEE/ACM Transactions on Audio, Speech, and Language Processing, 30:1386–1395.
|
| 259 |
+
|
| 260 |
+
Diederik P Kingma and Jimmy Ba. 2014. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980.
|
| 261 |
+
|
| 262 |
+
Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. 2017. Simple and scalable predictive uncertainty estimation using deep ensembles. Advances in neural information processing systems, 30.
|
| 263 |
+
|
| 264 |
+
Kimin Lee, Kibok Lee, Honglak Lee, and Jinwoo Shin. 2018. A simple unified framework for detecting outof-distribution samples and adversarial attacks. Advances in neural information processing systems, 31.
|
| 265 |
+
|
| 266 |
+
Sungjin Lee and Igor Shalyminov. 2019. Contextual outof-domain utterance handling with counterfeit data augmentation. In ICASSP 2019-2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 7205–7209. IEEE.
|
| 267 |
+
|
| 268 |
+
Jiaqi Li, Ming Liu, Min-Yen Kan, Zihao Zheng, Zekun Wang, Wenqiang Lei, Ting Liu, and Bing Qin. 2020. Molweni: A challenge multiparty dialogues-based machine reading comprehension dataset with discourse structure. In Proceedings of the 28th International Conference on Computational Linguistics, pages 2642–2652.
|
| 269 |
+
|
| 270 |
+
Ting-En Lin and Hua Xu. 2019. Deep unknown intent detection with margin loss. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5491–5496.
|
| 271 |
+
|
| 272 |
+
Jiexi Liu, Ryuichi Takanobu, Jiaxin Wen, Dazhen Wan, Hongguang Li, Weiran Nie, Cheng Li, Wei Peng, and Minlie Huang. 2021. Robustness testing of language understanding in task-oriented dialog. 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 2467–2480.
|
| 273 |
+
|
| 274 |
+
Weitang Liu, Xiaoyun Wang, John Owens, and Yixuan Li. 2020. Energy-based out-of-distribution detection. Advances in Neural Information Processing Systems, 33.
|
| 275 |
+
|
| 276 |
+
Petr Marek, Vishal Ishwar Naik, Anuj Goyal, and Vincent Auvray. 2021. Oodgan: Generative adversarial network for out-of-domain data generation. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies: Industry Papers, pages 238–245.
|
| 277 |
+
|
| 278 |
+
Johannes EM Mosig, Shikib Mehri, and Thomas Kober. 2020. Star: A schema-guided dialog dataset for transfer learning. arXiv preprint arXiv:2010.11853.
|
| 279 |
+
|
| 280 |
+
Biraj Pandey, Marius Pachitariu, Bingni W. Brunton, and Kameron Decker Harris. 2022. Structured random receptive fields enable informative sensory encodings. bioRxiv.
|
| 281 |
+
|
| 282 |
+
Mark W Pettet and Charles D Gilbert. 1992. Dynamic changes in receptive-field size in cat primary visual cortex. Proceedings of the National Academy of Sciences, 89(17):8366–8370.
|
| 283 |
+
|
| 284 |
+
Alexander Podolskiy, Dmitry Lipin, Andrey Bout, Ekaterina Artemova, and Irina Piontkovskaya. 2021. Revisiting mahalanobis distance for transformer-based out-of-domain detection. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 13675–13682.
|
| 285 |
+
|
| 286 |
+
Ben Poole, Sherjil Ozair, Aaron Van Den Oord, Alex Alemi, and George Tucker. 2019. On variational bounds of mutual information. In International Conference on Machine Learning, pages 5171–5180. PMLR.
|
| 287 |
+
|
| 288 |
+
Libo Qin, Tianbao Xie, Wanxiang Che, and Ting Liu. 2021. A survey on spoken language understanding: Recent advances and new frontiers. In IJCAI.
|
| 289 |
+
|
| 290 |
+
Jie Ren, Peter J Liu, Emily Fertig, Jasper Snoek, Ryan Poplin, Mark Depristo, Joshua Dillon, and Balaji Lakshminarayanan. 2019. Likelihood ratios for outof-distribution detection. Advances in Neural Information Processing Systems, 32.
|
| 291 |
+
|
| 292 |
+
Seonghan Ryu, Seokhwan Kim, Junhwi Choi, Hwanjo Yu, and Gary Geunbae Lee. 2017. Neural sentence embedding using only in-domain sentences for outof-domain sentence detection in dialog systems. Pattern Recognition Letters, 88:26–32.
|
| 293 |
+
|
| 294 |
+
Michael P Sceniak, Dario L Ringach, Michael J Hawken, and Robert Shapley. 1999. Contrast’s effect on spatial summation by macaque v1 neurons. Nature neuroscience, 2(8):733–739.
|
| 295 |
+
|
| 296 |
+
Walter J Scheirer, Anderson de Rezende Rocha, Archana Sapkota, and Terrance E Boult. 2012. Toward open set recognition. IEEE transactions on pattern analysis and machine intelligence, 35(7):1757– 1772.
|
| 297 |
+
|
| 298 |
+
Yilin Shen, Yen-Chang Hsu, Avik Ray, and Hongxia Jin. 2021. Enhancing the generalization for intent classification and out-of-domain detection in slu. 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 2443– 2453.
|
| 299 |
+
|
| 300 |
+
Lei Shu, Yassine Benajiba, Saab Mansour, and Yi Zhang. 2021. Odist: Open world classification via distributionally shifted instances. In Findings of the Association for Computational Linguistics: EMNLP 2021, pages 3751–3756.
|
| 301 |
+
|
| 302 |
+
Lei Shu, Hu Xu, and Bing Liu. 2017. Doc: Deep open classification of text documents. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 2911–2916.
|
| 303 |
+
|
| 304 |
+
Lothar Spillmann, Birgitta Dresp-Langley, and ChiaHuei Tseng. 2015. Beyond the classical receptive field: The effect of contextual stimuli. Journal of Vision, 15(9):7–7.
|
| 305 |
+
|
| 306 |
+
Ming Tan, Yang Yu, Haoyu Wang, Dakuo Wang, Saloni Potdar, Shiyu Chang, and Mo Yu. 2019. Out-ofdomain detection for low-resource text classification tasks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pages 3566–3572, Hong Kong, China. Association for Computational Linguistics.
|
| 307 |
+
|
| 308 |
+
Naftali Tishby, Fernando C Pereira, and William Bialek. 2000. The information bottleneck method. arXiv preprint physics/0004057.
|
| 309 |
+
|
| 310 |
+
Xing Wang, Juan Zhao, Lin Zhu, Xu Zhou, Zhao Li, Junlan Feng, Chao Deng, and Yong Zhang. 2021. Adaptive multi-receptive field spatial-temporal graph convolutional network for traffic forecasting. In 2021 IEEE Global Communications Conference (GLOBECOM), pages 1–7.
|
| 311 |
+
|
| 312 |
+
Zhen Wei, Yao Sun, Jinqiao Wang, Hanjiang Lai, and Si Liu. 2017. Learning adaptive receptive fields for deep image parsing network. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR).
|
| 313 |
+
|
| 314 |
+
Henry Weld, Xiaoqi Huang, Siqu Long, Josiah Poon, and Soyeon Caren Han. 2021. A survey of joint intent detection and slot filling models in natural language understanding. ACM Computing Surveys (CSUR).
|
| 315 |
+
|
| 316 |
+
Thomas Wolf, Julien Chaumond, Lysandre Debut, Victor Sanh, Clement Delangue, Anthony Moi, Pierric Cistac, Morgan Funtowicz, Joe Davison, Sam Shleifer, et al. 2020. Transformers: State-of-theart natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 38–45.
|
| 317 |
+
|
| 318 |
+
Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, et al. 2019. Huggingface’s transformers: State-ofthe-art natural language processing. arXiv preprint arXiv:1910.03771.
|
| 319 |
+
|
| 320 |
+
Yanan Wu, Keqing He, Yuanmeng Yan, QiXiang Gao, Zhiyuan Zeng, Fujia Zheng, Lulu Zhao, Huixing Jiang, Wei Wu, and Weiran Xu. 2022. Revisit overconfidence for OOD detection: Reassigned contrastive learning with adaptive class-dependent threshold. In Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 4165–4179, Seattle, United States. Association for Computational Linguistics.
|
| 321 |
+
|
| 322 |
+
Hong Xu, Keqing He, Yuanmeng Yan, Sihong Liu, Zijun Liu, and Weiran Xu. 2020a. A deep generative distance-based classifier for out-of-domain detection with mahalanobis space. In Proceedings of the 28th International Conference on Computational Linguistics, pages 1452–1460.
|
| 323 |
+
|
| 324 |
+
Jin Xu, Zishan Li, Bowen Du, Miaomiao Zhang, and Jing Liu. 2020b. Reluplex made more practical: Leaky relu. In 2020 IEEE Symposium on Computers and communications (ISCC), pages 1–7. IEEE.
|
| 325 |
+
|
| 326 |
+
Keyang Xu, Tongzheng Ren, Shikun Zhang, Yihao Feng, and Caiming Xiong. 2021. Unsupervised outof-domain detection via pre-trained transformers. 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 1052– 1061, Online. Association for Computational Linguistics.
|
| 327 |
+
|
| 328 |
+
Guangfeng Yan, Lu Fan, Qimai Li, Han Liu, Xiaotong Zhang, Xiao-Ming Wu, and Albert Y.S. Lam. 2020a. Unknown intent detection using Gaussian mixture model with an application to zero-shot intent classification. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 1050–1060, Online. Association for Computational Linguistics.
|
| 329 |
+
|
| 330 |
+
Guangfeng Yan, Lu Fan, Qimai Li, Han Liu, Xiaotong Zhang, Xiao-Ming Wu, and Albert YS Lam. 2020b. Unknown intent detection using gaussian mixture model with an application to zero-shot intent classification. In Proceedings of the 58th annual meeting of the association for computational linguistics, pages 1050–1060.
|
| 331 |
+
|
| 332 |
+
Zhiyuan Zeng, Keqing He, Yuanmeng Yan, Zijun Liu, Yanan Wu, Hong Xu, Huixing Jiang, and Weiran Xu. 2021a. Modeling discriminative representations for out-of-domain detection with supervised contrastive 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 2: Short Papers), pages 870–878, Online. Association for Computational Linguistics.
|
| 333 |
+
|
| 334 |
+
Zhiyuan Zeng, Keqing He, Yuanmeng Yan, Hong Xu, and Weiran Xu. 2021b. Adversarial self-supervised learning for out-of-domain detection. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 5631–5639.
|
| 335 |
+
|
| 336 |
+
Li-Ming Zhan, Haowen Liang, Bo Liu, Lu Fan, XiaoMing Wu, and Albert YS Lam. 2021. Out-of-scope intent detection with self-supervision and discriminative training. 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 3521–3532.
|
| 337 |
+
|
| 338 |
+
Hanlei Zhang, Xiaoteng Li, Hua Xu, Panpan Zhang, Kang Zhao, and Kai Gao. 2021a. TEXTOIR: An integrated and visualized platform for text open intent recognition. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing: System Demonstrations, pages 167–174.
|
| 339 |
+
|
| 340 |
+
Hanlei Zhang, Hua Xu, and Ting-En Lin. 2021b. Deep open intent classification with adaptive decision boundary. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 14374– 14382.
|
| 341 |
+
|
| 342 |
+
Hanlei Zhang, Hua Xu, Shaojie Zhao, and Qianrui Zhou. 2021c. Learning discriminative representations and decision boundaries for open intent detection.
|
| 343 |
+
|
| 344 |
+
Jing Zhao, Xijiong Xie, Xin Xu, and Shiliang Sun. 2017. Multi-view learning overview: Recent progress and new challenges. Information Fusion, 38:43–54.
|
| 345 |
+
|
| 346 |
+
Wenxuan Zhou, Fangyu Liu, and Muhao Chen. 2021. Contrastive out-of-distribution detection for pretrained transformers. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 1100–1111, Online and Punta Cana, Dominican Republic. Association for Computational Linguistics.
|
| 347 |
+
|
| 348 |
+
Yunhua Zhou, Peiju Liu, and Xipeng Qiu. 2022. Knncontrastive learning for out-of-domain intent classification. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 5129–5141.
|
| 349 |
+
|
| 350 |
+
# A More Implementation Details
|
| 351 |
+
|
| 352 |
+
We use Huggingface’s Transformers library (Wolf et al., 2020) and train with the backbone of BERT (Devlin et al., 2018). The max_seq_length is 256 for BertTokenize. The classification head is implemented as two-layer MLPs with the LeakyReLU activation ( $\mathrm { \Delta X u }$ et al., 2020b), while the projection heads in $\mu ( v _ { i } )$ and $\Sigma ( v _ { i } )$ as three-layer MLPs. The projection dimension is 64. Following (Zhan et al., 2021), We use AdamW (Kingma and Ba, 2014) to fine-tune BERT using a learning rate of 1e-5 and Adam (Wolf et al., 2019) to train the MLP heads using a learning rate of 1e-4. Following (Federici et al., 2019), we use Jensen-Shannon mutual information estimator (Hjelm et al., 2018) to maximize mutual information between two random variables. In the training stage, 15 epochs of pretraining are first conducted, and then 10 epochs of training are conducted by adding the process of unsupervised representation learning on unlabeled data with early stopping. The batch size is 25 for IND and unlabeled datasets, respectively. We set the weight $\lambda$ for $\mathcal { L } _ { I B }$ to be 0.5 in all experiments. And we set $r _ { 1 } ~ = ~ 1 6$ and $r _ { 2 } ~ = ~ 4 8$ . All results reported in our paper are averages of 3 runs with different random seeds, and each run is stopped when we reach a plateau on the validation performance. Hyper-parameters are searched based on IND intent classification performances on the validation set. All experiments are conducted in the Nvidia Tesla V100-SXM2 GPU with 32G graphical memory.
|
| 353 |
+
|
| 354 |
+
# B More Details about Baselines
|
| 355 |
+
|
| 356 |
+
We get the baseline results (MSP, SEG, DOC, ADB, and DA-ADB) using the OOD detection toolkit TEXTOIR (Zhang et al., 2021a). We get the baseline result of Outlier by running their released codes (Zhan et al., 2021). We re-implement CDA by using counterfeit OOD turns (Lee and Shalyminov, 2019). We re-implement ASS (Zeng et al., 2021b) based on the code of authors (Zeng et al., 2021a). For fair comparisons, all baselines are implemented by using BERT as the backbone.
|
| 357 |
+
|
| 358 |
+
C Computational Cost Analysis
|
| 359 |
+
Table 6: Number of parameters (Million), average training time for each epoch (minutes) and the total time for testing (seconds) on STAR-Full dataset.
|
| 360 |
+
|
| 361 |
+
<table><tr><td>Methods</td><td>#Para.</td><td>Training Time</td><td>Testing Time</td></tr><tr><td>Outlier</td><td>111.47 M</td><td>7.26 min</td><td>14.46 s</td></tr><tr><td>Caro</td><td>116.80 M</td><td>8.75 min</td><td>14.53 s</td></tr></table>
|
| 362 |
+
|
| 363 |
+

|
| 364 |
+
|
| 365 |
+
We compare the computational cost of a vanilla OOD detector Outlier (Zhan et al., 2021) and Caro. We use the STAR-Full dataset for this analysis. As shown in Table 6, Caro only introduces marginal parameter overhead. We can also observe that using Caro only introduces a little time overhead compared to Outlier.
|
| 366 |
+
|
| 367 |
+
# D More Details about Measurements Used to Produce the Graph
|
| 368 |
+
|
| 369 |
+
The mutual information estimation $\scriptstyle ( I ( x ; z )$ and $I ( z ; y ) ,$ ) reported in Figure 2 are computed by training two estimation networks from scratch on the final representation of Caro. Following (Federici et al., 2019), we use Jensen-Shannon mutual information estimator (Hjelm et al., 2018) to maximize mutual information between two random variables.
|
| 370 |
+
|
| 371 |
+

|
| 372 |
+
|
| 373 |
+

|
| 374 |
+
|
| 375 |
+
The two estimation architectures consist of threelayer MLPs. We report average numerical estimations of mutual information using an energy-based bound (Poole et al., 2019) on the test dataset. To reduce the variance of the estimator, the lowest and highest $5 \%$ are removed before averaging.
|
| 376 |
+
|
| 377 |
+
# E Analysis for Unlabeled Data Size
|
| 378 |
+
|
| 379 |
+
Table 7 demonstrates the effect of unlabeled data size for Caro. We downsample $100 \%$ , $7 5 \%$ , $50 \%$ , and $25 \%$ of the unlabeled data from STAR-Small and evaluate the performance of Caro. It can be seen that our method Caro achieves superior OOD detection performance in term of F1-OOD along with the increase of unlabeled data.
|
| 380 |
+
|
| 381 |
+
Table 7: Effect of unlabeled data size on the OOD intent detection performance. The reported performance are produced on the STAR-Small dataset.
|
| 382 |
+
|
| 383 |
+
<table><tr><td rowspan=1 colspan=1>DownSample-Rate</td><td rowspan=1 colspan=1>F1-All</td><td rowspan=1 colspan=1>F1-OOD</td><td rowspan=1 colspan=1>F1-IND</td></tr><tr><td rowspan=4 colspan=1>100%75%50%25%</td><td rowspan=1 colspan=1>45.02</td><td rowspan=1 colspan=1>46.78</td><td rowspan=1 colspan=1>45.01</td></tr><tr><td rowspan=1 colspan=1>44.40</td><td rowspan=1 colspan=1>37.77</td><td rowspan=1 colspan=1>44.44</td></tr><tr><td rowspan=1 colspan=1>45.04</td><td rowspan=1 colspan=1>30.13</td><td rowspan=1 colspan=1>45.15</td></tr><tr><td rowspan=1 colspan=1>44.47</td><td rowspan=1 colspan=1>20.76</td><td rowspan=1 colspan=1>44.62</td></tr></table>
|
| 384 |
+
|
| 385 |
+
# F Analysis for Loss Weight $\lambda$
|
| 386 |
+
|
| 387 |
+
Tabel 8 reports the OOD detection results as we vary the weight $\lambda$ for $\mathcal { L } _ { I B }$ in Eq. 4. The results indicate that a relatively small weight is desirable.
|
| 388 |
+
|
| 389 |
+
Table 8: Effect of $\lambda$ on the OOD intent detection performance. The reported performance are produced on the STAR-Full dataset.
|
| 390 |
+
|
| 391 |
+
<table><tr><td>入</td><td>F1-All</td><td>F1-0OD</td><td>F1-IND</td></tr><tr><td>0.3</td><td>47.57</td><td>55.68</td><td>47.51</td></tr><tr><td>0.4</td><td>48.10</td><td>51.44</td><td>48.08</td></tr><tr><td>0.5</td><td>48.75</td><td>54.75</td><td>48.71</td></tr><tr><td>0.6</td><td>47.15</td><td>50.84</td><td>47.12</td></tr><tr><td>0.7</td><td>47.83</td><td>50.60</td><td>47.81</td></tr></table>
|
| 392 |
+
|
| 393 |
+
Table 9: Case study of classified intents on the OOD samples (from STAR-Full dataset) by Outlier and Caro. OOD samples are classified as one of the IND classes by Outlier, which are detected as the OOD intent by Caro.
|
| 394 |
+
|
| 395 |
+
<table><tr><td colspan="2">Dialogue</td><td rowspan="2">Prediction of “Outlier”</td><td rowspan="2">Prediction of “Caro”</td></tr><tr><td>Customer</td><td>Agent</td></tr><tr><td colspan="2">Somebody has transferred $5oo from my account.</td><td rowspan="2">bank_ask_pin</td><td rowspan="2">OOD</td></tr><tr><td>yes please</td><td>Would you like to file a fraud report? Could I get your full name,please?</td></tr><tr><td rowspan="2">Jane Doe</td><td></td><td rowspan="2"></td><td rowspan="2"></td></tr><tr><td>Can you tell me your account number, please?</td></tr><tr><td colspan="2">What am I doing on this chat? Hey there! Can you tell me what the weather will be tomorrow please?</td><td>weather _inform</td><td>OOD</td></tr><tr><td rowspan="2">oh dang when's the next time it will be sunny?</td><td>It will be Raining all day on Saturday in Los Angeles,with temperatures of around 19 degrees celsius.</td><td rowspan="2">_forecast</td><td rowspan="2"></td></tr><tr><td>It will be Sunny all day on Friday in Los Angeles,with temperatures of around 11 degrees celsius.</td></tr><tr><td colspan="2">Nice! I think I'll head to La brea tar pits. I've never been there.have you seen those animals? Crazy</td><td rowspan="2">bank_inform</td><td rowspan="2"></td></tr><tr><td colspan="2">apartment for Thursday at 8pm my name is john</td></tr><tr><td rowspan="2">Ican't remember</td><td>Have you already paid the application fee for the apartment?</td><td rowspan="2">_cannot _authenticate</td><td rowspan="2">OOD</td></tr><tr><td>Iam sorry, but there is no viewing available at your preferred time.</td></tr><tr><td rowspan="2">Ihave a hot date by 8pmo Thursday</td><td rowspan="2">When would you like the viewing to start?</td><td rowspan="2"></td><td rowspan="2"></td></tr><tr><td></td></tr></table>
|
md/dev/JprM0p-q0Co/JprM0p-q0Co.md
ADDED
|
@@ -0,0 +1,597 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# TACKLING THE GENERATIVE LEARNING TRILEMMA WITH DENOISING DIFFUSION GANS
|
| 2 |
+
|
| 3 |
+
Zhisheng Xiao∗ The University of Chicago zxiao@uchicago.edu
|
| 4 |
+
|
| 5 |
+
Karsten Kreis
|
| 6 |
+
NVIDIA
|
| 7 |
+
kkreis@nvidia.com
|
| 8 |
+
Arash Vahdat
|
| 9 |
+
NVIDIA
|
| 10 |
+
avahdat@nvidia.com
|
| 11 |
+
|
| 12 |
+
# ABSTRACT
|
| 13 |
+
|
| 14 |
+
A wide variety of deep generative models has been developed in the past decade. Yet, these models often struggle with simultaneously addressing three key requirements including: high sample quality, mode coverage, and fast sampling. We call the challenge imposed by these requirements the generative learning trilemma, as the existing models often trade some of them for others. Particularly, denoising diffusion models have shown impressive sample quality and diversity, but their expensive sampling does not yet allow them to be applied in many real-world applications. In this paper, we argue that slow sampling in these models is fundamentally attributed to the Gaussian assumption in the denoising step which is justified only for small step sizes. To enable denoising with large steps, and hence, to reduce the total number of denoising steps, we propose to model the denoising distribution using a complex multimodal distribution. We introduce denoising diffusion generative adversarial networks (denoising diffusion GANs) that model each denoising step using a multimodal conditional GAN. Through extensive evaluations, we show that denoising diffusion GANs obtain sample quality and diversity competitive with original diffusion models while being $2 0 0 0 \times$ faster on the CIFAR-10 dataset. Compared to traditional GANs, our model exhibits better mode coverage and sample diversity. To the best of our knowledge, denoising diffusion GAN is the first model that reduces sampling cost in diffusion models to an extent that allows them to be applied to real-world applications inexpensively. Project page and code: https://nvlabs.github.io/denoising-diffusion-gan.
|
| 15 |
+
|
| 16 |
+
# 1 INTRODUCTION
|
| 17 |
+
|
| 18 |
+
In the past decade, a plethora of deep generative models has been developed for various domains such as images (Karras et al., 2019; Razavi et al., 2019), audio (Oord et al., 2016a; Kong et al., 2021), point clouds (Yang et al., 2019) and graphs (De Cao & Kipf, 2018). However, current generative learning frameworks cannot yet simultaneously satisfy three key requirements, often needed for their wide adoption in real-world problems. These requirements include (i) high-quality sampling, (ii) mode coverage and sample diversity, and (iii) fast and computationally inexpensive sampling. For example, most current works in image synthesis focus on high-quality generation. However, mode coverage and data diversity are important for better representing minorities and for reducing the negative social impacts of generative models. Additionally, applications such as interactive image editing or real-time speech synthesis require fast sampling. Here, we identify the challenge posed by these requirements as the generative learning trilemma, since existing models usually compromise between them.
|
| 19 |
+
|
| 20 |
+

|
| 21 |
+
Figure 1: Generative learning trilemma.
|
| 22 |
+
|
| 23 |
+
Fig. 1 summarizes how mainstream generative frameworks tackle the trilemma. Generative adversarial networks (GANs) (Goodfellow et al., 2014; Brock et al., 2018) generate high-quality samples rapidly, but they have poor mode coverage (Salimans et al., 2016; Zhao et al., 2018). Conversely, variational autoencoders (VAEs) (Kingma & Welling, 2014; Rezende et al., 2014) and normalizing flows (Dinh et al., 2016; Kingma & Dhariwal, 2018) cover data modes faithfully, but they often suffer from low sample quality. Recently, diffusion models (Sohl-Dickstein et al., 2015; Ho et al., 2020; Song et al., 2021c) have emerged as powerful generative models. They demonstrate surprisingly good results in sample quality, beating GANs in image generation (Dhariwal & Nichol, 2021; Ho et al., 2021). They also obtain good mode coverage, indicated by high likelihood (Song et al., 2021b; Kingma et al., 2021; Huang et al., 2021). Although diffusion models have been applied to a variety of tasks (Dhariwal & Nichol; Austin et al.; Mittal et al.; Luo & Hu), sampling from them often requires thousands of network evaluations, making their application expensive in practice.
|
| 24 |
+
|
| 25 |
+
In this paper, we tackle the generative learning trilemma by reformulating denoising diffusion models specifically for fast sampling while maintaining strong mode coverage and sample quality. We investigate the slow sampling issue of diffusion models and we observe that diffusion models commonly assume that the denoising distribution can be approximated by Gaussian distributions. However, it is known that the Gaussian assumption holds only in the infinitesimal limit of small denoising steps (Sohl-Dickstein et al., 2015; Feller, 1949), which leads to the requirement of a large number of steps in the reverse process. When the reverse process uses larger step sizes (i.e., it has fewer denoising steps), we need a non-Gaussian multimodal distribution for modeling the denoising distribution. Intuitively, in image synthesis, the multimodal distribution arises from the fact that multiple plausible clean images may correspond to the same noisy image.
|
| 26 |
+
|
| 27 |
+
Inspired by this observation, we propose to parametrize the denoising distribution with an expressive multimodal distribution to enable denoising for large steps. In particular, we introduce a novel generative model, termed as denoising diffusion GAN, in which the denoising distributions are modeled with conditional GANs. In image generation, we observe that our model obtains sample quality and mode coverage competitive with diffusion models, while taking only as few as two denoising steps, achieving about $2 0 0 0 \times$ speed-up in sampling compared to the predictor-corrector sampling by Song et al. (2021c) on CIFAR-10. Compared to traditional GANs, we show that our model significantly outperforms state-of-the-art GANs in sample diversity, while being competitive in sample fidelity.
|
| 28 |
+
|
| 29 |
+
In summary, we make the following contributions: i) We attribute the slow sampling of diffusion models to the Gaussian assumption in the denoising distribution and propose to employ complex, multimodal denoising distributions. ii) We propose denoising diffusion GANs, a diffusion model whose reverse process is parametrized by conditional GANs. iii) Through careful evaluations, we demonstrate that denoising diffusion GANs achieve several orders of magnitude speed-up compared to current diffusion models for both image generation and editing. We show that our model overcomes the deep generative learning trilemma to a large extent, making diffusion models for the first time applicable to interactive, real-world applications at a low computational cost.
|
| 30 |
+
|
| 31 |
+
# 2 BACKGROUND
|
| 32 |
+
|
| 33 |
+
In diffusion models (Sohl-Dickstein et al., 2015; Ho et al., 2020), there is a forward process that gradually adds noise to the data $\mathbf { x } _ { 0 } \sim q ( \mathbf { x } _ { 0 } )$ in $T$ steps with pre-defined variance schedule $\beta _ { t }$ :
|
| 34 |
+
|
| 35 |
+
$$
|
| 36 |
+
q ( \mathbf { x } _ { 1 : T } | \mathbf { x } _ { 0 } ) = \prod _ { t \geq 1 } q ( \mathbf { x } _ { t } | \mathbf { x } _ { t - 1 } ) , \quad q ( \mathbf { x } _ { t } | \mathbf { x } _ { t - 1 } ) = \mathcal { N } ( \mathbf { x } _ { t } ; \sqrt { 1 - \beta _ { t } } \mathbf { x } _ { t - 1 } , \beta _ { t } \mathbf { I } ) ,
|
| 37 |
+
$$
|
| 38 |
+
|
| 39 |
+
where $q ( \mathbf { x } _ { 0 } )$ is a data-generating distribution. The reverse denoising process is defined by:
|
| 40 |
+
|
| 41 |
+
$$
|
| 42 |
+
p _ { \theta } ( \mathbf { x } _ { 0 : T } ) = p ( \mathbf { x } _ { T } ) \prod _ { t \geq 1 } p _ { \theta } ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } ) , \quad p _ { \theta } ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } ) = \mathcal { N } ( \mathbf { x } _ { t - 1 } ; \mu _ { \theta } ( \mathbf { x } _ { t } , t ) , \sigma _ { t } ^ { 2 } \mathbf { I } ) ,
|
| 43 |
+
$$
|
| 44 |
+
|
| 45 |
+
where $\mu _ { \theta } ( \mathbf { x } _ { t } , t )$ and $\sigma _ { t } ^ { 2 }$ are the mean and variance for the denoising model and $\theta$ denotes its parameters. The goal of training is to maximize the likelihood $\begin{array} { r } { p _ { \theta } ( \mathbf { x } _ { 0 } ) = \breve { \int } p _ { \theta } ( \mathbf { x } _ { 0 : T } ) d \mathbf { x } _ { 1 : T } } \end{array}$ , by maximizing the evidence lower bound (ELBO, $\mathcal { L } \leq \log p _ { \theta } ( \mathbf { x } _ { 0 } ) )$ . The ELBO can be written as matching the true denoising distribution $q \big ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } \big )$ with the parameterized denoising model $p _ { \theta } ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } )$ using:
|
| 46 |
+
|
| 47 |
+
$$
|
| 48 |
+
\mathcal { L } = - \sum _ { t \geq 1 } \mathbb { E } _ { q ( \mathbf { x } _ { t } ) } \left[ D _ { \mathrm { K L } } \left( q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } ) \| p _ { \theta } ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } ) \right) \right] + C ,
|
| 49 |
+
$$
|
| 50 |
+
|
| 51 |
+
where $C$ contains constant terms that are independent of $\theta$ and $D _ { \mathrm { K L } }$ denotes the Kullback-Leibler (KL) divergence. The objective above is intractable due to the unavailability of $q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } )$ . Instead,
|
| 52 |
+
|
| 53 |
+

|
| 54 |
+
Figure 2: Top: The evolution of 1D data distribution $q ( \mathbf { x } _ { 0 } )$ through the diffusion process. Bottom:, The visualization of the true denoising distribution for varying step sizes conditioned on a fixed $\mathbf { x } _ { 5 }$ . The true denoising distribution for a small step size (i.e., $q ( \mathbf { x } _ { 4 } | \mathbf { x } _ { 5 } = X ) ,$ ) is close to a Gaussian distribution. However, it becomes more complex and multimodal as the step size increases.
|
| 55 |
+
|
| 56 |
+
Sohl-Dickstein et al. (2015) show that $\mathcal { L }$ can be written in an alternative form with tractable distributions (see Appendix A of Ho et al. (2020) for details). Ho et al. (2020) show the equivalence of this form with score-based models trained with denoising score matching (Song & Ermon, 2019; 2020).
|
| 57 |
+
|
| 58 |
+
Two key assumptions are commonly made in diffusion models: First, the denoising distribution $p _ { \theta } ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } )$ is modeled with a Gaussian distribution. Second, the number of denoising steps $T$ is often assumed to be in the order of hundreds to thousands of steps. In this paper, we focus on discrete-time diffusion models. In continuous-time diffusion models (Song et al., 2021c), similar assumptions are also made at the sampling time when discretizing time into small timesteps.
|
| 59 |
+
|
| 60 |
+
# 3 DENOISING DIFFUSION GANS
|
| 61 |
+
|
| 62 |
+
We first discuss why reducing the number of denoising steps requires learning a multimodal denoising distribution in Sec. 3.1. Then, we present our multimodal denoising model in Sec. 3.2.
|
| 63 |
+
|
| 64 |
+
# 3.1 MULTIMODAL DENOISING DISTRIBUTIONS FOR LARGE DENOISING STEPS
|
| 65 |
+
|
| 66 |
+
As we discussed in Sec. 2, a common assumption in the diffusion model literature is to approximate $q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } )$ with a Gaussian distribution. Here, we question when such an approximation is accurate.
|
| 67 |
+
|
| 68 |
+
The true denoising distribution $q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } )$ can be written as $q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } ) \propto q ( \mathbf { x } _ { t } | \mathbf { x } _ { t - 1 } ) q ( \mathbf { x } _ { t - 1 } )$ using Bayes’ rule where $q \big ( \mathbf { x } _ { t } | \mathbf { x } _ { t - 1 } \big )$ is the forward Gaussian diffusion shown in Eq. 1 and $q ( \mathbf { x } _ { t - 1 } )$ is the marginal data distribution at step $t$ . It can be shown that in two situations the true denoising distribution takes a Gaussian form. First, in the limit of infinitesimal step size $\beta _ { t }$ , the product in the Bayes’ rule is dominated by $q \big ( \mathbf { x } _ { t } | \mathbf { x } _ { t - 1 } \big )$ and the reversal of the diffusion process takes an identical functional form as the forward process (Feller, 1949). Thus, when $\beta _ { t }$ is sufficiently small, since $q \big ( \mathbf { x } _ { t } | \mathbf { x } _ { t - 1 } \big )$ is a Gaussian, the denoising distribution $q \big ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } \big )$ is also Gaussian, and the approximation used by current diffusion models can be accurate. To satisfy this, diffusion models often have thousands of steps with small $\beta _ { t }$ . Second, if data marginal $q ( \mathbf { x } _ { t } )$ is Gaussian, the denoising distribution $q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } )$ is also a Gaussian distribution. The idea of bringing data distribution $q ( \mathbf { x } _ { 0 } )$ and consequently $q ( \mathbf { x } _ { t } )$ closer to Gaussian using a VAE encoder was recently explored in LSGM (Vahdat et al., 2021). However, the problem of transforming the data to Gaussian itself is challenging and VAE encoders cannot solve it perfectly. That is why LSGM still requires tens to hundreds of steps on complex datasets.
|
| 69 |
+
|
| 70 |
+
In this paper, we argue that when neither of the conditions are met, i.e., when the denoising step is large and the data distribution is non-Gaussian, there are no guarantees that the Gaussian assumption on the denoising distribution holds. To illustrate this, in Fig. 2, we visualize the true denoising distribution for different denoising step sizes for a multimodal data distribution. We see that as the denoising step gets larger, the true denoising distribution becomes more complex and multimodal.
|
| 71 |
+
|
| 72 |
+
# 3.2 MODELING DENOISING DISTRIBUTIONS WITH CONITIONAL GANS
|
| 73 |
+
|
| 74 |
+
Our goal is to reduce the number of denoising diffusion steps $T$ required in the reverse process of diffusion models. Inspired by the observation above, we propose to model the denoising distribution with an expressive multimodal distribution. Since conditional GANs have been shown to model complex conditional distributions in the image domain (Mirza & Osindero, 2014; Ledig et al., 2017; Isola et al., 2017), we adopt them to approximate the true denoising distribution $q \big ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } \big )$ .
|
| 75 |
+
|
| 76 |
+
Specifically, our forward diffusion is set up similarly to the diffusion models in Eq. 1 with the main assumption that $T$ is assumed to be small $T \leq 8 ,$ ) and each diffusion step has larger $\beta _ { t }$ . Our training is formulated by matching the conditional GAN generator $p _ { \theta } ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } )$ and $q \big ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } \big )$ using an adversarial loss that minimizes a divergence $D _ { \mathrm { a d v } }$ per denoising step:
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
\underset { \theta } { \operatorname* { m i n } } \sum _ { t \geq 1 } \mathbb { E } _ { q ( \mathbf { x } _ { t } ) } \left[ D _ { \mathrm { a d v } } \big ( q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } ) \big | \big | p _ { \theta } \big ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } \big ) \big ) \right] ,
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
where $D _ { \mathrm { a d v } }$ can be Wasserstein distance, Jenson-Shannon divergence, or f-divergence depending on the adversarial training setup (Arjovsky et al., 2017; Goodfellow et al., 2014; Nowozin et al., 2016). In this paper, we rely on non-saturating GANs (Goodfellow et al., 2014), that are widely used in successful GAN frameworks such as StyleGANs (Karras et al., 2019; 2020b). In this case, $D _ { \mathrm { a d v } }$ takes a special instance of f-divergence called softened reverse $K L$ (Shannon et al., 2020), which is different from the forward KL divergence used in the original diffusion model training in Eq. $3 ^ { 1 }$ .
|
| 83 |
+
|
| 84 |
+
To set up the adversarial training, we denote the time-dependent discriminator as $D _ { \phi } ( \mathbf { x } _ { t - 1 } , \mathbf { x } _ { t } , t ) :$ $\mathbb { R } ^ { N } \times \mathbb { R } ^ { N } \times \mathbb { R } \to [ 0 , 1 ]$ , with parameters $\phi$ . It takes the $N$ -dimensional $\mathbf { x } _ { t - 1 }$ and $\mathbf { x } _ { t }$ as inputs, and decides whether $\mathbf { x } _ { t - 1 }$ is a plausible denoised version of $\mathbf { x } _ { t }$ . The discriminator is trained by:
|
| 85 |
+
|
| 86 |
+
$$
|
| 87 |
+
\operatorname* { m i n } _ { \phi } \sum _ { t \geq 1 } \mathbb { E } _ { q ( \mathbf { x } _ { t } ) } \big [ \mathbb { E } _ { q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } ) } [ - \log ( D _ { \phi } ( \mathbf { x } _ { t - 1 } , \mathbf { x } _ { t } , t ) ] + \mathbb { E } _ { p _ { \theta } ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } ) } [ - \log ( 1 - D _ { \phi } ( \mathbf { x } _ { t - 1 } , \mathbf { x } _ { t } , t ) ) ] \big ] ,
|
| 88 |
+
$$
|
| 89 |
+
|
| 90 |
+
where fake samples from $p _ { \theta } ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } )$ are contrasted against real samples from $q \big ( \mathbf { x } _ { t - 1 } \big | \mathbf { x } _ { t } \big )$ . The first expectation requires sampling from $q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } )$ which is unknown. However, we use the identity $\begin{array} { r } { q ( \mathbf { x } _ { t } , \mathbf { x } _ { t - 1 } ) = \int d \mathbf { x } _ { 0 } q ( \mathbf { x } _ { 0 } ) q ( \mathbf { x } _ { t } , \mathbf { x } _ { t - 1 } | \mathbf { x } _ { 0 } ) = \int d \mathbf { x } _ { 0 } q ( \mathbf { x } _ { 0 } ) q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { 0 } ) q ( \mathbf { x } _ { t } | \mathbf { x } _ { t - 1 } ) } \end{array}$ to rewrite the first expectation in Eq. 5 as:
|
| 91 |
+
|
| 92 |
+
$$
|
| 93 |
+
\begin{array} { r } { \mathbb { E } _ { q ( \mathbf { x } _ { t } ) q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } ) } \big [ - \log ( D _ { \phi } ( \mathbf { x } _ { t - 1 } , \mathbf { x } _ { t } , t ) ) \big ] = \mathbb { E } _ { q ( \mathbf { x } _ { 0 } ) q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { 0 } ) q ( \mathbf { x } _ { t } | \mathbf { x } _ { t - 1 } ) } \big [ - \log ( D _ { \phi } ( \mathbf { x } _ { t - 1 } , \mathbf { x } _ { t } , t ) ) \big ] . } \end{array}
|
| 94 |
+
$$
|
| 95 |
+
|
| 96 |
+
Given the discriminator, we train the generator by maxθ $\begin{array} { r } { \sum _ { t \geq 1 } \mathbb { E } _ { q ( \mathbf { x } _ { t } ) } \mathbb { E } _ { p _ { \theta } ( \mathbf { x } _ { t - 1 } \mid \mathbf { x } _ { t } ) } [ \log ( D _ { \phi } ( \mathbf { x } _ { t - 1 } , \mathbf { x } _ { t } , t ) ) ] . } \end{array}$ which updates the generator with the non-saturating GAN objective (Goodfellow et al., 2014).
|
| 97 |
+
|
| 98 |
+
Parametrizing the implicit denoising model: Instead of directly predicting $\mathbf { x } _ { t - 1 }$ in the denoising step, diffusion models (Ho et al., 2020) can be interpreted as parameterizing the denoising model by $p _ { \theta } ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } ) : = q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } , \mathbf { x } _ { 0 } = f _ { \theta } ( \mathbf { x } _ { t } , t ) )$ in which first $\mathbf { x } _ { \mathrm { 0 } }$ is predicted using the denoising model $f _ { \theta } ( \mathbf { x } _ { t } , t )$ , and then, $\mathbf { x } _ { t - 1 }$ is sampled using the posterior distribution $q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } , \mathbf { x } _ { 0 } )$ given $\mathbf { x } _ { t }$ and the predicted $\mathbf { x } _ { \mathrm { 0 } }$ (See Appendix $\mathbf { B }$ for details). The distribution $q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { 0 } , \mathbf { x } _ { t } )$ is intuitively the distribution over $\mathbf { x } _ { t - 1 }$ when denoising from $\mathbf { x } _ { t }$ towards $\mathbf { x } _ { \mathrm { 0 } }$ , and it always has a Gaussian form for the diffusion process in Eq. 1, independent of the step size and complexity of the data distribution (see Appendix A for the expression of $q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { 0 } , \mathbf { x } _ { t } ) )$ . Similarly, we define $p _ { \theta } ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } )$ by:
|
| 99 |
+
|
| 100 |
+
$$
|
| 101 |
+
p _ { \theta } ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } ) : = \int p _ { \theta } ( \mathbf { x } _ { 0 } | \mathbf { x } _ { t } ) q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } , \mathbf { x } _ { 0 } ) d \mathbf { x } _ { 0 } = \int p ( \mathbf { z } ) q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } , \mathbf { x } _ { 0 } = G _ { \theta } ( \mathbf { x } _ { t } , \mathbf { z } , t ) ) d \mathbf { z } ,
|
| 102 |
+
$$
|
| 103 |
+
|
| 104 |
+
where $p _ { \theta } ( \mathbf { x } _ { 0 } | \mathbf { x } _ { t } )$ is the implicit distribution imposed by the GAN generator $G _ { \theta } ( \mathbf { x } _ { t } , \mathbf { z } , t ) : \mathbb { R } ^ { N } \times \mathbb { R } ^ { L } \times$ $\mathbb { R } \to \mathbb { R } ^ { N }$ that outputs $\mathbf { x } _ { \mathrm { 0 } }$ given $\mathbf { x } _ { t }$ and an $L$ -dimensional latent variable $\mathbf { z } \sim p ( \mathbf { z } ) : = \mathcal { N } ( \mathbf { z } ; \mathbf { 0 } , \mathbf { I } )$ .
|
| 105 |
+
|
| 106 |
+
Our parameterization has several advantages: Firstly, our $p _ { \theta } ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } )$ is formulated similar to DDPM (Ho et al., 2020). Thus, we can borrow some inductive bias such as the network structure design from DDPM. The main difference is that, in DDPM, $\mathbf { x } _ { \mathrm { 0 } }$ is predicted as a deterministic mapping of $\mathbf { x } _ { t }$ , while in our case $\mathbf { x } _ { \mathrm { 0 } }$ is produced by the generator with random latent variable $\mathbf { z }$ . This is the key difference that allows our denoising distribution $p _ { \theta } ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } )$ to become multimodal and complex in contrast to the unimodal denoising model in DDPM. Secondly, note that for different $t$ ’s, $\mathbf { x } _ { t }$ has different levels of perturbation, and hence using a single network to predict $\mathbf { x } _ { t - 1 }$ directly at different $t$ may be difficult. However, in our case the generator only needs to predict unperturbed $\mathbf { x } _ { \mathrm { 0 } }$ and then add back perturbation using $q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } , \mathbf { x } _ { 0 } )$ . Fig. 3 visualizes our training pipeline.
|
| 107 |
+
|
| 108 |
+
# Advantage over one-shot generator:
|
| 109 |
+
|
| 110 |
+
One natural question for our model is, why not just train a GAN that can generate samples in one shot using a traditional setup, in contrast to our model that generates samples by denoising iteratively? Our model has several advantages over traditional GANs. GANs are known to suffer from training instability and mode collapse (Kodali et al., 2017; Salimans et al., 2016), and some possible reasons include the difficulty of directly generating samples from a complex distribution in one-shot, and the overfitting issue when the discriminator
|
| 111 |
+
|
| 112 |
+

|
| 113 |
+
Figure 3: The training process of denoising diffusion GAN.
|
| 114 |
+
|
| 115 |
+
only looks at clean samples. In contrast, our model breaks the generation process into several conditional denoising diffusion steps in which each step is relatively simple to model, due to the strong conditioning on $\mathbf { x } _ { t }$ . Moreover, the diffusion process smoothens the data distribution (Lyu, 2012), making the discriminator less likely to overfit. Thus, we expect our model to exhibit better training stability and mode coverage. We empirically verify the advantages over traditional GANs in Sec. 5.
|
| 116 |
+
|
| 117 |
+
# 4 RELATED WORK
|
| 118 |
+
|
| 119 |
+
Diffusion-based models (Sohl-Dickstein et al., 2015; Ho et al., 2020) learn the finite-time reversal of a diffusion process, sharing the idea of learning transition operators of Markov chains with Goyal et al. (2017); Alain et al. (2016); Bordes et al. (2017). Since then, there have been a number of improvements and alternatives to diffusion models. Song et al. (2021c) generalize diffusion processes to continuous time, and provide a unified view of diffusion models and denoising score matching (Vincent, 2011; Song & Ermon, 2019). Jolicoeur-Martineau et al. (2021b) add an auxiliary adversarial loss to the main objective. This is fundamentally different from ours, as their auxiliary adversarial loss only acts as an image enhancer, and they do not use latent variables; therefore, the denoising distribution is still a unimodal Gaussian. Other explorations include introducing alternative noise distributions in the forward process (Nachmani et al., 2021), jointly optimizing the model and noise schedule (Kingma et al., 2021) and applying the model in latent spaces (Vahdat et al., 2021).
|
| 120 |
+
|
| 121 |
+
One major drawback of diffusion or score-based models is the slow sampling speed due to a large number of iterative sampling steps. To alleviate this issue, multiple methods have been proposed, including knowledge distillation (Luhman & Luhman, 2021), learning an adaptive noise schedule (San-Roman et al., 2021), introducing non-Markovian diffusion processes (Song et al., 2021a; Kong & Ping, 2021), and using better SDE solvers for continuous-time models (Jolicoeur-Martineau et al., 2021a). In particular, Song et al. (2021a) uses $\mathbf { x } _ { \mathrm { 0 } }$ sampling as a crucial ingredient to their method, but their denoising distribution is still a Gaussian. These methods either suffer from significant degradation in sample quality, or still require many sampling steps as we demonstrate in Sec. 5.
|
| 122 |
+
|
| 123 |
+
Among variants of diffusion models, Gao et al. (2021) have the closest connection with our method. They propose to model the single-step denoising distribution by a conditional energy-based model (EBM), sharing the high-level idea of using expressive denoising distributions with us. However, they motivate their method from the perspective of facilitating the training of EBMs. More importantly, although only a few denoising steps are needed, expensive MCMC has to be used to sample from each denoising step, making the sampling process slow with ${ \sim } 1 8 0$ network evaluations. ImageBART (Esser et al., 2021a) explores modeling the denoising distribution of a diffusion process on discrete latent space with an auto-regressive model per step in a few denoising steps. However, the auto-regressive structure of their denoising distribution still makes sampling slow.
|
| 124 |
+
|
| 125 |
+
Since our model is trained with adversarial loss, our work is related to recent advances in improving the sample quality and diversity of GANs, including data augmentation (Zhao et al., 2020; Karras et al., 2020a), consistency regularization (Zhang et al., 2020; Zhao et al., 2021) and entropy regularization (Dieng et al., 2019). In addition, the idea of training generative models with smoothed distributions is also discussed in Meng et al. (2021a) for auto-regressive models.
|
| 126 |
+
|
| 127 |
+
# 5 EXPERIMENTS
|
| 128 |
+
|
| 129 |
+
In this section, we evaluate our proposed denoising diffusion GAN for the image synthesis problem. We begin with briefly introducing the network architecture design, while additional implementation details are presented in Appendix C. For our GAN generator, we adopt the ${ \mathrm { N C S N } } { + + }$ architecture from Song et al. (2021c) which has a U-net structure (Ronneberger et al., 2015). The conditioning $\mathbf { x } _ { t }$ is the input of the network, and time embedding is used to ensure conditioning on $t$ . We let the latent variable $\mathbf { z }$ control the normalization layers. In particular, we replace all group normalization layers (Wu & He, 2018) in ${ \mathrm { N C S N } } { + + }$ with adaptive group normalization layers in the generator, similar to Karras et al. (2019); Huang & Belongie (2017), where the shift and scale parameters in group normalization are predicted from z using a simple multi-layer fully-connected network.
|
| 130 |
+
|
| 131 |
+
# 5.1 OVERCOMING THE GENERATIVE LEARNING TRILEMMA
|
| 132 |
+
|
| 133 |
+
One major highlight of our model is that it excels at all three criteria in the generative learning trilemma. Here, we carefully evaluate our model’s performances on sample fidelity, sample diversity and sampling time, and benchmark against a comprehensive list of models on the CIFAR-10 dataset.
|
| 134 |
+
|
| 135 |
+
Evaluation criteria: We adopt the commonly used Frechet inception distance (FID) ( ´ Heusel et al., 2017) and Inception Score (IS) (Salimans et al., 2016) for evaluating sample fidelity. We use the training set as a reference to compute the FID, following common practice in the literature (see Ho et al. (2020); Karras et al. (2019) as an example). For sample diversity, we use the improved recall score from Kynka¨anniemi et al. ¨ (2019), which is an improved version of the original precision and recall metric proposed by Sajjadi et al. (2018). It is shown that an improved recall score reflects how the variation in the generated samples matches that in the training set (Kynka¨anniemi et al. ¨ , 2019). For sampling time, we use the number of function evaluations (NFE) and the clock time when generating a batch of 100 images on a V100 GPU.
|
| 136 |
+
|
| 137 |
+
Results: We present our quantitative results in Table 1. We observe that our sample quality is competitive among the best diffusion models and GANs. Although some variants of diffusion models obtain better IS and FID, they require a large number of function evaluations to generate samples (while we use only 4 denoising steps). For example, our sampling time is about $2 0 0 0 \times$ faster than the predictor-corrector sampling by Song et al. (2021c) and ${ \sim } 2 0 \times$ faster than FastDDPM (Kong & Ping, 2021). Note that diffusion models can produce samples in fewer steps while trading off the sample quality. To better benchmark our method against existing diffusion models, we plot the FID score versus sampling time of diffusion models by varying the number of denoising steps (or the error tolerance for continuous-time models) in Figure 4. The figure clearly shows the advantage of our model compared to previous diffusion models. When comparing our model to GANs, we observe that only StyleGAN2 with adaptive data augmentation has slightly better sample quality than ours. However, from Table 1, we see that GANs have limited sample diversity, as their recall scores are below 0.5. In contrast, our model obtains a significantly better recall score, even higher than several advanced likelihood-based models, and competitive among diffusion models. We show qualitative samples of CIFAR-10 in Figure 5. In summary, our model simultaneously excels at sample quality, sample diversity, and sampling speed and tackles the generative learning trilemma by a large extent.
|
| 138 |
+
|
| 139 |
+

|
| 140 |
+
Figure 4: Sample quality vs sampling time trade-off.
|
| 141 |
+
|
| 142 |
+

|
| 143 |
+
Figure 5: CIFAR-10 qualitative samples.
|
| 144 |
+
|
| 145 |
+
Table 1: Results for unconditional generation on CIFAR-10.
|
| 146 |
+
|
| 147 |
+
<table><tr><td>Model</td><td>IS↑</td><td>FID↓</td><td>Recall↑</td><td>NFE↓</td><td>Time (s)↓</td></tr><tr><td>Denoising Diffusion GAN (ours), T=4</td><td>9.63</td><td>3.75</td><td>0.57</td><td>4</td><td>0.21</td></tr><tr><td>DDPM (Ho et al., 2020)</td><td>9.46</td><td>3.21</td><td>0.57</td><td>1000</td><td>80.5</td></tr><tr><td>NCSN (Song & Ermon,2019)</td><td>8.87</td><td>25.3</td><td>1</td><td>1000</td><td>107.9</td></tr><tr><td>Adversarial DSM (Jolicoeur-Martineau et al., 2021b)</td><td>1</td><td>6.10</td><td>=</td><td>1000</td><td>-</td></tr><tr><td>Likelihood SDE (Song et al., 2021b)</td><td>=</td><td>2.87</td><td>-</td><td>-</td><td>-</td></tr><tr><td>Score SDE(VE) (Song et al.,2021c)</td><td>9.89</td><td>2.20</td><td>0.59</td><td>2000</td><td>423.2</td></tr><tr><td>Score SDE(VP) (Song et al.,2021c)</td><td>9.68</td><td>2.41</td><td>0.59</td><td>2000</td><td>421.5</td></tr><tr><td>Probability Flow (VP) (Song et al.,2021c)</td><td>9.83</td><td>3.08</td><td>0.57</td><td>140</td><td>50.9</td></tr><tr><td>LSGM(Vahdat et al.,2021)</td><td>9.87</td><td>2.10</td><td>0.61</td><td>147</td><td>44.5</td></tr><tr><td>DDIM, T=50 (Song et al., 2021a)</td><td>8.78</td><td>4.67</td><td>0.53</td><td>50</td><td>4.01</td></tr><tr><td>FastDDPM,T=50 (Kong& Ping,2021)</td><td>8.98</td><td>3.41</td><td>0.56</td><td>50</td><td>4.01</td></tr><tr><td>Recovery EBM (Gao et al.,2021)</td><td>8.30</td><td>9.58</td><td>-</td><td>180</td><td>-</td></tr><tr><td>Improved DDPM (Nichol & Dhariwal, 2021)</td><td>-</td><td>2.90</td><td>-</td><td>4000</td><td></td></tr><tr><td>VDM (Kingma et al., 2021)</td><td>-</td><td>4.00</td><td></td><td>1000</td><td></td></tr><tr><td>UDM (Kim et al., 2021)</td><td>10.1</td><td>2.33</td><td></td><td>2000</td><td></td></tr><tr><td>D3PMs (Austin et al., 2021)</td><td>8.56</td><td>7.34</td><td></td><td>1000</td><td></td></tr><tr><td>Gotta Go Fast (Jolicoeur-Martineau et al., 2021a)</td><td>-</td><td>2.44</td><td>-</td><td>180</td><td></td></tr><tr><td>DDPMDistillation (Luhman & Luhman, 2021)</td><td>8.36</td><td>9.36</td><td>0.51</td><td>1</td><td></td></tr><tr><td>SNGAN (Miyato et al., 2018)</td><td>8.22</td><td>21.7</td><td>0.44</td><td>1</td><td></td></tr><tr><td>SNGAN+DGflow (Ansari et al., 2021)</td><td>9.35</td><td>9.62</td><td>0.48</td><td>25</td><td>1.98</td></tr><tr><td>AutoGAN (Gong et al., 2019)</td><td>8.60</td><td>12.4</td><td>0.46</td><td>1</td><td>-</td></tr><tr><td>TransGAN (Jiang et al., 2021)</td><td>9.02</td><td>9.26</td><td>-</td><td>1</td><td>1</td></tr><tr><td>StyleGAN2 w/o ADA (Karras et al., 2020a)</td><td>9.18</td><td>8.32</td><td>0.41</td><td>1</td><td>0.04</td></tr><tr><td>StyleGAN2 w/ ADA (Karras et al., 2020a)</td><td>9.83</td><td>2.92</td><td>0.49</td><td>1</td><td>0.04</td></tr><tr><td>StyleGAN2 w/Diffaug (Zhao et al., 2020)</td><td>9.40</td><td>5.79</td><td>0.42</td><td>1</td><td>0.04</td></tr><tr><td>Glow (Kingma & Dhariwal, 2018)</td><td>3.92</td><td>48.9</td><td>-</td><td>1</td><td>-</td></tr><tr><td>PixelCNN (Oord et al.,2016b)</td><td>4.60</td><td>65.9</td><td>-</td><td>1024</td><td>-</td></tr><tr><td>NVAE(Vahdat&Kautz,2020)</td><td>7.18</td><td>23.5</td><td>0.51</td><td>1</td><td>0.36</td></tr><tr><td>IGEBM(Du & Mordatch,2019)</td><td>6.02</td><td>40.6</td><td>1</td><td>60</td><td>-</td></tr><tr><td>VAEBM (Xiao et al., 2021)</td><td>8.43</td><td>12.2</td><td>0.53</td><td>16</td><td>8.79</td></tr></table>
|
| 148 |
+
|
| 149 |
+
# 5.2 ABLATION STUDIES
|
| 150 |
+
|
| 151 |
+
Here, we provide additional insights into our model by performing ablation studies.
|
| 152 |
+
|
| 153 |
+
Number of denoising steps: In the first part of Table 2, we study the effect of using a different number of denoising steps $( T )$ . Note that $T = 1$ corresponds to training an unconditional GAN, as the conditioning $\mathbf { x } _ { t }$ contains almost no information about $\mathbf { x } _ { \mathrm { 0 } }$ . We observe that $T = 1$ leads to significantly worse results with low sample diversity, indicated by the low recall score. This confirms the benefits of breaking generation into several denoising steps, especially for improving the sample diversity. When varying $T > 1$ , we observe that $T = 4$ gives the best results, whereas there is a slight degrade in performance for larger $T$ . We hypothesize that we may require a significantly higher capacity to accommodate larger $T$ , as we need a conditional GAN for each denoising step.
|
| 154 |
+
|
| 155 |
+
Diffusion as data augmentation: Our model shares some similarities with recent work on applying data augmentation to GANs (Karras et al., 2020a; Zhao et al., 2020). To study the effect of perturbing inputs, we train a one-shot GAN with our network structure following the protocol in (Zhao et al., 2020) with the forward diffusion process as data augmentation. The result, presented in the second group of Table 2, is significantly worse than our model, indicating that our model is not equivalent to augmenting data before applying the discriminator.
|
| 156 |
+
|
| 157 |
+
Parametrization for $p _ { \theta } ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } )$ : We study two alternative ways to parametrize the denoising distribution for the same $T = 4$ setting. Instead of letting the generator produce estimated samples of $\mathbf { x } _ { \mathrm { 0 } }$ , we set the generator to directly output denoised samples $\mathbf x _ { t - 1 }$ without posterior sampling (direct denoising), or output the noise $\epsilon _ { t }$ that perturbs a clean image to produce $\mathbf { x } _ { t }$ (noise generation). Note that the latter case is closely related to most diffusion models where the network deterministically predicts the perturbation noise. In Table 2, we show that although these alternative parametrizations work reasonably well, our main parametrization outperforms them by a large margin.
|
| 158 |
+
|
| 159 |
+
Importance of latent variable: Removing latent variables $\mathbf { z }$ converts our denoising model to a unimodal distribution. In the last line of Table 2, we study our model’s performance without any latent variables $\mathbf { z }$ . We see that the sample quality is significantly worse, suggesting the importance of multimodal denoising distributions. In Figure 8, we visualize the effect of latent variables by showing samples of $p _ { \theta } ( \mathbf { x } _ { 0 } | \mathbf { x } _ { 1 } )$ , where $\mathbf { x } _ { 1 }$ is a fixed noisy observation. We see that while the majority of information in the conditioning $\mathbf { x } _ { 1 }$ is preserved, the samples are diverse due to the latent variables.
|
| 160 |
+
|
| 161 |
+
Table 2: Ablation studies on CIFAR-10.
|
| 162 |
+
|
| 163 |
+
<table><tr><td>Model Variants</td><td>IS↑</td><td>FID↓</td><td>Recall个</td></tr><tr><td>T=1</td><td>8.93</td><td>14.6</td><td>0.19</td></tr><tr><td>T=2</td><td>9.80</td><td>4.08</td><td>0.54</td></tr><tr><td>T=4</td><td>9.63</td><td>3.75</td><td>0.57</td></tr><tr><td>T=8</td><td>9.43</td><td>4.36</td><td>0.56</td></tr><tr><td>One-shot w/ aug</td><td>8.96</td><td>13.2</td><td>0.25</td></tr><tr><td>Direct denoising</td><td>9.10</td><td>6.03</td><td>0.53</td></tr><tr><td>Noise generation</td><td>8.79</td><td>8.04</td><td>0.52</td></tr><tr><td>No latent variable</td><td>8.37</td><td>20.6</td><td>0.42</td></tr></table>
|
| 164 |
+
|
| 165 |
+
Table 3: Mode coverage on StackedMNIST.
|
| 166 |
+
|
| 167 |
+
<table><tr><td>Model</td><td>Modes↑</td><td>KL↓</td></tr><tr><td>VEEGAN (Srivastava et al.)</td><td>762</td><td>2.173</td></tr><tr><td>PacGAN (Lin et al.)</td><td>992</td><td>0.277</td></tr><tr><td>PresGAN (Dieng et al.)</td><td>1000</td><td>0.115</td></tr><tr><td>InclusiveGAN (Yu et al.)</td><td>997</td><td>0.200</td></tr><tr><td>StyleGAN2 (Karras et al.)</td><td>940</td><td>0.424</td></tr><tr><td>Adv. DSM (Jolicoeur-Martineau et al.)</td><td>1000</td><td>1.49</td></tr><tr><td>VAEBM (Xiao et al.)</td><td>1000</td><td>0.087</td></tr><tr><td>Denoising Diffusion GAN (ours)</td><td>1000</td><td>0.071</td></tr></table>
|
| 168 |
+
|
| 169 |
+
# 5.3 ADDITIONAL STUDIES
|
| 170 |
+
|
| 171 |
+
Mode Coverage: Besides the recall score in Table 1, we also evaluate the mode coverage of our model on the popular 25-Gaussians and StackedMNIST. The 25-Gaussians dataset is a 2-D toy dataset, generated by a mixture of 25 two-dimensional Gaussian distributions, arranged in a grid. We train our denoising diffusion GAN with 4 denoising steps and compare it to other models in Figure 6. We observe that the vanilla GAN suffers severely from mode collapse, and while techniques like WGAN-GP (Gulrajani et al., 2017) improve mode coverage, the sample quality is still limited. In contrast, our model covers all the modes while maintaining high sample quality. We also train a diffusion model and plot the samples generated by 100 and 500 denoising steps. We see that diffusion models require a large number of steps to maintain high sample quality.
|
| 172 |
+
|
| 173 |
+

|
| 174 |
+
Figure 6: Qualitative results on the 25-Gaussians dataset.
|
| 175 |
+
|
| 176 |
+
StackMNIST contains images generated by randomly choosing 3 MNIST images and stacking them along the RGB channels. Hence, the data distribution has 1000 modes. Following the setting of Lin et al. (2018), we report the number of covered modes and the KL divergence from the categorical distribution over 1000 categories of generated samples to true data in Table 3. We observe that our model covers all modes faithfully and achieves the lowest KL compared to GANs that are specifically designed for better mode coverage or StyleGAN2 that is known to have the best sample quality.
|
| 177 |
+
|
| 178 |
+
Training Stability: We discuss the training stability of our model in Appendix D.
|
| 179 |
+
|
| 180 |
+
High Resolution Images: We train our model on datasets with larger images, including CelebAHQ (Karras et al., 2018) and LSUN Church (Yu et al., 2015) at $2 5 6 \times 2 5 6 \mathrm { p x }$ resolution. We report FID on these two datasets in Table 4 and 5. Similar to CIFAR-10, our model obtains competitive sample quality among the best diffusion models and GANs. In particular, in LSUN Church, our model outperforms DDPM and ImageBART (see Figure 7 and Appendix E for samples). Although, some GANs perform better on this dataset, their mode coverage is not reflected by the FID score.
|
| 181 |
+
|
| 182 |
+
Stroke-based image synthesis: Recently, Meng et al. (2021b) propose an interesting application of diffusion models to stroke-based generation. Specifically, they perturb a stroke painting by the forward diffusion process, and denoise it with a diffusion model. The method is particularly promising because it only requires training an unconditional generative model on the target dataset and does not require training images paired with stroke paintings like GAN-based methods (Sangkloy et al., 2017; Park et al., 2019). We apply our model to stroke-based image synthesis and show qualitative results in Figure 9. The generated samples are realistic and diverse, while the conditioning in the stroke paintings is faithfully preserved. Compared to Meng et al. (2021b), our model enjoys a $1 1 0 0 \times$ speedup in generation, as it takes only 0.16s to generate one image at 256 resolution vs. 181s for Meng et al. (2021b). This experiment confirms that our proposed model enables the application of diffusion models to interactive applications such as image editing.
|
| 183 |
+
|
| 184 |
+
Table 4: Generative results on CelebA-HQ-256
|
| 185 |
+
|
| 186 |
+
<table><tr><td>Model</td><td>FID↓</td></tr><tr><td>Denoising Diffusion GAN (ours)</td><td>7.64</td></tr><tr><td>Score SDE (Song et al., 2021c) LSGM (Vahdat et al., 2021) UDM (Kim et al., 2021)</td><td>7.23 7.22 7.16</td></tr><tr><td>NVAE(Vahdat & Kautz, 2020) VAEBM (Xiao et al., 2021)</td><td>29.7 20.4</td></tr><tr><td>NCP-VAE (Aneja et al.,2021)</td><td>24.8</td></tr><tr><td>PGGAN (Karras et al., 2018) Adv.LAE (Pidhorskyi et al., 2020)</td><td>8.03</td></tr><tr><td></td><td>19.2</td></tr><tr><td>VQ-GAN (Esser et al., 2021b) DC-AE (Parmar et al., 2021)</td><td>10.2 15.8</td></tr></table>
|
| 187 |
+
|
| 188 |
+
Table 5: Generative results on LSUN Church 256
|
| 189 |
+
|
| 190 |
+
<table><tr><td>Model</td><td>FID↓</td></tr><tr><td>Denoising Diffusion GAN (ours)</td><td>5.25</td></tr><tr><td>DDPM (Ho et al., 2020)</td><td>7.89</td></tr><tr><td>ImageBART (Esser et al., 2021a) Gotta Go Fast (Jolicoeur-Martineau et al.)</td><td>7.32 25.67</td></tr><tr><td>PGGAN (Karras et al., 2018))</td><td>6.42</td></tr><tr><td>StyleGAN (Karras et al., 2019)</td><td>4.21</td></tr><tr><td>StyleGAN2 (Karras et al., 2020b)</td><td>3.86</td></tr><tr><td></td><td></td></tr><tr><td>CIPS (Anokhin et al., 2021)</td><td>2.92</td></tr></table>
|
| 191 |
+
|
| 192 |
+

|
| 193 |
+
Figure 7: Qualitative results on CelebA-HQ 256 and LSUN Church Outdoor 256.
|
| 194 |
+
|
| 195 |
+
Additional results: Additional qualitative visualizations are provided in Appendix E, F, and G.
|
| 196 |
+
|
| 197 |
+

|
| 198 |
+
Figure 8: Multi-modality of denoising distribution given the same noisy observation. Left: clean image $\mathbf { x } _ { \mathrm { 0 } }$ and perturbed image $\mathbf { x } _ { 1 }$ . Right: Three samples from $p _ { \theta } ( \mathbf { x } _ { 0 } | \mathbf { x } _ { 1 } )$ .
|
| 199 |
+
|
| 200 |
+

|
| 201 |
+
Figure 9: Qualitative results on stroke-based synthesis. Top row: stroke paintings. Bottom two rows: generated samples corresponding to the stroke painting (best seen when zoomed in).
|
| 202 |
+
|
| 203 |
+
# 6 CONCLUSIONS
|
| 204 |
+
|
| 205 |
+
Deep generative learning frameworks still struggle with addressing the generative learning trilemma. Diffusion models achieve particularly high-quality and diverse sampling. However, their slow sampling and high computational cost do not yet allow them to be widely applied in real-world applications. In this paper, we argued that one of the main sources of slow sampling in diffusion models is the Gaussian assumption in the denoising distribution, which is justified only for very small denoising steps. To remedy this, we proposed denoising diffusion GANs that model each denoising step using a complex multimodal distribution, enabling us to take large denoising steps. In extensive experiments, we showed that denoising diffusion GANs achieve high sample quality and diversity competitive to the original diffusion models, while being orders of magnitude faster at sampling. Compared to traditional GANs, our proposed model enjoys better mode coverage and sample diversity. Our denoising diffusion GAN overcomes the generative learning trilemma to a large extent, allowing diffusion models to be applied to real-world problems with low computational cost.
|
| 206 |
+
|
| 207 |
+
# 7 ETHICS AND REPRODUCIBILITY STATEMENT
|
| 208 |
+
|
| 209 |
+
Generating high-quality samples while representing the diversity in the training data faithfully has been a daunting challenge in generative learning. Mode coverage and high diversity are key requirements for reducing biases in generative models and improving the representation of minorities in a population. While diffusion models achieve both high sample quality and diversity, their expensive sampling limits their application in many real-world problems. Our proposed denoising diffusion GAN reduces the computational complexity of diffusion models to an extent that allows these models to be applied in practical applications at a low cost. Thus, we foresee that in the long term, our model can help with reducing the negative social impacts of existing generative models that fall short in capturing the data diversity.
|
| 210 |
+
|
| 211 |
+
We evaluate our model using public datasets, and therefore this work does not involve any human subject evaluation or new data collection.
|
| 212 |
+
|
| 213 |
+
Reproducibility Statement: We currently provide experimental details in the appendices with a detailed list of hyperparameters and training settings. To aid with reproducibility further, we will release our source code publicly in the future with instructions to reproduce our results.
|
| 214 |
+
|
| 215 |
+
# REFERENCES
|
| 216 |
+
|
| 217 |
+
Guillaume Alain, Yoshua Bengio, Li Yao, Jason Yosinski, Eric Thibodeau-Laufer, Saizheng Zhang, and Pascal Vincent. Gsns: generative stochastic networks. Information and Inference: A Journal of the IMA, 5(2):210–249, 2016.
|
| 218 |
+
|
| 219 |
+
Jyoti Aneja, Alexander Schwing, Jan Kautz, and Arash Vahdat. A contrastive learning approach for training variational autoencoder priors. In Neural Information Processing Systems, 2021.
|
| 220 |
+
|
| 221 |
+
Ivan Anokhin, Kirill Demochkin, Taras Khakhulin, Gleb Sterkin, Victor Lempitsky, and Denis Korzhenkov. Image generators with conditionally-independent pixel synthesis. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2021.
|
| 222 |
+
|
| 223 |
+
Abdul Fatir Ansari, Ming Liang Ang, and Harold Soh. Refining deep generative models via discriminator gradient flow. In International Conference on Learning Representations, 2021.
|
| 224 |
+
|
| 225 |
+
Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein generative adversarial networks. ´ In International conference on machine learning, 2017.
|
| 226 |
+
|
| 227 |
+
Jacob Austin, Daniel Johnson, Jonathan Ho, Danny Tarlow, and Rianne van den Berg. Structured denoising diffusion models in discrete state-spaces. arXiv preprint arXiv:2107.03006, 2021.
|
| 228 |
+
|
| 229 |
+
Florian Bordes, Sina Honari, and Pascal Vincent. Learning to generate samples from noise through infusion training. arXiv preprint arXiv:1703.06975, 2017.
|
| 230 |
+
|
| 231 |
+
Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale gan training for high fidelity natural image synthesis. arXiv preprint arXiv:1809.11096, 2018.
|
| 232 |
+
|
| 233 |
+
Nicola De Cao and Thomas Kipf. Molgan: An implicit generative model for small molecular graphs. arXiv preprint arXiv:1805.11973, 2018.
|
| 234 |
+
|
| 235 |
+
Prafulla Dhariwal and Alex Nichol. Diffusion models beat gans on image synthesis. arXiv preprint arXiv:2105.05233, 2021.
|
| 236 |
+
|
| 237 |
+
Adji B Dieng, Francisco JR Ruiz, David M Blei, and Michalis K Titsias. Prescribed generative adversarial networks. arXiv preprint arXiv:1910.04302, 2019.
|
| 238 |
+
|
| 239 |
+
Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. Density estimation using real nvp. In International Conference on Learning Representations, 2016.
|
| 240 |
+
|
| 241 |
+
Yilun Du and Igor Mordatch. Implicit generation and modeling with energy based models. In Advances in Neural Information Processing Systems, 2019.
|
| 242 |
+
|
| 243 |
+
Patrick Esser, Robin Rombach, Andreas Blattmann, and Bjorn Ommer. Imagebart: Bidirec- ¨ tional context with multinomial diffusion for autoregressive image synthesis. arXiv preprint arXiv:2108.08827, 2021a.
|
| 244 |
+
|
| 245 |
+
Patrick Esser, Robin Rombach, and Bjorn Ommer. Taming transformers for high-resolution image synthesis. In Proceedings of the IEEE conference on computer vision and pattern recognition, 2021b.
|
| 246 |
+
|
| 247 |
+
W Feller. On the theory of stochastic processes, with particular reference to applications. In Proceedings of the [First] Berkeley Symposium on Mathematical Statistics and Probability, pp. 403–432. University of California Press, 1949.
|
| 248 |
+
|
| 249 |
+
Ruiqi Gao, Yang Song, Ben Poole, Ying Nian Wu, and Diederik P Kingma. Learning energy-based models by diffusion recovery likelihood. In International Conference on Learning Representations, 2021.
|
| 250 |
+
|
| 251 |
+
Xinyu Gong, Shiyu Chang, Yifan Jiang, and Zhangyang Wang. Autogan: Neural architecture search for generative adversarial networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, 2019.
|
| 252 |
+
|
| 253 |
+
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, 2014.
|
| 254 |
+
|
| 255 |
+
Anirudh Goyal, Nan Rosemary Ke, Surya Ganguli, and Yoshua Bengio. Variational walkback: Learning a transition operator as a stochastic recurrent net. arXiv preprint arXiv:1711.02282, 2017.
|
| 256 |
+
|
| 257 |
+
Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron Courville. Improved training of wasserstein gans. arXiv preprint arXiv:1704.00028, 2017.
|
| 258 |
+
|
| 259 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, 2016.
|
| 260 |
+
|
| 261 |
+
Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. Advances in neural information processing systems, 2017.
|
| 262 |
+
|
| 263 |
+
Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. In Advances in neural information processing systems, 2020.
|
| 264 |
+
|
| 265 |
+
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.
|
| 266 |
+
|
| 267 |
+
Chin-Wei Huang, Jae Hyun Lim, and Aaron Courville. A variational perspective on diffusion-based generative models and score matching. arXiv preprint arXiv:2106.02808, 2021.
|
| 268 |
+
|
| 269 |
+
Xun Huang and Serge Belongie. Arbitrary style transfer in real-time with adaptive instance normalization. In Proceedings of the IEEE International Conference on Computer Vision, 2017.
|
| 270 |
+
|
| 271 |
+
Phillip Isola, Jun-Yan Zhu, Tinghui Zhou, and Alexei A Efros. Image-to-image translation with conditional adversarial networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, 2017.
|
| 272 |
+
|
| 273 |
+
Yifan Jiang, Shiyu Chang, and Zhangyang Wang. Transgan: Two transformers can make one strong gan. arXiv preprint arXiv:2102.07074, 2021.
|
| 274 |
+
|
| 275 |
+
Alexia Jolicoeur-Martineau, Ke Li, Remi Pich ´ e-Taillefer, Tal Kachman, and Ioannis Mitliagkas. ´ Gotta go fast when generating data with score-based models. arXiv preprint arXiv:2105.14080, 2021a.
|
| 276 |
+
|
| 277 |
+
Alexia Jolicoeur-Martineau, Remi Pich ´ e-Taillefer, Ioannis Mitliagkas, and Remi Tachet des ´ Combes. Adversarial score matching and improved sampling for image generation. In International Conference on Learning Representations, 2021b.
|
| 278 |
+
|
| 279 |
+
Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of GANs for improved quality, stability, and variation. In International Conference on Learning Representations, 2018.
|
| 280 |
+
|
| 281 |
+
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, 2019.
|
| 282 |
+
|
| 283 |
+
Tero Karras, Miika Aittala, Janne Hellsten, Samuli Laine, Jaakko Lehtinen, and Timo Aila. Training generative adversarial networks with limited data. In Advances in neural information processing systems, 2020a.
|
| 284 |
+
|
| 285 |
+
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 conference on computer vision and pattern recognition, 2020b.
|
| 286 |
+
|
| 287 |
+
Dongjun Kim, Seungjae Shin, Kyungwoo Song, Wanmo Kang, and Il-Chul Moon. Score matching model for unbounded data score. arXiv preprint arXiv:2106.05527, 2021.
|
| 288 |
+
|
| 289 |
+
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2015.
|
| 290 |
+
|
| 291 |
+
Diederik P Kingma and Max Welling. Auto-encoding variational bayes. In The International Conference on Learning Representations, 2014.
|
| 292 |
+
|
| 293 |
+
Diederik P Kingma, Tim Salimans, Ben Poole, and Jonathan Ho. Variational diffusion models. arXiv preprint arXiv:2107.00630, 2021.
|
| 294 |
+
|
| 295 |
+
Durk P Kingma and Prafulla Dhariwal. Glow: Generative flow with invertible 1x1 convolutions. In Advances in neural information processing systems, 2018.
|
| 296 |
+
|
| 297 |
+
Naveen Kodali, Jacob Abernethy, James Hays, and Zsolt Kira. On convergence and stability of gans. arXiv preprint arXiv:1705.07215, 2017.
|
| 298 |
+
|
| 299 |
+
Zhifeng Kong and Wei Ping. On fast sampling of diffusion probabilistic models. arXiv preprint arXiv:2106.00132, 2021.
|
| 300 |
+
|
| 301 |
+
Zhifeng Kong, Wei Ping, Jiaji Huang, Kexin Zhao, and Bryan Catanzaro. Diffwave: A versatile diffusion model for audio synthesis. In International Conference on Learning Representations, 2021.
|
| 302 |
+
|
| 303 |
+
Tuomas Kynka¨anniemi, Tero Karras, Samuli Laine, Jaakko Lehtinen, and Timo Aila. Improved ¨ precision and recall metric for assessing generative models. arXiv preprint arXiv:1904.06991, 2019.
|
| 304 |
+
|
| 305 |
+
Christian Ledig, Lucas Theis, Ferenc Huszar, Jose Caballero, Andrew Cunningham, Alejandro ´ Acosta, Andrew Aitken, Alykhan Tejani, Johannes Totz, Zehan Wang, et al. Photo-realistic single image super-resolution using a generative adversarial network. In Proceedings of the IEEE conference on computer vision and pattern recognition, 2017.
|
| 306 |
+
|
| 307 |
+
Zinan Lin, Ashish Khetan, Giulia Fanti, and Sewoong Oh. Pacgan: The power of two samples in generative adversarial networks. In Advances in neural information processing systems, 2018.
|
| 308 |
+
|
| 309 |
+
Ilya Loshchilov and Frank Hutter. Sgdr: Stochastic gradient descent with warm restarts. arXiv preprint arXiv:1608.03983, 2016.
|
| 310 |
+
|
| 311 |
+
Eric Luhman and Troy Luhman. Knowledge distillation in iterative generative models for improved sampling speed. arXiv preprint arXiv:2101.02388, 2021.
|
| 312 |
+
|
| 313 |
+
Shitong Luo and Wei Hu. Diffusion probabilistic models for 3d point cloud generation. In Proceedings of the IEEE conference on computer vision and pattern recognition, 2021.
|
| 314 |
+
|
| 315 |
+
Siwei Lyu. Interpretation and generalization of score matching. arXiv preprint arXiv:1205.2629, 2012.
|
| 316 |
+
|
| 317 |
+
Chenlin Meng, Jiaming Song, Yang Song, Shengjia Zhao, and Stefano Ermon. Improved autoregressive modeling with distribution smoothing. arXiv preprint arXiv:2103.15089, 2021a.
|
| 318 |
+
|
| 319 |
+
Chenlin Meng, Yang Song, Jiaming Song, Jiajun Wu, Jun-Yan Zhu, and Stefano Ermon. Sdedit: Image synthesis and editing with stochastic differential equations. arXiv preprint arXiv:2108.01073, 2021b.
|
| 320 |
+
|
| 321 |
+
Lars Mescheder, Andreas Geiger, and Sebastian Nowozin. Which training methods for gans do actually converge? In International conference on Machine Learning, 2018.
|
| 322 |
+
|
| 323 |
+
Mehdi Mirza and Simon Osindero. Conditional generative adversarial nets. arXiv preprint arXiv:1411.1784, 2014.
|
| 324 |
+
|
| 325 |
+
Gautam Mittal, Jesse Engel, Curtis Hawthorne, and Ian Simon. Symbolic music generation with diffusion models. arXiv preprint arXiv:2103.16091, 2021.
|
| 326 |
+
|
| 327 |
+
Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. arXiv preprint arXiv:1802.05957, 2018.
|
| 328 |
+
|
| 329 |
+
Eliya Nachmani, Robin San Roman, and Lior Wolf. Non gaussian denoising diffusion models. arXiv preprint arXiv:2106.07582, 2021.
|
| 330 |
+
|
| 331 |
+
Alex Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. arXiv preprint arXiv:2102.09672, 2021.
|
| 332 |
+
|
| 333 |
+
Sebastian Nowozin, Botond Cseke, and Ryota Tomioka. f-gan: Training generative neural samplers using variational divergence minimization. In Advances in neural information processing systems, 2016.
|
| 334 |
+
|
| 335 |
+
Aaron van den Oord, Sander Dieleman, Heiga Zen, Karen Simonyan, Oriol Vinyals, Alex Graves, Nal Kalchbrenner, Andrew Senior, and Koray Kavukcuoglu. Wavenet: A generative model for raw audio. arXiv preprint arXiv:1609.03499, 2016a.
|
| 336 |
+
|
| 337 |
+
Aaron van den Oord, Nal Kalchbrenner, and Koray Kavukcuoglu. Pixel recurrent neural networks. International Conference on Machine Learning, 2016b.
|
| 338 |
+
|
| 339 |
+
Taesung Park, Ming-Yu Liu, Ting-Chun Wang, and Jun-Yan Zhu. Semantic image synthesis with spatially-adaptive normalization. In Proceedings of the IEEE conference on computer vision and pattern recognition, 2019.
|
| 340 |
+
|
| 341 |
+
Gaurav Parmar, Dacheng Li, Kwonjoon Lee, and Zhuowen Tu. Dual contradistinctive generative autoencoder. In Proceedings of the IEEE conference on computer vision and pattern recognition, 2021.
|
| 342 |
+
|
| 343 |
+
Stanislav Pidhorskyi, Donald A Adjeroh, and Gianfranco Doretto. Adversarial latent autoencoders. In Proceedings of the IEEE conference on computer vision and pattern recognition, 2020.
|
| 344 |
+
|
| 345 |
+
Ali Razavi, Aaron van den Oord, and Oriol Vinyals. Generating diverse high-fidelity images with vq-vae-2. In Advances in neural information processing systems, 2019.
|
| 346 |
+
|
| 347 |
+
Danilo Jimenez Rezende, Shakir Mohamed, and Daan Wierstra. Stochastic backpropagation and approximate inference in deep generative models. In International Conference on Machine Learning, 2014.
|
| 348 |
+
|
| 349 |
+
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. Springer, 2015.
|
| 350 |
+
|
| 351 |
+
Mehdi SM Sajjadi, Olivier Bachem, Mario Lucic, Olivier Bousquet, and Sylvain Gelly. Assessing generative models via precision and recall. arXiv preprint arXiv:1806.00035, 2018.
|
| 352 |
+
|
| 353 |
+
Tim Salimans, Ian Goodfellow, Wojciech Zaremba, Vicki Cheung, Alec Radford, and Xi Chen. Improved techniques for training gans. Advances in neural information processing systems, 2016.
|
| 354 |
+
|
| 355 |
+
Robin San-Roman, Eliya Nachmani, and Lior Wolf. Noise estimation for generative diffusion models. arXiv preprint arXiv:2104.02600, 2021.
|
| 356 |
+
|
| 357 |
+
Patsorn Sangkloy, Jingwan Lu, Chen Fang, Fisher Yu, and James Hays. Scribbler: Controlling deep image synthesis with sketch and color. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2017.
|
| 358 |
+
|
| 359 |
+
Matt Shannon, Ben Poole, Soroosh Mariooryad, Tom Bagby, Eric Battenberg, David Kao, Daisy Stanton, and RJ Skerry-Ryan. Non-saturating gan training as divergence minimization. arXiv preprint arXiv:2010.08029, 2020.
|
| 360 |
+
|
| 361 |
+
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
|
| 362 |
+
|
| 363 |
+
Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In International Conference on Machine Learning, 2015.
|
| 364 |
+
|
| 365 |
+
Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. In International Conference on Learning Representations, 2021a.
|
| 366 |
+
|
| 367 |
+
Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. In Advances in neural information processing systems, 2019.
|
| 368 |
+
|
| 369 |
+
Yang Song and Stefano Ermon. Improved techniques for training score-based generative models. arXiv preprint arXiv:2006.09011, 2020.
|
| 370 |
+
|
| 371 |
+
Yang Song, Conor Durkan, Iain Murray, and S. Ermon. Maximum likelihood training of score-based diffusion models. arXiv preprint arXiv:2101.09258, 2021b.
|
| 372 |
+
|
| 373 |
+
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, 2021c.
|
| 374 |
+
|
| 375 |
+
Akash Srivastava, Lazar Valkov, Chris Russell, Michael U Gutmann, and Charles Sutton. Veegan: Reducing mode collapse in gans using implicit variational learning. In Advances in Neural Information Processing Systems, 2017.
|
| 376 |
+
|
| 377 |
+
Arash Vahdat and Jan Kautz. NVAE: A deep hierarchical variational autoencoder. In Advances in neural information processing systems, 2020.
|
| 378 |
+
|
| 379 |
+
Arash Vahdat, Karsten Kreis, and Jan Kautz. Score-based generative modeling in latent space. In Advances in neural information processing systems, 2021.
|
| 380 |
+
|
| 381 |
+
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.
|
| 382 |
+
|
| 383 |
+
Pascal Vincent. A connection between score matching and denoising autoencoders. Neural computation, 23(7):1661–1674, 2011.
|
| 384 |
+
|
| 385 |
+
Yuxin Wu and Kaiming He. Group normalization. In Proceedings of the European conference on computer vision, 2018.
|
| 386 |
+
|
| 387 |
+
Zhisheng Xiao, Karsten Kreis, Jan Kautz, and Arash Vahdat. Vaebm: A symbiosis between variational autoencoders and energy-based models. In International Conference on Learning Representations, 2021.
|
| 388 |
+
|
| 389 |
+
Guandao Yang, Xun Huang, Zekun Hao, Ming-Yu Liu, Serge Belongie, and Bharath Hariharan. Pointflow: 3d point cloud generation with continuous normalizing flows. In Proceedings of the IEEE/CVF International Conference on Computer Vision, 2019.
|
| 390 |
+
|
| 391 |
+
Fisher Yu, Ari Seff, Yinda Zhang, Shuran Song, Thomas Funkhouser, and Jianxiong Xiao. Lsun: Construction of a large-scale image dataset using deep learning with humans in the loop. arXiv preprint arXiv:1506.03365, 2015.
|
| 392 |
+
|
| 393 |
+
Ning Yu, Ke Li, Peng Zhou, Jitendra Malik, Larry Davis, and Mario Fritz. Inclusive gan: Improving data and minority coverage in generative models. arXiv preprint arXiv:2004.03355, 2020.
|
| 394 |
+
|
| 395 |
+
Han Zhang, Zizhao Zhang, Augustus Odena, and Honglak Lee. Consistency regularization for generative adversarial networks. In International Conference on Learning Representations, 2020.
|
| 396 |
+
|
| 397 |
+
Richard Zhang. Making convolutional networks shift-invariant again. In International conference on Machine Learning, 2019.
|
| 398 |
+
|
| 399 |
+
Shengjia Zhao, Hongyu Ren, Arianna Yuan, Jiaming Song, Noah Goodman, and Stefano Ermon. Bias and generalization in deep generative models: An empirical study. In Advances in neural information processing systems, 2018.
|
| 400 |
+
|
| 401 |
+
Shengyu Zhao, Zhijian Liu, Ji Lin, Jun-Yan Zhu, and Song Han. Differentiable augmentation for data-efficient gan training. In Advances in neural information processing systems, 2020.
|
| 402 |
+
|
| 403 |
+
Zhengli Zhao, Sameer Singh, Honglak Lee, Zizhao Zhang, Augustus Odena, and Han Zhang. Improved consistency regularization for gans. In Proceedings of the AAAI Conference on Artificial Intelligence, 2021.
|
| 404 |
+
|
| 405 |
+
# A DERIVATION FOR THE GAUSSIAN POSTERIOR
|
| 406 |
+
|
| 407 |
+
Ho et al. (2020) provide a derivation for the Gaussian posterior distribution. We include it here for completeness. Consider the forward diffusion process in Eq. 1, which we repeat here:
|
| 408 |
+
|
| 409 |
+
$$
|
| 410 |
+
q ( \mathbf { x } _ { 1 : T } | \mathbf { x } _ { 0 } ) = \prod _ { t = 1 } ^ { T } q ( \mathbf { x } _ { t } | \mathbf { x } _ { t - 1 } ) , \quad q ( \mathbf { x } _ { t } | \mathbf { x } _ { t - 1 } ) = \mathcal { N } ( \mathbf { x } _ { t } ; \sqrt { 1 - \beta _ { t } } \mathbf { x } _ { t - 1 } , \beta _ { t } \mathbf { I } ) .
|
| 411 |
+
$$
|
| 412 |
+
|
| 413 |
+
Due to the Markov property of the forward process, we have the marginal distribution of $\mathbf { x } _ { t }$ given the initial clean data $\mathbf { x } _ { \mathrm { 0 } }$ :
|
| 414 |
+
|
| 415 |
+
$$
|
| 416 |
+
q ( \mathbf { x } _ { t } | \mathbf { x } _ { 0 } ) = \mathcal { N } ( \mathbf { x } _ { t } ; \sqrt { \bar { \alpha } _ { t } } \mathbf { x } _ { 0 } , ( 1 - \bar { \alpha } _ { t } ) \mathbf { I } ) ,
|
| 417 |
+
$$
|
| 418 |
+
|
| 419 |
+
where we denote $\alpha _ { t } : = 1 - \beta _ { t }$ and $\textstyle { \bar { \alpha } } _ { t } : = \prod _ { s = 1 } ^ { t } \alpha _ { s }$ . Applying Bayes’ rule, we can obtain the forward process posterior when conditioned on $\mathbf { x } _ { \mathrm { 0 } }$ :
|
| 420 |
+
|
| 421 |
+
$$
|
| 422 |
+
\begin{array} { r } { q ( \mathbf { x } _ { t - 1 } \vert \mathbf { x } _ { t } , \mathbf { x } _ { 0 } ) = \frac { q ( \mathbf { x } _ { t } \vert \mathbf { x } _ { t - 1 } , \mathbf { x } _ { 0 } ) q ( \mathbf { x } _ { t - 1 } \vert \mathbf { x } _ { 0 } ) } { q ( \mathbf { x } _ { t } \vert \mathbf { x } _ { 0 } ) } } \\ { = \frac { q ( \mathbf { x } _ { t } \vert \mathbf { x } _ { t - 1 } ) q ( \mathbf { x } _ { t - 1 } \vert \mathbf { x } _ { 0 } ) } { q ( \mathbf { x } _ { t } \vert \mathbf { x } _ { 0 } ) } , } \end{array}
|
| 423 |
+
$$
|
| 424 |
+
|
| 425 |
+
where the second equation follows from the Markov property of the forward process. Since all three terms in Eq. 9 are Gaussians, the posterior $q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } , \mathbf { x } _ { 0 } )$ is also a Gaussian distribution, and it can be written as
|
| 426 |
+
|
| 427 |
+
$$
|
| 428 |
+
q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } , \mathbf { x } _ { 0 } ) = \mathcal { N } ( \mathbf { x } _ { t - 1 } ; \tilde { \pmb { \mu } } _ { t } ( \mathbf { x } _ { t } , \mathbf { x } _ { 0 } ) , \tilde { \beta } _ { t } \mathbf { I } )
|
| 429 |
+
$$
|
| 430 |
+
|
| 431 |
+
with mean $\tilde { \mu } _ { t } ( \mathbf x _ { t } , \mathbf x _ { 0 } )$ and variance $\tilde { \beta } _ { t }$ . Plugging the expressions in Eq. 7 and Eq. 8 into Eq. 10, we obtain
|
| 432 |
+
|
| 433 |
+
$$
|
| 434 |
+
\tilde { \mu } _ { t } ( \mathbf { x } _ { t } , \mathbf { x } _ { 0 } ) : = \frac { \sqrt { \bar { \alpha } _ { t - 1 } } \beta _ { t } } { 1 - \bar { \alpha } _ { t } } \mathbf { x } _ { 0 } + \frac { \sqrt { \alpha _ { t } } ( 1 - \bar { \alpha } _ { t - 1 } ) } { 1 - \bar { \alpha } _ { t } } \mathbf { x } _ { t } \quad \mathrm { ~ a n d ~ } \quad \tilde { \beta } _ { t } : = \frac { 1 - \bar { \alpha } _ { t - 1 } } { 1 - \bar { \alpha } _ { t } } \beta _ { t }
|
| 435 |
+
$$
|
| 436 |
+
|
| 437 |
+
after minor simplifications.
|
| 438 |
+
|
| 439 |
+
# B PARAMETRIZATION OF DDPM
|
| 440 |
+
|
| 441 |
+
In Sec. 3.2, we mention that the parametrization of the denoising distribution for current diffusion models such as Ho et al. (2020) can be interpreted as $p _ { \theta } ( \mathbf { x } _ { t - 1 } | \bar { \mathbf { x } _ { t } } ) : = q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } , \mathbf { x } _ { 0 } = f _ { \theta } ( \mathbf { x } _ { t } , t ) )$ . However, such a parametrization is not explicitly stated in Ho et al. (2020) but it is discussed by Song et al. (2021a). To avoid possible confusion, here we show that the parametrization of Ho et al. (2020) is equivalent to what we describe in Sec 3.2.
|
| 442 |
+
|
| 443 |
+
Ho et al. (2020) train a noise prediction network $\epsilon _ { \theta } ( \mathbf { x } _ { t } , t )$ which predicts the noise that perturbs data $\mathbf { x } _ { \mathrm { 0 } }$ to $\mathbf { x } _ { t }$ , and a sample from $p _ { \theta } ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } )$ is obtained as (see Algorithm 2 of Ho et al. (2020))
|
| 444 |
+
|
| 445 |
+
$$
|
| 446 |
+
\mathbf { x } _ { t - 1 } = \frac { 1 } { \sqrt { \alpha _ { t } } } \left( \mathbf { x } _ { t } - \frac { 1 - \alpha _ { t } } { \sqrt { 1 - \bar { \alpha } _ { t } } } \epsilon _ { \theta } \left( \mathbf { x } _ { t } , t \right) \right) + \sigma _ { t } \mathbf { z } ,
|
| 447 |
+
$$
|
| 448 |
+
|
| 449 |
+
where $\mathbf { z } \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ except for the last denoising step where $\mathbf { z } = 0$ , and $\sigma _ { t } = \sqrt { \tilde { \beta } _ { t } }$ is the standard deviation of the Gaussian posterior distribution in Eq. 11.
|
| 450 |
+
|
| 451 |
+
Firstly, notice that predicting the perturbation noise $\epsilon _ { \theta } ( \mathbf { x } _ { t } , t )$ is equivalent to predicting $\mathbf { x } _ { \mathrm { 0 } }$ . We know that $\mathbf { x } _ { t }$ is generated by adding $\mathbf { \epsilon } \gets \mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ noise as:
|
| 452 |
+
|
| 453 |
+
$$
|
| 454 |
+
\mathbf { x } _ { t } = \sqrt { \bar { \alpha } _ { t } } \mathbf { x } _ { 0 } + \sqrt { 1 - \bar { \alpha } _ { t } } \epsilon ,
|
| 455 |
+
$$
|
| 456 |
+
|
| 457 |
+
Hence, after predicting the noise with $\epsilon _ { \theta } ( \mathbf { x } _ { t } , t )$ we can obtain a prediction of $\mathbf { x } _ { \mathrm { 0 } }$ using:
|
| 458 |
+
|
| 459 |
+
$$
|
| 460 |
+
\mathbf { x } _ { 0 } = \frac { 1 } { \sqrt { \bar { \alpha } _ { t } } } \left( \mathbf { x } _ { t } - \sqrt { 1 - \bar { \alpha } _ { t } } \pmb { \epsilon } _ { \theta } ( \mathbf { x } _ { t } , t ) \right) .
|
| 461 |
+
$$
|
| 462 |
+
|
| 463 |
+
Next, we can plug the expression for $\mathbf { x } _ { \mathrm { 0 } }$ in Eq. 13 into the mean of the Gaussian posterior distribution in Eq. 11, and we have
|
| 464 |
+
|
| 465 |
+
$$
|
| 466 |
+
\begin{array} { r l } & { \tilde { \pmb { \mu } } _ { t } ( \mathbf { x } _ { t } , \mathbf { x } _ { 0 } ) = \tilde { \mu } _ { t } \left( \mathbf { x } _ { t } , \frac { 1 } { \sqrt { \bar { \alpha } _ { t } } } \left( \mathbf { x } _ { t } - \sqrt { 1 - \bar { \alpha } _ { t } } \epsilon _ { \theta } ( \mathbf { x } _ { t } , t ) \right) \right) } \\ & { \qquad = \displaystyle \frac { 1 } { \sqrt { \alpha _ { t } } } \left( \mathbf { x } _ { t } - \frac { 1 - \alpha _ { t } } { \sqrt { 1 - \bar { \alpha } _ { t } } } \epsilon _ { \theta } ( \mathbf { x } _ { t } , t ) \right) } \end{array}
|
| 467 |
+
$$
|
| 468 |
+
|
| 469 |
+
after simplifications. Comparing this with Eq. 12, we observe that Eq. 12 simply corresponds to sampling from the Gaussian posterior distribution. Therefore, although Ho et al. (2020) use an alternative re-parametrization, their denoising distribution can still be equivalently interpreted as $p _ { \theta } ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } ) \ { \mathrm { : = } } \ q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } , \mathbf { x } _ { 0 } = f _ { \theta } ( \mathbf { x } _ { t } , t ) )$ , i.e, first predicting $\mathbf { x } _ { \mathrm { 0 } }$ using the time-dependent denoising model, and then sampling $\mathbf { x } _ { t - 1 }$ using the posterior distribution $q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } , \mathbf { x } _ { 0 } )$ given $\mathbf { x } _ { t }$ and the predicted $\mathbf { x } _ { \mathrm { 0 } }$ .
|
| 470 |
+
|
| 471 |
+
# C EXPERIMENTAL DETAILS
|
| 472 |
+
|
| 473 |
+
In this section, we present our experimental settings in detail.
|
| 474 |
+
|
| 475 |
+
# C.1 NETWORK STRUCTURE
|
| 476 |
+
|
| 477 |
+
Generator: Our generator structure largely follows the U-net structure (Ronneberger et al., 2015) used in ${ \mathrm { N C S N } } { + + }$ (Song et al., 2021c), which consists of multiple ResNet blocks (He et al., 2016) and Attention blocks (Vaswani et al., 2017). Hyper-parameters for the network design, such as the number of blocks and number of channels, are reported in Table 6. We follow the default settings in Song et al. (2021c) for other network configurations not mentioned in the table, including Swish activation function, upsampling and downsampling with anti-aliasing based on Finite Impulse Response (FIR) (Zhang, 2019), re-scaling all skip connections by $\scriptstyle { \frac { 1 } { \sqrt { 2 } } }$ , using residual block design from BigGAN (Brock et al., 2018) and incorporating progressive growing architectures (Karras et al., 2020b). See Appendix H of Song et al. (2021c) for more details on these configurations.
|
| 478 |
+
|
| 479 |
+
We follow Ho et al. (2020) and use sinusoidal positional embeddings for conditioning on integer time steps. The dimension for the time embedding is $4 \times$ the number of initial channels presented in Table 6. Contrary to previous works, we did not find the use of Dropout helpful in our case.
|
| 480 |
+
|
| 481 |
+
The fundamental difference between our generator network and the networks of previous diffusion models is that our generator takes an extra latent variable $\mathbf { z }$ as input. Inspired by the success of StyleGANs, we provide z-conditioning to the ${ \mathrm { N C S N } } { + + }$ architecture using mapping networks, introduced in StyleGAN (Karras et al., 2019). We use $\mathbf { z } \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ for all experiments. We replace all the group normalization (GN) layers in the network with adaptive group normalization (AdaGN) layers to allow the input of latent variables. The latent variable $\mathbf { z }$ is first transformed by a fully-connected network (called mapping network), and then the resulting embedding vector, denoted by w, is sent to every AdaGN layer. Each AdaGN layer contains one fully-connected layer that takes w as input, and outputs the per-channel shift and scale parameters for the group normalization. The network’s feature maps are then subject to affine transformations using these shift and scale parameters of the AdaGN layers. The mapping network and the fully-connected layer in AdaGN are independent of time steps $t$ , as we found no extra benefit in incorporating time embeddings in these layers. Details about latent variables are also presented in Table 6.
|
| 482 |
+
|
| 483 |
+
Discriminator: We design our time-dependent discriminator with a convolutional network with ResNet blocks, where the design of the ResNet blocks is similar to that of the generator. The discriminator tries to discriminate real and fake $\mathbf { x } _ { t - 1 }$ , conditioned on $\mathbf { x } _ { t }$ and $t$ . The time conditioning is enforced by the same sinusoidal positional embedding as in the generator. The $\mathbf { x } _ { t }$ conditioning is enforced by concatenating $\mathbf { x } _ { t }$ and $\mathbf { x } _ { t - 1 }$ as the input to the discriminator. We use LeakyReLU activations with a negative slope 0.2 for all layers. Similar to Karras et al. (2020b), we use a minibatch standard deviation layer after all the ResNet blocks. We present the exact architecture of discriminators in Table 7.
|
| 484 |
+
|
| 485 |
+
Table 6: Hyper-parameters for the generator network.
|
| 486 |
+
|
| 487 |
+
<table><tr><td></td><td>CIFAR10</td><td>CelebA-HQ</td><td>LSUNChurch</td></tr><tr><td># of ResNet blocks per scale</td><td>2</td><td>2</td><td>2</td></tr><tr><td>Initial #of channels</td><td>128</td><td>64</td><td>64</td></tr><tr><td>Channel multiplier for each scale</td><td>(1,2,2,2)</td><td>(1,1,2,2,4,4)</td><td>(1,1,2,2,4,4)</td></tr><tr><td>Scale of attention block</td><td>16</td><td>16</td><td>16</td></tr><tr><td>LatentDimension</td><td>100</td><td>100</td><td>100</td></tr><tr><td># of latent mapping layers</td><td>3</td><td>3</td><td>3</td></tr><tr><td>Latent embedding dimension</td><td>256</td><td>256</td><td>256</td></tr></table>
|
| 488 |
+
|
| 489 |
+
Table 7: Network structures for the discriminator. The number on the right indicates the number of channels in each residual block.
|
| 490 |
+
|
| 491 |
+
<table><tr><td rowspan=1 colspan=1>CelebA-HQ and LSUN Church</td></tr><tr><td rowspan=1 colspan=1>1 × 1 conv2d,128ResBlock down, 256ResBlock down, 512ResBlock down, 512</td></tr><tr><td rowspan=1 colspan=1>ResBlock down, 512</td></tr><tr><td rowspan=1 colspan=1>ResBlock down, 512</td></tr><tr><td rowspan=1 colspan=1>ResBlock down, 512</td></tr><tr><td rowspan=1 colspan=1>minibatch std layerGlobal Sum PoolingFC layer→ scalar</td></tr></table>
|
| 492 |
+
|
| 493 |
+
<table><tr><td>CIFAR-10</td></tr><tr><td>1 × 1 conv2d,128 ResBlock,128</td></tr><tr><td>ResBlock down, 256 ResBlock down, 512 ResBlock down, 512</td></tr><tr><td>minibatch std layer</td></tr><tr><td>Global Sum Pooling FC layer → scalar</td></tr></table>
|
| 494 |
+
|
| 495 |
+
# C.2 TRAINING
|
| 496 |
+
|
| 497 |
+
Diffusion Process: For all datasets, we set the number of diffusion steps to be 4. In order to compute $\beta _ { t }$ per step, we use the discretization of the continuous-time extension of the process described in Eq. 1, which is called the Variance Preserving (VP) SDE by Song et al. (2021c). We compute $\beta _ { t }$ based on the continuous-time diffusion model formulation, as it allows us to ensure that variance schedule stays the same independent of the number of diffusion steps. Let’s define the normalized time variable by $\begin{array} { r } { t ^ { \prime } : = \frac { t } { T } } \end{array}$ which normalizes $t \in \{ 1 , 2 , \ldots , T \}$ to $[ 0 , 1 ]$ . The variance function of VP SDE is given by:
|
| 498 |
+
|
| 499 |
+
$$
|
| 500 |
+
\sigma ^ { 2 } ( t ^ { \prime } ) = 1 - e ^ { - \beta _ { \mathrm { m i n } } t ^ { \prime } - 0 . 5 ( \beta _ { \mathrm { m a x } } - \beta _ { \mathrm { m i n } } ) t ^ { \prime 2 } } ,
|
| 501 |
+
$$
|
| 502 |
+
|
| 503 |
+
with the constants $\beta _ { \mathrm { m a x } } = 2 0$ and $\beta _ { \mathrm { m i n } } = 0 . 1$ . Recall that sampling from √ $t ^ { t h }$ step in the forward diffusion process can be done with $q ( \mathbf { x } _ { t } | \mathbf { x } _ { 0 } ) = \mathcal { N } ( \mathbf { x } _ { t } ; \sqrt { \bar { \alpha } _ { t } } \mathbf { x } _ { 0 } , ( 1 - \bar { \alpha } _ { t } ) \mathbf { I } )$ . We compute $\beta _ { t }$ by solving $\begin{array} { r } { 1 - \bar { \alpha } _ { t } = \sigma ^ { 2 } ( \frac { t } { T } ) } \end{array}$ :
|
| 504 |
+
|
| 505 |
+
$$
|
| 506 |
+
\beta _ { t } = 1 - \alpha _ { t } = 1 - \frac { \bar { \alpha } _ { t } } { \bar { \alpha } _ { t - 1 } } = 1 - \frac { 1 - \sigma ^ { 2 } \bigl ( \frac { t } { T } \bigr ) } { 1 - \sigma ^ { 2 } \bigl ( \frac { t - 1 } { T } \bigr ) } = 1 - e ^ { - \beta _ { \operatorname* { m i n } } \bigl ( \frac { 1 } { T } \bigr ) - 0 . 5 \bigl ( \beta _ { \operatorname* { m a x } } - \beta _ { \operatorname* { m i n } } \bigr ) \frac { 2 t - 1 } { T ^ { 2 } } } ,
|
| 507 |
+
$$
|
| 508 |
+
|
| 509 |
+
for $t \in \{ 1 , 2 , . . . T \}$ . This choice of $\beta _ { t }$ values corresponds to equidistant steps in time according to VP SDE. Other choices are possible, but we did not explore them.
|
| 510 |
+
|
| 511 |
+
Objective: We train our denoising diffusion GAN with the following adversarial objective:
|
| 512 |
+
|
| 513 |
+
$$
|
| 514 |
+
\begin{array} { l } { \displaystyle \operatorname* { m i n } _ { \phi } \sum _ { t = 1 } ^ { T } \mathbb { E } _ { q ( \mathbf { x } _ { 0 } ) q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { 0 } ) q ( \mathbf { x } _ { t } | \mathbf { x } _ { t - 1 } ) } \left[ - \log ( D _ { \phi } ( \mathbf { x } _ { t - 1 } , \mathbf { x } _ { t } , t ) + \mathbb { E } _ { p _ { \theta } ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } ) } [ - \log ( 1 - D _ { \phi } ( \mathbf { x } _ { t - 1 } , \mathbf { x } _ { t } , t ) ) ] \right] } \\ { \displaystyle \operatorname* { m a x } _ { \theta } \sum _ { t = 1 } ^ { T } \mathbb { E } _ { q ( \mathbf { x } _ { 0 } ) q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { 0 } ) q ( \mathbf { x } _ { t } | \mathbf { x } _ { t - 1 } ) } \left[ \mathbb { E } _ { p _ { \theta } ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } ) } [ \log ( D _ { \phi } ( \mathbf { x } _ { t - 1 } , \mathbf { x } _ { t } , t ) ) ] \right] } \end{array}
|
| 515 |
+
$$
|
| 516 |
+
|
| 517 |
+
where the outer expectation denotes ancestral sampling from $q ( \mathbf { x } _ { 0 } , \mathbf { x } _ { t - 1 } , \mathbf { x } _ { t } )$ and $p _ { \theta } ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { t } )$ is our implicit GAN denoising distribution.
|
| 518 |
+
|
| 519 |
+
Table 8: Optimization hyper-parameters.
|
| 520 |
+
|
| 521 |
+
<table><tr><td></td><td>CIFAR10</td><td>CelebA-HQ</td><td>LSUN Church</td></tr><tr><td>Initial learning rate for discriminator</td><td>10-4</td><td>10-4</td><td>10-4</td></tr><tr><td>Initial learning rate for generator</td><td>1.6 × 10-4</td><td>1.6 × 10-4</td><td>2×10-4</td></tr><tr><td>Adam optimizer β1</td><td>0.5</td><td>0.5</td><td>0.5</td></tr><tr><td>Adam optimizer β2</td><td>0.9</td><td>0.9</td><td>0.9</td></tr><tr><td>EMA</td><td>0.9999</td><td>0.999</td><td>0.999</td></tr><tr><td>Batch size</td><td>256</td><td>32</td><td>64</td></tr><tr><td># of training iterations</td><td>400k</td><td>750k</td><td>600k</td></tr><tr><td># of GPUs</td><td>4</td><td>8</td><td>8</td></tr></table>
|
| 522 |
+
|
| 523 |
+
Similar to Ho et al. (2020), during training we randomly sample an integer time step $t \in [ 1 , 2 , 3 , 4 ]$ for each datapoint in a batch. Besides the main objective, we also add an $R _ { 1 }$ regularization term (Mescheder et al., 2018) to the objective for the discriminator. The $R _ { 1 }$ term is defined as
|
| 524 |
+
|
| 525 |
+
$$
|
| 526 |
+
R _ { 1 } ( \phi ) = \frac { \gamma } { 2 } \mathbb { E } _ { q ( \mathbf { x } _ { 0 } ) q ( \mathbf { x } _ { t - 1 } | \mathbf { x } _ { 0 } ) q ( \mathbf { x } _ { t } | \mathbf { x } _ { t - 1 } ) } \left[ \left\| \nabla _ { \mathbf { x } _ { t - 1 } } D _ { \phi } ( \mathbf { x } _ { t - 1 } , \mathbf { x } _ { t } , t ) \right\| ^ { 2 } \right] ,
|
| 527 |
+
$$
|
| 528 |
+
|
| 529 |
+
where $\gamma$ is the coefficient for the regularization. We use $\gamma = 0 . 0 5$ for CIFAR-10, and $\gamma = 1$ for CelebA-HQ and LSUN Church. Note that the $R _ { 1 }$ regularization is a gradient penalty that encourages the discriminator to stay smooth and improves the convergence of GAN training (Mescheder et al., 2018).
|
| 530 |
+
|
| 531 |
+
Optimization: We train our models using the Adam optimizer (Kingma & Ba, 2015). We use cosine learning rate decay (Loshchilov & Hutter, 2016) for training both the generator and discriminator. Similar to Ho et al. (2020); Song et al. (2021c); Karras et al. (2020a), we observe that applying an exponential moving average (EMA) on the generator is crucial to achieve high performance. We summarize the optimization hyper-parameters in Table 8.
|
| 532 |
+
|
| 533 |
+
We train our models on CIFAR-10 using 4 V100 GPUs. On CelebA-HQ and LSUN Church we use 8 V100 GPUs. The training takes approximately 48 hours on CIFAR-10, and 180 hours on CelebA-HQ and LSUN Church.
|
| 534 |
+
|
| 535 |
+
# C.3 EVALUATION
|
| 536 |
+
|
| 537 |
+
When evaluating IS, FID and recall score, we use 50k generated samples for CIFAR-10 and LSUN Church, and 30k samples for CelebA-HQ (since the CelebA HQ dataset contains only 30k samples).
|
| 538 |
+
|
| 539 |
+
When evaluating sampling time, we use models trained on CIFAR-10 and generate a batch of 100 samples. We benchmark the sampling time on a machine with a single V100 GPU. We use Pytorch 1.9.0 and CUDA 11.0.
|
| 540 |
+
|
| 541 |
+
# C.4 ABLATION STUDIES
|
| 542 |
+
|
| 543 |
+
Here we introduce the settings for the ablation study in Sec. 5.2. We observe that training requires a larger number of training iterations when $T$ is larger. As a result, we train the model for each $T$ until the FID score does not increase any further. The number of training iteration is $2 0 0 \mathrm { k }$ for $T = 1$ and $T = 2$ , $4 0 0 \mathrm { k }$ for $T = 4$ and $6 0 0 \mathrm { k }$ for $T = 8$ . We use the same network structures and optimization settings as in the main experiments.
|
| 544 |
+
|
| 545 |
+
For the data augmentation baseline, we follow the differentiable data augmentation pipeline in Zhao et al. (2020). In particular, for every (real or fake) image in the batch, we perturbed it by sampling from a random timestep at the diffusion process (except the last diffusion step where the information of data is completely destroyed). We find the results insensitive to the number of possible perturbation levels (i.e, the number of steps in the diffusion process), and we report the result using a diffusion process with 4 steps. Since the perturbation by the diffusion process is differentiable due to the re-parametrization trick (Kingma & Welling, 2014), we can train both the discriminator and generator with the perturbed samples. See Zhao et al. (2020) for a detailed explanation for the training pipeline.
|
| 546 |
+
|
| 547 |
+
For the experiments on alternative parametrizations, we use $T = 4$ for the diffusion process and keep other settings the same as in the main experiments.
|
| 548 |
+
|
| 549 |
+
For the experiment on training a model without latent variables, similar to the main experiments, the generator takes the conditioning $\mathbf { x } _ { t }$ as its input, and the time conditioning is still enforced by the time embedding. However, the AdaGN layers are replaced by plain GN layers, such that no latent variable is needed, and the mapping network for $\mathbf { z }$ is removed. Other settings follow the main experiments.
|
| 550 |
+
|
| 551 |
+
# C.5 TOY DATA AND STACKEDMNIST
|
| 552 |
+
|
| 553 |
+
For the 25-Gaussian toy dataset, both our generator and discriminator have 3 fully-connected layers each with 512 hidden units and LeakyReLU activations (negative slope of 0.2). We enforce both the conditioning on $\mathbf { x } _ { t }$ and $t$ by concatenation with the input. We use the Adam optimizer with a learning rate of $1 0 ^ { - 4 }$ for both the generator and discriminator. The batch size is 512, and we train the model for 50k iterations.
|
| 554 |
+
|
| 555 |
+
Our experimental settings for StackedMNIST are the same as those for CIFAR-10, except that we train the model for only 150k iterations.
|
| 556 |
+
|
| 557 |
+
# D TRAINING STABILITY
|
| 558 |
+
|
| 559 |
+
In Fig. 10, we plot the discriminator loss for different time steps in the diffusion process when $T = 4$ . We observe that the training of our denoising diffusion GAN is stable and we do not see any explosion in loss values, as is sometimes reported for other GAN methods such as Brock et al. (2018). The stability might be attributed to two reasons: First, the conditioning on $\mathbf { x } _ { t }$ for both generator and discriminator provides a strong signal. The generator is required to generate a few plausible samples given $\mathbf { x } _ { t }$ and the discriminator requires classifying them. The $\mathbf { x } _ { t }$ conditioning keeps the discriminator and generator in a balance. Second, we are training the GAN on relatively smooth distributions, as the diffusion process is known as a smoothening process that brings the distributions of fake and real samples closer to each other (Lyu, 2012). As we can see from Fig. 10, the discriminator loss for $t > 0$ is higher than $t = 0$ (the last denoising step). Note that $t > 0$ corresponds to training the discriminator on noisy images, and in this case the true and generator distributions are closer to each other, making the discrimination harder and hence resulting in higher discriminator loss. We believe that such a property prevents the discriminator from overfitting, which leads to better training stability.
|
| 560 |
+
|
| 561 |
+
# E ADDITIONAL QUALITATIVE RESULTS
|
| 562 |
+
|
| 563 |
+
We show additional qualitative samples of CIFAR-10, CelebA-HQ and LSUN Church Outdoor in Figure 11, Figure 12 and Figure 13, respectively.
|
| 564 |
+
|
| 565 |
+
# F ADDITIONAL VISUALIZATION FOR $p _ { \theta } ( \mathbf { x } _ { 0 } | \mathbf { x } _ { t } )$
|
| 566 |
+
|
| 567 |
+
In Figure 14 and Figure 15, we show visualizations of samples from $p _ { \theta } ( \mathbf { x } _ { 0 } | \mathbf { x } _ { t } )$ for different $t$ . Note that except for $p _ { \theta } ( \mathbf { x } _ { 0 } | \mathbf { x } _ { 1 } )$ , the samples from $p _ { \theta } ( \mathbf { x } _ { 0 } | \mathbf { x } _ { t } )$ do not need to be sharp, as they are only intermediate outputs of the sampling process. The conditioning is less preserved as the perturbation in $\mathbf { x } _ { t }$ increases, and in particular $\mathbf { x } _ { T }$ 1 $\mathbf { \tilde { x } } _ { 4 }$ in our example) contains almost no information of clean data $\mathbf { x } _ { \mathrm { 0 } }$ .
|
| 568 |
+
|
| 569 |
+
# G NEAREST NEIGHBOR RESULTS
|
| 570 |
+
|
| 571 |
+
In Figure 16 and Figure 17, we show the nearest neighbors in the training dataset, corresponding to a few generated samples, where the nearest neighbors are computed using the feature distance of a pre-trained VGG network (Simonyan & Zisserman, 2014). We observe that the nearest neighbors are significantly different from the samples, suggesting that our models generalize well.
|
| 572 |
+
|
| 573 |
+

|
| 574 |
+
Figure 10: The discriminator loss per denoising step during training.
|
| 575 |
+
|
| 576 |
+

|
| 577 |
+
Figure 11: Additional qualitative samples on CIFAR-10.
|
| 578 |
+
|
| 579 |
+

|
| 580 |
+
Figure 12: Additional qualitative samples on CelebA-HQ.
|
| 581 |
+
|
| 582 |
+

|
| 583 |
+
Figure 13: Additional qualitative samples on LSUN Church Outdoor.
|
| 584 |
+
|
| 585 |
+

|
| 586 |
+
Figure 14: Visualization of samples from $p _ { \theta } ( \mathbf { x } _ { 0 } | \mathbf { x } _ { t } )$ for different $t$ on CelebA-HQ. For each example, the top row contains $\mathbf { x } _ { t }$ from diffusion process steps, where $\mathbf { x } _ { \mathrm { 0 } }$ is a sample from the dataset. The bottom rows contain 3 samples from $p _ { \theta } ( \mathbf { x } _ { 0 } | \mathbf { x } _ { t } )$ for different $t$ ’s.
|
| 587 |
+
|
| 588 |
+

|
| 589 |
+
Figure 15: Visualization of samples from $p _ { \theta } ( \mathbf { x } _ { 0 } | \mathbf { x } _ { t } )$ for different $t$ on LSUN Church. For each example, the top row contains $\mathbf { x } _ { t }$ from diffusion process steps, where $\mathbf { x } _ { \mathrm { 0 } }$ is a sample from the dataset. The bottom rows contain 3 samples from $p _ { \theta } ( \mathbf { x } _ { 0 } | \mathbf { x } _ { t } )$ for different $t$ ’s.
|
| 590 |
+
|
| 591 |
+

|
| 592 |
+
|
| 593 |
+

|
| 594 |
+
Figure 16: CIFAR-10 nearest neighbors in VGG feature space. Generated samples are in the leftmost column, and training set nearest neighbors are in the remaining columns.
|
| 595 |
+
|
| 596 |
+

|
| 597 |
+
Figure 17: CelebA-HQ nearest neighbors in the VGG feature space. Generated samples are in the leftmost column, and training set nearest neighbors are in the remaining columns.
|
md/dev/JtBRnrlOEFN/JtBRnrlOEFN.md
ADDED
|
@@ -0,0 +1,465 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CHARFORMER: FAST CHARACTER TRANSFORMERS VIA GRADIENT-BASED SUBWORD TOKENIZATION
|
| 2 |
+
|
| 3 |
+
Yi Tay∗, Vinh Q. Tran∗, Sebastian Ruder†, Jai Gupta, Hyung Won Chung, Dara Bahri Zhen Qin, Simon Baumgartner, Cong Yu, Donald Metzler
|
| 4 |
+
|
| 5 |
+
Google Research and DeepMind† yitay@google.com, vqtran@google.com
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
State-of-the-art models in natural language processing rely on separate rigid subword tokenization algorithms, which limit their generalization ability and adaptation to new settings. In this paper, we propose a new model inductive bias that learns a subword tokenization end-to-end as part of the model. To this end, we introduce a soft gradient-based subword tokenization module (GBST) that automatically learns latent subword representations from characters in a data-driven fashion. Concretely, GBST enumerates candidate subword blocks and learns to score them in a position-wise fashion using a block scoring network. We additionally introduce CHARFORMER, a deep Transformer model that integrates GBST and operates on the byte level. Via extensive experiments on English GLUE, multilingual, and noisy text datasets, we show that CHARFORMER outperforms a series of competitive byte-level baselines while generally performing on par and sometimes outperforming subword-based models. Additionally, CHARFORMER is fast, improving the speed of both vanilla byte-level and subword-level Transformers by $2 8 \mathrm { - } 1 0 0 \%$ while maintaining competitive quality. We believe this work paves the way for highly performant token-free models that are trained completely end-to-end.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
Neural networks have achieved tremendous success in natural language processing (NLP) by replacing feature-engineered models with stacks of functions that are learned end-to-end from vast amounts of data (Mikolov et al., 2013; Peters et al., 2018; Howard and Ruder, 2018). The single component of the traditional NLP pipeline (Manning and Schütze, 1999) that has so far resisted gradient-based learning is tokenization, which is commonly applied as a pre-processing step. State-of-the-art pre-trained language models (Devlin et al., 2019) generally rely on data-driven subword-based tokenization algorithms (Schuster and Nakajima, 2012; Sennrich et al., 2016; Wu et al., 2016; Kudo and Richardson, 2018) while expert-crafted segmentation algorithms are still common for languages without whitespace separation such as Chinese, Thai, and Korean (cf. Lample and Conneau, 2019).
|
| 14 |
+
|
| 15 |
+
This reliance on rigid tokenization methods introduces a bottleneck into current NLP systems that limits their capabilities. Subword segmentation algorithms split tokens into subwords solely based on frequency, without taking into account lexical or semantic similarity. As a result, models are brittle to rare words (Gong et al., 2018) and perturbations, both natural and adversarial (Belinkov and Bisk, 2018; Pruthi et al., 2019; Sun et al., 2020). In multilingual models, tokens in low-resource languages are split into many subwords, which impacts performance on those languages and deteriorates crosslingual transfer (Hu et al., 2020; Wang et al., 2021). Finally, a separate tokenization algorithm leads to a mismatch between the pre-training and downstream distribution of words when adapting pre-trained language models to new settings, which requires significant engineering effort to overcome.
|
| 16 |
+
|
| 17 |
+
The direct application of character-level modelling into pre-trained language models in turn results in severely increased computational and memory complexity due to an increased sequence length and generally lower performance. To address this problem, we propose gradient-based subword tokenization (GBST), a new method that combines the compositionality of character-level representations with the efficiency of subword tokenization while enabling end-to-end learning. Our method learns latent subword representations from characters using large amounts of unlabeled data. Specifically, GBST learns a position-wise soft selection over candidate subword blocks by scoring them with a scoring network. In contrast to prior tokenization-free methods (Clark et al., 2021), GBST learns interpretable latent subwords, which enables easy inspection of lexical representations and is more efficient than other byte-based models (Xue et al., 2021). Given that simply applying a standard Transformer on a sequence of characters and bytes is computationally prohibitive, GBST paves the way for usable, practical and highly performant character-level models. A high level overview of how the GBST module is applied can be found at Figure 3 (Appendix).
|
| 18 |
+
|
| 19 |
+
We furthermore introduce CHARFORMER, a Transformer encoder-decoder model that uses GBST to operate directly on the byte level. In addition, we experiment with a re-scaled variant of CHARFORMER, which allocates additional capacity to the encoder to make up for the lack of discrete subword embeddings.
|
| 20 |
+
|
| 21 |
+
We evaluate our model on a range of standard and non-standard English, and multilingual downstream tasks. On English GLUE and long document classification tasks, CHARFORMER outperforms strong byte-level baselines and overall achieves performance on par with subword-based models such as BERT (Devlin et al., 2019) and T5 (Raffel et al., 2020). On toxicity detection in social media datasets (Borkan et al., 2019; Wulczyn et al., 2017), CHARFORMER outperforms byte-level baselines as well as subword-based models, demonstrating robustness to spelling variation and non-standard language. Finally, a multilingually pre-trained CHARFORMER performs on par or outperforms strong subword-based multilingual baselines on standard cross-lingual datasets.
|
| 22 |
+
|
| 23 |
+
We additionally demonstrate CHARFORMER is more efficient compared to byte-level and subwordbased models with similar numbers of parameters. On a comparable setup, CHARFORMER outperforms a baseline similar to the recent state-of-the-art byte-level model ByT5 (Xue et al., 2021) while being $2 \times$ more memory efficient and $10 \mathrm { - } 9 3 \%$ faster. CHARFORMER also trains $28 \%$ faster than the subword-level mT5 model (Xue et al., 2020), has $3 \times$ fewer parameters and achieves comparable quality on well-established benchmarks. Finally, we demonstrate via visualization that the latent subwords learned by CHARFORMER are interpretable to some extent.
|
| 24 |
+
|
| 25 |
+
# 2 CHARFORMER
|
| 26 |
+
|
| 27 |
+
This section introduces our efficient character-level architecture, CHARFORMER. CHARFORMER is comprised of a Gradient-Based Subword Tokenization (GBST) module, followed by deep Transformer layers. The input to the GBST module is a sequence of characters or bytes1, which is then downsampled to construct latent subwords.
|
| 28 |
+
|
| 29 |
+
# 2.1 GRADIENT-BASED SUBWORD TOKENIZATION (GBST)
|
| 30 |
+
|
| 31 |
+
The input to GBST is a tensor of shape $\boldsymbol { X } \in \mathbb { R } ^ { L \times d }$ where $L$ is the number of input characters and $d$ is the character embedding dimension. The key idea behind GBST is for the model to learn to perform a latent subword segmentation of the input by selecting the most suitable subword block at every character position. A block is a contiguous span of characters $X _ { i : i + b }$ of length $b$ for $1 \leq i \leq L - b$ .
|
| 32 |
+
|
| 33 |
+
# 2.1.1 CONSTRUCTING CANDIDATE LATENT SUBWORD BLOCKS
|
| 34 |
+
|
| 35 |
+
We first enumerate all possible subword blocks of size $b$ up to a maximum block size $M$ . In order to learn subword block embeddings, we use a non-parameterized strided pooling function $F : \mathbb { R } ^ { b \times d } \mathbb { R } ^ { d }$ that projects a subword block consisting of a sequence of character embeddings $X _ { i : i + b } \in \mathbb { R } ^ { b \times d }$ to a single subword block representation $X _ { b , i } \in \mathbb { R } ^ { d }$ for block size $b$ at position $i$ . We compute subword blocks $X _ { b , i }$ with a stride $s$ :
|
| 36 |
+
|
| 37 |
+
$$
|
| 38 |
+
X _ { b } = [ F ( X _ { i : i + b } ) ; F ( X _ { ( i + s ) : ( i + s ) + b } ) ; . . . ]
|
| 39 |
+
$$
|
| 40 |
+
|
| 41 |
+

|
| 42 |
+
|
| 43 |
+

|
| 44 |
+
Figure 1: Illustration of subword block formation and scoring.
|
| 45 |
+
|
| 46 |
+
(a) Formation of subword blocks to be scored by $F _ { R }$ .
|
| 47 |
+
Offsets and/or pre-GBST convolutions not shown.
|
| 48 |
+
|
| 49 |
+
(b) Block scores that have been expanded back to length $L$ . Softmax is taken over block scores at each position $i$ to form block weights for constructing latent subword representations.
|
| 50 |
+
|
| 51 |
+
In practice we set $s = b$ , thus $X _ { b } \in \mathbb { R } ^ { \frac { L } { b } \times d }$ . The construction of latent subword blocks creates a shorter overall sequence length by downsampling. We construct $X _ { b }$ for $b \in { 1 , \dots , M }$ , which can be seen in Figure 1 for $M = 4$ .
|
| 52 |
+
|
| 53 |
+
Considering Offsets A limitation of a strided implementation is that it is unable to model all possible subword windows. For instance, for the character sequence $[ a , b , c , d ]$ we would only be able to allocate $[ a , b ]$ and $[ c , d ]$ as subword blocks of length $b = 2$ and would ignore the subword block $[ b , c ]$ . Offsets can be used to model sliding windows of all possible subword blocks. We consider enumerating all possible strided blocks by additionally shifting sequences up until the offset $s$ . As this increases computation, we instead propose to first apply a 1D convolution to $X$ , prior to enumerating subword blocks. This effectively “smoothes” over the subword blocks. We use the variant with 1D convolutions in our main experiments and provide additional ablations in $\ S 8 . 3$ of the Appendix.
|
| 54 |
+
|
| 55 |
+
Considering Intra-block Positions It is important to preserve the ordering of the characters within the block $X _ { i } , X _ { i + 1 } , \ldots , X _ { i + b }$ . E.g., the output of $F$ should differ for the blocks abc and bca. For certain choices of $F$ it may be valuable to add a positional embedding (Vaswani et al., 2017) to $X _ { i : i + b }$ before applying $F$ . Note that this positional embedding would only be for individual blocks, and is not global to the entire input sequence. That is, only positional embedding values for positions $1 , \ldots , b$ would be used. However, in practice we apply a 1D convolution before the GBST layer and use the mean-pooling function for $F$ . We find this to be sufficient to distinguish between same sized blocks with different character orders.
|
| 56 |
+
|
| 57 |
+
# 2.1.2 BLOCK SCORING NETWORK
|
| 58 |
+
|
| 59 |
+
In order to allow the model to learn which block to select for every character position, we introduce a block scoring network. The block scoring network is simply a parameterized function $F _ { R } ( . )$ that produces a score for each candidate block. Given a subword candidate block $X _ { b , i } \in \mathbb { R } ^ { d }$ , we compute a score $p _ { b , i }$ associated with the block using a simple linear transformation $F _ { R } : \mathbb { R } ^ { d } \mathbb { R }$ :
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
p _ { b , i } = F _ { R } ( X _ { b , i } )
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
We perform ranking of subword blocks with regard to each character position in the original sequence. At every position $i$ , the model learns to select the most suitable subword block $X _ { b , i }$ among all block sizes $1 \leq b \leq M$ . As each sequence of subword blocks $X _ { b }$ is downsampled, we realign the representations of the subword blocks by upsampling each $X _ { b }$ to its original sequence length $L$ . Specifically, for a block size of $b$ , we replicate each block representation $X _ { b , i } b$ times. We then score each candidate block at each position $i$ using the softmax function:
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
P _ { i } = \mathrm { s o f t m a x } ( [ p _ { 1 , i } , p _ { 1 , i } , \cdot \cdot \cdot , p _ { M , i } ] ) ,
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
which computes a relative score of each candidate block at each position and $P _ { i } \in \mathbb { R } ^ { M }$ . We show the scoring of realigned blocks in Figure 1.
|
| 72 |
+
|
| 73 |
+
# 2.1.3 FORMING LATENT SUBWORDS
|
| 74 |
+
|
| 75 |
+
We then sum the representations of all subword blocks $X _ { b , i }$ at each position $i$ multiplied by their learned probability $P _ { b , i }$ to form a latent subword representation $\hat { X } _ { i } \in \mathbb { R } ^ { d }$ :
|
| 76 |
+
|
| 77 |
+
$$
|
| 78 |
+
\hat { X } _ { i } = \sum _ { b } ^ { M } P _ { b , i } X _ { b , i }
|
| 79 |
+
$$
|
| 80 |
+
|
| 81 |
+
Intuitively, the model learns an ideal subword block for each position. In contrast to standard deterministic subword tokenization algorithms, this selection is soft and can thus consider different possible segmentations at every position $i$ . In general, however, this formulation still assumes that subwords are contiguous sequences of characters. While additional context can be considered via the convolutions in $\ S 2 . 1 . 1$ , non-concatenative morphology where morphemes are discontinuous may be harder for the method to model.2
|
| 82 |
+
|
| 83 |
+
# 2.1.4 POSITION-WISE SCORE CALIBRATION
|
| 84 |
+
|
| 85 |
+
In the above approach, the scoring of each position is independent of other positions. We hypothesize that it may be beneficial for block scores at each position to be aware of each other. To this end, we introduce an optional module that enables learning a consensus among block scores by calculating dot products across the scores $P _ { i }$ across all positions $i \in [ 1 , L ]$ . This can be viewed as a form of self-attention across block scores, albeit without any projections for computational efficiency. To learn the new scores $\hat { P } \in \mathbb { R } ^ { L \times M }$ , we compute $\hat { P } = \operatorname { s o f t m a x } ( P P ^ { \top } ) P$ .
|
| 86 |
+
|
| 87 |
+
# 2.1.5 DOWNSAMPLING
|
| 88 |
+
|
| 89 |
+
After learning a candidate block or mixture of blocks for each position, we use a downsampling function $F _ { D } : \mathbb { R } ^ { L \times d } \mathbb { R } ^ { \frac { L } { d _ { s } } \times d }$ that downsamples the sequence of latent subwords $\hat { X } = [ \hat { X } _ { 1 } , \dots , \hat { X } _ { L } ]$ to $\tilde { X }$ , reducing its sequence length by a factor of $d _ { s }$ . We choose $F _ { D }$ to be a non-parameterized mean pooling operation. Notably, such simple stride-based pooling removes potential redundancies caused by adjacent positions selecting similar blocks as the mean pool of two identical block embeddings produces the same outcome. Intuitively, as the downsampling operation is fixed, the parameterized components preceding it should learn an optimal subword tokenization given the downsampling.
|
| 90 |
+
|
| 91 |
+
# 2.2 TRANSFORMER STACK
|
| 92 |
+
|
| 93 |
+
The remainder of the CHARFORMER model remains identical to a regular Transformer encoderdecoder model. The Transformer stack operates on the downsampled latent subwords $\tilde { X }$ instead of subword embeddings.
|
| 94 |
+
|
| 95 |
+
Re-scaling of the Transformer Stack While subword-based models allocate much of their capacity to subword embeddings—up to $71 \%$ of all parameters for contemporary multilingual models (Chung et al., 2021)—, the character vocabulary of character-level models is much smaller and thus less expressive. Similar to Xue et al. (2021), we hypothesize that character-level models require deeper encoder stacks than subword-based models to make up for their smaller embedding capacity. Consequently, we explore a scaling variant of CHARFORMER that puts more parameters at the encoder at the expense of the decoder while preferring a deep narrow model over a larger wide model. Specifically, we re-configure the Base model size to be similar to the T5 Small model size, with an expanded 24 layers in the encoder. The resulting $\mathbf { C } _ { \mathrm { H A R F O R M E R } _ { S B a s e } }$ (Scaled Base) has $1 3 4 M$ parameters, which is about $67 \%$ the parameter footprint of the standard base T5 model (200M parameters; Raffel et al., 2020). Moreover, this particular CHARFORMER model is approximately $5 0 \mathrm { - } 1 0 0 \%$ faster than the T5 base model (see $\ S 4$ ).3 For the re-scaled variant, we also used the GLU variant described in (Shazeer, 2020) which is commonly referred to as the V1.1 variant in the T5 library.
|
| 96 |
+
|
| 97 |
+
A Note on Comparing Character-level and Subword-based Methods Prior work on efficient methods generally compares models with the same number of parameters (Chung et al., 2021). However, whereas embedding look-up even with large vocabularies in subword-based methods is $\mathcal { O } ( 1 )$ , re-distributing the subword embedding parameters in character-level models such as ByT5 (Xue et al., 2021) to dense layers incurs much higher computational costs—a $2 5 \%$ penalty in training speed. We believe that a fair re-scaling of character-level models should not only aim to match the number of parameters but also the compute and inference costs of subword-based models under the assumption that char/byte-level models will require longer sequences (see $\ S 4$ for a comparison).
|
| 98 |
+
|
| 99 |
+
Span-based Pre-training Our pre-training scheme follows T5 quite closely. We mask $N$ contiguous characters and train to predict them in a sequence-to-sequence architecture following Xue et al. (2021). The model optimizes the cross-entropy loss and is trained with teacher forcing.
|
| 100 |
+
|
| 101 |
+
# 3 EXPERIMENTS
|
| 102 |
+
|
| 103 |
+
We evaluate our method both in English as well as in a multilingual setting on relevant benchmarks and compare against state-of-the-art character-level and subword-based methods.
|
| 104 |
+
|
| 105 |
+
# 3.1 EXPERIMENTS ON MONOLINGUAL ENGLISH DATASETS
|
| 106 |
+
|
| 107 |
+
Data To showcase the effectiveness of the proposed method, we evaluate on a diverse set of standard English tasks from GLUE covering sentiment classification (SST-2; Socher et al., 2013), natural language inference (MNLI, QNLI; Williams et al., 2018; Rajpurkar et al., 2016), paraphrase detection (Dolan and Brockett, 2005, MRPC, QQP) and sentence similarity (Cer et al., 2017). In addition, we evaluate on tasks that require dealing with long documents, both for sentiment analysis (IMDb; Maas et al., 2011) and news classification (AGNews; Zhang et al., 2015).
|
| 108 |
+
|
| 109 |
+
Baselines We compare CHARFORMER against the following state-of-the-art subword-based models: BERT (Devlin et al., 2019), an encoder-only pre-trained masked language model; and T5 (Raffel et al., 2020), an encoder-decoder model. We also compare against Byte-level T5 (Xue et al., 2021), a T5 model that is directly applied to bytes. We additionally evaluate the impact of the downsampling in CHARFORMER by comparing it to the downsampling used by the character-level CANINE (Clark et al., 2021) model in our framework. CANINE downsamples a character sequence using local attention and pooling via strided convolutions. As the original CANINE uses an encoder-only model and was only trained on multilingual data, we integrate CANINE-style downsampling into Byte-level T5, which we refer to as Byte-level T5+LASC (local attention–strided convolution).4 As an ablation for the GBST inductive bias, we compare against Byte-level $\mathrm { T } 5 + \mathrm { C o n v } _ { B a s e }$ a convolutional baseline of Byte-level T5 with a 1D convolution of filter size 5 placed before the encoder. Note that in all the baselines and for CHARFORMER base models, in the spirit of fair comparison, we compare them at an equal parameterization (size). Our scaling experiments are reserved for our SBase models, which is intended to only be compared with subword T5 models, and not to unscaled byte-level baselines. Finally, we include an SBase scaled version of Byte-level T5 for comparison.
|
| 110 |
+
|
| 111 |
+
Setup We evaluate Base and SBase configurations of CHARFORMER with 203M and 134M parameters respectively. We compare to Base configurations of BERT and T5 that have a similar number of parameters. We pre-train all models on the C4 corpus for 1M steps using a batch size of 64 and sequence length of 1024. All non-subword models use a vocabulary of 256 bytes.5 Our pre-training scheme corrupts spans with a mean length of 20 bytes. Each model is pre-trained on 16 TPU V3 chips. We pre-train our models with the Adafactor optimizer with an inverse square root learning rate. We then fine-tune on each individual task separately using a constant learning rate of $1 0 ^ { - 3 }$ . More details can be found in the Appendix.
|
| 112 |
+
|
| 113 |
+
Table 1: Comparison of CHARFORMER against other subword and character-level models with different parameter sizes on diverse standard English datasets.
|
| 114 |
+
|
| 115 |
+
<table><tr><td>Model</td><td>0</td><td>SST-2</td><td>MNLI</td><td>QNLI</td><td>MRPC</td><td>QQP</td><td>STSB</td><td>COLA</td><td>AVG</td></tr><tr><td>BERTBase,Subword</td><td>110M</td><td>92.7</td><td>84.4/-</td><td>88.4</td><td>86.7/-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>T5Base,Subword</td><td>220M</td><td>92.7</td><td>84.2/84.6</td><td>90.5</td><td>88.9/92.1</td><td>91.6/88.7</td><td>88.0</td><td>53.8</td><td>84.3</td></tr><tr><td>Byte-level T5 Base</td><td>200M</td><td>91.6</td><td>82.5/82.7</td><td>88.7</td><td>87.3/91.0</td><td>90.9/87.7</td><td>84.3</td><td>45.1</td><td>81.5</td></tr><tr><td>Byte-level T5+ConV Base</td><td>205M</td><td>89.8</td><td>81.1/82.5</td><td>89.2</td><td>83.6/89.2</td><td>90.7/87.7</td><td>85.0</td><td>47.1</td><td>81.2</td></tr><tr><td>Byte-level T5+LASCBase</td><td>205M</td><td>90.0</td><td>80.0/80.8</td><td>87.1</td><td>82.8/88.1</td><td>89.0/85.4</td><td>83.7</td><td>25.3</td><td>77.0</td></tr><tr><td>CHARFORMER Base</td><td>203M</td><td>91.6</td><td>82.6/82.7</td><td>89.0</td><td>87.3/91.1</td><td>91.2/88.1</td><td>85.3</td><td>42.6</td><td>81.4</td></tr><tr><td>Byte-level T5s Base</td><td>133M</td><td>91.2</td><td>83.9/83.7</td><td>90.9</td><td>85.5/89.2</td><td>91.1/88.1</td><td>85.7</td><td>49.3</td><td>82.6</td></tr><tr><td>CHARFORMERSBase</td><td>134M</td><td>91.5</td><td>83.7/84.4</td><td>91.0</td><td>87.5/91.4</td><td>91.4/88.5</td><td>87.3</td><td>51.8</td><td>83.6</td></tr></table>
|
| 116 |
+
|
| 117 |
+
Table 2: Results on comment classification on Civil Comments and Wiki Comments. Metrics are accuracy and AUC-PR. T5 baseline results are from (Tay et al., 2021).
|
| 118 |
+
|
| 119 |
+
<table><tr><td>Model</td><td>Civil Comments</td><td>Wiki Comments</td></tr><tr><td>T5Base,Subword</td><td>81.2/-</td><td>91.5/-</td></tr><tr><td>Byte-level T5 Base</td><td>82.8/78.7</td><td>93.2/75.4</td></tr><tr><td>Byte-level T5+LASCBase</td><td>82.9 / 78.2</td><td>93.0 / 75.0</td></tr><tr><td>CHARFORMER Base</td><td>83.0/78.8</td><td>92.7 / 79.7</td></tr><tr><td>CHARFORMER SBase</td><td>83.0 /78.9</td><td>93.5 /75.5</td></tr></table>
|
| 120 |
+
|
| 121 |
+
Table 3: Results on text classification on long documents.
|
| 122 |
+
|
| 123 |
+
<table><tr><td>Model</td><td>IMDb</td><td>News</td></tr><tr><td>T5 Base,Subword</td><td>94.2</td><td>93.5</td></tr><tr><td>Byte-level T5 Base</td><td>91.5</td><td>93.6</td></tr><tr><td>Byte-level T5+LASC Base</td><td>91.1</td><td>93.5</td></tr><tr><td>CHARFORMER Base</td><td>91.5</td><td>94.0</td></tr><tr><td>CHARFORMER SBase</td><td>94.4</td><td>94.1</td></tr></table>
|
| 124 |
+
|
| 125 |
+
Results For all result tables, we divide the table into three sections: subword baseline(s), un-scaled byte-level baselines, and scaled CHARFORMER results. If a section and task combination has more than one model result, we underline the best result. We show result for GLUE in Table 1. CHARFORMER outperforms other character-level baselines trained under the same conditions with the same number of parameters across all tasks, while being considerably faster and requiring less compute than T5-style models that are directly applied to bytes or characters (see $\ S 4$ ). CHARFORMERSBase performs even better despite having a smaller number of parameters compared to the Base configuration, demonstrating the usefulness of rescaling the transformer stack for character-level models. CHARFORMER $S B a s e$ furthermore is the only model that performs on par or even outperforms the standard subword-based models on some tasks in standard English. In Table 3 we provide results for text classification of long documents. Here, CHARFORMER $S B a s e$ is the only byte-level model to outperform $\mathrm { T } 5 _ { B a s e , S u b w o r d }$ on the IMDb classification task, and both CHARFORMER models outperform byte and subword level baselines on AGNews.
|
| 126 |
+
|
| 127 |
+
# 3.2 EXPERIMENTS ON NON-STANDARD ENGLISH DATASETS
|
| 128 |
+
|
| 129 |
+
The previous set of experiments demonstrated the ability of CHARFORMER to perform well on clean datasets consisting of standard English. However, character-level models are particularly suited to data that is noisy, containing spelling variations, typos, and other non-standard language.
|
| 130 |
+
|
| 131 |
+
Data To demonstrate CHARFORMER’s ability to perform well on such data, we evaluate on toxicity detection using the Civil Comments (Borkan et al., 2019) and the Wikipedia Comments (Wulczyn et al., 2017) datasets. Both are standard benchmarks that require estimating the toxicity of usergenerated content. We use the same setup as for the standard English datasets.
|
| 132 |
+
|
| 133 |
+
Results We show results in Table 2. Character-level models outperform the subword-based T5 model on both datasets, demonstrating their suitability to deal with such noisy, user-generated data. CHARFORMER achieves performs on par or outperforms other character-level methods on both datasets across the different model sizes.
|
| 134 |
+
|
| 135 |
+
# 3.3 MULTILINGUAL EXPERIMENTS
|
| 136 |
+
|
| 137 |
+
Data To evaluate the effectiveness of character-level models on multilingual data, we evaluate on standard cross-lingual question answering and classification tasks. In particular, we evaluate on the question answering tasks TyDiQA-GoldP (Clark et al., 2020), XQuAD (Artetxe et al., 2020), and MLQA (Lewis et al., 2020) as well as the natural language inference task XNLI (Conneau et al., 2018) and the paraphrase detection task PAWS-X (Yang et al., 2019) from XTREME (Hu et al., 2020). We evaluate on the in-language multi-task setting for TyDiQA-GoldP (Clark et al., 2020) where models are fine-tuned on the combined gold data in all target languages and the translate-train-all setting where models are fine-tuned on English training data plus translations in all target languages for the other datasets. Both are the best-performing settings for the respective tasks in (Hu et al., 2020). In addition, we evaluate on zero-shot cross-lingual transfer from English on XNLI and PAWS-X.
|
| 138 |
+
|
| 139 |
+
Table 4: Multilingual comparison of CHARFORMER against subword and byte-level models on in-language multi-task, translate-train multi-task, and cross-lingual zero-shot (training on English) settings. Model sizes are the same as those in Table 1. mBERT and mT5 baseline results are from (Xue et al., 2020).
|
| 140 |
+
|
| 141 |
+
<table><tr><td></td><td colspan="2">In-Language</td><td colspan="4">Translate-Train-All</td><td colspan="2">Zero-Shot</td></tr><tr><td>Model</td><td>|0</td><td>TyDiQA-GoldP</td><td>XQuAD</td><td>MLQA</td><td>XNLI</td><td>PAWS-X</td><td>XNLI</td><td>PAWS-X</td></tr><tr><td>mBERTBase (Subword)</td><td>179M</td><td>77.6/68.0</td><td>--</td><td>--</td><td>-</td><td>1</td><td>65.4</td><td>81.9</td></tr><tr><td>mT5 Base (Subword)</td><td>582M</td><td>80.8/70.0</td><td>75.3/59.7</td><td>67.6/48.5</td><td>75.9</td><td>89.3</td><td>75.4</td><td>86.4</td></tr><tr><td>Byte-level T5 Base</td><td>200M</td><td>75.6/65.4</td><td>68.6/54.3</td><td>61.8/44.4</td><td>69.4</td><td>87.1</td><td>57.4</td><td>80.9</td></tr><tr><td>Byte-level T5+LASCBase</td><td>205M</td><td>70.6/59.7</td><td>66.8/52.1</td><td>58.8/41.1</td><td>67.9</td><td>84.8</td><td>55.2</td><td>79.0</td></tr><tr><td>CHARFORMER Base</td><td>203M</td><td>75.9/65.6</td><td>70.2/55.9</td><td>62.6/44.9</td><td>71.1</td><td>87.2</td><td>57.6</td><td>81.6</td></tr><tr><td>CHARFORMER S Base</td><td>134M</td><td>79.1/68.8</td><td>73.6/59.0</td><td>66.3/48.5</td><td>72.2</td><td>88.2</td><td>66.6</td><td>85.2</td></tr><tr><td>CHARFORMER s Base,LongPT</td><td>134M</td><td>81.2/71.3</td><td>74.2/59.8</td><td>67.2/49.4</td><td>72.8</td><td>88.6</td><td>67.8</td><td>83.7</td></tr></table>
|
| 142 |
+
|
| 143 |
+
Table 5: Comparison of pre-training compute metrics for mT5 (Subword) versus comparable quality CHARFORMER models on the $\mathrm { m C 4 }$ dataset. 64 TPUv3 chips were used for this experiment. CHARFORMERSBase sees the same number of tokens after downsampling as $\operatorname* { m T } 5 _ { B a s e }$ , while CHARFORMER $S B a s e , L o n g P T$ roughly sees the same amount of raw text as $\mathrm { m T } 5 _ { B a s e }$ , given that a SentencePiece subword token is about 4.1 bytes on average (Xue et al., 2021). CHARFORMERSBase is $28 \%$ faster than $\mathrm { m T } 5 _ { B a s e }$ , while using $33 \%$ of the FLOPS.
|
| 144 |
+
|
| 145 |
+
<table><tr><td>Model</td><td>Batch Size</td><td>L</td><td>ds</td><td>|0</td><td>Speed (steps/s)</td><td>FLOPS</td></tr><tr><td>mT5 Base (Subword)</td><td>1024</td><td>1024</td><td>-</td><td>582M</td><td>1.54</td><td>1.3 × 1015</td></tr><tr><td>CHARFORMERS Base</td><td>1024</td><td>2048</td><td>2</td><td>134M</td><td>1.98</td><td>4.3 ×1014</td></tr><tr><td>CHARFORMERs Base,LongPT</td><td>2048</td><td>2048</td><td>2</td><td>134M</td><td>1.01</td><td>4.3× 1014</td></tr></table>
|
| 146 |
+
|
| 147 |
+
Baselines We compare to strong multilingual subword-based baselines including multilingual BERT (Devlin et al., 2019) and multilingual T5 (Xue et al., 2020). In addition, we compare to the byte-level models from $\ S 3 . 1$ , which we pre-train on multilingual data.
|
| 148 |
+
|
| 149 |
+
Setup We pre-train CHARFORMER as well as the Byte-level T5 and Byte-level T5+LASC baselines on multilingual $\mathrm { m C 4 }$ Common Crawl (Xue et al., 2020) in 101 languages. Base size models were trained for 1M steps using a batch size of 64 and sequence length of 2048, with the exception of Byte-level $\mathrm { T } 5 _ { B a s e }$ , which was trained with a sequence length of 1024, as training speed was prohibitively slow (see Table 11). CHARFORMER $S B a s e$ and CHARFORMER $S B a s e , L o n g P T$ (longer pre-training) are trained with larger batch sizes for fair comparison with mT5. In particular, CHAR$\mathrm { F O R M E R } _ { S B a s e }$ pre-trains on the same amount of tokens after downsampling as $\mathbf { m T } 5 _ { B a s e }$ , while CHARFORMERSBase,LongP T pre-trains on roughly the same amount of raw text as $\operatorname* { m T } 5 _ { B a s e }$ , given that a SentencePiece subword token is about 4.1 bytes on average (Xue et al., 2021); see Table 5 for further details. All models were fine-tuned with an input sequence length of 4096 for questionanswering tasks and 2048 for inference tasks. Score calibration was not used for these experiments, as it did not benefit the model in the multilingual setting. For XNLI and PAWS-X (both translate-train and zero-shot settings), we also observed that performance improved if the GBST layer was not updated during fine-tuning; the reported CHARFORMER numbers reflect this configuration. Otherwise, all other hyper-parameters and model sizes are unchanged from the English experimental setup.
|
| 150 |
+
|
| 151 |
+
Results We show in-language multi-task, translate-train, and cross-lingual zero-shot results in Table 4. CHARFORMER $S B a s e$ is competitive with standard subword-based models and CHARFORMERSBase,LongP T outperforms subword-based models on TyDiQA-GoldP (in-language multitask). Additionally, in the translate-train setting CHARFORMER $S B a s e , L o n g P T$ is on par with subword models on XQuAD and MLQA, and close to parity on PAWS-X. Furthermore, CHARFORMER outperforms other character-level models in the zero-shot setting. However, we observe that this setting still remains a challenge for token-free models in general. We hypothesize that model size may be a major factor here. Finally, we provide additional comparison between GBST and LASC at a fixed down-sampling rate in Section 8.4 (Appendix), showing that GBST significantly outperforms LASC on TyDiQA.
|
| 152 |
+
|
| 153 |
+
Table 6: Pre-training compute metrics of models at different input lengths, downsampling rates, and model sizes on the English C4 dataset. 16 TPUv3 chips were used for this experiment. These numbers reflect a batch size of 64. Memory refers to per-device peak memory usage on TPUv3 chips.
|
| 154 |
+
|
| 155 |
+
<table><tr><td>Model</td><td>L</td><td>ds</td><td>0</td><td>Speed (steps/s)</td><td>FLOPS</td><td>Peak Mem.</td></tr><tr><td>T5Base :(Subword)</td><td>512</td><td>-</td><td>220M</td><td>9.3</td><td>1.1 × 1013</td><td>=</td></tr><tr><td>Byte-level T5 Base</td><td>1024</td><td>1</td><td>200M</td><td>8.2</td><td>2.9×1013</td><td>3.09GB</td></tr><tr><td>Byte-level T5+LASC Base</td><td>1024</td><td>4</td><td>205M</td><td>15</td><td>9.9 ×1012</td><td>1.62GB</td></tr><tr><td>CHARFORMER Base</td><td>1024</td><td>2</td><td>206M</td><td>11</td><td>1.6 ×1013</td><td>1.95GB</td></tr><tr><td>CHARFORMER Base</td><td>1024</td><td>3</td><td>203M</td><td>15</td><td>1.1 × 1013</td><td>1.63GB</td></tr><tr><td>CHARFORMERSBase</td><td>1024</td><td>2</td><td>134M</td><td>14</td><td>1.3 × 1013</td><td>1.73GB</td></tr><tr><td>CHARFORMERSBase</td><td>1024</td><td>3</td><td>134M</td><td>20</td><td>8.7×1012</td><td>1.34GB</td></tr></table>
|
| 156 |
+
|
| 157 |
+

|
| 158 |
+
Figure 2: Visualization of block scores (softmax weights) for every byte position from multilingual CHARFORMER $S B a s e$ on an example English input.
|
| 159 |
+
|
| 160 |
+
# 4 SPEED, MEMORY AND PARAMETERS
|
| 161 |
+
|
| 162 |
+
Table 6 reports the speed (global training steps per second), parameter sizes and number of floating point operations (FLOPS) for each forward pass of the models used in our experiments. All experiments were run on 16 TPU-v3 chips and speed is benchmarked on English C4 pre-training at the 1K input length $( L )$ . CHARFORMER models are generally more efficient both in terms of speed and FLOPS compared to other character-level models at different parameter sizes. With a low down-sampling rate $d _ { s }$ for CHARFORMER, Byte-level T5+LASC is more efficient due to using a higher down-sampling rate. Directly consuming the character sequence with a Transformer model is slow and requires a large number of FLOPS, which is exacerbated with longer sequence lengths where Byte-level T5 is more than $2 \times$ slower than the fastest CHARFORMER. This difference is even larger at longer input sequence lengths, which we report in the Appendix. CHARFORMERSBase achieves better performance (see $\ S 3$ ) with fewer parameters but more FLOPS by using a deep thin encoder and is twice as fast as the subword-based model with similar performance, $\mathrm { T } 5 _ { B a s e }$ .
|
| 163 |
+
|
| 164 |
+
# 5 VISUALIZING LATENT SUBWORDS
|
| 165 |
+
|
| 166 |
+
One benefit of CHARFORMER compared to other character-level methods is that the subwords it learns are directly interpretable and may give some indications to the behaviour of the underlying model. We visualize the scores the multilingual CHARFORMER has learned to assign to subword blocks of different sizes for the string ‘on subword tokenization’ in Figure 2. We observe that the model learns to allocate single-character subword blocks predominantly to vowels and whitespace in English. Moreover, in English the model allocates larger subword blocks to the beginning and end consonants of a subword. Together, we believe this suggests that the model has learned a meaningful segmentation of the input, and that it is able to dynamically mix between byte-level and subword-level features. Such behaviour could also parallel the relative importance attributed to consonants for word identification observed during reading in humans (Lee et al., 2001; Carreiras et al., 2008).
|
| 167 |
+
|
| 168 |
+
# 6 RELATED WORK
|
| 169 |
+
|
| 170 |
+
Subword tokenization Standard algorithms for deterministic subword tokenization are Byte Pair Encoding (BPE; Sennrich et al., 2016), Wordpiece (Wu et al., 2016), and SentencePiece (Kudo and Richardson, 2018). Prior work has highlighted issues with some of these algorithms (Bostrom and Durrett, 2020) and has generally observed that models learned with such rigid tokenization do not cope well with variation in language (Sun et al., 2020). To make a model more robust to morphological and compositional generalization, probabilistic segmentation algorithms such as subword regularization (Kudo, 2018) and BPE-dropout (Provilkov et al., 2020) have been proposed, which sample different segmentations during training. Recent methods propose to make models more robust for downstream tasks by enforcing prediction consistency between deterministic and probabilistic segmentations (Wang et al., 2021) and propose to update the tokenizer based on the downstream loss under different segmentations (Hiraoka et al., 2020; 2021). He et al. (2020) proposed DPE (dynamic programming encoding), a segmentation-based tokenization algorithm based on dynamic programming. Such methods, however, incur large computation costs due multiple forward passes needing to be performed for each segmentation of an example or due to the expensive DP computation, which make them unsuitable for pre-training.
|
| 171 |
+
|
| 172 |
+
Character-level models For recurrent neural networks, pure character-level models that take a sequence of characters as input (Graves, 2013; Zhang et al., 2015; Hwang and Sung, 2017) have mostly been superseded by character-aware methods that compute a token-level representation using a CNN over characters (Kim et al., 2016; Jozefowicz et al., 2016; Peters et al., 2018) due to poor performance when learning directly from characters. Such character-aware representations have lately been applied to deep Transformer models (El Boukkouri et al., 2020; Ma et al., 2020). These methods, however, still require tokenization for pre-processing and cannot be directly applied to languages without whitespace separation. Prior work also learned segmentation as part of the model but did not scale very well (Wang et al., 2017; Kreutzer and Sokolov, 2018; Kawakami et al., 2019). One notable exception is (Lee et al., 2017), which enabled fully character-level neural machine translation, using stacked convolutions, max pooling, and highway networks. Building on this, recent tokenization-free approaches such as CANINE (Clark et al., 2021) revisit the original character-level setting in the context of large pre-trained language models with a focus on multilingual models. Our method outperforms CANINE-style downsampling (local attention, strided convolutions) and also leads to improvements in the monolingual setting, while using less compute and parameters to down-sample than both Lee et al. (2017) and Clark et al. (2021). Recently, ByT5 (Xue et al., 2021) set new start-of-the-art results for tokenization-free models, by operating on the byte-level. This work performs on par with or outperforms ByT5, with significant gains in speed and compute efficiency.
|
| 173 |
+
|
| 174 |
+
Multilingual models Current multilingual models are generally analogues to successful monolingual Transformer models (Ruder et al., 2021). Consequently, models such as multilingual BERT (Devlin et al., 2019) and XLM-R (Conneau et al., 2020) employ the same subword tokenization algorithms as monolingual models, now applied to a massively multilingual corpus. In the multilingual setting, the problems of subword-based tokenization are exacerbated as tokens in languages with few data are over-segmented while high-frequency tokens are under-segmented, which limits cross-lingual transfer (Wang et al., 2021). This motivates our work as well as recent work on character-level models.
|
| 175 |
+
|
| 176 |
+
Efficient Transformers Moving from subwords to characters significantly increases the sequence length, which is an issue for Transformers due to the quadratic complexity of self-attention. Many efficient self-attention models have been proposed (Choromanski et al., 2020; Wang et al., 2020; Zaheer et al., 2020) to tackle this problem; see (Tay et al., 2020b;a) for a comprehensive overview. Notably, the CANINE model uses local attention (Parmar et al., 2018), which could also be swapped with another efficient Transformer variant. We note that the problem of efficiency is important but not the only challenge towards developing performant tokenization-free models. While applying an efficient attention mechanism might solve the fundamental computational costs of employing character-level models, there is no guarantee that these models will learn locally meaningful compositions.
|
| 177 |
+
|
| 178 |
+
# 7 CONCLUSION
|
| 179 |
+
|
| 180 |
+
We have proposed CHARFORMER, a re-scaled Transformer architecture that integrates gradient-based subword tokenization, a novel lightweight tokenization method that enables efficient end-to-end learning of latent subwords directly from characters. We have demonstrated that English and multilingual variants of CHARFORMER outperform strong character-level baselines across various datasets while being more efficient. CHARFORMER achieves performance on par with subword-based models on standard English tasks and outperforms subword-based models on noisy social media data. On multilingual data, CHARFORMER generally performs on par with subword-based models, while being faster than both byte-level and subword-level baselines. Finally, we provide a method to inspect the inner workings of the GBST module. Overall, we believe that the strong results presented in this paper pave the way for highly effective and powerful token-free models.
|
| 181 |
+
|
| 182 |
+
# ACKNOWLEDGEMENTS
|
| 183 |
+
|
| 184 |
+
We would like to thank Jon Clark, Noah Constant, and Kris Cao for valuable feedback on drafts of this manuscript.
|
| 185 |
+
|
| 186 |
+
# ETHICS STATEMENT
|
| 187 |
+
|
| 188 |
+
Standard subword tokenization algorithms produce segmentations that do not equally represents words and phrases in different languages. Instead, they are biased towards languages that already have many resources available, which leads to multilingual models performing worse on underrepresented languages (Wang et al., 2021). Tokenization-free approaches such as the one proposed in this paper may help to ameliorate this to some extent. Another challenge to using large multilingual models in practice is their relative computational inefficiency, which makes them unsuitable in resource-constrained settings common in scenarios where under-represented languages are spoken. CHARFORMER trains $28 \%$ faster than mT5 and has $3 \times$ fewer parameters, so may be a more suitable choice in such settings compared to state-of-the-art multilingual models.
|
| 189 |
+
|
| 190 |
+
# REPRODUCIBILITY STATEMENT
|
| 191 |
+
|
| 192 |
+
All code to train the core byte-level Transformer encoder-decoder for CHARFORMER its variants is already open-sourced as a part of the Mesh Tensorflow6 (Shazeer et al., 2018), $\mathrm { T } 5 ^ { 7 }$ (Raffel et al., 2020), and ByT58 (Xue et al., 2021) libraries. Additionally, an implementation of Charformer GBST compatible with existing open-source models has been open-sourced9. We also include a simplified Tensorflow implementation of GBST in Section 8.7 of the Appendix. All detailed experiment and hyperparameter settings required to reproduce our experiments can be found in Section 8.2 of the Appendix.
|
| 193 |
+
|
| 194 |
+
# REFERENCES
|
| 195 |
+
|
| 196 |
+
Mikel Artetxe, Sebastian Ruder, and Dani Yogatama. On the Cross-lingual Transferability of Monolingual Representations. In Proceedings of ACL 2020, 2020. URL http://arxiv.org/ abs/1910.11856.
|
| 197 |
+
|
| 198 |
+
Yonatan Belinkov and Yonatan Bisk. Synthetic and Natural Noise Both Break Neural Machine Translation. In Proceedings of ICLR 2018, 2018. URL http://arxiv.org/abs/1711. 02173.
|
| 199 |
+
|
| 200 |
+
Daniel Borkan, Lucas Dixon, Jeffrey Sorensen, Nithum Thain, and Lucy Vasserman. Nuanced metrics for measuring unintended bias with real data for text classification. CoRR, abs/1903.04561, 2019. URL http://arxiv.org/abs/1903.04561.
|
| 201 |
+
|
| 202 |
+
Kaj Bostrom and Greg Durrett. Byte Pair Encoding is Suboptimal for Language Model Pretraining. In Findings of EMNLP 2020, pages 4617–4624, 2020. doi: 10.18653/v1/2020.findings-emnlp.414.
|
| 203 |
+
|
| 204 |
+
Manuel Carreiras, Margaret Gillon-Dowens, Marta Vergara, and Manuel Perea. Are vowels and consonants processed differently? event-related potential evidence with a delayed letter paradigm. Journal of Cognitive Neuroscience, 21(2):275–288, 2008.
|
| 205 |
+
|
| 206 |
+
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.
|
| 207 |
+
|
| 208 |
+
Krzysztof Choromanski, Valerii Likhosherstov, David Dohan, Xingyou Song, Andreea Gane, Tamas Sarlos, Peter Hawkins, Jared Davis, Afroz Mohiuddin, Lukasz Kaiser, et al. Rethinking attention with performers. arXiv preprint arXiv:2009.14794, 2020.
|
| 209 |
+
|
| 210 |
+
Hyung Won Chung, Thibault Févry, Henry Tsai, Melvin Johnson, and Sebastian Ruder. Rethinking Embedding Coupling in Pre-trained Language Models. In Proceedings of ICLR 2021, 2021.
|
| 211 |
+
|
| 212 |
+
Jon Clark, Tom Kwiatkowski, Jennimaria Palomaki, Michael Collins, and Dan Garrette. TyDi QA: A Benchmark for Information-Seeking Question Answering in Typologically Diverse Languages. In Transactions of the ACL, 2020.
|
| 213 |
+
|
| 214 |
+
Jonathan H Clark, Dan Garrette, Iulia Turc, and John Wieting. Canine: Pre-training an efficient tokenization-free encoder for language representation. arXiv preprint arXiv:2103.06874, 2021.
|
| 215 |
+
|
| 216 |
+
Alexis Conneau, Guillaume Lample, Ruty Rinott, Adina Williams, Samuel R. Bowman, Holger Schwenk, and Veselin Stoyanov. XNLI: Evaluating Cross-lingual Sentence Representations. In Proceedings of EMNLP 2018, 2018. URL http://arxiv.org/abs/1809.05053.
|
| 217 |
+
|
| 218 |
+
Alexis Conneau, Kartikay Khandelwal, Naman Goyal, Vishrav Chaudhary, Guillaume Wenzek, Francisco Guzmán, Edouard Grave, Myle Ott, Luke Zettlemoyer, and Veselin Stoyanov. Unsupervised cross-lingual representation learning at scale. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 8440–8451, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.747. URL https://www.aclweb.org/anthology/2020.acl-main.747.
|
| 219 |
+
|
| 220 |
+
Jacob Devlin. Sharp models on dull hardware: Fast and accurate neural machine translation decoding on the cpu. arXiv preprint arXiv:1705.01991, 2017.
|
| 221 |
+
|
| 222 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. In Proceedings of NAACL 2019, 2019. URL http://arxiv.org/abs/1810.04805.
|
| 223 |
+
|
| 224 |
+
William B Dolan and Chris Brockett. Automatically constructing a corpus of sentential paraphrases. In Proceedings of the Third International Workshop on Paraphrasing (IWP2005), 2005.
|
| 225 |
+
|
| 226 |
+
Hicham El Boukkouri, Olivier Ferret, Thomas Lavergne, Hiroshi Noji, Pierre Zweigenbaum, and Jun’ichi Tsujii. CharacterBERT: Reconciling ELMo and BERT for word-level open-vocabulary representations from characters. In Proceedings of the 28th International Conference on Computational Linguistics, pages 6903–6915, Barcelona, Spain (Online), December 2020. International Committee on Computational Linguistics. doi: 10.18653/v1/2020.coling-main.609. URL https://www.aclweb.org/anthology/2020.coling-main.609.
|
| 227 |
+
|
| 228 |
+
Chengyue Gong, Di He, Xu Tan, Tao Qin, Liwei Wang, and Tie-Yan Liu. FRAGE: FrequencyAgnostic Word Representation. In Proceedings of NIPS 2018, 2018.
|
| 229 |
+
|
| 230 |
+
Alex Graves. Generating sequences with recurrent neural networks. arXiv preprint arXiv:1308.0850, 2013.
|
| 231 |
+
|
| 232 |
+
Xuanli He, Gholamreza Haffari, and Mohammad Norouzi. Dynamic programming encoding for subword segmentation in neural machine translation. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 3042–3051, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.275. URL https://www. aclweb.org/anthology/2020.acl-main.275.
|
| 233 |
+
|
| 234 |
+
Tatsuya Hiraoka, Sho Takase, Kei Uchiumi, Atsushi Keyaki, and Naoaki Okazaki. Optimizing word segmentation for downstream task. In Findings of the Association for Computational Linguistics: EMNLP 2020, pages 1341–1351, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.findings-emnlp.120. URL https: //www.aclweb.org/anthology/2020.findings-emnlp.120.
|
| 235 |
+
|
| 236 |
+
Tatsuya Hiraoka, Sho Takase, Kei Uchiumi, Atsushi Keyaki, and Naoaki Okazaki. Joint Optimization of Tokenization and Downstream Model. In Findings of ACL-IJCNLP 2021, 2021. URL http: //arxiv.org/abs/2105.12410.
|
| 237 |
+
|
| 238 |
+
Jeremy Howard and Sebastian Ruder. Universal Language Model Fine-tuning for Text Classification. In Proceedings of ACL 2018, 2018. URL http://arxiv.org/abs/1801.06146.
|
| 239 |
+
|
| 240 |
+
Junjie Hu, Sebastian Ruder, Aditya Siddhant, Graham Neubig, Orhan Firat, and Melvin Johnson. XTREME: A Massively Multilingual Multi-task Benchmark for Evaluating Cross-lingual Generalization. In Proceedings of ICML 2020, 2020.
|
| 241 |
+
|
| 242 |
+
Kyuyeon Hwang and Wonyong Sung. Character-level language modeling with hierarchical recurrent neural networks. In 2017 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 5720–5724. IEEE, 2017.
|
| 243 |
+
|
| 244 |
+
Rafal Jozefowicz, Oriol Vinyals, Mike Schuster, Noam Shazeer, and Yonghui Wu. Exploring the limits of language modeling. arXiv preprint arXiv:1602.02410, 2016.
|
| 245 |
+
|
| 246 |
+
Jungo Kasai, Nikolaos Pappas, Hao Peng, James Cross, and Noah A. Smith. Deep Encoder, Shallow Decoder: Reevaluating Non-autoregressive Machine Translation. In Proceedings of ICLR 2021, 2021. ISBN 0080437516.
|
| 247 |
+
|
| 248 |
+
Kazuya Kawakami, Chris Dyer, and Phil Blunsom. Learning to discover, ground and use words with segmental neural language models. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 6429–6441, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1645. URL https://www.aclweb.org/ anthology/P19-1645.
|
| 249 |
+
|
| 250 |
+
Yoon Kim, Yacine Jernite, David Sontag, and Alexander Rush. Character-aware neural language models. In Proceedings of the AAAI conference on artificial intelligence, volume 30, 2016.
|
| 251 |
+
|
| 252 |
+
Julia Kreutzer and Artem Sokolov. Learning to segment inputs for nmt favors character-level processing, 2018.
|
| 253 |
+
|
| 254 |
+
Taku Kudo. Subword regularization: Improving neural network translation models with multiple subword candidates. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 66–75, Melbourne, Australia, July 2018. Association for Computational Linguistics. doi: 10.18653/v1/P18-1007. URL https://www.aclweb.org/anthology/P18-1007.
|
| 255 |
+
|
| 256 |
+
Taku Kudo and John Richardson. SentencePiece: A simple and language independent subword tokenizer and detokenizer for neural text processing. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 66–71, Brussels, Belgium, November 2018. Association for Computational Linguistics. doi: 10.18653/v1/ D18-2012. URL https://www.aclweb.org/anthology/D18-2012.
|
| 257 |
+
|
| 258 |
+
Guillaume Lample and Alexis Conneau. Cross-lingual Language Model Pretraining. In Proceedings of NeurIPS 2019, 2019. URL https://github.com/google-research/bert.
|
| 259 |
+
|
| 260 |
+
Hye-Won Lee, Keith Rayner, and Alexander Pollatsek. The relative contribution of consonants and vowels to word identification during reading. Journal of Memory and Language, 44(2):189–205, 2001.
|
| 261 |
+
|
| 262 |
+
Jason Lee, Kyunghyun Cho, and Thomas Hofmann. Fully character-level neural machine translation without explicit segmentation. Transactions of the Association for Computational Linguistics, 5:365–378, 2017. doi: 10.1162/tacl_a_00067. URL https://aclanthology.org/ Q17-1026.
|
| 263 |
+
|
| 264 |
+
Patrick Lewis, Barlas Oguz, Ruty Rinott, Sebastian Riedel, and Holger Schwenk. MLQA: Evaluating ˘ Cross-lingual Extractive Question Answering. In Proceedings of ACL 2020, 2020. URL http: //arxiv.org/abs/1910.07475.
|
| 265 |
+
|
| 266 |
+
Wentao Ma, Yiming Cui, Chenglei Si, Ting Liu, Shijin Wang, and Guoping Hu. CharBERT: Characteraware pre-trained language model. In Proceedings of the 28th International Conference on Computational Linguistics, pages 39–50, Barcelona, Spain (Online), December 2020. International Committee on Computational Linguistics. doi: 10.18653/v1/2020.coling-main.4. URL https: //www.aclweb.org/anthology/2020.coling-main.4.
|
| 267 |
+
|
| 268 |
+
Andrew Maas, Raymond E Daly, Peter T Pham, Dan Huang, Andrew $\mathrm { ~ Y ~ N ~ g ~ }$ , and Christopher Potts. Learning word vectors for sentiment analysis. In Proceedings of the 49th annual meeting of the association for computational linguistics: Human language technologies, pages 142–150, 2011.
|
| 269 |
+
|
| 270 |
+
Christopher Manning and Hinrich Schütze. Foundations of statistical natural language processing. MIT press, 1999.
|
| 271 |
+
|
| 272 |
+
Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. Distributed Representations of Words and Phrases and their Compositionality. In Advances in Neural Information Processing Systems, 2013.
|
| 273 |
+
|
| 274 |
+
Niki Parmar, Ashish Vaswani, Jakob Uszkoreit, Lukasz Kaiser, Noam Shazeer, Alexander Ku, and Dustin Tran. Image transformer. In International Conference on Machine Learning, pages 4055–4064. PMLR, 2018.
|
| 275 |
+
|
| 276 |
+
Matthew E. Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. Deep contextualized word representations. In Proceedings of NAACL-HLT 2018, 2018.
|
| 277 |
+
|
| 278 |
+
Ivan Provilkov, Dmitrii Emelianenko, and Elena Voita. BPE-dropout: Simple and effective subword regularization. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 1882–1892, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.170. URL https://www.aclweb.org/anthology/2020. acl-main.170.
|
| 279 |
+
|
| 280 |
+
Danish Pruthi, Bhuwan Dhingra, and Zachary C. Lipton. Combating adversarial misspellings with robust word recognition. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5582–5591, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1561. URL https://www.aclweb.org/ anthology/P19-1561.
|
| 281 |
+
|
| 282 |
+
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, 2020. URL http: //arxiv.org/abs/1910.10683.
|
| 283 |
+
|
| 284 |
+
Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. SQuAD: $^ { 1 0 0 , 0 0 0 + }$ questions for machine comprehension of text. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 2383–2392, Austin, Texas, November 2016. Association for Computational Linguistics. doi: 10.18653/v1/D16-1264. URL https://www.aclweb. org/anthology/D16-1264.
|
| 285 |
+
|
| 286 |
+
Sebastian Ruder, Noah Constant, Jan Botha, Aditya Siddhant, Orhan Firat, Jinlan Fu, Pengfei Liu, Junjie Hu, Graham Neubig, and Melvin Johnson. Xtreme-r: Towards more challenging and nuanced multilingual evaluation. arXiv preprint arXiv:2104.07412, 2021.
|
| 287 |
+
|
| 288 |
+
Mike Schuster and Kaisuke Nakajima. Japanese and korean voice search. In 2012 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 5149–5152. IEEE, 2012.
|
| 289 |
+
|
| 290 |
+
Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1715–1725, Berlin, Germany, August 2016. Association for Computational Linguistics. doi: 10.18653/v1/P16-1162. URL https://www.aclweb.org/anthology/P16-1162.
|
| 291 |
+
|
| 292 |
+
Noam Shazeer. Glu variants improve transformer. arXiv preprint arXiv:2002.05202, 2020.
|
| 293 |
+
|
| 294 |
+
Noam Shazeer, Youlong Cheng, Niki Parmar, Dustin Tran, Ashish Vaswani, Penporn Koanantakool, Peter Hawkins, HyoukJoong Lee, Mingsheng Hong, Cliff Young, et al. Mesh-tensorflow: Deep learning for supercomputers. arXiv preprint arXiv:1811.02084, 2018.
|
| 295 |
+
|
| 296 |
+
Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D. Manning, Andrew $\mathrm { N g }$ , 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, Seattle, Washington, USA, October 2013. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/D13-1170.
|
| 297 |
+
|
| 298 |
+
Lichao Sun, Kazuma Hashimoto, Wenpeng Yin, Akari Asai, Jia Li, Philip Yu, and Caiming Xiong. Adv-bert: Bert is not robust on misspellings! generating nature adversarial samples on bert. arXiv preprint arXiv:2003.04985, 2020.
|
| 299 |
+
|
| 300 |
+
Yi Tay, Mostafa Dehghani, Samira Abnar, Yikang Shen, Dara Bahri, Philip Pham, Jinfeng Rao, Liu Yang, Sebastian Ruder, and Donald Metzler. Long range arena: A benchmark for efficient transformers. arXiv preprint arXiv:2011.04006, 2020a.
|
| 301 |
+
|
| 302 |
+
Yi Tay, Mostafa Dehghani, Dara Bahri, and Donald Metzler. Efficient transformers: A survey. arXiv preprint arXiv:2009.06732, 2020b.
|
| 303 |
+
|
| 304 |
+
Yi Tay, Mostafa Dehghani, Jai Gupta, Dara Bahri, Vamsi Aribandi, Zhen Qin, and Donald Metzler. Are pre-trained convolutions better than pre-trained transformers? arXiv preprint arXiv:2105.03322, 2021.
|
| 305 |
+
|
| 306 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Ł ukasz Kaiser, and Illia Polosukhin. Attention is all you need. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017. URL https://proceedings.neurips.cc/paper/2017/file/ 3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf.
|
| 307 |
+
|
| 308 |
+
Chong Wang, Yining Wang, Po-Sen Huang, Abdelrahman Mohamed, Dengyong Zhou, and Li Deng. Sequence modeling via segmentations. In International Conference on Machine Learning, pages 3674–3683. PMLR, 2017.
|
| 309 |
+
|
| 310 |
+
Sinong Wang, Belinda Li, Madian Khabsa, Han Fang, and Hao Ma. Linformer: Self-attention with linear complexity. arXiv preprint arXiv:2006.04768, 2020.
|
| 311 |
+
|
| 312 |
+
Xinyi Wang, Sebastian Ruder, and Graham Neubig. Multi-view Subword Regularization. In Proceedings of NAACL 2021, 2021. URL http://arxiv.org/abs/2103.08490.
|
| 313 |
+
|
| 314 |
+
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, New Orleans, Louisiana, June 2018. Association for Computational Linguistics. doi: 10.18653/v1/N18-1101. URL https://www.aclweb.org/anthology/N18-1101.
|
| 315 |
+
|
| 316 |
+
Yonghui Wu, Mike Schuster, Zhifeng Chen, Quoc V Le, Mohammad Norouzi, Wolfgang Macherey, Maxim Krikun, Yuan Cao, Qin Gao, Klaus Macherey, Jeff Klingner, Apurva Shah, Melvin Johnson, Xiaobing Liu, Łukasz Kaiser, Stephan Gouws, Yoshikiyo Kato, Taku Kudo, Hideto Kazawa, Keith Stevens, George Kurian, Nishant Patil, Wei Wang, Cliff Young, Jason Smith, Jason Riesa, Alex Rudnick, Oriol Vinyals, Greg Corrado, Macduff Hughes, and Jeffrey Dean. Google’s Neural Machine Translation System: Bridging the Gap between Human and Machine Translation. arXiv preprint arXiv:1609.08144, 2016.
|
| 317 |
+
|
| 318 |
+
Ellery Wulczyn, Nithum Thain, and Lucas Dixon. Ex machina: Personal attacks seen at scale. In Proceedings of the 26th International Conference on World Wide Web, WWW ’17, pages 1391– 1399, Republic and Canton of Geneva, CHE, 2017. International World Wide Web Conferences Steering Committee. ISBN 9781450349130. doi: 10.1145/3038912.3052591. URL https: //doi.org/10.1145/3038912.3052591.
|
| 319 |
+
|
| 320 |
+
Linting Xue, Noah Constant, Adam Roberts, Mihir Kale, Rami Al-Rfou, Aditya Siddhant, Aditya Barua, and Colin Raffel. mT5: A massively multilingual pre-trained text-to-text transformer, 2020.
|
| 321 |
+
|
| 322 |
+
Linting Xue, Aditya Barua, Noah Constant, Rami Al-Rfou, Sharan Narang, Mihir Kale, Adam Roberts, and Colin Raffel. ByT5: Towards a token-free future with pre-trained byte-to-byte models. arXiv preprint arXiv:2105.13626, 2021. URL http://arxiv.org/abs/2105.13626.
|
| 323 |
+
|
| 324 |
+
Yinfei Yang, Yuan Zhang, Chris Tar, and Jason Baldridge. PAWS-X: A Cross-lingual Adversarial Dataset for Paraphrase Identification. In Proceedings of EMNLP 2019, 2019. URL http: //arxiv.org/abs/1908.11828.
|
| 325 |
+
|
| 326 |
+
Manzil Zaheer, Guru Guruganesh, Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, et al. Big bird: Transformers for longer sequences. arXiv preprint arXiv:2007.14062, 2020.
|
| 327 |
+
|
| 328 |
+
Xiang Zhang, Junbo Zhao, and Yann LeCun. Character-level Convolutional Networks for Text Classification. Advances in Neural Information Processing Systems, pages 649–657, 2015. URL http://arxiv.org/abs/1509.01626#.
|
| 329 |
+
|
| 330 |
+
# 8 APPENDIX
|
| 331 |
+
|
| 332 |
+
# 8.1 OVERVIEW
|
| 333 |
+
|
| 334 |
+

|
| 335 |
+
Figure 3: High-level differences between traditional subword Transformer models and Charformer which uses gradient-based subword tokenization.
|
| 336 |
+
|
| 337 |
+
# 8.2 HYPERPARAMETERS
|
| 338 |
+
|
| 339 |
+
This section describes the hyperparameters that we use in our experiments.
|
| 340 |
+
|
| 341 |
+
Monolingual English Datasets Our small model follows the T5 small model size with 6 encoder layers and 6 decoder layers, hidden size $d _ { m o d e l }$ of 512, 8 heads, $d _ { k v }$ of 32 and $d _ { f f }$ of 2048. This corresponds to bi_v1_small.gin in the T5 codebase. The base model (corresponding to $b i \_ { \nu I . g i n } )$ has 12 encoder layers, 12 decoder layers, $d _ { m o d e l }$ of 768, $d _ { f f }$ of 3072 and 12 heads. The SBase model has 24 encoder layers and 6 decoder layers, while the remainder of its hyperparameters remain identical to the small model. All Transformer stacks use relative attention over positional encodings as per (Raffel et al., 2020). For pre-training, we run our models for $1 M$ steps on C4 with a batch size of 64. The maximum sequence length for all tasks is set to 1024. TPU packing is not activated for Charformer. For Charformer, the filter size of the pre-GBST convolution is set to 5 by default. For CHARFORMER, the downsampling rate is tuned in the range of $\{ 2 , 3 , 4 \}$ . For smaller models, the rate of 2 seems to work consistently the best. For base models, the best models used a downsampling rate of either 2 or 3. For the SBase models, the optimal downsampling rate was often 3.
|
| 342 |
+
|
| 343 |
+
Multilingual Datasets Hyperparameters are kept constant between English and multilingual tasks except for the following differences. For pre-training, we run our models for 1M steps with a batch size of 64, except for $\mathbf { C } _ { \mathrm { H A R F O R M E R } _ { S B a s e } }$ which uses a batch size of 1024 and CHARFORMERSBase,LongP T which usees a batch size of 2048. Models were pre-trained with a maximum sequence length of 2048 and fine-tuned with a maximum sequence length of 4096 for TyDiQA, XQuAD, and MLQA, and 2048 for XNLI and PAWS-X. Byte-level $\mathrm { T } 5 _ { B a s e }$ was the only model to be pre-trained with a maximum sequence length of 1024, as it was prohibitively slow, see Table 11. Fine-tuning and inference for this model, however still used 4096 and 2048 input lengths identical to other models. For all tasks, CHARFORMER models used a downsampling rate of 2, while Byte-level $_ { \mathrm { T } 5 + \mathrm { L A S C } }$ models used a downsampling rate of 4 (Clark et al., 2021). The downsampling rate of 2 was picked by ablating the downsampling rate on the TyDiQA-GoldP validation set. CHARFORMER models for XNLI and PAWS-X additionally did not back-propagate into the GBST layer during fine-tuning. Checkpoints were picked based on the dev set metrics, and then evaluated on test set. Reported metrics represent the macro-average of all languages in the task.
|
| 344 |
+
|
| 345 |
+
# 8.3 ABLATION STUDY
|
| 346 |
+
|
| 347 |
+
This section presents our ablation experiments for both English and multilingual tasks. We analyze the impact of various hyper-parameters and modeling choices such as using offsets vs 1D convolutions. Across experiments, we find that pre-GBST convolutions are preferred to enumerating offset blocks, as it results in similar (or better) quality but a more efficient implementation. For English tasks, block score calibration (BC) improves performance. We note that in the multilingual setting, block score calibration has little effect. The impact of different downsampling rates varies across tasks and model sizes. We also experimented with different convolution filter sizes in English and found that they did not significantly impact performance. Likewise, using a different character span corruption rate during pre-training did not significantly impact performance. Adding feed-forward layers to the CHARFORMER module in similar fashion to a Transformer block was also not obviously helpful.
|
| 348 |
+
|
| 349 |
+
Table 7: Ablation studies with CHARFORMERSmall on English tasks.
|
| 350 |
+
|
| 351 |
+
<table><tr><td>Ablation</td><td>ds</td><td>Size</td><td>SST-2</td><td>MNLImm</td><td>IMDb</td></tr><tr><td>Offsets</td><td></td><td>S</td><td>89.11</td><td>79.50</td><td>90.49</td></tr><tr><td>Conv</td><td></td><td>S</td><td>89.11</td><td>79.65</td><td>90.63</td></tr><tr><td>Conv + BC</td><td></td><td>S</td><td>89.56</td><td>80.15</td><td>90.60</td></tr><tr><td>Conv + Offsets + BC</td><td>2222</td><td>S</td><td>89.11</td><td>79.68</td><td>90.48</td></tr><tr><td>Conv</td><td>34</td><td>S</td><td>89.45</td><td>80.07</td><td>90.15</td></tr><tr><td>Conv</td><td></td><td>S</td><td>89.11</td><td>79.82</td><td>90.21</td></tr><tr><td>Conv</td><td>234</td><td>B</td><td>90.60</td><td>82.92</td><td>91.46</td></tr><tr><td>Conv</td><td></td><td>B</td><td>91.40</td><td>82.74</td><td>91.46</td></tr><tr><td>Conv</td><td></td><td>B</td><td>91.40</td><td>82.67</td><td>92.33</td></tr></table>
|
| 352 |
+
|
| 353 |
+
Table 8: Effect of freezing the GBST layer for XNLI and PAWS-X.
|
| 354 |
+
|
| 355 |
+
<table><tr><td>Model</td><td>ds</td><td>Freeze GBST</td><td>XNLI (Zero)</td><td>XNLI(Translate)</td><td>PAWS-X (Zero)</td><td>PAWS-X(Translate)</td></tr><tr><td>CHARFORMER Small</td><td>2</td><td>No</td><td>44.5</td><td>62.7</td><td>27.9</td><td>37.5</td></tr><tr><td>CHARFORMERSmall</td><td>2</td><td>Yes</td><td>50.9</td><td>68.7</td><td>77.1</td><td>84.8</td></tr><tr><td>CHARFORMER Small</td><td>3</td><td>No</td><td>47.9</td><td>67.9</td><td>29.5</td><td>36.8</td></tr><tr><td>CHARFORMER Small</td><td>3</td><td>Yes</td><td>43.2</td><td>68.6</td><td>77.8</td><td>83.7</td></tr><tr><td>CHARFORMER Small</td><td>4</td><td>No</td><td>47.5</td><td>47.5</td><td>30.9</td><td>36.9</td></tr><tr><td>CHARFORMER Small</td><td>4</td><td>Yes</td><td>43.6</td><td>43.6</td><td>77.9</td><td>83.5</td></tr></table>
|
| 356 |
+
|
| 357 |
+
# 8.4 COMPARING DOWNSAMPLING APPROACHES
|
| 358 |
+
|
| 359 |
+
In Table 10, we compare GBST downsampling with LASC downsampling (Clark et al., 2021) on TyDiQA-GoldP. For this experiment we use the same hyperparameters as in Section 3.3, except the pre-training input length is 1024 instead of 2048. Note that this difference is negligible (0.1 F1) for CHARFORMER $B a s e$ , $d _ { s } = 2$ which also appears in Table 4. All hyperparameters are fixed between CHARFORMER and Byte-level T5+LASC. Following (Clark et al., 2021) we set $d _ { s } = 4$ for LASC, and we compare CHARFORMER at the same downsampling rate. We additionally include $d _ { s } = 2$ and $d _ { s } = 3$ for CHARFORMER for comparison. With the same hyperparameters and downsampling rate, CHARFORMER outperforms Byte-level T5+LASC on TyDiQA-GoldP.
|
| 360 |
+
|
| 361 |
+
Table 9: Effect of $d _ { s }$ on TyDiQA-GoldP (in-language multi-task).
|
| 362 |
+
|
| 363 |
+
<table><tr><td>Model</td><td>ds</td><td>TyDiQA-GoldP F1</td></tr><tr><td>CHARFORMERSmall</td><td>2</td><td>69.6</td></tr><tr><td>CHARFORMERSmall</td><td>3</td><td>68.1</td></tr><tr><td>CHARFORMERSmall</td><td>4</td><td>66.6</td></tr><tr><td>Byte-level T5+LASCsmall</td><td>4</td><td>64.9</td></tr><tr><td>CHARFORMER Base</td><td>2</td><td>75.8</td></tr><tr><td>CHARFORMERBase</td><td>3</td><td>74.3</td></tr><tr><td>CHARFORMERBase</td><td>4</td><td>73.2</td></tr><tr><td>Byte-level T5+LASCBase</td><td>4</td><td>70.6</td></tr></table>
|
| 364 |
+
|
| 365 |
+
# 8.5 LARGE-SCALE EXPERIMENTS
|
| 366 |
+
|
| 367 |
+
In this section we report preliminary results for scaling Charformer using the same number of parameters as $\operatorname* { m T } 5 _ { L a r g e }$ and $\mathrm { B y T } 5 _ { L a r g e }$ (1.23B). We follow a model scaling configuration identical to ByT5 in these experiments, and use the same hyperparameter settings as our main multilingual results.
|
| 368 |
+
|
| 369 |
+
Table 10: Comparison on TyDiQA at 1.23B parameters. \*Due to resource constraints, the Charformer result below uses ${ \sim } 1 0 0 \mathrm { K }$ less pretraining steps than ByT5 and mT5.
|
| 370 |
+
|
| 371 |
+
<table><tr><td>Model</td><td>TyDiQA-GoldP F1 /EM</td></tr><tr><td>mT5Large</td><td>85.3 /75.3</td></tr><tr><td>ByT5 Large</td><td>87.7/79.2</td></tr><tr><td>CHARFORMER*</td><td>86.3 / 77.3</td></tr></table>
|
| 372 |
+
|
| 373 |
+
Results The CHARFORMER model under the same scaling as $\mathrm { B y T } 5 _ { L a r g e }$ was able to outperform $\operatorname* { m T } 5 _ { L a r g e }$ , a very strong baseline. Our preliminary results at this scale shows that CHARFORMER is competitive with, but is $1 . 4 \mathrm { F } 1$ behind $\mathrm { B y T } 5 _ { L a r g e }$ . However, we point out two important notes. First, the CHARFORMER result is undertrained compared to $\mathrm { B y T } 5 _ { L a r g e }$ since $10 \%$ of the pretraining has not finished. Second, the CHARFORMER model is also twice as fast as ByT5, as seen from Table 11.
|
| 374 |
+
|
| 375 |
+
# 8.6 MULTILINGUAL EXPERIMENTS
|
| 376 |
+
|
| 377 |
+
This section contains detailed results for our multilingual experiments.
|
| 378 |
+
|
| 379 |
+
Table 11: Compute metrics of base models at longer (2K) input length on the $\mathrm { m C 4 }$ pre-training corpus, using a batch size of 64 on 16 TPU-v3 chips.
|
| 380 |
+
|
| 381 |
+
<table><tr><td>Model</td><td>L</td><td>ds</td><td>|0</td><td>Speed (steps/s)</td><td>FLOPS</td></tr><tr><td>Byte-level T5 Base</td><td>2048</td><td>1</td><td>200M</td><td>2.7</td><td>2.0×1013</td></tr><tr><td>Byte-level T5+LASC Base</td><td>2048</td><td>4</td><td>205M</td><td>11</td><td>5.5× 1012</td></tr><tr><td>CHARFORMERBase</td><td>2048</td><td>2</td><td>203M</td><td>6.1</td><td>9.5×1012</td></tr><tr><td>CHARFORMERBase</td><td>2048</td><td>3</td><td>203M</td><td>10</td><td>6.5×1012</td></tr><tr><td>CHARFORMERSBase</td><td>2048</td><td>2</td><td>134M</td><td>6.1</td><td>9.2 ×1012</td></tr></table>
|
| 382 |
+
|
| 383 |
+
Table 12: Per-language breakdown of in-language multi-task TyDiQA-GoldP results.
|
| 384 |
+
|
| 385 |
+
<table><tr><td>Model</td><td>0</td><td>ar</td><td>bn</td><td>en</td><td>fi</td><td>id</td><td>ko</td><td>ru</td><td>SW</td><td>te</td><td>Avg.</td></tr><tr><td>mBERTBase (Subword)</td><td>179M</td><td>-/-</td><td>/</td><td>-</td><td>-/-</td><td>-/-</td><td>-</td><td>-/-</td><td>/</td><td>-/-</td><td>77.6/68.0</td></tr><tr><td>mT5 Base (Subword)</td><td>582M</td><td>84.2/71.8</td><td>80.0/69.0</td><td>76.6/65.2</td><td>80.1/69.3</td><td>85.5/75.0</td><td>70.3/61.6</td><td>77.5/64.4</td><td>83.6/74.9</td><td>88.2/78.0</td><td>80.8/70.0</td></tr><tr><td>Byte-level T5 Base</td><td>200M</td><td>81.4/67.0</td><td>66.8/56.6</td><td>69.8/59.5</td><td>75.6/63.0</td><td>81.6/72.4</td><td>64.6/58.7</td><td>74.1/60.8</td><td>81.8/74.3</td><td>85.0/76.1</td><td>75.6/65.4</td></tr><tr><td>Byte-level T5+LASCBase</td><td>205M</td><td>78.1/62.3</td><td>61.1/50.4</td><td>66.7/55.2</td><td>72.5/60.4</td><td>79.9/68.3</td><td>51.5/43.5</td><td>70.4/58.7</td><td>74.7/67.5</td><td>80.2/71.2</td><td>70.6/59.7</td></tr><tr><td>CHARFORMER Base</td><td>203M</td><td>81.8/67.9</td><td>69.1/60.2</td><td>71.4/60.5</td><td>76.3/64.2</td><td>83.0/73.1</td><td>62.7/54.3</td><td>74.7/61.7</td><td>80.2/73.3</td><td>83.6/75.0</td><td>75.9/65.6</td></tr><tr><td>CHARFORMERSBase</td><td>134M</td><td>82.4/68.1</td><td>78.1/67.3</td><td>75.4/64.3</td><td>79.5/68.2</td><td>85.0/75.9</td><td>66.6/58.0</td><td>77.0/64.3</td><td>81.5/74.1</td><td>86.5/78.6</td><td>79.1/68.8</td></tr><tr><td>CHARFORMERSBase,LongPT</td><td>134M</td><td>85.7/74.5</td><td>78.7/67.3</td><td>76.8/65.9</td><td>81.9/70.6</td><td>86.7/79.1</td><td>69.4/61.6</td><td>79.2/67.1</td><td>83.7/75.2</td><td>88.8/80.6</td><td>81.2/71.3</td></tr></table>
|
| 386 |
+
|
| 387 |
+
Table 13: Per-language breakdown of translate-train-all XQuAD results.
|
| 388 |
+
|
| 389 |
+
<table><tr><td>Model</td><td>间</td><td>ar</td><td>de</td><td>el</td><td>en</td><td>es</td><td>hi</td><td>ru</td><td>th</td><td>tr</td><td>vi</td><td>zh</td><td></td><td>Avg.</td></tr><tr><td>mT5 Base (Subword)</td><td>582M</td><td>72.4/55.2</td><td>76.9/59.7</td><td>76.8/58.8</td><td>83.1/70.3</td><td></td><td>79.0/61.2</td><td>71.4/53.4</td><td>76.1/58.5</td><td>67.9/62.0</td><td>72.5/51.4</td><td>75.9/56.3</td><td>76.9/69.7</td><td>75.3/59.7</td></tr><tr><td>Byte-levelT5 Base</td><td>200M</td><td>64.8/47.9</td><td>74.3/58.3</td><td>69.2/51.8</td><td>81.5/70.4</td><td>77.2/60.4</td><td></td><td>67.0/51.5</td><td>72.3/55.5</td><td>48.3/41.9</td><td>69.6/51.7</td><td>73.3/54.4</td><td>57.3/53.3</td><td>68.6/54.3</td></tr><tr><td>Byte-level T5+LASCBase</td><td>205M</td><td>62.9/45.5</td><td>70.6/54.2</td><td>68.3/52.3</td><td>80.1/68.4</td><td>74.8/57.9</td><td></td><td>63.1/46.2</td><td>68.2/52.2</td><td>50.0/43.4</td><td>67.1/48.2</td><td>71.7/51.8</td><td>57.7/52.7</td><td>66.8/52.1</td></tr><tr><td>CHARFORMER Base</td><td>203M</td><td>65.7/49.8</td><td>74.2/58.0</td><td>71.1/53.1</td><td>82.2/70.5</td><td>77.8/61.0</td><td></td><td>67.0/51.3</td><td>73.4/57.6</td><td>54.3/48.0</td><td>70.3/53.0</td><td>74.6/55.6</td><td>62.0/56.6</td><td>70.2/55.9</td></tr><tr><td>CHARFORMERS Base</td><td>134M</td><td>70.3/53.7</td><td>78.6/61.4</td><td>74.4/55.1</td><td>85.1/73.7</td><td>79.8/63.6</td><td></td><td>69.1/52.7</td><td>76.7/61.3</td><td>57.6/51.2</td><td>73.9/55.8</td><td>76.8/57.6</td><td>67.4/62.4</td><td>73.6/59.0</td></tr><tr><td>CHARFORMERS Base,LongPT</td><td>134M</td><td>72.6/55.0</td><td>79.0/62.3</td><td>74.9/56.1</td><td>85.4/74.5</td><td></td><td>80.4/63.4</td><td>70.6/56.1</td><td>77.8/62.2</td><td>56.1/49.2</td><td>76.1/58.2</td><td>77.7/59.4</td><td>66.0/61.8</td><td>74.2/59.8</td></tr></table>
|
| 390 |
+
|
| 391 |
+
Table 14: Per-language breakdown of translate-train-all MLQA results.
|
| 392 |
+
|
| 393 |
+
<table><tr><td>Model</td><td>0</td><td>ar</td><td>de</td><td>en</td><td>es</td><td>hi</td><td>vi</td><td>zh</td><td>Avg.</td></tr><tr><td>mT5 Base (Subword)</td><td>582M</td><td>61.1/40.7</td><td>65.5/49.2</td><td>80.7/66.3</td><td>70.7/52.1</td><td>63.6/44.3</td><td>68.0/47.6</td><td>63.5/39.4</td><td>67.6/48.5</td></tr><tr><td>Byte-levelT5 Base</td><td>200M</td><td>52.6/34.2</td><td>60.5/46.1</td><td>77.7/64.8</td><td>67.1/49.2</td><td>52.9/36.5</td><td>63.6/43.8</td><td>58.3/36.4</td><td>61.8/44.4</td></tr><tr><td>Byte-level T5+LASCBase</td><td>205M</td><td>50.8/32.0</td><td>58.1/43.5</td><td>75.8/62.2</td><td>64.7/46.7</td><td>49.2/32.6</td><td>60.4/40.4</td><td>52.6/30.6</td><td>58.8/41.1</td></tr><tr><td>CHARFORMER Base</td><td>203M</td><td>53.5/34.5</td><td>61.3/46.8</td><td>78.5/65.4</td><td>67.2/49.3</td><td>54.5/37.6</td><td>64.3/43.9</td><td>58.8/36.6</td><td>62.6/44.9</td></tr><tr><td>CHARFORMER S Base</td><td>134M</td><td>58.3/39.1</td><td>65.7/50.5</td><td>81.8/68.7</td><td>71.0/53.1</td><td>57.7/40.8</td><td>67.3/46.8</td><td>62.7/40.8</td><td>66.3/48.5</td></tr><tr><td>CHARFORMER S Base,Long PT</td><td>134M</td><td>59.6/40.0</td><td>66.6/51.3</td><td>82.2/69.0</td><td>72.1/54.5</td><td>59.7/42.9</td><td>68.2/47.4</td><td>62.4/40.7</td><td>67.2/49.4</td></tr></table>
|
| 394 |
+
|
| 395 |
+
Table 15: Per-language breakdown of translate-train-all and cross-lingual zero-shot XNLI results.
|
| 396 |
+
|
| 397 |
+
<table><tr><td>Model</td><td>间</td><td>ar</td><td>bg</td><td>de</td><td>el</td><td>en</td><td>es</td><td>fr</td><td>hi</td><td>ru</td><td>sw</td><td>th</td><td>tr</td><td>ur</td><td>vi</td><td>zh Avg.</td></tr><tr><td></td><td colspan="10">Translate-Train-All</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>mT5 Base (Subword)</td><td>582M</td><td>74.4</td><td>78.5</td><td>77.7</td><td>78.1</td><td>82.0</td><td>79.1</td><td>77.9 72.2</td><td>76.5</td><td>71.5</td><td>75.0</td><td></td><td>74.8</td><td>70.4</td><td>74.5</td><td>76.0</td><td>75.9</td></tr><tr><td>Byte-level T5Base</td><td>200M</td><td>67.1</td><td>72.0</td><td>71.0</td><td>70.6</td><td>76.9</td><td>74.0</td><td>73.4</td><td>63.7</td><td>69.2 66.2</td><td></td><td>65.7</td><td>69.4</td><td>62.8</td><td>69.6</td><td>69.0</td><td>69.4</td></tr><tr><td>Byte-level T5+LASCBase</td><td>205M</td><td>65.6</td><td>72.1</td><td>70.5</td><td>67.9</td><td>75.6</td><td>73.4</td><td>72.2</td><td>63.5</td><td>68.6</td><td>65.4</td><td>64.5</td><td>67.4</td><td>62.4</td><td>68.3</td><td>61.0</td><td>67.9</td></tr><tr><td>CHARFORMER Base</td><td>203M</td><td>69.5</td><td>72.9</td><td>72.7</td><td>72.6</td><td>78.2</td><td>74.5</td><td>73.6</td><td>67.0</td><td>71.7</td><td>67.9</td><td>68.1</td><td>70.8</td><td>65.0</td><td>70.7</td><td>71.5</td><td>71.1</td></tr><tr><td>CHARFORMERSBase</td><td>134M</td><td>70.8</td><td>75.7</td><td>75.9</td><td>73.1</td><td>80.9</td><td>76.9</td><td>76.8</td><td>65.6</td><td>74.7</td><td>65.7</td><td>67.7</td><td>72.0</td><td>63.1</td><td>72.9</td><td>71.5</td><td>72.2</td></tr><tr><td>CHARFORMERSBase,LongPT</td><td>134M</td><td>71.1</td><td>75.9</td><td>73.6</td><td>74.2</td><td>80.8</td><td>76.6</td><td>76.8</td><td>69.2</td><td>72.2</td><td>68.2</td><td>71.0</td><td>71.2</td><td>65.7</td><td>72.9</td><td>73.0</td><td>72.8</td></tr><tr><td>Cross-Lingual Zero-Shot</td><td colspan="10"></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>mBERTBase (Subword)</td><td>179M</td><td>64.3</td><td>68.0</td><td>70.0</td><td>65.3</td><td>80.8</td><td>73.5</td><td>73.4</td><td>58.9</td><td>67.8</td><td>49.7</td><td>54.1</td><td>60.9</td><td>57.2</td><td>69.3</td><td>67.8</td><td>65.4</td></tr><tr><td>mT5 Base (Subword)</td><td>582M</td><td>73.3</td><td>78.6</td><td>77.4</td><td>77.1</td><td>84.7</td><td>80.3</td><td>79.1</td><td>70.8</td><td>77.1</td><td>69.4</td><td>73.2</td><td>72.8</td><td>68.3</td><td>74.2</td><td>74.1</td><td>75.4</td></tr><tr><td>Byte-level T5Base</td><td>200M</td><td>56.7</td><td>61.2</td><td>63.0</td><td>60.9</td><td>79.2</td><td>70.1</td><td>65.3</td><td>43.9</td><td>61.0</td><td>45.5</td><td>43.5</td><td>52.0</td><td>44.3</td><td>58.3</td><td>55.6</td><td>57.4</td></tr><tr><td>Byte-level T5+LASCBase</td><td>205M</td><td>53.3</td><td>58.8</td><td>62.2</td><td>54.9</td><td>77.1</td><td>68.6</td><td>65.4</td><td>44.7</td><td>58.4</td><td>46.1</td><td>43.6</td><td>50.4</td><td>42.8</td><td>55.9</td><td>46.1</td><td>55.2</td></tr><tr><td>CHARFORMER Base</td><td>203M</td><td>55.7</td><td>61.1</td><td>64.8</td><td>60.1</td><td>77.3</td><td>69.9</td><td>67.9</td><td>44.4</td><td>60.2</td><td>45.3</td><td>47.9</td><td>54.0</td><td>43.5</td><td>59.1</td><td>53.4</td><td>57.6</td></tr><tr><td>CHARFORMER S Base</td><td>134M</td><td>66.4</td><td>71.0</td><td>72.7</td><td>68.6</td><td>82.4</td><td>77.1</td><td>75.4</td><td>57.6</td><td>70.6</td><td>48.7</td><td>61.4</td><td>61.8</td><td>54.1</td><td>68.9</td><td>62.8</td><td>66.6</td></tr><tr><td>CHARFORMERSBase,LongPT</td><td>134M</td><td>68.4</td><td>70.9</td><td>74.3</td><td>70.2</td><td>82.4</td><td>77.0</td><td>76.6</td><td>59.9</td><td>71.0</td><td>42.6</td><td>64.0</td><td>65.5</td><td>56.5</td><td>71.2</td><td>66.0</td><td>67.8</td></tr></table>
|
| 398 |
+
|
| 399 |
+
Table 16: Per-language breakdown of translate-train-all and cross-lingual zero-shot PAWS-X results.
|
| 400 |
+
|
| 401 |
+
<table><tr><td>Model</td><td>0</td><td>de</td><td>en</td><td>es</td><td>fr</td><td>ja</td><td>ko</td><td>zh</td><td>Avg.</td></tr><tr><td colspan="10">Translate-Train-All</td></tr><tr><td>mT5 Base (Subword)</td><td>582M</td><td>90.9</td><td>95.5</td><td>91.4</td><td>92.5</td><td>83.6</td><td>84.8</td><td>86.4</td><td>89.3</td></tr><tr><td>Byte-level T5 Base</td><td>200M</td><td>89.3</td><td>94.6</td><td>90.1</td><td>90.3</td><td>81.4</td><td>81.1</td><td>82.3</td><td>87.0</td></tr><tr><td>Byte-level T5+LASC Base</td><td>205M</td><td>87.3</td><td>93.1</td><td>89.2</td><td>89.2</td><td>81.0</td><td>72.9</td><td>80.8</td><td>84.8</td></tr><tr><td>CHARFORMER Base</td><td>203M</td><td>89.9</td><td>94.6</td><td>89.8</td><td>91.4</td><td>82.7</td><td>78.4</td><td>83.3</td><td>87.2</td></tr><tr><td>CHARFORMER sBase</td><td>134M</td><td>89.9</td><td>95.9</td><td>91.8</td><td>92.2</td><td>83.9</td><td>78.9</td><td>84.4</td><td>88.2</td></tr><tr><td>CHARFORMERs Base,LongPT</td><td>134M</td><td>90.7</td><td>95.1</td><td>92.2</td><td>92.2</td><td>84.1</td><td>81.6</td><td>84.6</td><td>88.6</td></tr><tr><td colspan="10">Cross-Lingual Zero-Shot</td></tr><tr><td>mBERTBase (Subword)</td><td>179M</td><td>85.7</td><td>94.0</td><td>87.4</td><td>87.0</td><td>73.0</td><td>69.6</td><td>77.0</td><td>81.9</td></tr><tr><td>mT5 Base (Subword)</td><td>582M</td><td>89.4</td><td>95.4</td><td>89.6</td><td>91.2</td><td>79.8</td><td>78.5</td><td>81.1</td><td>86.4</td></tr><tr><td>Byte-level T5 Base</td><td>200M</td><td>84.7</td><td>93.8</td><td>85.8</td><td>86.4</td><td>72.2</td><td>67.9</td><td>75.2</td><td>80.9</td></tr><tr><td>Byte-level T5+LASCBase</td><td>205M</td><td>83.2</td><td>93.2</td><td>84.1</td><td>85.0</td><td>67.9</td><td>66.4</td><td>73.4</td><td>79.0</td></tr><tr><td>CHARFORMER Base</td><td>203M</td><td>86.1</td><td>94.8</td><td>87.2</td><td>88.0</td><td>70.1</td><td>69.7</td><td>75.5</td><td>81.6</td></tr><tr><td>CHARFORMER SBase</td><td>134M</td><td>89.6</td><td>95.2</td><td>90.7</td><td>90.7</td><td>77.1</td><td>74.4</td><td>78.9</td><td>85.2</td></tr><tr><td>CHARFORMERSBase,LongPT</td><td>134M</td><td>89.8</td><td>95.3</td><td>88.7</td><td>89.7</td><td>74.5</td><td>68.9</td><td>78.9</td><td>83.7</td></tr></table>
|
| 402 |
+
|
| 403 |
+
# 8.7 EXAMPLE IMPLEMENTATION
|
| 404 |
+
|
| 405 |
+
For additional clarity, we include a simplified implementation of the GBST module in Tensorflow below. Default hyper-parameters here match those used in the paper.
|
| 406 |
+
|
| 407 |
+
max_subword_block_width: Integer of max block size to use for enumeration. block_attention: Hhether to use block score calibration. block_scoring_network: module for parameterized block scoring.
|
| 408 |
+
conv_kernel_size: Integer of the size of the pre-GBST convolution kernel.
|
| 409 |
+
"""
|
| 410 |
+
|
| 411 |
+
def __init__(self,
|
| 412 |
+
|
| 413 |
+
input_shape: tf.Tensor, downsample_rate: int $= 2$ , max_subword_block_width: int $\qquad = \quad 4$ , block_attention: bool $=$ False, conv_kernel_size: Optional[int] $= ~ 5 )$ ):
|
| 414 |
+
|
| 415 |
+
super(GBSTLayer, self).__init__()
|
| 416 |
+
self.downsample_rate $=$ downsample_rate
|
| 417 |
+
self.max_subword_block_width $=$ max_subword_block_width
|
| 418 |
+
self.conv_kernel_size $=$ conv_kernel_size
|
| 419 |
+
self.conv_layer = keras_layers.Conv1D( input_shape[-1], self.conv_kernel_size, input_shape $\mathrm { \Omega } _ { \ast } = \mathrm { \Omega } _ { \ast }$ input_shape)
|
| 420 |
+
self.block_attention $=$ block_attention
|
| 421 |
+
self.block_scoring_network $=$ keras_layers.Dense(1, use_bias=False)
|
| 422 |
+
|
| 423 |
+
def call(self, inputs): """Performs downsampling on the character-scale input representation.
|
| 424 |
+
|
| 425 |
+
Args: inputs: float Tensor of shape [batch_size, seq_length, embedding_size].
|
| 426 |
+
|
| 427 |
+
Returns:
|
| 428 |
+
|
| 429 |
+
<float>[batch_size, seq_length / downsample_rate , embedding_size].
|
| 430 |
+
Downsampled sequences.
|
| 431 |
+
|
| 432 |
+
length = inputs.shape[1] if self.conv_kernel_size: inputs $=$ self.conv_layer(inputs)
|
| 433 |
+
|
| 434 |
+
all_block_scores $=$ []
|
| 435 |
+
all_sequences $=$ []
|
| 436 |
+
for subword_len in range(1, self.max_subword_block_width): padded_input = inputs # Pad the sequence length if needed. if length % subword_len $! = ~ 0$ : pad_amt $=$ subword_len - int(length % subword_len) padding = tf.constant([[0, 0], [0, pad_amt], [0, 0]]) padded_input $=$ tf.pad(inputs, padding)
|
| 437 |
+
|
| 438 |
+
# For this block size, form candidate block embeddings and scores.
|
| 439 |
+
|
| 440 |
+
# candidates shape: [batch, seq_len/subword_len, dim] # block_scores shape: [batch, seq_len/subword_len, 1]
|
| 441 |
+
|
| 442 |
+
padded_input, [subword_len], stride $; =$ [subword_len], padding="VALID") block_scores = self.block_scoring_network(candidates)
|
| 443 |
+
|
| 444 |
+
# Upsample it back to the original sequence length. retiled_seq $=$ tf.repeat(candidates, subword_len, axis=1) retiled_block_scores = tf.repeat(block_scores, subword_len, axis=1)
|
| 445 |
+
|
| 446 |
+
# # Repad the upsampled sequence if needed.
|
| 447 |
+
|
| 448 |
+
if retiled_block_scores.shape[1] $<$ length: repad_amt $=$ length - retiled_block_scores.shape[1] repadding $=$ tf.constant([[0, 0], [0, repad_amt], [0, 0]]) retiled_seq $=$ tf.pad(retiled_seq, repadding) retiled_block_scores = tf.pad(retiled_block_scores, repadding)
|
| 449 |
+
|
| 450 |
+
# Make sure everything is the right length and add new dimension to concat # candidate blocks on.
|
| 451 |
+
retiled_block_scores $=$ retiled_block_scores[:, :length, :, None]
|
| 452 |
+
retiled_seq $=$ retiled_seq[:, :length, :, None]
|
| 453 |
+
all_block_scores.append(retiled_block_scores)
|
| 454 |
+
all_sequences.append(retiled_seq)
|
| 455 |
+
|
| 456 |
+
block_scores = tf.concat(all_block_scores, axis=-1) block_scores $=$ tf.nn.softmax(block_scores, axis=-1) candidates $=$ tf.concat(all_sequences, axis=-1)
|
| 457 |
+
|
| 458 |
+
# TODO: Block score calibration / block-by-block attention is omitted in this implementation. # batch_size $_ \textrm { x }$ num_candidates $_ \mathrm { x }$ length $_ \textrm { x }$ dim
|
| 459 |
+
candidates $=$ candidates $^ { \star }$ block_scores
|
| 460 |
+
output = tf.reduce_sum(candidates, axis=-1) # bsz $_ \mathrm { x }$ length x dim
|
| 461 |
+
|
| 462 |
+
# Downsample by mean pooling.
|
| 463 |
+
|
| 464 |
+
if self.downsample_rate $> ~ 1$ : output $=$ tf.nn.avg_pool( output, (self.downsample_rate,), stride $; =$ (self.downsample_rate,), padding="VALID")
|
| 465 |
+
return output
|
md/dev/JvIFpZOjLF4/JvIFpZOjLF4.md
ADDED
|
@@ -0,0 +1,391 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Geo-Neus: Geometry-Consistent Neural Implicit Surfaces Learning for Multi-view Reconstruction
|
| 2 |
+
|
| 3 |
+
Qiancheng $\mathbf { F u } ^ { 1 * }$ Qingshan $\mathbf { X } \mathbf { u } ^ { 2 * }$ Yew-Soon Ong2,3 Wenbing Tao1†
|
| 4 |
+
|
| 5 |
+
Huazhong University of Science and Technology 2Nanyang Technological University 3A\*STAR, Singapore 1{fqc98,wenbingtao}@hust.edu.cn 2{qingshan.xu,asysong}@ntu.edu.sg
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
Recently, neural implicit surfaces learning by volume rendering has become popular for multi-view reconstruction. However, one key challenge remains: existing approaches lack explicit multi-view geometry constraints, hence usually fail to generate geometry-consistent surface reconstruction. To address this challenge, we propose geometry-consistent neural implicit surfaces learning for multi-view reconstruction. We theoretically analyze that there exists a gap between the volume rendering integral and point-based signed distance function (SDF) modeling. To bridge this gap, we directly locate the zero-level set of SDF networks and explicitly perform multi-view geometry optimization by leveraging the sparse geometry from structure from motion (SFM) and photometric consistency in multi-view stereo. This makes our SDF optimization unbiased and allows the multi-view geometry constraints to focus on the true surface optimization. Extensive experiments show that our proposed method achieves high-quality surface reconstruction in both complex thin structures and large smooth regions, thus outperforming the state-ofthe-arts by a large margin. Code: https://github.com/GhiXu/Geo-Neus.
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
Reconstructing surfaces from calibrated multi-view images is a long-standing problem in computer vision and graphics. In the past years, traditional methods [30, 37, 15, 17] have adopted a multi-step pipeline to achieve impressive reconstruction results. Such a pipeline requires depth maps or point clouds to generate surface meshes. These intermediate representations inevitably introduce accumulated errors for the final reconstructed geometry. Recently, directly reconstructing surfaces from images [25, 43, 35, 42, 26] has attracted great interest for its potential to alleviate the accumulated errors and produce high-quality reconstructions. To achieve this, existing approaches represent surfaces as neural implicit representations and leverage volume rendering [21] to optimize them.
|
| 14 |
+
|
| 15 |
+
Inspired by neural volume rendering [23, 45] that simultaneously learns volume density and radiance field from input images, recent works [35, 42] use signed distance functions (SDF) [27] for surface representation and introduce the SDF-induced density function to enable the volume rendering to learn an implicit SDF representation. In essence, these works still focus on direct color field modeling by volume rendering integral rather than explicit multi-view geometry optimization. Therefore, existing approaches usually fail to generate geometry-consistent surface reconstruction. Intuitively, volume rendering samples multiple points along each ray and expresses the output pixel colors as the integral of the radiance field, or the weighted sum of sampled colors along the ray (cf. Fig. 1(a)). It means that the volume rendering integral directly optimizes the integral of geometry instead of the single surface intersection along the ray. This obviously introduces bias for geometry modeling, thus hindering true surface optimization. In Fig.1(b), we show the reconstruction case of NeuS [35], in which the bias between rendered colors and object geometry can be observed intuitively. Rendered colors are obtained by the color network via volume rendering. Surface colors are formed by the predicted colors of the surface where the SDF values are zeroes. It can be easily seen that there exists a gap between the rendered colors and the surface colors. Thus the reconstructed surface is imprecise despite the high-quality rendered image, indicating the bias between the color rendering and implicit geometry. (Detailed theoretical analysis will be elaborated later).
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: (a) Illustration of volume rendering. (b) A visual example. The volume rendering in NeuS uses integral colors to implicitly supervise surface modeling. Although its rendered colors achieve good results, the colors of estimated surface fail to preserve object geometry information. This shows the bias between rendered colors and geometry. In contrast, our approach achieves structurepreserving colors of estimated surface and produces geometry-consistent surface reconstruction.
|
| 19 |
+
|
| 20 |
+
To address the above problem, we propose Geo-Neus to devise an explicit and accurate neural geometry optimization model for geometry-consistent neural implicit surfaces learning by volume rendering, leading to better multi-view 3D reconstruction. Specifically, we directly locate the zerolevel set of SDF networks and explicitly perform multi-view geometry optimization by leveraging the sparse geometry from structure from motion (SFM) and photometric consistency in multi-view stereo. This model has several benefits. First, directly locating the zero-level set of SDF networks guarantees that our geometry modeling is unbiased. This enables our method to focus on true surface optimization. Second, we show that explicitly enforcing multi-view geometry constraints on the located zero-level set of SDF networks allows our method to generate geometry-consistent surface reconstruction. Previous neural implicit surfaces learning mainly uses the rendering loss to implicitly optimize SDF networks. This results in geometry ambiguity during the training optimization. Our introduced two types of explicit multi-view constraints encourage our SDF networks to reason about the correct geometry, including both complex thin structures and large smooth regions.
|
| 21 |
+
|
| 22 |
+
In summary, our contributions are: 1) We theoretically analyze that there exists a gap between volume rendering integral and point-based SDF modeling. This demonstrates that it is necessary to directly supervise the SDF networks to boost the neural implicit surfaces learning. 2) Based on our theoretical analysis, we propose to directly locate the zero-level set of SDF networks and leverage multi-view geometry constraints to explicitly supervise the training of SDF networks. In this way, the SDF networks are encouraged to focus on true surface optimization. Extensive experiments further validate the effectiveness of our theoretical analysis and the proposed direct optimization of SDF networks. We show that our proposed Geo-Neus is capable to reconstruct both complex thin structures and large smooth regions. Therefore, it greatly outperforms the state-of-the-art surface reconstruction methods, including traditional methods and neural implicit surface learning methods.
|
| 23 |
+
|
| 24 |
+
# 2 Related work
|
| 25 |
+
|
| 26 |
+
Traditional multi-view 3D reconstruction. Traditional multi-view 3D reconstruction is the classical pipeline of surface reconstruction from multi-view images. Given multi-view input images, traditional multi-view 3D reconstruction uses structure from motion (SFM) [33, 29] to extract and match features of neighbor views, and estimate camera parameters and sparse 3D points. After that, multi-view stereo (MVS) [30, 9, 37, 38, 36] is applied to estimate dense depth maps for each view and then all the depth maps are fused into dense point clouds. Finally, the surface reconstruction method [15, 17, 6], e.g., screened Poisson Surface Reconstruction [15] is used to reconstruct surfaces from point clouds. Traditional methods have achieved great success on various occasions, but there exists incompleteness of surface in some cases because their multiple intermediate steps are not made into an ensemble. With the development of deep learning, many attempts have been made on learning-based multi-view reconstruction [14, 40, 39, 27, 22], but the problem still exists.
|
| 27 |
+
|
| 28 |
+
Implicit representation of surface. Surface reconstruction methods can be generally divided into explicit methods and implicit methods, depending on the representation of surface. Explicit representation includes voxels [5, 31] and triangular mesh [3, 4, 16], which are limited by the resolution. Implicit representation uses an implicit function to represent the surface and thus is continuous. The surface can be extracted using the implicit function at any resolution. Traditional reconstruction methods, e.g., screened Poisson Surface Reconstruction [15], use basic functions to form the implicit function. As for learning-based methods, the most commonly used forms are the occupancy function [22, 28] and the signed distance function (SDF) [27] represented by the network. Based on these functions, many implicit surface reconstruction methods from point clouds have been proposed, e.g., ONet [22], DeepSDF [27], Point2Surf [8] and etc. For these methods, point clouds are obtained by scanner devices or multi-view stereo methods. That is, these point clouds are uniform and complete. Therefore, these methods are rarely applied on the sparse point clouds produced by SFM to reconstruct surfaces (In fact, we show that these methods degrade on sparse point clouds from SFM in our supplementary material). In this work, we use the sparse points from SFM as an explicit geometry supervision and show that they can facilitate the neural implicit surface reconstruction.
|
| 29 |
+
|
| 30 |
+
Neural implicit surface reconstruction. Neural implicit field is a new way to represent the geometry of objects. With NeRF [23] first using the neural radiance field represented by Multi-Layer Perceptron (MLP) in novel view synthesis, plenty of works [32, 18, 20] have sprung up using neural networks to represent scenes. IDR [43] reconstructs surfaces with neural networks by representing the geometry as the zero level set of an MLP that is considered to be an SDF. MVSDF [44] imports information from the MVS network to arrive at more geometry priors. VolSDF [42] and NeuS [35] use the weight function that involved SDF during the rendering process to make colors and geometry closer. UNISURF [26] explores the balance between surface rendering and volume rendering. The surface reconstructed by the neural network shows better completeness compared with the traditional multi-view reconstruction methods, especially when dealing with non-Lambertian cases. However, complex structures are not handled well. Meanwhile, flat planes and sharp corners could not be guaranteed. NeuralWarp [7], a concurrent work, also explores the use of patch-match on neural surface reconstruction. It combines volumetric rendering with a patch warping integration technique, which aggregates colors from points sampled along the camera ray from source views with patch warping. This way of patch aggregation is similar with volume rendering and shares the same sampled points and the same weights with those used by color integration. Note that NeuralWarp uses patch match with the color aggregation to optimize weights of sampled points, and thus to optimize the geometry indirectly. As we will analyze later, this kind of color integration operation will cause bias in the colors and the geometry. Therefore, NeuralWarp could not be trained from scratch and relies on the pre-trained model of VolSDF. Differently from NeuralWarp, our method locates the predicted surface of the SDF network using SDF-based interpolation and uses patch match to measure the photometric consistency among neighboring views. In this way, Geo-Neus can be trained from scratch and gets much better performance.
|
| 31 |
+
|
| 32 |
+
# 3 Method
|
| 33 |
+
|
| 34 |
+
Given posed multi-view images of an object, we aim at reconstructing the surface by neural volume rendering without mask supervision. The spatial field of the object is represented by a signed distance function (SDF), and the corresponding surface is extracted using the zero level set of the SDF. In the process of volume rendering, our goal is to optimize the signed distance function. In this section, we first analyze the inherent bias in color rendering which causes the inconsistency between rendered colors and implicit geometry. Then we introduce explicit SDF optimization to achieve geometry consistency. An overview of our approach is shown in Fig. 2.
|
| 35 |
+
|
| 36 |
+
# 3.1 Bias in color rendering
|
| 37 |
+
|
| 38 |
+
In the process of volume rending, there is a gap between the rendered colors and the geometry of the object. The rendered colors are not consistent with the real colors of the surface.
|
| 39 |
+
|
| 40 |
+

|
| 41 |
+
Figure 2: Overview of Geo-Neus. Previous neural implicit surfaces learning methods mainly depend on the color loss to implicitly supervise the SDF network. Our proposed Geo-Neus explicitly supervises the SDF network by introducing the SDF loss from sparse 3D points and photometric consistency loss from multi-view stereo.
|
| 42 |
+
|
| 43 |
+
For an opaque solid object $\varOmega \in \mathbb { R } ^ { 3 }$ , the opacity can be represented by an indicator function $\mathcal { O } ( \pmb { p } )$
|
| 44 |
+
|
| 45 |
+
$$
|
| 46 |
+
\begin{array} { r } { \mathscr { O } ( { p } ) = \left\{ \begin{array} { l l } { 1 , p \in \varOmega } \\ { 0 , p \notin \varOmega } \end{array} \right. . } \end{array}
|
| 47 |
+
$$
|
| 48 |
+
|
| 49 |
+
When we see some colors or we capture some colors with cameras, the colors are the light that transfers along the light ray into our eyes or cameras. Based on the inherent optical properties of the opaque solid object, we approximately assume that the colors $C$ of image set $\{ I _ { i } \}$ are the colors $c$ of object intersecting with the light ray $\nu$ from the corresponding camera position $\mathbf { \delta } _ { \pmb { o } }$ :
|
| 50 |
+
|
| 51 |
+
$$
|
| 52 |
+
C \left( \pmb { \sigma } , \pmb { \nu } \right) = c \left( \pmb { \sigma } + t ^ { * } \pmb { \nu } \right) ,
|
| 53 |
+
$$
|
| 54 |
+
|
| 55 |
+
where t∗ = argmin $\{ t | { \pmb { o } } + t { \pmb { v } } = { \pmb { p } }$ , $\pmb { p } \in \partial \Omega$ , $t \in ( 0 , \infty ) \}$ . $\partial \Omega$ represents geometry surfaces. The assumption is appropriate because light that transmits through the opaque object can be omitted. The intensity of light decays to about zero drastically when passing through the surface of the opaque object. Let us represent the surface of the object mathematically with the signed distance function. The signed distance function $s d f ( \pmb { p } )$ is the signed distance between a spatial point $\pmb { p }$ and the surface $\partial \varOmega$ . In this way, the surface $\partial \varOmega$ can be represented as:
|
| 56 |
+
|
| 57 |
+
$$
|
| 58 |
+
\partial \varOmega = \left\{ p | s d f \left( p \right) = 0 \right\} .
|
| 59 |
+
$$
|
| 60 |
+
|
| 61 |
+
With neural volume rendering, we estimate the signed distance function $s { \hat { d } } f$ and color field $\hat { c }$ by Multi-Layer Perceptron (MLP) networks $F _ { \Theta }$ and $G _ { \Phi }$ :
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
s \hat { d } f \left( \pmb { p } \right) = F _ { \Theta } \left( \pmb { p } \right) ,
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
\hat { c } \left( \pmb { \sigma } , \pmb { \nu } , t \right) = G _ { \Phi } \left( \pmb { \sigma } , \pmb { \nu } , t \right) .
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
Thus the estimated colors of the image with camera position $\pmb { o }$ can be represented as:
|
| 72 |
+
|
| 73 |
+
$$
|
| 74 |
+
\hat { C } = \int _ { 0 } ^ { + \infty } w \left( t \right) \hat { c } \left( t \right) d t ,
|
| 75 |
+
$$
|
| 76 |
+
|
| 77 |
+
where $t$ is the depth along the ray that comes from $\mathbf { \delta } _ { \pmb { o } }$ with the direction $\nu$ and $w ( t )$ is a weight for the point at $t$ . For simplicity, the notes $\mathbf { \delta } _ { \pmb { o } }$ and $\nu$ are omitted. To obtain discrete counterparts of $w$ and $\hat { c }$ we also sample $t _ { i }$ discretely along the ray and use the Riemann sum:
|
| 78 |
+
|
| 79 |
+
$$
|
| 80 |
+
\hat { C } = \sum _ { i = 1 } ^ { n } w \left( t _ { i } \right) \hat { c } \left( t _ { i } \right) .
|
| 81 |
+
$$
|
| 82 |
+
|
| 83 |
+
Following NeuS [35], $w ( t _ { i } )$ is computed as $w ( t _ { i } ) = T ( t _ { i } ) \alpha ( t _ { i } )$ , where $\begin{array} { r } { T ( t _ { i } ) = \prod _ { j = 1 } ^ { i - 1 } ( 1 - \alpha ( t _ { j } ) ) } \end{array}$ represents accumulated transmittance, $\begin{array} { r } { \alpha ( t _ { i } ) = \operatorname* { m a x } ( \frac { \Phi _ { s } ( s d f ( p _ { i } ) ) - \Phi _ { s } ( s d f ( p _ { i + 1 } ) ) } { \Phi _ { s } ( s d f ( p _ { i } ) ) } , 0 ) } \end{array}$ j=1is opacity, and $\pmb { p } _ { i }$ represents the sampled spatial point at $t _ { i }$ . $\Phi _ { s } ( x ) = ( 1 + e ^ { - s x } ) ^ { - 1 }$ is a Sigmoid function, where $s$ is a learnable parameter which controls the smoothness of the transition at the surface.
|
| 84 |
+
|
| 85 |
+
Notably, the goal of novel view synthesis is to make an accurate prediction of the colors $\hat { C }$ , and bend efforts to minimize the difference between the colors of ground truth images $C$ and the prediction $\hat { C }$ :
|
| 86 |
+
|
| 87 |
+
$$
|
| 88 |
+
C = \hat { C } = \sum _ { i = 1 } ^ { n } w \left( t _ { i } \right) \hat { c } \left( t _ { i } \right) .
|
| 89 |
+
$$
|
| 90 |
+
|
| 91 |
+
In surface reconstruction tasks, what we concentrate more is the surface of the object rather than the color. In this way, the above formula can be rewritten as:
|
| 92 |
+
|
| 93 |
+
$$
|
| 94 |
+
\begin{array} { l } { { \displaystyle C = \sum _ { i = 1 } ^ { j - 1 } w \left( t _ { i } \right) \hat { c } \left( t _ { i } \right) + w \left( t _ { j } \right) \hat { c } \left( \hat { t ^ { * } } \right) + w \left( t _ { j } \right) \left( \hat { c } \left( t _ { j } \right) - \hat { c } \left( \hat { t ^ { * } } \right) \right) + \sum _ { i = j + 1 } ^ { n } w \left( t _ { i } \right) \hat { c } \left( t _ { i } \right) } } \\ { { \displaystyle ~ = w \left( t _ { j } \right) \hat { c } \left( \hat { t ^ { * } } \right) + \varepsilon _ { s a m p l e } + \sum _ { i = 1 } ^ { n } w \left( t _ { i } \right) \hat { c } \left( t _ { i } \right) } } \\ { { \displaystyle ~ = w \left( t _ { j } \right) \hat { c } \left( \hat { t ^ { * } } \right) + \varepsilon _ { s a m p l e } + \varepsilon _ { w e i g h t } } , } \end{array}
|
| 95 |
+
$$
|
| 96 |
+
|
| 97 |
+
where $s \hat { d } f ( \hat { t ^ { * } } ) = 0$ , $t _ { j }$ denotes the nearest sample point from $\hat { t ^ { * } }$ , $\varepsilon _ { s a m p l e }$ denotes the bias caused by sampling operation and $\varepsilon _ { w e i g h t }$ denotes the bias caused by weighted sum operation of volume rendering. With Formula (2), it can be rewritten as:
|
| 98 |
+
|
| 99 |
+
$$
|
| 100 |
+
w \left( t _ { j } \right) \hat { c } \left( \hat { t ^ { * } } \right) + \varepsilon _ { s a m p l e } + \varepsilon _ { w e i g h t } = c \left( t ^ { * } \right) ,
|
| 101 |
+
$$
|
| 102 |
+
|
| 103 |
+
$$
|
| 104 |
+
\hat { c } \left( t ^ { * } \right) = \frac { c \left( t ^ { * } \right) - \varepsilon _ { s a m p l e } - \varepsilon _ { w e i g h t } } { w \left( t _ { j } \right) } .
|
| 105 |
+
$$
|
| 106 |
+
|
| 107 |
+
There the total bias between the colors of object surface and estimated surface is:
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
\Delta c = \hat { c } \left( \hat { t ^ { * } } \right) - c \left( t ^ { * } \right) = \frac { ( 1 - w \left( t _ { j } \right) ) c \left( t ^ { * } \right) - \varepsilon _ { s a m p l e } - \varepsilon _ { w e i g h t } } { w \left( t _ { j } \right) } .
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
The relative bias is:
|
| 114 |
+
|
| 115 |
+
$$
|
| 116 |
+
\delta c = \frac { \Delta c } { c \left( t ^ { * } \right) } = \frac { 1 } { w \left( t _ { j } \right) } - 1 - \frac { \varepsilon _ { s a m p l e } + \varepsilon _ { w e i g h t } } { w \left( t _ { j } \right) c \left( t ^ { * } \right) } .
|
| 117 |
+
$$
|
| 118 |
+
|
| 119 |
+
When $w \left( t _ { j } \right)$ approaches to 1 $, \varepsilon _ { w e i g h t }$ approaches to 0 and $\delta c$ approaches to $\varepsilon _ { s a m p l e } \Big / c \big ( t ^ { * } \big )$ . In this case, the total bias is only caused by discrete sampling, which is small (but still exists). Simulated weights of some existing neural reconstruction methods are shown in Fig. 3. As can be seen, it is nearly impossible to get right there in practice, especially without any geometric constraints. Furthermore, the problem becomes more intractable when dealing with cases of occlusion. Therefore, the weighted manner of volume rendering integral introduces a bias to implicit geometry modeling. Because the supervision of the whole network almost depends exclusively on the difference between rendered colors and ground truth colors, the bias would make it difficult to supervise the colors of surface and the SDF network, leading to a gap between the colors and the geometry.
|
| 120 |
+
|
| 121 |
+

|
| 122 |
+
Figure 3: Simulated weight in color rendering process of neural reconstruction methods.
|
| 123 |
+
|
| 124 |
+
A trivial solution is to directly supervise the geometry of the object. In this way, we design explicit supervision on the SDF network and geometry-consistent supervision with multi-view constraints.
|
| 125 |
+
|
| 126 |
+
# 3.2 Explicit supervision on SDF network
|
| 127 |
+
|
| 128 |
+
The SDF network, which estimates the signed distance from any spatial point to the surface of the object, is the key network that we need to optimize. So we propose an explicit supervision method on the SDF network to ensure its accuracy directly with points in 3D space.
|
| 129 |
+
|
| 130 |
+
For less extra cost, we use points generated by structure from motion (SFM) [29, 33] to supervise the SDF network. In fact, SFM is a canonical solution to compute the camera parameters of input images, where 2D feature matches $X$ and sparse 3D points $P$ are also generated as byproducts. Thus, these sparse 3D points can be used as "free" explicit geometry information. Approximately, we suppose that these sparse points are on the surface of the object. That is, the SDF values of the sparse points are zeroes: sdf $( \bar { { \pmb p } _ { i } } ) = 0$ , where $\pmb { p } _ { i } \in \pmb { P }$ . In practice, after obtaining sparse 3D points, a radius filter is applied to exclude some outliers [46].
|
| 131 |
+
|
| 132 |
+
Occlusion handling. Because we focus on opaque objects, some parts of objects are invisible from view of a certain camera position. Therefore, there are only some of the sparse points visible for each view. For an image $I _ { i }$ with camera position $\mathbf { \delta } _ { \pmb { o } _ { i } }$ , the visible points $\mathbf { \nabla } P _ { i }$ are consistent with feature points $X _ { i }$ of $I _ { i }$ :
|
| 133 |
+
|
| 134 |
+
$$
|
| 135 |
+
X _ { i } = K _ { i } \left[ { \pmb R } _ { i } | { \pmb t } _ { i } \right] P _ { i } ,
|
| 136 |
+
$$
|
| 137 |
+
|
| 138 |
+
where $\pmb { K } _ { i }$ is the internal calibration matrix, $\pmb { R } _ { i }$ is the rotation matrix and $t _ { i }$ is the translation vector for image $I _ { i }$ . The coordinates of $X _ { i }$ and $\mathbf { \nabla } P _ { i }$ are all homogeneous coordinates. The scale index before $X _ { i }$ is omitted for simplicity. According to feature points of each image, we get visible points for each view and use them to supervise the SDF network while rendering image from the corresponding view.
|
| 139 |
+
|
| 140 |
+
View-aware SDF loss. While rendering image $I _ { i }$ from view $V _ { i }$ , we use the SDF network to estimate SDF values for the visible points $\mathbf { \nabla } P _ { i }$ of $V _ { i }$ (see supplementary for the SDF loss by random sampling from sparse 3D points). Based on the approximation that the SDF values of sparse points are zeroes, we propose the view-aware SDF loss:
|
| 141 |
+
|
| 142 |
+
$$
|
| 143 |
+
\mathcal { L } _ { S D F } = \sum _ { \pmb { p _ { j } \in P _ { i } } } \frac { 1 } { N _ { i } } | s \hat { d } f \left( \pmb { p _ { j } } \right) - s d f \left( \pmb { p _ { j } } \right) | = \sum _ { \pmb { p _ { j } \in P _ { i } } } \frac { 1 } { N _ { i } } | s \hat { d } f \left( \pmb { p _ { j } } \right) | ,
|
| 144 |
+
$$
|
| 145 |
+
|
| 146 |
+
where $N _ { i }$ is the number of points in $\mathbf { \nabla } P _ { i }$ and $| \cdot |$ denotes the $L _ { 1 }$ distance. It is worth noting that the loss we use to supervise the SDF network varies according to the view being rendered. In this way, the introduced SDF loss is consistent with the process of color rendering.
|
| 147 |
+
|
| 148 |
+
With the explicit supervision on the SDF network, our network could converge faster owing to the use of geometry prior. Besides, because the complex geometric structures with strong textures are the concentrated distribution areas of the sparse points, our method could capture more meticulous geometries.
|
| 149 |
+
|
| 150 |
+
# 3.3 Geometry-consistent supervision with multi-view constraints
|
| 151 |
+
|
| 152 |
+
With SDF loss, our network could capture complex geometric details with strong textures. Since the sparse 3D points mainly provide the explicit constraints on the areas with rich textures, large smooth regions still lack explicit geometry constraints. To go a step further, we design geometry-consistent supervision on the implicit surface with multi-view stereo constraints.
|
| 153 |
+
|
| 154 |
+
Occlusion-aware implicit surface capture. We use the implicit representation of the surface, and extract surface with the zero-level set of the implicit function. So the question is: Where is our implicit surface? According to Formula (3), the estimated surface is:
|
| 155 |
+
|
| 156 |
+
$$
|
| 157 |
+
\hat { \partial \Omega } = \left\{ \pmb { p } | s \hat { d } f ( \pmb { p } ) = 0 \right\} .
|
| 158 |
+
$$
|
| 159 |
+
|
| 160 |
+
We aim to optimize $ { \partial } { \hat { \boldsymbol { \Omega } } }$ with geometry-consistent constraints among different views. Because the number of points on the surface is infinite, we need to sample points from $ { \partial } { \hat { \varOmega } }$ in practice. To maintain consistency with the process of color rendering using view rays, we sample the surface points on these rays. As mentioned in 3.1, we sample $t$ discretely along the view ray and use the Riemann sum to obtain the rendered colors. Based on the sampled points, we use linear interpolation to get the surface points, which is similar to the root-finding used in [25, 26] to estimate the surface.
|
| 161 |
+
|
| 162 |
+
Specifically, with sampled point $t$ on the ray, the corresponding 3D point is $\pmb { p } = \pmb { o } + t \pmb { \nu }$ , and the predicted SDF value is $s { \hat { d } } f ( \pmb { p } )$ . For simplicity, we further represent $s d f ( \pmb { p } )$ as $s { \hat { d } } f ( t )$ , which is the function of $t$ . We find the sample point $t _ { i }$ , the sign of whose SDF value is different from the next sample point $t _ { i + 1 }$ . The sample points set $T$ formed by $t _ { i }$ is:
|
| 163 |
+
|
| 164 |
+
$$
|
| 165 |
+
T = \left\{ t _ { i } | s \hat { d } f ( t _ { i } ) \cdot s \hat { d } f ( t _ { i + 1 } ) < 0 \right\} .
|
| 166 |
+
$$
|
| 167 |
+
|
| 168 |
+
In this situation, the line $t _ { i } t _ { i + 1 }$ intersects with the surface $ { \partial } { \hat { \varOmega } }$ . The intersection points set $\hat { T } ^ { * }$ is:
|
| 169 |
+
|
| 170 |
+
$$
|
| 171 |
+
\hat { T ^ { * } } = \left\{ t | t = \frac { s \hat { d } f ( t _ { i } ) t _ { i + 1 } - s \hat { d } f ( t _ { i + 1 } ) t _ { i } } { s \hat { d } f ( t _ { i } ) - s \hat { d } f ( t _ { i + 1 } ) } , t _ { i } \in T \right\} .
|
| 172 |
+
$$
|
| 173 |
+
|
| 174 |
+
The ray that interacts with the object may have more than one intersection with the surface. Specifically speaking, there may be at least two intersections. Similar to the SDF supervision mechanism, we just use the first intersection point along the ray considering the occlusion problem:
|
| 175 |
+
|
| 176 |
+
$$
|
| 177 |
+
t ^ { * } = \mathrm { a r g m i n } \left. t | t \in \hat { T ^ { * } } \right. .
|
| 178 |
+
$$
|
| 179 |
+
|
| 180 |
+
The selection of $t ^ { * }$ guarantees the sample points of the implicit surface are all visible for the corresponding view and makes the supervision consistent with the process of color rendering.
|
| 181 |
+
|
| 182 |
+
Multi-view photometric consistency constraints. We capture our estimated implicit surface, of which the geometric structures are supposed to be consistent among different views. Based on this intuition, we use the photometric consistency constraints in multi-view stereo (MVS) [9, 37, 10] to supervise our extracted implicit surface.
|
| 183 |
+
|
| 184 |
+
For a small area $s$ on the surface, the projection of $s$ on the image is a small pixel patch $q$ . The patches corresponding to $s$ are supposed to be geometry-consistent among different views, except for occlusion occasions. Similar to patch warping in traditional MVS methods, we use the central point and its normal to represent $s$ . For convenience, we represent the plane equation of $s$ in the camera coordinate of the reference image $I _ { r }$ :
|
| 185 |
+
|
| 186 |
+
$$
|
| 187 |
+
\pmb { n } ^ { T } \pmb { p } + d = 0 ,
|
| 188 |
+
$$
|
| 189 |
+
|
| 190 |
+
where $\pmb { p }$ is the intersection point computed through Formula (19) and ${ \pmb n } ^ { T }$ is the normal computed with automatic differentiation of SDF network at $\pmb { p }$ . Then the image point $\boldsymbol { x }$ in the pixel patch $q _ { i }$ of reference image $I _ { r }$ is related to the corresponding point $ { \boldsymbol { { x } } } ^ { \prime }$ in the pixel patch $q _ { i s }$ of the source image $I _ { s }$ via the plane-induced homography $\pmb { H }$ [12]:
|
| 191 |
+
|
| 192 |
+
$$
|
| 193 |
+
\pmb { x } = \pmb { H } \pmb { x } ^ { \prime } , \pmb { H } = \pmb { K } _ { s } ( \pmb { R } _ { s } \pmb { R } _ { r } ^ { T } - \frac { \pmb { R } _ { s } ( \pmb { R } _ { s } ^ { T } \pmb { t } _ { s } - \pmb { R } _ { r } ^ { T } \pmb { t } _ { r } ) \pmb { n } ^ { T } } { \pmb { d } } ) \pmb { K } _ { r } ^ { - 1 } ,
|
| 194 |
+
$$
|
| 195 |
+
|
| 196 |
+
where $\pmb { K }$ donates the intrinsic matrix, $\pmb { R }$ donates the rotation matrix and $t$ donates the translation vector. The index indicates which image the donation belongs to. To concentrate on the geometric information, we convert color images $\{ I _ { i } \}$ into gray images $\left\{ { { I } _ { i } ^ { \prime } } \right\}$ , and supervise our implicit surface with the photometric consistency among patches in $\{ I _ { i } ^ { \prime } \}$ (see supplementary for RGB image settings).
|
| 197 |
+
|
| 198 |
+
Photometric consistency loss. To measure the photometric consistency, we use the normalization cross correlation (NCC) of patches in the reference gray image $\left\{ I _ { r } ^ { \prime } \right\}$ and the source gray image $\{ I _ { s } ^ { \prime } \}$ :
|
| 199 |
+
|
| 200 |
+
$$
|
| 201 |
+
N C C ( I _ { r } ^ { \prime } ( q _ { i } ) , I _ { s } ^ { \prime } ( q _ { i s } ) ) = \frac { C o v ( I _ { r } ^ { \prime } ( q _ { i } ) , I _ { s } ^ { \prime } ( q _ { i s } ) ) } { \sqrt { V a r ( I _ { r } ^ { \prime } ( q _ { i } ) ) V a r ( I _ { s } ^ { \prime } ( q _ { i s } ) ) } } ,
|
| 202 |
+
$$
|
| 203 |
+
|
| 204 |
+
where $C o v$ denotes covariance and $V a r$ donates variance. While rendering colors for an image, we use the patches which take the pixels being rendered as center and the patch size is $1 1 \times 1 1$ . We take the rendered image as the reference image and compute NCC scores between its sampled patches and their corresponding patches on all source images. To handle occlusions, we find the best four of the computed NCC scores for each sampled patch following [10], and use them to compute the photometric consistency loss for the corresponding view:
|
| 205 |
+
|
| 206 |
+
$$
|
| 207 |
+
\mathcal { L } _ { p h o t o } = \frac { \sum _ { i = 1 } ^ { N } \sum _ { s = 1 } ^ { 4 } 1 - N C C ( I _ { r } ^ { \prime } ( q _ { i } ) , I _ { s } ^ { \prime } ( q _ { i s } ) ) } { 4 N } ,
|
| 208 |
+
$$
|
| 209 |
+
|
| 210 |
+
where $N$ is the number of sampled pixels on the rendered image. With the photometric consistency loss, the geometric consistency of the implicit surface among multiple views is guaranteed.
|
| 211 |
+
|
| 212 |
+
# 3.4 Loss function
|
| 213 |
+
|
| 214 |
+
During rendering colors from a specific view, our total loss is:
|
| 215 |
+
|
| 216 |
+
$$
|
| 217 |
+
\mathcal { L } = \mathcal { L } _ { c o l o r } + \alpha \mathcal { L } _ { r e g } + \beta \mathcal { L } _ { S D F } + \gamma \mathcal { L } _ { p h o t o } .
|
| 218 |
+
$$
|
| 219 |
+
|
| 220 |
+
$\mathcal { L } _ { c o l o r }$ is the difference between the ground truth colors and the rendered colors:
|
| 221 |
+
|
| 222 |
+
$$
|
| 223 |
+
\mathcal { L } _ { c o l o r } = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } | C _ { i } - \hat { C } _ { i } | .
|
| 224 |
+
$$
|
| 225 |
+
|
| 226 |
+
And $\mathcal { L } _ { \boldsymbol { r } \boldsymbol { e } \boldsymbol { g } }$ is an eikonal term [11] to regularize the gradients of SDF network:
|
| 227 |
+
|
| 228 |
+
$$
|
| 229 |
+
\mathcal { L } _ { r e g } = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } { \left( | \nabla \hat { s d f } ( \pmb { p } _ { i } ) | - 1 \right) ^ { 2 } } .
|
| 230 |
+
$$
|
| 231 |
+
|
| 232 |
+
In our experiments, we choose $\alpha$ , $\beta$ and $\gamma$ as 0.1, 1.0 and 0.5 respectively.
|
| 233 |
+
|
| 234 |
+
# 4 Experiments
|
| 235 |
+
|
| 236 |
+
# 4.1 Experimental setting
|
| 237 |
+
|
| 238 |
+
Datasets. Following previous practices [43, 35, 42], we reconstruct surfaces from 15 scans of DTU dataset [1] to evaluate our method. DTU dataset has objects of various categories, which are quite different in terms of appearance and geometries. There are 49 or 64 images at a resolution of $1 2 0 0 \times$ 1600 in each scan with camera parameters. We also test on 7 challenging scenes from the low-res set of the BlendedMVS dataset [41] (CC-4 License). Scenes in BlendedMVS have various numbers of views and camera parameters. The scenes are captured by images at a resolution of $7 6 8 \times 5 7 6$ , and the numbers of views vary from 31 to 143. We evaluate our reconstructed surfaces on DTU dataset with the Chamfer Distance provided by DTU evaluation metrics [1]. For the BlendedMVS dataset, we show the visual effects of the reconstructed surfaces.
|
| 239 |
+
|
| 240 |
+
Baselines. To better evaluate our method, we compare it with the-state-of-art learning-based methods and the traditional reconstruction method, colmap [30]. For learning-based methods, we compare with IDR [43], VolSDF [42], NeuS [35] and NeuralWarp [7]. For colmap, we use the reconstructed surface with trim parameter 7 (the best performance) [26].
|
| 241 |
+
|
| 242 |
+
Implementation details. Similar to [43, 35, 42], the SDF network is modeled by an 8-layer MLP with 256 hidden units and a skip connection in the middle. It is initialized by the geometric initialization presented in [2]. The radiance network is parameterized by a 4-layer MLP with 256 hidden units. Positional encoding [20] is applied to 3D location with 6 frequencies and to viewing direction with 4 frequencies. We sample 512 rays per batch and follow the hierarchical sampling strategy in NeuS [35] to sample points for each ray. We train our model for $3 0 0 \mathrm { k }$ iterations for around 16 hours on a single NVIDIA RTX2080Ti GPU. After network training, a mesh can be extracted from the SDF in a predefined bounding box by the Marching Cube [19] with the volume size of $5 1 2 ^ { 3 }$
|
| 243 |
+
|
| 244 |
+
# 4.2 Comparisons
|
| 245 |
+
|
| 246 |
+
We compare the reconstruction quality of our method and baselines on DTU dataset. Table 1 shows the quantitative results. Notably, our method outperforms baselines by a large margin. Specifically, it outperforms state-of-the-art neural implicit surfaces learning methods by over $2 5 \%$ and outperforms the traditional method colmap by $2 2 \%$ . As shown qualitatively in Fig. 4, our method achieves high-quality surface reconstruction in both complex thin structures and large smooth regions. For example, our method can recover abrupt depth changes in Scan 37 and reconstruct planar structures in Scan 24 and 40. To test the capability of handling
|
| 247 |
+
|
| 248 |
+
Table 1: Results on DTU scenes. The surfaces produced by colmap are trimmed with trimming value 7.
|
| 249 |
+
|
| 250 |
+
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=2>with mask</td><td rowspan=1 colspan=5>without mask</td></tr><tr><td rowspan=1 colspan=1>Scan</td><td rowspan=1 colspan=1>IDR</td><td rowspan=1 colspan=1>NeuS</td><td rowspan=1 colspan=1>VolSDF</td><td rowspan=1 colspan=1>NeuS</td><td rowspan=1 colspan=1>NeuralWarp</td><td rowspan=1 colspan=1>colmap</td><td rowspan=1 colspan=1>Ours</td></tr><tr><td rowspan=1 colspan=1>37</td><td rowspan=1 colspan=1>1.87</td><td rowspan=1 colspan=1>0.95</td><td rowspan=1 colspan=1>1.26</td><td rowspan=1 colspan=1>1.21</td><td rowspan=1 colspan=1>0.71</td><td rowspan=1 colspan=1>0.91</td><td></td></tr><tr><td></td><td rowspan=3 colspan=1>0.63</td><td></td><td rowspan=3 colspan=1>0.81</td><td rowspan=3 colspan=1>0.73</td><td rowspan=3 colspan=1>0.38</td><td rowspan=3 colspan=1>0.37</td><td></td></tr><tr><td></td><td></td><td rowspan=2 colspan=1>0.5370.336</td></tr><tr><td rowspan=1 colspan=1>40</td><td rowspan=1 colspan=1>0.80</td></tr><tr><td rowspan=1 colspan=1>55</td><td rowspan=1 colspan=1>0.48</td><td rowspan=1 colspan=1>0.39</td><td rowspan=1 colspan=1>0.49</td><td rowspan=1 colspan=1>0.40</td><td rowspan=1 colspan=1>0.38</td><td rowspan=1 colspan=1>0.37</td><td rowspan=1 colspan=1>0.357</td></tr><tr><td rowspan=1 colspan=1>63</td><td rowspan=1 colspan=1>1.04</td><td rowspan=1 colspan=1>1.26</td><td rowspan=1 colspan=1>1.25</td><td rowspan=1 colspan=1>1.20</td><td rowspan=1 colspan=1>0.79</td><td rowspan=1 colspan=1>0.90</td><td rowspan=1 colspan=1>0.800</td></tr><tr><td rowspan=1 colspan=1>65</td><td rowspan=1 colspan=1>0.79</td><td rowspan=1 colspan=1>0.72</td><td rowspan=1 colspan=1>0.70</td><td rowspan=1 colspan=1>0.70</td><td rowspan=1 colspan=1>0.81</td><td rowspan=1 colspan=1>1.00</td><td rowspan=1 colspan=1>0.454</td></tr><tr><td rowspan=1 colspan=1>69</td><td rowspan=1 colspan=1>0.77</td><td rowspan=1 colspan=1>0.69</td><td rowspan=1 colspan=1>0.72</td><td rowspan=1 colspan=1>0.72</td><td rowspan=1 colspan=1>0.82</td><td rowspan=1 colspan=1>0.54</td><td rowspan=1 colspan=1>0.408</td></tr><tr><td rowspan=1 colspan=1>83</td><td rowspan=1 colspan=1>1.33</td><td rowspan=1 colspan=1>0.94</td><td rowspan=1 colspan=1>1.29</td><td rowspan=1 colspan=1>1.01</td><td rowspan=1 colspan=1>1.20</td><td rowspan=1 colspan=1>1.22</td><td rowspan=1 colspan=1>1.032</td></tr><tr><td rowspan=1 colspan=1>97</td><td rowspan=1 colspan=1>1.16</td><td rowspan=1 colspan=1>1.14</td><td rowspan=1 colspan=1>1.18</td><td rowspan=1 colspan=1>1.16</td><td rowspan=1 colspan=1>1.06</td><td rowspan=1 colspan=1>1.08</td><td rowspan=1 colspan=1>0.843</td></tr><tr><td rowspan=1 colspan=1>105</td><td rowspan=1 colspan=1>0.76</td><td rowspan=1 colspan=1>0.77</td><td rowspan=1 colspan=1>0.70</td><td rowspan=1 colspan=1>0.82</td><td rowspan=1 colspan=1>0.68</td><td rowspan=1 colspan=1>0.64</td><td rowspan=1 colspan=1>0.548</td></tr><tr><td rowspan=1 colspan=1>106</td><td rowspan=1 colspan=1>0.67</td><td rowspan=1 colspan=1>0.66</td><td rowspan=1 colspan=1>0.66</td><td rowspan=1 colspan=1>0.66</td><td rowspan=1 colspan=1>0.66</td><td rowspan=1 colspan=1>0.48</td><td rowspan=1 colspan=1>0.460</td></tr><tr><td rowspan=1 colspan=1>110</td><td rowspan=1 colspan=1>0.90</td><td rowspan=1 colspan=1>1.35</td><td rowspan=1 colspan=1>1.08</td><td rowspan=1 colspan=1>1.69</td><td rowspan=1 colspan=1>0.74</td><td rowspan=1 colspan=1>0.59</td><td rowspan=2 colspan=1>0.4730.294</td></tr><tr><td rowspan=1 colspan=1>114</td><td rowspan=1 colspan=1>0.42</td><td rowspan=1 colspan=1>0.39</td><td rowspan=1 colspan=1>0.42</td><td rowspan=1 colspan=1>0.39</td><td rowspan=1 colspan=1>0.41</td><td rowspan=1 colspan=1>0.32</td></tr><tr><td rowspan=2 colspan=1>118122</td><td rowspan=1 colspan=1>0.51</td><td rowspan=1 colspan=1>0.51</td><td rowspan=1 colspan=1>0.61</td><td rowspan=1 colspan=1>0.49</td><td rowspan=1 colspan=1>0.63</td><td rowspan=1 colspan=1>0.45</td><td rowspan=1 colspan=1>0.355</td></tr><tr><td rowspan=1 colspan=1>0.53</td><td rowspan=1 colspan=1>0.52</td><td rowspan=1 colspan=1>0.55</td><td rowspan=1 colspan=1>0.51</td><td rowspan=1 colspan=1>0.51</td><td rowspan=1 colspan=1>0.43</td><td rowspan=1 colspan=1>0.345</td></tr><tr><td rowspan=1 colspan=1>mean</td><td rowspan=1 colspan=1>0.90</td><td rowspan=1 colspan=1>0.82</td><td rowspan=1 colspan=1>0.86</td><td rowspan=1 colspan=1>0.87</td><td rowspan=1 colspan=1>0.68</td><td rowspan=1 colspan=1>0.65</td><td rowspan=1 colspan=1>0.508</td></tr></table>
|
| 251 |
+
|
| 252 |
+

|
| 253 |
+
Figure 4: Surfaces reconstructed on DTU and BlendedMVS. We use NeuS trained with mask supervision and colmap with trimming value 7 (see supplementary for comparison with NeuralWarp).
|
| 254 |
+
|
| 255 |
+

|
| 256 |
+
Figure 5: Surface quality of ablation models.
|
| 257 |
+
|
| 258 |
+
various scenes, we test on 7 challenging
|
| 259 |
+
scenes of the BlendedMVS dataset. Qualitative results in Fig. 4 show that our method yields more smooth and consistent surface quality than other methods.
|
| 260 |
+
|
| 261 |
+
# 4.3 Analysis
|
| 262 |
+
|
| 263 |
+
Ablation study. To evaluate the effect of our proposed contributions, we conduct an ablation study on DTU dataset. NeuS is adopted as our baseline. Different modules are progressively added to the baseline to investigate their efficacy. Results are reported in Table 2. We see that, with very sparse 3D supervision on SDF networks, Model-A has begun to outperform colmap (0.62 vs 0.65). This demonstrates that explicit SDF optimization is very beneficial to improve geometries. With the proposed photometric consistency loss, Model-B can optimize SDF networks more completely, leading to much more performance improvement. Fig. 5 shows how the proposed loss functions improve the surface quality. Model-A reconstructs the apple stem finely but the surface is not smooth enough. Model-B reconstructs the smooth surface but the apple stem is lost. That is, the SDF loss is better to improve the reconstruction of complex thin structures, while the photometric loss is better for the reconstruction of large smooth regions. Moreover, our full model, Geo-Neus absorbs their individual advantages and achieves the best performance.
|
| 264 |
+
|
| 265 |
+
Geometry bias of volumetric integration. To further investigate the geometric bias of volumetric integration, we render the depth images from a particular pose in a similar fashion to rendering RGB pixels [20] (see supplementary for details), and then use the depth images to construct sparse 3D points and photometric consistency constraints. NeuS is also used as the baseline. Comparison results are shown in Table 3. As can be seen, compared with baseline (0.87), multi-view geometry constraints with depth integral bring little performance improvement or even degradation. It is a remarkable fact that photometric consistency supervision with depth integral surface location could not converge because of the initial immense bias while the SDF location model converges smoothly. As an alternative, we train these two models based on the baseline model pretrained with $2 0 0 \mathrm { k }$ iterations. The result of the depth integral model still degrades compared with the baseline. This verifies the existence of geometric bias in volumetric integration. With our proposed SDF-oriented optimization, surface reconstruction quality can be significantly boosted.
|
| 266 |
+
|
| 267 |
+
Table 2: Ablation study on DTU scenes.
|
| 268 |
+
|
| 269 |
+
<table><tr><td>Method</td><td>Lcolor</td><td>LsDF</td><td>Lphoto</td><td>mean</td></tr><tr><td>Baseline</td><td>√</td><td></td><td></td><td>0.87</td></tr><tr><td>Model-A</td><td></td><td>厂</td><td></td><td>0.62</td></tr><tr><td>Model-B</td><td></td><td></td><td></td><td>0.54</td></tr><tr><td>Geo-Neus</td><td></td><td></td><td></td><td>0.51</td></tr></table>
|
| 270 |
+
|
| 271 |
+
<table><tr><td rowspan=1 colspan=1>Constraint</td><td rowspan=1 colspan=1>Setting</td><td rowspan=1 colspan=1>mean</td></tr><tr><td rowspan=1 colspan=1>Sparse 3D points</td><td rowspan=1 colspan=1>DepthintegralSDF location</td><td rowspan=1 colspan=1>0.850.62</td></tr><tr><td rowspan=1 colspan=1>Photometric consistency</td><td rowspan=1 colspan=1>DepthintegralSDF location</td><td rowspan=1 colspan=1>1.080.57</td></tr></table>
|
| 272 |
+
|
| 273 |
+
Table 3: Comparison results between depth integral and SDF location.
|
| 274 |
+
|
| 275 |
+
Convergence speed. We further study the convergence speed of our proposed method, Geo-Neus, and baseline, NeuS. As shown in Fig. 6, our method converges rapidly from scratch and becomes stable after $2 0 0 \mathrm { k }$ iterations. In contrast, NeuS cannot extract the reasonable surface from SDF networks in the beginning and starts to become stable after $2 5 0 \mathrm { k }$ iterations. This demonstrates that our proposed explicit SDF optimization also improves the efficiency of neural surfaces learning by volume rendering, reducing the training time from around 16 hours to around 10 hours.
|
| 276 |
+
|
| 277 |
+
Limitation. We show failure cases of our method on scenes with strong specular highlights and transparent objects. Fig. 7(a) shows our reconstructed surfaces on the scene with strong specular highlights, DTU scan77. In this case, the strong specular highlights lead to large view-dependent effects, making the multi-view photometric consistency loss unable to reliably measure multi-view geometry constraints. Thus, our method cannot produce satisfactory surfaces in this case. In addition, Fig. 7(b) shows our reconstructed surfaces on the scene with transparent objects [13]. As proposed in Sec. 3.1, we assume the target objects are all opaque and solid. For transparent objects, the proposed bias between rendered colors and implicit geometry is invalid. Furthermore, the geometric loss we proposed may not work well, just like the photometric consistency used in traditional reconstruction methods.
|
| 278 |
+
|
| 279 |
+

|
| 280 |
+
Figure 6: Convergence speed.
|
| 281 |
+
|
| 282 |
+

|
| 283 |
+
Figure 7: Failure cases.
|
| 284 |
+
|
| 285 |
+
# 5 Conclusion
|
| 286 |
+
|
| 287 |
+
We have proposed Geo-Neus, a new method to perform neural implicit surfaces learning by enforcing explicit SDF optimization. In our paper, we first provide the theoretical analysis that there exists a gap between volume rendering integration and neural SDF learning. With this theoretical support, we propose to explicitly optimize neural SDF learning by introducing two multi-view geometry constraints: sparse 3D points in structure from motion and photometric consistency in multi-view stereo. In this way, Geo-Neus produces high-quality surface reconstruction in both complex thin structures and large smooth regions. Therefore, it outperforms the state-of-the-arts by a large margin, including both traditional and neural implicit surfaces learning methods. We note that although our method greatly improves reconstruction quality, its efficiency is still limited. In the future, it will be interesting to explore accelerating neural implicit surfaces learning by volume rendering through super-fast per-scene radiance field optimization methods [34, 24]. We don’t see an immediate negative societal impact of our work, but accurate 3D models may be used from malevolence.
|
| 288 |
+
|
| 289 |
+
Acknowledgments This work was in part supported by the National Natural Science Foundation of China under Grants 62176096 and 61991412, the Data Science and Artificial Intelligence Research Center (DSAIR), School of Computer Science and Engineering, Nanyang Technological University and the A\*Star Center for Frontier AI Research (CFAR).
|
| 290 |
+
|
| 291 |
+
References
|
| 292 |
+
[1] Henrik Aanæs, Rasmus Ramsbøl Jensen, George Vogiatzis, Engin Tola, and Anders Bjorholm Dahl. Large-scale data for multiple-view stereopsis. International Journal of Computer Vision, 120(2):153–168, 2016.
|
| 293 |
+
[2] Matan Atzmon and Yaron Lipman. Sal: Sign agnostic learning of shapes from raw data. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 2565–2574, 2020.
|
| 294 |
+
[3] Bruce G Baumgart. A polyhedron representation for computer vision. In Proceedings of the National Computer Conference and Exposition, pages 589–596, 1975.
|
| 295 |
+
[4] Jean-Daniel Boissonnat and Bernhard Geiger. Three-dimensional reconstruction of complex shapes based on the delaunay triangulation. In Biomedical Image Processing and Biomedical Visualization, volume 1905, pages 964–975, 1993.
|
| 296 |
+
[5] Adrian Broadhurst, Tom W Drummond, and Roberto Cipolla. A probabilistic framework for space carving. In Proceedings of the IEEE International Conference on Computer Vision, volume 1, pages 388–393, 2001.
|
| 297 |
+
[6] Brian Curless and Marc Levoy. A volumetric method for building complex models from range images. In Proceedings of the 23rd annual conference on Computer graphics and interactive techniques, pages 303–312, 1996.
|
| 298 |
+
[7] François Darmon, Bénédicte Bascle, Jean-Clément Devaux, Pascal Monasse, and Mathieu Aubry. Improving neural implicit surfaces geometry with patch warping. arXiv preprint arXiv:2112.09648, 2021.
|
| 299 |
+
[8] Philipp Erler, Paul Guerrero, Stefan Ohrhallinger, Niloy J Mitra, and Michael Wimmer. Points2surf learning implicit surfaces from point clouds. In Proceedings of the European Conference on Computer Vision, pages 108–124. Springer, 2020.
|
| 300 |
+
[9] Yasutaka Furukawa and Jean Ponce. Accurate, dense, and robust multiview stereopsis. IEEE Transactions on Pattern Analysis and Machine Intelligence, 32(8):1362–1376, 2010.
|
| 301 |
+
[10] S. Galliani, K. Lasinger, and K. Schindler. Massively parallel multiview stereopsis by surface normal diffusion. In Proceedings of the IEEE International Conference on Computer Vision, pages 873–881, 2015.
|
| 302 |
+
[11] Amos Gropp, Lior Yariv, Niv Haim, Matan Atzmon, and Yaron Lipman. Implicit geometric regularization for learning shapes. arXiv preprint arXiv:2002.10099, 2020.
|
| 303 |
+
[12] Richard Hartley and Andrew Zisserman. Multiple View Geometry in Computer Vision. Cambridge University Press, 2 edition, 2004.
|
| 304 |
+
[13] Jeffrey Ichnowski, Yahav Avigal, Justin Kerr, and Ken Goldberg. Dex-nerf: Using a neural radiance field to grasp transparent objects. arXiv preprint arXiv:2110.14217, 2021.
|
| 305 |
+
[14] Abhishek Kar, Christian Häne, and Jitendra Malik. Learning a multi-view stereo machine. Advances in neural information processing systems, 30, 2017.
|
| 306 |
+
[15] Michael Kazhdan and Hugues Hoppe. Screened poisson surface reconstruction. ACM Transactions on Graphics, 32(3):1–13, 2013.
|
| 307 |
+
[16] Patrick Labatut, J-P Pons, and Renaud Keriven. Robust and efficient surface reconstruction from range data. In Computer Graphics Forum, volume 28, pages 2275–2290, 2009.
|
| 308 |
+
[17] Patrick Labatut, Jean-Philippe Pons, and Renaud Keriven. Efficient multi-view reconstruction of large-scale scenes using interest points, delaunay triangulation and graph cuts. In Proceedings of the IEEE International Conference on Computer Vision, pages 1–8, 2007.
|
| 309 |
+
[18] Lingjie Liu, Jiatao Gu, Kyaw Zaw Lin, Tat-Seng Chua, and Christian Theobalt. Neural sparse voxel fields. Advances in Neural Information Processing Systems, 33:15651–15663, 2020.
|
| 310 |
+
|
| 311 |
+
[19] William E Lorensen and Harvey E Cline. Marching cubes: A high resolution 3d surface construction algorithm. ACM siggraph computer graphics, 21(4):163–169, 1987.
|
| 312 |
+
|
| 313 |
+
[20] Ricardo Martin-Brualla, Noha Radwan, Mehdi SM Sajjadi, Jonathan T Barron, Alexey Dosovitskiy, and Daniel Duckworth. Nerf in the wild: Neural radiance fields for unconstrained photo collections. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 7210–7219, 2021.
|
| 314 |
+
|
| 315 |
+
[21] Nelson Max. Optical models for direct volume rendering. IEEE Transactions on Visualization and Computer Graphics, 1(2):99–108, 1995.
|
| 316 |
+
|
| 317 |
+
[22] Lars Mescheder, Michael Oechsle, Michael Niemeyer, Sebastian Nowozin, and Andreas Geiger. Occupancy networks: Learning 3d reconstruction in function space. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 4460–4470, 2019.
|
| 318 |
+
|
| 319 |
+
[23] Ben Mildenhall, Pratul P Srinivasan, Matthew Tancik, Jonathan T Barron, Ravi Ramamoorthi, and Ren $\mathrm { N g }$ . Nerf: Representing scenes as neural radiance fields for view synthesis. In Proceedings of the European Conference on Computer Vision, pages 405–421, 2020.
|
| 320 |
+
|
| 321 |
+
[24] Thomas Müller, Alex Evans, Christoph Schied, and Alexander Keller. Instant neural graphics primitives with a multiresolution hash encoding. arXiv preprint arXiv:2201.05989, 2022.
|
| 322 |
+
|
| 323 |
+
[25] Michael Niemeyer, Lars Mescheder, Michael Oechsle, and Andreas Geiger. Differentiable volumetric rendering: Learning implicit 3d representations without 3d supervision. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 3504–3515, 2020.
|
| 324 |
+
|
| 325 |
+
[26] Michael Oechsle, Songyou Peng, and Andreas Geiger. Unisurf: Unifying neural implicit surfaces and radiance fields for multi-view reconstruction. In Proceedings of the IEEE International Conference on Computer Vision, pages 5589–5599, 2021.
|
| 326 |
+
|
| 327 |
+
[27] Jeong Joon Park, Peter Florence, Julian Straub, Richard Newcombe, and Steven Lovegrove. Deepsdf: Learning continuous signed distance functions for shape representation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 165–174, 2019.
|
| 328 |
+
|
| 329 |
+
[28] Songyou Peng, Michael Niemeyer, Lars Mescheder, Marc Pollefeys, and Andreas Geiger. Convolutional occupancy networks. In Proceedings of the European Conference on Computer Vision, pages 523–540, 2020.
|
| 330 |
+
|
| 331 |
+
[29] Johannes L Schonberger and Jan-Michael Frahm. Structure-from-motion revisited. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 4104–4113, 2016.
|
| 332 |
+
|
| 333 |
+
[30] Johannes L. Schönberger, Enliang Zheng, Jan-Michael Frahm, and Marc Pollefeys. Pixelwise view selection for unstructured multi-view stereo. In Proceedings of the European Conference on Computer Vision, pages 501–518, 2016.
|
| 334 |
+
|
| 335 |
+
[31] Steven M Seitz and Charles R Dyer. Photorealistic scene reconstruction by voxel coloring. International Journal of Computer Vision, 35(2):151–173, 1999.
|
| 336 |
+
|
| 337 |
+
[32] Vincent Sitzmann, Julien Martel, Alexander Bergman, David Lindell, and Gordon Wetzstein. Implicit neural representations with periodic activation functions. Advances in Neural Information Processing Systems, 33:7462–7473, 2020.
|
| 338 |
+
|
| 339 |
+
[33] Noah Snavely, Steven M Seitz, and Richard Szeliski. Photo tourism: exploring photo collections in 3d. In ACM SIGGRAPH, pages 835–846, 2006.
|
| 340 |
+
|
| 341 |
+
[34] Cheng Sun, Min Sun, and Hwann-Tzong Chen. Direct voxel grid optimization: Super-fast convergence for radiance fields reconstruction. arXiv preprint arXiv:2111.11215, 2021.
|
| 342 |
+
|
| 343 |
+
[35] Peng Wang, Lingjie Liu, Yuan Liu, Christian Theobalt, Taku Komura, and Wenping Wang. Neus: Learning neural implicit surfaces by volume rendering for multi-view reconstruction. arXiv preprint arXiv:2106.10689, 2021.
|
| 344 |
+
|
| 345 |
+
[36] Qingshan Xu, Weihang Kong, Wenbing Tao, and Marc Pollefeys. Multi-scale geometric consistency guided and planar prior assisted multi-view stereo. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2022.
|
| 346 |
+
[37] Qingshan Xu and Wenbing Tao. Multi-scale geometric consistency guided multi-view stereo. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 5483–5492, 2019.
|
| 347 |
+
[38] Qingshan Xu and Wenbing Tao. Planar prior assisted patchmatch multi-view stereo. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 12516–12523, 2020.
|
| 348 |
+
[39] Qingshan Xu and Wenbing Tao. Pvsnet: Pixelwise visibility-aware multi-view stereo network. arXiv preprint arXiv:2007.07714, 2020.
|
| 349 |
+
[40] Yao Yao, Zixin Luo, Shiwei Li, Tian Fang, and Long Quan. Mvsnet: Depth inference for unstructured multi-view stereo. In Proceedings of the European Conference on Computer Vision, pages 767–783, 2018.
|
| 350 |
+
[41] Yao Yao, Zixin Luo, Shiwei Li, Jingyang Zhang, Yufan Ren, Lei Zhou, Tian Fang, and Long Quan. Blendedmvs: A large-scale dataset for generalized multi-view stereo networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 1790–1799, 2020.
|
| 351 |
+
[42] Lior Yariv, Jiatao Gu, Yoni Kasten, and Yaron Lipman. Volume rendering of neural implicit surfaces. In Advances in Neural Information Processing Systems, volume 34, 2021.
|
| 352 |
+
[43] Lior Yariv, Yoni Kasten, Dror Moran, Meirav Galun, Matan Atzmon, Basri Ronen, and Yaron Lipman. Multiview neural surface reconstruction by disentangling geometry and appearance. In Advances in Neural Information Processing Systems, volume 33, pages 2492–2502, 2020.
|
| 353 |
+
[44] Jingyang Zhang, Yao Yao, and Long Quan. Learning signed distance field for multi-view surface reconstruction. In Proceedings of the IEEE International Conference on Computer Vision, pages 6525–6534, 2021.
|
| 354 |
+
[45] Kai Zhang, Gernot Riegler, Noah Snavely, and Vladlen Koltun. Nerf $^ { + + }$ : Analyzing and improving neural radiance fields. arXiv preprint arXiv:2010.07492, 2020.
|
| 355 |
+
[46] Qian-Yi Zhou, Jaesik Park, and Vladlen Koltun. Open3d: A modern library for 3d data processing. arXiv preprint arXiv:1801.09847, 2018.
|
| 356 |
+
|
| 357 |
+
# Checklist
|
| 358 |
+
|
| 359 |
+
1. For all authors...
|
| 360 |
+
|
| 361 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 362 |
+
(b) Did you describe the limitations of your work? [Yes] See Section 4.3.
|
| 363 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Section 5.
|
| 364 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 365 |
+
|
| 366 |
+
2. If you are including theoretical results...
|
| 367 |
+
|
| 368 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] See Section 3.1.
|
| 369 |
+
(b) Did you include complete proofs of all theoretical results? [Yes] See Section 3.1.
|
| 370 |
+
|
| 371 |
+
3. If you ran experiments...
|
| 372 |
+
|
| 373 |
+
(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 plan to release the code completely but have not yet with submission.
|
| 374 |
+
|
| 375 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 4.1.
|
| 376 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No]
|
| 377 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Section 4.1.
|
| 378 |
+
|
| 379 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 380 |
+
|
| 381 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes] See Section 4.1.
|
| 382 |
+
(b) Did you mention the license of the assets? [Yes] See Section 4.1.
|
| 383 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [No]
|
| 384 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 385 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 386 |
+
|
| 387 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 388 |
+
|
| 389 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 390 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 391 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/K0E_F0gFDgA/K0E_F0gFDgA.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/K10zWxlEGI/K10zWxlEGI.md
ADDED
|
@@ -0,0 +1,532 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Expressive dynamics models with nonlinear injective readouts enable reliable recovery of latent features from neural activity
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 The advent of large-scale neural recordings has enabled new approaches that
|
| 11 |
+
2 aim to discover the computational mechanisms of neural circuits by understand
|
| 12 |
+
3 ing the rules that govern how their state evolves over time. While these neural
|
| 13 |
+
4 dynamics cannot be directly measured, they can typically be approximated by
|
| 14 |
+
5 low-dimensional models in a latent space. How these models represent the map
|
| 15 |
+
6 ping from latent space to neural space can affect the interpretability of the latent
|
| 16 |
+
7 representation. Typical choices for this mapping (e.g., linear layer or MLP) lack the
|
| 17 |
+
8 property of injectivity, meaning that changes in latent state may have no effect on
|
| 18 |
+
9 neural activity. During training, non-injective readouts incentivize the invention of
|
| 19 |
+
10 dynamics that misrepresent the underlying system and the computation it performs.
|
| 20 |
+
11 Combining our injective Flow readout with prior work on interpretable latent dy
|
| 21 |
+
12 namics models, we created the Ordinary Differential equations autoencoder with
|
| 22 |
+
13 Injective Nonlinear readout (ODIN), which learns to capture latent dynamical
|
| 23 |
+
14 systems that are nonlinearly embedded into observed neural firing rates via an
|
| 24 |
+
15 approximately injective nonlinear mapping. We show that ODIN can recover non
|
| 25 |
+
16 linearly embedded systems from simulated neural activity, even when the nature of
|
| 26 |
+
17 the system and embedding are unknown. Additionally, we show that ODIN enables
|
| 27 |
+
18 the unsupervised recovery of underlying dynamical features (e.g., fixed-points) and
|
| 28 |
+
19 embedding geometry. When applied to biological neural recordings, ODIN can
|
| 29 |
+
20 reconstruct neural activity with comparable accuracy to previous state-of-the-art
|
| 30 |
+
21 methods while using substantially fewer latent dimensions. Overall, ODIN’s accu
|
| 31 |
+
22 racy in recovering ground-truth latent features and ability to accurately reconstruct
|
| 32 |
+
23 neural activity with low dimensionality make it a promising method for distilling
|
| 33 |
+
24 interpretable dynamics that can help explain neural computation.
|
| 34 |
+
|
| 35 |
+
# 25 1 Introduction
|
| 36 |
+
|
| 37 |
+
26 Recent evidence has shown that when artificial recurrent neural networks are trained to perform
|
| 38 |
+
27 tasks, the rules that govern how the internal activity evolves over time (i.e., the network dynamics)
|
| 39 |
+
28 can provide insight into how the network performs the underlying computation [1–4]. Given the
|
| 40 |
+
29 conceptual similarities between artificial neural networks and biological neural circuits, it may be
|
| 41 |
+
30 possible to apply these same dynamical analyses to brain activity to gain insight into how neural
|
| 42 |
+
circuits perform complex sensory, cognitive, and motor processes [5–7]. However, unlike in artificial
|
| 43 |
+
32 networks, we cannot easily interrogate the dynamics of biological neural circuits and must instead
|
| 44 |
+
33 estimate them from observed neural activity.
|
| 45 |
+
34 Fortunately, advances in recording technology have dramatically increased the number of neurons
|
| 46 |
+
35 that can be simultaneously recorded, providing ample data for novel population-level analyses of
|
| 47 |
+
36 neural activity [8–10]. In these datasets, the activity of hundreds or thousands of neurons can often
|
| 48 |
+
37 be captured by relatively low-dimensional subspaces [11], orders-of-magnitude smaller than the total
|
| 49 |
+
38 number of neurons. Neural activity in these latent spaces seems to evolve according to consistent sets
|
| 50 |
+
39 of rules (i.e., latent dynamics) [12, 6]. Assuming no external inputs, these rules can be expressed
|
| 51 |
+
40 mathematically as:
|
| 52 |
+
|
| 53 |
+
$$
|
| 54 |
+
\begin{array} { r } { \mathbf { z } _ { t + 1 } = \mathbf { z } _ { t } + f ( \mathbf { z } _ { t } ) } \\ { \mathbf { y } _ { t } = \exp { g ( \mathbf { z } _ { t } ) } } \\ { \mathbf { x } _ { t } \sim \mathrm { P o i s s o n } ( \mathbf { y } _ { t } ) } \end{array}
|
| 55 |
+
$$
|
| 56 |
+
|
| 57 |
+
41 where $\mathbf { z } _ { t } \in \mathbb { R } ^ { D }$ represents the latent state at time $t$ , $f ( \cdot ) : \mathbb { R } ^ { D } \mathbb { R } ^ { D }$ is the vector field governing the
|
| 58 |
+
42 dynamical system, $\mathbf { y } _ { t } \in \mathbb { R } ^ { N }$ denotes the firing rates of the $N$ neurons, $g ( \cdot ) : \mathbb { R } ^ { D } \to \mathbb { R } ^ { \breve { N } }$ maps latent
|
| 59 |
+
43 activity into log-firing rates, and $\mathbf { x } _ { t } \in \mathbb { R } ^ { N }$ denotes the observed spike counts at time $t$ , assuming the
|
| 60 |
+
44 spiking activity follows a Poisson distribution with time-varying rates given at each moment $t$ by $\mathbf { y } _ { t }$
|
| 61 |
+
45 Unfortunately, any latent system can be equivalently described by many combinations of dynamics $f$
|
| 62 |
+
46 and embeddings $g$ , which makes the search for a unique latent system futile. However, versions of a
|
| 63 |
+
47 latent system’s dynamics $f$ and embedding $g$ that are less complex and use fewer latent dimensions
|
| 64 |
+
48 can be much easier to interpret than alternative representations that are more complex and/or higher
|
| 65 |
+
49 dimensional. Models of latent dynamics that can discover simple and low-dimensional representations
|
| 66 |
+
50 will make it easier to link latent dynamics to neural computation.
|
| 67 |
+
51 A popular approach to estimate neural dynamics [13–15] is to use neural population dynamics models
|
| 68 |
+
52 (NPDMs), which model neural activity as a latent dynamical system embedded into neural activity.
|
| 69 |
+
53 We refer to the components of an NPDM that learn the dynamics and embedding as the generator $\hat { f }$
|
| 70 |
+
54 and the readout $\hat { g }$ , respectively. When modeling neural activity, the generator and readout are jointly
|
| 71 |
+
55 trained to infer firing rates $\hat { \mathbf { y } }$ that maximize the likelihood of the observed neural activity $\mathbf { x }$ .
|
| 72 |
+
56 Using NPDMs to estimate underlying dynamics and embedding implicitly assumes that good recon
|
| 73 |
+
57 struction performance (i.e., $\hat { x } \approx x$ ) implies interpretable estimates of the underlying system (i.e.,
|
| 74 |
+
58 $\approx z , { \hat { f } } \approx f , { \hat { g } } \approx g )$ . However, recent work has shown that when the state dimensionality of
|
| 75 |
+
59 the generator $\hat { D }$ is larger than a system’s latent dimensionality $D$ , high reconstruction performance
|
| 76 |
+
60 may actually correspond to estimates of the latent system that are overly complex or misleading
|
| 77 |
+
61 and therefore harder to interpret [15]. Thus at present, reconstruction performance is seemingly an
|
| 78 |
+
62 unreliable indicator for the interpretability of the learned dynamics.
|
| 79 |
+
63 This vulnerability to learning overly complex latent features might come from the fact that, in general,
|
| 80 |
+
64 changes in the latent state are not obligated to have an effect on predicted neural activity. Thus,
|
| 81 |
+
65 NPDMs can be rewarded for inventing latent activity that boosts reconstruction performance, even if
|
| 82 |
+
66 that latent activity has no direct correspondence to the neural activity. A potential solution is to make
|
| 83 |
+
67 the readout $\hat { g }$ injective, which obligates all latent activity to affect neural reconstruction. This would
|
| 84 |
+
68 penalize any latent activity that is not reflected in the observed neural activity and puts pressure on
|
| 85 |
+
69 the generator $\hat { f }$ and readout $\hat { g }$ to learn a more interpretable (i.e., simpler and lower dimensional)
|
| 86 |
+
70 representation of the underlying system.
|
| 87 |
+
71 In addition, most previously used readouts $\hat { g }$ were not expressive enough to model diverse mappings
|
| 88 |
+
72 from latent space to neural space, assuming the embedding $g$ to be a relatively simple (often linear)
|
| 89 |
+
73 transformation (though there are exceptions [16–18]). Capturing nonlinear embeddings is important
|
| 90 |
+
74 because neural activity often lives on a lower-dimensional manifold that is nonlinearly embedded
|
| 91 |
+
75 into the higher-dimensional neural space [7]. Therefore, assumptions of linearity are likely to prevent
|
| 92 |
+
76 NPDMs from capturing dynamics in their simplest and lowest-dimensional form, making them less
|
| 93 |
+
77 interpretable than the latent features learned by NPDMs that can approximate these nonlinearities.
|
| 94 |
+
78 To address these challenges, we propose a novel architecture called the Ordinary Differential equa
|
| 95 |
+
79 tion autoencoder with Injective Nonlinear readout (ODIN), which implements $\hat { f }$ using a Neural
|
| 96 |
+
80 ODE (NODE [19]) and $\hat { g }$ using a network inspired by invertible ResNets [20–22, 19, 23]. ODIN
|
| 97 |
+
81 approximates an injective nonlinear mapping between latent states and neural activity, obligating all
|
| 98 |
+
82 latent state variance to appear in the predicted neural activity and penalizing the model for inventing
|
| 99 |
+
83 excessively complex or high-dimensional dynamics. On synthetic data, ODIN learns representations
|
| 100 |
+
84 of the latent system that are more interpretable, with simpler and lower-dimensional latent activity and
|
| 101 |
+
85 dynamical features (e.g., fixed-points) than alternative readouts. ODIN’s interpretability is also more
|
| 102 |
+
86 robust to overestimates of latent dimensionality and can recover the nonlinear embedding of synthetic
|
| 103 |
+
87 data that evolves on a simulated manifold. When applied to neural activity from a monkey performing
|
| 104 |
+
88 a reaching task with obstacles, ODIN reconstructs neural activity comparably to state-of-the-art
|
| 105 |
+
89 recurrent neural network (RNN)-based models while requiring far fewer latent state dimensions.
|
| 106 |
+
90 In summary, ODIN estimates interpretable latent features from synthetic data and can reconstruct
|
| 107 |
+
91 biological neural recordings with high accuracy, making it a promising tool for understanding how
|
| 108 |
+
92 the brain performs computation.
|
| 109 |
+
|
| 110 |
+
# 2 Related Work
|
| 111 |
+
|
| 112 |
+
94 Many previous models have attempted to understand neural activity through the lens of neural
|
| 113 |
+
95 dynamics. Early efforts limited model complexity by constraining both $\hat { f }$ and $\hat { g }$ to be linear [24–26].
|
| 114 |
+
96 While these models were relatively straightforward to analyze, they often failed to adequately explain
|
| 115 |
+
97 neural activity patterns [27].
|
| 116 |
+
98 Other approaches increased the expressiveness of the modeled dynamics $\hat { f }$ . RNNs can learn to
|
| 117 |
+
99 approximate complex nonlinear dynamics, and have been shown to substantially outperform linear
|
| 118 |
+
100 dynamics models in reconstructing neural activity [27]. Unfortunately, RNNs implicitly couple the
|
| 119 |
+
101 capacity of the model to the latent state dimensionality, meaning their ability to model complex
|
| 120 |
+
102 dynamics relies on having a high-dimensional latent state. In contrast, NODEs can model arbitrarily
|
| 121 |
+
103 complex dynamics of embedded dynamical systems at the dimensionality of the system [19, 15].
|
| 122 |
+
104 On synthetic data, NODEs have been shown to recover dynamics more accurately than RNN
|
| 123 |
+
105 based methods [28, 15]. In contrast to our approach, previous NODE-based models used a linear
|
| 124 |
+
106 readout $\hat { g }$ that lacks injectivity. This can make the accuracy of estimated latent activity vulnerable
|
| 125 |
+
107 to overestimates of the latent dimensionality (i.e., when $\dot { \hat { D } } > D _ { \ast } ^ { \ast }$ ) and/or fail to capture potential
|
| 126 |
+
108 nonlinearities in the embedding $g$ .
|
| 127 |
+
109 Early efforts to allow greater flexibility in $\hat { g }$ preserved linearity in $\hat { f }$ , using feed-forward neural
|
| 128 |
+
110 networks to nonlinearly embed linear dynamical systems in high-dimensional neural firing rates
|
| 129 |
+
111 [16]. More recently, models have used Gaussian Processes to approximate nonlinear mappings
|
| 130 |
+
112 from latent state to neural firing with tuning curves [17]. Other models have combined nonlinear
|
| 131 |
+
113 dynamics models and nonlinear embeddings for applications in behavioral tracking [29] and neural
|
| 132 |
+
114 reconstruction [18]. Additional approaches extend these methods to incorporate alternative noise
|
| 133 |
+
115 models that may better reflect the underlying firing properties of neurons [16, 30]. While nonlinear,
|
| 134 |
+
116 the readouts of these models lacked injectivity in their mapping from latent activity to neural activity.
|
| 135 |
+
117 Many alternative models seek to capture interpretable latent features of a system from observations.
|
| 136 |
+
118 One popular approach uses a sparsity penalty on a high-dimensional basis set to derive a sparse
|
| 137 |
+
119 symbolic estimate of the governing equations for the system [31]. However, it is unclear whether
|
| 138 |
+
120 such sparse symbolic representation is necessarily a benefit when modeling dynamics in the brain.
|
| 139 |
+
121 Another recent model uses contrastive loss and auxiliary behavioral variables to learn low-dimensional
|
| 140 |
+
122 representations of latent activity [32]. This approach does not have an explicit dynamics model,
|
| 141 |
+
123 however, so is not amenable to the dynamical analyses performed in this manuscript.
|
| 142 |
+
124 Normalizing flows – a type of invertible neural network – have recently become a staple for generative
|
| 143 |
+
125 modeling and density estimation [20, 23]. Some latent variable models have used invertible networks
|
| 144 |
+
126 to approximate the mapping from the latent space to neural activity [33] or for generative models of
|
| 145 |
+
127 visual cortex activity [34]. To allow this mapping to change dimensionality between the latent space
|
| 146 |
+
128 and neural activity, some of these models used a zero-padding procedure similar to the padding used
|
| 147 |
+
129 in this manuscript (see Section 3.3.1), which makes the transformation injective rather than invertible
|
| 148 |
+
130 [33, 23]. However, these previous approaches did not have explicit dynamics models, making our
|
| 149 |
+
131 study, to our knowledge, the first to test whether injective readouts can improve the interpretability of
|
| 150 |
+
132 neural population dynamics models.
|
| 151 |
+
|
| 152 |
+
# 3 Methods
|
| 153 |
+
|
| 154 |
+
# 3.1 Synthetic Neural Data
|
| 155 |
+
|
| 156 |
+
To determine whether different models can distill an interpretable latent system from observed population activity, we first used reference datasets that were generated using simple ground-truth dynamics $f$ and embedding $g$ . Our synthetic test cases emulate the empirical properties of neural systems, specifically low-dimensional latent dynamics observed through noisy spiking activity [13, 35– 37]. We sampled latent trajectories from the Arneodo system ( $f$ , $D = 3$ ) and nonlinearly embedded these trajectories into neural activity via an embedding $g$ . We consider models that can recover the dynamics $f$ and embedding $g$ used to generate these data as providing an interpretable description of
|
| 157 |
+
|
| 158 |
+

|
| 159 |
+
Figure 1: A) Synthetic neural data generation (left to right). Trajectories from the Arneodo system are projected onto random encoding vectors to compute activations at each timepoint. A scaled sigmoid nonlinearity is applied to convert the activations into firing rates. B) Zero-padded latent dynamics (green) are reversibly warped into higher-dimensional neural activity space (blue). C) The Flow readout maps from latent space to neural space by applying a sequence of $K$ small updates (parameterized by an MLP, bottom). Reverse pass maps from neural space to latent space and is implemented by serial subtraction of updates from the same MLP.
|
| 160 |
+
|
| 161 |
+
142 the latent system and its relation to the neural activity. Additional detail on data generation, models,
|
| 162 |
+
143 and metrics can be found in the Supplementary Material.
|
| 163 |
+
144 We generated activations for $N$ neurons $N = 1 2$ ) by projecting the simulated latent trajectories $\mathbf { Z }$
|
| 164 |
+
145 through a $3 \times N$ matrix whose columns were random encoding vectors with elements sampled from a
|
| 165 |
+
146 uniform distribution $U [ - 0 . 5 , 0 . 5 ]$ (Fig. 1A, left). We standardized these activations to have zero mean
|
| 166 |
+
147 and unit variance and applied a different scaled sigmoid function to each neuron, yielding a matrix of
|
| 167 |
+
148 non-negative time-varying firing rates $\mathbf { Y }$ . The scaling of each sigmoid function was evenly spaced on
|
| 168 |
+
149 a logarithmic scale between $1 0 ^ { \overline { { 0 . 2 } } }$ and 10. This process created a diverse set of activation functions
|
| 169 |
+
150 ranging from quasi-linear to nearly step-function-like behavior (Fig. 1A, Activation Functions).
|
| 170 |
+
151 We simulated spiking activity $\mathbf { X }$ by sampling from inhomogeneous Poisson processes with time
|
| 171 |
+
152 varying rate parameters equal to the firing rate $\mathbf { Y }$ of the simulated neurons (Fig. 1A, right). We
|
| 172 |
+
153 randomly split 70-point segments of these trials into training and validation datasets (training and
|
| 173 |
+
154 validation proportions were 0.8 and 0.2, respectively).
|
| 174 |
+
|
| 175 |
+
# 3.2 Biological Neural Data
|
| 176 |
+
|
| 177 |
+
We evaluated how well our model could reconstruct biological neural activity on a well-characterized dataset [38] included in the Neural Latents Benchmark (NLB) [27]. This dataset is composed of single-unit recordings from primary and pre-motor cortices of a monkey performing a visually-guided reaching task with obstacles, referred to as the Maze task. Trials were trimmed to the window [-250, 350] ms relative to movement onset, and spiking activity was binned at $2 0 ~ \mathrm { m s }$ . To compare the reconstruction performance of our model directly against the benchmark, we split the neural activity into held-in and held-out neurons, comprising 137 and 35 neurons, respectively, using the same sets of neurons as were used to assess models for the NLB leaderboard.
|
| 178 |
+
|
| 179 |
+
# 3.3 Model Architecture
|
| 180 |
+
|
| 181 |
+
We used three sequential autoencoder (SAE) variants in this study, with the main difference being the choice of readout module, ${ \hat { g } } ( \cdot )$ . In brief, a sequence of binned spike counts $\mathbf { x } _ { \mathrm { 1 : } T }$ was passed through a bidirectional GRU encoder, whose final hidden states were converted to an initial condition $\hat { \mathbf { z } } _ { 0 }$ via a mapping $\phi ( \cdot )$ . A modified NODE generator unrolled the initial condition into time-varying latent states $\hat { \mathbf { z } } _ { 1 : T }$ . These were subsequently mapped to inferred rates via the readout ${ \hat { g } } ( \cdot ) \in$ {Linear, MLP, Flow $\}$ . All models were trained for a fixed number of epochs to infer firing rates $\hat { \mathbf { y } } _ { 1 : T }$ that minimize the negative Poisson log-likelihood of the observed spikes $\mathbf { x } _ { 1 : T }$ .
|
| 182 |
+
|
| 183 |
+
$$
|
| 184 |
+
\begin{array} { r l } & { \mathbf { h } _ { T } = \left[ \mathbf { h } _ { f w d } \middle | \mathbf { h } _ { b w d } \right] = \mathrm { B i G R U } ( \mathbf { x } _ { 1 : T } ) } \\ & { \qquad \hat { \mathbf { z } } _ { 0 } = \phi ( \mathbf { h } _ { T } ) } \\ & { \qquad \hat { \mathbf { z } } _ { t + 1 } = \hat { \mathbf { z } } _ { t } + \boldsymbol { \alpha } \cdot \mathbf { M } \mathbf { L } \mathbf { P } ( \hat { \mathbf { z } } _ { t } ) } \\ & { \qquad \hat { \mathbf { y } } _ { t } = \exp \hat { g } ( \hat { \mathbf { z } } _ { t } ) } \end{array}
|
| 185 |
+
$$
|
| 186 |
+
|
| 187 |
+
172 For models with Linear and MLP readouts, $\phi ( \cdot )$ was a linear map to $\mathbb { R } ^ { \hat { D } }$ . For models with Flow
|
| 188 |
+
173 readouts, $\phi ( \cdot )$ was a linear map to $\mathbb { R } ^ { N }$ followed by the reverse pass of the Flow (see Section 3.3.1).
|
| 189 |
+
174 We unrolled the NODE using Euler’s method with a fixed step size equal to the bin width and trained
|
| 190 |
+
175 using standard backpropagation for efficiency. A scaling factor $( \alpha = 0 . 1$ ) was applied to the output
|
| 191 |
+
176 of the NODE’s MLP to stabilize the dynamics during early training. Readouts were implemented as
|
| 192 |
+
177 either a single linear layer (Linear), an MLP with two 150-unit ReLU hidden layers (MLP), or a Flow
|
| 193 |
+
178 readout (Flow) which contains an MLP with two 150-unit ReLU hidden layers. We refer to these
|
| 194 |
+
179 three models as Linear-NODE, MLP-NODE, and ODIN, respectively.
|
| 195 |
+
|
| 196 |
+
# 3.3.1 Flow Readout
|
| 197 |
+
|
| 198 |
+
181 The Flow readout resembles a simplified invertible ResNet [23]. Flow learns a vector field that can
|
| 199 |
+
182 reversibly transform data between latent and neural representations (Figure 1B). The Flow readout
|
| 200 |
+
183 has three steps: first, we increase the dimensionality of the latent activity $\mathbf { z } _ { t }$ to match that of the
|
| 201 |
+
184 neural activity by padding the latent state with zeros. This corresponds to an initial estimate of
|
| 202 |
+
185 the log-firing rates, $\log \hat { \mathbf { y } } _ { t , 0 }$ . Note that zero-padding makes our mapping injective rather than fully
|
| 203 |
+
186 invertible (see [33, 23]). The Flow network then uses an MLP to iteratively refine $\log \hat { \mathbf y } _ { t , k }$ over $K$
|
| 204 |
+
187 steps $K = 2 0$ ) after which we apply an exponential to produce the final firing rate predictions, $\hat { \mathbf { y } } _ { t }$ .
|
| 205 |
+
188 A scaling factor $( \beta = 0 . 1 $ ) was applied to the output of the Flow’s MLP to stabilize the dynamics
|
| 206 |
+
189 during early training.
|
| 207 |
+
|
| 208 |
+
$$
|
| 209 |
+
\begin{array} { c } { \log \hat { { \mathbf { y } } } _ { t , 0 } = [ \hat { { \mathbf { z } } } _ { t } | \mathbf { 0 } ] ^ { T } } \\ { \log \hat { { \mathbf { y } } } _ { t , k + 1 } = \log \hat { { \mathbf { y } } } _ { t , k } + \beta \cdot \operatorname { M L P } ( \log \hat { { \mathbf { y } } } _ { t , k } ) } \\ { \hat { g } \left( \hat { { \mathbf { z } } } _ { t } \right) = \log \hat { { \mathbf { y } } } _ { t , K } = \log \hat { { \mathbf { y } } } _ { t } } \end{array}
|
| 210 |
+
$$
|
| 211 |
+
|
| 212 |
+
190 We also use the approximate inverse of the Flow to transform the output of the encoders to initial
|
| 213 |
+
191 conditions in the latent space via $\phi ( \cdot )$ . We approximate the inverse using a simplified version of
|
| 214 |
+
192 the fixed-point iteration procedure described in [23]. Our method subtracts the output of the MLP
|
| 215 |
+
193 from the state rather than adding it as in the forward mode (Fig 1C). From here, we trim the excess
|
| 216 |
+
194 dimensions to recover $\hat { z } \in \mathbb { R } ^ { \hat { D } }$ (in effect, removing the zero-padding dimensions).
|
| 217 |
+
|
| 218 |
+
$$
|
| 219 |
+
\begin{array} { r l } & { \log \hat { \mathbf { y } } _ { t , k - 1 } = \log \hat { \mathbf { y } } _ { t , k } - \boldsymbol { \beta } \cdot \mathbf { M } \mathbf { L } \mathbf { P } ( \log \hat { \mathbf { y } } _ { t , k } ) } \\ & { \hat { \boldsymbol { g } } ^ { - 1 } \left( \log \hat { \mathbf { y } } _ { t } \right) = [ \log \hat { y } _ { t , 0 , 1 } , \dots , \log \hat { y } _ { t , 0 , \hat { D } } ] ^ { T } = \hat { \mathbf { z } } _ { t } } \end{array}
|
| 220 |
+
$$
|
| 221 |
+
|
| 222 |
+
195 The Flow mapping is only guaranteed to be injective if changes in the output of the MLP are
|
| 223 |
+
196 sufficiently small relative to changes in the input (i.e., Lipschitz constants for the MLP that is
|
| 224 |
+
197 strictly less than 1) [23]. The model can be made fully injective by either restricting the weights
|
| 225 |
+
198 of the MLP (e.g., spectral norm [39]), or using a variable step-size ODE solver that can prevent
|
| 226 |
+
199 crossing trajectories (e.g., continuous normalizing flows [19]. In practice, we found that using a
|
| 227 |
+
200 moderate number of steps allows Flow to preserve approximate injectivity of the readout at all tested
|
| 228 |
+
201 dimensionalities (Supp. Fig. 1).
|
| 229 |
+
|
| 230 |
+
# 3.4 Metrics and characterization of dynamics
|
| 231 |
+
|
| 232 |
+
203 All metrics were evaluated on validation data. Reconstruction performance for the synthetic data was
|
| 233 |
+
204 assessed using two key metrics. The first, spike negative log-likelihood (Spike NLL), was defined
|
| 234 |
+
205 as the Poisson NLL employed during model training. The second, Rate $\dot { R } ^ { \hat { 2 } }$ , was the coefficient of
|
| 235 |
+
206 determination between the inferred and true firing rates, averaged across neurons. We used Spike
|
| 236 |
+
207 NLL to assess how well the inferred rates explain the spiking activity, while Rate $R ^ { 2 }$ reflects the
|
| 237 |
+
208 model’s ability to find the true firing rates. These metrics quantify how well the model captures
|
| 238 |
+
209 the embedded system’s dynamics (i.e., that $\hat { f }$ captures the system described by $f$ ), but give no
|
| 239 |
+
210 indication of the interpretability of the learned latent representation (i.e., that the learned $\hat { f }$ is simple
|
| 240 |
+
211 and low-dimensional).
|
| 241 |
+
212 To assess the interpretability of the latent activity inferred by the model $\hat { z }$ , we used a previously
|
| 242 |
+
213 published metric called the State $R ^ { 2 }$ [15]. State $R ^ { 2 }$ is defined as the coefficient of determination $( R ^ { 2 } )$
|
| 243 |
+
214 of a linear regression from simulated latent trajectories $z$ to the inferred latent trajectories $\hat { z }$ . State $R ^ { 2 }$
|
| 244 |
+
215 will be low if the inferred latent trajectories contain features that cannot be explained by an affine
|
| 245 |
+
216 transformation of the true latent trajectories. We use this to assess the degree to which models can
|
| 246 |
+
217 preserve the simplicity and low dimensionality of the embedded dynamics, thereby maintaining an
|
| 247 |
+
218 interpretable latent representation. Together, high Rate $R ^ { 2 }$ and State $R ^ { 2 }$ indicate that the modeled
|
| 248 |
+
219 latent activity reflects the simulated latent dynamics without inventing extra features that make the
|
| 249 |
+
220 model harder to interpret (i.e., $\hat { z } \approx z$ ).
|
| 250 |
+
221 As a direct comparison of the estimated dynamics $\hat { f }$ to the simulated dynamics $f$ , we extracted
|
| 251 |
+
222 the fixed-point (FP) structure from our trained models and compared it to the FP structure of the
|
| 252 |
+
223 underlying system. We used previously published FP-finding techniques [40] to identify regions of
|
| 253 |
+
224 the generator’s dynamics where the magnitude of the vector field was close to zero, calling this set of
|
| 254 |
+
225 locations the putative FPs. We linearized the dynamics around the FPs and computed the eigenvalues
|
| 255 |
+
226 of the Jacobian of $\hat { f }$ to characterize each FP. Capturing FP location and character gives an indication
|
| 256 |
+
227 of how closely the estimated dynamics resemble the simulated dynamics (i.e., $\hat { f } \approx f .$ ).
|
| 257 |
+
228 To determine how well our embedding $\hat { g }$ captures the simulated embedding $g$ , we projected the
|
| 258 |
+
229 encoding vectors used to generate the synthetic neural activity from the ground-truth system into our
|
| 259 |
+
230 model’s latent space using the same affine transformation from ground-truth latent activity to inferred
|
| 260 |
+
231 latent activity as was used to compute State $R ^ { 2 }$ . We projected the inferred latent activity onto each
|
| 261 |
+
232 neuron’s affine-transformed encoding vector to find the predicted activation of each synthetic neuron.
|
| 262 |
+
233 We then related the predicted firing rates of each neuron to its corresponding activations to derive
|
| 263 |
+
234 an estimate of each neuron’s activation function. Because the inferred latent activity is arbitrarily
|
| 264 |
+
235 scaled/translated relative to the true latent activity, we fit an affine transformation from the predicted
|
| 265 |
+
236 activation function to the ground-truth activation function. The coefficient of determination $R ^ { 2 }$ of
|
| 266 |
+
237 this fit quantifies how well our models were able to recover the synthetic warping applied to each
|
| 267 |
+
238 neuron (i.e., $\hat { g } \approx g ,$ ).
|
| 268 |
+
39 For the biological neural data, we measured model performance using two metrics from the Neural
|
| 269 |
+
40 Latents Benchmark (NLB) [27], co-smoothing bits-per-spike (co-bps) and velocity decoding perfor
|
| 270 |
+
41 mance on predicted firing rates $( \mathrm { V e l } R ^ { 2 } )$ . co-bps quantifies how well the model predicts the spiking of
|
| 271 |
+
42 the held-out neurons, while Vel $R ^ { 2 }$ quantifies how well the denoised rates can predict the monkey’s
|
| 272 |
+
43 hand velocity during the reach. We compare these metrics to models from the NLB leaderboard. Of
|
| 273 |
+
44 note, models submitted to NLB are assessed by their performance on a hidden test set, while our
|
| 274 |
+
45 model performance is computed on the validation data.
|
| 275 |
+
|
| 276 |
+

|
| 277 |
+
Figure 2: Flow-NODE (ODIN) recovers latent activity more accurately than alternative models and is robust to overestimates of latent dimensionality. A) Diagram of model readouts tested, including Linear (green), Flow (red), MLP (orange). B) Inferred latent activity of representative model at each state dimensionality $\hat { D }$ . True latent activity (affine-transformed to overlay inferred latent activity) shown in light blue. C) All: Model metrics as a function of $\hat { D }$ . Shaded areas represent one standard deviation around the mean. Dashed vertical line indicates $\hat { D } = 3$ Top: Spike NLL, Middle: Rate $R ^ { 2 }$ , Bottom: State $R ^ { 2 }$ .
|
| 278 |
+
|
| 279 |
+
# 4 Results
|
| 280 |
+
|
| 281 |
+
# 4.1 Finding interpretable latent activity across state dimensionalities with ODIN
|
| 282 |
+
|
| 283 |
+
We began by training Linear-, MLP-, and Flow-NODEs (i.e., ODIN) (Fig 2A) to reconstruct synthetic neural activity from the Arneodo system [41] and compared reconstruction performance (i.e. Spike NLL and Rate $R ^ { 2 }$ ) and latent recovery (i.e. State $R ^ { 2 }$ ) as functions of the dimensionality $\hat { D }$ of the state space. We trained 5 different random seeds for each of the 3 model types and 5 state dimensionalities (75 total models, model hyperparameters in Supp. Table 1). First, we observed that the Linear-NODE learned latent states that did not closely resemble the simulated latent activity, with all tested dimensionalities performing worse than either the Flow or the MLP readout at $\hat { D } = \hat { 3 }$ (Fig 2B,C, mean State $R ^ { 2 } = 0 . { \dot { 7 } } 0$ for Linear vs. 0.89, 0.93 for MLP, Flow respectively). We also found that Linear-NODE required many more dimensions to reach the peak reconstruction performance (Fig 2C, Rate $R ^ { 2 }$ ). These results demonstrate that models that are unable to account for nonlinear embeddings are vulnerable to learning more complex and higher dimensional dynamics than those learned by models with nonlinear readouts.
|
| 284 |
+
|
| 285 |
+

|
| 286 |
+
Figure 3: Flow-NODE (ODIN) recovers fixed-point properties accurately at the correct dimensionality. A,B) Representative latent activity and fixed-points from the true (blue, ◦), ODIN (red, $\times )$ ), and Linear (green, $+$ ) systems. Each fixed point is labeled with reference to C. C) Plots of the real vs. imaginary part of the eigenvalues of the Jacobian evaluated at each fixed point. Unit circle in the complex plane (black curve) shows boundary between attractive and repulsive behavior (the attractive and repulsive sides of the boundary are indicated by inset).
|
| 287 |
+
|
| 288 |
+
Next, we compared ODIN to MLP-NODE and found that at the correct dimensionality $\hat { D } = 3 \AA$ ), these models had similar performance for both reconstruction and latent recovery. However, we found that as the dimensionality increased beyond the true dimensionality $\hat { D } > 3 )$ , the latent recovery of the MLP-NODE degraded rapidly while ODIN’s latent recovery remained high $\mathrm { F i g 2 C }$ , as $\hat { D } > 3$ ). This result provides evidence that readouts that lack injectivity (like MLPs) tend to learn misleading latent activity that can make their representations less interpretable when the true dimensionality $\hat { D }$ is unknown.
|
| 289 |
+
|
| 290 |
+
# 4.2 Recovering fixed-point structure with ODIN
|
| 291 |
+
|
| 292 |
+
A common method to compare how well dynamics models capture the underlying dynamics from synthetic data is to examine the character and structure of the inferred fixed-points (FPs) to the FPs of the ground-truth system[15]. At a high-level, FPs enable a concise description of the dynamics in a small region of state-space around the FP, and can collectively provide a qualitative picture of the overall dynamical landscape. To obtain a set of candidate FPs, we searched the latent space for points at which the magnitude of the vector field $\| \hat { f } \|$ is minimized (as in [1, 40]). We computed the eigenvalues (λs) of the Jacobian of $\hat { f }$ at each FP location. The real and imaginary components of these eigenvalues identify each FP as attractive, repulsive, etc.
|
| 293 |
+
|
| 294 |
+
We found that 3D ODIN models and 3D Linear-NODEs were both able to recover three fixed-points that generally matched the location of the three fixed points of the Arneodo system (Fig 3A), However, while ODIN was also able to capture the eigenspectra of all three FPs (Fig. 3B, red $\times ,$ ), the LinearNODE failed to capture the rotational dynamics of the central FP (Fig 3B, middle column, green $+$ ). 280 Both models were able to approximately recover the eigenspectra of outermost FPs of the system 281 (Fig. 3B, left, right columns). We found that the MLP-NODE was also able to find FPs with similar 282 accuracy to ODIN at 3D. These results show that the inability to model the nonlinear embedding can 283 lead to impoverished estimates of the underlying dynamics $\hat { f }$ .
|
| 295 |
+
|
| 296 |
+
# 4.3 Recovering simulated activation functions with ODIN
|
| 297 |
+
|
| 298 |
+
While obtaining interpretable dynamics is our primary goal, models that allow unsupervised recovery of the embedding geometry may provide additional insight about the computations performed by the neural system [42, 7]. For this section, we considered a representative model from each readout class with the correct number of latent dimensions $\simeq 3$ ). We performed an affine transformation from the ground truth encoding vectors into the modeled latent space and computed the projection of the modeled latent activity onto the affine-transformed encoding vectors (Fig 4A). From this projection, we derived an estimate of the activation function for each neuron, and compared this estimate to the ground-truth activation function.
|
| 299 |
+
|
| 300 |
+
We found, as expected, that the linear readout was unable to approximate the sigmoidal activation function of individual neurons (Fig 4B, green). On the other hand, both ODIN and MLP-NODE were able to capture activation functions ranging from nearly linear to step function-like in nature (Fig 4B, red, orange). Across all simulated neurons, we found that ODIN more accurately estimated the activation function of individual neurons compared to both Linear- and MLP-NODEs (Fig 4C), suggesting that the injectivity of the Flow readout allows more accurate estimation of nonlinear embeddings.
|
| 301 |
+
|
| 302 |
+
# 4.4 Modeling motor cortical activity with ODIN
|
| 303 |
+
|
| 304 |
+
To validate ODIN’s ability to fit neural activity from a biological neural circuit, we applied ODIN to the Maze dataset from the Neural Latents Benchmark, composed of recordings from the motor and pre-motor cortices of a monkey performing a reaching task (Fig. 5A). After performing hyperparameter sweeps across regularization parameters and network size (Supp. Table 2), we trained a set of ODIN and Linear-NODE models to reconstruct the neural activity with a range of state dimensionalities $\hat { D }$ . We visualized the top 3 PCs of the condition-averaged latent trajectories and predicted single-neuron firing rates for example models
|
| 305 |
+
|
| 306 |
+

|
| 307 |
+
Figure 4: Flow-NODE (ODIN) can recover nonlinear activation functions of neurons. A) True encoding vectors (numbered lines over true latent activity (blue)) were affine-transformed into a representative model’s latent space. B) Inferred activation function for two example neurons (columns), color coded by readout type (Linear $=$ green, ${ \bf M L P = }$ orange, Flow $=$ red, True $=$ black). Plots show the predicted firing rate vs. the activation of the selected neuron. C) Comparison of the $R ^ { 2 }$ values of the fits from B across model types. Left: Flow vs. MLP. Right: Flow vs. Linear
|
| 308 |
+
|
| 309 |
+
from each readout type. We found no visually obvious differences in the inferred latent trajectories 2 (Fig. 5B), but when we computed condition-averaged peri-stimulus time histograms (PSTHs) of 23 single neuron firing rates, we found that ODIN typically produced firing rate estimates that more 24 closely resembled the empirical PSTHs than those from the Linear-NODE (Fig. 5C).
|
| 310 |
+
|
| 311 |
+
325 Without access to a ground truth dynamics $f$ and embedding $g$ that generated these biological data, the
|
| 312 |
+
326 dimensionality required to reconstruct the neural activity was our primary measure of interpretability.
|
| 313 |
+
327 We computed co-bps –a measure of reconstruction performance on held-out neurons– for each model
|
| 314 |
+
328 and found that 10D ODIN models substantially outperformed Linear-NODE models, even when the
|
| 315 |
+
329 Linear-NODE had more than twice as many dimensions (10D ODIN: 0.333, vs 25D Linear: 0.287).
|
| 316 |
+
330 This suggests that ODIN’s injective non-linear readout is effective at reducing the required latent
|
| 317 |
+
331 state dimensionality to capture the data relative to a simple linear readout.
|
| 318 |
+
332 We also compared ODIN to other models on the NLB leaderboard for this dataset [27, 43]. The best
|
| 319 |
+
333 reported AutoLFADS model (a RNN-based variational SAE with $\hat { D } = 1 0 0 \mathrm { \Omega }$ ) had only modestly higher
|
| 320 |
+
334 co-bps than the 10D ODIN (0.333 vs 0.355) [44]. These results suggest that ODIN is effective at
|
| 321 |
+
335 reducing the required dimensionality for neural reconstruction, which may provide more interpretable
|
| 322 |
+
336 latent representations than alternative models.
|
| 323 |
+
|
| 324 |
+

|
| 325 |
+
Figure 5: ODIN can reconstruct cortical activity with low-dimensional dynamics A) Top: Schematic of task [38] Bottom: example hand trajectories and condition-averaged firing rates aligned to move onset. B) Example condition-averaged latent activity from ODIN and Linear-NODE models applied to neural activity recorded during the Maze task. C) Example single-neuron peri-stimulus time histograms for ODIN and Linear-NODE models across conditions. D) Effects of latent state dimensionality $\hat { D }$ on reconstruction (top, co-bps) and decoding (bottom, Vel $R ^ { 2 }$ ) performance. Plot shows mean (point) and standard deviation (shading) of 5 randomly initialized models at each $\hat { D }$ . Horizontal lines represent NLB performance by AutoLFADS (black) and GFPA (grey) [27].
|
| 326 |
+
|
| 327 |
+
# 5 Discussion
|
| 328 |
+
|
| 329 |
+
Dynamics models have had great success in reproducing neural activity patterns and relating brain activity to behavior [45, 27, 46]. However, it has been difficult to use these models to investigate neural computation directly. If neural population models could be trusted to find interpretable representations of latent dynamics, then recent techniques that can uncover computation in artificial networks could help to explain computations in the brain [1, 40, 47]. In this work, we created a new model called ODIN that can overcome major barriers to learning interpretable latent dynamical systems. By combining Neural ODE generators and approximately injective nonlinear readouts, ODIN offers significant advantages over the prior state-of-the-art, including lower latent dimensionality, simpler latent activity that is robust to the choice of latent dimensionality, and the ability to model arbitrary nonlinear activation functions.
|
| 330 |
+
|
| 331 |
+
348 Circuits in the brain are densely interconnected, and so a primary limitation of this work is that
|
| 332 |
+
349 ODIN is not yet able to account for inputs to the system that may be coming from areas that are not
|
| 333 |
+
350 directly modeled. Thus ODIN is currently only able to model the dynamics of a given population of
|
| 334 |
+
351 neurons as an autonomous system. Inferring inputs is difficult due to ambiguity in the role of inputs
|
| 335 |
+
352 compared to internal dynamics for driving the state of the system. While some RNN-based models
|
| 336 |
+
353 have methods for input inference [45], more work is needed to develop solutions for NODE-based
|
| 337 |
+
354 models. Injective readouts are an important step towards addressing the fundamental difficulties of
|
| 338 |
+
355 input inference, as models without injective readouts can be incentivized to imagine latent features
|
| 339 |
+
356 that are actually the result of inputs.
|
| 340 |
+
357 Interpretable dynamics derived from neural population recordings could answer critical scientific
|
| 341 |
+
358 questions about the brain and help improve brain-machine interface technology. A potential negative
|
| 342 |
+
359 consequence is that human neural interfaces combined with an understanding of neural computation
|
| 343 |
+
360 might make it possible and profitable to develop strategies that are effective at influencing behavior.
|
| 344 |
+
361 Future researchers should focus on applications of this research that are scientific and medical rather
|
| 345 |
+
362 than commercial or political.
|
| 346 |
+
363 References
|
| 347 |
+
364 [1] David Sussillo and Omri Barak. Opening the black box: low-dimensional dynamics in high
|
| 348 |
+
365 dimensional recurrent neural networks. Neural Computation, 25(3):626–649, March 2013.
|
| 349 |
+
366 ISSN 1530-888X. doi: 10.1162/NECO_a_00409.
|
| 350 |
+
367 [2] Valerio Mante, David Sussillo, Krishna Shenoy, and William Newsome. Context-dependent
|
| 351 |
+
368 computation by recurrent dynamics in prefrontal cortex. Nature, 503:78–84, November 2013.
|
| 352 |
+
369 doi: 10.1038/nature12742.
|
| 353 |
+
370 [3] Evan D. Remington, Devika Narain, Eghbal A. Hosseini, and Mehrdad Jazayeri. Flexible
|
| 354 |
+
371 Sensorimotor Computations through Rapid Reconfiguration of Cortical Dynamics. Neuron, 98
|
| 355 |
+
372 (5):1005–1019.e5, June 2018. ISSN 1097-4199. doi: 10.1016/j.neuron.2018.05.020.
|
| 356 |
+
73 [4] Niru Maheswaranathan, Alex Williams, Matthew Golub, Surya Ganguli, and David Sus
|
| 357 |
+
374 sillo. Reverse engineering recurrent networks for sentiment classification reveals line at
|
| 358 |
+
375 tractor dynamics. In Advances in Neural Information Processing Systems, volume 32. Cur
|
| 359 |
+
376 ran Associates, Inc., 2019. URL https://proceedings.neurips.cc/paper/2019/hash/
|
| 360 |
+
377 d921c3c762b1522c475ac8fc0811bb0f-Abstract.html.
|
| 361 |
+
378 [5] Saurabh Vyas, Matthew D. Golub, David Sussillo, and Krishna V. Shenoy. Computation
|
| 362 |
+
379 Through Neural Population Dynamics. Annual Review of Neuroscience, 43(1):249–275,
|
| 363 |
+
380 2020. doi: 10.1146/annurev-neuro-092619-094115. URL https://doi.org/10.1146/
|
| 364 |
+
381 annurev-neuro-092619-094115. _eprint: https://doi.org/10.1146/annurev-neuro-092619-
|
| 365 |
+
382 094115.
|
| 366 |
+
383 [6] Krishna V. Shenoy, Maneesh Sahani, and Mark M. Churchland. Cortical control of arm
|
| 367 |
+
384 movements: a dynamical systems perspective. Annual Review of Neuroscience, 36:337–359,
|
| 368 |
+
385 July 2013. ISSN 1545-4126. doi: 10.1146/annurev-neuro-062111-150509.
|
| 369 |
+
386 [7] Mehrdad Jazayeri and Srdjan Ostojic. Interpreting neural computations by examining intrinsic
|
| 370 |
+
387 and embedding dimensionality of neural activity. Technical Report arXiv:2107.04084, arXiv,
|
| 371 |
+
388 August 2021. URL http://arxiv.org/abs/2107.04084. arXiv:2107.04084 [q-bio] type:
|
| 372 |
+
389 article.
|
| 373 |
+
390 [8] Ian H. Stevenson and Konrad P. Kording. How advances in neural recording affect data analysis.
|
| 374 |
+
391 Nature Neuroscience, 14(2):139–142, February 2011. ISSN 1546-1726. doi: 10.1038/nn.2731.
|
| 375 |
+
392 [9] Nicholas A Steinmetz, Cagatay Aydin, Anna Lebedeva, Michael Okun, Marius Pachitariu,
|
| 376 |
+
393 Marius Bauza, Maxime Beau, Jai Bhagat, Claudia Böhm, Martijn Broux, Susu Chen, Jennifer
|
| 377 |
+
394 Colonell, Richard J Gardner, Bill Karsh, Fabian Kloosterman, Dimitar Kostadinov, Carolina
|
| 378 |
+
395 Mora-Lopez, John O’Callaghan, Junchol Park, Jan Putzeys, Britton Sauerbrei, Rik J J van
|
| 379 |
+
396 Daal, Abraham Z Vollan, Shiwei Wang, Marleen Welkenhuysen, Zhiwen Ye, Joshua T Dudman,
|
| 380 |
+
397 Barundeb Dutta, Adam W Hantman, Kenneth D Harris, Albert K Lee, Edvard I Moser, John
|
| 381 |
+
398 O’Keefe, Alfonso Renart, Karel Svoboda, Michael Häusser, Sebastian Haesler, Matteo Caran
|
| 382 |
+
399 dini, and Timothy D Harris. Neuropixels 2.0: A miniaturized high-density probe for stable,
|
| 383 |
+
400 long-term brain recordings. Science, 372(6539), April 2021.
|
| 384 |
+
401 [10] Jeffrey Demas, Jason Manley, Frank Tejera, Kevin Barber, Hyewon Kim, Francisca Martínez
|
| 385 |
+
402 Traub, Brandon Chen, and Alipasha Vaziri. High-speed, cortex-wide volumetric recording
|
| 386 |
+
403 of neuroactivity at cellular resolution using light beads microscopy. Nature Methods, 18(9):
|
| 387 |
+
404 1103–1111, September 2021. ISSN 1548-7105. doi: 10.1038/s41592-021-01239-8. URL
|
| 388 |
+
405 https://www.nature.com/articles/s41592-021-01239-8. Number: 9 Publisher: Na
|
| 389 |
+
406 ture Publishing Group.
|
| 390 |
+
407 [11] Peiran Gao and Surya Ganguli. On simplicity and complexity in the brave new world of
|
| 391 |
+
408 large-scale neuroscience. Current Opinion in Neurobiology, 32:148–155, June 2015. ISSN
|
| 392 |
+
409 0959-4388. doi: 10.1016/J.CONB.2015.04.003. URL https://www.sciencedirect.com/
|
| 393 |
+
10 science/article/pii/S0959438815000768. Publisher: Elsevier Current Trends.
|
| 394 |
+
11 [12] Lea Duncker and Maneesh Sahani. Dynamics on the manifold: Identifying computational
|
| 395 |
+
12 dynamical activity from neural population recordings. Current Opinion in Neurobiology, 70:
|
| 396 |
+
413 163–170, October 2021. ISSN 0959-4388. doi: 10.1016/j.conb.2021.10.014. URL https:
|
| 397 |
+
14 //www.sciencedirect.com/science/article/pii/S0959438821001264.
|
| 398 |
+
|
| 399 |
+
[13] David Sussillo, Rafal Jozefowicz, L. F. Abbott, and Chethan Pandarinath. LFADS - Latent Factor Analysis via Dynamical Systems. Technical Report arXiv:1608.06315, arXiv, August 2016. URL http://arxiv.org/abs/1608.06315. arXiv:1608.06315 [cs, q-bio, stat] type: article.
|
| 400 |
+
[14] Marine Schimel, Ta-Chu Kao, Kristopher T. Jensen, and Guillaume Hennequin. iLQR-VAE : control-based learning of input-driven dynamics with applications to neural data. Technical report, bioRxiv, October 2021. URL https://www.biorxiv.org/content/10.1101/2021. 10.07.463540v1. Section: New Results Type: article.
|
| 401 |
+
[15] Andrew R. Sedler, Christopher Versteeg, and Chethan Pandarinath. Expressive architectures enhance interpretability of dynamics-based neural population models, February 2023. URL http://arxiv.org/abs/2212.03771. arXiv:2212.03771 [cs, q-bio].
|
| 402 |
+
[16] Yuanjun Gao, Evan Archer, Liam Paninski, and John P. Cunningham. Linear dynamical neural population models through nonlinear embeddings. Technical Report arXiv:1605.08454, arXiv, October 2016. URL http://arxiv.org/abs/1605.08454. arXiv:1605.08454 [q-bio, stat] type: article.
|
| 403 |
+
[17] Anqi Wu, Nicholas A. Roy, Stephen Keeley, and Jonathan W Pillow. Gaussian process based nonlinear latent structure discovery in multivariate spike train data. In Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017. URL https://papers.nips.cc/paper_files/paper/2017/hash/ b3b4d2dbedc99fe843fd3dedb02f086f-Abstract.html.
|
| 404 |
+
[18] Yuan Zhao and Il Memming Park. Variational Online Learning of Neural Dynamics. Frontiers in Computational Neuroscience, 14, 2020. ISSN 1662-5188. URL https://www.frontiersin. org/article/10.3389/fncom.2020.00071.
|
| 405 |
+
[19] Ricky T. Q. Chen, Yulia Rubanova, Jesse Bettencourt, and David Duvenaud. Neural Ordinary Differential Equations. Technical Report arXiv:1806.07366, arXiv, December 2019. URL http://arxiv.org/abs/1806.07366. arXiv:1806.07366 [cs, stat] type: article.
|
| 406 |
+
[20] Laurent Dinh, David Krueger, and Yoshua Bengio. Nice: Non-linear independent components estimation. arXiv preprint arXiv:1410.8516, 2014.
|
| 407 |
+
[21] Durk P Kingma and Prafulla Dhariwal. Glow: Generative flow with invertible 1x1 convolutions. Advances in neural information processing systems, 31, 2018.
|
| 408 |
+
[22] Lynton Ardizzone, Jakob Kruse, Sebastian Wirkert, Daniel Rahner, Eric W. Pellegrini, Ralf S. Klessen, Lena Maier-Hein, Carsten Rother, and Ullrich Köthe. Analyzing Inverse Problems with Invertible Neural Networks. Technical Report arXiv:1808.04730, arXiv, February 2019. URL http://arxiv.org/abs/1808.04730. arXiv:1808.04730 [cs, stat] type: article.
|
| 409 |
+
[23] Jens Behrmann, Will Grathwohl, Ricky T. Q. Chen, David Duvenaud, and Joern-Henrik Jacobsen. Invertible Residual Networks. In Proceedings of the 36th International Conference on Machine Learning, pages 573–582. PMLR, May 2019. URL https://proceedings.mlr. press/v97/behrmann19a.html. ISSN: 2640-3498.
|
| 410 |
+
[24] Jakob H Macke, Lars Buesing, John P Cunningham, Byron M Yu, Krishna V Shenoy, and Maneesh Sahani. Empirical models of spiking in neural populations. In Advances in Neural Information Processing Systems, volume 24. Curran Associates, Inc., 2011. URL https://papers. nips.cc/paper/2011/hash/7143d7fbadfa4693b9eec507d9d37443-Abstract.html.
|
| 411 |
+
[25] Evan Archer, Il Memming Park, Lars Buesing, John Cunningham, and Liam Paninski. Black box variational inference for state space models, November 2015. URL http://arxiv.org/ abs/1511.07367. arXiv:1511.07367 [stat].
|
| 412 |
+
[26] David Pfau, Eftychios A Pnevmatikakis, and Liam Paninski. Robust learning of low-dimensional dynamics from large neural ensembles. In Advances in Neural Information Processing Systems, volume 26. Curran Associates, Inc., 2013. URL https://papers.nips.cc/paper_files/ paper/2013/hash/47a658229eb2368a99f1d032c8848542-Abstract.html.
|
| 413 |
+
|
| 414 |
+
464 [27] Felix Pei, Joel Ye, David Zoltowski, Anqi Wu, Raeed H. Chowdhury, Hansem Sohn, Joseph E.
|
| 415 |
+
465 O’Doherty, Krishna V. Shenoy, Matthew T. Kaufman, Mark Churchland, Mehrdad Jazayeri,
|
| 416 |
+
466 Lee E. Miller, Jonathan Pillow, Il Memming Park, Eva L. Dyer, and Chethan Pandarinath.
|
| 417 |
+
467 Neural Latents Benchmark ’21: Evaluating latent variable models of neural population activity.
|
| 418 |
+
468 Technical Report arXiv:2109.04463, arXiv, January 2022. URL http://arxiv.org/abs/
|
| 419 |
+
469 2109.04463. arXiv:2109.04463 [cs, q-bio] type: article.
|
| 420 |
+
470 [28] Timothy D Kim, Thomas Z Luo, Jonathan W Pillow, and Carlos Brody. Inferring latent
|
| 421 |
+
471 dynamics underlying neural population activity via neural differential equations. In International
|
| 422 |
+
472 Conference on Machine Learning, pages 5551–5561. PMLR, 2021.
|
| 423 |
+
473 [29] Matthew J. Johnson, David Duvenaud, Alexander B. Wiltschko, Sandeep R. Datta, and Ryan P.
|
| 424 |
+
474 Adams. Composing graphical models with neural networks for structured representations and
|
| 425 |
+
475 fast inference, July 2017. URL http://arxiv.org/abs/1603.06277. arXiv:1603.06277
|
| 426 |
+
476 [stat].
|
| 427 |
+
477 [30] Ian H. Stevenson. Flexible models for spike count data with both over- and under- dispersion.
|
| 428 |
+
478 Journal of Computational Neuroscience, 41(1):29–43, August 2016. ISSN 1573-6873. doi:
|
| 429 |
+
479 10.1007/s10827-016-0603-y. URL https://doi.org/10.1007/s10827-016-0603-y.
|
| 430 |
+
480 [31] Steven L Brunton, Joshua L Proctor, and J Nathan Kutz. Discovering governing equations
|
| 431 |
+
481 from data by sparse identification of nonlinear dynamical systems. Proceedings of the national
|
| 432 |
+
482 academy of sciences, 113(15):3932–3937, 2016.
|
| 433 |
+
483 [32] Steffen Schneider, Jin Hwa Lee, and Mackenzie Weygandt Mathis. Learnable latent embeddings
|
| 434 |
+
484 for joint behavioural and neural analysis. Nature, 617(7960):360–368, May 2023. ISSN 1476-
|
| 435 |
+
485 4687. doi: 10.1038/s41586-023-06031-6. URL https://www.nature.com/articles/
|
| 436 |
+
486 s41586-023-06031-6. Number: 7960 Publisher: Nature Publishing Group.
|
| 437 |
+
487 [33] Ding Zhou and Xue-Xin Wei. Learning identifiable and interpretable latent models of high
|
| 438 |
+
488 dimensional neural activity using pi-VAE, November 2020. URL http://arxiv.org/abs/
|
| 439 |
+
489 2011.04798. arXiv:2011.04798 [cs, q-bio, stat].
|
| 440 |
+
490 [34] Mohammad Bashiri, Edgar Walker, Konstantin-Klemens Lurz, Akshay Jagadish, Taliah
|
| 441 |
+
491 Muhammad, Zhiwei Ding, Zhuokun Ding, Andreas Tolias, and Fabian Sinz. A flow-based
|
| 442 |
+
492 latent state generative model of neural population responses to natural images. In Ad
|
| 443 |
+
493 vances in Neural Information Processing Systems, volume 34, pages 15801–15815. Cur
|
| 444 |
+
494 ran Associates, Inc., 2021. URL https://proceedings.neurips.cc/paper/2021/hash/
|
| 445 |
+
495 84a529a92de322be42dd3365afd54f91-Abstract.html.
|
| 446 |
+
496 [35] Jimmy T. H. Smith, Scott W. Linderman, and David Sussillo. Reverse engineering recur
|
| 447 |
+
497 rent neural networks with Jacobian switching linear dynamical systems. Technical Report
|
| 448 |
+
498 arXiv:2111.01256, arXiv, November 2021. URL http://arxiv.org/abs/2111.01256.
|
| 449 |
+
499 arXiv:2111.01256 [cs] type: article.
|
| 450 |
+
500 [36] Cole Hurwitz, Akash Srivastava, Kai Xu, Justin Jude, Matthew Perich, Lee Miller,
|
| 451 |
+
501 and Matthias Hennig. Targeted Neural Dynamical Modeling. In Advances in Neu
|
| 452 |
+
502 ral Information Processing Systems, volume 34, pages 29379–29392. Curran Asso
|
| 453 |
+
503 ciates, Inc., 2021. URL https://papers.nips.cc/paper_files/paper/2021/hash/
|
| 454 |
+
504 f5cfbc876972bd0d031c8abc37344c28-Abstract.html.
|
| 455 |
+
505 [37] Kristopher Jensen, Ta-Chu Kao, Jasmine Stone, and Guillaume Hennequin. Scalable
|
| 456 |
+
506 Bayesian GPFA with automatic relevance determination and discrete noise models. In Ad
|
| 457 |
+
507 vances in Neural Information Processing Systems, volume 34, pages 10613–10626. Cur
|
| 458 |
+
508 ran Associates, Inc., 2021. URL https://proceedings.neurips.cc/paper/2021/hash/
|
| 459 |
+
509 58238e9ae2dd305d79c2ebc8c1883422-Abstract.html.
|
| 460 |
+
510 [38] Mark M. Churchland, John P. Cunningham, Matthew T. Kaufman, Stephen I. Ryu, and Krishna V.
|
| 461 |
+
511 Shenoy. Cortical preparatory activity: representation of movement or first cog in a dynamical
|
| 462 |
+
512 machine? Neuron, 68(3):387–400, November 2010. ISSN 1097-4199. doi: 10.1016/j.neuron.
|
| 463 |
+
513 2010.09.015.
|
| 464 |
+
514 [39] Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral Normaliza
|
| 465 |
+
515 tion for Generative Adversarial Networks, February 2018. URL http://arxiv.org/abs/
|
| 466 |
+
516 1802.05957. arXiv:1802.05957 [cs, stat].
|
| 467 |
+
517 [40] Matthew D. Golub and David Sussillo. Fixedpointfinder: A tensorflow toolbox for identifying
|
| 468 |
+
518 and characterizing fixed points in recurrent neural networks. Journal of Open Source Software,
|
| 469 |
+
519 3(31):1003, 2018. doi: 10.21105/joss.01003. URL https://doi.org/10.21105/joss.
|
| 470 |
+
520 01003.
|
| 471 |
+
521 [41] A Arneodo, P Coullet, and C Tresser. Occurence of strange attractors in three-dimensional
|
| 472 |
+
522 Volterra equations. Physics Letters A, 79(4):259–263, October 1980. ISSN 0375-9601.
|
| 473 |
+
523 doi: 10.1016/0375-9601(80)90342-4. URL https://www.sciencedirect.com/science/
|
| 474 |
+
524 article/pii/0375960180903424.
|
| 475 |
+
525 [42] Richard J. Gardner, Erik Hermansen, Marius Pachitariu, Yoram Burak, Nils A. Baas, Ben
|
| 476 |
+
526 jamin A. Dunn, May-Britt Moser, and Edvard I. Moser. Toroidal topology of population activity
|
| 477 |
+
527 in grid cells. Technical report, bioRxiv, February 2021. URL https://www.biorxiv.org/
|
| 478 |
+
528 content/10.1101/2021.02.25.432776v1. Section: New Results Type: article.
|
| 479 |
+
529 [43] EvalAI: Neural Latents Benchmark ’21 - MC Maze 20ms. URL https://eval.ai/web/
|
| 480 |
+
530 challenges/challenge-page/1256/leaderboard/3183.
|
| 481 |
+
531 [44] Mohammad Reza Keshtkaran, Andrew R. Sedler, Raeed H. Chowdhury, Raghav Tandon,
|
| 482 |
+
532 Diya Basrai, Sarah L. Nguyen, Hansem Sohn, Mehrdad Jazayeri, Lee E. Miller, and Chethan
|
| 483 |
+
533 Pandarinath. A large-scale neural network training framework for generalized estimation
|
| 484 |
+
534 of single-trial population dynamics. Nature Methods, 19(12):1572–1577, December 2022.
|
| 485 |
+
535 ISSN 1548-7105. doi: 10.1038/s41592-022-01675-0. URL https://www.nature.com/
|
| 486 |
+
536 articles/s41592-022-01675-0. Number: 12 Publisher: Nature Publishing Group.
|
| 487 |
+
537 [45] Chethan Pandarinath, Daniel J. O’Shea, Jasmine Collins, Rafal Jozefowicz, Sergey D. Stavisky,
|
| 488 |
+
538 Jonathan C. Kao, Eric M. Trautmann, Matthew T. Kaufman, Stephen I. Ryu, Leigh R. Hochberg,
|
| 489 |
+
539 Jaimie M. Henderson, Krishna V. Shenoy, L. F. Abbott, and David Sussillo. Inferring single-trial
|
| 490 |
+
540 neural population dynamics using sequential auto-encoders. Nature Methods, 15(10):805–815,
|
| 491 |
+
541 October 2018. ISSN 1548-7105. doi: 10.1038/s41592-018-0109-9. URL https://www.
|
| 492 |
+
542 nature.com/articles/s41592-018-0109-9. Number: 10 Publisher: Nature Publishing
|
| 493 |
+
543 Group.
|
| 494 |
+
544 [46] Jimmy T. H. Smith, Andrew Warrington, and Scott W. Linderman. Simplified State Space
|
| 495 |
+
545 Layers for Sequence Modeling, March 2023. URL http://arxiv.org/abs/2208.04933.
|
| 496 |
+
546 arXiv:2208.04933 [cs].
|
| 497 |
+
547 [47] Laura Driscoll, Krishna Shenoy, and David Sussillo. Flexible multitask computation in recur
|
| 498 |
+
548 rent networks utilizes shared dynamical motifs, August 2022. URL https://www.biorxiv.
|
| 499 |
+
549 org/content/10.1101/2022.08.15.503870v1. Pages: 2022.08.15.503870 Section: New
|
| 500 |
+
550 Results.
|
| 501 |
+
|
| 502 |
+
1. For all authors...
|
| 503 |
+
|
| 504 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? Yes, we ensured that the abstract was supported by the main body of the article
|
| 505 |
+
(b) Did you describe the limitations of your work? Yes, we included a section in the discussion where we describe where our work is currently limited, and offer suggestions for ways to extend the work to address these limitations
|
| 506 |
+
(c) Did you discuss any potential negative societal impacts of your work? We’ve included a short description of how this work might adversely impact societal health in the Broader Impacts section
|
| 507 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? Yes, we’ve read the ethical review guidelines and confirmed that our paper meets their standards
|
| 508 |
+
|
| 509 |
+
2. If you are including theoretical results...
|
| 510 |
+
|
| 511 |
+
(a) Did you state the full set of assumptions of all theoretical results? (b) Did you include complete proofs of all theoretical results?
|
| 512 |
+
|
| 513 |
+
3. If you ran experiments...
|
| 514 |
+
|
| 515 |
+
(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)? We plan to include these components in the supplementary pdf for final submission
|
| 516 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? We’ve included these details, split between the main text and the supplement, depending on their relative importance
|
| 517 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? Yes, we’ve included error bars on relevant plots
|
| 518 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? Yes, we’ve included the details of our internal cluster in the supplementary materials
|
| 519 |
+
|
| 520 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 521 |
+
|
| 522 |
+
(a) If your work uses existing assets, did you cite the creators? Yes, we credit these assets in the supplementary materials
|
| 523 |
+
(b) Did you mention the license of the assets? We plan to include the license of each asset in the supplement
|
| 524 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? Yes, we plan to include our code and data-generation in the final submission
|
| 525 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating?
|
| 526 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content?
|
| 527 |
+
|
| 528 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 529 |
+
|
| 530 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable?
|
| 531 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable?
|
| 532 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation?
|
md/dev/K2OixmPDou3/K2OixmPDou3.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/K3BMejPSyQ/K3BMejPSyQ.md
ADDED
|
@@ -0,0 +1,546 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Two-timescale Derivative Free Optimization for Performative Prediction with Markovian Data
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
This paper studies the performative prediction problem where a learner aims to minimize the expected loss with a decision-dependent data distribution. Such setting is motivated when outcomes can be affected by the prediction model, e.g., in strategic classification. We consider a state-dependent setting where the data distribution evolves according to an underlying controlled Markov chain. We focus on stochastic derivative free optimization (DFO) where the learner is given access to a loss function evaluation oracle with the above Markovian data. We propose a two-timescale $\mathrm { D F O } ( \lambda )$ algorithm that features (i) a sample accumulation mechanism that utilizes every observed sample to estimate the overall gradient of performative risk, and (ii) a two-timescale diminishing step size that balances the rates of DFO updates and bias reduction. Under a general non-convex optimization setting, we show that $\mathrm { D F O } ( \lambda )$ requires $\mathcal { O } ( 1 / \epsilon ^ { 3 } )$ samples (up to a log factor) to attain a near-stationary solution with expected squared gradient norm less than $\epsilon > 0$ . Numerical experiments verify our analysis.
|
| 11 |
+
|
| 12 |
+
# 15 1 Introduction
|
| 13 |
+
|
| 14 |
+
16 Consider the following stochastic optimization problem with decision-dependent data:
|
| 15 |
+
|
| 16 |
+
$$
|
| 17 |
+
\operatorname* { m i n } _ { \pmb { \theta } \in \mathbb { R } ^ { d } } \mathcal { L } ( \pmb { \theta } ) = \mathbb { E } _ { Z \sim \Pi _ { \pmb { \theta } } } \big [ \ell ( \pmb { \theta } ; Z ) \big ] .
|
| 18 |
+
$$
|
| 19 |
+
|
| 20 |
+
17 Notice that the decision variable $\pmb \theta$ appears in both the loss function $\ell ( \pmb \theta ; Z )$ and the data distribution
|
| 21 |
+
18 $\Pi _ { \theta }$ supported on Z. The overall loss function $\mathcal { L } ( \pmb \theta )$ is known as the performative risk which captures
|
| 22 |
+
19 the distributional shift due to changes in the deployed model. This setting is motivated by the
|
| 23 |
+
20 recent studies on performative prediction (Perdomo et al., 2020), which considers outcomes that are
|
| 24 |
+
21 supported by the deployed model $\pmb \theta$ under training. For example, this models strategic classification
|
| 25 |
+
22 (Hardt et al., 2016; Dong et al., 2018) in economical and financial practices such as with the training
|
| 26 |
+
23 of loan classifier for customers who may react to the deployed model $\pmb { \theta }$ to maximize their gains; or
|
| 27 |
+
24 in price promotion mechanism (Zhang et al., 2018) where customers react to prices with the aim of
|
| 28 |
+
25 gaining a lower price; or in ride sharing business (Narang et al., 2022) with customers who adjust
|
| 29 |
+
26 their demand according to prices set by the platform.
|
| 30 |
+
27 The objective function $\mathcal { L } ( \pmb { \theta } )$ is non-convex in general due to the effects of $\pmb \theta$ on both the loss function
|
| 31 |
+
28 and distribution. Numerous efforts have been focused on characterizing and finding the so-called
|
| 32 |
+
29 performative stable solution which is a fixed point to the repeated risk minimization (RRM) process
|
| 33 |
+
30 (Perdomo et al., 2020; Mendler-Dunner et al. ¨ , 2020; Brown et al., 2022; Li & Wai, 2022; Roy et al.,
|
| 34 |
+
31 2022; Drusvyatskiy & Xiao, 2022). While RRM might be a natural algorithm for scenarios when the
|
| 35 |
+
32 learner is agnostic to the performative effects in the dynamic data distribution, the obtained solution
|
| 36 |
+
33 maybe far from being optimal or stationary to (1).
|
| 37 |
+
34 On the other hand, recent works have studied performative optimal solutions that minimizes (1). This
|
| 38 |
+
35 is challenging due to the non-convexity of $\mathcal { L } ( \pmb { \theta } )$ and more importantly, the absence of knowledge
|
| 39 |
+
36 of $\Pi _ { \theta }$ . In fact, evaluating $\nabla { \mathcal { L } } ( \theta )$ or its stochastic gradient estimate would require learning the
|
| 40 |
+
37 distribution $\Pi _ { \theta }$ a-priori (Izzo et al., 2021). To design a tractable procedure, prior works have assumed
|
| 41 |
+
38 structures for (1) such as approximating $\Pi _ { \theta }$ by Gaussian mixture (Izzo et al., 2021), $\Pi _ { \theta }$ depends
|
| 42 |
+
39 linearly on $\pmb \theta$ (Narang et al., 2022), etc., combined with a two-phase algorithm that separately learns
|
| 43 |
+
40 $\Pi _ { \theta }$ and optimizes $\pmb { \theta }$ . Other works have assumed a mixture dominance structure (Miller et al., 2021)
|
| 44 |
+
41 on the combined effect of $\Pi _ { \theta }$ and $\ell ( \cdot )$ on $\mathcal { L } ( \pmb \theta )$ , which in turn implies that $\mathcal { L } ( \pmb { \theta } )$ is convex. Based on
|
| 45 |
+
42 this assumption, a derivative free optimization (DFO) algorithm was analyzed in Ray et al. (2022).
|
| 46 |
+
43 This paper focuses on approximating the performa
|
| 47 |
+
44 tive optimal solution without relying on additional
|
| 48 |
+
45 condition on the distribution $\Pi _ { \theta }$ and/or using a two
|
| 49 |
+
46 phase algorithm. We concentrate on stochastic DFO
|
| 50 |
+
47 algorithms (Ghadimi & Lan, 2013) which do not in
|
| 51 |
+
48 volve first order information (i.e., gradient) about
|
| 52 |
+
49 $\mathcal { L } ( \pmb \theta )$ . As an advantage, these algorithms avoid the
|
| 53 |
+
50 need for estimating $\Pi _ { \theta }$ . Instead, the learner is given
|
| 54 |
+
51 access to the loss function evaluation oracle $\ell ( { \bar { \pmb { \theta } } } ; Z )$
|
| 55 |
+
52 and receive data samples from a controlled Markov
|
| 56 |
+
53 chain. Note that the latter models the stateful and
|
| 57 |
+
54 strategic agent setting considered in (Ray et al., 2022;
|
| 58 |
+
55 Roy et al., 2022; Li & Wai, 2022; Brown et al., 2022).
|
| 59 |
+
|
| 60 |
+
<table><tr><td>Stochastic DFO Settings</td><td>Rate</td></tr><tr><td>Decision-indep.</td><td>0(1/²2)</td></tr><tr><td>(Ghadimi & Lan, 2013)</td><td></td></tr><tr><td>Decision-depend. (Markov) O(1/ε)</td><td></td></tr></table>
|
| 61 |
+
|
| 62 |
+
Table 1: Comparison of the expected convergence rates (to find an $\epsilon$ -stationary point) for DFO under various settings where DFO is used to tackle an unstructured non-convex optimization problem such as (1).
|
| 63 |
+
|
| 64 |
+
Such setting is motivated when the actual data distribution adapts slowly to the decision model, which will be announced by the learner during the (stochastic) optimization process.
|
| 65 |
+
|
| 66 |
+
58 The proposed DFO $( \lambda )$ algorithm features (i) a two-timescale step sizes design to control the bias
|
| 67 |
+
59 variance tradeoff in the derivative-free gradient estimates, and (ii) a sample accumulation mechanism
|
| 68 |
+
60 with forgetting factor $\lambda$ that aggregates every observed samples to control the amount of error in
|
| 69 |
+
61 gradient estimates. In addition to the new algorithm design, our main findings are summarized below:
|
| 70 |
+
|
| 71 |
+
• Under the Markovian data setting, we show in Theorem 3.1 that the DFO $( \lambda )$ algorithm finds a nearstationary solution $\bar { \pmb { \theta } }$ with $\mathbb { E } [ \lVert \nabla \mathcal { L } ( \bar { \pmb { \theta } } ) \rVert ^ { 2 } ] \le \epsilon$ using $\textstyle { \mathcal { O } } ( { \frac { d ^ { 2 } } { \epsilon ^ { 3 } } } \log 1 / \epsilon )$ samples/iterations. Compared to prior works, our analysis does not require structural assumption on the distribution $\Pi _ { \theta }$ or convexity condition on the performative risk (Izzo et al., 2021; Miller et al., 2021; Ray et al., 2022).
|
| 72 |
+
|
| 73 |
+
• Our analysis demonstrates the trade-off induced by the forgetting factor $\lambda$ in the DFO $( \lambda )$ algorithm. We identify the desiderata for the optimal value(s) of $\lambda$ . We show that increasing $\lambda$ allows to reduce the number of samples requited by the algorithm if the performative risk gradient has a small Lipschitz constant.
|
| 74 |
+
|
| 75 |
+
0 For the rest of this paper, $\ S$ describes the problem setup and the DFO $( \lambda )$ algorithm, $\ S$ presents the main results, $\ S$ outlines the proofs. Finally, we provide numerical results to verify our findings in $\ S 5$ .
|
| 76 |
+
|
| 77 |
+
72 Finally, as displayed in Table 1, we remark that stochastic DFO under decision dependent (and
|
| 78 |
+
73 Markovian) samples has a convergence rate of $\mathcal { O } ( 1 / \epsilon ^ { 3 } )$ towards an $\epsilon$ -stationary point, which is worse
|
| 79 |
+
74 than the decision independent setting that has $\mathcal { O } ( 1 / \epsilon ^ { 2 } )$ in Ghadimi & Lan (2013). We believe that
|
| 80 |
+
75 this is a fundamental limit for DFO-type algorithms when tackling problems with decision-dependent
|
| 81 |
+
76 sample due to the challenges in designing a low variance gradient estimator; see $\ S$ .
|
| 82 |
+
77 Related Works. The idea of DFO dates back to Nemirovski˘ı (1983), and has been extensively studied
|
| 83 |
+
78 thereafter Flaxman et al. (2005); Agarwal et al. (2010); Nesterov & Spokoiny (2017); Ghadimi &
|
| 84 |
+
79 Lan (2013). Results on matching lower bound were established in (Jamieson et al., 2012). While a
|
| 85 |
+
80 similar DFO framework is adopted in the current paper for performative prediction, our algorithm is
|
| 86 |
+
81 limited to using a special design in the gradient estimator to avoid introducing unwanted biases.
|
| 87 |
+
82 There are only a few works considering the Markovian data setting in performative prediction. Brown
|
| 88 |
+
83 et al. (2022) is the first paper to study the dynamic settings, where the response of agents to learner’s
|
| 89 |
+
84 deployed classifier is modeled as a function of classifier and the current distribution of the population;
|
| 90 |
+
85 also see (Izzo et al., 2022). On the other hand, Li & Wai (2022); Roy et al. (2022) model the
|
| 91 |
+
86 unforgetful nature and the reliance on past experiences of single/batch agent(s) via controlled Markov
|
| 92 |
+
87 Chain. Lastly, Ray et al. (2022) investigated the state-dependent framework where agents’ response
|
| 93 |
+
88 may be driven to best response at a geometric rate.
|
| 94 |
+
|
| 95 |
+
1: Input: Constants $\delta _ { 0 } , \eta _ { 0 } , \tau _ { 0 } , \alpha , \beta$ , maximum epochs $T$ , forgetting factor $\lambda$ , loss function $\bar { \ell \left( \cdot ; \cdot \right) }$ .
|
| 96 |
+
2: Initialization: Set initial $\pmb { \theta } _ { 0 }$ and sample $Z _ { 0 }$ .
|
| 97 |
+
3: for $k = 0$ to $T - 1$ do
|
| 98 |
+
4: $\delta _ { k } \gets \delta _ { 0 } / ( 1 + k ) ^ { \beta }$ , $\eta _ { k } \eta _ { 0 } / ( 1 + k ) ^ { \alpha } .$ , $\tau _ { k } \gets \operatorname* { m a x } \{ 1 , \tau _ { 0 } \log ( 1 + k ) \}$
|
| 99 |
+
5: Update ) ← θk, Z(0k $Z _ { k } ^ { ( 0 ) } \gets Z _ { k }$ , ${ \pmb u } _ { k } \sim \mathrm { U n i f } ( \mathbb { S } ^ { { \mathsf { d } } - 1 } )$
|
| 100 |
+
6: for $m = 1 , 2 , \cdots , \tau _ { k } { \bf d }$ o
|
| 101 |
+
7: Deploy the model $\check { \pmb { \theta } } _ { k } ^ { ( m ) } = \pmb { \theta } _ { k } ^ { ( m ) } + \delta _ { k } \pmb { u } _ { k }$
|
| 102 |
+
|
| 103 |
+
Draw $Z _ { k } ^ { ( m ) } \sim \mathbb { T } _ { \check { \pmb { \theta } } _ { k } ^ { ( m ) } } ( Z _ { k } ^ { ( m - 1 ) } , \cdot )$
|
| 104 |
+
|
| 105 |
+
9: Update $\theta _ { k } ^ { ( m ) }$ as
|
| 106 |
+
|
| 107 |
+
$$
|
| 108 |
+
\begin{array} { r l } & { \pmb { g } _ { k } ^ { ( m ) } = \frac { d } { \delta _ { k } } \ell \big ( \check { \pmb { \theta } } _ { k } ^ { ( m ) } ; Z _ { k } ^ { ( m ) } \big ) \pmb { u } _ { k } , } \\ & { \pmb { \theta } _ { k } ^ { ( m + 1 ) } = \pmb { \theta } _ { k } ^ { ( m ) } - \eta _ { k } \lambda ^ { \tau _ { k } - m } \pmb { g } _ { k } ^ { ( m ) } . } \end{array}
|
| 109 |
+
$$
|
| 110 |
+
|
| 111 |
+
10: end for
|
| 112 |
+
|
| 113 |
+
11: $Z _ { k + 1 } \gets Z _ { k } ^ { ( \tau _ { k } ) }$ , $\pmb { \theta } _ { k + 1 } \pmb { \theta } _ { k } ^ { ( \tau _ { k } + 1 ) }$
|
| 114 |
+
|
| 115 |
+
12: end for
|
| 116 |
+
|
| 117 |
+
Output: Last iterate $\pmb { \theta } _ { T }$
|
| 118 |
+
|
| 119 |
+
89 Notations: Let $\mathbb { R } ^ { d }$ be the $d$ -dimensional Euclidean space equipped with inner product $\langle \cdot , \cdot \rangle$ and
|
| 120 |
+
90 induced norm $\| x \| = { \sqrt { \langle x , x \rangle } }$ . Let $s$ be a (measurable) sample space, and $\mu , \nu$ are two probability
|
| 121 |
+
91 measures defined on $s$ . Then, we use $\delta _ { \mathrm { T V } } \left( \mu , \nu \right) : = \operatorname* { s u p } _ { A \subset { \mathcal { S } } } \mu ( A ) - \nu ( A )$ to denote the total variation
|
| 122 |
+
92 distance between $\mu$ and $\nu$ . Denote $\mathbb { T } _ { \theta } ( \cdot , \cdot )$ ⊂S as the state-dependent Markov kernel and its stationary
|
| 123 |
+
93 distribution is $\Pi _ { \theta } ( \cdot )$ . Let $\mathbb { B } ^ { d }$ and $\mathbb { S } ^ { d - 1 }$ be the unit ball and its boundary (i.e., a unit sphere) centered
|
| 124 |
+
94 around the origin in $d$ -dimensional Euclidean space, respectively, and correspondingly, the ball and
|
| 125 |
+
95 sphere of radius r > 0 are rBd and rSd−1.
|
| 126 |
+
|
| 127 |
+
# 96 2 Problem Setup and Algorithm Design
|
| 128 |
+
|
| 129 |
+
97 In this section, we develop the DFO $( \lambda )$ algorithm for tackling (1) and describe the problem setup.
|
| 130 |
+
98 Assume that $\mathcal { L } ( \pmb { \theta } )$ is differentiable, we focus on finding an $\epsilon$ -stationary solution, $\pmb { \theta }$ , which satisfies
|
| 131 |
+
|
| 132 |
+
$$
|
| 133 |
+
\| \nabla \mathcal { L } ( \pmb { \theta } ) \| ^ { 2 } \leq \epsilon .
|
| 134 |
+
$$
|
| 135 |
+
|
| 136 |
+
99 With the goal of reaching (2), there are two key challenges in our stochastic algorithm design:
|
| 137 |
+
100 (i) to estimate the gradient $\nabla { \mathcal { L } } ( \theta )$ , and (ii) to handle the stateful setting where one cannot draw
|
| 138 |
+
101 samples directly from the distribution $\Pi _ { \theta }$ . We shall discuss how the proposed DFO $( \lambda )$ algorithm,
|
| 139 |
+
102 which is summarized in Algorithm 1, tackles the above issues through utilizing two ingredients: (a)
|
| 140 |
+
103 two-timescales step sizes, and (b) sample accumulation with the forgetting factor $\lambda \in [ 0 , 1 )$ .
|
| 141 |
+
|
| 142 |
+
Estimating $\nabla { \mathcal { L } } ( \theta )$ via Two-timescales DFO. First notice that the gradient of $\mathcal { L } ( \cdot )$ can be derived a
|
| 143 |
+
|
| 144 |
+
$$
|
| 145 |
+
\nabla \mathcal { L } ( \pmb { \theta } ) = \mathbb { E } _ { Z \sim \Pi _ { \pmb { \theta } } } [ \nabla \ell ( \pmb { \theta } ; Z ) + \ell ( \pmb { \theta } ; Z ) \nabla _ { \pmb { \theta } } \log \Pi _ { \pmb { \theta } } ( Z ) ] ,
|
| 146 |
+
$$
|
| 147 |
+
|
| 148 |
+
105 As a result, constructing the stochastic estimates of $\nabla { \mathcal { L } } ( \theta )$ typically requires knowledge of $\Pi _ { \pmb \theta } ( \cdot )$
|
| 149 |
+
106 which may not be known a-priori unless a separate estimation procedure is applied; see e.g., (Izzo
|
| 150 |
+
107 et al., 2021). To avoid the need for direct evaluations of $\nabla _ { \pmb { \theta } } \log \Pi _ { \pmb { \theta } } ( Z )$ , we consider an alternative
|
| 151 |
+
108 design via zero-th order optimization (Ghadimi & Lan, 2013). The intuition comes from observing
|
| 152 |
+
109 that with $\delta 0 ^ { + }$ , $\mathcal { L } ( \pmb { \theta } + \mathbf { \bar { \delta } } \mathbf { u } ) - \mathcal { L } ( \pmb { \theta } )$ is an approximate of the directional derivative of $\mathcal { L }$ along $\textbf { \em u }$
|
| 153 |
+
110 This suggests that an estimate for $\nabla { \mathcal { L } } ( \theta )$ can be constructed using the objective function values of
|
| 154 |
+
111 $\ell ( \pmb \theta ; Z )$ only.
|
| 155 |
+
112 Inspired by the above, we aim to construct a gradient estimate by querying $\ell ( \cdot )$ at randomly perturbed
|
| 156 |
+
113 points. Formally, given the current iterate $\pmb \theta \in \mathbb { R } ^ { d }$ and a query radius $\delta > 0$ , we sample a vector
|
| 157 |
+
114 $\mathbf { \bar { \boldsymbol { u } } } \in \mathbb { R } ^ { d }$ uniformly from $\mathbb { S } ^ { d - 1 }$ . The zero-th order gradient estimator for $\mathcal { L } ( \pmb { \theta } )$ is then defined as
|
| 158 |
+
|
| 159 |
+
$$
|
| 160 |
+
g _ { \delta } ( \pmb \theta ; \pmb u , Z ) : = \frac d \delta \ell ( \check { \pmb \theta } ; Z ) \pmb { u } \quad \mathrm { w i t h } \quad \check { \pmb \theta } : = \pmb \theta + \delta \pmb { u } , Z \sim \Pi _ { \check { \pmb \theta } } ( \cdot ) .
|
| 161 |
+
$$
|
| 162 |
+
|
| 163 |
+
115 In fact, as $\textbf { \em u }$ is zero-mean, $g _ { \delta } ( \pmb \theta ; \pmb u , Z )$ is an unbiased estimator for $\nabla { \mathcal { L } } _ { \delta } ( \pmb { \theta } )$ . Here, $\mathcal { L } _ { \delta } ( \pmb { \theta } )$ is a smooth
|
| 164 |
+
116 approximation of $\mathcal { L } ( \pmb { \theta } )$ (Flaxman et al., 2005; Nesterov & Spokoiny, 2017) defined as
|
| 165 |
+
|
| 166 |
+
$$
|
| 167 |
+
\begin{array} { r } { \mathcal { L } _ { \delta } ( \pmb { \theta } ) = \mathbb { E } _ { \pmb { u } } [ \mathcal { L } ( \pmb { \check { \theta } } ) ] = \mathbb { E } _ { \pmb { u } } [ \mathbb { E } _ { Z \sim \Pi _ { \check { \theta } } } [ \ell ( \pmb { \check { \theta } } ; Z ) ] ] . } \end{array}
|
| 168 |
+
$$
|
| 169 |
+
|
| 170 |
+
117 Furthermore, it is known that under mild condition [cf. Assumption 3.1 to be discussed later],
|
| 171 |
+
118 $\| \nabla \mathcal { L } _ { \delta } ( \pmb { \theta } ) - \nabla \mathcal { L } ( \pmb { \theta } ) \| = \mathcal { O } ( \delta )$ and thus (4) is an $\mathcal { O } ( \delta )$ -biased estimate for $\nabla { \mathcal { L } } ( \theta )$ .
|
| 172 |
+
119 We remark that the gradient estimator in (4) differs from the one used in classical works on DFO such
|
| 173 |
+
120 as (Ghadimi & Lan, 2013). The latter takes the form of $\begin{array} { r } { \frac { d } { \delta } ( \ell ( \check { \pmb { \theta } } ; Z ) - \ell ( \pmb { \theta } ; Z ) ) \mathbf { \delta } _ { \pmb { u } } } \end{array}$ . Under the setting
|
| 174 |
+
121 of standard stochastic optimization where the sample $Z$ is drawn independently of $\textbf { \em u }$ and Lipschitz
|
| 175 |
+
122 continuous $\ell ( \cdot ; Z )$ , the said estimator in (Ghadimi & Lan, 2013) is shown to have constant variance
|
| 176 |
+
123 while it remains $\dot { \mathcal { O } } ( \delta )$ -biased. Such properties cannot be transferred to (4) since $Z$ is drawn from a
|
| 177 |
+
124 distribution dependent on $\textbf { \em u }$ via $\check { \pmb { \theta } } = \pmb { \theta } + \delta \pmb { u }$ . In this case, the two-point gradient estimator would
|
| 178 |
+
125 become biased; see $\ S$ .
|
| 179 |
+
126 However, we note that the variance of (4) would increase as $\mathcal { O } ( 1 / \delta ^ { 2 } )$ when $\delta 0$ , thus the parameter
|
| 180 |
+
127 $\delta$ yields a bias-variance trade off in the estimator design. To remedy for the increase of variance, the
|
| 181 |
+
128 DFO $( \lambda )$ algorithm incorporates a two-timescale step size design for generating gradient estimates $( \delta _ { k } )$
|
| 182 |
+
129 and updating models $( \eta _ { k } )$ , respectively. Our design principle is such that the models are updated at a
|
| 183 |
+
130 slower timescale to adapt to the gradient estimator with $\hat { \mathcal { O } } ( 1 / \delta ^ { 2 } )$ variance. Particularly, we will set
|
| 184 |
+
131 $\eta _ { k + 1 } / \delta _ { k + 1 } \to 0$ to handle the bias-variance trade off, e.g., by setting $\alpha > \beta$ in line 4 of Algorithm 1.
|
| 185 |
+
132 Markovian Data and Sample Accumulation. We consider a setting where the sample/data distribu
|
| 186 |
+
133 tion observed by the DFO $( \lambda )$ algorithm evolves according to a controlled Markov chain (MC). Notice
|
| 187 |
+
134 that this describes a stateful agent(s) scenario such that the deployed models $\mathbf { \eta } ^ { ( \theta ) }$ would require time
|
| 188 |
+
135 to manifest their influence on the samples obtained; see (Li & Wai, 2022; Roy et al., 2022; Brown
|
| 189 |
+
136 et al., 2022; Ray et al., 2022; Izzo et al., 2022).
|
| 190 |
+
137 To describe the setting formally, we denote $\mathbb { T } _ { \pmb { \theta } } : \mathbb { Z } \times \mathcal { Z } \mathbb { R } _ { + }$ as a Markov kernel controlled by
|
| 191 |
+
138 a deployed model $\pmb { \theta }$ . For a given $\pmb \theta$ , the kernel has a unique stationary distribution $\Pi _ { \theta } ( \cdot )$ . Under
|
| 192 |
+
139 this setting, suppose that the previous state/sample is $Z$ , the next sample follows the distribution
|
| 193 |
+
140 $Z ^ { \prime } \sim \mathbb { T } _ { \pmb { \theta } } ( \bar { Z } , \cdot )$ which is not necessarily the same as $\Pi _ { \pmb \theta } ( \cdot )$ . As a consequence, the gradient estimator
|
| 194 |
+
141 (4) is not an unbiased estimator of $\nabla \dot { \mathcal { L } } _ { \delta } ( \pmb { \theta } )$ since $Z \sim \Pi _ { \tilde { \theta } } ( \cdot )$ cannot be conveniently accessed.
|
| 195 |
+
142 A common strategy in settling the above issue is to allow a burn-in phase in the algorithm as in (Ray
|
| 196 |
+
143 et al., 2022); also commonly found in MCMC methods (Robert et al., 1999). Using the fact that $\mathbb { T } _ { \theta }$
|
| 197 |
+
144 admits the stationary distribution $\Pi _ { \theta }$ , if one can wait a sufficiently long time before applying the
|
| 198 |
+
145 current sample, i.e., consider initializing with the previous sample $Z ^ { ( 0 ) } = Z$ , the procedure
|
| 199 |
+
|
| 200 |
+
$$
|
| 201 |
+
\begin{array} { r } { Z ^ { ( m ) } \sim \mathbb { T } _ { \pmb { \theta } } ( Z ^ { ( m - 1 ) } , \cdot ) , m = 1 , \dots , \tau , } \end{array}
|
| 202 |
+
$$
|
| 203 |
+
|
| 204 |
+
would yield a sample 6 $Z ^ { + } = Z ^ { ( \tau ) }$ that admits a distribution close to $\Pi _ { \theta }$ provided that $\tau \gg 1$ is 7 sufficiently large compared to the mixing time of $\mathbb { T } _ { \theta }$ .
|
| 205 |
+
|
| 206 |
+
148 Intuitively, the procedure (6) may be inefficient as a number of samples $Z ^ { ( 1 ) } , Z ^ { ( 2 ) } , \dots , Z ^ { ( \tau - 1 ) }$ will
|
| 207 |
+
149 be completely ignored at the end of each iteration. As a remedy, the DFO $( \lambda )$ algorithm incorporates
|
| 208 |
+
150 a sample accumulation mechanism which gathers the gradient estimates generated from possibly
|
| 209 |
+
151 non-stationary samples via a forgetting factor of $\lambda \in [ 0 , 1 )$ . Following (4), $\nabla { \mathcal { L } } ( \theta )$ is estimated by
|
| 210 |
+
|
| 211 |
+
$$
|
| 212 |
+
\begin{array} { r } { \pmb { g } = \frac { d } { \delta } \sum _ { m = 1 } ^ { \tau } \lambda ^ { \tau - m } \ell ( \pmb { \theta } ^ { ( m ) } + \delta \pmb { u } ; Z ^ { ( m ) } ) \pmb { u } , \mathrm { w i t h } Z ^ { ( m ) } \sim \mathbb { T } _ { \pmb { \theta } ^ { ( m ) } + \delta \pmb { u } } \big ( Z ^ { ( m - 1 ) } , \cdot \big ) . } \end{array}
|
| 213 |
+
$$
|
| 214 |
+
|
| 215 |
+
152 At a high level, the mechanism works by assigning large weights to samples that are close to the
|
| 216 |
+
153 end of an epoch (which are less biased). Moreover, $\bar { \pmb { \theta } } ^ { ( m ) }$ is simultaneously updated within the
|
| 217 |
+
154 epoch to obtain an online algorithm that gradually improves the objective value of (1). Note that
|
| 218 |
+
155 with $\lambda = 0$ , the DFO(0) algorithm reduces into one that utilizes burn-in (6). We remark that from
|
| 219 |
+
156 the implementation perspective for performative prediction, Algorithm 1 corresponds to a greedy
|
| 220 |
+
157 deployment scheme (Perdomo et al., 2020) as the latest model θ(m)k $\pmb { \theta } _ { k } ^ { ( m ) } + \delta _ { k } \pmb { u } _ { k }$ is deployed at every
|
| 221 |
+
158 sampling step. Line 6–10 of Algorithm 1 details the above procedure.
|
| 222 |
+
159 Lastly, we note that recent works have analyzed stochastic algorithms that rely on a single trajectory
|
| 223 |
+
160 of samples taken from a Markov Chain, e.g., (Sun et al., 2018; Karimi et al., 2019; Doan, 2022),
|
| 224 |
+
161 that are based on stochastic gradient. Sun & Li (2019) considered a DFO algorithm for general
|
| 225 |
+
162 optimization problems but the MC studied is not controlled by $\pmb \theta$ .
|
| 226 |
+
|
| 227 |
+
# 3 Main Results
|
| 228 |
+
|
| 229 |
+
64 This section studies the convergence of the DFO $( \lambda )$ algorithm and demonstrates that the latter finds
|
| 230 |
+
65 an $\epsilon$ -stationary solution [cf. (2)] to (1). We first state the assumptions required for our analysis:
|
| 231 |
+
|
| 232 |
+
166 Assumption 3.1. (Smoothness) $\mathcal { L } ( \pmb \theta )$ is differentiable, and there exists a constant $L > 0$ such that
|
| 233 |
+
|
| 234 |
+
$$
|
| 235 |
+
\| \nabla \mathcal { L } ( \pmb { \theta } ) - \nabla \mathcal { L } ( \pmb { \theta } ^ { \prime } ) \| \leq L \left\| \pmb { \theta } - \pmb { \theta } ^ { \prime } \right\| , \forall \pmb { \theta } , \pmb { \theta } ^ { \prime } \in \mathbb { R } ^ { d } .
|
| 236 |
+
$$
|
| 237 |
+
|
| 238 |
+
167 Assumption 3.2. (Bounded Loss) There exists a constant $G > 0$ such that
|
| 239 |
+
|
| 240 |
+
$$
|
| 241 |
+
\begin{array} { r } { | \ell ( \pmb \theta ; z ) | \leq G , \forall \pmb \theta \in \mathbb { R } ^ { d } , \forall z \in { \sf Z } . } \end{array}
|
| 242 |
+
$$
|
| 243 |
+
|
| 244 |
+
168 Assumption 3.3. (Lipschitz Distribution Map) There exists a constant $L _ { 1 } > 0$ such that
|
| 245 |
+
|
| 246 |
+
$$
|
| 247 |
+
\delta _ { \mathrm { T V } } \left( \Pi _ { \pmb { \theta } _ { 1 } } , \Pi _ { \pmb { \theta } _ { 2 } } \right) \leq L _ { 1 } \left. \pmb { \theta } _ { 1 } - \pmb { \theta } _ { 2 } \right. \ \quad \forall \pmb { \theta } _ { 1 } , \pmb { \theta } _ { 2 } \in \mathbb { R } ^ { d } .
|
| 248 |
+
$$
|
| 249 |
+
|
| 250 |
+
169 The conditions above state that the gradient of the performative risk is Lipschitz continuous and the
|
| 251 |
+
170 state-dependent distribution vary smoothly w.r.t. $\pmb \theta$ . Note that Assumption 3.1 is found in recent
|
| 252 |
+
171 works such as (Izzo et al., 2021; Ray et al., 2022), and Assumption 3.2 can be found in (Izzo et al.,
|
| 253 |
+
172 2021). Assumption 3.3 is slightly strengthened from the Wasserstein-1 distance bound in (Perdomo
|
| 254 |
+
173 et al., 2020), and it gives better control for distribution shift in our Markovian data setting.
|
| 255 |
+
|
| 256 |
+
Next, we consider the assumptions about the controlled Markov chain induced by $\mathbb { T } _ { \theta }$ :
|
| 257 |
+
|
| 258 |
+
175 Assumption 3.4. (Geometric Mixing) Let $\{ Z _ { k } \} _ { k \ge 0 }$ denote a Markov Chain on the state space Z
|
| 259 |
+
176 with transition kernel $\mathbb { T } _ { \theta }$ and stationary measure $\Pi _ { \theta }$ . There exist constants $\rho \in [ 0 , 1 )$ , $M \geq 0$ , such
|
| 260 |
+
177 that for any $k \geq 0 , z \in Z$ ,
|
| 261 |
+
|
| 262 |
+
$$
|
| 263 |
+
\begin{array} { r } { \delta _ { \mathrm { T V } } \left( \mathbb { P } _ { \pmb { \theta } } ( Z _ { k } \in \cdot | Z _ { 0 } = z ) , \Pi _ { \pmb { \theta } } \right) \le M \rho ^ { k } . } \end{array}
|
| 264 |
+
$$
|
| 265 |
+
|
| 266 |
+
178 Assumption 3.5. (Smoothness of Markov Kernel) There exists a constant $L _ { 2 } \geq 0$ such that
|
| 267 |
+
|
| 268 |
+
$$
|
| 269 |
+
\delta _ { \mathrm { T V } } \left( \mathbb { T } _ { \pmb { \theta } _ { 1 } } ( z , \cdot ) , \mathbb { T } _ { \pmb { \theta } _ { 2 } } ( z , \cdot ) \right) \leq L _ { 2 } \left\| \pmb { \theta } _ { 1 } - \pmb { \theta } _ { 2 } \right\| , \forall \pmb { \theta } _ { 1 } , \pmb { \theta } _ { 2 } \in \mathbb { R } ^ { d } , z \in \mathbb { Z } .
|
| 270 |
+
$$
|
| 271 |
+
|
| 272 |
+
179 Assumption 3.4 is a standard condition on the mixing time of the Markov chain induced by $\mathbb { T } _ { \theta }$ ;
|
| 273 |
+
180 Assumption 3.5 imposes a smoothness condition on the Markov transition kernel $\mathbb { T } _ { \theta }$ with respect to
|
| 274 |
+
181 $\pmb \theta$ . For instance, the geometric dynamically environment in Ray et al. (2022) constitutes a special
|
| 275 |
+
182 case which satisfies the above conditions.
|
| 276 |
+
183 Unlike (Ray et al., 2022; Izzo et al., 2021; Miller et al., 2021), we do not impose any additional
|
| 277 |
+
184 assumption (such as mixture dominance) other than Assumption 3.3 on $\Pi _ { \theta }$ . As a result, (1) remains
|
| 278 |
+
185 an ‘unstructured’ non-convex optimization problem. Our main theoretical result on the convergence
|
| 279 |
+
186 of the DFO $( \lambda )$ algorithm towards a near-stationary solution of (1) is summarized as:
|
| 280 |
+
|
| 281 |
+
Theorem 3.1. Suppose Assumptions 3.1-3.5 hold, step size sequence $\{ \eta _ { k } \} _ { k \ge 1 }$ , and query radius sequence $\{ \delta _ { k } \} _ { k \ge 1 }$ satisfy the following conditions,
|
| 282 |
+
|
| 283 |
+
$$
|
| 284 |
+
\begin{array} { l } { \eta _ { k } = d ^ { - 2 / 3 } \cdot ( 1 + k ) ^ { - 2 / 3 } , \quad \delta _ { k } = d ^ { 1 / 3 } \cdot ( 1 + k ) ^ { - 1 / 6 } , } \\ { \tau _ { k } = \operatorname* { m a x } \{ 1 , \displaystyle \frac { 2 } { \log { 1 / \operatorname* { m a x } \{ \rho , \lambda \} } } \log ( 1 + k ) \} \quad \forall k \geq 0 . } \end{array}
|
| 285 |
+
$$
|
| 286 |
+
|
| 287 |
+
187
|
| 288 |
+
|
| 289 |
+
Then, there exists constants $t _ { 0 } , c _ { 5 } , c _ { 6 } , c _ { 7 }$ , such that for any $T \geq t _ { 0 }$ , the iterates $\{ \pmb { \theta } _ { k } \} _ { k \ge 0 }$ generated by $D F O ( \lambda )$ satisfy the following inequality,
|
| 290 |
+
|
| 291 |
+
$$
|
| 292 |
+
\operatorname* { m i n } _ { 0 \leq k \leq T } \mathbb { E } \left\| \nabla \mathcal { L } ( \pmb { \theta } _ { k } ) \right\| ^ { 2 } \leq 1 2 \operatorname* { m a x } \left\{ c _ { 5 } ( 1 - \lambda ) , c _ { 6 } , \frac { c _ { 7 } } { 1 - \lambda } \right\} \frac { d ^ { 2 / 3 } } { ( T + 1 ) ^ { 1 / 3 } } .
|
| 293 |
+
$$
|
| 294 |
+
|
| 295 |
+
188 We have defined the following quantities and constants:
|
| 296 |
+
|
| 297 |
+
$$
|
| 298 |
+
c _ { 5 } = 2 G , \quad c _ { 6 } = \frac { \operatorname* { m a x } \{ L ^ { 2 } , G ^ { 2 } ( 1 - \beta ) \} } { 1 - 2 \beta } , \quad c _ { 7 } = \frac { L G ^ { 2 } } { 2 \beta - \alpha + 1 } ,
|
| 299 |
+
$$
|
| 300 |
+
|
| 301 |
+
189 with $\begin{array} { r } { \alpha = \frac { 2 } { 3 } , \beta = \frac { 1 } { 6 } } \end{array}$ . Observe the following corollary on the iteration complexity of DFO $( \lambda )$ algorithm:
|
| 302 |
+
190 Corollary 3.1. (ϵ-stationarity) Suppose that the Assumptions of Theorem 3.1 hold. Fix any $\epsilon > 0$ ,
|
| 303 |
+
191 the condition $\begin{array} { r } { \operatorname* { m i n } _ { 0 \leq k \leq T - 1 } \mathbb { E } \left\| \nabla \mathcal { L } ( \pmb { \theta } _ { k } ) \right\| ^ { 2 } \leq \epsilon } \end{array}$ holds whenever
|
| 304 |
+
|
| 305 |
+
$$
|
| 306 |
+
\begin{array} { r } { T \ge \left( 1 2 \operatorname* { m a x } \left\{ c _ { 5 } ( 1 - \lambda ) , c _ { 6 } , \frac { c _ { 7 } } { 1 - \lambda } \right\} \right) ^ { 3 } \frac { d ^ { 2 } } { \epsilon ^ { 3 } } . } \end{array}
|
| 307 |
+
$$
|
| 308 |
+
|
| 309 |
+
192 In the corollary above, the lower bound on $T$ is expressed in terms of the number of epochs that
|
| 310 |
+
193 Algorithm 1 needs to achieve the target accuracy. Consequently, the total number of samples required
|
| 311 |
+
194 (i.e., the number of inner iterations taken in Line 6–9 of Algorithm 1 across all epochs) is:
|
| 312 |
+
|
| 313 |
+
$$
|
| 314 |
+
\begin{array} { r } { \mathbf { S } _ { \epsilon } = \sum _ { k = 1 } ^ { T } \tau _ { k } = \mathcal { O } \left( \frac { d ^ { 2 } } { \epsilon ^ { 3 } } \log ( 1 / \epsilon ) \right) . } \end{array}
|
| 315 |
+
$$
|
| 316 |
+
|
| 317 |
+
195 We remark that due to the decision-dependent properties of the samples, the DFO $( \lambda )$ algorithm
|
| 318 |
+
196 exhibits a worse sampling complexity (12) than prior works in stochastic DFO algorithm, e.g.,
|
| 319 |
+
197 (Ghadimi & Lan, 2013) which shows a rate of $\mathcal { O } ( \bar { d } / \epsilon ^ { 2 } )$ on non-convex smooth objective functions.
|
| 320 |
+
198 In particular, the adopted one-point gradient estimator in (4) admits a variance that can only be
|
| 321 |
+
199 controlled by a time varying $\delta$ ; see the discussions in $\ S 4 . 1$ .
|
| 322 |
+
200 Achieving the desired convergence rate requires setting $\eta _ { k } = \Theta ( k ^ { - 2 / 3 } )$ , $\delta _ { k } = \Theta ( k ^ { - 1 / 6 } )$ , i.e.,
|
| 323 |
+
201 yielding a two-timescale step sizes design with $\eta _ { k } / \delta _ { k } \to 0$ . Notice that the influence of forgetting
|
| 324 |
+
202 factor $\lambda$ are reflected in the constant factor of (9). Particularly, if $c _ { 5 } > c _ { 7 }$ and $c _ { 5 } \geq c _ { 6 }$ , the optimal
|
| 325 |
+
203 choice is $\begin{array} { r } { \lambda = 1 - \sqrt { \frac { c _ { 7 } } { c _ { 5 } } } } \end{array}$ , otherwise the optimal choice is $\lambda \in [ 0 , 1 - c _ { 7 } / c _ { 6 } ]$ . Informally, this indicates
|
| 326 |
+
204 that when the performative risk is smoother (i.e. its gradient has a small Lipschitz constant), a large $\lambda$
|
| 327 |
+
205 can speed up the convergence of the algorithm; otherwise a smaller $\lambda$ is preferable.
|
| 328 |
+
|
| 329 |
+
# 206 4 Proof Outline of Main Results
|
| 330 |
+
|
| 331 |
+
This section outlines the key steps in proving Theorem 3.1. Notice that analyzing the DFO $( \lambda )$ algorithm is challenging due to the two-timescales step sizes and Markov chain samples with time varying kernel. Our analysis departs significantly from prior works such as (Ray et al., 2022; Izzo et al., 2021; Brown et al., 2022; Li & Wai, 2022) to handle the challenges above.
|
| 332 |
+
|
| 333 |
+
Let $\mathcal { F } ^ { k } = { \sigma } ( \theta _ { 0 } , Z _ { s } ^ { ( m ) } , u _ { s } , 0 \le s \le k , 0 \le m \le \tau _ { k } )$ be the filtration. Our first step is to exploit the smoothness of $\mathcal { L } ( \pmb \theta )$ to bound the squared norms of gradient. Observe that:
|
| 334 |
+
|
| 335 |
+
213 Lemma 4.1. (Decomposition) Under Assumption 3.1, it holds that
|
| 336 |
+
|
| 337 |
+
$$
|
| 338 |
+
\sum _ { k = 0 } ^ { t } \mathbb { E } \left. \nabla \mathcal { L } ( \pmb { \theta } _ { k } ) \right. ^ { 2 } \leq \mathbf { I } _ { 1 } ( t ) + \mathbf { I } _ { 2 } ( t ) + \mathbf { I } _ { 3 } ( t ) + \mathbf { I } _ { 4 } ( t ) ,
|
| 339 |
+
$$
|
| 340 |
+
|
| 341 |
+
214 for any $t \geq 1$ , where
|
| 342 |
+
|
| 343 |
+
$$
|
| 344 |
+
\begin{array} { r l } & { \mathbf { I } _ { 1 } ( t ) : = \sum _ { k = 1 } ^ { t } \frac { 1 - \lambda } { \eta _ { k } } \left( \mathbb { E } \left[ \mathcal { L } ( \pmb { \theta } _ { k } ) \right] - \mathbb { E } \left[ \mathcal { L } ( \pmb { \theta } _ { k + 1 } ) \right] \right) } \\ & { \mathbf { I } _ { 2 } ( t ) : = - \sum _ { k = 1 } ^ { t } \mathbb { E } \left. \nabla \mathcal { L } ( \pmb { \theta } _ { k } ) \big | ( 1 - \lambda ) \sum _ { m = 1 } ^ { \tau _ { k } } \lambda ^ { \tau _ { k } - m } \cdot \Big ( g _ { k } ^ { ( m ) } - \mathbb { E } _ { Z \sim \Pi _ { \tilde { \theta } _ { k } } } \left[ g _ { \delta _ { k } } ( \pmb { \theta } _ { k } ; \boldsymbol { u } _ { k } , Z ) \right] \Big ) \right. } \\ & { \mathbf { I } _ { 3 } ( t ) : = - \sum _ { k = 1 } ^ { t } \mathbb { E } \left. \nabla \mathcal { L } ( \pmb { \theta } _ { k } ) \big | ( 1 - \lambda ) \left( \sum _ { m = 1 } ^ { \tau _ { k } } \lambda ^ { \tau _ { k } - m } \nabla \mathcal { L } _ { \delta _ { k } } ( \pmb { \theta } _ { k } ) \right) - \nabla \mathcal { L } ( \pmb { \theta } _ { k } ) \right. } \\ & { \mathbf { I } _ { 4 } ( t ) : = \frac { L ( 1 - \lambda ) } { 2 } \sum _ { k = 1 } ^ { t } \eta _ { k } \mathbb { E } \left\| \sum _ { m = 1 } ^ { \tau _ { k } } \lambda ^ { \tau _ { k } - m } g _ { k } ^ { ( m ) } \right\| ^ { 2 } } \end{array}
|
| 345 |
+
$$
|
| 346 |
+
|
| 347 |
+
215 The lemma is achieved through the standard descent lemma implied by Assumption 3.1 and decom
|
| 348 |
+
216 posing the upper bound on $| | \mathbf { \check { V } } \mathcal { L } ( \pmb { \theta } _ { k } ) | | ^ { 2 }$ into respectful terms; see the proof in Appendix A. Among
|
| 349 |
+
217 the terms on the right hand side of (13), we note that ${ \bf I } _ { 1 } ( t ) , { \bf I } _ { 3 } ( t )$ and ${ \mathbf I } _ { 4 } ( t )$ arises directly from
|
| 350 |
+
218 Assumption 3.1, while ${ \bf I } _ { 2 } ( t )$ comes from bounding the noise terms due to Markovian data.
|
| 351 |
+
219 We bound the four components in Lemma 4.1 as follows. For simplicity, we denote $A ( t ) : =$
|
| 352 |
+
220 $\begin{array} { r } { \frac { 1 } { 1 + t } \sum _ { k = 0 } ^ { t } \mathbb { E } \left. \nabla \mathcal { L } ( \pmb { \theta } _ { k } ) \right. ^ { 2 } } \end{array}$ . Among the four terms, we highlight that the main challenge lies on
|
| 353 |
+
221 obtaining a tight bound for ${ \bf I } _ { 2 } ( t )$ . Observe that
|
| 354 |
+
|
| 355 |
+
$$
|
| 356 |
+
\mathbf { I } _ { 2 } ( t ) \leq ( 1 - \lambda ) \mathbb { E } \left[ \sum _ { k = 0 } ^ { t } \| \nabla \mathcal { L } ( \pmb { \theta } _ { k } ) \| \cdot \bigg \| \sum _ { m = 1 } ^ { \tau _ { k } } \lambda ^ { \tau _ { k } - m } \Delta _ { k , m } \bigg \| \right]
|
| 357 |
+
$$
|
| 358 |
+
|
| 359 |
+
222 where ${ \Delta _ { k , m } } { \stackrel { \mathrm { d e f } } { = } } \mathbb { E } _ { \mathcal { F } ^ { k - 1 } } [ { g _ { k } ^ { ( m ) } } - \mathbb { E } _ { Z \sim \Pi _ { \tilde { \theta } _ { k } } } g _ { k } ( \pmb { \theta } _ { k } ; \boldsymbol { u } _ { k } , Z ) ]$ . There are two sources of bias in $\Delta _ { k , m }$ : one is
|
| 360 |
+
223 the noise induced by drifting of decision variable in every epoch, the other is the bias that depends
|
| 361 |
+
224 on the mixing time of Markov kernel. To control these biases, we are inspired by the proof of $\mathrm { W u }$
|
| 362 |
+
225 et al., 2020, Theorem 4.7) to introduce a reference Markov chain $\tilde { Z } _ { k } ^ { ( \ell ) }$ , $\ell = 0 , . . . , \tau _ { k }$ , whose decision
|
| 363 |
+
variables remains fixed for a period of length 226 $\tau _ { k }$ and is initialized with $\tilde { Z } _ { k } ^ { ( 0 ) } = Z _ { k } ^ { ( 0 ) }$ :
|
| 364 |
+
|
| 365 |
+
$$
|
| 366 |
+
\tilde { Z } _ { k } ^ { ( 0 ) } \ \xrightarrow { \check { \theta } _ { k } } \ \tilde { Z } _ { k } ^ { ( 1 ) } \ \xrightarrow { \check { \theta } _ { k } } \ \tilde { Z } _ { k } ^ { ( 2 ) } \ \xrightarrow { \check { \theta } _ { k } } \ \tilde { Z } _ { k } ^ { ( 3 ) } \ \cdot \ \cdot \ \xrightarrow { \check { \theta } _ { k } } \ \tilde { Z } _ { k } ^ { ( \tau _ { k } ) }
|
| 367 |
+
$$
|
| 368 |
+
|
| 369 |
+
227 and we recall that the actual chain in the algorithm evolves as
|
| 370 |
+
|
| 371 |
+
$$
|
| 372 |
+
Z _ { k } ^ { ( 0 ) } \ { \xrightarrow { \breve { \theta } _ { k + 1 } ^ { ( 0 ) } } } Z _ { k } ^ { ( 1 ) } \ { \xrightarrow { \breve { \theta } _ { k + 1 } ^ { ( 1 ) } } } Z _ { k } ^ { ( 2 ) } \cdots { \xrightarrow { \breve { \theta } _ { k + 1 } ^ { ( \tau _ { k } - 1 ) } } } Z _ { k } ^ { ( \tau _ { k } ) } .
|
| 373 |
+
$$
|
| 374 |
+
|
| 375 |
+
228 With the help of the reference chain, we decompose $\Delta _ { k , m }$ into
|
| 376 |
+
|
| 377 |
+
$$
|
| 378 |
+
\begin{array} { r l } & { \Delta _ { k , m } = \mathbb { E } _ { \mathcal { F } ^ { k - 1 } } \left[ \frac { d } { \delta _ { k } } \left( \mathbb { E } [ \ell ( \tilde { \theta } _ { k } ^ { ( m ) } ; Z _ { k } ^ { ( m ) } ) | \tilde { \theta } _ { k } ^ { ( m ) } , Z _ { k } ^ { ( 0 ) } ] - \mathbb { E } _ { \tilde { Z } _ { k } ^ { ( m ) } } [ \ell ( \tilde { \theta } _ { k } ^ { ( m ) } ; \tilde { Z } _ { k } ^ { ( m ) } ) | \tilde { \theta } _ { k } ^ { ( m ) } , \tilde { Z } _ { k } ^ { ( 0 ) } ] \right) u _ { k } \right] } \\ & { \qquad + \mathbb { E } _ { \mathcal { F } ^ { k - 1 } } \left[ \frac { d } { \delta _ { k } } \left( \mathbb { E } _ { \tilde { Z } _ { k } ^ { ( m ) } } [ \ell ( \tilde { \theta } _ { k } ^ { ( m ) } ; \tilde { Z } _ { k } ^ { ( m ) } ) | \tilde { \theta } _ { k } ^ { ( m ) } , \tilde { Z } _ { k } ^ { ( 0 ) } ] - \mathbb { E } _ { Z \sim \Pi _ { \tilde { \theta } _ { k } } } [ \ell ( \tilde { \theta } _ { k } ^ { ( m ) } ; Z ) | \tilde { \theta } _ { k } ^ { ( m ) } ] \right) u _ { k } \right] } \\ & { \qquad + \mathbb { E } _ { \mathcal { F } ^ { k - 1 } } \frac { d } { \delta _ { k } } \mathbb { E } _ { Z \sim \Pi _ { \tilde { \theta } _ { k } } } \left[ \ell ( \tilde { \theta } _ { k } ^ { ( m ) } ; Z ) - \ell ( \tilde { \theta } _ { k } ; Z ) | \tilde { \theta } _ { k } ^ { ( m ) } , \tilde { \theta } _ { k } \right] u _ { k } : = A _ { 1 } + A _ { 2 } + A _ { 3 } } \end{array}
|
| 379 |
+
$$
|
| 380 |
+
|
| 381 |
+
229 We remark that $A _ { 1 }$ reflects the drift of (16) from initial sample $Z _ { k } ^ { ( 0 ) }$ driven by varying $\check { \pmb { \theta } } _ { k } ^ { ( m ) }$ , $A _ { 2 }$
|
| 382 |
+
230 captures the statistical discrepancy between above two Markov chains (16) and (15) at same step $m$ ,
|
| 383 |
+
231 and $A _ { 3 }$ captures the drifting gap between $\check { \pmb { \theta } } _ { k }$ and $\check { \pmb { \theta } } _ { k } ^ { ( m ) }$ . Applying Assumption 3.3, $A _ { 1 }$ and $A _ { 2 }$ can be
|
| 384 |
+
232 upper bounded with the smoothness and geometric mixing property of Markov kernel. In addition,
|
| 385 |
+
233 $A _ { 3 }$ can be upper bounded using Lipschitz condition on (stationary) distribution map $\Pi _ { \theta }$ . Finally, the
|
| 386 |
+
234 forgetting factor $\lambda$ helps to control $\lVert \check { \pmb { \theta } } _ { k } ^ { ( \cdot ) } - \check { \pmb { \theta } } _ { k } \rVert$ to be at the same order of a single update. Therefore,
|
| 387 |
+
235 $\| \Delta _ { k , m } \|$ can be controlled by an upper bound relying on $\lambda , \rho , L$ .
|
| 388 |
+
|
| 389 |
+
The following lemma summarizes the above results as well as the bounds on the other terms:
|
| 390 |
+
|
| 391 |
+
Lemma 4.2. Under Assumption 3.2, 3.3, 3.4 and 3.5, with $\eta _ { t + 1 } = \eta _ { 0 } ( 1 + t ) ^ { - \alpha }$ , $\delta _ { t + 1 } = \delta _ { 0 } ( 1 + t ) ^ { - \beta }$ and $\alpha \in ( 0 , 1 )$ , $\beta \in ( 0 , \frac { 1 } { 2 } )$ . Suppose that $0 < 2 \alpha - 4 \beta < 1$ and
|
| 392 |
+
|
| 393 |
+
$$
|
| 394 |
+
\tau _ { k } \geq \frac { 1 } { \log { 1 / \operatorname* { m a x } \{ \rho , \lambda \} } } \left( \log ( 1 + k ) + \operatorname* { m a x } \{ \log \frac { \delta _ { 0 } } { d } , 0 \} \right) .
|
| 395 |
+
$$
|
| 396 |
+
|
| 397 |
+
239 Then, it holds that
|
| 398 |
+
|
| 399 |
+
$$
|
| 400 |
+
\begin{array} { l } { \displaystyle \mathbf I _ { 2 } ( t ) \le \frac { c _ { 2 } d ^ { 5 / 2 } } { ( 1 - \lambda ) ^ { 2 } } \mathcal { A } ( t ) ^ { \frac 1 2 } ( 1 + t ) ^ { 1 - ( \alpha - 2 \beta ) } , \forall t \ge \operatorname* { m a x } \{ t _ { 1 } , t _ { 2 } \} } \\ { \displaystyle \mathbf I _ { 1 } ( t ) \le c _ { 1 } ( 1 - \lambda ) ( 1 + t ) ^ { \alpha } , \mathbf I _ { 3 } ( t ) \le c _ { 3 } \mathcal { A } ( t ) ^ { \frac 1 2 } ( 1 + t ) ^ { 1 - \beta } , \mathbf I _ { 4 } ( t ) \le \frac { c _ { 4 } d ^ { 2 } } { 1 - \lambda } ( 1 + t ) ^ { 1 - ( \alpha - 2 \beta ) } , } \end{array}
|
| 401 |
+
$$
|
| 402 |
+
|
| 403 |
+
240 where $t _ { 1 } , t _ { 2 }$ are defined in (25), (26), and $c _ { 1 } , c _ { 2 } , c _ { 3 } , c _ { 4 }$ are constants defined as follows:
|
| 404 |
+
|
| 405 |
+
$$
|
| 406 |
+
\begin{array} { l } { { c _ { 1 } : = 2 G / \eta _ { 0 } , ~ c _ { 2 } : = \displaystyle \frac { \eta _ { 0 } } { \delta _ { 0 } ^ { 2 } } \frac { 6 \cdot \left( L _ { 1 } G ^ { 2 } + L _ { 2 } G ^ { 2 } + \sqrt { L } G ^ { 3 / 2 } \right) } { \sqrt { 1 - 2 \alpha + 4 \beta } } , } } \\ { { c _ { 3 } : = \displaystyle \frac { 2 } { \sqrt { 1 - 2 \beta } } \operatorname* { m a x } \{ L \delta _ { 0 } , G \sqrt { 1 - \beta } \} , ~ c _ { 4 } : = \displaystyle \frac { \eta _ { 0 } } { \delta _ { 0 } ^ { 2 } } \cdot \frac { L G ^ { 2 } } { 2 \beta - \alpha + 1 } . } } \end{array}
|
| 407 |
+
$$
|
| 408 |
+
|
| 409 |
+
241 See Appendix B for the proof. We comment that the bound for $\mathbf { I } _ { 4 } ( t )$ cannot be improved. As a
|
| 410 |
+
242 concrete example, consider the constant function $\ell ( \pmb \theta ; z ) = \mathrm { c } \neq 0$ for all $z \in { \mathbb { Z } }$ , it can be shown that
|
| 411 |
+
243 $\| g _ { k } ^ { ( m ) } \| ^ { 2 } = \mathrm { c } ^ { 2 }$ and consequently $\mathbf { I } _ { 4 } ( t ) = \Omega ( \eta _ { k } / \delta _ { k } ^ { 2 } ) = \Omega ( t ^ { 1 - ( \alpha - 2 \beta ) } )$ , which matches (18). Finally,
|
| 412 |
+
244 plugging Lemma 4.2 into Lemma 4.1 gives:
|
| 413 |
+
|
| 414 |
+
$$
|
| 415 |
+
A ( t ) \leq \frac { c _ { 1 } ( 1 - \lambda ) } { ( 1 + t ) ^ { 1 - \alpha } } + \frac { c _ { 2 } d ^ { 5 / 2 } } { ( 1 - \lambda ) ^ { 2 } } \frac { A ( t ) ^ { \frac { 1 } { 2 } } } { ( 1 + t ) ^ { \alpha - 2 \beta } } + c _ { 3 } \frac { A ( t ) ^ { \frac { 1 } { 2 } } } { ( 1 + t ) ^ { \beta } } + c _ { 4 } \frac { d ^ { 2 } } { 1 - \lambda } \frac { 1 } { ( 1 + t ) ^ { \alpha - 2 \beta } } .
|
| 416 |
+
$$
|
| 417 |
+
|
| 418 |
+
245 Since $\mathbf { \mathcal { A } } ( t ) \geq 0$ , the above is a quadratic inequality that implies the following bound:
|
| 419 |
+
|
| 420 |
+
Lemma 4.3. Under Assumption 3.1–3.5, with the step sizes 246 $\eta _ { t + 1 } = \eta _ { 0 } ( 1 + t ) ^ { - \alpha }$ , $\delta _ { t + 1 } = \delta _ { 0 } ( 1 +$ 247 $\begin{array} { r } { t ) ^ { - \beta } , \tau _ { k } \geq \frac { 1 } { \log { 1 / \operatorname* { m a x } \{ \rho , \lambda \} } } \left( \log ( 1 + k ) + \operatorname* { m a x } \{ \log \frac { \delta _ { 0 } } { d } , 0 \} \right) , \eta _ { 0 } = d ^ { - 2 / 3 } } \end{array}$ $\eta _ { 0 } ~ = ~ d ^ { - 2 / 3 } , \delta _ { 0 } ~ = ~ d ^ { 1 / 3 }$ , $\alpha \in ( 0 , 1 )$ 248 $\beta \in ( 0 , \textstyle { \frac { 1 } { 2 } } )$ . If $2 \alpha - 4 \beta < 1$ , then there exists a constant $t _ { 0 }$ such that the iterates $\{ \pmb { \theta } _ { k } \} _ { k \ge 0 }$ satisfies
|
| 421 |
+
|
| 422 |
+
$$
|
| 423 |
+
\frac { 1 } { 1 + T } \sum _ { k = 0 } ^ { T } \mathbb { E } \left\| \nabla \mathcal { L } ( \pmb { \theta } _ { k } ) \right\| ^ { 2 } \leq 1 2 \operatorname* { m a x } \{ c _ { 5 } ( 1 - \lambda ) , c _ { 6 } , \frac { c _ { 7 } } { 1 - \lambda } \} d ^ { 2 / 3 } T ^ { - \operatorname* { m i n } \{ 2 \beta , 1 - \alpha , \alpha - 2 \beta \} } , \forall T \geq t _ { 0 } .
|
| 424 |
+
$$
|
| 425 |
+
|
| 426 |
+
249 Optimizing the step size exponents $\alpha , \beta$ in the above concludes the proof of Theorem 3.1.
|
| 427 |
+
|
| 428 |
+
251 We conclude by discussing two alternative zero-th order gradient estimators to (4), and argue that
|
| 429 |
+
252 they do not improve over the sample complexity in the proposed DFO $( \lambda )$ algorithm. We study:
|
| 430 |
+
|
| 431 |
+
$$
|
| 432 |
+
\begin{array} { r } { g _ { 2 \mathrm { p t } - 1 } : = \frac { d } { \delta } \left[ \ell \left( \theta + \delta u ; Z \right) - \ell ( \theta ; Z ) \right] u , \quad g _ { 2 \mathrm { p t } - 1 1 } : = \frac { d } { \delta } \left[ \ell \left( \theta + \delta u ; Z _ { 1 } \right) - \ell ( \theta ; Z _ { 2 } ) \right] u , } \end{array}
|
| 433 |
+
$$
|
| 434 |
+
|
| 435 |
+
53 where $\pmb { u } \sim \mathrm { U n i f } ( \mathbb { S } ^ { \mathsf { d } - 1 } )$ . For ease of illustration, we assume that the samples $Z , Z _ { 1 } , Z _ { 2 }$ are drawn
|
| 436 |
+
254 directly from the stationary distributions $Z \sim \Pi _ { \pmb { \theta } + \delta \pmb { u } } , Z _ { 1 } \sim \Pi _ { \pmb { \theta } + \delta \pmb { u } } , Z _ { 2 } \sim \overset { \cdot } { \Pi } _ { \pmb { \theta } }$ .
|
| 437 |
+
255 We recall from $\ S$ that the estimator $\mathbf { \sigma } _ { g _ { 2 } \mathsf { p t } - 1 }$ is a finite difference approximation of the directional
|
| 438 |
+
256 derivative of objective function along the randomized direction $\textbf { \em u }$ , as proposed in Nesterov &
|
| 439 |
+
257 Spokoiny (2017); Ghadimi & Lan (2013). For non-convex stochastic optimization with decision
|
| 440 |
+
258 independent sample distribution, i.e., $\Pi _ { \pmb { \theta } } \equiv \bar { \Pi }$ for all $\pmb \theta$ , the DFO algorithm based on $\mathbf { \sigma } _ { g _ { 2 } \mathsf { p t } - 1 }$ is
|
| 441 |
+
259 known to admit an optimal sample complexity of $\mathcal { O } ( 1 / \epsilon ^ { 2 } )$ (Jamieson et al., 2012). Note that
|
| 442 |
+
260 $\mathbb { E } _ { u \sim \mathrm { U n i f } ( \mathbb { S } ^ { d - 1 } ) , Z \sim \bar { \Pi } } [ \ell ( \pmb { \theta } ; Z ) \pmb { u } ] = \mathbf { 0 }$ . However, in the case of decision-dependent sample distribution
|
| 443 |
+
261 as in (1), $\mathbf { \sigma } _ { g _ { 2 } \mathsf { p t } - 1 }$ would become a biased estimator since the sample $Z$ is drawn from $\prod _ { \pm \delta u }$ which
|
| 444 |
+
262 depends on $\textbf { \em u }$ . The DFO algorithm based on $\mathbf { \sigma } _ { g _ { 2 } \mathsf { p t } - 1 }$ may not converge to a stationary solution of (1).
|
| 445 |
+
263 A remedy to handle the above issues is to consider the estimator $\mathbf { \sigma } _ { g _ { 2 } \mathsf { p t } - 1 \mathsf { l } }$ which utilizes two samples
|
| 446 |
+
264 $Z _ { 1 } , Z _ { 2 }$ , each independently drawn at a different decision variable, to form the gradient estimate. In
|
| 447 |
+
265 fact, it can be shown that $\vec { \mathbb { E } } [ g _ { 2 \mathsf { p t } - 1 1 } ] = \nabla \mathcal { L } _ { \delta } ( \pmb { \theta } )$ yields an unbiased gradient estimator. However, due
|
| 448 |
+
266 to the decoupled random samples $Z _ { 1 } , Z _ { 2 }$ , we have
|
| 449 |
+
|
| 450 |
+
$$
|
| 451 |
+
\begin{array} { r l } & { \displaystyle \mathbb { E } \left\| g _ { 2 \mathrm { p t } - 1 1 } \right\| ^ { 2 } = \mathbb { E } \left[ \big ( \ell \left( \theta + \delta u ; Z _ { 1 } \right) - \ell ( \theta ; Z _ { 1 } ) + \ell ( \theta ; Z _ { 1 } ) - \ell ( \theta ; Z _ { 2 } ) \big ) ^ { 2 } \right] \frac { d ^ { 2 } } { \delta ^ { 2 } } } \\ & { \displaystyle \overset { ( a ) } { \geq } \mathbb { E } \left[ \frac { 3 } { 4 } \big ( \ell ( \theta ; Z _ { 1 } ) - \ell ( \theta ; Z _ { 2 } ) \big ) ^ { 2 } - 3 \big ( \ell ( \theta + \delta u ; Z _ { 1 } \big ) - \ell ( \theta ; Z _ { 1 } ) \big ) ^ { 2 } \right] \frac { d ^ { 2 } } { \delta ^ { 2 } } } \\ & { \displaystyle = \frac { 3 } { 2 } \mathsf { V a r } [ \ell ( \theta ; Z ) ] \frac { d ^ { 2 } } { \delta ^ { 2 } } - 3 \mathbb { E } \left[ \big ( \ell \left( \theta + \delta u ; Z _ { 1 } \right) - \ell ( \theta ; Z _ { 1 } ) \big ) ^ { 2 } \right] \frac { d ^ { 2 } } { \delta ^ { 2 } } \geq \frac { 3 } { 2 } \frac { \sigma ^ { 2 } d ^ { 2 } } { \delta ^ { 2 } } - 3 \mu ^ { 2 } d ^ { 2 } = \Omega ( 1 / \delta ^ { 2 } ) . } \end{array}
|
| 452 |
+
$$
|
| 453 |
+
|
| 454 |
+
267 where in (a) we use the fact that $( x + y ) ^ { 2 } \ \geq \ { \frac { 3 } { 4 } } x ^ { 2 } - 3 y ^ { 2 }$ , in (b) we assume $\mathsf { V a r } [ \ell ( \pmb { \theta } ; Z ) ] : =$
|
| 455 |
+
268 $\begin{array} { r } { \mathbb { E } \left( \ell ( \pmb { \theta } ; Z ) - \mathcal { L } ( \pmb { \theta } ) \right) ^ { 2 } \ge \sigma ^ { 2 } > 0 } \end{array}$ and $\ell ( \pmb \theta ; z )$ is $\mu$ -Lipschitz in $\pmb \theta$ . As such, this two-point gradi
|
| 456 |
+
269 ent estimator does not reduce the variance when compared with the estimator in (4). Note that a
|
| 457 |
+
270 two-sample estimator also incurs additional sampling overhead in the scenario of Markovian samples.
|
| 458 |
+
|
| 459 |
+
# 5 Numerical Experiments
|
| 460 |
+
|
| 461 |
+
We examine the efficacy of the DFO $( \lambda )$ algorithm on a few toy examples by comparing DFO $( \lambda )$ with a simple stochastic gradient descent scheme with greedy deployment. Unless otherwise specified, we use the step size choices in (8) for DFO $( \lambda )$ . All experiments are conducted on a server with an Intel Xeon 6318 CPU using Python 3.7. To measure performance, we record the gradient norm $\| \nabla { \mathcal { L } } ( \pmb { \theta } ) \|$ and estimate its expected value using at least 8 trials.
|
| 462 |
+
|
| 463 |
+
1-Dimensional Case: Quadratic Loss. The first example considers a scalar quadratic loss function $\ell : \mathbb { R } \times \mathbb { R } \to \mathbb { R }$ defined by $\begin{array} { r } { \ell ( \pmb { \theta } ; z ) = \frac { 1 } { 1 2 } z \pmb { \theta } ( 3 \pmb { \theta } ^ { 2 } - 8 \pmb { \hat { \theta } } - 4 8 ) } \end{array}$ . To simulate the controlled Markov chain scenario, the samples are generated dynamically according to an auto-regressive (AR) process $Z _ { t + 1 } = ( 1 - \gamma ) Z _ { t } + \gamma \bar { Z } _ { t + 1 }$ with $\begin{array} { r } { \bar { Z } _ { t + 1 } \sim \mathcal { N } ( \pmb { \theta } , \frac { ( 2 - \gamma ) } { \gamma } \sigma ^ { 2 } ) } \end{array}$ with parameter $\gamma \in ( 0 , 1 )$ . Note that the stationary distribution of the AR process is $\Pi _ { \pmb \theta } = \mathcal { N } ( \pmb \theta , \sigma ^ { 2 } )$ . As such, the performative risk function in this case is $\begin{array} { r } { \mathcal { L } ( \pmb { \theta } ) = \mathbb { E } _ { Z \sim \Pi _ { \pmb { \theta } } } \left[ \ell ( \pmb { \theta } ; Z ) \right] = \frac { \pmb { \theta } ^ { 2 } } { 1 2 } ( \pmb { \theta } ^ { 2 } - 8 \pmb { \theta } - 4 8 ) } \end{array}$ , which is quartic in $\pmb \theta$ . Note that $\mathcal { L } ( \pmb { \theta } )$ is not convex in $\pmb \theta$ and the set of stationary solution is $\{ \pmb \theta : \nabla \mathcal { L } ( \pmb \theta ) = 0 \} \overset { - } { = } \{ 4 , 0 , - 2 \}$ , among which the optimal solution is $\pmb { \theta } _ { P O } = \arg \operatorname* { m i n } _ { \pmb { \theta } } \mathcal { L } ( \pmb { \theta } ) = 4$ .
|
| 464 |
+
|
| 465 |
+
In our experiments below, we initialize all the algorithms are initialized by $\theta _ { 0 } = 6$ . In Figure 1 (left), we compare the norms of the gradient for performative risk with pure DFO (no burn-in), the $\tt D F O ( \lambda )$ algorithm, and stochastic gradient descent with greedy deployment scheme (SGD-GD) against the number of samples observed by the algorithms. We first observe from Figure 1 (left) that pure DFO and SGD-GD methods do not converge to a stationary point to $\mathcal { L } ( \pmb { \theta } )$ even after more samples
|
| 466 |
+
|
| 467 |
+

|
| 468 |
+
Figure 1: (left) One Dimension Quadratic Minimization problem with samples generated by AR distribution model where regressive parameter $\gamma = 0 . 5$ . (middle) Markovian Pricing Problem with $d = 5$ dimension. (right) Linear Regression problem based on AR distribution model $( \gamma = 0 . 5 )$ ).
|
| 469 |
+
|
| 470 |
+
290 are observed. On the other hand, DFO $( \lambda )$ converges to a stationary point of $\mathcal { L } ( \pmb { \theta } )$ at the rate of
|
| 471 |
+
291 $\| \nabla \mathcal { L } ( \pmb { \theta } ) \| ^ { 2 } = \mathcal { O } ( 1 / S ^ { 0 . 3 6 } )$ , matching Theorem 3.1 that predicts a rate of $\mathcal { O } ( 1 / S ^ { 1 / 3 } )$ , where $S$ is the
|
| 472 |
+
292 total number of samples observed.
|
| 473 |
+
293 Besides, we observe that with large $\lambda = 0 . 7 5$ , DFO $( \lambda )$ converges at a faster rate at the beginning (i.e.,
|
| 474 |
+
294 transient phase), but the convergence rate slows down at the steady phase (e.g., when no. of samples
|
| 475 |
+
295 observed is greater than $1 0 ^ { 6 }$ ) compared to running the same algorithm with smaller $\lambda$ .
|
| 476 |
+
|
| 477 |
+
Higher Dimension Case: Markovian Pricing. The second example examines a multi-dimensional $\mathrm { { } } d = 5$ ) pricing problem similar to (Izzo et al., 2021, Sec. 5.2). The decision variable $\pmb \theta \in \mathbb { R } ^ { 5 }$ denotes the prices of $d = 5$ goods and $\kappa$ is a drifting parameter for the prices. Our goal is to maximize the average revenue $\mathbb { E } _ { Z \sim \Pi _ { \pmb { \theta } } } [ \ell ( \pmb { \theta } ; Z ) ]$ with $\ell ( \pmb { \theta } ; z ) = - \langle \pmb { \theta } | z \rangle$ , where $\Pi _ { \pmb \theta } \equiv \tilde { \mathcal { N } } ( \pmb \mu _ { 0 } - \kappa \pmb \theta , \sigma ^ { 2 } \pmb I )$ is the unique stationary distribution of the Markov process (i.e., an AR process)
|
| 478 |
+
|
| 479 |
+
Note that in this case, the performative optimal solution is $\theta _ { P O } = \mathrm { a r g } \operatorname* { m i n } _ { \theta } \mathcal { L } ( \theta ) = \mu _ { 0 } / ( 2 \kappa )$
|
| 480 |
+
|
| 481 |
+
302 We set $\gamma = 0 . 5 , \sigma = 5$ , drifting parameter $\kappa = 0 . 5$ , initial mean of non-shifted distribution
|
| 482 |
+
303 $\pmb { \mu } _ { 0 } = \left[ - 2 , 2 , - 2 , 2 , - 2 \right] ^ { \top }$ . All the algorithms are initialized by $\pmb { \theta } _ { 0 } = \left[ 2 , - 2 , 2 , - 2 , 2 \right] ^ { \top }$ . We simulate
|
| 483 |
+
304 the convergence behavior for different algorithms in Figure 1 (middle). Observe that the differences
|
| 484 |
+
305 between the DFO $( \lambda )$ algorithms with different $\lambda$ becomes less significant than Figure 1 (left).
|
| 485 |
+
306 Markovian Performative Regression. The last example considers the linear regression problem
|
| 486 |
+
307 in (Nagaraj et al., 2020) which is a prototype problem for studying stochastic optimization with
|
| 487 |
+
308 Markovian data (e.g., reinforcement learning). Unlike the previous examples, this problem involves a
|
| 488 |
+
309 pair of correlated r.v.s that follows a decision-dependent joint distribution. We adopt a setting similar
|
| 489 |
+
310 to the regression example in (Izzo et al., 2021), where $( { \bar { X } } , Y ) \sim \Pi _ { \theta }$ with $X \sim \hat { \mathcal { N } } ( 0 , \sigma _ { 1 } ^ { 2 } I ) , \mathsf { Y } | X \sim$
|
| 490 |
+
311 $\mathcal { N } \left( \langle \beta ( \pmb { \theta } ) | X \rangle , \sigma _ { 2 } ^ { 2 } \right)$ , $\beta ( \pmb \theta ) = { { a } _ { 0 } } + { { a } _ { 1 } } \pmb \theta$ . The loss function is $\begin{array} { r } { \ell ( \pmb { \theta } ; x , y ) = ( \left. x \mid \pmb { \theta } \right. - y ) ^ { 2 } + \frac { \mu } { 2 } \left\| \pmb { \theta } \right\| ^ { 2 } } \end{array}$ .
|
| 491 |
+
312 In this case, the performative risk is:
|
| 492 |
+
|
| 493 |
+
$$
|
| 494 |
+
\begin{array} { r } { \boldsymbol { : } ( \pmb { \theta } ) = \mathbb { E } _ { \Pi _ { \theta } } \left[ \ell ( \pmb { \dot { \theta } } ; X , Y ) \right] = \left( \sigma _ { 1 } ^ { 2 } a _ { 1 } ^ { 2 } - 2 \sigma _ { 1 } ^ { 2 } a _ { 1 } + \sigma _ { 1 } ^ { 2 } + \frac { \mu } { 2 } \right) \left. \pmb { \theta } \right. ^ { 2 } - 2 \sigma _ { 1 } ^ { 2 } ( 1 - a _ { 1 } ) \pmb { \theta } ^ { \top } a _ { 0 } + \sigma _ { 1 } ^ { 2 } \left. \mathbf { a } _ { 0 } \right. ^ { 2 } + \sigma _ { 2 } ^ { 2 } , } \end{array}
|
| 495 |
+
$$
|
| 496 |
+
|
| 497 |
+
313 For simplicity, we assume $\sigma _ { 1 } ^ { 2 } ( 1 - a _ { 1 } ) = \sigma _ { 1 } ^ { 2 } a _ { 1 } ^ { 2 } - 2 \sigma _ { 1 } ^ { 2 } a _ { 1 } + \sigma _ { 1 } ^ { 2 } + \mu / \underset { } { 2 }$ , from which we can deduce
|
| 498 |
+
314 ${ \pmb \theta } _ { P O } = { \bf \bar { a } } _ { 0 }$ . In this experiment, we consider Markovian samples $( \tilde { X _ { t } } , \tilde { Y _ { t } } ) _ { t = 1 } ^ { T }$ drawn from an AR
|
| 499 |
+
315 process:
|
| 500 |
+
|
| 501 |
+
$$
|
| 502 |
+
\begin{array} { r l } & { ( { \tilde { X } } _ { t } , { \tilde { Y } } _ { t } ) = ( 1 - \gamma ) ( { \tilde { X } } _ { t - 1 } , { \tilde { Y } } _ { t - 1 } ) + \gamma ( X _ { t } , Y _ { t } ) , } \\ & { X _ { t } \sim { \mathcal { N } } ( 0 , \frac { 2 - \gamma } { \gamma } \sigma _ { 1 } ^ { 2 } I ) , Y _ { t } | X _ { t } \sim { \mathcal { N } } ( \langle X _ { t } | \beta ( \pmb { \theta } _ { t - 1 } ) \rangle , \frac { 2 - \gamma } { \gamma } \sigma _ { 2 } ^ { 2 } ) , } \end{array}
|
| 503 |
+
$$
|
| 504 |
+
|
| 505 |
+
316 for any $t \geq 1$ . We set $d \ = \ 5$ , $a _ { 0 } ~ = ~ [ - 1 , 1 , - 1 , 1 , - 1 ] ^ { \top }$ , $a _ { 1 } \ = \ 0 . 5 , \sigma _ { 1 } ^ { 2 } \ = \ \sigma _ { 2 } ^ { 2 } \ = \ 1$ , regu
|
| 506 |
+
317 larization parameter $\mu = 0 . 5$ , mixing parameter $\gamma = 0 . 1$ . The algorithms are initialized with
|
| 507 |
+
318 $\pmb { \theta } _ { 0 } = [ 1 , - 1 , 1 , - 1 , 1 ] ^ { \top }$ . Figure 1 (right) shows the result of the simulation. Similar to the previous
|
| 508 |
+
319 examples, we observe that pure DFO and SGD fail to find a stationary solution to $\mathcal { L } ( \pmb \theta )$ . Meanwhile,
|
| 509 |
+
320 DFO $( \lambda )$ converges to a stationary solution after a reasonable number of samples are observed.
|
| 510 |
+
321 Conclusions. We have described a derivative-free optimization approach for finding a stationary
|
| 511 |
+
322 point of the performative risk function. In particular, we consider a non-i.i.d. data setting with
|
| 512 |
+
323 samples generated from a controlled Markov chain and propose a two-timescale step sizes approach
|
| 513 |
+
324 in constructing the gradient estimator. The proposed DFO $( \lambda )$ algorithm is shown to converge to a
|
| 514 |
+
325 stationary point of the performative risk function at the rate of $\mathcal { O } ( 1 / T ^ { 1 / 3 } )$ .
|
| 515 |
+
|
| 516 |
+
326 References
|
| 517 |
+
327 Agarwal, A., Dekel, O., and Xiao, L. Optimal algorithms for online convex optimization with multi-point bandit feedback. In Annual Conference Computational Learning Theory, 2010.
|
| 518 |
+
329 Brown, G., Hod, S., and Kalemaj, I. Performative prediction in a stateful world. In International Conference on Artificial Intelligence and Statistics, pp. 6045–6061. PMLR, 2022. Doan, T. T. Finite-time analysis of markov gradient descent. IEEE Transactions on Automatic Control, 2022. Dong, J., Roth, A., Schutzman, Z., Waggoner, B., and Wu, Z. S. Strategic classification from revealed preferences. In Proceedings of the 2018 ACM Conference on Economics and Computation, pp. 55–70, 2018.
|
| 519 |
+
336 Drusvyatskiy, D. and Xiao, L. Stochastic optimization with decision-dependent distributions. Mathematics of Operations Research, 2022. Flaxman, A. D., Kalai, A. T., and McMahan, H. B. Online convex optimization in the bandit setting: Gradient descent without a gradient. In Proceedings of the Sixteenth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA ’05, pp. 385–394, USA, 2005. Society for Industrial and Applied Mathematics. ISBN 0898715857. Ghadimi, S. and Lan, G. Stochastic first- and zeroth-order methods for nonconvex stochastic programming, 2013. URL https://arxiv.org/abs/1309.5549. Hardt, M., Megiddo, N., Papadimitriou, C., and Wootters, M. Strategic classification. In Proceedings of the 2016 ACM conference on innovations in theoretical computer science, pp. 111–122, 2016. Izzo, Z., Ying, L., and Zou, J. How to learn when data reacts to your model: Performative gradient descent. In Meila, M. and Zhang, T. (eds.), Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pp. 4641–4650. PMLR, 18–24 Jul 2021. URL https://proceedings.mlr.press/v139/izzo21a.html. Izzo, Z., Zou, J., and Ying, L. How to learn when data gradually reacts to your model. In International Conference on Artificial Intelligence and Statistics, pp. 3998–4035. PMLR, 2022. Jamieson, K. G., Nowak, R., and Recht, B. Query complexity of derivative-free optimization. In Pereira, F., Burges, C., Bottou, L., and Weinberger, K. (eds.), Advances in Neural Information Processing Systems, volume 25. Curran Associates, Inc., 2012. URL https://proceedings. neurips.cc/paper/2012/file/e6d8545daa42d5ced125a4bf747b3688-Paper.pdf.
|
| 520 |
+
356 Karimi, B., Miasojedow, B., Moulines, E., and Wai, H.-T. Non-asymptotic analysis of biased stochastic approximation scheme. In Conference on Learning Theory, pp. 1944–1974. PMLR, 2019. Li, Q. and Wai, H.-T. State dependent performative prediction with stochastic approximation. In International Conference on Artificial Intelligence and Statistics, pp. 3164–3186. PMLR, 2022.
|
| 521 |
+
361 Mendler-Dunner, C., Perdomo, J., Zrnic, T., and Hardt, M. Stochastic optimization for performative ¨ prediction. Advances in Neural Information Processing Systems, 33:4929–4939, 2020.
|
| 522 |
+
363 Miller, J., Perdomo, J. C., and Zrnic, T. Outside the echo chamber: Optimizing the performative risk. In International Conference on Machine Learning, 2021.
|
| 523 |
+
365 Nagaraj, D., Wu, X., Bresler, G., Jain, P., and Netrapalli, P. Least squares regression with markovian data: Fundamental limits and algorithms. Advances in neural information processing systems, 33: 16666–16676, 2020.
|
| 524 |
+
368 Narang, A., Faulkner, E., Drusvyatskiy, D., Fazel, M., and Ratliff, L. J. Multiplayer performative prediction: Learning in decision-dependent games. arXiv preprint arXiv:2201.03398, 2022.
|
| 525 |
+
370 Nemirovski˘ı, A. S. Problem complexity and method efficiency in optimization. Wiley series in discrete mathematics. Wiley, Chichester, 1983.
|
| 526 |
+
|
| 527 |
+
372 Nesterov, Y. and Spokoiny, V. G. Random gradient-free minimization of convex functions. Founda
|
| 528 |
+
373 tions of Computational Mathematics, 17:527–566, 2017.
|
| 529 |
+
374 Perdomo, J., Zrnic, T., Mendler-Dunner, C., and Hardt, M. Performative prediction. In ¨ International
|
| 530 |
+
375 Conference on Machine Learning, pp. 7599–7609. PMLR, 2020.
|
| 531 |
+
376 Ray, M., Ratliff, L. J., Drusvyatskiy, D., and Fazel, M. Decision-dependent risk minimization
|
| 532 |
+
377 in geometrically decaying dynamic environments. In Proceedings of the AAAI Conference on
|
| 533 |
+
378 Artificial Intelligence, volume 36, pp. 8081–8088, 2022.
|
| 534 |
+
379 Robert, C. P., Casella, G., and Casella, G. Monte Carlo statistical methods, volume 2. Springer, 1999.
|
| 535 |
+
380 Roy, A., Balasubramanian, K., and Ghadimi, S. Projection-free constrained stochastic nonconvex
|
| 536 |
+
381 optimization with state-dependent markov data. In Advances in neural information processing
|
| 537 |
+
382 systems, 2022.
|
| 538 |
+
383 Sun, T. and Li, D. Decentralized markov chain gradient descent. arXiv preprint arXiv:1909.10238,
|
| 539 |
+
384 2019.
|
| 540 |
+
385 Sun, T., Sun, Y., and Yin, W. On markov chain gradient descent. Advances in neural information
|
| 541 |
+
386 processing systems, 31, 2018.
|
| 542 |
+
387 Wu, Y. F., Zhang, W., Xu, P., and Gu, Q. A finite-time analysis of two time-scale actor-critic methods.
|
| 543 |
+
388 Advances in Neural Information Processing Systems, 33:17617–17628, 2020.
|
| 544 |
+
389 Zhang, D. J., Dai, H., Dong, L., Qi, F., Zhang, N., Liu, X., Liu, Z., and Yang, J. How do price
|
| 545 |
+
390 promotions affect customer behavior on retailing platforms? evidence from a large randomized
|
| 546 |
+
391 experiment on alibaba. Production and Operations Management, 2018.
|
md/dev/K48UYo0glaJ/K48UYo0glaJ.md
ADDED
|
@@ -0,0 +1,406 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Theseus: A Library for Differentiable Nonlinear Optimization
|
| 2 |
+
|
| 3 |
+
Luis Pineda1, Taosha Fan1, Maurizio Monge2, Shobha Venkataraman1, Paloma Sodhi1, Ricky T. Q. Chen1, Joseph Ortiz1, Daniel DeTone2, Austin Wang1, Stuart Anderson1, Jing Dong2, Brandon Amos1, Mustafa Mukadam1
|
| 4 |
+
|
| 5 |
+
1Meta AI, 2Reality Labs Research
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
We present Theseus, an efficient application-agnostic open source library for differentiable nonlinear least squares (DNLS) optimization built on PyTorch, providing a common framework for end-to-end structured learning in robotics and vision. Existing DNLS implementations are application specific and do not always incorporate many ingredients important for efficiency. Theseus is application-agnostic, as we illustrate with several example applications that are built using the same underlying differentiable components, such as second-order optimizers, standard costs functions, and Lie groups. For efficiency, Theseus incorporates support for sparse solvers, automatic vectorization, batching, GPU acceleration, and gradient computation with implicit differentiation and direct loss minimization. We do extensive performance evaluation in a set of applications, demonstrating significant efficiency gains and better scalability when these features are incorporated. Project page: https://sites.google.com/view/theseus-ai/
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
Reconciling traditional approaches with deep learning to leverage their complementary strengths is a common thread in a large body of recent work in robotics. In particular, an emerging trend is to differentiate through nonlinear least squares (NLS) [1] which is a second-order optimization formulation at the heart of many problems in robotics [2–7] and vision [8–13]. Optimization layers as inductive priors in neural models have been explored in machine learning with convex optimization [14, 15] and in meta learning with gradient descent [16, 17] based first-order optimization.
|
| 14 |
+
|
| 15 |
+
Differentiable nonlinear least squares (DNLS) provides a general scheme to encode inductive priors, as the objective function can be partly parameterized by neural models and partly with engineered domain-specific differentiable models. Here, as illustrated in Fig. 1, input tensors define a sum of weighted squares objective function and output tensors are minima of that objective. Such implicit layers [18] are in contrast to typical (explicit) layers that take input tensors through a linear transformation and some element-wise nonlinear activation function.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: Theseus enables building custom, efficient DNLS layers that support end-to-end structured learning.
|
| 19 |
+
|
| 20 |
+
36th Conference on Neural Information Processing Systems (NeurIPS 2022).
|
| 21 |
+
|
| 22 |
+
The ability to compute gradients end-to-end is retained by differentiating through the optimizer which allows neural models to train on the final task loss, while also taking advantage of priors captured by the optimizer. The flexibility of such a scheme has led to promising state-of-the-art results in a wide range of applications such as structure from motion [19], motion planning [20], SLAM [21, 22], bundle adjustment [23], state estimation [24, 25], image alignment [26] with other applications like manipulation and tactile sensing [27, 28], control [29], human pose tracking [30, 31] to be explored. However, existing implementations from above are application specific, common underlying tools like optimizers get reimplemented, and features like sparse solvers, batching, and GPU support that impact efficiency are not always included. This has led to a fragmented literature where it is difficult to start work on new ideas or to build on the progress of prior work.
|
| 23 |
+
|
| 24 |
+
To address this gap, we present Theseus, an open source library for differentiable nonlinear least squares optimization built on PyTorch. Theseus provides an efficient application-agnostic interface that consolidates recent efforts and catalyzes future progress in the domain of structured end-to-end learning for robotics and vision. Our contributions are summarized below.
|
| 25 |
+
|
| 26 |
+
Application agnostic interface. Our implementation provides an easy to use interface to build custom optimization layers and plug them into any neural architecture. (i) The layer can be constructed from a set of available second-order optimizers like Gauss-Newton, Levenberg–Marquardt (with adaptive damping) and Dogleg, and a nonlinear least squares objective. (ii) The objective can be constructed with learnable or hand-specified cost functions, either by applying one of many common costs already provided in the library, or by building custom costs in-place with support for automatic differentiation through PyTorch [32]. (iii) We also provide differentiable Lie groups for representing 2D/3D positions and rotations [33], and differentiable kinematics wrapping over an existing library [34] for representing robot models. More details are described in Sec. 3.
|
| 27 |
+
|
| 28 |
+
Efficiency based design. Efficiency is a central design consideration and we make several advancements in improving computation times and memory consumption. (i) As common in prior work, an optimizer implementation using PyTorch’s native linear solver would use a dense representation for solving the linear system within the nonlinear optimization. In practice, these optimization problems often have a considerable amount of sparsity that can be exploited [35–38]. In Theseus, we implement sparse linear solvers that are differentiable end-to-end and make them efficient with custom CPU and CUDA backends to support batching and GPU acceleration. (ii) Beyond sparse solvers, we extend batching and GPU support to all features in the library and add automatic vectorization of cost functions and other operations to significantly boost efficiency. (iii) Finally, we introduce implicit differentiation [39] and direct loss minimization [40, 41], which have been previously applied to only first order optimizers like gradient descent and convex optimization, to a new class of second-order optimizers. This goes beyond prior work with nonlinear least squares that currently only support differentiation with standard unrolling, which is known to have challenges with compute, memory, and vanishing gradients. More details are described in Sec. 4.
|
| 29 |
+
|
| 30 |
+
Highlights of results. Together, the application-agnostic features let users easily set up a variety of problems like pose graph optimization, tactile state estimation, bundle adjustment, motion planning, and homography estimation, all of which are included as examples in the open source code and described in Sec. 3.1. In evaluations, we find that on a standard GPU, Theseus with a sparse solver is much faster and requires significantly less memory than a dense solver, and when solving a batch of large problems the forward pass of Theseus is up to $2 0 \mathrm { x }$ faster than state-of-the-art $\mathrm { C } { + } { + }$ based solver Ceres that has limited GPU support and does not support batching and end-to-end learning. We also compare all backward modes to find that with increasing number of optimization iterations, compute and memory increases linearly for unrolling and stays constant for implicit differentiation, while the latter also provides better gradients. More details are described in Sec. 5.
|
| 31 |
+
|
| 32 |
+
# 2 Background and related work
|
| 33 |
+
|
| 34 |
+
Nonlinear least squares (NLS) is an optimization problem [1] that finds optimization variables $\theta$
|
| 35 |
+
|
| 36 |
+
$$
|
| 37 |
+
\theta ^ { \star } = \operatorname * { a r g m i n } _ { \theta } S ( \theta ) , \qquad S ( \theta ) = \frac { 1 } { 2 } \sum _ { i } | | r _ { i } ( \theta ^ { i } ) | | ^ { 2 } = \frac { 1 } { 2 } \sum _ { i } | | w _ { i } c _ { i } ( \theta ^ { i } ) | | ^ { 2 }
|
| 38 |
+
$$
|
| 39 |
+
|
| 40 |
+
where the objective $S ( \theta )$ is a sum of squared vector-valued residual terms $r _ { i }$ , each a function of $\theta ^ { i } \subset \theta$ that are (non-disjoint) subsets of the optimization variables $\theta = \{ \theta _ { j } \}$ . Any variable $\theta _ { j }$ is a manifold object; for example, a Euclidean vector or a matrix Lie group. For flexibility, we represent a residual $\dot { r _ { i } } ( \theta ^ { i } ) = w _ { i } c _ { i } ( \bar { \theta } ^ { i } )$ as a product of a matrix weight $w _ { i }$ and vector cost $c _ { i }$ . Robotics and vision have used this general optimization formulation to tackle many applications [3, 4]. For example, costs capture sensor measurement errors and physical constraints to optimize camera, robot, object, or human poses in estimation and tracking problems like simultaneous localization and mapping (SLAM) [42], structure from motion [13], bundle adjustment [8], visual inertial odometry [2], articulated tracking [12], contact odometry in legged locomotion [27], 3D pose and shape reconstruction of humans [30, 31] or objects [10]. Similarly, costs can also capture constraints and desired future goals to find robot states or actions in motion planning [5], dynamics [6], and control [29] problems.
|
| 41 |
+
|
| 42 |
+
Solving NLS. Problems represented by Eq. (1) are solved by iteratively linearizing the nonlinear objective around the current variables to get the linear system $\begin{array} { r } { ( \sum _ { i } J _ { i } ^ { \top } J _ { i } ) \delta \theta = ( \bar { \sum _ { i } } J _ { i } ^ { \top } r _ { i } ) } \end{array}$ , then solving the linear system to find the update $\delta \theta$ , and finally updating the variables $\theta \theta - \delta \theta$ , until convergence. Note that in the update the minus operation is more generally a retraction mapping for non-Euclidean variables. In the linear system, $\bar { J } _ { i } = [ \partial r _ { i } / \partial \theta ^ { i } ]$ are the Jacobians of residuals with respect to the variables and the iterative method above, called Gauss-Newton (GN), is a nonlinear optimizer that is (approximately) second-order, since $\begin{array} { r } { \dot { H } = ( \sum _ { i } J _ { i } ^ { \top } J _ { i } ) } \end{array}$ represents the approximate Hessian. To improve robustness and convergence, variations like Levenberg–Marquardt (LM) damp the linear system, while others use a trust region and adjust step size for the update with line search (e.g., Dogleg). Please refer to [1, 43] for an in-depth exploration. In most applications discussed above the objective structure gives rise to a sparse Hessian, since not all costs depend on all variables. Several general purpose frameworks [35–38] have been built that leverage this sparsity property to efficiently solve the sparse linear system in every iteration of the nonlinear optimization. While these frameworks were not built for deep learning, they are highly efficient and performant on CPU.
|
| 43 |
+
|
| 44 |
+
NLS with learning. Data driven learning has been explored to address challenges in hand crafting costs or features for costs, finding weights to balance different costs, or to find initializations that lead to better convergence. Some examples include, learning object shape code [44] or environment depth code [45] for SLAM [46], learning motion priors for planning to manipulate articulated objects [47], learning relative pose from tactile images to estimate object state during pushing [28], and semantic 2D segmentation fused in 3D mesh for semantic SLAM [7]. These approaches only train features on a surrogate or intermediate loss and then apply optimization at inference where the true downstream task loss is available but not utilized. To take full advantage of end-to-end learning, latest approaches thus are redesigning the optimization to be differentiable.
|
| 45 |
+
|
| 46 |
+
Differentiable NLS (DNLS) solves the optimization in Eq. (1) and also provides gradients of the solution $\theta ^ { \star }$ with respect to any upstream neural model parameters $\phi$ that parameterize the objective $S ( \theta ; \phi )$ and in turn any costs $\boxed { c _ { i } ( \theta ^ { i } ; \phi ) }$ , weights $w _ { i } ( \phi )$ , or initialization for variables $\theta _ { i n i t } ( \phi )$ . The goal is to learn these parameters $\phi$ end-to-end with a downstream learning objective $L$ defined as a function of $\theta ^ { \star }$ . This results in a bilevel optimization setup as shown in Fig. 1
|
| 47 |
+
|
| 48 |
+
$$
|
| 49 |
+
\theta ^ { \star } ( \phi ) = \operatorname * { a r g m i n } _ { \theta } S ( \theta ; \phi ) , \qquad \mathrm { o u t e r ~ l o o p : ~ } \phi ^ { \star } = \operatorname * { a r g m i n } _ { \phi } L ( \theta ^ { \star } ( \phi ) )
|
| 50 |
+
$$
|
| 51 |
+
|
| 52 |
+
where the inner loop is DNLS and the outer loop is gradient descent class of optimization that is standard in deep learning. The outer loop performs update $\phi \phi + \delta \phi$ by computing $\delta \phi$ using gradients ${ \partial \theta ^ { \star } } / { \bar { \partial } \phi }$ through inner loop DNLS. Note that more generally the learning objective i.e. outer loss $L$ can also depend on other quantities like neural model parameters downstream of $\theta ^ { * }$ , but we omit them here for clarity.
|
| 53 |
+
|
| 54 |
+
Recent works with DNLS have outperformed optimization only or learning only methods by combining the strengths of classical methods with deep learning. For example, learning features for costs to represent depth in bundle adjustment [23] and monocular stereo [48] where an initialization network also learns to predict depth and pose, learning cost weights like motion model weights in video to depth estimation [19], obstacle avoidance weights in 2D motion planning from occupancy images [20], learning robust loss weights in image alignment [26] and state-of-the-art dense SLAM [22], and confidence weights for feature matching to optimize camera pose [49]. Other works, backpropagate reconstruction error to sensor model in a SLAM system [21], solve large scale bundle adjustment on a GPU [50], and learn sensor and dynamics models for 2D visual object tracking and visual odometry [24]. These implementations however, are application specific which has led to repeated work in building DNLS where features like learnable costs and weights, Lie groups, and kinematics are not always present. Additionally, features that have a significant impact on performance, like sparsity and vectorization of costs are only considered by some [24, 50, 51] or in the case of implicit differentiation for NLS optimization, have not yet been explored.
|
| 55 |
+
|
| 56 |
+
# 3 Application agnostic interface
|
| 57 |
+
|
| 58 |
+
Given the lack of a common and efficient framework for DNLS an important goal of Theseus is to provide an application-agnostic interface. In this section, we describe how we enable this with an easy-to-use core API, standard cost functions, and features like Lie groups and kinematics, and illustrate several examples using this interface. We discuss design for efficiency in the next section.
|
| 59 |
+
|
| 60 |
+

|
| 61 |
+
|
| 62 |
+
The core API lets users focus on describing the DNLS problem and their interaction with the outer loss $L$ and parameters $\phi$ within any broader PyTorch model, while the solution and differentiation are seamlessly taken care of under-the-hood. The basic components of the core API are described below with the help of a simple example in Listing 1 (see App. B for more details on the example):
|
| 63 |
+
|
| 64 |
+
��� Variable: refers to either optimization variables, $\theta$ , or auxiliary variables (those constant with respect to $S$ , e.g., parameters $\phi$ or data tensors), which are named wrappers of torch batched tensors stored in Variable.tensor (lines 3-5).
|
| 65 |
+
• CostFunction: defines costs $c _ { i }$ (lines 12-14) and are also responsible for declaring which of its variables are optimization and which are auxiliary (lines 8-9),
|
| 66 |
+
• CostWeight: defines weights $w _ { i }$ associated with cost $c _ { i }$ (line 14).
|
| 67 |
+
• Objective: defines $S ( \theta ; \phi )$ , and thus the structure of an optimization problem (lines 11, 15) by holding all cost functions and weights, and their associated variables. These are implicitly obtained when a CostFunction is added to the Objective, and Variable names are used to infer which are shared by one or more CostFunction.
|
| 68 |
+
• Optimizer: is the inner loop optimization algorithm (e.g. Gauss-Newton) that finds the solution $\theta ^ { \star }$ given objective $S$ (line 16).
|
| 69 |
+
• TheseusLayer: encapsulates Optimizer and Objective, and serves as the interface between the DNLS block and other torch modules upstream or downstream (line 16).
|
| 70 |
+
|
| 71 |
+
The interface between the inner loop optimization and the outer loop’s parameters and loss occurs via TheseusLayer.forward (lines 21-23). This receives as input a dictionary mapping variable names to torch tensors, which Theseus then uses to populate the corresponding Variable with the tensor mapped to its name. With the input dictionary users can provide initial values for the optimization variables, data tensors, or current values for parameters $\phi$ before running the inner loop optimization. The output of forward is another dictionary that maps variable names to tensors with their optimal values found in the inner loop (lines 21, 24); auxiliary variables are not modified during the forward pass. The output tensors can then be combined with other torch modules downstream to compute $L$ while maintaining the full differentiable computation graph (lines 24-26).
|
| 72 |
+
|
| 73 |
+
We currently provide Gauss-Newton, Levenberg–Marquardt (with adaptive damping), and Dogleg as nonlinear Optimizer for the inner loop, with the ability to easily add support for more optimizers in the future. Listing 1 uses AutoDiffCostFunction to construct an in-place CostFunction (line 12) which allows automatically calculating Jacobians $J _ { i }$ with PyTorch (see App. C). Beyond this, in the library we include standard cost functions with analytical Jacobians broadly used in many applications, like Gaussian measurements, reprojection error, relative pose measurement, motion models, and collision costs. We also include a variety of robust loss functions, useful for example in handling outliers [52], which can be easily integrated with CostFunction. Next we describe support for Lie groups and kinematics.
|
| 74 |
+
|
| 75 |
+
Differentiable Lie groups. Lie groups are widely used in robotics and vision to represent 2D/3D positions and rotations [33]. Due to their non-Euclidean geometry, it is difficult to apply them to deep learning, which primarily operates with Euclidean tensors, but recently there is growing interest in making them compatible [24, 53–57]. LieTorch [54] generalizes automatic differentiation on the Lie group tangent space through local parameterization around the identity, but the implementation is complex since every operation requires a custom kernel. In contrast, Theseus computes common Lie group operators, e.g., the exponential and logarithm map, inverse, composition, etc., in closed form, and provides their corresponding analytical derivatives on the tangent space. Following [58], we also implement a projection operator that allows us to project gradients computed by PyTorch’s autodiff to the tangent space and use them to easily compute Jacobians and update Lie group variables correctly; a similar strategy has also been implemented in [59]. Additionally, our Lie group implementation includes a heuristic extension that allows using any of PyTorch’s first-order optimizers on nonEuclidean manifolds with minimal code changes. All of these make it easy and straightforward to run optimization and train neural networks with Lie groups variables. More details in App. D.
|
| 76 |
+
|
| 77 |
+
Differentiable kinematics. Many problems such as motion planning or state estimation on high degree of freedom robots like arms or mobile manipulators, involve computation of robot kinematics for collision avoidance or computing distance of end effector to goal. Theseus provides a differentiable implementation of forward kinematics by wrapping over Differentiable Robot Model [34], which builds a differentiable kinematics function from a standard robot model file. Gradients are computed through autodiff, while we also provide a more efficient, analytical manipulator Jacobian. This module can be used within any CostFunction in Theseus.
|
| 78 |
+
|
| 79 |
+
# 3.1 Example applications
|
| 80 |
+
|
| 81 |
+
To illustrate the versatility of Theseus, we include a number of example DNLS applications below with more details in App. E. Crucially, to implement these with Theseus, most of the effort is only in defining application-specific components such as data management, neural models, or custom CostFunction. With these defined, putting the full DNLS block together is a few lines of code to setup a TheseusLayer and an outer loop, similar to the simple example in Listing 1.
|
| 82 |
+
|
| 83 |
+
Pose graph optimization (PGO) estimates poses from their noisy relative measurements [60]. With DNLS we learn the radius of a Welsh robust cost function for outlier rejection, using the difference between estimated and ground truth poses as the outer loss on a synthetic dataset.
|
| 84 |
+
|
| 85 |
+
Tactile state estimation follows [28], which estimates 2D poses of an object pushed by a robot hand with an image-based tactile sensor [61]. A neural network that predicts relative pose between hand and object from tactile images is learned end-to-end through the TheseusLayer.
|
| 86 |
+
|
| 87 |
+
Bundle adjustment is the problem of optimizing a 3D reconstruction formed by a set of camera images and a set of landmarks observed and matched across the images [62]. We learn the radius of a soft-kernel that penalizes outlier observations, using the average frame pose error as outer loss.
|
| 88 |
+
|
| 89 |
+
Motion planning considers a differentiable version of the GPMP2 planning algorithm, inspired by [20], where the outer loss tries to match expert demonstrations. Here we learn a model for initializing optimization variables, and we include the inner loop objective as a term in the outer loss.
|
| 90 |
+
|
| 91 |
+
Homography estimation. Homography is a linear transformation between corresponding points in two images and can be solved by minimising a dense photometric loss. Robustness to lighting and viewpoint change can be improved with a feature-metric loss based on CNN features [63–68]. In our outer loop, we train a CNN to produce robust features for image alignment.
|
| 92 |
+
|
| 93 |
+
# 4 Efficiency based design
|
| 94 |
+
|
| 95 |
+
Theseus enables several different applications with a general interface. Compute and memory efficiency are central to making its usage practical. Next, we explain design considerations to support batching and vectorization, sparsity, and backward modes for differentiation, which we demonstrate boost performance in the evaluations section.
|
| 96 |
+
|
| 97 |
+
# 4.1 Batching and vectorization
|
| 98 |
+
|
| 99 |
+
Parallel processing is important to improve computational efficiency in machine learning and optimization. In Theseus, we enable two levels of parallelization. First, Theseus natively supports solving a batch of DNLS in parallel, thus fitting seamlessly in the PyTorch framework, where training and inferences on batches is the standard. Second, inspired by DeepLM [50], and noting that lots of the operations such as costs, gradients/Jacobian computation, and variable
|
| 100 |
+
|
| 101 |
+

|
| 102 |
+
Figure 2: Speedup with automatic vectorization on PGO. Black dotted line is without vectorization.
|
| 103 |
+
|
| 104 |
+
updates only differ from each other in terms of the input data, we make use of the single-instructionmultiple-data (SIMD) protocol by automatically detecting and vectorizing operations of the same type, significantly reducing computation overhead. Using the PGO example, Fig. 2 shows that Theseus achieves significant speedup with automatic vectorization both for forward and backward pass. Note that there is an application-dependent trade-off between memory and speed; here the memory use increases by up to $\sim 8 2 \%$ for forward and $\sim 5 5 \%$ for backward.
|
| 105 |
+
|
| 106 |
+
# 4.2 Handling sparsity with linear solvers beyond PyTorch
|
| 107 |
+
|
| 108 |
+
Solving NLS requires solving a sequence of linear systems to obtain descent directions. As discussed in Sec. 2, these systems are generally sparse and can be solved much more efficiently if not treated as dense. Theseus includes differentiable sparse solvers that take advantage of the sparsity, complementing PyTorch’s native dense solvers. Importantly, Theseus seamlessly takes care of assembling the cost functions and variables in the objective into sparse data structures that our linear solvers can consume, without any extra burden on the user. Currently, we provide three sparse solvers: (i) a CPU-based solver that relies on CHOLMOD [69], (ii) cudaLU, which is based on the cuSolverRF package that is part of Nvidia’s cuSolver library provided with CUDA, and (iii) BaSpaCho, our novel batched sparse Cholesky solver with GPU support. As a bonus feature, we provide access to these solvers as standalone PyTorch functions, so they can be used to solve sparse matrices arising outside of NLS or DNLS optimization.
|
| 109 |
+
|
| 110 |
+
CHOLMOD-based solver. CHOLMOD [69] achieves state-of-the-art performance on computation of the Cholesky decomposition of sparse matrices. It exploits parallelism by grouping sparse entries to take advantage of high-performance multi-threaded dense matrix operations in BLAS/LAPACK libraries. CHOLMOD has some limited support for GPU for some of its operations, but the algorithm is strongly CPU-based, and the user is expected to provide matrix data on the CPU. One convenient feature is computing the symbolic analysis of a sparse matrix pattern as a separate step and creating a symbolic decomposition object that can be used for all subsequent factorizations. We also take advantage of builtin functionality for sparse multiplication and only provide the Jacobian matrix $J$ to solve for the Hessian $H = j ^ { \top } J$ . Two limitations of the library with respect to Theseus are, first, the lack of proper GPU support, which forces us to provide matrix data on the CPU, and, second, the lack of batching, which requires us to loop to solve every problem in the batch independently. On the other hand, since it runs on CPU, it has less memory restrictions than GPU-based solvers (see Sec. 5.1).
|
| 111 |
+
|
| 112 |
+
cudaLU solver. cuSolverRF is designed to accelerate the solution of sets of linear systems by fast LU refactorization when given new coefficients for the same sparsity pattern. To take advantage of this, we implemented custom CUDA kernels for batched sparse matrix-matrix and matrix-vector products, and for solving a batch of sparse linear systems using LU factorization from cuSolverRF. Although this solver leads to a substantial performance boost over PyTorch’s dense solver (see Sec. 5.1), the closed-source nature of cuSOLVER results in some challenges and limitations: (i) cuSolverRF does not support separate symbolic decomposition and numeric contexts, so it’s not possible to use the same symbolic decomposition to hold in memory separate factors. Since this is necessary in Theseus for unrolling of the inner loop, we work around this limitation by creating a pool of contexts, and we use the least recently used context for factorization. As a consequence, the number of contexts must be set according to the number of iterations that need to be unrolled; (ii) The batch size is fixed once a context is created. Since recreating the contexts is an expensive operation, it means that the batch size has to be constant over the course of outer loop optimization; (iii) It relies on LU factorization, which for symmetric matrices (the case of Theseus) is less efficient than using Cholesky decomposition.
|
| 113 |
+
|
| 114 |
+
BaSpaCho solver. Batched Sparse Cholesky (BaSpaCho) is a novel open-source sparse Cholesky solver designed for Theseus with support for batching (https://github.com/facebookresearch/ baspacho). BaSpaCho implements the supernodal Cholesky algorithm [70] to achieve state-of-the art performance by exploiting dense operations via BLAS/cuBLAS. This is achieved by building an elimination tree and then clustering column blocks with similar sparsity patterns. These blocks form nodes of the elimination tree and allow dense operations. In BaSpaCho, the dense operations are dispatched to BLAS (on CPU) or cuBLAS (on GPU), with additional support added on top for batching matrix operations with the same sparsity patterns. In problems with very sparse matrices, like bundle adjustment [8], the supernodal algorithm employed in state-of-the-art solvers [37] is unable to eliminate columns of parameter blocks simultaneously. Thus, past work has resorted to the Schur complement trick [71] to send a reduced problem to the sparse solver. However, this logic adds extra complexity to the nonlinear optimization, while essentially duplicating the work of the (mathematically equivalent) Cholesky decomposition. In BaSpaCho, we instead complement the supernodal algorithm with sparse elimination that removes the need to externally handle Schur complement as a workaround to the limitation of the supernodal algorithm. More details are described in App. F.
|
| 115 |
+
|
| 116 |
+
Backward for custom linear solvers. Obtaining derivatives of the linear system solve with respect to the parameters is a crucial operation for DNLS. In particular, we consider optimizing the parameters $A$ and $b$ of a linear system $y = A ^ { - 1 } b$ to minimize a downstream function $f ( y )$ . The derivatives of the loss with respect to the parameters of the linear system can be obtained with implicit differentiation, $\begin{array} { r } { \frac { \partial f } { \partial b } = A ^ { - 1 } \frac { \partial \mathbf { \bar { f } } } { \partial y } } \end{array}$ and $\begin{array} { r } { \frac { \partial f } { \partial A } = - A ^ { - 1 } \frac { \partial f } { \partial y } y ^ { \top } } \end{array}$ 1 @f@y y>, as done in Barron and Poole [72]. In Theseus, we implement this by connecting the Python interface of our sparse solvers with PyTorch’s autograd.Function classes that implement the gradients above in their backward methods. This connects the computation graph between the downstream function and any upstream parameters that modify the system via auxiliary variables or values for optimization variables. Furthermore, since the gradients require solving linear systems that use the same matrix as the forward pass, our backward pass can cache factorizations, resulting in it being significantly faster than the forward pass (see Fig. 3).
|
| 117 |
+
|
| 118 |
+
# 4.3 Backward modes for DNLS
|
| 119 |
+
|
| 120 |
+
The parameters $\phi$ upstream of DNLS can be learned end-to-end through the solution $\theta ^ { \star } ( \phi )$ by using the adjoint derivatives ${ { \partial \theta ^ { \star } ( \phi ) } / { \partial \phi } }$ . We include four methods for computing them in Theseus.
|
| 121 |
+
|
| 122 |
+
Unrolling is the standard way in which past work in DNLS has computed the adjoint derivatives. This is often referred to as backpropagation through time or unrolled optimization and is explored in [16, 20, 73–82]. In practice, often only a few steps of unrolling are performed due to challenges with compute, memory, and vanishing gradients.
|
| 123 |
+
|
| 124 |
+
Truncated differentiation. Aside from unrolling a few steps, another way of approximating the derivatives is to use truncated backpropagation through time (TBPTT) [83, 84]. Truncation unfortunately results in biased derivatives and many works [85–89] seek to further theoretically understand the properties of TBPTT, including the bias of the estimator and how to unbias it.
|
| 125 |
+
|
| 126 |
+
Implicit differentiation. If $\theta ^ { \star }$ can be computed exactly, then the implicit function theorem provides a way of computing the adjoint derivatives, as done in related work in convex optimization and first-order gradient descent methods [14, 15, 90–95]. We apply the implicit function theorem from Dontchev and Rockafellar [39, Theorem 1B.1] (see App. H) to Eq. (2) to perform implicit differentiation on a new class of second-order NLS optimization. This first requires that we transform Eq. (2) into an implicit function that finds the roots. We do this via the first-order optimality condition, resulting in $\bar { g } ( \theta ; \phi ) : = \nabla _ { \theta } S ( \theta ; \phi )$ . Finding $\Theta ^ { \star } ( \phi ) : = \{ \theta \mid g ( \theta ; \phi ) = 0 \}$ corresponds to solving Eq. (2). Under mild assumptions, the theorem above gives the adjoint derivative at $\bar { \phi }$
|
| 127 |
+
|
| 128 |
+
$$
|
| 129 |
+
\mathrm { D } _ { \phi } \theta ^ { \star } ( \bar { \phi } ) = - \mathrm { D } _ { \theta } ^ { - 1 } g ( \theta ^ { \star } ( \bar { \phi } ) ; \bar { \phi } ) \mathrm { D } _ { \phi } g ( \theta ^ { \star } ( \bar { \phi } ) ; \bar { \phi } ) .
|
| 130 |
+
$$
|
| 131 |
+
|
| 132 |
+
As Theseus internally uses a (Gauss-)Newton solver, the following proposition provided in App. H shows how we can compute Eq. (3) by differentiating a single Newton step at an optimal solution.
|
| 133 |
+
|
| 134 |
+
Proposition 1. The implicit derivative (Eq. (3)) can be computed by differentiating a Newton step $\bar { h ( \theta ; \phi ) } : = \theta - [ \nabla _ { \theta } ^ { 2 } S ( \hat { \theta } ; \phi ) ] _ { \mathrm { { s t o p } } } ^ { - 1 } \nabla _ { \theta } S ( \theta ; \phi )$ at an optimal $\theta ^ { \star }$ , where $[ \cdot ] _ { \mathrm { s t o p } }$ zeros the derivative.
|
| 135 |
+
|
| 136 |
+

|
| 137 |
+
Figure 3: Forward/backward times of Theseus with sparse and dense solvers on different PGO problem scales.
|
| 138 |
+
|
| 139 |
+
Direct loss minimization. Suppose we have an outer loss as in Eq. (2). The direct loss minimization (DLM) approach uses this loss to augment the inner-loop optimization problem in order to define a finite difference scheme that approaches the true gradient $\begin{array} { r } { \nabla _ { \phi } L = \operatorname* { l i m } _ { \varepsilon \to 0 } g _ { \mathrm { D L M } } ^ { \varepsilon } } \end{array}$ , where $g _ { \mathrm { D L M } } ^ { \varepsilon } \triangleq$ $\begin{array} { r } { \frac { 1 } { \varepsilon } \{ \frac { \partial } { \partial \phi } S ( \theta ^ { * } ; \phi ) - \frac { \partial } { \partial \phi } S ( \theta _ { \mathrm { d i r e c t } } ; \phi ) \} } \end{array}$ ! . This was used in prior works that solve optimization problems on structured discrete domains [40, 41, 96, 97], but has so far not seen much use in structured continuous settings. We modify the original DLM formulation to better suit its implementation within Theseus
|
| 140 |
+
|
| 141 |
+
$$
|
| 142 |
+
\begin{array} { r l } { \theta ^ { \star } = \underset { \hat { \theta } } { \arg \operatorname* { m i n } } S ( \hat { \theta } ; \phi ) , \quad } & { \theta _ { \mathrm { d i r e c t } } = \underset { \hat { \theta } } { \arg \operatorname* { m i n } } S ( \hat { \theta } ; \phi ) + \left\| \varepsilon \hat { \theta } - \frac { 1 } { 2 } \nabla _ { \theta } L ( \theta ^ { * } ) \right\| ^ { 2 } . } \end{array}
|
| 143 |
+
$$
|
| 144 |
+
|
| 145 |
+
This is different from the original formulation in two ways: (i) we only assume access to the gradient vector $\nabla _ { { \boldsymbol { \theta } } } L ( { \boldsymbol { \theta } } ^ { * } )$ , which helps formulate DLM as an algorithm for computing vector-Jacobian products, and (ii) we add a small regularization term to ensure the modified objective for $\theta _ { \mathrm { d i r e c t } }$ is a sum-of-squares without affecting the limit as $\varepsilon \to 0$ . See App. H for more details.
|
| 146 |
+
|
| 147 |
+
# 5 Evaluation
|
| 148 |
+
|
| 149 |
+
We evaluate the performance of Theseus under different settings with PGO and tactile state estimation applications from Sec. 3.1. PGO allows us to easily control the problem scales for performance evaluation; in Sec. 5.1 we profile time and memory consumption of Theseus in an end-to-end setup and in Sec. 5.2 we evaluate timings of Theseus as a stand-alone NLS optimizer and compare with state-of-the-art Ceres [37]. The tactile state estimation application involves a more complex outer loop model that is useful for comparing all different backward modes, which we present in Sec. 5.3.
|
| 150 |
+
|
| 151 |
+
# 5.1 Profiling forward and backward pass of Theseus for DNLS
|
| 152 |
+
|
| 153 |
+
We study the performance of Theseus for DNLS on the PGO problem [60] with the synthetic Cube dataset, as described in App. E. We run 10 inner loop iterations and 20 outer loop epochs, and use implicit differentiation to compute gradients of the inner NLS optimization. For these experiments we used an Nvidia V100 GPU with 32GBs of memory for all Python computation, and Intel Xeon 2.2GHz CPU with 20 threads for the CPU-based CHOLMOD linear solver. We evaluate performance using our sparse solvers in Theseus and using PyTorch’s Cholesky dense solver.
|
| 154 |
+
|
| 155 |
+
Fig. 3 shows the average time of a full forward and backward pass for a given batch size, taken by Theseus with different solvers (cudaLU, CHOLMOD, BaSpaCho and dense), for different problem scales (number of poses and batch size). The two left plots show time as a function of number of poses for a batch size of 128, while the two right plots show time as a function of batch size for 2048 poses. We find that dense does not scale well with poses or batch size. For a batch size of 128, the largest problem that it can solve before running out of GPU memory has 256 poses (left two plots). With 2048 poses, dense is unable to solve the problem regardless of batch size (right two plots). On the other hand with a batch size of 128, our solvers BaSpaCho scale to 2048 poses and cudaLU scale to 4096 poses. CHOLMOD can solve problems even larger, since the linear system is solved on CPU and we have successfully tested up to 8192 poses and batch size 256 (see App. G), for a total of 22GBs of GPU usage for residuals and Jacobian blocks computation.
|
| 156 |
+
|
| 157 |
+
In addition to being more memory efficient, running times of our sparse solvers are also smaller for large enough number of poses/batch size, especially for the backward pass. Even though dense’s total time for forward+backward is comparable to cudaLU and faster than CHOLMOD for smaller problems: e.g., 1.47s (dense) vs. 1.32s (cudaLU) and 2.82s (CHOLMOD) for batch size 128 and 64 poses, dense is significantly slower or out of memory for larger problems. For the largest problem that dense can solve (batch size 128 and 256 poses) its total time is already much slower than all others methods:
|
| 158 |
+
|
| 159 |
+
20.81s (dense) vs. 10.96s (CHOLMOD), 2.86s (cudaLU), and 2.25s (BaSpaCho). Furthermore, BaSpaCho outperforms dense for any problem scale and is up to one order of magnitude faster, including for smaller batch sizes and number of poses (see App. G for more results and details). For the largest problem that we consider (batch size 256 and 2048 poses), the total times for our sparse solvers are 170.28s for cudaLU, 239.07s for CHOLMOD, and 57.67s for BaSpaCho.
|
| 160 |
+
|
| 161 |
+
# 5.2 Profiling Theseus as stand-alone NLS optimizer
|
| 162 |
+
|
| 163 |
+
DNLS typically involves solving numerous optimization problems each epoch where a fast NLS optimizer is essential. We compare Theseus as a stand-alone NLS optimizer with the state-of-the-art Ceres [37] library for solving a batch of PGO problems without any learning involved. We compare all solvers in terms of the total time required to perform 10 iterations on a set of 256 PGO problems. CPU/GPU configurations are same as before. For CHOLMOD, we also include a configuration that runs everything on CPU, including Jacobians and residual computation (labelled CHOLMOD-allcpu).
|
| 164 |
+
|
| 165 |
+
Fig. 4 shows speedup obtained by Theseus with batching, vectorization and sparse solvers, over Ceres as a function of increasing number of poses or batch size. We vary the number of poses for a fixed batch size of 256, and vary the batch size for a fixed number of poses of 2048. Although Ceres is faster than all of our solvers when the number of poses and batch size are small (for instance, Ceres is $2 5 \mathrm { x }$ faster with 256 poses and 16 batch size, see App. G), as these increase Theseus shows signif
|
| 166 |
+
|
| 167 |
+

|
| 168 |
+
Figure 4: Speedup of Theseus (forward pass) over Ceres (black dashed) on different PGO problem scales.
|
| 169 |
+
|
| 170 |
+
icant speedup by being able to solve larger batches of problems in parallel. For the largest setup that all our solvers can scale to (2048 poses, 256 batch size), BaSpaCho is ${ \sim } 2 3 \mathbf { x }$ faster than Ceres, and our other solvers are ${ \sim } 4 \mathbf { x }$ faster. CHOLMOD has a 6x speedup for its largest setting (4096 poses, 256 batch size).
|
| 171 |
+
|
| 172 |
+
Since typical use case of Theseus involves large batches and number of variables during end-to-end learning with DNLS, the speedups in this setting against a performant NLS solver highlights the significance of our efficiency-based design choices. See App. G for additional results of smaller fixed batch size and number of poses.
|
| 173 |
+
|
| 174 |
+
# 5.3 Backward modes analysis
|
| 175 |
+
|
| 176 |
+
We explore the trade-offs between our different backward modes using the tactile state estimation application in Sec. 3.1. The learnable components here include a neural network, and thus closely follow the type of applications that motivate Theseus. We compare the following backward modes: derivative unrolling (Unroll), implicit differentiation (Implicit), truncated differentiation (Trunc), and direct loss minimization (DLM); for Trunc we include results when truncating 5 and 10 steps. We compare all modes along 3 axis of performance: validation loss after 100 epochs (outer loop), run time during training, and peak GPU memory consumption of TheseusLayer. For these experiments we used Quadro GP100 GPUs with 16GB of memory. For time and memory we present separate results for forward and backward pass, and all numbers are averaged over 700 (7 batches for 100 epochs). Below we discuss our main findings from this analysis, and more results and details can be found in App. H.
|
| 177 |
+
|
| 178 |
+
Fig. 5 shows average run times for all backward modes as a function of the maximum number of iterations in the inner loop optimization. We observe that the time used in the forward pass (Fig. 5, far left) increases roughly linearly for all modes, all having similar times except for Unroll, which is slower than other modes. On the other hand, we observe stark differences in the backward pass time (Fig. 5, center left), where Unroll is the only method that has a linear dependence on the number of inner loop iterations. All other methods have a constant footprint for computing derivatives, independent of the number of inner loop iterations. As expected, increasing the number of iterations through which we backprop (5 or 10 for Trunc, all iterations for Unroll) increases the time necessary for a backward pass $( \mathtt { I m p l i c i t } = \mathtt { D L M } < \mathtt { T r u n c - 5 } < \mathtt { T r u n c - 1 } \theta < < \mathtt { U n r o l 1 } )$ .
|
| 179 |
+
|
| 180 |
+
Figure 5 (center right) shows the average peak memory consumption of the backward modes. In this case, the trends observed for the backward pass memory consumption is similar to the trends in time. In particular, Unroll’s memory footprint increases linearly with the number of inner loop iterations, from $\mathrm { \sim 3 4 M B s }$ to $\sim \mathrm { 2 6 2 M B s }$ ; for all other methods the memory consumption remains constant. The best memory profiles in this example is obtained with Implicit and DLM backward modes, with $\sim \mathrm { 2 8 M B s }$ and $\sim \mathrm { 2 9 M B s }$ , respectively. These trends also hold for the forward pass memory consumption.
|
| 181 |
+
|
| 182 |
+

|
| 183 |
+
Figure 5: Time and memory consumption of different backward modes in tactile state estimation.
|
| 184 |
+
|
| 185 |
+
Figure 5 also shows the validation losses obtained with all backward modes (far right). The best validation loss, after 100 epochs of training, is obtained using Implicit, followed by Trunc variants. We notice that both variants of Trunc keep improving with increasing number of inner loop iterations, and that Unroll and Implicit achieve the best results with 20 iterations. One exception is DLM, which doesn’t improve much with the number of iterations, but is also the best method when only 2 inner loop iterations are performed. As a point of caution, we stress that, unlike the timing and memory results, the relative training performance between different backward modes is likely to be application dependent, and is affected by hyperparameters such as the step size used for the inner loop optimizer (0.05 in this example), and the outer optimizer’s learning rate. Our experiments suggest that implicit differentiation is a good default to use for differentiable optimization, considering its low time/memory footprint, and potential for better end-to-end performance with proper hyperparameter tuning.
|
| 186 |
+
|
| 187 |
+
# 6 Discussion
|
| 188 |
+
|
| 189 |
+
Summary. Theseus provides nonlinear least squares as a differentiable layer and enables easily building and training end-to-end architectures for robotics and vision applications. We illustrate several example applications using the same application-agnostic interface and demonstrate significant improvements in performance with our efficiency-based design. Following how autodiff and GPU acceleration (among others) have led to the evolution of PyTorch in contrast to NumPy [98], we can similarly view sparsity and implicit differentiation on top of autodiff and GPU acceleration as the key ingredients that power Theseus, in contrast to solvers like Ceres that typically only support sparsity. When solving a batch of large problems the forward pass of Theseus is up to $2 0 \mathrm { x }$ faster than Ceres.
|
| 190 |
+
|
| 191 |
+
Limitations. Theseus currently has a few limitations. The nonlinear solvers we currently support apply constraints in a soft manner (i.e., using weighted costs). Hard constraints can be handled with methods like augmented Lagrangian or sequential quadratic programs [99, 100], and differentiating through them are active research topics. The current implementation of LM does not support damping to be learnable. Some limitations and trade-offs with the sparse linear solvers are discussed in Sec. 4.2, and with backward modes are discussed in App. H. Online learning applications may require frequently editing the objective and depending on the problem size there may be a nontrivial overhead that is not currently optimized as we explored only non-incremental settings in this work. Additional performance gains can be extracted by moving some of our Python implementation to $\mathrm { C } { + } { + }$ but we prioritized flexibility in evolving the API in the short-term. We do not yet support distributed training beyond what PyTorch natively supports. We will explore these features and optimizations in the future as the library continues to evolve.
|
| 192 |
+
|
| 193 |
+
# Acknowledgments and Disclosure of Funding
|
| 194 |
+
|
| 195 |
+
The authors would like to thank Dhruv Batra, Olivier Delalleau, Jessica Hodgins, and Mary Williamson for guidance and support on the project, Dhruv Batra and Sal Candido for feedback on early drafts of the paper, Franziska Meier for help with the differentiable robot model library, Paul-Edouard Sarlin for helpful discussion on the homography example, Horace He, Richard Zou and Samantha Andow for help with functorch [101] library, Terran Washington, Gopika Jhala and Chantal Mora for designing the Theseus logo, and Oliver Libaw, Christine Gibson, Orialis Valentin, Alyssa Newcomb and Eric Kaplan for help with the blog post. The authors also thank community members for contributions to the open source code. Work by PS and JO was done while at Meta AI.
|
| 196 |
+
|
| 197 |
+
References [1] Jorge Nocedal and Stephen Wright. Numerical optimization. Springer Science & Business Media, 2006. 1, 2, 3 [2] Christian Forster, Luca Carlone, Frank Dellaert, and Davide Scaramuzza. On-manifold preintegration for real-time visual–inertial odometry. IEEE Transactions on Robotics, 33(1): 1–21, 2016. 1, 3 [3] Frank Dellaert, Michael Kaess, et al. Factor graphs for robot perception. Foundations and Trends® in Robotics, 6(1-2):1–139, 2017. 3 [4] Timothy D. Barfoot. State estimation for robotics. State Estimation for Robotics, 2017. doi: 10.1017/9781316671528. 3 [5] Mustafa Mukadam, Jing Dong, Xinyan Yan, Frank Dellaert, and Byron Boots. Continuoustime gaussian process motion planning via probabilistic inference. The International Journal of Robotics Research, 37(11):1319–1340, 2018. 3, 22, 23 [6] Mandy Xie and Frank Dellaert. A unified method for solving inverse, forward, and hybrid manipulator dynamics using factor graphs. arXiv preprint arXiv:1911.10065, 2019. 3 [7] Antoni Rosinol, Marcus Abate, Yun Chang, and Luca Carlone. Kimera: an open-source library for real-time metric-semantic localization and mapping. In 2020 IEEE International Conference on Robotics and Automation (ICRA), pages 1689–1696. IEEE, 2020. 1, 3 [8] Bill Triggs, Philip F McLauchlan, Richard I Hartley, and Andrew W Fitzgibbon. Bundle adjustment—a modern synthesis. In International workshop on vision algorithms, pages 298–372. Springer, 1999. 1, 3, 7, 22 [9] Hanna Pasula, Stuart Russell, Michael Ostland, and Yaacov Ritov. Tracking many objects with many sensors. In IJCAI, volume 99, pages 1160–1171. Citeseer, 1999.
|
| 198 |
+
[10] Richard Szeliski and Sing Bing Kang. Recovering 3d shape and motion from image streams using nonlinear least squares. Journal of Visual Communication and Image Representation, 5 (1):10–28, 1994. 3
|
| 199 |
+
[11] Aleksandr Segal, Dirk Haehnel, and Sebastian Thrun. Generalized-icp. In Robotics: science and systems, volume 2, page 435. Seattle, WA, 2009.
|
| 200 |
+
[12] Tanner Schmidt, Richard A Newcombe, and Dieter Fox. Dart: Dense articulated real-time tracking. In Robotics: Science and Systems, volume 2, pages 1–9. Berkeley, CA, 2014. 3
|
| 201 |
+
[13] Johannes L Schonberger and Jan-Michael Frahm. Structure-from-motion revisited. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 4104–4113, 2016. 1, 3
|
| 202 |
+
[14] Brandon Amos and J Zico Kolter. Optnet: Differentiable optimization as a layer in neural networks. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pages 136–145. JMLR. org, 2017. 1, 7
|
| 203 |
+
[15] Akshay Agrawal, Brandon Amos, Shane Barratt, Stephen Boyd, Steven Diamond, and J Zico Kolter. Differentiable convex optimization layers. In Advances in Neural Information Processing Systems, pages 9558–9570, 2019. 1, 7
|
| 204 |
+
[16] Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In International conference on machine learning, pages 1126– 1135. PMLR, 2017. 1, 7
|
| 205 |
+
[17] Edward Grefenstette, Brandon Amos, Denis Yarats, Phu Mon Htut, Artem Molchanov, Franziska Meier, Douwe Kiela, Kyunghyun Cho, and Soumith Chintala. Generalized inner loop meta-learning. arXiv preprint arXiv:1910.01727, 2019. 1
|
| 206 |
+
|
| 207 |
+
[18] David Duvenaud, Zico Kolter, and Matthew Johnson. Deep Implicit Layers: Neural ODEs, Equilibrium Models, and Differentiable Optimization. http://implicit-layers-tutorial. org/, 2020. 1
|
| 208 |
+
|
| 209 |
+
[19] Zachary Teed and Jia Deng. Deepv2d: Video to depth with differentiable structure from motion. arXiv preprint arXiv:1812.04605, 2018. 2, 3
|
| 210 |
+
|
| 211 |
+
[20] Mohak Bhardwaj, Byron Boots, and Mustafa Mukadam. Differentiable gaussian process motion planning. In 2020 IEEE International Conference on Robotics and Automation (ICRA), pages 10598–10604. IEEE, 2020. 2, 3, 5, 7, 22
|
| 212 |
+
|
| 213 |
+
[21] Krishna Murthy Jatavallabhula, Ganesh Iyer, and Liam Paull. $\nabla$ slam: Dense slam meets automatic differentiation. In 2020 IEEE International Conference on Robotics and Automation (ICRA), pages 2130–2137. IEEE, 2020. 2, 3
|
| 214 |
+
|
| 215 |
+
[22] Zachary Teed and Jia Deng. Droid-slam: Deep visual slam for monocular, stereo, and rgb-d cameras. Advances in Neural Information Processing Systems, 34, 2021. 2, 3
|
| 216 |
+
|
| 217 |
+
[23] Chengzhou Tang and Ping Tan. BA-Net: Dense bundle adjustment networks. 7th International Conference on Learning Representations, ICLR 2019, 2019. 2, 3
|
| 218 |
+
|
| 219 |
+
[24] Brent Yi, Michelle A Lee, Alina Kloss, Roberto Martín-Martín, and Jeannette Bohg. Differentiable factor graph optimization for learning smoothers. In 2021 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pages 1339–1345. IEEE, 2021. 2, 3, 5 [25] Hansheng Chen, Pichao Wang, Fan Wang, Wei Tian, Lu Xiong, and Hao Li. Epro-pnp: Generalized end-to-end probabilistic perspective-n-points for monocular object pose estimation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 2781–2790, 2022. 2
|
| 220 |
+
|
| 221 |
+
[26] Zhaoyang Lv, Frank Dellaert, James M Rehg, and Andreas Geiger. Taking a deeper look at the inverse compositional algorithm. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 4581–4590, 2019. 2, 3
|
| 222 |
+
|
| 223 |
+
[27] Ross Hartley, Maani Ghaffari Jadidi, Lu Gan, Jiunn-Kai Huang, Jessy W Grizzle, and Ryan M Eustice. Hybrid contact preintegration for visual-inertial-contact state estimation using factor graphs. In 2018 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pages 3783–3790. IEEE, 2018. 2, 3
|
| 224 |
+
|
| 225 |
+
[28] Paloma Sodhi, Michael Kaess, Mustafa Mukadam, and Stuart Anderson. Learning tactile models for factor graph-based estimation. In 2021 IEEE International Conference on Robotics and Automation (ICRA), pages 13686–13692. IEEE, 2021. 2, 3, 5, 21, 22
|
| 226 |
+
|
| 227 |
+
[29] Markus Giftthaler, Michael Neunert, Markus Stäuble, Jonas Buchli, and Moritz Diehl. A family of iterative gauss-newton shooting methods for nonlinear optimal control. In 2018 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pages 1–9. IEEE, 2018. 2, 3
|
| 228 |
+
|
| 229 |
+
[30] Federica Bogo, Angjoo Kanazawa, Christoph Lassner, Peter Gehler, Javier Romero, and Michael J Black. Keep it smpl: Automatic estimation of 3d human pose and shape from a single image. In European conference on computer vision, pages 561–578. Springer, 2016. 2, 3
|
| 230 |
+
|
| 231 |
+
[31] Taosha Fan, Kalyan Vasudev Alwala, Donglai Xiang, Weipeng Xu, Todd Murphey, and Mustafa Mukadam. Revitalizing optimization for 3d human pose and shape estimation: A sparse constrained formulation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 11457–11466, 2021. 2, 3
|
| 232 |
+
|
| 233 |
+
[32] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems, 32:8026–8037, 2019. 2
|
| 234 |
+
|
| 235 |
+
[33] Joan Solà, Jeremie Deray, and Dinesh Atchuthan. A micro Lie theory for state estimation in robotics. arXiv, pages 1–17, 2018. URL http://arxiv.org/abs/1812.01537. 2, 5
|
| 236 |
+
|
| 237 |
+
[34] Franziska Meier, Austin Wang, Giovanni Sutanto, Yixin Lin, and Paarth Shah. Differentiable and learnable robot models. arXiv preprint arXiv:2202.11217, 2022. 2, 5
|
| 238 |
+
|
| 239 |
+
[35] Giorgio Grisetti, Rainer Kümmerle, Hauke Strasdat, and Kurt Konolige. g2o: A general framework for (hyper) graph optimization. In Proceedings of the IEEE International Conference on Robotics and Automation (ICRA), pages 9–13, 2011. 2, 3, 21
|
| 240 |
+
|
| 241 |
+
[36] Frank Dellaert. Factor graphs and gtsam: A hands-on introduction. Technical report, Georgia Institute of Technology, 2012.
|
| 242 |
+
|
| 243 |
+
[37] Sameer Agarwal and Keir Mierle. Ceres solver: Tutorial & reference. Google Inc, 2(72):8, 2012. 7, 8, 9, 21
|
| 244 |
+
|
| 245 |
+
[38] Jing Dong and Zhaoyang Lv. miniSAM: A flexible factor graph non-linear least squares optimization framework. CoRR, abs/1909.00903, 2019. URL http://arxiv.org/abs/1909. 00903. 2, 3
|
| 246 |
+
|
| 247 |
+
[39] Asen L Dontchev and R Tyrrell Rockafellar. Implicit functions and solution mappings, volume 543. Springer, 2009. 2, 7, 26
|
| 248 |
+
|
| 249 |
+
[40] Tamir Hazan, Joseph Keshet, and David McAllester. Direct loss minimization for structured prediction. Advances in neural information processing systems, 23, 2010. 2, 8
|
| 250 |
+
|
| 251 |
+
[41] Yang Song, Alexander Schwing, Raquel Urtasun, et al. Training deep neural networks via direct loss minimization. In International conference on machine learning, pages 2169–2177. PMLR, 2016. 2, 8, 27
|
| 252 |
+
|
| 253 |
+
[42] Frank Dellaert and Michael Kaess. Square root sam: Simultaneous localization and mapping via square root information smoothing. The International Journal of Robotics Research, 25 (12):1181–1203, 2006. 3
|
| 254 |
+
|
| 255 |
+
[43] Carl T Kelley. Iterative methods for optimization. SIAM, 1999. 3 [44] Edgar Sucar, Kentaro Wada, and Andrew Davison. NodeSLAM: Neural Object Descriptors for Multi-View Shape Reconstruction. Proceedings - 2020 International Conference on 3D Vision, 3DV 2020, pages 949–958, 2020. doi: 10.1109/3DV50981.2020.00105. 3
|
| 256 |
+
|
| 257 |
+
[45] Michael Bloesch, Jan Czarnowski, Ronald Clark, Stefan Leutenegger, and Andrew J Davison. Codeslam—learning a compact, optimisable representation for dense visual slam. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2560–2568, 2018. 3
|
| 258 |
+
|
| 259 |
+
[46] Jan Czarnowski, Tristan Laidlow, Ronald Clark, and Andrew J. Davison. DeepFactors: RealTime Probabilistic Dense Monocular SLAM. IEEE Robotics and Automation Letters, 5(2): 721–728, 2020. doi: 10.1109/LRA.2020.2965415. 3
|
| 260 |
+
|
| 261 |
+
[47] Muhammad Asif Rana, Mustafa Mukadam, Seyed Reza Ahmadzadeh, Sonia Chernova, and Byron Boots. Towards robust skill generalization: Unifying learning from demonstration and motion planning. In Conference on Robot Learning, pages 109–118. PMLR, 2017. 3
|
| 262 |
+
|
| 263 |
+
[48] Ronald Clark, Michael Bloesch, Jan Czarnowski, Stefan Leutenegger, and Andrew J Davison. Ls-net: Learning to solve nonlinear least squares for monocular stereo. arXiv preprint arXiv:1809.02966, 2018. 3
|
| 264 |
+
|
| 265 |
+
[49] Barbara Roessle and Matthias Nießner. End2end multi-view feature matching using differentiable pose optimization. arXiv preprint arXiv:2205.01694, 2022. 3
|
| 266 |
+
|
| 267 |
+
[50] Jingwei Huang, Shan Huang, and Mingwei Sun. Deeplm: Large-scale nonlinear least squares on deep learning frameworks using stochastic domain decomposition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10308–10317, 2021. 3, 6
|
| 268 |
+
|
| 269 |
+
[52] Jonathan T Barron. A general and adaptive robust loss function. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 4331–4339, 2019. 5
|
| 270 |
+
|
| 271 |
+
[53] Valentin Peretroukhin, Matthew Giamou, David M Rosen, W Nicholas Greene, Nicholas Roy, and Jonathan Kelly. A smooth representation of belief over so (3) for deep rotation learning with uncertainty. Robotics: Science and Systems, 2020. 5
|
| 272 |
+
|
| 273 |
+
[54] Zachary Teed and Jia Deng. Tangent Space Backpropagation for 3D Transformation Groups. Proceedings of the IEEE Computer Society Conference on Computer Vision and Pattern Recognition, pages 10333–10342, 2021. doi: 10.1109/CVPR46437.2021.01020. URL http: //arxiv.org/abs/2103.12032. 5
|
| 274 |
+
|
| 275 |
+
[55] Yi Zhou, Connelly Barnes, Jingwan Lu, Jimei Yang, and Hao Li. On the continuity of rotation representations in neural networks. Proceedings of the IEEE Computer Society Conference on Computer Vision and Pattern Recognition, 2019-June:5738–5746, 2019. doi: 10.1109/CVPR.2019.00589.
|
| 276 |
+
|
| 277 |
+
[56] Congyue Deng, Or Litany, Yueqi Duan, Adrien Poulenard, Andrea Tagliasacchi, and Leonidas J Guibas. Vector neurons: A general framework for so (3)-equivariant networks. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 12200–12209, 2021.
|
| 278 |
+
|
| 279 |
+
[57] Philippe Hansen-Estruch, Wenling Shang, Lerrel Pinto, Pieter Abbeel, and Stas Tiomkin. Gem: Group enhanced model for learning dynamical control systems. arXiv preprint arXiv:2104.02844, 2021. 5
|
| 280 |
+
|
| 281 |
+
[58] P-A Absil, Robert Mahony, and Rodolphe Sepulchre. Optimization algorithms on matrix manifolds. Princeton University Press, 2009. 5, 20, 21
|
| 282 |
+
|
| 283 |
+
[59] Brent Yi. jaxlie. https://github.com/brentyi/jaxlie, 2021. 5 [60] D.M. Rosen, L. Carlone, A.S. Bandeira, and J.J. Leonard. SE-Sync: A certifiably correct algorithm for synchronization over the special Euclidean group. Intl. J. of Robotics Research, 38(2–3):95–125, March 2019. 5, 8, 21
|
| 284 |
+
|
| 285 |
+
[61] Mike Lambeta, Po-Wei Chou, Stephen Tian, Brian Yang, Benjamin Maloon, Victoria Rose Most, Dave Stroud, Raymond Santos, Ahmad Byagowi, Gregg Kammerer, et al. Digit: A novel design for a low-cost compact high-resolution tactile sensor with application to in-hand manipulation. IEEE Robotics and Automation Letters, 5(3):3838–3845, 2020. 5, 21
|
| 286 |
+
|
| 287 |
+
[62] Sameer Agarwal, Noah Snavely, Steven M Seitz, and Richard Szeliski. Bundle adjustment in the large. In European conference on computer vision, pages 29–42. Springer, 2010. 5, 22 [63] Jan Czarnowski, Stefan Leutenegger, and Andrew J. Davison. Semantic texture for robust dense tracking. In Proceedings of the IEEE International Conference on Computer Vision (ICCV) Workshops, Oct 2017. 5, 23
|
| 288 |
+
|
| 289 |
+
[64] Jing Dong, Byron Boots, Frank Dellaert, Ranveer Chandra, and Sudipta Sinha. Learning to align images using weak geometric supervision. In 2018 International Conference on 3D Vision (3DV), pages 700–709. IEEE, 2018.
|
| 290 |
+
|
| 291 |
+
[65] Chengzhou Tang and Ping Tan. BA-Net: Dense Bundle Adjustment Network. In ICLR, 2019.
|
| 292 |
+
|
| 293 |
+
[66] Paul-Edouard Sarlin, Ajaykumar Unagar, Måns Larsson, Hugo Germain, Carl Toft, Viktor Larsson, Marc Pollefeys, Vincent Lepetit, Lars Hammarstrand, Fredrik Kahl, and Torsten Sattler. Back to the Feature: Learning robust camera localization from pixels to pose. In CVPR, 2021. URL https://arxiv.org/abs/2103.09213.
|
| 294 |
+
|
| 295 |
+
[67] Zhaoyang Lv, Frank Dellaert, James Rehg, and Andreas Geiger. Taking a deeper look at the inverse compositional algorithm. In CVPR, 2019.
|
| 296 |
+
|
| 297 |
+
[68] Chaoyang Wang, Hamed Kiani Galoogahi, Chen-Hsuan Lin, and Simon Lucey. Deep-lk for efficient adaptive object tracking. 2018 IEEE International Conference on Robotics and Automation (ICRA), pages 627–634, 2018. 5
|
| 298 |
+
[69] Yanqing Chen, Timothy A Davis, William W Hager, and Sivasankaran Rajamanickam. Algorithm 887: Cholmod, supernodal sparse cholesky factorization and update/downdate. ACM Transactions on Mathematical Software (TOMS), 35(3):1–14, 2008. 6
|
| 299 |
+
[70] Esmond $\mathrm { N g }$ and Barry W Peyton. A supernodal cholesky factorization algorithm for sharedmemory multiprocessors. SIAM Journal on scientific computing, 14(4):761–769, 1993. 7, 23
|
| 300 |
+
[71] Fuzhen Zhang. The Schur complement and its applications, volume 4. Springer Science & Business Media, 2006. 7
|
| 301 |
+
[72] Jonathan T Barron and Ben Poole. The fast bilateral solver. In European conference on computer vision, pages 617–632. Springer, 2016. 7
|
| 302 |
+
[73] Barak A Pearlmutter and Jeffrey Mark Siskind. Reverse-mode ad in a functional framework: Lambda the ultimate backpropagator. ACM Transactions on Programming Languages and Systems (TOPLAS), 30(2):1–36, 2008. 7
|
| 303 |
+
[74] Chongjie Zhang and Victor Lesser. Multi-agent learning with policy prediction. In Twentyfourth AAAI conference on artificial intelligence, 2010.
|
| 304 |
+
[75] Dougal Maclaurin, David Duvenaud, and Ryan Adams. Gradient-based hyperparameter optimization through reversible learning. In International conference on machine learning, pages 2113–2122. PMLR, 2015.
|
| 305 |
+
[76] David Belanger and Andrew McCallum. Structured prediction energy networks. In International Conference on Machine Learning, pages 983–992, 2016.
|
| 306 |
+
[77] Luke Metz, Ben Poole, David Pfau, and Jascha Sohl-Dickstein. Unrolled generative adversarial networks. CoRR, abs/1611.02163, 2016. URL http://arxiv.org/abs/1611.02163.
|
| 307 |
+
[78] Tian Han, Yang Lu, Song-Chun Zhu, and Ying Nian Wu. Alternating back-propagation for generator network. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 31, 2017.
|
| 308 |
+
[79] David Belanger, Bishan Yang, and Andrew McCallum. End-to-end learning for structured prediction energy networks. In Proceedings of the 34th International Conference on Machine Learning-Volume 70, pages 429–439. JMLR. org, 2017.
|
| 309 |
+
[80] David Belanger. Deep energy-based models for structured prediction. PhD thesis, University of Massachusetts Amherst, 2017.
|
| 310 |
+
[81] Jakob N Foerster, Richard Y Chen, Maruan Al-Shedivat, Shimon Whiteson, Pieter Abbeel, and Igor Mordatch. Learning with opponent-learning awareness. arXiv preprint arXiv:1709.04326, 2017.
|
| 311 |
+
[82] Vishal Monga, Yuelong Li, and Yonina C Eldar. Algorithm unrolling: Interpretable, efficient deep learning for signal and image processing. IEEE Signal Processing Magazine, 38(2): 18–44, 2021. 7
|
| 312 |
+
[83] Paul J Werbos. Backpropagation through time: what it does and how to do it. Proceedings of the IEEE, 78(10):1550–1560, 1990. 7
|
| 313 |
+
[84] Herbert Jaeger. Tutorial on training recurrent neural networks, covering BPPT, RTRL, EKF and the" echo state network" approach, volume 5. GMD-Forschungszentrum Informationstechnik Bonn, 2002. 7
|
| 314 |
+
[85] Corentin Tallec and Yann Ollivier. Unbiasing truncated backpropagation through time. arXiv preprint arXiv:1705.08209, 2017. 7
|
| 315 |
+
|
| 316 |
+
[86] Yuhuai Wu, Mengye Ren, Renjie Liao, and Roger Grosse. Understanding short-horizon bias in stochastic meta-optimization. arXiv preprint arXiv:1803.02021, 2018.
|
| 317 |
+
|
| 318 |
+
[87] Renjie Liao, Yuwen Xiong, Ethan Fetaya, Lisa Zhang, KiJung Yoon, Xaq Pitkow, Raquel Urtasun, and Richard Zemel. Reviving and improving recurrent back-propagation. In International Conference on Machine Learning, pages 3082–3091. PMLR, 2018.
|
| 319 |
+
|
| 320 |
+
[88] Amirreza Shaban, Ching-An Cheng, Nathan Hatch, and Byron Boots. Truncated backpropagation for bilevel optimization. In The 22nd International Conference on Artificial Intelligence and Statistics, pages 1723–1732. PMLR, 2019.
|
| 321 |
+
|
| 322 |
+
[89] Paul Vicol, Luke Metz, and Jascha Sohl-Dickstein. Unbiased gradient estimation in unrolled computation graphs with persistent evolution strategies. In International Conference on Machine Learning, pages 10553–10563. PMLR, 2021. 7
|
| 323 |
+
|
| 324 |
+
[90] Brandon Amos. Differentiable Optimization-Based Modeling for Machine Learning. PhD thesis, Carnegie Mellon University, May 2019. 7
|
| 325 |
+
|
| 326 |
+
[91] Justin Domke. Generic methods for optimization-based modeling. In Artificial Intelligence and Statistics, pages 318–326. PMLR, 2012.
|
| 327 |
+
|
| 328 |
+
[92] Stephen Gould, Basura Fernando, Anoop Cherian, Peter Anderson, Rodrigo Santa Cruz, and Edison Guo. On differentiating parameterized argmin and argmax problems with application to bi-level optimization. arXiv preprint arXiv:1607.05447, 2016.
|
| 329 |
+
|
| 330 |
+
[93] Jonathan Lorraine, Paul Vicol, and David Duvenaud. Optimizing millions of hyperparameters by implicit differentiation. In International Conference on Artificial Intelligence and Statistics, pages 1540–1552. PMLR, 2020.
|
| 331 |
+
|
| 332 |
+
[94] Mathieu Blondel, Quentin Berthet, Marco Cuturi, Roy Frostig, Stephan Hoyer, Felipe LlinaresLópez, Fabian Pedregosa, and Jean-Philippe Vert. Efficient and modular implicit differentiation. arXiv preprint arXiv:2105.15183, 2021.
|
| 333 |
+
|
| 334 |
+
[95] Matan Atzmon, Niv Haim, Lior Yariv, Ofer Israelov, Haggai Maron, and Yaron Lipman. Controlling neural level sets. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché- Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. URL https://proceedings.neurips.cc/paper/ 2019/file/b20bb95ab626d93fd976af958fbc61ba-Paper.pdf. 7
|
| 335 |
+
|
| 336 |
+
[96] Marin Vlastelica, Anselm Paulus, Vít Musil, Georg Martius, and Michal Rolínek. Differentiation of blackbox combinatorial solvers. arXiv preprint arXiv:1912.02175, 2019. 8
|
| 337 |
+
|
| 338 |
+
[97] Mathias Niepert, Pasquale Minervini, and Luca Franceschi. Implicit mle: Backpropagating through discrete exponential family distributions. Advances in Neural Information Processing Systems, 34, 2021. 8
|
| 339 |
+
|
| 340 |
+
[98] Charles R. Harris, K. Jarrod Millman, Stéfan J. van der Walt, Ralf Gommers, Pauli Virtanen, David Cournapeau, Eric Wieser, Julian Taylor, Sebastian Berg, Nathaniel J. Smith, Robert Kern, Matti Picus, Stephan Hoyer, Marten H. van Kerkwijk, Matthew Brett, Allan Haldane, Jaime Fernández del Río, Mark Wiebe, Pearu Peterson, Pierre Gérard-Marchant, Kevin Sheppard, Tyler Reddy, Warren Weckesser, Hameer Abbasi, Christoph Gohlke, and Travis E. Oliphant. Array programming with NumPy. Nature, 585(7825):357–362, September 2020. doi: 10.1038/s41586-020-2649-2. URL https://doi.org/10.1038/s41586-020-2649-2. 10
|
| 341 |
+
|
| 342 |
+
[99] Paloma Sodhi, Sanjiban Choudhury, Joshua G. Mangelson, and Michael Kaess. ICS: Incremental Constrained Smoothing for State Estimation, 2020. 10
|
| 343 |
+
|
| 344 |
+
[100] André F.T. Martins, Mário A.T. Figueiredo, Pedro M.Q. Aguiar, Noah A. Smith, and Eric P. Xing. An augmented Lagrangian approach to constrained MAP inference. Proceedings of the 28th International Conference on Machine Learning, ICML 2011, pages 169–176, 2011. 10 [101] Richard Zou Horace He. functorch: Jax-like composable function transforms for pytorch. https://github.com/pytorch/functorch, 2021. 10, 19, 20
|
| 345 |
+
|
| 346 |
+
[102] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. 20
|
| 347 |
+
|
| 348 |
+
[103] Gregory S Chirikjian. Stochastic models, information theory, and Lie groups, volume 2: Analytic methods and modern applications, volume 2. Springer Science & Business Media, 2011. 20
|
| 349 |
+
|
| 350 |
+
[104] Taosha Fan, Hanlin Wang, Michael Rubenstein, and Todd Murphey. Cpl-slam: Efficient and certifiably correct planar graph-based slam using the complex number representation. IEEE Transactions on Robotics, 36(6):1719–1737, 2020. 21
|
| 351 |
+
|
| 352 |
+
[105] Taosha Fan and Todd Murphey. Majorization minimization methods for distributed pose graph optimization. arXiv preprint arXiv:2108.00083, 2021. 21
|
| 353 |
+
|
| 354 |
+
[106] Daniel Martinec and Tomas Pajdla. Robust rotation and translation estimation in multiview reconstruction. In 2007 IEEE Conference on Computer Vision and Pattern Recognition, pages 1–8. IEEE, 2007. 21
|
| 355 |
+
|
| 356 |
+
[107] Amit Singer and Yoel Shkolnisky. Three-dimensional structure determination from common lines in cryo-em by eigenvectors and semidefinite programming. SIAM journal on imaging sciences, 4(2):543–572, 2011. 21
|
| 357 |
+
|
| 358 |
+
[108] Mihai Cucuringu, Yaron Lipman, and Amit Singer. Sensor network localization by eigenvector synchronization over the euclidean group. ACM Transactions on Sensor Networks (TOSN), 8 (3):1–42, 2012. 21
|
| 359 |
+
|
| 360 |
+
[109] Luca Carlone, Roberto Tron, Kostas Daniilidis, and Frank Dellaert. Initialization techniques for 3d slam: A survey on rotation estimation and its use in pose graph optimization. In 2015 IEEE International Conference on Robotics and Automation (ICRA), pages 4597–4604, 2015. 21
|
| 361 |
+
|
| 362 |
+
[110] Jiaji Zhou, James A. Bagnell, and Matthew T. Mason. A fast stochastic contact model for planar pushing and grasping: Theory and experimental validation. In Nancy M. Amato, Siddhartha S. Srinivasa, Nora Ayanian, and Scott Kuindersma, editors, Robotics: Science and Systems XIII, Massachusetts Institute of Technology, Cambridge, Massachusetts, USA, July 12-16, 2017, 2017. doi: 10.15607/RSS.2017.XIII.040. URL http://www.roboticsproceedings.org/ rss13/p40.html. 22
|
| 363 |
+
|
| 364 |
+
[111] Paloma Sodhi, Eric Dexheimer, Mustafa Mukadam, Stuart Anderson, and Michael Kaess. Leo: Learning energy-based models in factor graph optimization. In Conference on Robot Learning, pages 234–244. PMLR, 2022. 22
|
| 365 |
+
|
| 366 |
+
[112] Bruce D. Lucas and Takeo Kanade. An iterative image registration technique with an application to stereo vision. In Proceedings of the 7th International Joint Conference on Artificial Intelligence - Volume 2, IJCAI’81, page 674–679, San Francisco, CA, USA, 1981. Morgan Kaufmann Publishers Inc. 23
|
| 367 |
+
|
| 368 |
+
[113] Simon Baker and Iain A. Matthews. Lucas-kanade 20 years on: A unifying framework. International Journal of Computer Vision, 56(3):221–255, 2004. URL https://doi.org/10. 1023/B:VISI.0000011205.11775.fd. 23
|
| 369 |
+
|
| 370 |
+
[114] Daniel DeTone, Tomasz Malisiewicz, and Andrew Rabinovich. Deep image homography estimation. RSS 2016 Workshop: Limits and Potentials of Deep Learning in Robotics, 2016. URL http://arxiv.org/abs/1606.03798. 23
|
| 371 |
+
|
| 372 |
+
[115] Ulisse Dini. Analisi infinitesimale. Lithografia Gorani, 1878. 26
|
| 373 |
+
|
| 374 |
+
# Checklist
|
| 375 |
+
|
| 376 |
+
1. For all authors...
|
| 377 |
+
|
| 378 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 379 |
+
(b) Did you describe the limitations of your work? [Yes]
|
| 380 |
+
(c) Did you discuss any potential negative societal impacts of your work? [No] We do not foresee any beyond what the field of differentiable optimization already have.
|
| 381 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 382 |
+
|
| 383 |
+
2. If you are including theoretical results...
|
| 384 |
+
|
| 385 |
+
(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]
|
| 386 |
+
|
| 387 |
+
3. If you ran experiments...
|
| 388 |
+
|
| 389 |
+
(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]
|
| 390 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
|
| 391 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
|
| 392 |
+
(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]
|
| 393 |
+
|
| 394 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 395 |
+
|
| 396 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 397 |
+
(b) Did you mention the license of the assets? [Yes]
|
| 398 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [Yes]
|
| 399 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 400 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 401 |
+
|
| 402 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 403 |
+
|
| 404 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 405 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 406 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/K5qR1F14qPE/K5qR1F14qPE.md
ADDED
|
@@ -0,0 +1,446 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MOTION-INDUCTIVE SELF-SUPERVISED OBJECT DISCOVERY IN VIDEOS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
In this paper, we consider the task of unsupervised object discovery in videos. Previous works have shown promising results via processing optical flows to segment objects. However, taking flow as input brings about two drawbacks. First, flow cannot capture sufficient cues when objects remain static or partially occluded. Second, it is challenging to establish temporal coherency from flow-only input, due to the missing texture information. To tackle these limitations, we propose a model for directly processing consecutive RGB frames, and infer the optical flow between any pair of frames using a layered representation, with the opacity channels being treated as the segmentation. Additionally, to enforce object permanence, we apply temporal consistency loss on the inferred masks from randomly-paired frames, which refer to the motions at different paces, and encourage the model to segment the objects even if they may not move at the current time point. Experimentally, we demonstrate superior performance over previous state-of-the-art methods on three public video segmentation datasets (DAVIS2016, SegTrackv2, and FBMS-59), while being computationally efficient by avoiding the overhead of computing optical flow as input.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Representing the visual scene with objects as the basic elements has long been considered a fundamental cognitive ability of the intelligent agent, for it enables understanding and interaction with the world more efficiently, for example, combinatorial generalization in novel settings (Tenenbaum et al., 2011). Although it remains somewhat obscure at the level of neurophysiology on exactly how humans discover the objects in a visual scene in the first place, it is a consensus that motion seems to play an indispensable role in defining and discovering the objects from the scene. For example, in 1923, Wertheimer introduced the common fate principle that elements moving together tends to be perceived as a group (Wertheimer, 1923); while later Gibson claimed the independent motion has even been treated as one attribute to define an object visually (Gibson & Carmichael, 1966). Grounded on the above assumptions, the recent literature has witnessed numerous works with different models proposed for segmenting the moving objects via unsupervised learning (Yang et al., 2019; 2021b;a; Liu et al., 2021).
|
| 12 |
+
|
| 13 |
+
Exploiting optical flows for object discovery naturally incurs two critical limitations: First, objects in videos may stop moving or be partially occluded at any time point, leaving no effective cues for their existence in the flow field; Second, computing optical flow from a pair of frames refers to a lossy encoding procedure, that poses a significant challenge for establishing temporal coherence, due to the lack of effective texture information. In contrast, adopting RGB frame sequences poses a few clear advantages. The most obvious one is that, while objects do not necessarily move all the time, the property of temporal coherence in RGB space naturally guarantees a preliminary understanding of object permanence; Additionally, the rich textures in the appearance stream give more distinctive patterns than those in motion, allowing to better identify and distinguish the different objects. Last but not least, processing RGB streams still enables a faster processing speed than using optical flow.
|
| 14 |
+
|
| 15 |
+
In this paper, our goal is to train a video segmentation model that can discover the moving objects within a sequence of RGB frames, in the form of segmentation. In specific, our proposed model first encodes consecutive frames independently, into a set of frame-wise visual features, that is followed by a temporal fusion with a Transformer encoder. To localise the moving objects, we randomly pair the visual features from two frames and pass them into a frame comparator module, effectively establishing the relative motion between frames. Inspired by Yang et al. (2021a), we decode the motion features into optical flows with a dual-layered representation, with the opacity weight of each layer treated as the segmentation mask. At training time, we exploit an off-the-shelf optical flow estimator, e.g., RAFT (Teed & Deng, 2020), as the induction for flow reconstruction. To develop the property of object permanence, we enforce a temporal consistency on the inferred segmentation masks, which encourages the model to mine effective texture information from the RGB sequence and keep track of the objects even if they may be static at the current time point.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: Illustration about Bicycle Motocross (BMX) sequence on SegTrackv2 (Li et al., 2013). The red boxes and the yellow boxes refer to the arm and the back of the player, respectively. Flowonly method (Yang et al., 2021a) fails to track the same region in a temporal consistent fashion since it derives the foreground region directly from current optical flow. However, our methodology of processing a RGB video clip develops a sense of object permanence and solves the issue.
|
| 19 |
+
|
| 20 |
+
In short, we summarize the contributions in this paper: First, we introduce the Motion-inductive Object Discovery (MOD) model, a simple architecture for discovering the moving objects in videos, by directly processing a set of consecutive RGB frames. Second, we propose a self-supervised proxy task that is used to train the architecture without relying upon any manual annotation. To overcome the challenge from flow-based methods, i.e., objects may stay static or move slowly, we adopt a random-paired policy and restrain the temporal consistency. Third, we conduct a series of ablation studies to validate each key component of our method, such as the temporal consistency of randompaired flow. While evaluating three public benchmarks, we demonstrate superior performance over existing approaches on DAVIS2016 (Perazzi et al., 2016), SegTrackv2 (Li et al., 2013), and FBMS59 (Ochs et al., 2013), with considerable speed-up during the inference procedure.
|
| 21 |
+
|
| 22 |
+
# 2 RELATED WORK
|
| 23 |
+
|
| 24 |
+
Video Object Segmentation. How to segment objects coherently in one video sequence has extended the topic of instance segmentation in the image. There is a great amount of work about video object segmentation (VOS) in recent decades (Caelles et al., 2017; Hu et al., 2017; Fan et al., 2019; Dutt Jain et al., 2017; Lai & Xie, 2019; Maninis et al., 2018; Oh et al., 2019; Voigtlaender et al., 2019; Caelles et al., 2017; Perazzi et al., 2017; Hu et al., 2018; Li & Loy, 2018; Bao et al., 2018; Voigtlaender et al., 2019; Johnander et al., 2019). Recently, the research on getting rid of the dense annotation and designing more effective self-supervised algorithms has attracted more and more interest in the computer vision community including VOS (Xu & Wang, 2021; Jabri et al., 2020; Lai et al., 2020; Li et al., 2019; Vondrick et al., 2018; Lu et al., 2020; Wang et al., 2019; Kipf et al., 2022). For VOS, there are two mainstream protocols to evaluate the learned model. One is semi-supervised video object segmentation, the other is unsupervised video object segmentation. Given the first-frame mask of the objects of interest, semi-supervised VOS tracks those objects in subsequent frames, while unsupervised VOS directly segments the most salient objects from the background without any reference. These two protocols are defined in the inference phase, meaning methods could leverage ground truth annotations in the training stage. In this paper, we don’t use any kinds of manual annotations for either training or evaluation.
|
| 25 |
+
|
| 26 |
+
Motion Segmentation. As the name suggests, the aim of motion segmentation is to discover moving objects. One line of the work (Brox & Malik, 2010; Fragkiadaki et al., 2012; Ochs & Brox, 2012; Ochs et al., 2013; Lezama et al., 2011; Keuper et al., 2015) formulates motion as the point trajectory to take advantage of long-range temporal information so that segmentation results can be acquired by grouping the trajectories. Later, deep learning methods take over the area (Tokmakov et al., 2017b;a; Xie et al., 2019; Yang et al., 2019; 2021a; Choudhury et al., 2022; Yang et al., 2021b; Ye et al., 2022a; Wang et al., 2022). Tokmakov et al. (2017b) adopts a two-stream network that ingests both RGB and optical flow. Then they realize a memory mechanism by the convolutional recurrent unit to enhance the visual cues. CIS (Yang et al., 2019) achieves fully unsupervised motion segmentation which discards the supervision of annotated masks during training. By formulating a min-max game of mutual information, the generator is asked to create foreground segments that are as unrelated as possible to the background. AMD (Liu et al., 2021) minimizes the warp synthesis error to train appearance and motion pathways without any supervision. The most similar work to ours is MG (Yang et al., 2021a), which solely leverages the optical flow to separate the pixels via cross attention mechanism (Locatello et al., 2020). Compared to MG (Yang et al., 2021a), we keep reserved on the module design and the training recipe to demonstrate the improvement brought by our method is purely from taking consecutive RGB frames instead of optical flow. Recent work GWM (Choudhury et al., 2022) also utilizes RGB images and adopt the supervision from optical flow but their model ingests a single image to segment the foreground and fails to consider temporal coherency.
|
| 27 |
+
|
| 28 |
+
Object Discovery. There is rich literature on identifying salient objects without explicit supervision, known as object discovery. There exist a series of works that aim to learn object-centric representations in images (Locatello et al., 2020; Lin et al., 2020; Jiang & Ahn, 2020; Greff et al., 2019; Emami et al., 2021; Burgess et al., 2019; Crawford & Pineau, 2019; Engelcke et al., 2019; 2021). Typically, IODINE (Greff et al., 2019) develops iterative variational inference to separate different objects. Locatello et al. (2020) proposes slot attention to iteratively update latent object representations. Further, a line of works (Zablotskaia et al., 2020; Min et al., 2021; Kosiorek et al., 2018; Kipf et al., 2022; Jiang et al., 2019; Kabra et al., 2021; Crawford & Pineau, 2020; Besbinar & Frossard, 2021; Bear et al., 2020; Bao et al., 2022; Ye et al., 2022b; Yang et al., 2021a) extend object-centric learning to video domain. Most of these approaches incorporate motion cues into the reconstruction task and perform well in moving object segmentation but perform poorly in processing static objects. While in this work, we adopt slot attention to form optical flow reconstruction bottleneck and perceive both dynamic and static instances through RGB clip input in a temporally consistent way.
|
| 29 |
+
|
| 30 |
+
# 3 MOTION-INDUCTIVE OBJECT DISCOVERY (MOD) MODEL
|
| 31 |
+
|
| 32 |
+
In this section, we detail our MOD model, which processes a set of consecutive RGB frames and automatically discovers the moving objects in the form of segmentation. An overview of the training procedure can be seen in Figure 2, where the visual features computed from individual frames are temporally fused, and randomly paired together, for decoding the optical flows between two corresponding frames. Taking inspiration from the motion grouping (Yang et al., 2021a), we also adopt a dual-layered representation for the output flow, with the foreground and background flows being reconstructed separately, and later composited with the inferred opacity masks (soft segmentation). In the following section, we will detail each key component in our proposed architecture.
|
| 33 |
+
|
| 34 |
+
# 3.1 SPATIAL-TEMPORAL VISUAL ENCODER
|
| 35 |
+
|
| 36 |
+
To start with, our model takes a short video clip as input, i.e., $\boldsymbol { v } = \{ x _ { 1 } , \cdot \cdot \cdot , x _ { T } \} , \boldsymbol { v } \in \mathbb { R } ^ { T \times H \times W \times 3 }$ , consisting of a set of RGB frames, the frame-wise visual representations are computed with a shared visual encoder $\Phi _ { \mathrm { e n c } }$ . Formally, the output feature map $o _ { t }$ at timestamp $t$ $\mathit { \Omega } ^ { \prime } 1 \leq t \leq T$ ) can be obtained:
|
| 37 |
+
|
| 38 |
+
$$
|
| 39 |
+
o _ { t } = \Phi _ { \mathrm { e n c } } ( x _ { t } ) \in \mathbb { R } ^ { h \times w \times d } ,
|
| 40 |
+
$$
|
| 41 |
+
|
| 42 |
+

|
| 43 |
+
Figure 2: Model architecture. Our model first extracts spatial features of consecutive frames by the visual encoder. To jointly model the temporal relation, we aggregate and interact among the multi-frame features with late-fusion. We randomly pair two frames’ visual representations and pass them into the frame comparator to encode relative motion. Then, we decode the flow from random-paired frames. Through iterative routing, we adopt a dual-layer representation for the flow reconstruction, i.e., outputting the foreground and background flows separately, and composing them with inferred opacity weights. The whole training procedure does not require supervision from any mask annotations.
|
| 44 |
+
|
| 45 |
+
where $h , w , d$ denotes the dimension of the height, width, and channel, respectively. Till this point, to build the temporal dependency between multiple visual frames, a global fusion module is introduced, via a standard Transformer Encoder layer:
|
| 46 |
+
|
| 47 |
+
$$
|
| 48 |
+
\{ \widetilde o _ { 1 } , \dots , \widetilde o _ { T } \} = \Phi _ { \mathrm { t e m p } } ( \{ o _ { 1 } + \mathtt { p e } _ { 1 } , \cdots , o _ { T } + \mathtt { p e } _ { T } \} ) ,
|
| 49 |
+
$$
|
| 50 |
+
|
| 51 |
+
where $\mathsf { p e }$ refers to the learnable spatial-temporal positional encodings, and the output $\tilde { o } _ { t } \in \mathbb { R } ^ { h \times w \times d }$ remains the same dimension as input.
|
| 52 |
+
|
| 53 |
+
By taking the multiple RGB frames as input, our proposed visual encoder can explicitly consider the temporal coherence within the video clip. Note that, such seemingly simple design poses two critical differences from previous work on motion-driven object discovery (Yang et al., 2019; 2021a), where only frame-wise optical flow is adopted: First, using RGB frames as input can drastically reduce the computation latency at inference time. The throughput of our model without computing dense optical flow reaches round 100 fps on a standard 32GB Tesla V100 GPU while prior works need to calculate flow at first. RGB provides more semantic information than flows for the model to exploit, i.e., including not only the object’s shape but also its texture. Second, processing multiple frames contributes to the development of a sense of object permanence within the video clip, i.e., the understanding that items or people still exist even when they cannot be perceived explicitly. Therefore, even though the objects in videos may stop moving or be partially occluded at any time point, they can still be effectively segmented with the temporal cues.
|
| 54 |
+
|
| 55 |
+
# 3.2 RANDOM-PAIRED FRAME COMPARATOR
|
| 56 |
+
|
| 57 |
+
Till this point, we consider building the relative motion between any two visual frames within the video clip, from reference frame $i$ to target frame $j$ , i.e., $f _ { i \to j }$ . In specific, we select the visual representation of the two corresponding frames, i.e., ${ \tilde { o } } _ { i }$ and ${ \tilde { o } } _ { j }$ , concatenate them along the feature dimension, and feed it into a comparator module:
|
| 58 |
+
|
| 59 |
+
$$
|
| 60 |
+
f _ { i \to j } = \Phi _ { \mathrm { c o m p } } ( \mathrm { c o n c a t } ( \tilde { o } _ { i } , \tilde { o } _ { j } ) ) \in \mathbb { R } ^ { h \times w \times d } ,
|
| 61 |
+
$$
|
| 62 |
+
|
| 63 |
+
where $\Phi _ { \mathrm { c o m p } } : \mathbb { R } ^ { 2 d } \mathbb { R } ^ { d }$ consists of multiple deformable convolutional layers (Zhu et al., 2019) followed by a series of Transformer Encoders, that dynamically construct the feature representation for later estimating relative motion between frames while reducing the feature dimensions at the same time.
|
| 64 |
+
|
| 65 |
+
Discussion. With such a design of random-paired frame comparator, our MOD is capable of modeling the relative motion between any two randomly sampled frames out of the video clip $T$ frames), accounting for a total of $T ^ { 2 }$ frame pairs for forward, backward, single, or multi-step motions. Note that, we do not distinguish the case of $i \neq j$ and $i = j$ . Specifically, the former encourages the model to discover the relative motion between two different frames, while the latter refers to an extreme case that neither objects nor camera is moving, and no motion cues are available, thus enforcing the model to discover objects via temporal coherence, i.e., objects that moves in any frame along the video should also be discovered in static frames.
|
| 66 |
+
|
| 67 |
+
# 3.3 DUAL-LAYERED FLOW DECODER
|
| 68 |
+
|
| 69 |
+
To decode the features into the form of optical flow, we adopt several slot attention layers (Locatello et al., 2020) with two learnable queries, i.e., termed as slot vectors, iteratively attending the output visual features from the comparator, and decoded into the optical flow between any two frames with a dual-layered representation. In detail, a slot attention module acts similarly to a Transformer Decoder, with the only exception being that the normalisation is computed along the slot side, thus each slot competes to take over the pixels. In each iteration, given two slot vectors as $S \in \mathbb { R } ^ { 2 \times d }$ and visual feature maps $\tilde { o } _ { t } \in \mathbb { R } ^ { h w \times d }$ , we use three linear projections to compute the query, key and value, i.e., $Q \in \mathbf { \bar { \mathbb { R } } } ^ { 2 \times d } , K , V \in \mathbb { R } ^ { h w \times d }$ . Thereafter, we can obtain the weights matrix $\bar { W } \in \bar { \mathbb { R } ^ { 2 } } \times h w$ and normalise along the slot dimension, i.e.,
|
| 70 |
+
|
| 71 |
+
$$
|
| 72 |
+
\widetilde { W } _ { s , \cdot } = \exp ( W _ { s , \cdot } ) / \sum _ { l } \exp { ( W _ { l , \cdot } ) } , \mathrm { w h e r e } ~ W = \frac { 1 } { \sqrt { d } } Q K ^ { T } .
|
| 73 |
+
$$
|
| 74 |
+
|
| 75 |
+
Then, we gain the next iteration’s slot vectors by aggregating the values $V$ and passing them into a Gated Recurrent Unit (GRU) (Cho et al., 2014), i.e.,
|
| 76 |
+
|
| 77 |
+
$$
|
| 78 |
+
S : = \mathrm { G R U ( i n p u t s } = A V , \mathrm { s t a t e s } = S ) , \mathrm { w h e r e } A _ { \cdot , s } = \frac { \widetilde { W } _ { \cdot , s } } { \sum _ { l } \widetilde { W } _ { \cdot , l } } \in \mathbb { R } ^ { 2 \times ( h \times w ) } .
|
| 79 |
+
$$
|
| 80 |
+
|
| 81 |
+
We iterate the whole routing process for $N$ times. In this way, the entities of similar RGB and flow patterns are grouped together and distinct pixels are separated by two slots. Eventually, we broadcast the final outputted slots into G = {Gs ∈ Rh×w×d}2s= added with learnable spatial positional embeddings to construct the optical flow. A flow decoder $\Phi _ { \mathrm { d e c } }$ consisting Transformer encoders and up-sampling layers takes the slot grids as input, and outputs dual layers of optical flows $\{ \widetilde { I } ^ { s } \in \mathbb { R } ^ { H \times W \times 3 } \} _ { s = 1 } ^ { 2 } ^ { 1 }$ and their opacity weights $\{ \alpha ^ { s } \in \mathbb { R } ^ { H \times W \times 1 } \} _ { s = 1 } ^ { 2 }$ :
|
| 82 |
+
|
| 83 |
+
$$
|
| 84 |
+
\{ \widetilde { I } ^ { s } , \alpha ^ { s } \} _ { s = 1 } ^ { 2 } = \Phi _ { \mathrm { d e c } } ( G ) ,
|
| 85 |
+
$$
|
| 86 |
+
|
| 87 |
+
where $\alpha ^ { s } \in [ 0 , 1 ] ^ { H \times W \times 1 }$ is normalized across two slots via softmax function. Noted that thanks to the softmax function, the alpha value for foreground could be close to zero when the foreground object is missing in part of the video. For a given frame pair $( i , j )$ , their relative flow $\widetilde { I } _ { i j }$ can be computed via:
|
| 88 |
+
|
| 89 |
+
$$
|
| 90 |
+
\widetilde { I } _ { i j } = \sum _ { s = 1 } ^ { 2 } \alpha _ { i j } ^ { s } \otimes \widetilde { I } _ { i j } ^ { s } ,
|
| 91 |
+
$$
|
| 92 |
+
|
| 93 |
+
where $\otimes$ denotes the element-wise multiplication. At inference time, we adopt the binarized opacity weights $\alpha ^ { s }$ as the object segmentation masks.
|
| 94 |
+
|
| 95 |
+
# 3.4 TRAINING
|
| 96 |
+
|
| 97 |
+
In this section, we describe the training procedure for the proposed model, on the raw videos without using manual annotations for the object segmentations. In general, the training loss is composed of three components, namely, flow reconstruction, temporal consistency, and entropy minimisation.
|
| 98 |
+
|
| 99 |
+
Flow Reconstruction. As the main objective for optimisation, we use the flow reconstruction, where we adopt an off-the-shelf optical flow estimator, for example, RAFT (Teed & Deng, 2020), to estimate the flow between any two frames in the video. We minimise the discrepancy between the dual-layer flow reconstruction and the output from the existing flow estimator:
|
| 100 |
+
|
| 101 |
+
$$
|
| 102 |
+
\mathcal { L } _ { \mathrm { r e c o n } } ^ { i j } = \frac { 1 } { | \Omega | } \sum _ { u \in \Omega } | I _ { i j } ( u ) - \widetilde { I } _ { i j } ( u ) | _ { 2 } ,
|
| 103 |
+
$$
|
| 104 |
+
|
| 105 |
+
where $\Omega = \{ 1 , \cdots , H \} \times \{ 1 , \cdots , W \}$ represents the spatial lattice, and a $| \cdot | _ { 2 }$ denotes the L2 norm. In practice, the reconstruction constraint for zero flow when $i = j$ is dropped due to the distribution gap between dynamic flow and static flow, resulting in the divergence of the training. Note that, flow estimator is only used for model training, at inference time, our proposed architecture directly processes the RGB video clips.
|
| 106 |
+
|
| 107 |
+
Temporal Consistency. In order to build up temporal consistency within the input video, the pair of motion embeddings $f _ { i \to j } , f _ { i \to k }$ that starts from the same reference frame $i$ , are passed through the flow decoder to reconstruct the optical flow between two corresponding frames. Note that, as $1 \leq j , k \leq T$ are randomly sampled at every training iteration, the output flow will refer to the motion at a different pace. However, the predicted alpha weights for flow composition denote the soft segmentation for the same objects in the $i$ -th frame, thus remaining consistent. In specific, the two inferred masks $\{ \alpha _ { i \to j } ^ { s } \} _ { s = 1 } ^ { 2 } , \{ \stackrel { \smile } { \alpha } _ { i \to k } ^ { s } \} _ { s = 1 } ^ { 2 }$ are enforced to pull closer by minimising mean-squared error $\mathcal { L } _ { \mathrm { c o n s } }$ , i.e.,
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
\mathcal { L } _ { \mathrm { c o n s } } = \frac { 1 } { T } \sum _ { i = 1 } ^ { T } \mathcal { L } _ { \mathrm { c o n s } } ^ { i } \quad \mathrm { ~ w h e r e ~ } \mathcal { L } _ { \mathrm { c o n s } } ^ { i } = \frac { 1 } { 2 | \Omega | } \sum _ { u \in \Omega } \sum _ { s = 1 } ^ { 2 } | \alpha _ { i \to j } ^ { s } ( u ) - \alpha _ { i \to k } ^ { s } ( u ) | ^ { 2 } .
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
Entropy Minimisation. Lastly, we impose a pixel-wise entropy regularisation on inferred masks, that is zero if the alpha channels are one-hot, and maximum when they are of equal probability. Intuitively, this helps encourage the masks to be binary, which aligns with our goal in obtaining segmentation masks:
|
| 114 |
+
|
| 115 |
+
$$
|
| 116 |
+
\mathcal { L } _ { \mathrm { e n t r o } } ^ { i j } = \frac { 1 } { 2 | \Omega | } \sum _ { u \in \Omega } \sum _ { s = 1 } ^ { 2 } - \alpha _ { i j } ^ { s } ( u ) \log ( \alpha _ { i j } ^ { s } ( u ) ) .
|
| 117 |
+
$$
|
| 118 |
+
|
| 119 |
+
Total Loss. Accordingly, we rewrite aforementioned reconstruction loss $\scriptstyle { \mathcal { L } } _ { \mathrm { r e c o n } }$ and entropy regulatization ${ \mathcal { L } } _ { \mathrm { e n t r o } }$ in summed version:
|
| 120 |
+
|
| 121 |
+
$$
|
| 122 |
+
\begin{array} { l l l } { \displaystyle \mathcal { L } _ { \mathrm { r e c o n } } = \frac { 1 } { 2 T } \sum _ { i = 1 } ^ { T } \mathcal { L } _ { \mathrm { r e c o n } } ^ { i \to j _ { i } } + \mathcal { L } _ { \mathrm { r e c o n } } ^ { i \to k _ { i } } ; } \\ { \displaystyle \mathcal { L } _ { \mathrm { e n t r o } } = \frac { 1 } { 2 T } \sum _ { i = 1 } ^ { T } \mathcal { L } _ { \mathrm { e n t r o } } ^ { i \to j _ { i } } + \mathcal { L } _ { \mathrm { e n t r o } } ^ { i \to k _ { i } } . } \end{array}
|
| 123 |
+
$$
|
| 124 |
+
|
| 125 |
+
The total loss for training our model can thus be computed as:
|
| 126 |
+
|
| 127 |
+
$$
|
| 128 |
+
\mathcal { L } _ { \mathrm { t o t } } = \lambda _ { \mathrm { r } } \mathcal { L } _ { \mathrm { r e c o n } } + \lambda _ { \mathrm { e } } \mathcal { L } _ { \mathrm { e n t r o } } + \lambda _ { \mathrm { c } } \mathcal { L } _ { \mathrm { c o n s } } ,
|
| 129 |
+
$$
|
| 130 |
+
|
| 131 |
+
where we set $\lambda _ { \mathrm { r } } = 1 0 0$ , $\lambda _ { \mathrm { e } } = \lambda _ { \mathrm { c } } = 0 . 0 1$ at the beginning of the training. We notice the model to be fairly robust to these hyper-parameters.
|
| 132 |
+
|
| 133 |
+
# 4 EXPERIMENTAL SETUP
|
| 134 |
+
|
| 135 |
+
In the experiments setup, we first introduce the benchmarks and then elaborate on implementation details.
|
| 136 |
+
|
| 137 |
+
# 4.1 DATASETS
|
| 138 |
+
|
| 139 |
+
We benchmark on three popular datasets designed for video object segmentation. DAVIS2016 (Perazzi et al., 2016) consists of 50 high quality videos, 3455 frames in total. Every frame is annotated with a pixel-accurate segmentation mask. SegTrackv2 (Li et al., 2013) contains 14 sequences and 947 fully-annotated frames. Each sequence involves 1-6 moving objects and presents challenges including motion blur, appearance change, complex deformation, occlusion, slow motion, and interacting objects. FBMS-59 (Ochs et al., 2013) has 59 sequences with greatly varied resolution and annotates every 20th frame. Many sequences contain multiple moving objects. Following previous evaluation metric (Yang et al., 2019; Xie et al., 2022), we merge objects of SegTrackv2 and FBMS59 into one single object for video object segmentation. We evaluate the pixel-wise segmentation through Jaccard index $\mathcal { I }$ , also called Intersection over Union (IoU). Following prior arts (Yang et al., 2019; 2021a), we compute the mean per frame over the test set and merge multi-object annotation into single unified segmentation.
|
| 140 |
+
|
| 141 |
+
# 4.2 IMPLEMENTATION DETAILS
|
| 142 |
+
|
| 143 |
+
For data input, we sample $T = 7$ consecutive frames as the input clip. Each frame is resized to $1 9 2 \times 3 8 4$ and the estimated optical flow is computed by RAFT (Teed & Deng, 2020), which is pre-trained on the synthetic dataset (Mayer et al., 2016).
|
| 144 |
+
|
| 145 |
+
To compute spatial-temporal visual representation, we adopt the first three stages of a SwinV2- $\mathrm { T }$ as the frame encoder $\Phi _ { \mathrm { e n c } }$ , which is then followed by a standard Transformer Encoders with 8 heads (Vaswani et al., 2017) as temporal fusion module $\Phi _ { \mathrm { t e m p } }$ . For the frame comparator $\Phi _ { \mathrm { c o m p } }$ , we use two deformable convolutional layers in the company with three standard Transformer Encoders with 8 heads to process the pixel transformation. Then, we choose $N = 5$ iteration in total for the iterative routing in slot attention. Lastly, we utilize three stages of SwinV2 blocks with the linear patch expanding layers as the flow decoder $\Phi _ { \mathrm { d e c } }$ (Cao et al., 2021).
|
| 146 |
+
|
| 147 |
+
As for training, we adopt AdamW optimizer (Loshchilov & Hutter, 2018) with learning rate $4 \times 1 0 ^ { - 5 }$ . The model is trained from scratch without any pretrained weights, for a total of 300k iterations. At inference time, we adopt the overlapping temporal sliding window to ensemble the segmentation masks. We average the resultant masks obtained by the whole temporal segments. We propose two protocols to evaluate our results. Besides measuring the masks without any post-processing, we also apply test-time adaptation with the help of the self-supervised DINO-pretrained ViT (Caron et al., 2021). Without any fine-tuning, the pretrained ViT can propagate the masks as noisy annotations to the whole frames in the same manner as CRW (Jabri et al., 2020). We refine the masks further with CRF (Lafferty et al., 2001). For more detailed technical information, please refer to the supplementary materials.
|
| 148 |
+
|
| 149 |
+
# 5 RESULTS
|
| 150 |
+
|
| 151 |
+
In this section, we compare primarily with several top-performing approaches trained without human annotations, for example, OCLR (Xie et al., 2022), MG (Yang et al., 2021a), CIS (Yang et al., 2019), etc. However, as the architecture, modality, input resolution, and post-processing protocols are all different, we try our best to conduct the comparison as fairly as possible.
|
| 152 |
+
|
| 153 |
+
# 5.1 ABLATION STUDY
|
| 154 |
+
|
| 155 |
+
We conduct all ablation studies on DAVIS2016 and vary one variable each time, as shown in Table 1.
|
| 156 |
+
|
| 157 |
+
Temporal Fusion $\Phi _ { \mathrm { t e m p } }$ and Frame Comparator $\Phi _ { \mathbf { c o m p } }$ . As shown by Ours-A and Our-C, the performance degrades significantly without temporal fusion, demonstrating the importance of building up global temporal dependency. Also, indicated by Ours-B, we find the model fails to converge when removing the component of frame comparator $\Phi _ { \mathrm { c o m p } }$ . It meets expectations because frame comparator $\Phi _ { \mathrm { c o m p } }$ is the sole module in charge of relative motion estimation. Without it, the model cannot reconstruct optical flow thus leading to divergence.
|
| 158 |
+
|
| 159 |
+
Number of Frames $T$ . While comparing Ours-A, Ours-D, and Ours-E, there is a clear trend that increasing the frame number boosts the segmentation quality, which coincides with our intuition that incorporating a wider temporal receptive field can enhance the sense of temporal coherence and object permanence. Due to the limited computational memory, we only set $T = 7$ as the maximum frame number in the paper. A promising performance is expected when inputting more frames.
|
| 160 |
+
|
| 161 |
+
Table 1: Ablation studies on temporal fusion $( \Phi _ { \mathrm { t e m p } } )$ , frame comparator $( \Phi _ { \mathrm { c o m p } } )$ , the number of input frames $( T )$ , temporal consistency $( \mathcal { L } _ { \mathrm { c o n s } } )$ , and entropy loss $( \mathcal { L } _ { \mathrm { e n t r o } } )$ .
|
| 162 |
+
|
| 163 |
+
<table><tr><td>Model</td><td>Φtemp</td><td>Pcomp</td><td>T</td><td>Lcons</td><td>Lentro</td><td>DAVIS(J ↑)</td></tr><tr><td>Ours-A</td><td>√</td><td>√</td><td>7</td><td>√</td><td>√</td><td>73.9</td></tr><tr><td>Ours-B</td><td>1</td><td>X</td><td>7</td><td>√</td><td>√</td><td>fail</td></tr><tr><td>Ours-C</td><td>X</td><td>√</td><td>7</td><td>√</td><td>√</td><td>68.3</td></tr><tr><td>Ours-D</td><td>√</td><td>√</td><td>3</td><td>√</td><td>√</td><td>66.4</td></tr><tr><td>Ours-E</td><td>√</td><td>√</td><td>5</td><td>√</td><td>√</td><td>68.2</td></tr><tr><td>Ours-F</td><td>√</td><td>√</td><td>7</td><td>X</td><td>X</td><td>60.4</td></tr><tr><td>Ours-G</td><td>√</td><td>√</td><td>7</td><td>X</td><td>√</td><td>65.6</td></tr><tr><td>Ours-H</td><td>√</td><td>√</td><td>7</td><td>√</td><td>X</td><td>69.5</td></tr></table>
|
| 164 |
+
|
| 165 |
+
Table 2: Quantitative comparison on unsupervised video object segmentation. We compare our method on three standard datasets, DAVIS2016, SegTrackv2, and FBMS-59. Sup. refers to the supervision, including None, Synthetic (Syn.), and Ground Truth (GT). p.p. is short for postprocessing (e.g., CRF (Lafferty et al., 2001)).
|
| 166 |
+
|
| 167 |
+
<table><tr><td rowspan="2">Model</td><td>Training</td><td colspan="3">Inference</td><td colspan="3">J (Mean) ↑</td></tr><tr><td>Sup.</td><td>RGB</td><td>Flow</td><td>p.p.</td><td>DAVIS2016</td><td>SegTrackv2</td><td>FBMS-59</td></tr><tr><td>SAGE (Wang et al., 2017)</td><td>None</td><td>√</td><td>√</td><td>X</td><td>42.6</td><td>57.6</td><td>61.2</td></tr><tr><td>NLC (Faktor & Irani, 2014)</td><td>None</td><td>√</td><td></td><td>√</td><td>55.1</td><td>67.2</td><td>51.5</td></tr><tr><td>CIS (Yang et al., 2019)</td><td>None</td><td></td><td></td><td>√</td><td>71.5</td><td>62.5</td><td>63.5</td></tr><tr><td>AMD (Liu et al., 2021)</td><td>None</td><td>√</td><td>X</td><td>X</td><td>57.8</td><td>57.0</td><td>47.5</td></tr><tr><td>SIMO (Lamdouar et al., 2021)</td><td>Syn.</td><td>X</td><td></td><td>√</td><td>67.8</td><td>62.0</td><td>=</td></tr><tr><td>MG (Yang et al., 2021a)</td><td>None</td><td>X</td><td></td><td>X</td><td>68.3</td><td>58.6</td><td>53.1</td></tr><tr><td>OCLR (Xie et al., 2022)</td><td>Syn.</td><td>X</td><td>√</td><td>X</td><td>72.1</td><td>67.6</td><td>65.4</td></tr><tr><td>MOD (w/o post-processing)</td><td>None</td><td>√</td><td>X</td><td>X</td><td>73.9</td><td>62.2</td><td>61.3</td></tr><tr><td>MOD (test-time adaptation)</td><td>None</td><td>√</td><td>X</td><td>√</td><td>79.2</td><td>69.4</td><td>66.9</td></tr><tr><td>FSEG (Dutt Jain et al., 2017)</td><td>GT</td><td>√</td><td>√</td><td>=</td><td>70.7</td><td>61.4</td><td>68.4</td></tr><tr><td>COSNet (Lu et al., 2019)</td><td>GT</td><td>√</td><td>X</td><td></td><td>80.5</td><td>49.7</td><td>75.6</td></tr><tr><td>MATNet (Zhou et al.,2020)</td><td>GT</td><td>√</td><td>√</td><td></td><td>82.4</td><td>50.4</td><td>76.1</td></tr><tr><td>D²Conv3d (Schmidt et al., 2022)</td><td>GT</td><td>√</td><td>X</td><td>=</td><td>85.5</td><td>-</td><td>-</td></tr></table>
|
| 168 |
+
|
| 169 |
+
Temporal Consistency $\mathcal { L } _ { \mathbf { c o n s } }$ and Entropy Regularisation $\mathcal { L } _ { \mathrm { e n t r } 0 }$ . Lastly, comparing Ours-G and Ours-A, we observe that the performance increases considerably with temporal consistency. It manifests the validity of our design motivation, temporal consistency conduces to persistently tracking the object. The entropy regularisation is also indispensable shown by Ours-H and Ours-A.
|
| 170 |
+
|
| 171 |
+
# 5.2 COMPARISON WITH STATE-OF-THE-ART
|
| 172 |
+
|
| 173 |
+
We show the comparison with state-of-the-art in Table 2. On DAVIS2016, MOD achieves $7 3 . 9 \%$ mIOU without any post-processing, exceeding MG (Yang et al., 2021a) by a large margin $( + 5 . 8 \% )$ . Compared to the latest method OCLR (Xie et al., 2022) which fabricates a synthesized dataset to train its model, our method still surpasses it only using the information of the DAVIS dataset itself. On another two benchmarks SegTrackv2 and FBMS-59, MOD also beats MG (Yang et al., 2021a), which only leverages single-step flows to decompose foreground and background, by $+ 3 . 6 \%$ and $+ 8 . 2 \%$ , respectively. The superior experimental results demonstrate that our methodology of multiframe reasoning benefits moving object discovery. Furthermore, equipped with DINO-pretrained ViT, a further performance gain is observed on all three benchmarks, which is even more competitive with current supervised approaches.
|
| 174 |
+
|
| 175 |
+
# 5.3 QUALITATIVE RESULTS
|
| 176 |
+
|
| 177 |
+
In Figure 3, we present several qualitative illustrations of the model. It can be seen that our results are robust to the noticeable background flow signal (drift-chicane sequence in the second column) and estimate more accurate boundaries when single-step foreground flow cannot represent exact object shape (breakdance and dance-twirl sequences in middle) compared to MG (Yang et al., 2021a). It demonstrates inferring the masks by associating a bunch of RGB features well resolves the limitation of the usage of flow. Moreover, in virtue of temporally consistent cues, our model handles occlusion well shown in the libby sequence at the rightmost column, which could be hard for the flow-only method to maintain the object shape constantly.
|
| 178 |
+
|
| 179 |
+

|
| 180 |
+
Figure 3: Qualitative results of object video segmentation on DAVIS2016. MG refers to Yang et al. (2021a). Red boxes outline the corresponding difference.
|
| 181 |
+
|
| 182 |
+
# 5.4 LIMITATIONS
|
| 183 |
+
|
| 184 |
+
Though we demonstrate that associating multiple frames stimulates the comprehensive sense of objectness, which is proved by the superior experimental performance across the prior arts, there still exist limitations and room for improvement. First, our method uses a number of consecutive frames, which challenges computational memory. How to utilize pretrained features for reducing training expenses would be meaningful. Second, how to segment multiple objects remains unresolved. We display a preliminary result in supplementary material. It will be promising to exploit the semantic information from RGB to discriminate different foreground objects. We leave them as the feature work. Despite these limitations, the approach has convincingly manifested the value of considering textural information and processing RGB frames as a whole.
|
| 185 |
+
|
| 186 |
+
# 6 CONCLUSION
|
| 187 |
+
|
| 188 |
+
In this paper, we propose a self-supervised model for video object discovery. The model takes a set of consecutive RGB frames as input and generates the segmentation mask for the moving objects in the video. At training time, the model is tasked to reconstruct the optical flow between any pair of frames, through a layered representation with the opacity channels being treated as the segmentation. To encourage the model to capture the objects even when they may be static at a certain time point, a temporal consistency loss is enforced on the inferred masks on the randomlypaired frames. As a consequence, we demonstrate superior performance over previous state-of-theart methods on three public video segmentation datasets (DAVIS2016, SegTrackv2, and FBMS-59), while being computationally efficient by avoiding the overhead of computing optical flow.
|
| 189 |
+
|
| 190 |
+
# REFERENCES
|
| 191 |
+
|
| 192 |
+
Linchao Bao, Baoyuan Wu, and Wei Liu. Cnn in mrf: Video object segmentation via inference in a cnn-based higher-order spatio-temporal mrf. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 5977–5986, 2018.
|
| 193 |
+
|
| 194 |
+
Zhipeng Bao, Pavel Tokmakov, Allan Jabri, Yu-Xiong Wang, Adrien Gaidon, and Martial Hebert. Discovering objects that can move. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 11789–11798, June 2022.
|
| 195 |
+
|
| 196 |
+
Daniel Bear, Chaofei Fan, Damian Mrowca, Yunzhu Li, Seth Alter, Aran Nayebi, Jeremy Schwartz, Li F Fei-Fei, Jiajun Wu, Josh Tenenbaum, et al. Learning physical graph representations from visual scenes. Advances in Neural Information Processing Systems, 33:6027–6039, 2020.
|
| 197 |
+
|
| 198 |
+
Beril Besbinar and Pascal Frossard. Self-supervision by prediction for object discovery in videos. In 2021 IEEE International Conference on Image Processing (ICIP), pp. 1509–1513. IEEE, 2021.
|
| 199 |
+
|
| 200 |
+
Thomas Brox and Jitendra Malik. Object segmentation by long term analysis of point trajectories. In European conference on computer vision, pp. 282–295. Springer, 2010.
|
| 201 |
+
|
| 202 |
+
Christopher P Burgess, Loic Matthey, Nicholas Watters, Rishabh Kabra, Irina Higgins, Matt Botvinick, and Alexander Lerchner. Monet: Unsupervised scene decomposition and representation. arXiv preprint arXiv:1901.11390, 2019.
|
| 203 |
+
|
| 204 |
+
Sergi Caelles, Kevis-Kokitsi Maninis, Jordi Pont-Tuset, Laura Leal-Taixe, Daniel Cremers, and ´ Luc Van Gool. One-shot video object segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 221–230, 2017.
|
| 205 |
+
|
| 206 |
+
Hu Cao, Yueyue Wang, Joy Chen, Dongsheng Jiang, Xiaopeng Zhang, Qi Tian, and Manning Wang. Swin-unet: Unet-like pure transformer for medical image segmentation. arXiv preprint arXiv:2105.05537, 2021.
|
| 207 |
+
|
| 208 |
+
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.
|
| 209 |
+
|
| 210 |
+
Kyunghyun Cho, Bart van Merrienboer, C¸ aglar Gulc¸ehre, Dzmitry Bahdanau, Fethi Bougares, Hol- ¨ ger Schwenk, and Yoshua Bengio. Learning phrase representations using rnn encoder-decoder for statistical machine translation. In EMNLP, 2014.
|
| 211 |
+
|
| 212 |
+
Subhabrata Choudhury, Laurynas Karazija, Iro Laina, Andrea Vedaldi, and Christian Rupprecht. Guess what moves: Unsupervised video and image segmentation by anticipating motion. arXiv preprint arXiv:2205.07844, 2022.
|
| 213 |
+
|
| 214 |
+
Eric Crawford and Joelle Pineau. Spatially invariant unsupervised object detection with convolutional neural networks. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 3412–3420, 2019.
|
| 215 |
+
|
| 216 |
+
Eric Crawford and Joelle Pineau. Exploiting spatial invariance for scalable unsupervised object tracking. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 3684– 3692, 2020.
|
| 217 |
+
|
| 218 |
+
Suyog Dutt Jain, Bo Xiong, and Kristen Grauman. Fusionseg: Learning to combine motion and appearance for fully automatic segmentation of generic objects in videos. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3664–3673, 2017.
|
| 219 |
+
|
| 220 |
+
Patrick Emami, Pan He, Sanjay Ranka, and Anand Rangarajan. Efficient iterative amortized inference for learning symmetric and disentangled multi-object representations. In International Conference on Machine Learning, pp. 2970–2981. PMLR, 2021.
|
| 221 |
+
|
| 222 |
+
Martin Engelcke, Adam R Kosiorek, Oiwi Parker Jones, and Ingmar Posner. Genesis: Generative scene inference and sampling with object-centric latent representations. arXiv preprint arXiv:1907.13052, 2019.
|
| 223 |
+
|
| 224 |
+
Martin Engelcke, Oiwi Parker Jones, and Ingmar Posner. Genesis-v2: Inferring unordered object representations without iterative refinement. Advances in Neural Information Processing Systems, 34:8085–8094, 2021.
|
| 225 |
+
|
| 226 |
+
Alon Faktor and Michal Irani. Video segmentation by non-local consensus voting. In BMVC, volume 2, pp. 8, 2014.
|
| 227 |
+
|
| 228 |
+
Deng-Ping Fan, Wenguan Wang, Ming-Ming Cheng, and Jianbing Shen. Shifting more attention to video salient object detection. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 8554–8564, 2019.
|
| 229 |
+
|
| 230 |
+
Katerina Fragkiadaki, Geng Zhang, and Jianbo Shi. Video segmentation by tracing discontinuities in a trajectory embedding. In 2012 IEEE Conference on Computer Vision and Pattern Recognition, pp. 1846–1853. IEEE, 2012.
|
| 231 |
+
|
| 232 |
+
James Jerome Gibson and Leonard Carmichael. The senses considered as perceptual systems, volume 2. Houghton Mifflin Boston, 1966.
|
| 233 |
+
|
| 234 |
+
Klaus Greff, Raphael Lopez Kaufman, Rishabh Kabra, Nick Watters, Christopher Burgess, Daniel ¨ Zoran, Loic Matthey, Matthew Botvinick, and Alexander Lerchner. Multi-object representation learning with iterative variational inference. In International Conference on Machine Learning, pp. 2424–2433. PMLR, 2019.
|
| 235 |
+
|
| 236 |
+
Yuan-Ting Hu, Jia-Bin Huang, and Alexander Schwing. Maskrnn: Instance level video object segmentation. Advances in neural information processing systems, 30, 2017.
|
| 237 |
+
|
| 238 |
+
Yuan-Ting Hu, Jia-Bin Huang, and Alexander G Schwing. Videomatch: Matching based video object segmentation. In Proceedings of the European conference on computer vision (ECCV), pp. 54–70, 2018.
|
| 239 |
+
|
| 240 |
+
Allan Jabri, Andrew Owens, and Alexei Efros. Space-time correspondence as a contrastive random walk. Advances in neural information processing systems, 33:19545–19560, 2020.
|
| 241 |
+
|
| 242 |
+
Jindong Jiang and Sungjin Ahn. Generative neurosymbolic machines. Advances in Neural Information Processing Systems, 33:12572–12582, 2020.
|
| 243 |
+
|
| 244 |
+
Jindong Jiang, Sepehr Janghorbani, Gerard De Melo, and Sungjin Ahn. Scalor: Generative world models with scalable object representations. arXiv preprint arXiv:1910.02384, 2019.
|
| 245 |
+
|
| 246 |
+
Joakim Johnander, Martin Danelljan, Emil Brissman, Fahad Shahbaz Khan, and Michael Felsberg. A generative appearance model for end-to-end video object segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8953–8962, 2019.
|
| 247 |
+
|
| 248 |
+
Rishabh Kabra, Daniel Zoran, Goker Erdogan, Loic Matthey, Antonia Creswell, Matt Botvinick, Alexander Lerchner, and Chris Burgess. Simone: View-invariant, temporally-abstracted object representations via unsupervised video decomposition. Advances in Neural Information Processing Systems, 34:20146–20159, 2021.
|
| 249 |
+
|
| 250 |
+
Margret Keuper, Bjoern Andres, and Thomas Brox. Motion trajectory segmentation via minimum cost multicuts. In Proceedings of the IEEE international conference on computer vision, pp. 3271–3279, 2015.
|
| 251 |
+
|
| 252 |
+
Thomas Kipf, Gamaleldin Fathy Elsayed, Aravindh Mahendran, Austin Stone, Sara Sabour, Georg Heigold, Rico Jonschkowski, Alexey Dosovitskiy, and Klaus Greff. Conditional object-centric learning from video. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ aD7uesX1GF_.
|
| 253 |
+
|
| 254 |
+
Adam Kosiorek, Hyunjik Kim, Yee Whye Teh, and Ingmar Posner. Sequential attend, infer, repeat: Generative modelling of moving objects. Advances in Neural Information Processing Systems, 31, 2018.
|
| 255 |
+
|
| 256 |
+
John Lafferty, Andrew McCallum, and Fernando CN Pereira. Conditional random fields: Probabilistic models for segmenting and labeling sequence data. 2001.
|
| 257 |
+
|
| 258 |
+
Z. Lai and W. Xie. Self-supervised learning for video correspondence flow. In BMVC, 2019.
|
| 259 |
+
|
| 260 |
+
Zihang Lai, Erika Lu, and Weidi Xie. Mast: A memory-augmented self-supervised tracker. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6479– 6488, 2020.
|
| 261 |
+
|
| 262 |
+
Hala Lamdouar, Weidi Xie, and Andrew Zisserman. Segmenting invisible moving objects. In British Machine Vision Association, 2021.
|
| 263 |
+
|
| 264 |
+
Jose Lezama, Karteek Alahari, Josef Sivic, and Ivan Laptev. Track to the future: Spatio-temporal ´ video segmentation with long-range motion cues. In CVPR 2011, pp. 3369–3376. IEEE, 2011.
|
| 265 |
+
|
| 266 |
+
Fuxin Li, Taeyoung Kim, Ahmad Humayun, David Tsai, and James M Rehg. Video segmentation by tracking many figure-ground segments. In Proceedings of the IEEE international conference on computer vision, pp. 2192–2199, 2013.
|
| 267 |
+
|
| 268 |
+
Xiaoxiao Li and Chen Change Loy. Video object segmentation with joint re-identification and attention-aware mask propagation. In Proceedings of the European conference on computer vision (ECCV), pp. 90–105, 2018.
|
| 269 |
+
|
| 270 |
+
Xueting Li, Sifei Liu, Shalini De Mello, Xiaolong Wang, Jan Kautz, and MingHsuan Yang. Joint-task self-supervised learning for temporal correspondence. I n H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alche-Buc, E. Fox, and R. Garnett ´ (eds.), Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. URL https://proceedings.neurips.cc/paper/2019/file/ 140f6969d5213fd0ece03148e62e461e-Paper.pdf.
|
| 271 |
+
|
| 272 |
+
Zhixuan Lin, Yi-Fu Wu, Skand Vishwanath Peri, Weihao Sun, Gautam Singh, Fei Deng, Jindong Jiang, and Sungjin Ahn. Space: Unsupervised object-oriented scene representation via spatial attention and decomposition. arXiv preprint arXiv:2001.02407, 2020.
|
| 273 |
+
|
| 274 |
+
Liang Liu, Jiangning Zhang, Ruifei He, Yong Liu, Yabiao Wang, Ying Tai, Donghao Luo, Chengjie Wang, Jilin Li, and Feiyue Huang. Learning by analogy: Reliable supervision from transformations for unsupervised optical flow estimation. In IEEE Conference on Computer Vision and Pattern Recognition(CVPR), 2020.
|
| 275 |
+
|
| 276 |
+
Runtao Liu, Zhirong Wu, Stella Yu, and Stephen Lin. The emergence of objectness: Learning zero-shot segmentation from videos. In M. Ranzato, A. Beygelzimer, Y. Dauphin, P.S. Liang, and J. Wortman Vaughan (eds.), Advances in Neural Information Processing Systems, volume 34, pp. 13137–13152. Curran Associates, Inc., 2021. URL https://proceedings.neurips. cc/paper/2021/file/6d9cb7de5e8ac30bd5e8734bc96a35c1-Paper.pdf.
|
| 277 |
+
|
| 278 |
+
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.
|
| 279 |
+
|
| 280 |
+
Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In International Conference on Learning Representations, 2018.
|
| 281 |
+
|
| 282 |
+
Xiankai Lu, Wenguan Wang, Chao Ma, Jianbing Shen, Ling Shao, and Fatih Porikli. See more, know more: Unsupervised video object segmentation with co-attention siamese networks. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 3623– 3632, 2019.
|
| 283 |
+
|
| 284 |
+
Xiankai Lu, Wenguan Wang, Jianbing Shen, Yu-Wing Tai, David J. Crandall, and Steven C. H. Hoi. Learning video object segmentation from unlabeled videos. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020.
|
| 285 |
+
|
| 286 |
+
K-K Maninis, Sergi Caelles, Yuhua Chen, Jordi Pont-Tuset, Laura Leal-Taixe, Daniel Cremers, and ´ Luc Van Gool. Video object segmentation without temporal information. IEEE transactions on pattern analysis and machine intelligence, 41(6):1515–1530, 2018.
|
| 287 |
+
|
| 288 |
+
N. Mayer, E. Ilg, P. Hausser, P. Fischer, D. Cremers, A. Dosovitskiy, and T. Brox. A large ¨ dataset to train convolutional networks for disparity, optical flow, and scene flow estimation. In IEEE International Conference on Computer Vision and Pattern Recognition (CVPR), 2016. URL http://lmb.informatik.uni-freiburg.de/Publications/2016/ MIFDB16. arXiv:1512.02134.
|
| 289 |
+
|
| 290 |
+
Cheol-Hui Min, Jinseok Bae, Junho Lee, and Young Min Kim. Gatsbi: Generative agent-centric spatio-temporal object interaction. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3074–3083, 2021.
|
| 291 |
+
|
| 292 |
+
Peter Ochs and Thomas Brox. Higher order motion models and spectral clustering. In 2012 IEEE Conference on Computer Vision and Pattern Recognition, pp. 614–621. IEEE, 2012.
|
| 293 |
+
|
| 294 |
+
Peter Ochs, Jitendra Malik, and Thomas Brox. Segmentation of moving objects by long term video analysis. IEEE transactions on pattern analysis and machine intelligence, 36(6):1187–1200, 2013.
|
| 295 |
+
|
| 296 |
+
Seoung Wug Oh, Joon-Young Lee, Ning Xu, and Seon Joo Kim. Video object segmentation using space-time memory networks. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 9226–9235, 2019.
|
| 297 |
+
|
| 298 |
+
Federico Perazzi, Jordi Pont-Tuset, Brian McWilliams, Luc Van Gool, Markus Gross, and Alexander Sorkine-Hornung. A benchmark dataset and evaluation methodology for video object segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 724–732, 2016.
|
| 299 |
+
|
| 300 |
+
Federico Perazzi, Anna Khoreva, Rodrigo Benenson, Bernt Schiele, and Alexander SorkineHornung. Learning video object segmentation from static images. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2663–2672, 2017.
|
| 301 |
+
|
| 302 |
+
Rene Ranftl, Alexey Bochkovskiy, and Vladlen Koltun. Vision transformers for dense prediction. In ´ Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 12179–12188, 2021.
|
| 303 |
+
|
| 304 |
+
Christian Schmidt, Ali Athar, Sabarinath Mahadevan, and Bastian Leibe. D2conv3d: Dynamic dilated convolutions for object segmentation in videos. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pp. 1200–1209, 2022.
|
| 305 |
+
|
| 306 |
+
Deqing Sun, Xiaodong Yang, Ming-Yu Liu, and Jan Kautz. Pwc-net: Cnns for optical flow using pyramid, warping, and cost volume. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 8934–8943, 2018.
|
| 307 |
+
|
| 308 |
+
Zachary Teed and Jia Deng. Raft: Recurrent all-pairs field transforms for optical flow. In European conference on computer vision, pp. 402–419. Springer, 2020.
|
| 309 |
+
|
| 310 |
+
Joshua B Tenenbaum, Charles Kemp, Thomas L Griffiths, and Noah D Goodman. How to grow a mind: Statistics, structure, and abstraction. science, 331(6022):1279–1285, 2011.
|
| 311 |
+
|
| 312 |
+
Pavel Tokmakov, Karteek Alahari, and Cordelia Schmid. Learning motion patterns in videos. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3386–3394, 2017a.
|
| 313 |
+
|
| 314 |
+
Pavel Tokmakov, Karteek Alahari, and Cordelia Schmid. Learning video object segmentation with visual memory. In Proceedings of the IEEE International Conference on Computer Vision, pp. 4481–4490, 2017b.
|
| 315 |
+
|
| 316 |
+
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.
|
| 317 |
+
|
| 318 |
+
Paul Voigtlaender, Yuning Chai, Florian Schroff, Hartwig Adam, Bastian Leibe, and Liang-Chieh Chen. Feelvos: Fast end-to-end embedding learning for video object segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9481–9490, 2019.
|
| 319 |
+
|
| 320 |
+
Carl Vondrick, Abhinav Shrivastava, Alireza Fathi, Sergio Guadarrama, and Kevin Murphy. Tracking emerges by colorizing videos. In Proceedings of the European conference on computer vision (ECCV), pp. 391–408, 2018.
|
| 321 |
+
|
| 322 |
+
Ning Wang, Yibing Song, Chao Ma, Wengang Zhou, Wei Liu, and Houqiang Li. Unsupervised deep tracking. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 1308–1317, 2019.
|
| 323 |
+
|
| 324 |
+
Wenguan Wang, Jianbing Shen, Ruigang Yang, and Fatih Porikli. Saliency-aware video object segmentation. IEEE transactions on pattern analysis and machine intelligence, 40(1):20–33, 2017.
|
| 325 |
+
|
| 326 |
+
Yangtao Wang, Xi Shen, Yuan Yuan, Yuming Du, Maomao Li, Shell Xu Hu, James L Crowley, and Dominique Vaufreydaz. TokenCut: Segmenting Objects in Images and Videos with Selfsupervised Transformer and Normalized Cut. working paper or preprint, 2022. URL https: //hal.archives-ouvertes.fr/hal-03765422.
|
| 327 |
+
|
| 328 |
+
Max Wertheimer. Untersuchungen zur lehre von der gestalt. ii. Psychologische forschung, 4(1): 301–350, 1923.
|
| 329 |
+
|
| 330 |
+
Christopher Xie, Yu Xiang, Zaid Harchaoui, and Dieter Fox. Object discovery in videos as foreground motion clustering. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9994–10003, 2019.
|
| 331 |
+
|
| 332 |
+
Junyu Xie, Weidi Xie, and Andrew Zisserman. Segmenting moving objects via an object-centric layered representation. In Advances in Neural Information Processing Systems, 2022.
|
| 333 |
+
|
| 334 |
+
Jiarui Xu and Xiaolong Wang. Rethinking self-supervised correspondence learning: A video framelevel similarity perspective. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 10075–10085, 2021.
|
| 335 |
+
|
| 336 |
+
Charig Yang, Hala Lamdouar, Erika Lu, Andrew Zisserman, and Weidi Xie. Self-supervised video object segmentation by motion grouping. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 7177–7188, October 2021a.
|
| 337 |
+
|
| 338 |
+
Yanchao Yang, Antonio Loquercio, Davide Scaramuzza, and Stefano Soatto. Unsupervised moving object detection via contextual information separation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2019.
|
| 339 |
+
|
| 340 |
+
Yanchao Yang, Brian Lai, and Stefano Soatto. Dystab: Unsupervised object segmentation via dynamic-static bootstrapping. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2826–2836, June 2021b.
|
| 341 |
+
|
| 342 |
+
Vickie Ye, Zhengqi Li, Richard Tucker, Angjoo Kanazawa, and Noah Snavely. Deformable sprites for unsupervised video decomposition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2657–2666, 2022a.
|
| 343 |
+
|
| 344 |
+
Vickie Ye, Zhengqi Li, Richard Tucker, Angjoo Kanazawa, and Noah Snavely. Deformable sprites for unsupervised video decomposition. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2022b.
|
| 345 |
+
|
| 346 |
+
Polina Zablotskaia, Edoardo A Dominici, Leonid Sigal, and Andreas M Lehrmann. Unsupervised video decomposition using spatio-temporal iterative inference. arXiv preprint arXiv:2006.14727, 2020.
|
| 347 |
+
|
| 348 |
+
Tianfei Zhou, Shunzhou Wang, Yi Zhou, Yazhou Yao, Jianwu Li, and Ling Shao. Motion-attentive transition for zero-shot video object segmentation. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 13066–13073, 2020.
|
| 349 |
+
|
| 350 |
+
Xizhou Zhu, Han Hu, Stephen Lin, and Jifeng Dai. Deformable convnets v2: More deformable, better results. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 9308–9316, 2019.
|
| 351 |
+
|
| 352 |
+
# A MORE IMPLEMENTATION DETAILS
|
| 353 |
+
|
| 354 |
+
In this section, we list the architecture details and training settings. Codes and models will be released publicly.
|
| 355 |
+
|
| 356 |
+
# A.1 VISUAL ENCODER
|
| 357 |
+
|
| 358 |
+
The visual encoder contains the first three stages of Swin-Tiny V2. We tabulate the workflow in Table 3.
|
| 359 |
+
Table 3: Architecture of visual encoder. $h$ stands for the number of attention heads while $w s$ refers to window size.
|
| 360 |
+
|
| 361 |
+
<table><tr><td>stage</td><td>operation</td><td>output sizes</td></tr><tr><td>input</td><td>=</td><td>3×192×384</td></tr><tr><td>PatchEmbed</td><td>4 × 4, stride 4, 96</td><td>96 × 48 × 96</td></tr><tr><td>SwinBlock1</td><td>h=3 ×2 [ws= 12]</td><td>96 × 48 × 96</td></tr><tr><td>DownSample1</td><td>192</td><td>192 × 24× 48</td></tr><tr><td>SwinBlock2</td><td>h=6] ×2 [ws=12</td><td>192 × 24× 48</td></tr><tr><td>DownSample2</td><td>384</td><td>384 × 12 × 24</td></tr><tr><td>SwinBlock3</td><td>[h=12] ×6 [ws=12</td><td>384 × 12 × 24</td></tr></table>
|
| 362 |
+
|
| 363 |
+
# A.2 FRAME COMPARATOR
|
| 364 |
+
|
| 365 |
+
The frame comparator possesses two deformable convolutional layers, with ReLU operation in between and three Transformer Encoder blocks. We tabulate the workflow in Table 4.
|
| 366 |
+
Table 4: Architecture of frame comparator. $h$ represents the number of attention heads
|
| 367 |
+
|
| 368 |
+
<table><tr><td>stage</td><td>operation</td><td>output sizes</td></tr><tr><td>input</td><td>1</td><td>768 × 12 × 24</td></tr><tr><td>DeformConv1</td><td>3 ×3,768</td><td>768 × 12 × 24</td></tr><tr><td>ReLU</td><td>-</td><td>768 × 12 × 24</td></tr><tr><td>DeformConv2</td><td>3 ×3,384</td><td>384 ×12×24</td></tr><tr><td>Transformer</td><td>[h=8] ×3 384</td><td>384× 12 ×24</td></tr></table>
|
| 369 |
+
|
| 370 |
+
# A.3 FLOW DECODER
|
| 371 |
+
|
| 372 |
+
The frame comparator consists of three stages of SwinV2 block added with linear expanding layers.
|
| 373 |
+
We tabulate the workflow in Table 5.
|
| 374 |
+
|
| 375 |
+
# A.4 TRAINING DETAILS
|
| 376 |
+
|
| 377 |
+
For all datasets, we train with a batch size of 2. To train more efficiently, we sample three flow pairs $( i j )$ for a given frame $i$ ; one is static replication $i = j$ , another two are motion pair $i \neq j$ . We apply temporal consistency first on the masks from two motion pairs, then pull the static mask to the average of two dynamic masks closer. We linearly warm up the learning rate for the first 1k iterations. Besides, for every $1 0 0 \mathrm { k }$ iterations, we decay the learning rate by half and increase the scale of temporal consistency $\lambda _ { c }$ and entropy regularisation $\lambda _ { e }$ by the factor of 5. In the default setting, we train for about 3 days on 8 standard Tesla V100 GPUs with 32GB memory each.
|
| 378 |
+
|
| 379 |
+
Table 5: Architecture of flow decoder. $h$ stands for the number of attention heads while ws refers to window size.
|
| 380 |
+
|
| 381 |
+
<table><tr><td>stage</td><td>operation</td><td>output sizes</td></tr><tr><td>input</td><td>= [h=12]</td><td>384×12×24</td></tr><tr><td>SwinBlock1</td><td>×2 [ws = 12]</td><td>384 × 12 × 24</td></tr><tr><td>PatchExpand1</td><td>768</td><td>192 × 24 × 48</td></tr><tr><td>SwinBlock2</td><td>h=6] ×2 [ws=12</td><td>192 × 24 × 48</td></tr><tr><td>PatchExpand2</td><td>384</td><td>96 × 48 × 96</td></tr><tr><td>SwinBlock3</td><td>h=3] ×2 [ws=12</td><td>96 × 48 × 96</td></tr><tr><td>PatchExpand3 outConv</td><td>1536 5 × 5, stride 1, 4</td><td>96 ×192 × 384 4×192×384</td></tr></table>
|
| 382 |
+
|
| 383 |
+
# A.5 TEST-TIME ADAPTATION
|
| 384 |
+
|
| 385 |
+
Inspired by OCLR (Xie et al., 2022), we adopt test-time adaptation based on RGB sequence to enhance appearance consistency. In detail, we follow existing works on self-supervised tracking (Lai et al., 2020; Jabri et al., 2020) to propagate object masks across time span. The whole process consists of three steps. First, we extract RGB features of each frame with a DINO-pretrained ViT encoder. Then, we select key frames for object mask propagation. Finally, we calculate the affinity matrix between frames and perform mask propagation.
|
| 386 |
+
|
| 387 |
+
DINO Feature Extraction. Given a video sequence $\boldsymbol { v } = \{ x _ { 1 } , . . . , x _ { T } \} , \boldsymbol { v } \in \mathbb { R } ^ { T \times H \times W \times 3 }$ , we use DINO pretrained ViT-Small encoder with patch size $8 \times 8$ to extract features:
|
| 388 |
+
|
| 389 |
+
$$
|
| 390 |
+
\{ f _ { 1 } , . . . , f _ { T } \} = \{ \Phi ( x _ { 1 } ) , . . . , \Phi ( x _ { T } ) \} , \quad f _ { t } \in \mathbb { R } ^ { h \times w \times 3 8 4 } ,
|
| 391 |
+
$$
|
| 392 |
+
|
| 393 |
+
where $h = H / / 8$ and $w = W / / 8$ . The extracted features will be used in the mask propagation step.
|
| 394 |
+
|
| 395 |
+
Key Frame Selection. Given video $v$ , our model predicts object mask of each frame as $m =$ $\{ \alpha _ { 1 } , . . . , \alpha _ { T } \} , m \in \mathbb { R } ^ { T \times H \times W \times 1 }$ . Since the video frames are continuous along the temporal dimension, it is practical to propagate object masks between neighboring frames. The propagation operation is the same as Jabri et al. (2020), the only difference is that we have no ground-truth mask for reference. Therefore, we need to design a mechanism to select object masks of high confidence. To do this, we measure the temporal coherence of predicted object masks for key frame selection. Specifically, for each timestamp $t \in \{ 3 , . . . , T - 2 \}$ , we can calculate four propagated masks as:
|
| 396 |
+
|
| 397 |
+
$$
|
| 398 |
+
\hat { \alpha } _ { t } = [ \mathrm { M a s k - p r o p } ( \alpha _ { t - 2 } ) , \mathrm { M a s k - p r o p } ( \alpha _ { t - 1 } ) , \mathrm { M a s k - p r o p } ( \alpha _ { t + 1 } ) , \mathrm { M a s k - p r o p } ( \alpha _ { t + 2 } ) ] ,
|
| 399 |
+
$$
|
| 400 |
+
|
| 401 |
+
where ‘Mask-prop’ denotes the propagation operation. Then we calculate the average IoU between the original mask and propagated masks as the confidence score:
|
| 402 |
+
|
| 403 |
+
$$
|
| 404 |
+
s _ { t } = \frac { \mathrm { I o U } ( \hat { \alpha } _ { t } [ 0 ] , \alpha _ { t } ) + \mathrm { I o U } ( \hat { \alpha } _ { t } [ 1 ] , \alpha _ { t } ) + \mathrm { I o U } ( \hat { \alpha } _ { t } [ 2 ] , \alpha _ { t } ) + \mathrm { I o U } ( \hat { \alpha } _ { t } [ 3 ] , \alpha _ { t } ) } { 4 } .
|
| 405 |
+
$$
|
| 406 |
+
|
| 407 |
+
The calculated $s _ { t }$ measures the coherency between $\alpha _ { t }$ and its neighbors. Our empirical studies show that it serves as a reliable signal for key frame selection.
|
| 408 |
+
|
| 409 |
+
Object Mask Propagation. We select timestamps with Top- $k \%$ confidence score as the key reference frames $k = 1 5$ on DAVIS2016, $k = 2 5$ on SegTrackv2, $k = 1 0$ on FBMS-59). Then we iteratively propagate the object masks with a neighbor temporal window size $n = 7$ . Compared to conventional semi-supervised object segmentation which only relies on the first frame as key frame, we have multiple key frames on different temporal positions to correct the accumulated propagation error. In this way, the propagation enhances object permanence across time and boosts performance.
|
| 410 |
+
|
| 411 |
+
# B RESULTS BREAKDOWN
|
| 412 |
+
|
| 413 |
+
We include a specific result breakdown in this section. We show the per-sequence results on DAVIS2016 in Table 6, SegTrackv2 in Table 7 and FBMS-59 in Table 8.
|
| 414 |
+
|
| 415 |
+
Table 6: Sequence-wise results on DAVIS2016.
|
| 416 |
+
|
| 417 |
+
<table><tr><td rowspan="2"> Sequence</td><td colspan="2">J (Mean) ↑</td></tr><tr><td>w/o post proc.</td><td>test-time adap.</td></tr><tr><td>dog</td><td>80.7</td><td>87.4</td></tr><tr><td>cows</td><td>87.2</td><td>88.8</td></tr><tr><td>goat</td><td>47.5</td><td>80.6</td></tr><tr><td>camel</td><td>85.6</td><td>86.1</td></tr><tr><td>libby</td><td>72.5</td><td>77.7</td></tr><tr><td>parkour</td><td>72.9</td><td>87.9</td></tr><tr><td>soapbox</td><td>84.6</td><td>86.5</td></tr><tr><td>blackswan</td><td>48.9</td><td>46.9</td></tr><tr><td>bmx-trees</td><td>50.1</td><td>55.8</td></tr><tr><td>kite-surf</td><td>55.9</td><td>62.6</td></tr><tr><td>car-shadow</td><td>87.9</td><td>86.9</td></tr><tr><td>breakdance</td><td>82.6</td><td>76.0</td></tr><tr><td>dance-twirl</td><td>82.5</td><td>85.4</td></tr><tr><td>scooter-black</td><td>80.2</td><td>80.3</td></tr><tr><td>drift-chicane</td><td>78.6</td><td>82.2</td></tr><tr><td>motocross-jump</td><td>68.4</td><td>88.9</td></tr><tr><td>horsejump-high</td><td>78.0</td><td>84.3</td></tr><tr><td>drift-straight</td><td>69.2</td><td>80.0</td></tr><tr><td>car-roundabout</td><td>87.7</td><td>83.9</td></tr><tr><td>paragliding-launch</td><td>62.1</td><td>62.8</td></tr><tr><td>frame avg.</td><td>73.9</td><td>79.2</td></tr></table>
|
| 418 |
+
|
| 419 |
+
Table 7: Sequence-wise results on SegTrackv2.
|
| 420 |
+
|
| 421 |
+
<table><tr><td rowspan="2">Sequence</td><td colspan="2">J (Mean) ↑</td></tr><tr><td>w/o post proc.</td><td>test-time adap.</td></tr><tr><td>drift</td><td>41.7</td><td>40.7</td></tr><tr><td>birdfall</td><td>38.2</td><td>61.5</td></tr><tr><td>girl</td><td>76.5</td><td>82.3</td></tr><tr><td>cheetah</td><td>18.4</td><td>30.1</td></tr><tr><td>worm</td><td>52.5</td><td>74.3</td></tr><tr><td>parachute</td><td>90.2</td><td>92.0</td></tr><tr><td>monkeydog</td><td>14.3</td><td>31.1</td></tr><tr><td>hummingbird</td><td>61.2</td><td>58.8</td></tr><tr><td>soldier</td><td>66.3</td><td>58.8</td></tr><tr><td>bmx</td><td>73.7</td><td>78.8</td></tr><tr><td>frog</td><td>80.5</td><td>76.3</td></tr><tr><td>penguin</td><td>63.5</td><td>62.7</td></tr><tr><td>monkey</td><td>46.8</td><td>77.4</td></tr><tr><td>bird of paradise</td><td>85.3</td><td>85.4</td></tr><tr><td>frame avg.</td><td>62.2</td><td>69.4</td></tr></table>
|
| 422 |
+
|
| 423 |
+
Table 8: Sequence-wise results on FBMS-59.
|
| 424 |
+
|
| 425 |
+
<table><tr><td rowspan="2"></td><td colspan="2">J (Mean) ↑</td></tr><tr><td>w/o post proc.</td><td>test-time adap.</td></tr><tr><td>Sequence camel01</td><td>25.8</td><td>66.9</td></tr><tr><td>cars1</td><td>66.1</td><td>88.3</td></tr><tr><td>cars10</td><td>31.6</td><td>33.9</td></tr><tr><td>cars4</td><td>72.9</td><td>83.2</td></tr><tr><td>cars5</td><td>81.2</td><td>82.5</td></tr><tr><td>cats01</td><td>80.6</td><td>79.2</td></tr><tr><td>cats03</td><td>62.0</td><td>63.4</td></tr><tr><td>cats06</td><td>40.1</td><td>38.7</td></tr><tr><td>dogs01</td><td>70.6</td><td>61.2</td></tr><tr><td>dogs02</td><td>62.8</td><td>82.2</td></tr><tr><td>farm01</td><td>86.7</td><td>88.9</td></tr><tr><td>giraffesO1</td><td>38.6</td><td>52.2</td></tr><tr><td>goats01</td><td>44.8</td><td>45.3</td></tr><tr><td>horses02</td><td>64.4</td><td>77.6</td></tr><tr><td>horses04</td><td>68.5</td><td>73.5</td></tr><tr><td>horses05</td><td>43.7</td><td>49.0</td></tr><tr><td>lion01</td><td>60.1</td><td>71.5</td></tr><tr><td>marple12</td><td>74.7</td><td>80.3</td></tr><tr><td>marple2</td><td>65.0</td><td>71.4</td></tr><tr><td>marple4</td><td>79.1</td><td>91.6</td></tr><tr><td>marple6</td><td>76.0</td><td>85.1</td></tr><tr><td>marple7</td><td>72.5</td><td>55.2</td></tr><tr><td>marple9</td><td>87.5</td><td>97.9</td></tr><tr><td>people03</td><td>76.5</td><td>48.5</td></tr><tr><td>people1</td><td>72.4</td><td>80.8</td></tr><tr><td>people2</td><td>80.9</td><td>83.0</td></tr><tr><td>rabbits02</td><td>50.2</td><td>58.9</td></tr><tr><td>rabbits03</td><td>39.5</td><td>55.7</td></tr><tr><td>rabbits04</td><td>47.0</td><td>53.0</td></tr><tr><td>tennis</td><td>63.1</td><td>71.1</td></tr><tr><td>frame avg.</td><td>61.3</td><td>66.9</td></tr></table>
|
| 426 |
+
|
| 427 |
+
Table 9: Ablation studies on flow estimator.
|
| 428 |
+
|
| 429 |
+
<table><tr><td>Flow Estimator</td><td>DAVIS2016</td><td>SegTrackv2</td><td>FBMS-59</td></tr><tr><td>RAFT</td><td>73.9</td><td>62.2</td><td>61.3</td></tr><tr><td>ARFlow</td><td>59.2</td><td>51.1</td><td>50.0</td></tr></table>
|
| 430 |
+
|
| 431 |
+

|
| 432 |
+
Figure 4: Per-slot visualization on DAVIS 2016.
|
| 433 |
+
|
| 434 |
+
# C MORE QUANTITATIVE RESULTS
|
| 435 |
+
|
| 436 |
+
Besides RAFT flow estimator, we consider a fully unsupervised model ARFlow (Liu et al., 2020) shown in Table 9. The inferior result brought from ARFlow demonstrates that a good optical flow quality lays strong foundation for the success of the object discovery, which aligns with our motivation.
|
| 437 |
+
|
| 438 |
+
# D MORE QUALITATIVE RESULTS
|
| 439 |
+
|
| 440 |
+
We visualize the segmentation results when initializing 5 slots vectors in Figure 4. The results are promising, where each slot groups similar part under the only supervision of motion. We believe more supervision like semantics (Caron et al., 2021) and depth (Ranftl et al., 2021) would lead to better segmentation. We show more qualitative results of SegTrackv2 and FBMS-59 in Figure 5 and Figure 6. Besides,
|
| 441 |
+
|
| 442 |
+

|
| 443 |
+
Figure 5: Qualitative results on SegTrackv2. MG refers to Yang et al. (2021a). Red boxes outline the corresponding difference.
|
| 444 |
+
|
| 445 |
+

|
| 446 |
+
Figure 6: Qualitative results on FBMS-59. MG refers to Yang et al. (2021a). Red boxes highlight the corresponding difference.
|
md/dev/KLaDXLAzzFT/KLaDXLAzzFT.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/KVYq2Ea90PC/KVYq2Ea90PC.md
ADDED
|
@@ -0,0 +1,457 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# A STUDY OF FACE OBFUSCATION IN IMAGENET
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Face obfuscation (blurring, mosaicing, etc.) has been shown to be effective for privacy protection; nevertheless, object recognition research typically assumes access to complete, unobfuscated images. In this paper, we explore the effects of face obfuscation on the popular ImageNet challenge visual recognition benchmark. Most categories in the ImageNet challenge are not people categories; however, many incidental people appear in the images, and their privacy is a concern. We first annotate faces in the dataset. Then we demonstrate that face blurring and overlaying—two typical obfuscation techniques—have minimal impact on the accuracy of recognition models. Concretely, we benchmark multiple deep neural networks on face-obfuscated images and observe that the overall recognition accuracy drops only slightly $( \leq 1 . 0 \% )$ . Further, we experiment with transfer learning to 4 downstream tasks (object recognition, scene recognition, face attribute classification, and object detection) and show that features learned on face-obfuscated images are equally transferable. Our work demonstrates the feasibility of privacyaware visual recognition, improves the highly-used ImageNet challenge benchmark, and suggests an important path for future visual datasets.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Visual data is being generated at an unprecedented scale. People share billions of photos daily on social media (Meeker, 2014). There is one security camera for every 4 people in China and the United States (Lin & Purnell, 2019). Even your home can be watched by smart devices taking photos (Butler et al., 2015; Dai et al., 2015). Learning from the visual data has led to computer vision applications that promote the common good, e.g., better traffic management (Malhi et al., 2011) and law enforcement (Sajjad et al., 2020). However, it also raises privacy concerns, as images may capture sensitive information such as faces, addresses, and credit cards (Orekondy et al., 2018).
|
| 12 |
+
|
| 13 |
+
Extensive prior research has focused on preventing unauthorized access to sensitive information in private datasets (Fredrikson et al., 2015; Shokri et al., 2017). However, are publicly available datasets free of privacy concerns? Taking the popular ImageNet dataset (Deng et al., 2009) as an example, there are only 3 people categories1 in the 1000 categories of the ImageNet Large Scale Visual Recognition Challenge (ILSVRC) (Russakovsky et al., 2015); nevertheless, the dataset exposes many people co-occurring with other objects in images (Prabhu & Birhane, 2021), e.g., people sitting on chairs, walking dogs, or drinking beer (Fig. 1). It is concerning since ILSVRC is freely available for academic use2 and widely used by the research community.
|
| 14 |
+
|
| 15 |
+
In this paper, we attempt to mitigate ILSVRC’s privacy issues. Specifically, we construct a privacyenhanced version of ILSVRC and gauge its utility as a benchmark for image classification and as a dataset for transfer learning.
|
| 16 |
+
|
| 17 |
+
Face annotation. As an initial step, we focus on a prominent type of private information—faces. To examine and mitigate their privacy issues, we first annotate faces in ImageNet using face detectors and crowdsourcing. We use Amazon Rekognition to detect faces automatically, and then refine the results through crowdsourcing on Amazon Mechanical Turk to obtain accurate annotations.
|
| 18 |
+
|
| 19 |
+
We have annotated 1,431,093 images in ILSVRC, resulting in 562,626 faces from 243,198 images ( $17 \%$ of all images have at least one face). Many categories have more than $90 \%$ images with faces, even though they are not people categories, e.g., volleyball and military uniform. Our annotations confirm that faces are ubiquitous in ILSVRC and pose a privacy issue. We release the face annotations to facilitate subsequent research in privacy-aware visual recognition on ILSVRC.
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
Figure 1: Most categories in ImageNet Challenge (Russakovsky et al., 2015) are not people categories. However, the images contain many people co-occurring with the object of interest, posing a potential privacy threat. These are example images (with faces blurred or overlaid) of barber chair, husky, beer bottle, volleyball and military uniform.
|
| 23 |
+
|
| 24 |
+
Effects of face obfuscation on classification accuracy. Obfuscating sensitive image areas is widely used for preserving privacy (McPherson et al., 2016). We focus on two simple obfuscation methods: blurring and overlaying (Fig. 1), whose privacy effects have been analyzed in prior work (Oh et al., 2016; Li et al., 2017; Hasan et al., 2018). Using our face annotations, we construct face-obfuscated versions of ILSVRC. What are the effects of using them for image classification? At first glance, it seems inconsequential—one should still recognize a car even when the people inside have their faces blurred. Indeed, we verify that validation accuracy drops only slightly $( 0 . \bar { 1 } \% - 0 . 7 \%$ for blurring, $0 . 3 \% { - } 1 . 0 \%$ for overlaying) when using face-obfuscated images to train and evaluate. We analyze this drop in detail (identifying categories which are particularly affected), but this key result demonstrates that we can train privacy-aware visual classifiers on ILSVRC which remain highly competitive, with less than a $1 \%$ accuracy drop.
|
| 25 |
+
|
| 26 |
+
Effects on feature transferability. Besides a classification benchmark, ILSVRC also serves as pretraining data for transferring to domains where labeled images are scarce (Girshick, 2015; Liu et al., 2015a). So a further question is: Does face obfuscation hurt the transferability of visual features learned from ILSVRC? We investigate by pretraining models on the original/obfuscated images and finetuning on 4 downstream tasks: object recognition on CIFAR-10 (Krizhevsky et al., 2009), scene recognition on SUN (Xiao et al., 2010), object detection on PASCAL VOC (Everingham et al., 2010), and face attribute classification on CelebA (Liu et al., 2015b). They include both classification and spatial localization, as well as both face-centric and face-agnostic recognition. In all of the 4 tasks, models pretrained on face-obfuscated images perform closely with models pretrained on original images. We do not see a statistically significant difference between them, suggesting that visual features learned from face-obfuscated pretraining are equally transferable. Again, this encourages us to adopt face obfuscation as an additional protection on visual recognition datasets without worrying about detrimental effects on the dataset’s utility.
|
| 27 |
+
|
| 28 |
+
Contributions. Our contributions are twofold. First, we obtain accurate face annotations in ILSVRC, facilitating subsequent research on privacy protection. We will release the code and the annotations. Second, to the best of our knowledge, we are the first to investigate the effects of privacy-aware face obfuscation on large-scale visual recognition. Through extensive experiments, we demonstrate that training on face-obfuscated images does not significantly compromise accuracy on both image classification and downstream tasks, while providing some privacy protection. Therefore, we advocate for face obfuscation to be included in ImageNet and to become a standard step in future dataset creation efforts.
|
| 29 |
+
|
| 30 |
+
# 2 RELATED WORK
|
| 31 |
+
|
| 32 |
+
Privacy-preserving machine learning (PPML). Machine learning frequently uses private datasets (Chen et al., 2019b). Research in PPML is concerned with an adversary trying to infer the private data. The privacy breach can happen to the trained model. For example, model inversion attack recovers sensitive attributes (e.g., gender, genotype) of an individual given the model’s output (Fredrikson et al., 2014; 2015; Hamm, 2017; Li et al., 2019; Wu et al., 2019). Membership inference attack infers whether an individual was included in training (Shokri et al., 2017; Nasr et al., 2019; Hisamoto et al., 2020). Training data extraction attack extracts verbatim training data from the model (Carlini et al., 2019; 2020). For defending against these attacks, differential privacy is a general framework (Abadi et al., 2016; Chaudhuri & Monteleoni, 2008; McMahan et al., 2018; Jayaraman & Evans, 2019; Jagielski et al., 2020). It requires the model to behave similarly whether or not an individual is in the training data.
|
| 33 |
+
|
| 34 |
+
Privacy breaches can also happen in training/inference. To address hardware/software vulnerabilities, researchers have used enclaves—a hardware mechanism for protecting a memory region from unauthorized access—to execute machine learning workloads (Ohrimenko et al., 2016; Tramer & Boneh, 2018). Machine learning service providers can run their models on users’ private data encrypted using homomorphic encryption (Gilad-Bachrach et al., 2016; Brutzkus et al., 2019; Juvekar et al., 2018; Bian et al., 2020; Yonetani et al., 2017). It is also possible for multiple data owners to train a model collectively without sharing their private data using federated learning (McMahan et al., 2017; Bonawitz et al., 2017; Li et al., 2020) or secure multi-party computation (Shokri & Shmatikov, 2015; Melis et al., 2019; Hamm et al., 2016; Pathak et al., 2010; Hamm et al., 2016).
|
| 35 |
+
|
| 36 |
+
There is a fundamental difference between our work and PPML. PPML focuses on private datasets, whereas we focus on public datasets with private information. ImageNet, like other academic datasets, is publicly available to researchers. There is no point preventing an adversary from inferring the data. However, public datasets can also expose private information about individuals, who may not even be aware of their presence in the data. It is their privacy we are protecting.
|
| 37 |
+
|
| 38 |
+
Privacy in visual data. To mitigate privacy issues with public visual datasets, researchers have attempted to obfuscate private information before publishing the data. Frome et al. (2009) and Uittenbogaard et al. (2019) use blurring and inpainting to obfuscate faces and license plates in Google Street View. nuScenes (Caesar et al., 2020) is an autonomous driving dataset where faces and license plates are detected and then blurred. Similar method is also used for the action dataset AViD (Piergiovanni & Ryoo, 2020).
|
| 39 |
+
|
| 40 |
+
We follow this line of work to obfuscate faces in ImageNet but differ in two critical ways. First, to the best of our knowledge, we are the first to thoroughly analyze the effects of face obfuscation on visual recognition. Second, prior works use only automatic methods such as face detectors, whereas we additionally employ crowdsourcing. Human annotations are more accurate and thus more useful for following research on privacy preservation in ImageNet. Most importantly though, automated face recognition methods are known to contain racial and gender biases (Buolamwini & Gebru, 2018); thus using these methods alone is likely to result in more privacy protection to members of majority groups. Including a manual verification step helps partially mitigate these issues.
|
| 41 |
+
|
| 42 |
+
Finally, we note that face obfuscation alone is not sufficient for privacy protection. Orekondy et al. (2018) constructed Visual Redactions, annotating images with 42 privacy attributes, including faces, names, and addresses. Ideally, we should obfuscate all such information; however, this may not be immediately feasible. Obfuscating faces (omnipresent in visual datasets) is an important first step.
|
| 43 |
+
|
| 44 |
+
Privacy guarantees of face obfuscation. Unfortunately, face obfuscation does not provide any formal guarantee of privacy. Both humans and machines may be able to infer an individual’s identity from face-obfuscated images, presumably relying on cues outside faces such as height and clothing (Chang et al., 2006; Oh et al., 2016). Researchers have tried to protect sensitive image regions against attacks, e.g., by perturbing the image adversarially to reduce the performance of a recognizer (Oh et al., 2017; Ren et al., 2018; Sun et al., 2018; Wu et al., 2018; Xiao et al., 2020). However, these methods are tuned for a particular model and provide no privacy guarantee either.
|
| 45 |
+
|
| 46 |
+
Further, guarantees in privacy may reduce dataset utility as shown for example by Cheng et al. (2021). Therefore, we choose two simple local methods—blurring and overlaying—instead of more sophisticated alternatives. Overlaying removes all information in a face bounding box, whereas blurring removes only partial information. Their effectiveness for privacy protection can be ascertained only empirically, which has been the focus of prior work (Oh et al., 2016; Li et al., 2017; Hasan et al., 2018) but is beyond the scope of this paper.
|
| 47 |
+
|
| 48 |
+
Visual recognition from degraded data. Researchers have studied visual recognition in the presence of various image degradation, including blurring (Vasiljevic et al., 2016), lens distortions (Pei et al., 2018), and low resolution (Ryoo et al., 2016). These undesirable artifacts are due to imperfect sensors rather than privacy concerns. In contrast, we intentionally obfuscate faces for privacy’s sake.
|
| 49 |
+
|
| 50 |
+
Ethical issues with datasets. Datasets are important in machine learning and computer vision. But recently they have been called out for scrutiny (Paullada et al., 2020), especially regarding the presence of people. A prominent issue is imbalanced representation, e.g., underrepresentation of certain demographic groups in data for face recognition (Buolamwini & Gebru, 2018), activity recognition (Zhao et al., 2017), and image captioning (Hendricks et al., 2018).
|
| 51 |
+
|
| 52 |
+
For ImageNet, researchers have examined and attempted to mitigate issues such as geographic diversity, the category vocabulary, and imbalanced representation (Shankar et al., 2017; Stock & Cisse, 2018; Dulhanty & Wong, 2019; Yang et al., 2020). We focus on an orthogonal issue: the privacy of people in the images. Prabhu & Birhane (2021) also discussed ImageNet’s privacy issues and suggested face obfuscation as one potential solution. Our face annotations enable face obfuscation to be implemented, and our experiments support its effectiveness. Concurrent work (Asano et al., 2021) addresses the privacy issue by collecting a dataset of unlabeled images without people.
|
| 53 |
+
|
| 54 |
+
Potential negative impacts. The main concern we see is giving the impression of privacy guarantees when in fact face obfuscation is an imperfect technique for privacy protection. We hope that the above detailed discussion and this clarification will help mitigate this issue. Another important concern is disparate impact on people of different demographics as a result of using automated face detection methods; as mentioned above, we hope that incorporating a manual annotation step will help partially alleviate this issue so that similar privacy preservation is afforded to all.
|
| 55 |
+
|
| 56 |
+
# 3 ANNOTATING FACES IN ILSVRC
|
| 57 |
+
|
| 58 |
+
We annotate faces in ILSVRC (Russakovsky et al., 2015). The annotations localize an important type of sensitive information in ImageNet, making it possible to obfuscate the sensitive areas for privacy protection.
|
| 59 |
+
|
| 60 |
+
It is challenging to annotate faces accurately, at ImageNet’s scale while under a reasonable budget. Automatic face detectors are fast and cheap but not accurate enough, whereas crowdsourcing is accurate but more expensive. Inspired by prior work (Kuznetsova et al., 2018; Yu et al., 2015), we devise a two-stage semi-automatic pipeline that brings the best of both worlds. First, we run the face detector by Amazon Rekognition on all images in ILSVRC. The results contain both false positives and false negatives, so we refine them through crowdsourcing on Amazon Mechanical Turk. Workers are given images with detected bounding boxes, and they adjust existing boxes or create new ones to cover all faces. Please see Appendix A for detail.
|
| 61 |
+
|
| 62 |
+
Annotation quality. To analyze the quality of the face annotations, we select 20 categories on which the face detector is likely to perform poorly. Then we manually check validation images from these categories; the results characterize an upper bound of the overall annotation accuracy.
|
| 63 |
+
|
| 64 |
+
Concretely, first, we randomly sample 10 categories under the mammal subtree in the ImageNet hierarchy (the left 10 categories in Table 1). Images in these categories contain many false positives (animal faces detected as humans). Second, we take the 10 categories with the greatest number of detected faces (the right 10 categories in Table 1). Images in those categories contain many people and thus are likely to have more false negatives. Each of the selected categories has 50 validation images, and two graduate students manually inspected all face annotations on them, including the face detection results and the final crowdsourcing results.
|
| 65 |
+
|
| 66 |
+
Table 1: The number of false positives $( F P s )$ and false negatives (FNs) on validation images from 20 categories challenging for the face detector. Each category has 50 images. The $A$ columns are after automatic face detection, whereas the $H$ columns are human results after crowdsourcing.
|
| 67 |
+
|
| 68 |
+
<table><tr><td rowspan="2">Category</td><td colspan="2">#FPs</td><td colspan="2">#FNs</td><td rowspan="2">Category</td><td colspan="2">#FPs</td><td colspan="2">#FNs</td></tr><tr><td>A</td><td>H</td><td>A</td><td>H</td><td></td><td>H</td><td>A</td><td>H</td></tr><tr><td>irish setter</td><td>12</td><td>3</td><td>0</td><td>0</td><td>maypole</td><td>0</td><td>0</td><td>7</td><td>5</td></tr><tr><td>gorilla</td><td>32</td><td>7</td><td>0</td><td>0</td><td>basketball</td><td>0</td><td>0</td><td>7</td><td>2</td></tr><tr><td>cheetah</td><td>3</td><td>1</td><td>0</td><td>0</td><td>volleyball</td><td>0</td><td>0</td><td>10</td><td>5</td></tr><tr><td>basset</td><td>10</td><td>0</td><td>0</td><td>0</td><td>balance beam</td><td>0</td><td>0</td><td>9</td><td>5</td></tr><tr><td>lynx</td><td>9</td><td>1</td><td>0</td><td>0</td><td>unicycle</td><td>0</td><td>1</td><td>6</td><td>1</td></tr><tr><td>rottweiler</td><td>11</td><td>4</td><td>0</td><td>0</td><td>stage</td><td>0</td><td>0</td><td>0</td><td>0</td></tr><tr><td>sorrel</td><td>2</td><td>1</td><td>0</td><td>0</td><td>torch</td><td>2</td><td>1</td><td>1</td><td>1</td></tr><tr><td>impala</td><td>1</td><td>0</td><td>0</td><td>0</td><td>baseball player</td><td>0</td><td>0</td><td>0</td><td>0</td></tr><tr><td>bernese mt. dog</td><td>20</td><td>3</td><td>0</td><td>0</td><td>military uniform</td><td>3</td><td>2</td><td>2</td><td>0</td></tr><tr><td>silky terrier</td><td>4</td><td>0</td><td>0</td><td>0</td><td>steel drum</td><td>1</td><td>1</td><td>1</td><td>0</td></tr><tr><td>Average</td><td>10.4</td><td>2.0</td><td>0.0</td><td>0.0</td><td>Average</td><td>0.6</td><td>0.5</td><td>4.3</td><td>1.9</td></tr></table>
|
| 69 |
+
|
| 70 |
+
Table 2: Some categories grouped into supercategories in WordNet (Miller, 1998). For each supercategory, we show the fraction of images with faces. These supercategories have fractions significantly deviating from the average of the entire ILSVRC $( 1 7 \% )$ .
|
| 71 |
+
|
| 72 |
+
<table><tr><td>Supercategory</td><td>#Categories</td><td>#Images</td><td>With faces (%)</td></tr><tr><td>clothing</td><td>49</td><td>62,471</td><td>58.90</td></tr><tr><td>wheeled 1vehicle</td><td>44</td><td>57,055</td><td>35.30</td></tr><tr><td>musical instrument</td><td>26</td><td>33,779</td><td>47.64</td></tr><tr><td>bird</td><td>59</td><td>76,536</td><td>1.69</td></tr><tr><td>insect</td><td>27</td><td>35,097</td><td>1.81</td></tr></table>
|
| 73 |
+
|
| 74 |
+

|
| 75 |
+
Figure 2: Left: The fraction of images with faces for the 1000 ILSVRC categories. 106 categories have more than half images with faces. 216 categories have more than $2 5 \%$ . Right: A histogram of the number of faces per image, excluding the 1,187,895 images with no face.
|
| 76 |
+
|
| 77 |
+
The errors are shown in Table 1. As expected, the left 10 categories (mammals) have some false positives but no false negatives. In contrast, the right 10 categories have very few false positives but some false negatives. Crowdsourcing significantly reduces both error types. This demonstrate that we can obtain high-quality face annotations using the two-stage pipeline, but face detection alone is less accurate. Among the 20 categories, we have on average 1.25 false positives and 0.95 false negatives per 50 images. However, our overall accuracy on the entire ILSVRC is much higher as these categories are selected deliberately to be error-prone.
|
| 78 |
+
|
| 79 |
+
Distribution of faces in ILSVRC. Using our two-stage pipeline, we annotated all 1,431,093 images in ILSVRC. Among them, 243,198 images $( 1 7 \% )$ contain at least one face. And the total number of faces adds up to 562,626.
|
| 80 |
+
|
| 81 |
+
Fig. 2 Left shows the fraction of images with faces for different categories, ranging from $9 7 . 5 \%$ (bridegroom) to $0 . 1 \%$ (rock beauty, a type of saltwater fish). 106 categories have more than half images with faces. 216 categories have more than $2 5 \%$ . Among the 243K images with faces, Fig. 2 Right shows the number of faces per image. $9 0 . 1 \%$ images contain less than 5. But some of them contain as many as 100 (a cap due to Amazon Rekognition). Most of those images capture sports scenes with a crowd of spectators, e.g., images from baseball player or volleyball.
|
| 82 |
+
|
| 83 |
+
Since ILSVRC categories are in the WordNet (Miller, 1998) hierarchy, we can group them into supercategories in WordNet. Table 2 lists a few common ones that collectively cover 215 categories. For each supercategory, we calculate the fraction of images with faces. Results suggests that supercategories such as clothing and musical instrument frequently co-occur with people, whereas bird and insect seldom do.
|
| 84 |
+
|
| 85 |
+
# 4 EFFECTS OF FACE OBFUSCATION ON CLASSIFICATION ACCURACY
|
| 86 |
+
|
| 87 |
+
Having annotated faces in ILSVRC, we now investigate how face obfuscation—a widely used technique for privacy preservation (Fan, 2019; Frome et al., 2009)—impacts image classification.
|
| 88 |
+
|
| 89 |
+
Face obfuscation method. We experiment with two simple obfuscation methods—blurring and overlaying. For overlaying, we cover faces with the average color in the ILSVRC training data: a gray shade with RGB value $( 0 . 4 8 5 , 0 . 4 5 6 , 0 . 4 0 6 )$ . For blurring, we use a variant of Gaussian blurring. It achieves better visual quality by removing the sharp boundaries between blurred and unblurred regions (Fig. 1). Let $I$ be an image and $M$ be the mask of face bounding boxes. Applying Gaussian blurring to them gives us $I _ { b l u r r e d } $ and $M _ { b l u r r e d } $ . Then we use $M _ { b l u r r e d } $ as the mask to composite $I$ and $I _ { b l u r r e d }$ : $I _ { n e w } = M _ { b l u r r e d } \cdot I _ { b l u r r e d } + ( 1 - M _ { b l u r r e d } ) \cdot I _ { \ l }$ . Due to the use of $M _ { b l u r r e d } $ instead of $M$ , we avoid sharp boundaries in $I _ { n e w }$ . Please see Appendix $\mathbf { B }$ for detail.
|
| 90 |
+
|
| 91 |
+
Table 3: Validation accuracies on ILSVRC using original images, face-blurred images, and faceoverlaid images. The accuracy drops slightly but consistently when blurred (the $\Delta _ { \mathrm { b } }$ columns) or overlaid (the $\Delta _ { \mathrm { o } }$ columns), though overlaying leads to larger drop than blurring. Each experiment is repeated 3 times; we report the mean accuracy and its standard error (SEM).
|
| 92 |
+
|
| 93 |
+
<table><tr><td rowspan="2">Model</td><td colspan="5">Top-1 accuracy (%)</td><td colspan="5">Top-5 accuracy (%)</td></tr><tr><td>Original</td><td>Blurred</td><td>△b</td><td>overlaid</td><td></td><td>△。 Original</td><td>Blurred</td><td>△b</td><td>overlaid</td><td>△</td></tr><tr><td>AlexNet</td><td>56.0± 0.3</td><td>55.8±0.1</td><td>0.2</td><td>55.5± 0.2</td><td>0.6</td><td>78.8 ± 0.1</td><td>78.6 ± 0.1</td><td>0.3</td><td>78.2 ± 0.2</td><td>0.7</td></tr><tr><td>SqueezeNet</td><td>56.0 ± 0.2</td><td>55.3± 0.0</td><td>0.7</td><td>55.0 ± 0.2</td><td>1.0</td><td>78.6± 0.2</td><td>78.1 ± 0.0</td><td>0.5</td><td>77.6 ± 0.1</td><td>1.0</td></tr><tr><td>ShuffleNet</td><td>64.7 ± 0.2</td><td>64.0 ± 0.1</td><td>0.6</td><td>63.7 ± 0.0</td><td>1.0</td><td>85.9 ± 0.0</td><td>85.5 ± 0.1</td><td>0.5</td><td>85.2 ± 0.2</td><td>0.8</td></tr><tr><td>VGG11</td><td>68.9 ± 0.0</td><td>68.2 ± 0.1</td><td>0.7</td><td>67.8± 0.2</td><td>1.1</td><td>88.7 ± 0.0</td><td>88.3 ± 0.1</td><td>0.4</td><td>87.9 ± 0.0</td><td>0.8</td></tr><tr><td>VGG13</td><td>69.9 ± 0.1</td><td>69.3 ± 0.1</td><td>0.7</td><td>68.8 ± 0.0</td><td>1.2</td><td>89.3 ± 0.1</td><td>88.9± 0.0</td><td>0.4</td><td>88.5 ± 0.1</td><td>0.8</td></tr><tr><td>VGG16</td><td>71.7 ± 0.1</td><td>70.8 ± 0.1</td><td>0.8</td><td>70.6 ± 0.1</td><td>1.1</td><td>90.5 ± 0.1</td><td>89.9 ± 0.1</td><td>0.6</td><td>89.6± 0.0</td><td>0.9</td></tr><tr><td>VGG19</td><td>72.4 ± 0.0</td><td>71.5 ± 0.0</td><td>0.8</td><td>71.2 ± 0.2</td><td>1.2</td><td>90.9 ± 0.1</td><td>90.3±0.0</td><td>0.6</td><td>90.1 ± 0.1</td><td>0.8</td></tr><tr><td>MobileNet</td><td>65.4 ± 0.2</td><td>64.4 ± 0.2</td><td>1.0</td><td>64.3± 0.2</td><td>1.0</td><td>86.7 ± 0.1</td><td>86.0 ± 0.1</td><td>0.7</td><td>85.7 ± 0.1</td><td>0.9</td></tr><tr><td>DenseNet121</td><td>75.0 ± 0.1</td><td>74.2 ± 0.1</td><td>0.8</td><td>74.1 ± 0.1</td><td>1.0</td><td>92.4 ± 0.0</td><td>92.0 ± 0.1</td><td>0.4</td><td>91.7 ± 0.0</td><td>0.7</td></tr><tr><td>DenseNet201</td><td>77.0± 0.0</td><td>76.6 ± 0.0</td><td>0.4</td><td>76.1 ± 0.1</td><td>0.9</td><td>93.5 ± 0.0</td><td>93.2 2±0.1</td><td>0.2</td><td>92.9 ± 0.1</td><td>0.6</td></tr><tr><td>ResNet18</td><td>69.8 ± 0.2</td><td>69.0± 0.2</td><td>0.7</td><td>68.9 ± 0.1</td><td>0.8</td><td>89.2 ± 0.0</td><td>88.7± 0.0</td><td>0.5</td><td>88.7±0.1</td><td>0.6</td></tr><tr><td>ResNet34</td><td>73.1 ± 0.1</td><td>72.3 ± 0.4</td><td>0.8</td><td>72.4 ± 0.1</td><td>0.7</td><td>91.3 ± 0.0</td><td>90.8 ± 0.1</td><td>0.5</td><td>90.7 ± 0.0</td><td>0.6</td></tr><tr><td>ResNet50</td><td>75.5± 0.2</td><td>75.0 ± 0.1</td><td>0.4</td><td>74.9 ± 0.0</td><td>0.6</td><td>92.5 ± 0.0</td><td>92.4± 0.1</td><td>0.1</td><td>92.2 ± 0.0</td><td>0.3</td></tr><tr><td>ResNet101</td><td>77.3 ± 0.1</td><td>76.7 ± 0.1</td><td>0.5</td><td>76.7 ± 0.1</td><td>0.6</td><td>93.6 ± 0.1</td><td>93.3 ± 0.1</td><td>0.3</td><td>93.1 ± 0.1</td><td>0.5</td></tr><tr><td>ResNet152</td><td>77.9 ± 0.1</td><td>77.3 ± 0.1</td><td>0.6</td><td>77.0± 0.3</td><td>0.9</td><td>93.9 ± 0.0</td><td>93.7 ± 0.0</td><td>0.4</td><td>93.3 ±0.3</td><td>0.6</td></tr><tr><td>Average</td><td>70.0</td><td>69.4</td><td>0.7</td><td>69.1</td><td>0.9</td><td>89.1</td><td>88.6</td><td>0.4</td><td>88.4</td><td>0.7</td></tr></table>
|
| 94 |
+
|
| 95 |
+

|
| 96 |
+
Figure 3: The average drop in category-wise accuracies vs. the fraction of blurred area in images. Left: Top-1 accuracies. Right: Top-5 accuracies. The accuracies are averaged across all different model architectures and random seeds.
|
| 97 |
+
|
| 98 |
+
Experiment setup and training details. To study the effects of face obfuscation on classification, we benchmark various deep neural networks including AlexNet (Krizhevsky et al., 2017), VGG (Simonyan & Zisserman, 2015), SqueezeNet (Iandola et al., 2016), ShuffleNet (Zhang et al., 2018), MobileNet (Howard et al., 2017), ResNet (He et al., 2016), and DenseNet (Huang et al., 2017). Each model is studied in three settings: (1) original images for both training and evaluation; (2) face-blurred images for both; (3) face-overlaid images for both.
|
| 99 |
+
|
| 100 |
+
Different models share a uniform implementation of the training/evaluation pipeline. During training, we randomly sample a $2 2 4 \times 2 2 4$ image crop and apply random horizontal flipping. During evaluation, we always take the central crop and do not flip. All models are trained with a batch size of 256, a momentum of 0.9, and a weight decay of $1 0 ^ { - 4 }$ . We train with SGD for 90 epochs, dropping the learning rate by a factor of 10 every 30 epochs. The initial learning rate is 0.01 for AlexNet, SqueezeNet, and VGG; 0.1 for other models. Each experiment takes 1–7 days on machines with 2 CPUs, 16GB memory, and 1–6 Nvidia GTX GPUs.
|
| 101 |
+
|
| 102 |
+
Overall accuracy. Table 3 shows the validation accuracies. Each training instance is replicated 3 times with different random seeds, and we report the mean accuracy and its standard error (SEM). The $\Delta$ columns are the accuracy drop when using face-obfuscated images (original minus blurred). For both blurring and overlaying, we see a small but consistent drop in top-1 and top-5 accuracies. For example, with blurring, top-5 accuracies drop $0 . 1 \% - 0 . 7 \%$ with an average of only $0 . 4 \%$ . Overlaying leads to slightly larger drops averaged at $0 . 7 \%$ since it removes more information.
|
| 103 |
+
|
| 104 |
+
It is expected to incur a small but consistent drop. On the one hand, face obfuscation removes information that might be useful for classifying the image. On the other hand, it should leave intact most ILSVRC categories since they are non-human. Though not surprising, our results are encouraging. They assure us that we can train privacy-aware visual classifiers on ImageNet with less than $1 \%$ accuracy drop.
|
| 105 |
+
|
| 106 |
+

|
| 107 |
+
Figure 4: The average drop in category-wise accuracies caused by blurring vs. the fraction of object area covered by faces. Left: Top-1 accuracies. Right: Top-5 accuracies. The accuracies are averaged across all different model architectures and random seeds.
|
| 108 |
+
|
| 109 |
+
Category-wise accuracies and the fraction of blur. To gain insights into the effects on individual categories, we break down the accuracy into the 1000 ILSVRC categories. We hypothesize that if a category has a large fraction of obfuscated area, it will likely incur a large accuracy drop.
|
| 110 |
+
|
| 111 |
+
To support the hypothesis, we focus on blurring and first average the accuracies for each category across different models. Then, we calculate the correlation between the accuracy drop and the fraction of blurred area: $r = 0 . 2 8$ for top-1 accuracy and $r = 0 . 4 4$ for top-5 accuracy. The correlation is not strong but is statistically significant, with p-values of $6 . 3 1 \times 1 0 ^ { - 2 \dot { 0 } }$ and $2 . 6 9 \times \dot { 1 } 0 ^ { - 4 9 }$ respectively.
|
| 112 |
+
|
| 113 |
+
The positive correlation is also evident in Fig. 3. On the $\mathbf { X }$ -axis, we divide the blurred fraction into 5 groups from small to large. On the y-axis, we show the average accuracy drop for categories in each group. Using top-5 accuracy (Fig. 3 Right), the drop increases monotonically from $0 . 3 0 \%$ to $4 . 0 4 \%$ when moving from a small blurred fraction $( 0 \% - 1 \% )$ to a larger fraction $( \geq 8 \% )$ ).
|
| 114 |
+
|
| 115 |
+
The pattern becomes less clear in top-1 accuracy (Fig. 3 Left). The drop stays around $0 . 5 \%$ and begins to increase only when the fraction goes beyond $4 \%$ . However, top-1 accuracy is a worse metric than top-5 accuracy (ILSVRC’s official metric), because top-1 accuracy is ill-defined for images with multiple objects. In contrast, top-5 accuracy allows the model to predict 5 categories for each image and succeed as long as one of them matches the ground truth. In addition, top-1 accuracy suffers from confusion between near-identical categorie (like eskimo dog and siberian husky), an artifact we discuss further below.
|
| 116 |
+
|
| 117 |
+
In summary, our analysis of category-wise accuracies aligns with a simple intuition—if too much area is obfuscated, models will have difficulty classifying the image.
|
| 118 |
+
|
| 119 |
+
Most impacted categories. Besides the size of the obfuscated area, another factor is whether it overlaps with the object of interest. Most categories in ILSVRC are non-human and should have very little overlap with faces. However, there are exceptions. Mask, for example, is indeed nonhuman. But masks are worn on the face; therefore, obfuscating faces will make masks harder to recognize. Similar categories include sunglasses, harmonica, etc. Due to their close spatial proximity to faces, the accuracy is likely to drop significantly in the presence of face obfuscation.
|
| 120 |
+
|
| 121 |
+
To quantify this intuition, we calculate the overlap between objects and faces. Object bounding boxes are available from the localization task of ILSVRC. Given an object bounding box, we calculate the fraction of area covered by face bounding boxes. The fractions are then averaged across different images in a category.
|
| 122 |
+
|
| 123 |
+
Results in Fig. 4 show that blurring leads to larger accuracy drop for categories with larger fractions covered by faces. Some noteable examples include mask $( 2 4 . 8 4 \%$ covered by faces, $8 . 7 1 \%$ drop in top-5 accuracy), harmonica $( 2 9 . 0 9 \%$ covered by faces, $8 . 9 3 \%$ drop in top-5 accuracy), and snorkel $3 0 . 5 1 \%$ covered, $6 . 0 0 \%$ drop). The correlation between the fraction and the drop is $r = 0 . 3 2$ for top-1 accuracy and $r = 0 . 4 6$ for top-5 accuracy.
|
| 124 |
+
|
| 125 |
+
Fig. 5a showcases images from harmonica and mask and their blurred versions. We use GradCAM (Selvaraju et al., 2017) to visualize where the model is looking at when classifying the image. For original images, the model can effectively localize and classify the object of interest. For blurred images, however, the model fails to classify the object; neither does it attend to the correct region.
|
| 126 |
+
|
| 127 |
+
In summary, the categories most impacted by face obfuscation are those overlapping with faces, such as mask and harmonica. These categories have much lower accuracies when using obfuscated images, as obfuscation removes visual cues necessary for recognizing them.
|
| 128 |
+
|
| 129 |
+

|
| 130 |
+
(a) Images from mask and harmonica with Grad-CAM (Selvaraju et al., 2017) visualizations of where a ResNet152 (He et al., 2016) model looks at. Original images on the left; face-blurred images on the right.
|
| 131 |
+
|
| 132 |
+

|
| 133 |
+
(b) Images from eskimo dog and siberian husky are very similar. However, eskimo dog has a large accuracy drop when using face-blurred images, whereas siberian husky has a large accuracy increase.
|
| 134 |
+
|
| 135 |
+
Disparate changes for visually similar categories. Our last observation focuses on categories whose top-1 accuracies change drastically. Intriguingly, they come in pairs, consisting of one category with decreasing accuracy and another visually similar category with increasing accuracy. For example, eskimo dog and siberian husky are visually similar (Fig. 5b). When using faceblurred images, eskimo dog’s top-1 accuracy drops by $12 . 8 \%$ , whereas siberian husky’s increases by $1 6 . 9 \%$ . It is strange since most images in these two categories do not even contain human faces. More examples are in Table 4.
|
| 136 |
+
|
| 137 |
+
Eskimo dog and siberian husky images are so similar that the model faces a seemingly arbitrary choice. We examine the predictions and find that models trained on original images prefer eskimo dog, whereas models trained on blurred images prefer siberian husky. It is the different preferences over these two competing categories that drive the top-1 accuracies to change in different directions. To further investigate, we include two metrics that are less sensitive to competing categories: top-5 accuracy and average precision. In Table 4, the pairwise pattern evaporates when these metrics. A pair of categories no longer have drastic changes, and the changes do not necessarily go in different directions. The results show that models trained on blurred images are still good at recognizing eskimo dog, though siberian husky has an even higher score.
|
| 138 |
+
|
| 139 |
+
# 5 EFFECTS ON FEATURE TRANSFERABILITY
|
| 140 |
+
|
| 141 |
+
Visual features learned on ImageNet are effective for a wide range of tasks (Girshick, 2015; Liu et al., 2015a). We now investigate the effects of face obfuscation on feature transferability to downstream tasks. Specifically, we compare models without pretraining and models pretrained on original/blurred/overlaid images by finetuning on 4 tasks: object recognition, scene recognition, object detection, and face attribute classification. They include both classification and spatial localization, as well as both face-centric and face-agnostic recognition. Details are in Appendix E.
|
| 142 |
+
|
| 143 |
+
Object and scene recognition on CIFAR-10 and SUN. CIFAR-10 (Krizhevsky et al., 2009) contains images from 10 object categories such as horse and truck. SUN (Xiao et al., 2010) contains images from 397 scenes such as bedroom and restaurant. Like ImageNet, they are not peoplecentered but may contain people.
|
| 144 |
+
|
| 145 |
+
We finetune models to classify images in these two datasets and show the results in Table 5. For both datasets, pretraining helps significantly; models pretrained on blurred or overlaid images perform closely with those pretrained on original images. The results show that visual features learned on face-obfsucated images have no problem transferring to face-agnostic downstream tasks.
|
| 146 |
+
|
| 147 |
+
Object detection on PASCAL VOC. Next, we finetune models for object detection on PASCAL VOC (Everingham et al., 2010). We choose it instead of COCO (Lin et al., 2014) because it is small enough to benefit from pretraining. We finetune a FasterRCNN (Ren et al., 2015) object detector with a ResNet50 backbone pretrained on original/blurred/overlaid images. The results do not show a significant difference between them ( $7 9 . 4 0 \pm 0 . 3 1$ , $7 9 . 2 9 \pm 0 . 2 2$ , and $7 9 . 3 9 \pm 0 . 0 2$ in mAP).
|
| 148 |
+
|
| 149 |
+
PASCAL VOC includes person as one of its 20 object categories. And one could hypothesize that the model detects people relying on face cues. However, we do not observe a performance drop in face-obfuscated pretraining, even considering the AP of the person category $( 8 4 . 4 0 \pm 0 . 1 \bar { 4 }$ original, $8 4 . 8 0 \pm 0 . { \bar { 5 } } 0$ blurred, and $8 4 . 4 7 \pm 0 . 0 5$ overlaid).
|
| 150 |
+
|
| 151 |
+
Table 4: Visually similar categories whose top-1 accuracy varies significantly—but in opposite directions. However, the pattern evaporates when using top-5 accuracy or average precision.
|
| 152 |
+
|
| 153 |
+
<table><tr><td rowspan="3">Category</td><td colspan="3">Top-1 accuracy (%)</td><td colspan="3">Top-5 accuracy (%)</td><td colspan="3">Average precision (%)</td></tr><tr><td>Original</td><td>Blurred</td><td>A</td><td>Original</td><td>Blurred</td><td>△</td><td>Original</td><td>Blurred</td><td>A</td></tr><tr><td>eskimo dog</td><td>50.8 ± 1.1</td><td>38.0±0.4</td><td>12.8</td><td>95.5±0.4</td><td>95.1 ±0.2</td><td>0.4</td><td>19.4±0.8</td><td>19.9 ± 0.5</td><td>-0.5</td></tr><tr><td>siberian husky</td><td>46.3 ± 1.8</td><td>63.2 ±0.8</td><td>-16.9</td><td>97.0 ±0.4</td><td>97.2 ± 0.3</td><td>-0.2</td><td>29.2 ± 0.3</td><td>29.6± 0.5</td><td>-0.4</td></tr><tr><td>projectile</td><td>35.6 ± 0.9</td><td>21.7 ± 1.0</td><td>13.9</td><td>86.2± 0.4</td><td>85.5±0.4</td><td>0.7</td><td>23.1 ±0.4</td><td>22.5±0.5</td><td>0.6</td></tr><tr><td>missile</td><td>31.6±0.7</td><td>45.8 ± 0.8</td><td>-14.2</td><td>81.5±0.7</td><td>81.8±0.4</td><td>-0.3</td><td>20.4 ± 0.3</td><td>21.1 ± 0.6</td><td>-0.7</td></tr><tr><td>tub</td><td>35.5 ± 1.5</td><td>27.9 ±0.6</td><td>7.6</td><td>79.4 ± 0.6</td><td>75.6±0.5</td><td>3.8</td><td>19.9 ± 0.4</td><td>18.8±0.2</td><td>1.1</td></tr><tr><td>bathtub</td><td>35.4± 1.0</td><td>42.5± 0.4</td><td>- 7.1</td><td>78.9 ± 0.3</td><td>80.8 ± 1.2</td><td>-1.9</td><td>27.4±0.8</td><td>25.1±0.6</td><td>2.3</td></tr><tr><td>american chameleon</td><td>63.0±0.4</td><td>54.7 ± 1.2</td><td>8.3</td><td>97.0±0.5</td><td>96.6±0.5</td><td>0.4</td><td>40.0±0.2</td><td>39.3±0.5</td><td>0.7</td></tr><tr><td>green lizard</td><td>42.0 ± 0.6</td><td>45.6 ± 1.2</td><td>-3.6</td><td>91.3 ± 0.3</td><td>89.7±0.2</td><td>1.6</td><td>22.6±0.8</td><td>22.4 ± 0.1</td><td>0.2</td></tr></table>
|
| 154 |
+
|
| 155 |
+
Table 5: Top-1 accuracy on CIFAR-10 (Krizhevsky et al., 2009) and SUN (Xiao et al., 2010) of models without pretraining, pretrained on original images, and pretrained on blurred images.
|
| 156 |
+
|
| 157 |
+
<table><tr><td rowspan="2">Model</td><td colspan="4">CIFAR-10</td><td colspan="4">SUN</td></tr><tr><td>No pretrain</td><td>Original</td><td>Blurred</td><td>Overlaid</td><td>No pretrain</td><td>Original</td><td>Blurred</td><td>Overlaid</td></tr><tr><td>AlexNet</td><td>83.3±0.2</td><td>90.6±0.0</td><td>90.9±0.0</td><td>91.1 ± 0.0</td><td>26.2±0.6</td><td>46.3±0.1</td><td>46.5± 0.1</td><td>46.2±0.0</td></tr><tr><td>ShuffleNet</td><td>92.3 ±0.3</td><td>95.7 ± 0.0</td><td>95.4 ± 0.1</td><td>95.2 ± 0.1</td><td>33.8±0.7</td><td>51.2 ± 0.1</td><td>50.4± 0.3</td><td>49.3 ± 0.3</td></tr><tr><td>ResNet18</td><td>92.8± 0.1</td><td>96.1 ± 0.1</td><td>96.1 ± 0.1</td><td>96.1 ± 0.1</td><td>36.9 ± 4.8</td><td>55.0±0.2</td><td>55.0± 0.1</td><td>55.1 ± 0.1</td></tr><tr><td>ResNet34</td><td>90.6 ± 0.9</td><td>96.9 ± 0.1</td><td>97.0± 0.0</td><td>97.1 ± 0.2</td><td>40.3 ± 0.4</td><td>57.8±0.0</td><td>57.9 ± 0.1</td><td>57.8±0.1</td></tr></table>
|
| 158 |
+
|
| 159 |
+
Face attribute classification on CelebA. But what if the downstream task is entirely about understanding faces? Will face-obfuscated pretraining fail? We explore this question by classifying face attributes on CelebA (Liu et al., 2015b). Given a headshot, the model predicts multiple face attributes such as smiling and eyeglasses.
|
| 160 |
+
|
| 161 |
+
CelebA is too large to benefit from pretraining, so we finetune on a subset of 5K images. Table 6 shows the results in mAP. There is a discrepancy between different models, so we add a few more models. But overall, blurred/overlaid pretraining performs competitively. This is remarkable given that the task relies heavily on faces. A possible reason is that the model only learns low-level faceagnostic features during pretraining and learns face features in finetuning.
|
| 162 |
+
|
| 163 |
+
In all of the 4 tasks, pretraining on face-obfuscated images does not hurt the transferability of the learned feature. It suggests that one could use face-obfuscated ILSVRC for pretraining without degrading the downstream task, even when the downstream task requires an understanding of faces.
|
| 164 |
+
|
| 165 |
+
Table 6: mAP of face attribute classification on CelebA (Liu et al., 2015b), using subset of 5K training images.
|
| 166 |
+
|
| 167 |
+
<table><tr><td>Model</td><td>No pretrain</td><td>Original</td><td>Blurred</td><td>Overlaid</td></tr><tr><td>AlexNet</td><td>41.8 ± 0.5</td><td>55.5± 0.7</td><td>50.7 ± 0.8</td><td>52.5 ± 0.4</td></tr><tr><td>ShuffleNet</td><td>36.5 ± 0.7</td><td>55.6 ±1.2</td><td>52.5 ± 1.0</td><td>53.5 ± 1.4</td></tr><tr><td>ResNet18</td><td>45.1 ± 1.0</td><td>51.7 ± 1.9</td><td>51.8 ± 1.0</td><td>52.0 ±0.6</td></tr><tr><td>ResNet34</td><td>49.4 ± 2.4</td><td>55.6 ± 2.4</td><td>56.5 ± 1.9</td><td>56.4 ± 2.3</td></tr><tr><td>ResNet50</td><td>48.7 ± 1.3</td><td>42.8 ± 0.9</td><td>50.9 ± 2.7</td><td>50.4 ± 0.5</td></tr><tr><td>VGG11</td><td>48.7± 0.3</td><td>56.0 ± 0.7</td><td>57.4 ± 0.6</td><td>58.1 ± 0.9</td></tr><tr><td>VGG13</td><td>47.2 ± 0.8</td><td>58.4 ± 0.6</td><td>59.0 ± 0.5</td><td>58.2 ± 0.4</td></tr><tr><td>MobileNet</td><td>43.8 ± 0.2</td><td>49.4 ± 0.8</td><td>49.9 ± 1.3</td><td>49.6 ± 1.3</td></tr></table>
|
| 168 |
+
|
| 169 |
+
# 6 CONCLUSION
|
| 170 |
+
|
| 171 |
+
We explored how face obfuscation affects recognition accuracy on ILSVRC. We annotated faces in the dataset and benchmarked deep neural networks on images with faces blurred or overlaid. Experimental results demonstrate face obfuscation enhances privacy with minimal impact on accuracy.
|
| 172 |
+
|
| 173 |
+
# REFERENCES
|
| 174 |
+
|
| 175 |
+
Martin Abadi, Andy Chu, Ian Goodfellow, H Brendan McMahan, Ilya Mironov, Kunal Talwar, and Li Zhang. Deep learning with differential privacy. In Conference on Computer and Communications Security, 2016.
|
| 176 |
+
|
| 177 |
+
Yuki Asano, Christian Rupprecht, Andrew Zisserman, and Andrea Vedaldi. Pass: An imagenet replacement for self-supervised pretraining without humans. In Advances in Neural Information Processing Systems (Datasets and Benchmarks Track), 2021.
|
| 178 |
+
|
| 179 |
+
Song Bian, Tianchen Wang, Masayuki Hiromoto, Yiyu Shi, and Takashi Sato. Ensei: Efficient secure inference via frequency-domain homomorphic convolution for privacy-preserving visual recognition. In Conference on Computer Vision and Pattern Recognition, 2020.
|
| 180 |
+
|
| 181 |
+
Keith Bonawitz, Vladimir Ivanov, Ben Kreuter, Antonio Marcedone, H Brendan McMahan, Sarvar Patel, Daniel Ramage, Aaron Segal, and Karn Seth. Practical secure aggregation for privacypreserving machine learning. In Conference on Computer and Communications Security, pp. 1175–1191, 2017.
|
| 182 |
+
|
| 183 |
+
Alon Brutzkus, Ran Gilad-Bachrach, and Oren Elisha. Low latency privacy preserving inference. In International Conference on Machine Learning, pp. 812–821, 2019.
|
| 184 |
+
|
| 185 |
+
Joy Buolamwini and Timnit Gebru. Gender shades: Intersectional accuracy disparities in commercial gender classification. In Conference on Fairness, Accountability, and Transparency, pp. 77–91, 2018.
|
| 186 |
+
|
| 187 |
+
Daniel J Butler, Justin Huang, Franziska Roesner, and Maya Cakmak. The privacy-utility tradeoff for remotely teleoperated robots. In International Conference on Human-Robot Interaction, 2015.
|
| 188 |
+
|
| 189 |
+
Holger Caesar, Varun Bankiti, Alex H Lang, Sourabh Vora, Venice Erin Liong, Qiang Xu, Anush Krishnan, Yu Pan, Giancarlo Baldan, and Oscar Beijbom. nuscenes: A multimodal dataset for autonomous driving. In Conference on Computer Vision and Pattern Recognition, pp. 11621– 11631, 2020.
|
| 190 |
+
|
| 191 |
+
Nicholas Carlini, Chang Liu, Ulfar Erlingsson, Jernej Kos, and Dawn Song. The secret sharer: Eval- ´ uating and testing unintended memorization in neural networks. In USENIX Security Symposium, pp. 267–284, 2019.
|
| 192 |
+
|
| 193 |
+
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.
|
| 194 |
+
|
| 195 |
+
Yi Chang, Rong Yan, Datong Chen, and Jie Yang. People identification with limited labels in privacy-protected video. In International Conference Multimedia and Expo, pp. 1005–1008, 2006.
|
| 196 |
+
|
| 197 |
+
Kamalika Chaudhuri and Claire Monteleoni. Privacy-preserving logistic regression. In Advances in Neural Information Processing Systems, 2008.
|
| 198 |
+
|
| 199 |
+
Kai Chen, Jiaqi Wang, Jiangmiao Pang, Yuhang Cao, Yu Xiong, Xiaoxiao Li, Shuyang Sun, Wansen Feng, Ziwei Liu, Jiarui Xu, Zheng Zhang, Dazhi Cheng, Chenchen Zhu, Tianheng Cheng, Qijie Zhao, Buyu Li, Xin Lu, Rui Zhu, Yue Wu, Jifeng Dai, Jingdong Wang, Jianping Shi, Wanli Ouyang, Chen Change Loy, and Dahua Lin. MMDetection: Open mmlab detection toolbox and benchmark. arXiv preprint arXiv:1906.07155, 2019a.
|
| 200 |
+
|
| 201 |
+
Mia Xu Chen, Benjamin N Lee, Gagan Bansal, Yuan Cao, Shuyuan Zhang, Justin Lu, Jackie Tsay, Yinan Wang, Andrew M Dai, Zhifeng Chen, et al. Gmail smart compose: Real-time assisted writing. In International Conference on Knowledge Discovery and Data Mining, pp. 2287–2295, 2019b.
|
| 202 |
+
|
| 203 |
+
Victoria Cheng, Vinith M Suriyakumar, Natalie Dullerud, Shalmali Joshi, and Marzyeh Ghassemi. Can you fake it until you make it? impacts of differentially private synthetic data on downstream classification fairness. In Conference on Fairness, Accountability, and Transparency, 2021.
|
| 204 |
+
|
| 205 |
+
Ji Dai, Behrouz Saghafi, Jonathan Wu, Janusz Konrad, and Prakash Ishwar. Towards privacypreserving recognition of human activities. In International Conference on Image Processing, 2015.
|
| 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 Conference on Computer Vision and Pattern Recognition, 2009.
|
| 208 |
+
|
| 209 |
+
Chris Dulhanty and Alexander Wong. Auditing imagenet: Towards a model-driven framework for annotating demographic attributes of large-scale image datasets. arXiv preprint arXiv:1905.01347, 2019.
|
| 210 |
+
|
| 211 |
+
Mark Everingham, Luc Van Gool, Christopher KI Williams, John Winn, and Andrew Zisserman. The pascal visual object classes (voc) challenge. International Journal of Computer Vision, 88 (2):303–338, 2010.
|
| 212 |
+
|
| 213 |
+
Liyue Fan. Practical image obfuscation with provable privacy. In International Conference Multimedia and Expo, 2019.
|
| 214 |
+
|
| 215 |
+
Matt Fredrikson, Somesh Jha, and Thomas Ristenpart. Model inversion attacks that exploit confidence information and basic countermeasures. In Conference on Computer and Communications Security, pp. 1322–1333, 2015.
|
| 216 |
+
|
| 217 |
+
Matthew Fredrikson, Eric Lantz, Somesh Jha, Simon Lin, David Page, and Thomas Ristenpart. Privacy in pharmacogenetics: An end-to-end case study of personalized warfarin dosing. In USENIX Security Symposium, pp. 17–32, 2014.
|
| 218 |
+
|
| 219 |
+
Andrea Frome, German Cheung, Ahmad Abdulkader, Marco Zennaro, Bo Wu, Alessandro Bissacco, Hartwig Adam, Hartmut Neven, and Luc Vincent. Large-scale privacy protection in google street view. In International Conference on Computer Vision, 2009.
|
| 220 |
+
|
| 221 |
+
Ran Gilad-Bachrach, Nathan Dowlin, Kim Laine, Kristin Lauter, Michael Naehrig, and John Wernsing. Cryptonets: Applying neural networks to encrypted data with high throughput and accuracy. In International Conference on Machine Learning, pp. 201–210, 2016.
|
| 222 |
+
|
| 223 |
+
Ross Girshick. Fast r-cnn. In International Conference on Computer Vision, pp. 1440–1448, 2015.
|
| 224 |
+
|
| 225 |
+
Jihun Hamm. Minimax filter: learning to preserve privacy from inference attacks. Journal of Machine Learning Research, 18(1):4704–4734, 2017.
|
| 226 |
+
|
| 227 |
+
Jihun Hamm, Yingjun Cao, and Mikhail Belkin. Learning privately from multiparty data. In International Conference on Machine Learning, pp. 555–563, 2016.
|
| 228 |
+
|
| 229 |
+
Rakibul Hasan, Eman Hassan, Yifang Li, Kelly Caine, David J Crandall, Roberto Hoyle, and Apu Kapadia. Viewer experience of obscuring scene elements in photos to enhance privacy. In Conference on Human Factors in Computing Systems, 2018.
|
| 230 |
+
|
| 231 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Conference on Computer Vision and Pattern Recognition, 2016.
|
| 232 |
+
|
| 233 |
+
Lisa Anne Hendricks, Kaylee Burns, Kate Saenko, Trevor Darrell, and Anna Rohrbach. Women also snowboard: Overcoming bias in captioning models. In European Conference on Computer Vision, pp. 793–811, 2018.
|
| 234 |
+
|
| 235 |
+
Sorami Hisamoto, Matt Post, and Kevin Duh. Membership inference attacks on sequence-tosequence models: Is my data in your machine translation system? Transactions of the Association for Computational Linguistics, 8:49–63, 2020.
|
| 236 |
+
|
| 237 |
+
Andrew G Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, and Hartwig Adam. Mobilenets: Efficient convolutional neural networks for mobile vision applications. arXiv preprint arXiv:1704.04861, 2017.
|
| 238 |
+
|
| 239 |
+
Gao Huang, Zhuang Liu, Laurens Van Der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. In Conference on Computer Vision and Pattern Recognition, 2017.
|
| 240 |
+
|
| 241 |
+
Forrest N Iandola, Song Han, Matthew W Moskewicz, Khalid Ashraf, William J Dally, and Kurt Keutzer. Squeezenet: Alexnet-level accuracy with 50x fewer parameters and¡ $0 . 5 \mathrm { m b }$ model size. arXiv preprint arXiv:1602.07360, 2016.
|
| 242 |
+
|
| 243 |
+
Matthew Jagielski, Jonathan Ullman, and Alina Oprea. Auditing differentially private machine learning: How private is private sgd? Advances in Neural Information Processing Systems, 33, 2020.
|
| 244 |
+
|
| 245 |
+
Bargav Jayaraman and David Evans. Evaluating differentially private machine learning in practice. In USENIX Security Symposium, pp. 1895–1912, 2019.
|
| 246 |
+
|
| 247 |
+
Chiraag Juvekar, Vinod Vaikuntanathan, and Anantha Chandrakasan. {GAZELLE}: A low latency framework for secure neural network inference. In USENIX Security Symposium, pp. 1651–1669, 2018.
|
| 248 |
+
|
| 249 |
+
Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009.
|
| 250 |
+
|
| 251 |
+
Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. Communications of the ACM, 60(6):84–90, 2017.
|
| 252 |
+
|
| 253 |
+
Alina Kuznetsova, Hassan Rom, Neil Alldrin, Jasper Uijlings, Ivan Krasin, Jordi Pont-Tuset, Shahab Kamali, Stefan Popov, Matteo Malloci, Tom Duerig, et al. The open images dataset v4: Unified image classification, object detection, and visual relationship detection at scale. arXiv preprint arXiv:1811.00982, 2018.
|
| 254 |
+
|
| 255 |
+
Ang Li, Jiayi Guo, Huanrui Yang, and Yiran Chen. Deepobfuscator: Adversarial training framework for privacy-preserving image classification. arXiv preprint arXiv:1909.04126, 2019.
|
| 256 |
+
|
| 257 |
+
Tian Li, Anit Kumar Sahu, Ameet Talwalkar, and Virginia Smith. Federated learning: Challenges, methods, and future directions. IEEE Signal Processing Magazine, 37(3):50–60, 2020.
|
| 258 |
+
|
| 259 |
+
Yifang Li, Nishant Vishwamitra, Bart P Knijnenburg, Hongxin Hu, and Kelly Caine. Effectiveness and users’ experience of obfuscation as a privacy-enhancing technology for sharing photos. Proceedings of the ACM on Human-Computer Interaction, 1:1–24, 2017.
|
| 260 |
+
|
| 261 |
+
Liza Lin and Newley Purnell. A world with a billion cameras watching you is just around the corner, December 2019.
|
| 262 |
+
|
| 263 |
+
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 ´ European Conference on Computer Vision, 2014.
|
| 264 |
+
|
| 265 |
+
Fayao Liu, Chunhua Shen, and Guosheng Lin. Deep convolutional neural fields for depth estimation from a single image. In Conference on Computer Vision and Pattern Recognition, pp. 5162–5170, 2015a.
|
| 266 |
+
|
| 267 |
+
Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In International Conference on Computer Vision, December 2015b.
|
| 268 |
+
|
| 269 |
+
Muhammad Hassam Malhi, Muhammad Hassan Aslam, Faisal Saeed, Owais Javed, and Muhammad Fraz. Vision based intelligent traffic management system. In 2011 Frontiers of Information Technology, pp. 137–141, 2011.
|
| 270 |
+
|
| 271 |
+
Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Aguera y Arcas. Communication-efficient learning of deep networks from decentralized data. In International Conference on Artificial Intelligence and Statistics, pp. 1273–1282, 2017.
|
| 272 |
+
|
| 273 |
+
H Brendan McMahan, Daniel Ramage, Kunal Talwar, and Li Zhang. Learning differentially private recurrent language models. In International Conference on Learning Representations, 2018.
|
| 274 |
+
|
| 275 |
+
Richard McPherson, Reza Shokri, and Vitaly Shmatikov. Defeating image obfuscation with deep learning. arXiv preprint arXiv:1609.00408, 2016.
|
| 276 |
+
|
| 277 |
+
Mary Meeker. 2014 internet trends, May 2014. URL https://www.kleinerperkins.com/ perspectives/2014-internet-trends/.
|
| 278 |
+
|
| 279 |
+
Luca Melis, Congzheng Song, Emiliano De Cristofaro, and Vitaly Shmatikov. Exploiting unintended feature leakage in collaborative learning. In Symposium on Security and Privacy, pp. 691–706. IEEE, 2019.
|
| 280 |
+
|
| 281 |
+
George A Miller. WordNet: An electronic lexical database. 1998.
|
| 282 |
+
|
| 283 |
+
Milad Nasr, Reza Shokri, and Amir Houmansadr. Comprehensive privacy analysis of deep learning: Passive and active white-box inference attacks against centralized and federated learning. In Symposium on Security and Privacy, pp. 739–753. IEEE, 2019.
|
| 284 |
+
|
| 285 |
+
Seong Joon Oh, Rodrigo Benenson, Mario Fritz, and Bernt Schiele. Faceless person recognition: Privacy implications in social media. In European Conference on Computer Vision, 2016.
|
| 286 |
+
|
| 287 |
+
Seong Joon Oh, Mario Fritz, and Bernt Schiele. Adversarial image perturbation for privacy protection a game theory perspective. In International Conference on Computer Vision, 2017.
|
| 288 |
+
|
| 289 |
+
Olga Ohrimenko, Felix Schuster, Cedric Fournet, Aastha Mehta, Sebastian Nowozin, Kapil ´ Vaswani, and Manuel Costa. Oblivious multi-party machine learning on trusted processors. In USENIX Security Symposium, pp. 619–636, 2016.
|
| 290 |
+
|
| 291 |
+
Tribhuvanesh Orekondy, Mario Fritz, and Bernt Schiele. Connecting pixels to privacy and utility: Automatic redaction of private information in images. In Conference on Computer Vision and Pattern Recognition, 2018.
|
| 292 |
+
|
| 293 |
+
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, highperformance deep learning library. In Advances in Neural Information Processing Systems, 2019.
|
| 294 |
+
|
| 295 |
+
Manas A Pathak, Shantanu Rane, and Bhiksha Raj. Multiparty differential privacy via aggregation of locally trained classifiers. In Advances in Neural Information Processing Systems, pp. 1876– 1884, 2010.
|
| 296 |
+
|
| 297 |
+
Amandalynne Paullada, Inioluwa Deborah Raji, Emily M Bender, Emily Denton, and Alex Hanna. Data and its (dis) contents: A survey of dataset development and use in machine learning research. arXiv preprint arXiv:2012.05345, 2020.
|
| 298 |
+
|
| 299 |
+
Yanting Pei, Yaping Huang, Qi Zou, Hao Zang, Xingyuan Zhang, and Song Wang. Effects of image degradations to cnn-based image classification. arXiv preprint arXiv:1810.05552, 2018.
|
| 300 |
+
|
| 301 |
+
AJ Piergiovanni and Michael Ryoo. Avid dataset: Anonymized videos from diverse countries. In Advances in Neural Information Processing Systems, 2020.
|
| 302 |
+
|
| 303 |
+
Vinay Uday Prabhu and Abeba Birhane. Large image datasets: A pyrrhic win for computer vision? In Winter Conference on Applications of Computer Vision, 2021.
|
| 304 |
+
|
| 305 |
+
Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. In Advances in Neural Information Processing Systems, 2015.
|
| 306 |
+
|
| 307 |
+
Zhongzheng Ren, Yong Jae Lee, and Michael S Ryoo. Learning to anonymize faces for privacy preserving action detection. In European Conference on Computer Vision, 2018.
|
| 308 |
+
|
| 309 |
+
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.
|
| 310 |
+
|
| 311 |
+
Michael S Ryoo, Brandon Rothrock, Charles Fleming, and Hyun Jong Yang. Privacy-preserving human activity recognition from extreme low resolution. arXiv preprint arXiv:1604.03196, 2016.
|
| 312 |
+
|
| 313 |
+
Muhammad Sajjad, Mansoor Nasir, Khan Muhammad, Siraj Khan, Zahoor Jan, Arun Kumar Sangaiah, Mohamed Elhoseny, and Sung Wook Baik. Raspberry pi assisted face recognition framework for enhanced law-enforcement services in smart cities. Future Generation Computer Systems, 108:995–1007, 2020.
|
| 314 |
+
|
| 315 |
+
Ramprasaath R Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra. Grad-cam: Visual explanations from deep networks via gradient-based localization. In International Conference on Computer Vision, pp. 618–626, 2017.
|
| 316 |
+
|
| 317 |
+
Shreya Shankar, Yoni Halpern, Eric Breck, James Atwood, Jimbo Wilson, and D Sculley. No classification without representation: Assessing geodiversity issues in open data sets for the developing world. arXiv preprint arXiv:1711.08536, 2017.
|
| 318 |
+
|
| 319 |
+
Reza Shokri and Vitaly Shmatikov. Privacy-preserving deep learning. In Conference on Computer and Communications Security, pp. 1310–1321, 2015.
|
| 320 |
+
|
| 321 |
+
Reza Shokri, Marco Stronati, Congzheng Song, and Vitaly Shmatikov. Membership inference attacks against machine learning models. In Symposium on Security and Privacy, pp. 3–18, 2017.
|
| 322 |
+
|
| 323 |
+
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. International Conference on Learning Representations, 2015.
|
| 324 |
+
|
| 325 |
+
Pierre Stock and Moustapha Cisse. Convnets and imagenet beyond accuracy: Understanding mistakes and uncovering biases. In European Conference on Computer Vision, 2018.
|
| 326 |
+
|
| 327 |
+
Qianru Sun, Liqian Ma, Seong Joon Oh, Luc Van Gool, Bernt Schiele, and Mario Fritz. Natural and effective obfuscation by head inpainting. In Conference on Computer Vision and Pattern Recognition, 2018.
|
| 328 |
+
|
| 329 |
+
Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In Conference on Computer Vision and Pattern Recognition, 2015.
|
| 330 |
+
|
| 331 |
+
Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In Conference on Computer Vision and Pattern Recognition, 2016.
|
| 332 |
+
|
| 333 |
+
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 Conference on Computer Vision and Pattern Recognition, 2019.
|
| 334 |
+
|
| 335 |
+
Florian Tramer and Dan Boneh. Slalom: Fast, verifiable and private execution of neural networks in trusted hardware. In International Conference on Learning Representations, 2018.
|
| 336 |
+
|
| 337 |
+
Ries Uittenbogaard, Clint Sebastian, Julien Vijverberg, Bas Boom, Dariu M Gavrila, et al. Privacy protection in street-view panoramas using depth and multi-view imagery. In Conference on Computer Vision and Pattern Recognition, 2019.
|
| 338 |
+
|
| 339 |
+
Igor Vasiljevic, Ayan Chakrabarti, and Gregory Shakhnarovich. Examining the impact of blur on recognition by convolutional networks. arXiv preprint arXiv:1611.05760, 2016.
|
| 340 |
+
|
| 341 |
+
Bingzhe Wu, Shiwan Zhao, Guangyu Sun, Xiaolu Zhang, Zhong Su, Caihong Zeng, and Zhihong Liu. P3sgd: Patient privacy preserving sgd for regularizing deep cnns in pathological image classification. In Conference on Computer Vision and Pattern Recognition, 2019.
|
| 342 |
+
|
| 343 |
+
Zhenyu Wu, Zhangyang Wang, Zhaowen Wang, and Hailin Jin. Towards privacy-preserving visual recognition via adversarial training: A pilot study. In European Conference on Computer Vision, 2018.
|
| 344 |
+
|
| 345 |
+
Jianxiong Xiao, James Hays, Krista A Ehinger, Aude Oliva, and Antonio Torralba. Sun database: Large-scale scene recognition from abbey to zoo. In Conference on Computer Vision and Pattern Recognition, pp. 3485–3492, 2010.
|
| 346 |
+
|
| 347 |
+
Yanru Xiao, Cong Wang, and Xing Gao. Evade deep image retrieval by stashing private images in the hash space. In Conference on Computer Vision and Pattern Recognition, 2020.
|
| 348 |
+
|
| 349 |
+
Saining Xie, Ross Girshick, Piotr Dollar, Zhuowen Tu, and Kaiming He. Aggregated residual trans-´ formations for deep neural networks. In Conference on Computer Vision and Pattern Recognition, 2017.
|
| 350 |
+
|
| 351 |
+
Kaiyu Yang, Klint Qinami, Li Fei-Fei, Jia Deng, and Olga Russakovsky. Towards fairer datasets: Filtering and balancing the distribution of the people subtree in the imagenet hierarchy. In Conference on Fairness, Accountability, and Transparency, 2020.
|
| 352 |
+
|
| 353 |
+
Ryo Yonetani, Vishnu Naresh Boddeti, Kris M Kitani, and Yoichi Sato. Privacy-preserving visual learning using doubly permuted homomorphic encryption. In International Conference on Computer Vision, 2017.
|
| 354 |
+
|
| 355 |
+
Fisher Yu, Ari Seff, Yinda Zhang, Shuran Song, Thomas Funkhouser, and Jianxiong Xiao. Lsun: Construction of a large-scale image dataset using deep learning with humans in the loop. arXiv preprint arXiv:1506.03365, 2015.
|
| 356 |
+
|
| 357 |
+
Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016.
|
| 358 |
+
|
| 359 |
+
Xiangyu Zhang, Xinyu Zhou, Mengxiao Lin, and Jian Sun. Shufflenet: An extremely efficient convolutional neural network for mobile devices. In Conference on Computer Vision and Pattern Recognition, 2018.
|
| 360 |
+
|
| 361 |
+
Jieyu Zhao, Tianlu Wang, Mark Yatskar, Vicente Ordonez, and Kai-Wei Chang. Men also like shopping: Reducing gender bias amplification using corpus-level constraints. arXiv preprint arXiv:1707.09457, 2017.
|
| 362 |
+
|
| 363 |
+
# A SEMI-AUTOMATIC FACE ANNOTATION
|
| 364 |
+
|
| 365 |
+
We describe our face annotation method in detail. It consists of two stages: face detection followed by crowdsourcing.
|
| 366 |
+
|
| 367 |
+

|
| 368 |
+
Figure 6: Face detection results on ILSVRC by Amazon Rekognition. The first row shows correct examples. The second row shows false positives, most of which are animal faces. The third row shows false negatives.
|
| 369 |
+
|
| 370 |
+
Stage 1: Automatic face detection. First, we run the face detection API provided by Amazon Rekognition3 on all images in ILSVRC, which can be done within one day and $\$ 1500$ . We also explored services from other vendors but found Rekognition to work the best, especially for small faces and multiple faces in one image (Fig. 6 Top).
|
| 371 |
+
|
| 372 |
+
However, face detectors are not perfect. There are false positives and false negatives. Most false positives, as Fig. 6 Middle shows, are animal faces incorrectly detected as humans. Meanwhile, false negatives are rare; some of them occur under poor lighting or heavy occlusion. For privacy preservation, a small number of false positives are acceptable, but false negatives are undesirable. In that respect, Rekognition hits a suitable trade-off for our purpose.
|
| 373 |
+
|
| 374 |
+
Stage 2: Refining faces through crowdsourcing. After running the face detector, we refine the results through crowdsourcing on Amazon Mechanical Turk (MTurk). In each task, the worker is given an image with bounding boxes detected by the face detector (Fig. 7 Left). They adjust existing bounding boxes or create new ones to cover all faces and not-safe-for-work (NSFW) areas. NSFW areas may not necessarily contain private information, but just like faces, they are good candidates for image obfuscation (Prabhu & Birhane, 2021).
|
| 375 |
+
|
| 376 |
+
For faces, we specifically require the worker to cover the mouth, nose, eyes, forehead, and cheeks. For NSFW areas, we define them to include nudity, sexuality, profanity, etc. However, we do not dictate what constitutes, e.g., nudity, which is deemed to be subjective and culture-dependent. Instead, we encourage workers to follow their best judgment.
|
| 377 |
+
|
| 378 |
+
The worker has to go over 50 images in each HIT (Human Intelligence Task) to get rewarded. However, most images do not require the worker’s action since the face detections are already fairly accurate. The 50 images include 3 gold standard images for quality control. These images have verified ground truth faces, but we intentionally show incorrect annotations for the workers to fix. The entire HIT resembles an action game. Starting with 2 lives, the worker will lose a life when making a mistake on gold standard images. In that case, they will see the ground truth faces (Fig. 7
|
| 379 |
+
|
| 380 |
+
·human faces ·content thatis NSFW (nudity,sexuality,profanity,violence,etc.)
|
| 381 |
+
|
| 382 |
+

|
| 383 |
+
There are existing rectangles on some images.You have to adjust them if they are not accurate enough,delete them if the areas they cover are not sensitive areas,and draw new rectangles if existing ones fail to cover all sensitive areas.
|
| 384 |
+
·How much area to cover? For a face,the rectangle you draw should cover at least the mouth, nose,eyes,forehead and cheeks.For NSFW area,use your best judgement.
|
| 385 |
+
|
| 386 |
+

|
| 387 |
+
Figure 7: The UI for face annotation on Amazon Mechanical Turk. Left: The worker is given an image with inaccurate face detections. They correct the results by adjusting existing bounding boxes or creating new ones. Each HIT (Human Intelligence Task) have 50 images, including 3 gold standard images for which we know the ground truth answers. Right: The worker loses a life when making a mistake on gold standard images. They will have to start from scratch after losing both 2 lives.
|
| 388 |
+
|
| 389 |
+
Right) and the remaining lives. If they lose both 2 lives, the game is over, and they have to start from scratch at the first image. We found this strategy to improve annotation quality. We spent about $\$ 2500$ on worker compensation. At this point, it is impossible to estimate the hourly wage accurately, since we have only the submit time of HITs but not the start time.
|
| 390 |
+
|
| 391 |
+
We did not distinguish NSFW areas from faces during crowdsourcing. Still, we conduct a study demonstrating that the final data contains only a tiny number of NSFW annotations compared to faces. The number of NSFW areas varies significantly across different ILSVRC categories. Bikini is likely to contain much more NSFW areas than the average. We examined all 1,300 training images and 50 validation images in bikini. We found only 25 images annotated with NSFW areas $( 1 . 8 5 \% )$ . The average number for the entire ILSVRC is expected to be much smaller. For example, we found 0 NSFW images among the validation images from the categories in Table 1.
|
| 392 |
+
|
| 393 |
+
# B FACE BLURRING METHOD
|
| 394 |
+
|
| 395 |
+
As illustrated in Fig. 8, we blur human faces using a variant of Gaussian blurring to avoid sharp boundaries between blurred and unblurred regions.
|
| 396 |
+
|
| 397 |
+
Let $\mathbb { D } = [ 0 , 1 ]$ be the range of pixel values; $I \in \mathbb { D } ^ { h \times w \times 3 }$ is an RGB image with height $h$ and width $w$ (Fig. 8 Middle). We have $m$ face bounding boxes annotated on $I$ :
|
| 398 |
+
|
| 399 |
+
$$
|
| 400 |
+
\{ ( x _ { 0 } ^ { ( i ) } , y _ { 0 } ^ { ( i ) } , x _ { 1 } ^ { ( i ) } , y _ { 1 } ^ { ( i ) } ) \} _ { i = 1 } ^ { m } . ^ { 4 }
|
| 401 |
+
$$
|
| 402 |
+
|
| 403 |
+
First, we enlarge each bounding box to be
|
| 404 |
+
|
| 405 |
+
$$
|
| 406 |
+
\left( x _ { 0 } ^ { ( i ) } - { \frac { d _ { i } } { 1 0 } } , y _ { 0 } ^ { ( i ) } - { \frac { d _ { i } } { 1 0 } } , x _ { 1 } ^ { ( i ) } + { \frac { d _ { i } } { 1 0 } } , y _ { 1 } ^ { ( i ) } + { \frac { d _ { i } } { 1 0 } } \right) ,
|
| 407 |
+
$$
|
| 408 |
+
|
| 409 |
+
where $d _ { i }$ is the length of the diagonal. Out-of-range coordinates are truncated to $0 , h - 1$ , or $w - 1$
|
| 410 |
+
|
| 411 |
+
Next, we represent the union of the enlarged bounding boxes as a mask $M \in \mathbb { D } ^ { h \times w \times 1 }$ with value 1 inside bounding boxes and value 0 outside them (Fig. 8 Bottom). We apply Gaussian blurring to
|
| 412 |
+
|
| 413 |
+

|
| 414 |
+
Figure 8: The method for face blurring. It avoids sharp boundaries between blurred and unblurred regions. $I$ : the original image; $M$ : the mask of enlarged face bounding boxes; $I _ { n e w }$ : the final face-blurred image.
|
| 415 |
+
|
| 416 |
+
both $M$ and $I$ :
|
| 417 |
+
|
| 418 |
+
$$
|
| 419 |
+
\begin{array} { r l r } { { \cal M } _ { b l u r r e d } } & { = } & { G a u s s i a n \left( { \cal M } , \frac { d _ { m a x } } { 1 0 } \right) } \\ & { } & \\ { { \cal I } _ { b l u r r e d } } & { = } & { G a u s s i a n \left( { \cal I } , \frac { d _ { m a x } } { 1 0 } \right) , } \end{array}
|
| 420 |
+
$$
|
| 421 |
+
|
| 422 |
+
where serves $d _ { m a x }$ is the maximum diagonal length across all boundin radius parameter of Gaussian blurring; it depends on es on image so that the la $I$ . Here est bou $\frac { d _ { m a x } } { 1 0 }$ $d _ { m a x }$
|
| 423 |
+
box can be sufficiently blurred.
|
| 424 |
+
|
| 425 |
+
Finally, we use $M _ { b l u r r e d } $ as the mask to composite $I$ and $I _ { b l u r r e d } $
|
| 426 |
+
|
| 427 |
+
$$
|
| 428 |
+
I _ { n e w } = M _ { b l u r r e d } \cdot I _ { b l u r r e d } + ( 1 - M _ { b l u r r e d } ) \cdot I .
|
| 429 |
+
$$
|
| 430 |
+
|
| 431 |
+
$I _ { n e w }$ is the final face-blurred image. Due to the use of $M _ { b l u r r e d } $ instead of $M$ , we avoid sharp boundaries in $I _ { n e w }$ .
|
| 432 |
+
|
| 433 |
+
# C ORIGINAL IMAGES FOR TRAINING AND OBFUSCATED IMAGES FOR EVALUATION
|
| 434 |
+
|
| 435 |
+
We use obfuscated images to evaluate PyTorch models (Paszke et al., $2 0 1 9 ) ^ { 5 }$ trained on original images. We experiment with 5 different methods for face obfuscation: (1) blurring; (2) overlaying with the average color in the ILSVRC training data: a gray shade with RGB value (0.485, 0.456, 0.406); (3–5) overlaying with red/green/blue patches.
|
| 436 |
+
|
| 437 |
+
Results in top-5 accuracy are in Table 7. Not surprisingly, face obfuscation lowers the accuracy, which is due to not only the loss of information but also the mismatch between data distributions in training and evaluation. Nevertheless, all obfuscation methods lead to only a small accuracy drop $( 0 . 7 \% - 1 . 5 \%$ on average), and blurring leads to the smallest drop. The reason could be that blurring does not conceal all information in a bounding box compared to overlaying.
|
| 438 |
+
|
| 439 |
+
Table 7: Top-5 accuracies of models trained on original images but evaluated on images obfuscated using different methods. Original: original images for validation; Mean: validation images overlaid with the average color in the ILSVRC training data; Red/Green/Blue: images overlaid with different colors; Blurred: face-blurred images; $\Delta _ { \mathrm { b } }$ : Original minus blurred.
|
| 440 |
+
|
| 441 |
+
<table><tr><td>Model</td><td>Original</td><td>Red</td><td>Green</td><td>Blue</td><td>Mean</td><td>Blurred</td><td>△b</td></tr><tr><td>AlexNet (Krizhevsky et al., 2017)</td><td>79.1</td><td>76.7</td><td>77.1</td><td>76.7</td><td>77.8</td><td>78.2</td><td>0.8</td></tr><tr><td>GoogLeNet (Szegedy et al., 2015)</td><td>89.5</td><td>87.9</td><td>88.2</td><td>87.9</td><td>88.3</td><td>88.7</td><td>0.9</td></tr><tr><td>Inception v3 (Szegedy et al.,2016)</td><td>88.7</td><td>86.7</td><td>87.0</td><td>86.6</td><td>87.2</td><td>87.7</td><td>0.9</td></tr><tr><td>SqueezeNet (Iandola et al., 2016)</td><td>80.6</td><td>78.6</td><td>79.0</td><td>78.5</td><td>79.4</td><td>79.7</td><td>0.9</td></tr><tr><td>ShuffleNet (Zhang et al.,2018)</td><td>88.3</td><td>86.6</td><td>86.8</td><td>86.6</td><td>87.0</td><td>87.4</td><td>1.0</td></tr><tr><td>VGG11 (Simonyan & Zisserman, 2015)</td><td>88.6</td><td>87.1</td><td>87.4</td><td>87.0</td><td>87.6</td><td>87.8</td><td>0.8</td></tr><tr><td>VGG13</td><td>89.3</td><td>87.9</td><td>88.1</td><td>87.9</td><td>88.2</td><td>88.5</td><td>0.8</td></tr><tr><td>VGG16</td><td>90.4</td><td>89.1</td><td>89.1</td><td>88.9</td><td>89.3</td><td>89.7</td><td>0.7</td></tr><tr><td>VGG19</td><td>90.9</td><td>89.4</td><td>89.5</td><td>89.2</td><td>89.7</td><td>90.1</td><td>0.8</td></tr><tr><td>MobileNet (Howard et al.,2017)</td><td>90.3</td><td>88.9</td><td>89.1</td><td>88.9</td><td>89.2</td><td>89.5</td><td>0.8</td></tr><tr><td>MNASNet (Tan et al., 2019)</td><td>91.5</td><td>90.0</td><td>90.2</td><td>90.2</td><td>90.4</td><td>90.8</td><td>0.7</td></tr><tr><td>DenseNet121 (Huang et al., 2017)</td><td>92.0</td><td>90.7</td><td>90.8</td><td>90.7</td><td>91.0</td><td>91.3</td><td>0.7</td></tr><tr><td>DenseNet161</td><td>93.6</td><td>92.5</td><td>92.5</td><td>92.3</td><td>92.8</td><td>93.0</td><td>0.6</td></tr><tr><td>DenseNet169</td><td>92.8</td><td>91.6</td><td>91.7</td><td>91.6</td><td>91.9</td><td>92.2</td><td>0.6</td></tr><tr><td>DenseNet201</td><td>93.4</td><td>92.2</td><td>92.3</td><td>92.0</td><td>92.3</td><td>92.7</td><td>0.7</td></tr><tr><td>ResNet18 (He et al., 2016)</td><td>89.1</td><td>87.5</td><td>87.6</td><td>87.5</td><td>87.8</td><td>88.3</td><td>0.8</td></tr><tr><td>ResNet34</td><td>91.4</td><td>89.8</td><td>90.0</td><td>89.8</td><td>90.2</td><td>90.7</td><td>0.8</td></tr><tr><td>ResNet50</td><td>92.9</td><td>91.7</td><td>91.8</td><td>91.5</td><td>91.8</td><td>92.2</td><td>0.7</td></tr><tr><td>ResNet101</td><td>93.6</td><td>92.3</td><td>92.4</td><td>92.3</td><td>92.5</td><td>92.9</td><td>0.7</td></tr><tr><td>ResNet152</td><td>94.1</td><td>92.9</td><td>93.0</td><td>92.9</td><td>93.1</td><td>93.4</td><td>0.6</td></tr><tr><td>ResNeXt50 (Xie et al., 2017)</td><td>93.7</td><td>92.5</td><td>92.6</td><td>92.4</td><td>92.8</td><td>93.0</td><td>0.7</td></tr><tr><td>ResNeXt101</td><td>94.5</td><td>93.5</td><td>93.5</td><td>93.3</td><td>93.5</td><td>93.9</td><td>0.6</td></tr><tr><td>Wide ResNet50 (Zagoruyko & Komodakis,2016)</td><td>94.1</td><td>92.9</td><td>93.0</td><td>92.9</td><td>93.1</td><td>93.4</td><td>0.7</td></tr><tr><td>WideResNet101</td><td>94.3</td><td>93.2</td><td>93.3</td><td>93.1</td><td>93.4</td><td>93.7</td><td>0.6</td></tr><tr><td>Average</td><td>90.7</td><td>89.3</td><td>89.4</td><td>89.2</td><td>89.6</td><td>89.9</td><td>0.7</td></tr></table>
|
| 442 |
+
|
| 443 |
+
# D OBFUSCATED IMAGES FOR TRAINING AND ORIGINAL IMAGES FOR EVALUATION
|
| 444 |
+
|
| 445 |
+
Vice versa, we also experiment with training on blurred images while evaluating on original images. This setting is practically relevant because models used in real-world products may be trained on privacy-preserved data but deployed in the wild without any obfuscation. Results are shown in Table 8. Similarly, training on blurred images lowers the accuracy by only a small amount $( 0 . 2 5 \% -$ $1 . 0 4 \%$ in top-5 accuracy, with an average of $0 . 6 7 \%$ ).
|
| 446 |
+
|
| 447 |
+
# E DETAILS OF TRANSFER LEARNING EXPERIMENTS
|
| 448 |
+
|
| 449 |
+
Image classification on CIFAR-10, SUN, and CelebA. Object recognition on CIFAR10 (Krizhevsky et al., 2009), scene recognition on SUN (Xiao et al., 2010), and face attribute classification on CelebA (Liu et al., 2015b) are all image classification tasks. For any model, we simply replace the output layer and finetune for 90 epochs. Hyperparameters are almost identical to those in Sec. 4, except that the learning rate is tuned individually for each model on validation data. Note that face attribute classification on CelebA is a multi-label classification task, so we apply binary cross-entropy loss to each label independently.
|
| 450 |
+
|
| 451 |
+
Object detection on PASCAL VOC. We adopt a FasterRCNN (Ren et al., 2015) object detector with a ResNet50 backbone pretrained on original or face-obfuscated ILSVRC. The detector is finetuned for 10 epochs on the trainval set of PASCAL VOC 2007 and 2012 (Everingham et al., 2010). It is then evaluated on the test set of 2007.
|
| 452 |
+
|
| 453 |
+
The system is implemented in MMDetection (Chen et al., 2019a). We finetune using SGD with a momentum of 0.9, a weight decay of $1 0 ^ { - 4 }$ , a batch size of 2, and a learning rate of $\mathrm { { \bar { 1 } } . 2 5 \times 1 0 ^ { - 3 } }$ . The learning rate decreases by a factor of 10 in the last epoch.
|
| 454 |
+
|
| 455 |
+
Table 8: Validation accuracies on original ILSVRC images of models trained on original/blurred images. Training on blurred images lead to a small but consistent accuracy drop.
|
| 456 |
+
|
| 457 |
+
<table><tr><td rowspan="2">Model</td><td colspan="3">Top-1 accuracy (%)</td><td colspan="3">Top-5 accuracy (%)</td></tr><tr><td>Original training</td><td>Blurred training</td><td>△</td><td>Original training</td><td>Blurred training</td><td>△</td></tr><tr><td>AlexNet</td><td>56.0 ± 0.3</td><td>55.3 ± 0.0</td><td>0.7</td><td>78.8 ± 0.1</td><td>78.0 ± 0.1</td><td>0.9</td></tr><tr><td>SqueezeNet</td><td>56.0 ± 0.2</td><td>54.9 ± 0.1</td><td>1.1</td><td>78.6 ± 0.2</td><td>77.6 ± 0.1</td><td>1.0</td></tr><tr><td>ShuffleNet</td><td>64.7 ± 0.2</td><td>63.7 ± 0.0</td><td>1.0</td><td>85.9 ± 0.0</td><td>85.1 ± 0.0</td><td>0.9</td></tr><tr><td>VGG11</td><td>68.9 ± 0.0</td><td>67.9 ± 0.2</td><td>1.0</td><td>88.7 ± 0.0</td><td>87.9 ± 0.1</td><td>0.8</td></tr><tr><td>VGG13</td><td>69.9 ± 0.1</td><td>69.0 ± 0.2</td><td>1.0</td><td>89.3 ± 0.1</td><td>88.6 ± 0.1</td><td>0.7</td></tr><tr><td>VGG16</td><td>71.7 ± 0.1</td><td>70.6 ± 0.1</td><td>1.1</td><td>90.5 ± 0.1</td><td>89.8 ± 0.1</td><td>0.7</td></tr><tr><td>VGG19</td><td>72.4 ± 0.0</td><td>71.2 ± 0.1</td><td>1.2</td><td>90.9 ± 0.1</td><td>90.1 ± 0.0</td><td>0.8</td></tr><tr><td>MobileNet</td><td>65.4 ± 0.2</td><td>64.0 ± 0.2</td><td>1.4</td><td>86.7 ± 0.1</td><td>85.6 ± 0.1</td><td>1.0</td></tr><tr><td>DenseNet121</td><td>75.0 ± 0.1</td><td>74.1 ± 0.0</td><td>0.9</td><td>92.4 ± 0.0</td><td>91.8 ± 0.0</td><td>0.6</td></tr><tr><td>DenseNet201</td><td>77.0 ± 0.0</td><td>76.5 ± 0.1</td><td>0.5</td><td>93.5 ± 0.0</td><td>93.2 ± 0.0</td><td>0.3</td></tr><tr><td>ResNet18</td><td>69.8 ± 0.2</td><td>68.6 ± 0.2</td><td>1.1</td><td>89.2 ± 0.0</td><td>88.5 ± 0.1</td><td>0.7</td></tr><tr><td>ResNet34</td><td>73.1 ± 0.1</td><td>72.0 ± 0.4</td><td>1.1</td><td>91.3 ± 0.0</td><td>90.6 ± 0.2</td><td>0.7</td></tr><tr><td>ResNet50</td><td>75.5 ± 0.2</td><td>74.9 ± 0.1</td><td>0.6</td><td>92.5 ± 0.0</td><td>92.2 ± 0.1</td><td>0.3</td></tr><tr><td>ResNet101</td><td>77.3 ± 0.1</td><td>76.6 ± 0.0</td><td>0.7</td><td>93.6 ± 0.1</td><td>93.2 ± 0.0</td><td>0.4</td></tr><tr><td>ResNet152</td><td>77.9 ± 0.1</td><td>77.2 ± 0.2</td><td>0.7</td><td>93.9 ± 0.0</td><td>93.6 ± 0.0</td><td>0.4</td></tr><tr><td>Average</td><td>70.0</td><td>69.1</td><td>0.9</td><td>89.1</td><td>88.4</td><td>0.7</td></tr></table>
|
md/dev/KVljrqehulG/KVljrqehulG.md
ADDED
|
@@ -0,0 +1,494 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EFFICIENT AUTOMATIC GRAPH LEARNING VIA DESIGN RELATIONS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Despite the success of automated machine learning (AutoML), which aims to find the best design, including the architecture of neural networks and hyper-parameters, conventional AutoML methods are computationally expensive and hardly provide insights into the relations of different model design choices. This work focus on the scope of AutoML on graph tasks. To tackle the challenges, we propose FALCON, an efficient sample-based method to search for the optimal model design on graph tasks. Our key insight is to model the design space of possible model designs as a design graph, where the nodes represent design choices, and the edges denote design similarities. FALCON features 1) a task-agnostic module, which performs message passing on the design graph via a Graph Neural Network (GNN), and 2) a task-specific module, which conducts label propagation of the known model performance information on the design graph. Both modules are combined to predict the design performances in the design space, navigating the search direction. We conduct extensive experiments on 27 node and graph classification tasks from various application domains. We empirically show that FALCON can efficiently obtain the well-performing designs for each task using only 30 explored nodes. Specifically, FALCON has a comparable time cost with the one-shot approaches while achieving an average improvement of $3 . 3 \%$ compared with the best baselines.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Automated machine learning (AutoML) (Liu et al., 2019; Pham et al., 2018; Bender et al., 2018; Real et al., 2019; Zoph & Le, 2017; Cai et al., 2019; 2021; Gao et al., 2019; You et al., 2020b; Zhang et al., 2021) has demonstrated great success in various domains including computer vision (Chu et al., 2020; Ghiasi et al., 2019; Chen et al., 2019), language modeling (Zoph & Le, 2017; So et al., 2019), and recommender systems (Chen et al., 2022). It is an essential component for the state-of-the-art deep learning models (Liu et al., 2018; Baker et al., 2017; Xu et al., 2020; Chen et al., 2021).
|
| 12 |
+
|
| 13 |
+
Given a graph learning task, e.g., a node/graph classification task on graphs, our goal of AutoML is to search for a model architecture and hyper-parameter setting from a design space that results in the best test performance on the task. Following previous works (You et al., 2020b), we define design as a set of architecture and hyper-parameter choices (e.g., 3 layer, 64 embedding dimensions, batch normalization, skip connection between consecutive layers), and define design space as the space of all possible designs for a given task.
|
| 14 |
+
|
| 15 |
+
However, AutoML is very computationally intensive. The design space of interest often involves millions of possible designs (Elsken et al.; You et al., 2020a). Sample-based AutoML (Zoph & Le, 2017; Gao et al., 2019; Bergstra et al., 2011; Liu et al., 2017; Luo et al., 2018) has been used to perform search via sampling candidate designs from the design space to explore. One central challenge of existing sample-based AutoML solutions is its sample efficiency: it needs to train as few models as possible to identify the best-performing model in the vast design space. To improve the efficiency, existing research focuses on developing good search algorithms to navigate in the design space (White et al., 2021; Shi et al., 2020; Ma et al., 2019).
|
| 16 |
+
|
| 17 |
+
However, these methods do not consider modeling the effect of model design choices, which provides strong inductive biases in searching for the best-performing model. By “inductive bias”, we refer to the patterns of multiple variables interacting together, which can happen in multiple parts of the design space. Thus, an efficient search strategy should rapidly rule out a large subset of the design space with potentially bad performance leveraging such learned inductive bias.
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: Overview of FALCON. (a) Design graph example. We present a small design graph on TU-COX2 graph classification dataset. The design choices are shown in the table, #pre, #mp, #post denotes the numbers of pre-processing, message passing, and post-processing layers, respectively. The better design performance, the darker node colors. (b) FALCON search strategy. Red: Explored nodes. Green: Candidate nodes to be sampled from. Blue: The best node. Gray: Other nodes. Locally, FALCON extends the design subgraph via a search strategy detailed in Section 3.3. Globally, FALCON approaches the optimal design navigated by the inductive bias of the design relations.
|
| 21 |
+
|
| 22 |
+
Proposed approach. To overcome the limitations, we propose FALCON, an AutoML framework on graph tasks that achieves state-of-the-art sample efficiency and performance by leveraging model design insights. Our key insight is to build a design graph over the design space of architecture and hyper-parameter choices. FALCON extracts model design insights by learning a meta-model that captures the relation between the design graph and model performance and uses it to inform a sample-efficient search strategy. FALCON consists of the following two novel components.
|
| 23 |
+
|
| 24 |
+
Design space as a graph. Previous works view the model design space as a high-dimensional space with isolated design choices (You et al., 2020b), which offer few insights regarding the relations between different design choices. For example, through trial runs if we find the models with more than 3 layers do not work well without batch normalization, this knowledge can help us reduce the search space by excluding all model designs of more than 3 layers with batch normalization set to false. While such insights are hardly obtained with existing AutoML algorithms (Liu et al., 2019; Pham et al., 2018; Gao et al., 2019; Zoph & Le, 2017; Cai et al., 2019), FALCON achieves it via constructing a graph representation, design graph, among all the design choices. Figure 1(a) shows a visualization of a design graph, where each node represents a candidate design, and edges denote the similarity between the designs. See Section 3.1 for details on the similarity and graph construction.
|
| 25 |
+
|
| 26 |
+
Search by navigating on the design graph. Given the design graph, FALCON deploys a Graph Neural Network predictor, short for meta-GNN, which is supervised by the explored nodes’ performances and learns to predict the performance of a specific design given the corresponding node in the design graph. The meta-GNN is designed with 1) a task-agnostic module, which performs message passing on the design graph, and 2) a task-specific module, which conducts label propagation of the known model performance information on the design graph. Furthermore, we propose a search strategy that uses meta-GNN predictions to navigate the search in the design graph efficiently.
|
| 27 |
+
|
| 28 |
+
Experiments. We conduct extensive experiments on 27 graph datasets, covering node- and graphlevel tasks with distinct distributions. Moreover, we demonstrate FALCON’ potential applicability on image datasets by conducting experiments on the CIFAR-10 image dataset. Our code is available at https://anonymous.4open.science/r/Falcon.
|
| 29 |
+
|
| 30 |
+
# 2 RELATED WORK
|
| 31 |
+
|
| 32 |
+
Automatic Machine Learning (AutoML) is the cornerstone of discovering state-of-the-art model designs without costing massive human efforts. We introduce four types of related works below.
|
| 33 |
+
|
| 34 |
+
Sample-based AutoML methods. Existing sample-based approaches explore the search space via sampling candidate designs, which includes heuristic search algorithms, e.g., Simulated Annealing, Bayesian Optimization approaches (Bergstra et al., 2011; White et al., 2021; Ma et al., 2019), evolutionary- (Xie & Yuille, 2017; Real et al., 2017) and reinforcement-based methods (Zoph & Le, 2017; Zhou et al., 2019; Gao et al., 2019). However, they tend to train thousands of models from scratch, which results in the low sample efficiency. For example, (Zoph & Le, 2017; Gao et al., 2019) usually involve training hundreds of GPUs for several days, hindering the development of AutoML in real-world applications (Bender et al., 2018). Some hyper-parameter search methods aim to reduce the computational cost. For example, Successive Halving (Karnin et al., 2013) allocates the training resources to more potentially valuable models based on the early-stage training information. Li et al. (2017) further extend it using different budgets to find the best configurations to avoid the trade-off between selecting the configuration number and allocating the budget. Jaderberg et al. (2017) combine parallel search and sequential optimisation methods to conduct fast search. However, their selective mechanisms are only based on the model performance and lack of deep knowledge, which draws less insight into the relation of design variables and limits the sample efficiency.
|
| 35 |
+
|
| 36 |
+
One-shot AutoML methods. The one-shot approaches (Liu et al., 2019; Pham et al., 2018; Xie et al., 2019; Bender et al., 2018; Qin et al., 2021) have been popular for the high search efficiency. Specifically, they involve training a super-net representing the design space, i.e., containing every candidate design, and shares the weights for the same computational cell. Nevertheless, weight sharing degrades the reliability of design ranking, as it fails to reflect the true performance of the candidate designs (Yu et al., 2020).
|
| 37 |
+
|
| 38 |
+
Graph-based AutoML methods. The key insight of our work is to construct the design space as a design graph, where nodes are candidate designs and edges denote design similarities, and deploy a Graph Neural Network, i.e., meta-GNN, to predict the design performance. Graph HyperNetwork (Zhang et al., 2019a) directly generates weights for each node in a computation graph representation. You et al. (2020a) study network generators that output relational graphs and analyze the link between their predictive performance and the graph structure. Recently, Zhao et al. (2020) considers both the micro- (i.e., a single block) and macro-architecture (i.e., block connections) of each design in graph domain. AutoGML (Park et al., 2022) designs a meta-graph to capture the relations among models and graphs and take a meta-learning approach to estimate the relevance of models to different graphs. Notably, none of these works model the search space as a design graph.
|
| 39 |
+
|
| 40 |
+
Design performance predictor. Previous works predict the performance of a design using the learning curves (Baker et al., 2018), layer-wise features (Deng et al., 2017), computational graph structure (Zhang et al., 2019a; White et al., 2021; Shi et al., 2019; Ma et al., 2019; Zhang et al., 2019b; Lee et al., 2021a), or combining dataset information (Lee et al., 2021a) via a dataset encoder. To highlight, FALCON explicitly models the relations among model designs. Moreover, it leverages the performance information on training instances to provide task-specific information besides the design features, which is differently motivated compared with Lee et al. (2021b) that employs meta-learning techniques and incorporate hardware features to rapidly adapt to unseen devices. Besides, meta-GNN is applicable for both images and graphs, compared with Lee et al. (2021a).
|
| 41 |
+
|
| 42 |
+
# 3 PROPOSED METHOD
|
| 43 |
+
|
| 44 |
+
This section introduces our proposed approach FALCON for sample-based AutoML. In Section 3.1, we introduce the construction of design graph, and formulate the AutoML goal as a search on the design graph for the node with the best task performance. In Section 3.2, we introduce our novel neural predictor consisting of a task-agnostic module and a task-specific module, which predicts the performances of unknown designs. Finally, we detail our search strategy in Section 3.3. We refer the reader to Figure 1 (b) for a high-level overview of FALCON.
|
| 45 |
+
|
| 46 |
+
# 3.1 DESIGN SPACE AS A GRAPH
|
| 47 |
+
|
| 48 |
+
Motivation. Previous works generally consider each design choice as isolated from other designs. However, it is often observed that some designs that share the same design features, e.g., graph neural networks (GNNs) that are more than 3 layers and have batch normalization layers, may have similar performances. Moreover, the inductive bias of the relations between design choices can provide valuable information for navigating the design space for the best design. For example, suppose we find that setting batch normalization of a 3-layer GCN (Kipf & Welling, 2017) and a 4-layer GIN (Xu et al., 2019) to false both degrade the performance. Then we can reasonably infer that a 3-layer GraphSAGE (Hamilton et al., 2017) with batch normalization outperforms the one without. We could leverage such knowledge and only search for the designs that are more likely to improve the task performance. To the best of our knowledge, FALCON is the first method to explicitly consider such relational information among model designs.
|
| 49 |
+
|
| 50 |
+
Design graph. We denote the design graph as $\mathcal { G } ( \mathcal { N } , \mathcal { E } )$ , where the nodes $\mathcal { N }$ include the candidate designs, and edges $\mathcal { E }$ denote the similarities between the candidate designs. Specifically, we use the notion of design distance to decide the graph connectivity, and we elaborate on them below.
|
| 51 |
+
|
| 52 |
+
Design distance. For each numerical design dimension, two design choices have a distance 1 if they are adjacent in the ordered list of design choices. For example, if the hidden dimension size can take values [16, 32, 64, 128], then the distance between 16 and 32 is 1, and the distance between 32 and 128 is 2. For each categorical design dimension, any two distinct design choices have a distance 1. We then define the connectivity of the design graph in terms of the design distance:
|
| 53 |
+
|
| 54 |
+
Definition 1 (Design Graph Connectivity) The design graph can be expressed as $\mathscr { G } ( \mathcal { N } , \mathcal { E } )$ , where the nodes $\mathcal { N } = \{ d _ { 1 } , \ldots , d _ { n } \}$ are model designs, and $( d _ { i } , d _ { j } ) \in \mathcal { E }$ iff the design distance between $d _ { i }$ and $d _ { j }$ is 1.
|
| 55 |
+
|
| 56 |
+
Structure of the design graph. The definition of edges implies that the design graph is highly structured, with the following properties: (1) All designs that are the same except for one categorical design dimension form a clique subgraph. (2) All designs that are the same except $k$ numerical design dimensions form a grid graph structure. Moreover, we use a special calculation for the design distance with a combination of design dimensions that have dependencies. For example, the design dimensions of pooling operations, pooling layers, and the number of layers can depend on each other, thus the design graph structure becomes more complex. See the details in Appendix A.2.
|
| 57 |
+
|
| 58 |
+
Design subgraph. The design graph may contain millions of nodes. Therefore, directly applying the meta-model to the design graph is computationally intensive. Moreover, a reliable performance estimation for an unknown node depends on its similarity between the nodes already explored by the search algorithm. Therefore, we focus on using a meta-model to predict performance for a dynamic subgraph, i.e., design subgraph, containing the explored nodes in the current search stage and the candidate nodes to be sampled in the next step. The candidate set can be constructed by selecting the multi-hop neighbors of explored nodes on the design graph. The design subgraph is defined as:
|
| 59 |
+
|
| 60 |
+
Definition 2 (Design Subgraph) During a search, suppose the explored node set is $\mathcal { N } _ { e }$ and the candidate set is $\mathcal { N } _ { c }$ . The design subgraph is formulated as $\mathcal { G } _ { s } ( \mathcal { N } _ { s } , \mathcal { E } _ { s } )$ , where $\mathcal { N } _ { s } = \mathcal { N } _ { e } \cup \mathcal { N } _ { c }$ are the nodes and $\mathcal { E } _ { s } = \{ ( u , v ) | u \in \mathrm { \bar { \mathcal { N } } } _ { s } , v \in \bar { \mathcal { N } } _ { s } , ( \bar { u } , v ) \in \mathcal { N } \}$ are the edges.
|
| 61 |
+
|
| 62 |
+
Given the design subgraph, we formulate the AutoML problem as searching for the node, i.e., design choice, with the best task performance.
|
| 63 |
+
|
| 64 |
+
# 3.2 META-GNN FOR PERFORMANCE PREDICTION
|
| 65 |
+
|
| 66 |
+
Here we introduce a meta-model, named meta-GNN, to predict the performance of model designs, i.e., nodes of the design subgraph. The goal of meta-GNN is learning the inductive bias of design relations, which is used to navigate the search path on the design graph. As is illustrated in Figure 2, the meta-GNN comprises a task-agnostic module and a task-specific module, used to capture the knowledge of model design and task performance, respectively.
|
| 67 |
+
|
| 68 |
+
Task-agnostic module. The task-agnostic module uses a design encoder to encode the design features on nodes of the design subgraph, and a relation encoder to capture the design similarities and differences on edges of the design subgraph. After that, it performs message passing on the design subgraph. We introduce each component below:
|
| 69 |
+
|
| 70 |
+
• Design encoder: it computes the node features of design subgraph by the concatenation of the feature encoding of each design dimension. For numerical design dimensions,we conduct min-max normalization on their values as the node features. For categorical design dimensions such as aggregation operator which takes one of (SUM, MAX, MEAN), we encode it as a one-hot feature. • Relation encoder: it captures the similarity relationships between the connecting designs. For each $( d _ { i } , d _ { j } ) \in \mathcal { E }$ , we encode the design dimension where $d _ { i }$ and $d _ { j }$ differ by a one-hot encoding.
|
| 71 |
+
|
| 72 |
+

|
| 73 |
+
Figure 2: Meta-GNN Framework: Task-agnostic module generates the embedding given the design variables and their graphical structures. Task-specific module leverages performance information and conducts label propagation to generate the task-specific embeddings. The two embeddings are concatenated and input into an MLP for predicting the design performance.
|
| 74 |
+
|
| 75 |
+
• Message passing module: a GNN model is used to take the design subgraph and the processed features to perform message passing and output node representations. This information will be combined with the task-specific module to predict the design’s performance.
|
| 76 |
+
|
| 77 |
+
Task-specific module. The task-specific module takes into account the information of design performance on selected training instances and thus is specific for one dataset.
|
| 78 |
+
|
| 79 |
+
The challenge of including such task-specific performance is that it is only available on a very limited set of explored nodes. To overcome the challenge, we use label propagation to propagate the performance information of explored nodes to the unexplored nodes. This is based on our observation that models trained with similar designs typically make similar predictions on instances. We provide an example in Figure 2 to illustrate the task-specific module.
|
| 80 |
+
|
| 81 |
+
• Identifying critical instances: The first step is to identify critical training instances that result in different performances across different designs. Here we use a set of explored designs (anchors) to provide the instance-wise performances. Specifically, the $( i , j )$ element of the top left matrix of Figure 2 represents whether the $i$ -th design can correctly predict the label of $j$ -th instance. Then, we compute the entropy of each training instance’s performance over the anchors. Then we obtain the instance-wise probability via Softmax on the entropy vector, from which we sample instances that result in high variation across designs. The high variation implies that these instances can distinguish good designs from bad ones in the design subgraph, which are informative.
|
| 82 |
+
|
| 83 |
+
• Label propagation and linear projection: Based on the inductive bias of smoothness, we perform label propagation to make the task-specific information available to all candidate designs. Concretely, label propagation can be written as
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
\mathbf { Y } ^ { ( k + 1 ) } = \alpha \cdot D ^ { - 1 / 2 } A D ^ { - 1 / 2 } \mathbf { Y } ^ { ( k ) } + ( 1 - \alpha ) \mathbf { Y } ^ { ( k ) }
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
where each row of $\mathbf { Y }$ is the performance vector of design $i$ (if explored) or a zero vector (for the unexplored designs). $D \in \bar { \mathbb { R } } ^ { | \mathcal { N } _ { s } | \times | \mathcal { N } _ { s } | }$ is the diagonal matrix of node degree, $A \in \mathbb { R } ^ { | \mathcal { N } _ { s } | \times | \mathcal { N } _ { s } | }$ is the adjacent matrix of the design subgraph, and $\alpha$ is a hyper-parameter. After label propagation, we use a linear layer to project the performance information to another high-dimensional space.
|
| 90 |
+
|
| 91 |
+
Finally, as shown in Figure 2, we concatenate the output embeddings of the task-specific and taskagnostic modules and use an MLP to produce the performance predictions.
|
| 92 |
+
|
| 93 |
+
Objective for Meta-GNN. The training of neural performance predictor is commonly formulated as a regression using mean square error (MSE), in order to predict how good the candidate designs are for the current task. However, the number of explored designs is usually small for sample-efficient AutoML, especially during the early stage of the search process. Thus, the deep predictor tends to overfit, degrading the reliability of performance prediction. To solve this problem, we incorporate a pair-wise rank loss (Burges et al., 2005; Hu et al., 2021) with the MSE objective, resulting in
|
| 94 |
+
|
| 95 |
+
Require: $S$ : Design space. $K$ : Exploration size. $h _ { \theta }$ : Meta-GNN. $V / V ^ { \prime }$ : Warm-up / Full epoch. η:
|
| 96 |
+
Learning rate. $C$ : Number of start nodes.
|
| 97 |
+
1: $\Omega \boldsymbol { \mathrm { S } }$ AMPLE-NODES $( S , C )$ // Initialize the exploration set
|
| 98 |
+
2: $\Gamma $ MULTI-HOP-NEIGHBORS $( \Omega )$ // Construct candidate set from multi-hop neighbors
|
| 99 |
+
3: $Y _ { \Omega } = \mathbf { G } \mathbf { E } \mathbf { T } \mathbf { \cdot }$ -VALIDATION-PERFORMANCE $( \Omega , V )$ // Explore the initial nodes (for $V$ epochs)
|
| 100 |
+
4: while $t = | \Omega | < K$ do
|
| 101 |
+
5: $\mathcal { G } _ { s } ^ { ( t ) } \gets ( \mathcal { N } _ { v } = \Omega \cup \Gamma , \mathcal { E } = \mathrm { S I M I L A R I T Y } ( \mathcal { N } _ { v } )$ // (1) Update the design subgraph
|
| 102 |
+
6: while not converge do
|
| 103 |
+
7: $\theta \gets \theta - \eta \cdot \partial \bar { \mathcal { L } } ( \hat { Y } _ { \Omega } , h _ { \theta } ( \mathcal { G } _ { s } ^ { ( t ) } ) _ { \Omega } ) / \partial \theta$ // (2) Compute Eq. 2 and conduct optimization
|
| 104 |
+
8: end while
|
| 105 |
+
9: // (3) Sample a candidate node with probability proportional to the meta-GNN’s prediction
|
| 106 |
+
10: $d ^ { ( t ) } = s$ AMPLE-WITH-PROBABILITY $( \Gamma , \mathrm { S o f t m a x } ( h _ { \theta } ( \mathcal { G } _ { s } ^ { ( t ) } ) _ { \Gamma } ) )$
|
| 107 |
+
11: $Y _ { t } = \mathbf { G } \mathbf { E } \mathbf { T } \mathbf { - }$ VALIDATION-PERFORMANCE $( d ^ { ( t ) } , V )$ // (2) Explore the current selected node
|
| 108 |
+
12: $\Omega \Omega \cup \{ d ^ { ( t ) } \}$ , $\Gamma \Gamma \cup$ MULTI-HOP-NEIGHBORS $( \{ d ^ { ( t ) } \} )$ )
|
| 109 |
+
13: end while
|
| 110 |
+
14: $D = \mathbf { S }$ ELECT-TOPK $\{ \Omega _ { i } : Y _ { i } \} _ { i = 1 } ^ { K }$ , $\mathrm { s i z e } = \mathbf { M I N } \big ( \big \lceil 1 0 \% \cdot K \big \rceil , 5 \big ) ,$ ) // Models to be fully trained
|
| 111 |
+
15: $Y ^ { \prime } = \mathbf { G } \mathbf { E } \mathbf { T } \mathbf { - }$ VALIDATION-PERFORMANCE $( D , V ^ { \prime } )$ // Obtain the final performance
|
| 112 |
+
16: $I = \mathrm { A R G M A X } ( Y ^ { \prime } )$ // Obtain best model
|
| 113 |
+
17: return $D _ { I } , Y _ { I } ^ { \prime }$
|
| 114 |
+
|
| 115 |
+
a quadratic number of training pairs, thus reducing overfitting. Furthermore, predicting relative performance is more robust across datasets than predicting absolute performance. Overall, the objective is formulated as follows:
|
| 116 |
+
|
| 117 |
+
$$
|
| 118 |
+
\begin{array} { l } { { \displaystyle { \mathcal { L } } ( \hat { Y } , Y ) = \sum _ { i = 1 } ^ { N } ( \hat { Y } _ { i } - Y _ { i } ) ^ { 2 } + \lambda { \mathcal { L } } _ { r a n k } ( \hat { Y } , Y ) , \mathrm { ~ w h e r e ~ } } } \\ { ~ } \\ { { \displaystyle { \mathcal { L } } _ { r a n k } ( \hat { Y } , Y ) = \sum _ { i = 1 } ^ { N } \sum _ { j = i } ^ { N } ( - 1 ) ^ { \mathbb { I } ( Y _ { i } > Y _ { j } ) } \cdot \sigma \left( \frac { \hat { Y } _ { i } - \hat { Y } _ { j } } { \tau } \right) } } \end{array}
|
| 119 |
+
$$
|
| 120 |
+
|
| 121 |
+
where $\lambda$ is the trade-off hyper-parameter, $\tau$ is the temperature controlling the minimal performance gap that will be highly penalized, and $\sigma$ is the Sigmoid function. Thus, the meta-GNN is trained to predict the node performance on the design subgraph supervised by the explored node performance.
|
| 122 |
+
|
| 123 |
+
# 3.3 SEARCH STRATEGY
|
| 124 |
+
|
| 125 |
+
Equipped with the meta-GNN, we propose a sequential search strategy to search for the best design in the design graph. The core idea is to leverage meta-GNN to perform fast inference on the dynamic design subgraph, and decide what would be the next node to explore, thus navigating the search. We summarize our search strategy in Algorithm 1. Concretely, our search strategy consists of the following three steps:
|
| 126 |
+
|
| 127 |
+
• Initialization: As shown in Figure 1 (b), FALCON randomly samples multiple nodes on the design graph. The motivation of sampling multiple nodes in the initial step is to enlarge the receptive field on the design graph to avoid the local optima and bad performance, which is empirically verified in Appendix D. Then, FALCON explore the initialized nodes by training designs on the tasks and construct the instance mask for the task-specific module. • Meta-GNN training: Following Figure 2, meta-GNN predicts the performance of the explored nodes. The loss is computed via Equation 2 and back-propagated to optimize the meta-GNN. • Exploration via inference: Meta-GNN is then used to make predictions for the performances of all candidate nodes. Then we apply Softmax on the predictions as the probability distribution of candidate designs, from which FALCON samples a new node and updates the design subgraph.
|
| 128 |
+
|
| 129 |
+
At every iteration, FALCON extends the design subgraph through the last two steps. After several iterations, it selects and retrains a few designs in the search trajectory with top performances. Overall,
|
| 130 |
+
|
| 131 |
+
FALCON approaches the optimal design navigated by the relational inductive bias learned by metaGNN, as shown in Figure 1 (b).
|
| 132 |
+
|
| 133 |
+
# 4 EXPERIMENTS
|
| 134 |
+
|
| 135 |
+
We conduct extensive experiments on 27 graph datasets and an image dataset. The goal is twofold: (1) to show FALCON’s sample efficiency over the existing AutoML methods (cf. Section 4.2) and (2) to provide insights into how the inductive bias of design relartions navigate the search on design graph (cf. Section 4.3).
|
| 136 |
+
|
| 137 |
+
# 4.1 EXPERIMENTAL SETTINGS
|
| 138 |
+
|
| 139 |
+
We consider the following tasks in our evaluation and we leave the details including dataset split, evaluation metrics, and hyper-parameters in Appendix A.
|
| 140 |
+
|
| 141 |
+
Node classification. We use 6 benchmarks ranging from citation networks to product or social networks: Cora, CiteSeer, PubMed (Sen et al., 2008), ogbn-arxiv (Hu et al., 2020), AmazonComputers (Shchur et al., 2018), and Reddit (Zeng et al., 2020).
|
| 142 |
+
|
| 143 |
+
Graph classification. We use 21 benchmark binary classification tasks in TUDataset (Morris et al., 2020), which are to predict certain properties for molecule datasets with various distribution.
|
| 144 |
+
|
| 145 |
+
Image classification. We use CIFAR-10 (Krizhevsky, 2009). See details in Appendix C.
|
| 146 |
+
|
| 147 |
+
Baselines. We compare FALCON with three types of baselines:
|
| 148 |
+
|
| 149 |
+
• Simple search strategies: Random, Simulated Annealing (SA), Bayesian Optimization (BO) (Bergstra et al., 2011).
|
| 150 |
+
• AutoML approaches: DARTS (Liu et al., 2019), ENAS (Pham et al., 2018), GraphNAS (Gao et al., 2019), AutoAttend (Guan et al., 2021), GASSO (Qin et al., 2021), where the last three methods are specifically designed for graph tasks.
|
| 151 |
+
• Ablation models: FALCON-G and FALCON-LP, where FALCON-G discards the design graph and predicts the design performance using an MLP, and FALCON-LP removes the task-specific module and predicts design performance using only the task-agnostic module.
|
| 152 |
+
|
| 153 |
+
We also include a naive method, BRUTEFORCE, which trains $5 \%$ designs from scratch and returns the best design among them. The result of BRUTEFORCE is regarded as the approximated ground truth performance. We compare FALCON and the simple search baselines under sample size controlled search, where we limit the number of explored designs. We set the exploration size as 30 by default.
|
| 154 |
+
|
| 155 |
+
Design Space. We use different design spaces on node- and graph-level tasks. Specifically, The design variables include common hyper-parameters, e.g., dropout ratio, and architecture choices, e.g., layer connectivity and batch normalization. Moreover, we consider node pooling choices for the graph classification datasets, which is less studied in the previous works (Cai et al., 2021; Gao et al., 2019; Zhou et al., 2019). Besides, we follow You et al. (2020b) and control the number of parameters for all the candidate designs to ensure a fair comparison. See Appendix A.2 for the details.
|
| 156 |
+
|
| 157 |
+
# 4.2 MAIN RESULTS
|
| 158 |
+
|
| 159 |
+
Node classification tasks. Table 1 summarizes the performance of FALCON and the baselines.
|
| 160 |
+
|
| 161 |
+

|
| 162 |
+
Figure 3: Accuracy v.s. the number of explored nodes on ogbn-arxiv.
|
| 163 |
+
|
| 164 |
+
Notably, FALCON takes comparable search cost as the oneshot methods and is $1 5 \mathrm { x }$ less expensive than GraphNAS. Moreover, FALCON achieves the best performances over the baselines with sufficient margins in the most datasets, using only 30 explored designs. For example, FALCON outperforms ENAS by $1 . 8 \%$ in CiteSeer and GASSO by $1 . 6 \%$ in AmazonComputers. Also, the removal of the design graph and task-specific module decreases the performance constantly, which validates their effectiveness. It is worth mentioning that FALCON is competitive with BRUTEFORCE, demonstrating the excellence of FALCON in searching for globally bestperforming designs.
|
| 165 |
+
|
| 166 |
+
Table 1: Search results on five node classification tasks, where Time stands for the search cost (GPU·hours). We conduct t-test to compute p-value on our method with the best AutoML baselines.
|
| 167 |
+
|
| 168 |
+
<table><tr><td rowspan="2"></td><td colspan="2">Cora</td><td colspan="2">CiteSeer</td><td colspan="2">Pubmed</td><td colspan="2">AmazonComputers</td><td colspan="2">Reddit</td></tr><tr><td>ACC</td><td>Time</td><td>ACC</td><td>Time</td><td>ACC</td><td>Time</td><td>ACC</td><td>Time</td><td>F1</td><td>Time</td></tr><tr><td>Random</td><td>80.8±1.7</td><td>0.20</td><td>71.2±0.8</td><td>0.22</td><td>86.0±3.5</td><td>0.24</td><td>81.6±3.0</td><td>0.16</td><td>94.3±0.1</td><td>0.97</td></tr><tr><td>BO</td><td>85.1±0.3</td><td>0.28</td><td>72.6±0.9</td><td>0.30</td><td>88.5±0.3</td><td>0.31</td><td>82.3±6.3</td><td>0.16</td><td>94.2±0.2</td><td>0.94</td></tr><tr><td>SA</td><td>81.1±0.8</td><td>0.24</td><td>74.7±0.2</td><td>0.25</td><td>88.9±0.1</td><td>0.29</td><td>81.2±6.9</td><td>0.23</td><td>94.3±0.5</td><td>0.97</td></tr><tr><td>ENAS</td><td>85.8±0.4</td><td>0.27</td><td>74.9±0.2</td><td>0.39</td><td>88.6±0.8</td><td>2.06</td><td>74.5±1.2</td><td>0.83</td><td>92.3±1.0</td><td>1.98</td></tr><tr><td>DARTS</td><td>85.8±0.2</td><td>0.25</td><td>75.2±0.3</td><td>0.25</td><td>89.1±0.1</td><td>0.35</td><td>84.1±1.9</td><td>0.35</td><td>[OoM]</td><td>-</td></tr><tr><td>GraphNAS</td><td>82.2±3.6</td><td>3.12</td><td>74.9±0.6</td><td>3.99</td><td>89.2±0.3</td><td>5.37</td><td>88.5±2.4</td><td>2.53</td><td>89.1±2.9</td><td>3.03</td></tr><tr><td>AutoAttend</td><td>84.6±0.2</td><td>1.23</td><td>73.9±0.2</td><td>1.25</td><td>84.4±0.7</td><td>1.55</td><td>87.3±1.1</td><td>2.62</td><td>[OoM]</td><td>-</td></tr><tr><td>GASSO</td><td>86.8±1.1</td><td>0.38</td><td>75.3±0.7</td><td>0.33</td><td>86.3±0.4</td><td>0.41</td><td>89.8±0.1</td><td>0.73</td><td>[OoM]</td><td>-</td></tr><tr><td>FALCON-G</td><td>84.5±0.8</td><td>0.23</td><td>74.3±1.7</td><td>0.24</td><td>89.2±0.1</td><td>0.26</td><td>87.6±0.9</td><td>0.27</td><td>93.7±0.4</td><td>1.11</td></tr><tr><td>FALCON-LP</td><td>85.5±1.0</td><td>0.26</td><td>74.6±0.1</td><td>0.26</td><td>89.0±0.2</td><td>0.29</td><td>90.7±0.6</td><td>0.30</td><td>94.9±0.2</td><td>1.00</td></tr><tr><td>FALCON</td><td>86.4±0.5</td><td>0.26</td><td>76.2±0.4</td><td>0.28</td><td>89.3±0.5</td><td>0.32</td><td>91.2±0.5</td><td>0.30</td><td>95.2±0.2</td><td>1.15</td></tr><tr><td>BRUTEFORCE</td><td>87.0</td><td>52.5</td><td>76.0</td><td>59.7</td><td>90.0</td><td>63.0</td><td>91.4</td><td>81.5</td><td>95.5</td><td>>200</td></tr><tr><td>p-value</td><td></td><td>-</td><td>0.051</td><td>-</td><td>0.145</td><td>-</td><td>0.017</td><td>-</td><td>0002</td><td>-</td></tr></table>
|
| 169 |
+
|
| 170 |
+
We further investigate the speed-performance trade-off of FALCON and other sample-based approaches in ogbn-arxiv. We run several search trials under different sample sizes. As shown in Figure 3, FALCON reaches the approximated ground truth result with very few explored nodes. In contrast, SA and Random require more samples to converge, while BO performs bad even with a large number of explored nodes, potentially due to its inability in dealing with high-dimensional design features.
|
| 171 |
+
|
| 172 |
+
Graph classification tasks. The graph classification datasets cover a wide range of graph distributions. In Table 2, we report the selected performance results for graph classification tasks and leave other results including the search costs in Appendix B. We highlight three observations:
|
| 173 |
+
|
| 174 |
+
• On average, the state-of-the-art AutoML baselines algorithms perform close to the simple search methods, indicating the potentially unreliable search, as similarly concluded by Yu et al. (2020). • FALCON surpasses the best AutoML baselines with an average improvement of $3 . 3 \%$ . The sufficient and consistent improvement greatly validates our sample efficiency under a controlled sample size. where FALCON can explore the designs that are more likely to perform well through the relational inference based on the relations of previously explored designs and their performances. • In the second block, we attribute the high sample efficiency of FALCON to the exhibition of design relations and the performance information from the training instances. Specifically, FALCON outperforms FALCON-LP by $4 . 8 7 \%$ on average, indicating that the task-specific module provides more task information that aids the representation learning of model designs, enabling a fast adaption on a certain task. Moreover, FALCON gains an average improvement of $6 . 4 3 \%$ compared to FALCON-G, which justifies our motivation that the design relations promote the learning of relational inductive bias and guide the search on the design graph.
|
| 175 |
+
|
| 176 |
+
We also conduct experiments similar to Figure 3 to investigate how FALCON converges with the increasing sample size ( $\mathrm { { } } ^ { c f . }$ Appendix B.1) and report the best designs found by FALCON for each dataset (cf. Appendix B.2). Besides, we provide sensitivity analysis on FALCON’s hyper-parameters, e.g., number of random start nodes $C$ (cf. Appendix D).
|
| 177 |
+
|
| 178 |
+
Image classification task. We demonstrate the potential of FALCON in image domain. Due to space limitation, we leave the results of CIFAR-10 to Appendix C. We found FALCON can search for designs that are best-performing, compared with the baselines. Specifically, it gains average improvements of $1 . 4 \%$ over the simple search baselines and $0 . 3 \%$ over the one-shot baselines on the architecture design space, with search cost comparable to the one-shot based baselines.
|
| 179 |
+
|
| 180 |
+
# 4.3 CASE STUDIES OF FALCON
|
| 181 |
+
|
| 182 |
+
We study FALCON in two dimensions: (1) Search process: we probe FALCON’s inference process through the explanations of meta-GNN on a design graph, and (2) Design representations: we visualize the node representations output by the meta-GNN to examine the effect of design choices.
|
| 183 |
+
|
| 184 |
+
Search process. We use GNNExplainer (Ying et al., 2019) to explain the node prediction of metaGNN and shed light on the working mechanism of FALCON. Here we consider the importance of each design dimension for each node’s prediction. We demonstrate on a real case when searching on CIFAR-10 (cf. Table 12 for the design space). For conciseness, we focus on two design dimensions: (Weight Decay, Batch Size). Then, given a node of interest $n ^ { \prime } = ( 0 . 9 , 1 2 8 )$ , we observe the change in its predictions and dimension importance during the search process.
|
| 185 |
+
|
| 186 |
+
Table 2: Selected results for the graph classification tasks. The average task performance (ROC-AUC) of the architectures searched by FALCON is $3 . 3 \%$ over the best AutoML baselines.
|
| 187 |
+
|
| 188 |
+
<table><tr><td></td><td>ER-MD</td><td>AIDS</td><td>OVCAR-8</td><td>MCF-7</td><td>SN12C</td><td>NCI109</td><td>Tox21-AhR</td><td>Avg.</td></tr><tr><td>Random</td><td>77.5±1.6</td><td>97.0±1.4</td><td>56.2±0.0</td><td>58.2±0.3</td><td>57.4±1.0</td><td>73.4±0.9</td><td>75.7±2.0</td><td>70.8</td></tr><tr><td>BO</td><td>77.6±3.5</td><td>96.1±1.0</td><td>63.6±0.7</td><td>60.7±0.0</td><td>54.8±1.1</td><td>73.6±1.2</td><td>75.5±1.1</td><td>71.7</td></tr><tr><td>SA</td><td>75.9±4.2</td><td>95.4±0.9</td><td>59.5±3.2</td><td>56.7±0.8</td><td>60.4±1.7</td><td>76.6±5.6</td><td>76.5±3.0</td><td>71.6</td></tr><tr><td>ENAS</td><td>76.0±2.2</td><td>97.1±0.4</td><td>56.0±1.3</td><td>59.7±0.8</td><td>66.4±0.6</td><td>71.2±1.0</td><td>73.6±0.9</td><td>71.4</td></tr><tr><td>DARTS</td><td>75.0±0.7</td><td>98.0±0.0</td><td>56.8±0.3</td><td>60.2±0.7</td><td>66.0±0.4</td><td>73.5±0.2</td><td>76.0±1.1</td><td>72.2</td></tr><tr><td>GraphNAS</td><td>76.9±3.6</td><td>95.9±0.8</td><td>58.7±0.8</td><td>61.3±5.2</td><td>60.7±1.5</td><td>73.6±2.9</td><td>70.6±4.3</td><td>71.1</td></tr><tr><td>AutoAttend</td><td>73.1±0.8</td><td>97.4±0.3</td><td>59.8±0.8</td><td>64.4±0.2</td><td>71.8±0.3</td><td>75.9±1.8</td><td>74.1±0.9</td><td>73.8</td></tr><tr><td>GASSO</td><td>73.2±0.4</td><td>95.2±0.7</td><td>62.3±0.3</td><td>62.5±0.4</td><td>70.9±2.3</td><td>73.9±0.4</td><td>70.2±3.5</td><td>72.6</td></tr><tr><td>FALCON-G</td><td>78.3±3.0</td><td>96.3±1.4</td><td>56.4±1.1</td><td>62.3±4.5</td><td>69.8±2.2</td><td>70.3±6.4</td><td>72.5±2.8</td><td>72.3</td></tr><tr><td>FALCON-LP</td><td>76.7±2.4</td><td>96.0±0.2</td><td>61.5±4.9</td><td>59.5±5.7</td><td>70.3±3.8</td><td>73.1±0.3</td><td>76.5±2.5</td><td>73.3</td></tr><tr><td>FALCON</td><td>78.4±0.2</td><td>97.5±1.1</td><td>66.7±3.4</td><td>65.5±2.5</td><td>73.3±0.0</td><td>78.4±2.3</td><td>78.5±1.1</td><td>76.9</td></tr><tr><td>BRUTEFORCE</td><td>83.3</td><td>96.0</td><td>67.4</td><td>70.6</td><td>73.7</td><td>81.8</td><td>82.0</td><td>79.3</td></tr><tr><td>p-value</td><td>0.155</td><td>1</td><td>0.008</td><td>0.035</td><td><0.001</td><td>0.096</td><td>0.018</td><td>-</td></tr></table>
|
| 189 |
+
|
| 190 |
+
<table><tr><td>Explored node nt:</td><td>·</td><td>(0.99, 64)</td><td>(0.9, 64)</td><td>(0.99, 128)</td><td></td></tr><tr><td>Performance of nt:</td><td>…</td><td>++</td><td>:</td><td>+</td><td>:</td></tr><tr><td>Prediction on n':</td><td>:</td><td>0.90</td><td>0.77 …</td><td>0.89</td><td>:</td></tr><tr><td>Dimension importance:</td><td>:</td><td>[0.5, 0.5]</td><td>[0.8, 0.2] …</td><td>[0.6, 0.4]</td><td>…</td></tr></table>
|
| 191 |
+
|
| 192 |
+
Where $^ +$ and − indicate the relative performance of the explored nodes, $t$ is the current search step. Interestingly, we see that the prediction on $n ^ { \prime }$ and the dimension importance evolve with the explored designs and their relations. For example, when weight decay changes from 0.99 to 0.9, there is a huge drop in the node performance, which affects the prediction of $n ^ { \prime }$ and increases the importance of Weight Decay as design performance seems to be sensitive to this dimension.
|
| 193 |
+
|
| 194 |
+
Design representations. In Figure 4, we visualize the high-dimensional design representations via T-SNE (van der Maaten & Hinton, 2008) after training the meta-GNN on the Cora dataset.
|
| 195 |
+
|
| 196 |
+

|
| 197 |
+
Figure 4: T-SNE visualization for the design representations on Cora dataset.
|
| 198 |
+
|
| 199 |
+
In the left figure, the better the design performance, the darker the color. Generally, the points with small distance have similar colors or performances, indicating that meta-GNN can distinguish “good” nodes from “bad” nodes. For the right figure, different colors represent different dropout ratios. The high discrimination indicates that the dropout ratio is an influential variable for learning the design representation, which further affects design performance. This evidence validates the meta-GNN’s expressiveness and capacity to learn the relational inductive bias between the design choices.
|
| 200 |
+
|
| 201 |
+
# 5 CONCLUSION, LIMITATION, AND FUTURE WORK
|
| 202 |
+
|
| 203 |
+
This work introduces FALCON, an efficient sample-based AutoML framework. We propose the concept of design graph that explicitly models and encodes relational information among model designs. On top of the design graph, we develop a sample-efficient strategy to navigate the search on the design graph with a novel meta-model. One future direction is to better tackle the high average node degree on the design graphwhich could cause over-smoothing, especially when the design variables include many categorical variables. And a simple solution is to use edge dropout to randomly remove a portion of edges at each training epoch. Another future direction is to better adapt FALCON on continuous design variables via developing a dynamic design graph that enable a more fine-grained search between the discretized values.
|
| 204 |
+
|
| 205 |
+
# REPRODUCIBILITY STATEMENT
|
| 206 |
+
|
| 207 |
+
All of the datasets used in this work are public. For experimental setup, we state the detailed settings in Appendix A and Appendix C, including the graph pre-processing, dataset splits, hyper-parameters. Moreover, we include our code in an anonymous link for public access. For the results, we report the best models found by our algorithm as well as their corresponding performances. Overall, we believe we have made great efforts to ensure reproducibility in this paper.
|
| 208 |
+
|
| 209 |
+
# ETHICS STATEMENT
|
| 210 |
+
|
| 211 |
+
In this work, we propose a novel algorithm to search for the best model designs where no human subject is related. This work could promote the discovery of more powerful and expressive models and provide insights into design relations. However, while best-performing models may be “experts” in fulfilling given tasks, they are not necessarily fair towards different user or entity groups. We believe this is a general issue in the AutoML area and should be well addressed to ensure the ethics of models in real-world applications.
|
| 212 |
+
|
| 213 |
+
# REFERENCES
|
| 214 |
+
|
| 215 |
+
Bowen Baker, Otkrist Gupta, Nikhil Naik, and Ramesh Raskar. Designing neural network architectures using reinforcement learning. In ICLR, 2017.
|
| 216 |
+
|
| 217 |
+
Bowen Baker, Otkrist Gupta, Ramesh Raskar, and Nikhil Naik. Accelerating neural architecture search using performance prediction. In ICLR, 2018.
|
| 218 |
+
|
| 219 |
+
Gabriel Bender, Pieter-Jan Kindermans, Barret Zoph, Vijay Vasudevan, and Quoc V. Le. Understand ing and simplifying one-shot architecture search. In ICML, 2018.
|
| 220 |
+
|
| 221 |
+
James Bergstra, Remi Bardenet, Yoshua Bengio, and Bal ´ azs K ´ egl. Algorithms for hyper-parameter ´ optimization. In NeurIPS, 2011.
|
| 222 |
+
|
| 223 |
+
Filippo Maria Bianchi, Daniele Grattarola, Lorenzo Livi, and Cesare Alippi. Graph neural networks with convolutional ARMA filters. arXiv, 2019.
|
| 224 |
+
|
| 225 |
+
Christopher J. C. Burges, Tal Shaked, Erin Renshaw, Ari Lazier, Matt Deeds, Nicole Hamilton, and Gregory N. Hullender. Learning to rank using gradient descent. In ICML, 2005.
|
| 226 |
+
|
| 227 |
+
Han Cai, Ligeng Zhu, and Song Han. Proxylessnas: Direct neural architecture search on target task and hardware. In ICLR, 2019.
|
| 228 |
+
|
| 229 |
+
Shaofei Cai, Liang Li, Jincan Deng, Beichen Zhang, Zheng-Jun Zha, Li Su, and Qingming Huang. Rethinking graph neural architecture search from message-passing. In CVPR, 2021.
|
| 230 |
+
|
| 231 |
+
Bo Chen, Xiangyu Zhao, Yejing Wang, Wenqi Fan, Huifeng Guo, and Ruiming Tang. Automated machine learning for deep recommender systems: A survey. 2022.
|
| 232 |
+
|
| 233 |
+
Xiangning Chen, Ruochen Wang, Minhao Cheng, Xiaocheng Tang, and Cho-Jui Hsieh. Drnas: Dirichlet neural architecture search. In ICLR, 2021.
|
| 234 |
+
|
| 235 |
+
Yukang Chen, Tong Yang, Xiangyu Zhang, Gaofeng Meng, Chunhong Pan, and Jian Sun. Detnas: Neural architecture search on object detection. 2019.
|
| 236 |
+
|
| 237 |
+
Xiangxiang Chu, Bo Zhang, Hailong Ma, Ruijun Xu, and Qingyuan Li. Fast, accurate and lightweight super-resolution with neural architecture search. In ICPR. IEEE, 2020.
|
| 238 |
+
|
| 239 |
+
Boyang Deng, Junjie Yan, and Dahua Lin. Peephole: Predicting network performance before training. Arxiv, 2017.
|
| 240 |
+
|
| 241 |
+
Frederik Diehl. Edge contraction pooling for graph neural networks. CoRR, abs/1905.10990, 2019.
|
| 242 |
+
|
| 243 |
+
Jian Du, Shanghang Zhang, Guanhang Wu, Jose M. F. Moura, and Soummya Kar. Topology adaptive ´ graph convolutional networks.
|
| 244 |
+
|
| 245 |
+
Thomas Elsken, Jan Hendrik Metzen, and Frank Hutter. Neural architecture search: A survey. J. Mach. Learn. Res.
|
| 246 |
+
|
| 247 |
+
Hongyang Gao and Shuiwang Ji. Graph u-nets. In ICML, volume 97, pp. 2083–2092, 2019.
|
| 248 |
+
|
| 249 |
+
Yang Gao, Hong Yang, Peng Zhang, Chuan Zhou, and Yue Hu. Graphnas: Graph neural architecture search with reinforcement learning. arXiv, 1904.09981, 2019.
|
| 250 |
+
|
| 251 |
+
Golnaz Ghiasi, Tsung-Yi Lin, and Quoc V. Le. NAS-FPN: learning scalable feature pyramid architecture for object detection. In CVPR, 2019.
|
| 252 |
+
|
| 253 |
+
Chaoyu Guan, Xin Wang, and Wenwu Zhu. Autoattend: Automated attention representation search. In ICML, 2021.
|
| 254 |
+
|
| 255 |
+
William L. Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. In NeurIPS, pp. 1024–1034, 2017.
|
| 256 |
+
|
| 257 |
+
Chi Hu, Chenglong Wang, Xiangnan Ma, Xia Meng, Yinqiao Li, Tong Xiao, Jingbo Zhu, and Changliang Li. Ranknas: Efficient neural architecture search by pairwise ranking. In EMNLP, 2021.
|
| 258 |
+
|
| 259 |
+
Weihua Hu, Matthias Fey, Marinka Zitnik, Yuxiao Dong, Hongyu Ren, Bowen Liu, Michele Catasta, and Jure Leskovec. Open graph benchmark: Datasets for machine learning on graphs. arXiv preprint arXiv:2005.00687, 2020.
|
| 260 |
+
|
| 261 |
+
Max Jaderberg, Valentin Dalibard, Simon Osindero, Wojciech M. Czarnecki, Jeff Donahue, Ali Razavi, Oriol Vinyals, Tim Green, Iain Dunning, Karen Simonyan, Chrisantha Fernando, and Koray Kavukcuoglu. Population based training of neural networks. CoRR, 2017.
|
| 262 |
+
|
| 263 |
+
Zohar Shay Karnin, Tomer Koren, and Oren Somekh. Almost optimal exploration in multi-armed bandits. In ICML, 2013.
|
| 264 |
+
|
| 265 |
+
Thomas N. Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In ICLR, 2017.
|
| 266 |
+
|
| 267 |
+
Alex Krizhevsky. Learning multiple layers of features from tiny images. In Technical report, 2009.
|
| 268 |
+
|
| 269 |
+
Hayeon Lee, Eunyoung Hyung, and Sung Ju Hwang. Rapid neural architecture search by learning to generate graphs from datasets. In ICLR, 2021a.
|
| 270 |
+
|
| 271 |
+
Hayeon Lee, Sewoong Lee, Song Chong, and Sung Ju Hwang. Hardware-adaptive efficient latency prediction for NAS via meta-learning. In NeurIPS, 2021b.
|
| 272 |
+
|
| 273 |
+
Junhyun Lee, Inyeop Lee, and Jaewoo Kang. Self-attention graph pooling. In ICML, 2019.
|
| 274 |
+
|
| 275 |
+
Lisha Li, Kevin G. Jamieson, Giulia DeSalvo, Afshin Rostamizadeh, and Ameet Talwalkar. Hyperband: A novel bandit-based approach to hyperparameter optimization. J. Mach. Learn. Res., 2017.
|
| 276 |
+
|
| 277 |
+
Chenxi Liu, Barret Zoph, Jonathon Shlens, Wei Hua, Li-Jia Li, Li Fei-Fei, Alan L. Yuille, Jonathan Huang, and Kevin Murphy. Progressive neural architecture search. 1712.00559, 2017.
|
| 278 |
+
|
| 279 |
+
Hanxiao Liu, Karen Simonyan, Oriol Vinyals, Chrisantha Fernando, and Koray Kavukcuoglu. Hierarchical representations for efficient architecture search. In ICLR, 2018.
|
| 280 |
+
|
| 281 |
+
Hanxiao Liu, Karen Simonyan, and Yiming Yang. DARTS: differentiable architecture search. In ICLR, 2019.
|
| 282 |
+
|
| 283 |
+
Renqian Luo, Fei Tian, Tao Qin, Enhong Chen, and Tie-Yan Liu. Neural architecture optimization. In NeurIPS, 2018.
|
| 284 |
+
|
| 285 |
+
Lizheng Ma, Jiaxu Cui, and Bo Yang. Deep neural architecture search with deep graph bayesian optimization. In WI. ACM, 2019.
|
| 286 |
+
|
| 287 |
+
Zheng Ma, Junyu Xuan, Yu Guang Wang, Ming Li, and Pietro Lio. Path integral based convolution \` and pooling for graph neural networks. 2020.
|
| 288 |
+
|
| 289 |
+
Christopher Morris, Martin Ritzert, Matthias Fey, William L. Hamilton, Jan Eric Lenssen, Gaurav Rattan, and Martin Grohe. Weisfeiler and leman go neural: Higher-order graph neural networks. In AAAI, pp. 4602–4609, 2019.
|
| 290 |
+
|
| 291 |
+
Christopher Morris, Nils M. Kriege, Franka Bause, Kristian Kersting, Petra Mutzel, and Marion Neumann. Tudataset: A collection of benchmark datasets for learning with graphs. 2020.
|
| 292 |
+
|
| 293 |
+
Namyong Park, Ryan A. Rossi, Nesreen K. Ahmed, and Christos Faloutsos. Autogml: Fast automatic model selection for graph machine learning. CoRR, 2022.
|
| 294 |
+
|
| 295 |
+
Hieu Pham, Melody Y. Guan, Barret Zoph, Quoc V. Le, and Jeff Dean. Efficient neural architecture search via parameter sharing. In ICML, 2018.
|
| 296 |
+
|
| 297 |
+
Yijian Qin, Xin Wang, Zeyang Zhang, and Wenwu Zhu. Graph differentiable architecture search with structure learning. In NeurIPS, 2021.
|
| 298 |
+
|
| 299 |
+
Esteban Real, Sherry Moore, Andrew Selle, Saurabh Saxena, Yutaka Leon Suematsu, Jie Tan, Quoc V. Le, and Alexey Kurakin. Large-scale evolution of image classifiers. In ICML, 2017.
|
| 300 |
+
|
| 301 |
+
Esteban Real, Alok Aggarwal, Yanping Huang, and Quoc V. Le. Regularized evolution for image classifier architecture search. AAAI Press, 2019.
|
| 302 |
+
|
| 303 |
+
Prithviraj Sen, Galileo Namata, Mustafa Bilgic, Lise Getoor, Brian Gallagher, and Tina Eliassi-Rad. Collective classification in network data. AI Mag., 2008.
|
| 304 |
+
|
| 305 |
+
Oleksandr Shchur, Maximilian Mumme, Aleksandar Bojchevski, and Stephan Gunnemann. Pitfalls ¨ of graph neural network evaluation. 2018.
|
| 306 |
+
|
| 307 |
+
Han Shi, Renjie Pi, Hang Xu, Zhenguo Li, James T. Kwok, and Tong Zhang. Multi-objective neural architecture search via predictive network performance optimization. 1911.09336, 2019.
|
| 308 |
+
|
| 309 |
+
Han Shi, Renjie Pi, Hang Xu, Zhenguo Li, James T. Kwok, and Tong Zhang. Bridging the gap between sample-based and one-shot neural architecture search with BONAS. In NeurIPS, 2020.
|
| 310 |
+
|
| 311 |
+
David R. So, Quoc V. Le, and Chen Liang. The evolved transformer. In ICML, 2019.
|
| 312 |
+
|
| 313 |
+
Laurens van der Maaten and Geoffrey Hinton. Visualizing high-dimensional data using t-sne. Journal of Machine Learning Research, 2008.
|
| 314 |
+
|
| 315 |
+
Colin White, Willie Neiswanger, and Yash Savani. BANANAS: bayesian optimization with neural architectures for neural architecture search. In AAAI, 2021.
|
| 316 |
+
|
| 317 |
+
Lingxi Xie and Alan L. Yuille. Genetic CNN. In IEEE, 2017.
|
| 318 |
+
|
| 319 |
+
Sirui Xie, Hehui Zheng, Chunxiao Liu, and Liang Lin. SNAS: stochastic neural architecture search. In ICLR, 2019.
|
| 320 |
+
|
| 321 |
+
Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? In ICLR, 2019.
|
| 322 |
+
|
| 323 |
+
Yuhui Xu, Lingxi Xie, Xiaopeng Zhang, Xin Chen, Guo-Jun Qi, Qi Tian, and Hongkai Xiong. PC-DARTS: partial channel connections for memory-efficient architecture search. In ICLR, 2020.
|
| 324 |
+
|
| 325 |
+
Zhitao Ying, Dylan Bourgeois, Jiaxuan You, Marinka Zitnik, and Jure Leskovec. Gnnexplainer: Generating explanations for graph neural networks. In NeurIPS, pp. 9240–9251, 2019.
|
| 326 |
+
|
| 327 |
+
Jiaxuan You, Jure Leskovec, Kaiming He, and Saining Xie. Graph structure of neural networks. In ICML, 2020a.
|
| 328 |
+
|
| 329 |
+
Jiaxuan You, Zhitao Ying, and Jure Leskovec. Design space for graph neural networks. In NeurIPS, 2020b.
|
| 330 |
+
|
| 331 |
+
Kaicheng Yu, Christian Sciuto, Martin Jaggi, Claudiu Musat, and Mathieu Salzmann. Evaluating the search phase of neural architecture search. In ICLR, 2020.
|
| 332 |
+
|
| 333 |
+
Hanqing Zeng, Hongkuan Zhou, Ajitesh Srivastava, Rajgopal Kannan, and Viktor K. Prasanna. Graphsaint: Graph sampling based inductive learning method. In ICLR, 2020.
|
| 334 |
+
|
| 335 |
+
Chris Zhang, Mengye Ren, and Raquel Urtasun. Graph hypernetworks for neural architecture search. In ICLR, 2019a.
|
| 336 |
+
|
| 337 |
+
Muhan Zhang, Shali Jiang, Zhicheng Cui, Roman Garnett, and Yixin Chen. D-VAE: A variational autoencoder for directed acyclic graphs. In NeurIPS, 2019b.
|
| 338 |
+
|
| 339 |
+
Ziwei Zhang, Xin Wang, and Wenwu Zhu. Automated machine learning on graphs: A survey. In IJCAI, 2021.
|
| 340 |
+
|
| 341 |
+
Yiren Zhao, Duo Wang, Xitong Gao, Robert D. Mullins, Pietro Lio, and Mateja Jamnik. Probabilistic \` dual network architecture search on graphs. 2020.
|
| 342 |
+
|
| 343 |
+
Kaixiong Zhou, Qingquan Song, Xiao Huang, and Xia Hu. Auto-gnn: Neural architecture search of graph neural networks. 2019.
|
| 344 |
+
|
| 345 |
+
Barret Zoph and Quoc V. Le. Neural architecture search with reinforcement learning. In ICLR, 2017.
|
| 346 |
+
|
| 347 |
+
# A EXPERIMENT DETAILS
|
| 348 |
+
|
| 349 |
+
A.1 SETTINGS
|
| 350 |
+
|
| 351 |
+
Graph classification datasets. The graph classification datasets used in this work are summarized in Table 3. And the detailed dataset statics can be referred from https://chrsmrrs.github. io/datasets/docs/datasets/.
|
| 352 |
+
|
| 353 |
+
Table 3: List of the graph classification datasets used in this work.
|
| 354 |
+
|
| 355 |
+
<table><tr><td>Small Scale</td><td>AIDS,BZR-MD,COX2-MD,DHFR-MD, Mutagenicity, NCI1, NCI109,PTC-MM, PTC-MR</td></tr><tr><td>Medium/Large Scale</td><td>Tox21-AhR,MCF-7, MOLT-4, UACC257, Yeast, NCI-H23, OVCAR-8, P388, PC-3, SF-295, SN12C, SW-620</td></tr></table>
|
| 356 |
+
|
| 357 |
+
Specifically, all datasets are binary classification tasks that predict certain properties for small molecules. For example, the labels in Tox21-AhR represent toxicity/non-toxicity, while the graphs in Mutagenicity are classified into two classes based on their mutagenic effect on a bacterium (Morris et al., 2020). Consequently, we use atom types as the node features and bond types as edge features.
|
| 358 |
+
|
| 359 |
+
Evaluation metrics. For Reddit, we use F1 score (micro) as the evaluation metric following the previous work (Zeng et al., 2020). For other node classification tasks and image dataset, we use classification accuracy as the evaluation metric. For the graph classification tasks, we use ROC-AUC as the evaluation metric.
|
| 360 |
+
|
| 361 |
+
Dataset splits. For ogbn-arxiv and Reddit, we use the standardized dataset split. For other node classification datasets, we split the nodes in each graph into $70 \%$ , $10 \%$ , $20 \%$ in training, validation, and test sets, respectively. For graph classification tasks, we split the graphs into $80 \%$ , $10 \%$ , $10 \%$ for training, validation, and test sets, respectively.
|
| 362 |
+
|
| 363 |
+
Hyper-Parameters. We tuned the hyper-parameters of the baselines based on the default setting in their public codes. For FALCON, we construct the candidate set as the 3-hop neighbors of the explored nodes and set the number of start nodes as $\operatorname* { m i n } ( \lceil 1 0 \% \cdot K \rceil , 1 0 )$ , where $K$ denotes the exploration size. The meta-GNN is constitute of 3 message-passing layers and 3 label propagation layers. All the experiments are repeated at least 3 times.
|
| 364 |
+
|
| 365 |
+
# A.2 DESIGN SPACES
|
| 366 |
+
|
| 367 |
+
# A.2.1 DESIGN SPACES FOR THE SAMPLE-BASED METHODS
|
| 368 |
+
|
| 369 |
+
In this work, we use different design spaces for the datasets depending on the task types, i.e., node or graph level. We summarize the design variables and choices in Table 4 and Table 5. For the design space of Reddit, we replace ”Aggregation” in Table 4 with ”Convolutional layer type”, which takes values from {GCNConv (Kipf & Welling, 2017), SAGEConv (Hamilton et al., 2017), GraphConv (Morris et al., 2019), GINConv (Xu et al., 2019), ARMAConv (Bianchi et al., 2019), TAGConv (Du et al.)}.
|
| 370 |
+
|
| 371 |
+
Table 4: Design Space for the node-level tasks (except for Reddit). 5,832 candidates in total.
|
| 372 |
+
|
| 373 |
+
<table><tr><td>Type</td><td>Variable</td><td>Candidate Values</td></tr><tr><td>Hyper-parameters</td><td>Dropout ratio</td><td>[0.0, 0.3, 0.6]</td></tr><tr><td rowspan="6">Architecture</td><td># Pre-process layers</td><td>[1,2, 3]</td></tr><tr><td># Message passing layers</td><td>[2,4,6, 8]</td></tr><tr><td>#Post-precess layers</td><td>[1,2,3]</td></tr><tr><td>Layer connectivity</td><td>STACK, SUM, CAT</td></tr><tr><td>Activation</td><td>ReLU, Swish,Prelu</td></tr><tr><td>Batch norm Aggregation</td><td>True,False Mean,Max, SUM</td></tr></table>
|
| 374 |
+
|
| 375 |
+
Table 5: Design Space for the graph-level tasks. 58,320 candidates in total.
|
| 376 |
+
|
| 377 |
+
<table><tr><td>Type</td><td>Variable</td><td>Candidate Values</td></tr><tr><td>Hyper-parameters</td><td>Dropout ratio</td><td>[0.0, 0.3, 0.6]</td></tr><tr><td rowspan="10"></td><td># Pre-process layers</td><td>[1,2,3]</td></tr><tr><td># Message passing layers</td><td>[2,4,6,8]</td></tr><tr><td># Post-precess layers</td><td>[1,2,3]</td></tr><tr><td>Layer connectivity</td><td>STACK,SUM,CAT</td></tr><tr><td>Activation</td><td>ReLU, Swish,Prelu</td></tr><tr><td>Batch norm</td><td>True,False</td></tr><tr><td>Aggregation</td><td>Mean,Max,SUM</td></tr><tr><td>Node pooling flag (Use node pooling)</td><td>True,False</td></tr><tr><td>Node pooling type (if applicable)</td><td>TopkPool (Gao & Ji,2019), SAGPool (Lee et al.,2019), PANPool (Ma et al.,202O),EdgePool (Diehl,2019)</td></tr><tr><td>Node pooling loop</td><td>[2,4,6]</td></tr></table>
|
| 378 |
+
|
| 379 |
+
Specifically, The STACK design choice means directly stacking multiple GNN layers, i.e., without skip-connections. We also support node pooling operations for graph classification tasks, where the pooling loop stands for the number of message passing layers between each pooling operation. If the number of message passing layers is $m$ and the node pooling loop is $l$ , there will be a node pooling layer after the ith message passing layer in the design model (hierarchical pooling), where $i \in \{ 1 ^ { \cdot } + \dot { k } \cdot l \ | \ k = 0 , \ldots , \lceil ( m ^ { - } \bar { 1 } ) / l \rceil ^ { \cdot } - 1 \}$ . Moreover, to avoid duplicated and invalid designs, some design variables are required to satisfy specific dependency rules, and we take two examples to elaborate on this point.
|
| 380 |
+
|
| 381 |
+
• If the node pooling flag of a design is False, then the design does not have any value on node pooling type and node pooling loop, and vice versa.
|
| 382 |
+
|
| 383 |
+
For example, we denote node pooling flag as $f$ , node pooling type as $t$ , and $^ *$ as any design choice, then( $f { = } ]$ False, $\scriptstyle t = *$ ) or ( $f { = } ]$ False, $l { = } ^ { * }$ ) will both be invalid.
|
| 384 |
+
|
| 385 |
+
• The node pooling loop should not exceed the number of message passing layers.
|
| 386 |
+
|
| 387 |
+
For example, design $A ( m { = } 4 , l { = } 4 )$ and design $B$ $\because ( m { = } 4 , l { = } 6 )$ that take the same values on other design variables are duplicated.
|
| 388 |
+
|
| 389 |
+
Thus, the design graph constructed under dependency rules is more complex. Without loss of generality, we define that the distance of $f { = } ]$ False) and $f =$ True, $l { = } \mathbf { M I N } ( \{ i \in \mathbb { L } \} ) )$ as 1, where $\mathbb { L }$ represents the design choice of node pooling loop. Thus, the design graph is a connected graph that enables the exploration of any node with random initialization. It is also worth mentioning that the search strategy of FALCON is modularized given the design graph. In contrast, the dependency rules constrain the action space of reinforcement learning methods, e.g., $( f { = } \mathrm { T u r e } \mathrm { F a l s e } )$ is inapplicable, which requires special operation inside the controller.
|
| 390 |
+
|
| 391 |
+
Table 7: Design space for the one-shot baselines on node and graph classification tasks.
|
| 392 |
+
|
| 393 |
+
<table><tr><td>Variable</td><td>Candidate Values</td></tr><tr><td>Dropout ratio</td><td>[0.0, 0.3, 0.6]</td></tr><tr><td>Layer connectivity</td><td>STACK, SUM</td></tr><tr><td># Pre-process layers</td><td>[1, 2, 3]</td></tr><tr><td>#Message passing layers</td><td>[2,4,6, 8]</td></tr><tr><td># Post-precess layers</td><td>[1,2,3]</td></tr><tr><td>Activation</td><td>ReLU,Swish,Prelu</td></tr><tr><td>Batch norm</td><td>True, False</td></tr><tr><td>Aggregation</td><td>Mean, Max, SUM</td></tr></table>
|
| 394 |
+
|
| 395 |
+
Table 6: Statistics and the construction time of the design graphs.
|
| 396 |
+
|
| 397 |
+
<table><tr><td></td><td>#Nodes</td><td>#Edges (Undirected)</td><td> Ave. Degree</td><td>Diameter</td><td>construction time (s)</td></tr><tr><td>DG-1</td><td>5,832</td><td>78.732</td><td>13.5</td><td>13</td><td>13</td></tr><tr><td>DG-2</td><td>58,320</td><td>1,070,172</td><td>18.4</td><td>17</td><td>147</td></tr></table>
|
| 398 |
+
|
| 399 |
+
We further summarize the statistics and construction time of the design graphs in Table 6, where DG-1 and DG-2 denote the design graphs for node-level and graph-level tasks, respectively. We use multi-processing programing on 50 CPUs (Intel Xeon Gold 5118 CPU $ @ ~ 2 . 3 0 \mathrm { G H z } \mathrm { \Omega }$ ) to conduct the graph construction. Note that we don’t have to construct the entire design graph in the pre-processing step, since we only extend the small portion of the design graph, i.e., , the design subgraph, during the search process. Thus, the total time cost of constructing the design subgraph will be $O ( E ^ { \prime } )$ where $E ^ { \prime }$ is the number of edges in the design subgraph, which largely lowers the time costs.
|
| 400 |
+
|
| 401 |
+
# A.2.2 DESIGN SPACES FOR THE ONE-SHOT BASELINES
|
| 402 |
+
|
| 403 |
+
The one-shot models (Liu et al., 2019; Pham et al., 2018) is built upon a super-model that is required to contain all of the architecture choices. We build the macro search space over entire models for both node classification and graph classification datasets with constraints. Firstly, we do not consider CAT (skip-concatenate) a layer connectivity choice, and we also remove design variables for node pooling. The reason is that CAT and node pooling operations change the input shape and make the output embeddings inapplicable for the subsequent weight-sharing modules in our settings. Secondly, the layer connectivity is customized for each layer following the previous works (Liu et al., 2019; Pham et al., 2018), instead of setting as a global value for every layer. Overall, we summarize the design space in Table 7.
|
| 404 |
+
|
| 405 |
+
To enable a fair comparison, we fine-tune the hyper-parameters and report the best results of the architectures found by the one-shot methods according to their performance in the validation sets.
|
| 406 |
+
|
| 407 |
+
# B MORE EXPERIMENTAL RESULTS ON GRAPH TASKS
|
| 408 |
+
|
| 409 |
+
# B.1 GRAPH CLASSIFICATION TASKS
|
| 410 |
+
|
| 411 |
+
Task performance. Here we provide more results of task performance on the graph classification dataset. We repeat each experiment at least 3 times and report the average performances and the standard errors. The results are summarized in Table 8. The results well demonstrate the preeminence of FALCON in searching for good designs under different data distributions.
|
| 412 |
+
|
| 413 |
+
Search cost. As shown in Figure 5, we report the search cost of Random, DARTS, ENAS, GraphNAS, and FALCON on the selected datasets. The time measurements are conducted on a single NVIDIA GeForce 3070 GPU (24G). We see FALCON has a comparable time cost with Random and DARTS, which empirically proves the efficiency of FALCON.
|
| 414 |
+
|
| 415 |
+
However, as FALCON still needs to sample designs and train them from scratch (i.e., the search cost of FALCON is bounded by the search cost of Random), the computational cost is relatively high in large datasets, e.g., OVCAR-8 and MCF-7. We can potentially alleviate this limitation via integrating dataset sampling to reduce time costs.
|
| 416 |
+
|
| 417 |
+
Table 8: Test performance (ROC-AUC) on the graph classification datasets.
|
| 418 |
+
|
| 419 |
+
<table><tr><td></td><td>DHFR-MD</td><td>COX2-MD</td><td>Mutagenicity</td><td>MOLT-4</td><td>NCI-H23</td><td>PTC-MR</td><td>P388</td></tr><tr><td>Random</td><td>59.0±5.2</td><td>63.2±1.9</td><td>77.1±1.9</td><td>58.6±0.7</td><td>58.4±2.1</td><td>59.9±5.7</td><td>63.9±0.7</td></tr><tr><td>BO</td><td>55.1±0.0</td><td>71.6±5.5</td><td>78.3±0.7</td><td>58.1±2.0</td><td>63.6±0.0</td><td>58.8±7.7</td><td>68.9±0.0</td></tr><tr><td>SA</td><td>56.0±7.1</td><td>67.4±3.1</td><td>81.1±0.3</td><td>54.8±1.1</td><td>56.7±3.2</td><td>59.4±6.2</td><td>74.4±1.0</td></tr><tr><td>ENAS</td><td>53.5±3.7</td><td>57.9±1.7</td><td>75.0±1.6</td><td>61.5±0.1</td><td>61.2±1.1</td><td>59.8±1.6</td><td>68.3±1.2</td></tr><tr><td>DARTS</td><td>55.8±6.3</td><td>70.4±3.2</td><td>74.4±0.7</td><td>61.4±0.7</td><td>63.5±1.9</td><td>59.3±0.5</td><td>70.8±0.7</td></tr><tr><td>GraphNAS</td><td>61.6±4.3</td><td>63.9±2.5</td><td>80.2±1.5</td><td>62.1±1.0</td><td>62.4±3.9</td><td>58.6±6.7</td><td>68.2±2.5</td></tr><tr><td>AutoAttend</td><td>63.3±0.9</td><td>68.8±0.7</td><td>79.6±0.1</td><td>59.5±0.2</td><td>61.8±0.2</td><td>57.8±0.6</td><td>74.9±0.5</td></tr><tr><td>GASSO</td><td>60.9±2.3</td><td>68.5±2.0</td><td>75.1±0.5</td><td>57.4±0.9</td><td>64.7±1.5</td><td>51.9±5.2</td><td>71.3±1.4</td></tr><tr><td>FALCON-G</td><td>58.5±8.8</td><td>67.3±3.6</td><td>79.8±1.7</td><td>62.8±3.3</td><td>62.2±1.2</td><td>55.6±6.9</td><td>74.2±3.7</td></tr><tr><td>FALCON-LP</td><td>61.4±1.5</td><td>66.8 ±3.6</td><td>80.2±0.8</td><td>58.5 ±8.8</td><td>63.7±4.1</td><td>55.6±2.0</td><td>75.1±1.1</td></tr><tr><td>FALCON</td><td>63.6±7.9</td><td>67.3±3.2</td><td>81.1±0.5</td><td>64.4±4.0</td><td>66.6±3.3</td><td>60.0±1.4</td><td>77.0±1.4</td></tr><tr><td>(cont.) PTC-MM</td><td>PC-3</td><td>SF-295</td><td>NCI1</td><td>SW-620</td><td>UACC257</td><td>Yeast</td><td>Avg.</td></tr><tr><td>52.5±5.6</td><td>60.4±0.0</td><td>55.3±0.5</td><td>77.5±0.3</td><td>57.5±2.7</td><td>61.1±0.5</td><td>53.3±0.0</td><td>61.3</td></tr><tr><td>60.1±1.5</td><td>59.7±0.1</td><td>60.6±0.3</td><td>77.3±0.0</td><td>63.8±0.9</td><td>60.8±0.0</td><td>55.0±0.0</td><td>63.7</td></tr><tr><td>58.1±4.6</td><td>69.0±2.0</td><td>55.3±0.6</td><td>79.6±5.3</td><td>58.2±2.1</td><td>64.2±0.1</td><td>53.8±1.2</td><td>63.4</td></tr><tr><td>52.4±2.9</td><td>62.2±1.1</td><td>60.9±2.2</td><td>77.2±1.2</td><td>64.8±2.2</td><td>64.7±0.5</td><td>63.0±1.1</td><td>63.0</td></tr><tr><td>52.6±4.1</td><td>61.6±0.5</td><td>62.2±1.1</td><td>66.3±3.0</td><td>66.0±0.3</td><td>65.7±0.2</td><td>61.4±1.4</td><td>63.7</td></tr><tr><td>54.8±3.9</td><td>68.6±2.6</td><td>65.0±3.1</td><td>78.1±3.6</td><td>61.8±4.4</td><td>61.5±5.1</td><td>57.2±1.1</td><td>64.6</td></tr><tr><td>64.7±1.2</td><td>66.2±0.3</td><td>64.2±0.9</td><td>79.3±1.6</td><td>65.5±0.4</td><td>57.1±0.5</td><td>59.6±0.8</td><td>65.9</td></tr><tr><td>63.2±0.7</td><td>66.0±1.8</td><td>65.8±0.4</td><td>76.6±0.6</td><td>64.7±1.1</td><td>62.7±0.2</td><td>60.1±0.4</td><td>64.9</td></tr><tr><td>55.2±2.4</td><td>65.1±2.8</td><td>64.3±2.1</td><td>80.6±0.8</td><td>62.0±3.0</td><td>61.0±3.8</td><td>57.5±1.5</td><td>64.7</td></tr><tr><td>56.8±6.1</td><td>68.1±0.3</td><td>63.5±3.4</td><td>80.4±0.5</td><td>65.2±1.7</td><td>54.5±1.1</td><td>56.6±1.7</td><td>64.7</td></tr><tr><td>57.1±0.1</td><td>71.0±1.7</td><td>64.4±0.4</td><td>80.9±0.8</td><td>66.6±2.1</td><td>66.7±2.1</td><td>58.1±1.7</td><td>67.5*</td></tr></table>
|
| 420 |
+
|
| 421 |
+

|
| 422 |
+
Figure 5: Search cost on the selected datasets.
|
| 423 |
+
|
| 424 |
+
ROC-AUC v.s. exploration size. Here we report the change in task performance on graph classification datasets with the number of explored nodes. In Figure 6, we visualize the results on two graph classification datasets. We see that FALCON can approach the best-performing designs quickly as the explored size grows.
|
| 425 |
+
|
| 426 |
+
# B.2 BEST DESIGNS
|
| 427 |
+
|
| 428 |
+
In Table 9 and Table 10, we summarize the best designs found by FALCON and BRUTEFORCE in each dataset, where the average number of parameters is $1 3 7 . 5 \mathrm { k }$ for all the graph classification datasets. Note that we select the best designs according to their performance on validation sets; thus, there are cases where FALCON surpasses BRUTEFORCE. We highlight the design variables that are different between FALCON and BRUTEFORCE for comparison.
|
| 429 |
+
|
| 430 |
+

|
| 431 |
+
Figure 6: Accuracy v.s. the number of explored nodes on two graph classification datasets.
|
| 432 |
+
|
| 433 |
+
Table 9: Average parameters & Best designs in the node classification datasets.
|
| 434 |
+
|
| 435 |
+
<table><tr><td>Dataset</td><td>Average Param (k)</td><td>Best design</td><td></td><td>Test perfor- mance (%)</td></tr><tr><td rowspan="2">ogbn-arxiv</td><td rowspan="2">44.5</td><td>FALCON</td><td>(0.0,1,4,2, STACK, Swish, True, Mean)</td><td>70.36</td></tr><tr><td>BRUTEFORCE</td><td>(0.3,1,4,2, SUM, Relu, True,Mean)</td><td>70.51</td></tr><tr><td>Cora</td><td>77.8</td><td>FALCON BRUTEFORCE</td><td>(0.0, 1, 6,1, SUM, Swish,False,Mean) (0.0,1,4,1, STACK, Swish,False,Mean)</td><td>87.18 86.99</td></tr><tr><td>Citeseer</td><td>289.0</td><td>FALCON BRUTEFORCE</td><td>(0.3,1,2,1,SUM, Prelu, True, Mean) (0.3,1,2,2, SUM, Prelu, False, Mean)</td><td>76.19 75.99</td></tr><tr><td>Pubmed</td><td>57.8</td><td>FALCON BRUTEFORCE</td><td>(0.3,1,8,1,SUM, Relu, True,Add) (0.3,1,8,1,SUM, Relu, True,Add)</td><td>90.04 90.04</td></tr><tr><td>AmazonComputers</td><td>46.2</td><td>FALCON BRUTEFORCE</td><td>(0.0,1,4,1,STACK,Swish,True,Mean) (0.0,3,4,2,STACK,Prelu,True,Mean)</td><td>91.64 91.35</td></tr><tr><td>Reddit</td><td>47.2</td><td>FALCON BRUTEFORCE</td><td>(0.0,3,4,2, STACK,Prelu, True,ARMAConv) (0.0,3,4,2, STACK,Prelu,True,ARMAConv)</td><td>95.46 95.46</td></tr></table>
|
| 436 |
+
|
| 437 |
+
# B.3 BRUTEFORCE’S CONFIDENCE INTERVAL AND VARIANT
|
| 438 |
+
|
| 439 |
+
To estimate the uncertainty of Bruteforce, we compute the $9 5 \%$ confidence interval of Bruteforce using bootstrapping. Moreover, we consider a variant of Bruteforce baseline to compare with Bruteforce. Specifically, we train all the designs in the design space for 30 epochs, select the top $10 \%$ design, and resume the training until 50 epochs. After that, we choose the top $50 \%$ designs to be fully trained and return the best fully trained design based on the validation performance. We run Bruteforce-bootstrap on four datasets as demonstrations. We summarize the results in Table 11.
|
| 440 |
+
|
| 441 |
+
Table 11: Test performances of Bruteforce and its variant.
|
| 442 |
+
|
| 443 |
+
<table><tr><td></td><td>Cora</td><td>CiteSeer</td><td>ER-MD</td><td>AIDS</td></tr><tr><td>Bruteforce (max)</td><td>87.0</td><td>76.0</td><td>83.3</td><td>96.0</td></tr><tr><td>Confidence interval length</td><td>0.2</td><td>0.1</td><td>0.6</td><td>0.0</td></tr><tr><td>Bruteforce-bootstrap</td><td>87.0</td><td>76.4</td><td>83.8</td><td>95.7</td></tr></table>
|
| 444 |
+
|
| 445 |
+
Surprisingly, we found that the performance of Bruteforce and Bruteforce-bootstrap are very close. This indicates that Bruteforce (fully trained $5 \%$ design) is a good surrogate of Bruteforcebootstrapping (fully trained $5 \%$ design, but using bootstrapping selection), and could also well approximate the ground truth performance of the best design.
|
| 446 |
+
|
| 447 |
+
Table 10: Best designs in the graph classification datasets.
|
| 448 |
+
|
| 449 |
+
<table><tr><td>Dataset</td><td></td><td>Best design</td><td>Test perfor- mance (%)</td></tr><tr><td rowspan="2">AIDS</td><td>FALCON</td><td>(0.3,1,4,2, SUM,Prelu, True,Add, NoPool)</td><td>99.02</td></tr><tr><td>BRUTEFORCE</td><td>(0.0,3,8,2, STACK,Relu, True,Add, SAGPool, 2)</td><td>95.97</td></tr><tr><td rowspan="2">COX2-MD</td><td>FALCON</td><td>(0.0,2,6,1,SUM,Swish,True,Add,EdgePool,2)</td><td>69.87</td></tr><tr><td>BRUTEFORCE</td><td>(0.0,1, 4, 3, STACK,Prelu, True,Max, TopkPool, 2)</td><td>65.39</td></tr><tr><td>DHFR-MD</td><td>FALCON</td><td>(0.3,2,4,2,SUM,Swish,True,Mean,PANPool,2)</td><td>71.33</td></tr><tr><td rowspan="2">ER-MD</td><td>BRUTEFORCE</td><td>(0.0,1,4,3, CAT, Prelu, True, Mean, SAGPool,4)</td><td>56.22</td></tr><tr><td>FALCON</td><td>(0.3,3,4,2, CAT, Relu, True,Add,PANPool,2)</td><td>81.67</td></tr><tr><td rowspan="2">MCF-7</td><td>BRUTEFORCE</td><td>(0.0,3,5,3, CAT, Prelu, True,Max,PANPool,6)</td><td>83.33</td></tr><tr><td>FALCON BRUTEFORCE</td><td>(0.6,1,8, 2, CAT, Swish, True, Add, NoPool) (0.0,1,2, 6, SUM,Prelu, True,Add, NoPool)</td><td>67.85 70.61</td></tr><tr><td rowspan="2">MOLT-4</td><td></td><td></td><td></td></tr><tr><td>FALCON BRUTEFORCE</td><td>(0.0,3,6,2, SUM,Prelu,True,Max,NoPool) (0.0,1,6,1, SUM,Prelu,True,Add,NoPool)</td><td>69.03 70.30</td></tr><tr><td rowspan="2">Mutagenicity</td><td></td><td></td><td></td></tr><tr><td>FALCON BRUTEFORCE</td><td>(0.0,2, 6,1, CAT,Relu, True,Add, NoPool) (0.0,2,4,2, CAT, Relu, True,Add, PANPool, 2)</td><td>81.73</td></tr><tr><td rowspan="2">NCI1</td><td></td><td></td><td>81.17</td></tr><tr><td>FALCON BRUTEFORCE</td><td>(0.0,2,4,2, SUM, Swish, True, Max, EdgePool,2) (0.0,1,4,2,STACK,Prelu,True,Add,EdgePool,4)</td><td>80.13</td></tr><tr><td rowspan="2">NCI109</td><td></td><td></td><td>82.81</td></tr><tr><td>FALCON BRUTEFORCE</td><td>(0.0,2,8,2, STACK,Prelu, True,Max,NoPool) (0.0,3, 6,2, STACK,Prelu, True,Add,EdgePool, 6)</td><td>79.98 81.77</td></tr><tr><td rowspan="2">NCI-H23</td><td>FALCON</td><td></td><td></td></tr><tr><td>BRUTEFORCE</td><td>(0.0,2,6,1,CAT,Swish,True,Add,NoPool) (0.0,2,6,1,CAT,Swish,True,Add,NoPool)</td><td>71.14 71.14</td></tr><tr><td rowspan="2">OVCAR-8</td><td>FALCON</td><td></td><td></td></tr><tr><td>BRUTEFORCE</td><td>(0.6,2,6,2, CAT, Swish, True,Add, NoPool) (0.6,1,2,3,CAT,Swish,True,Add,NoPool)</td><td>68.21 67.40</td></tr><tr><td rowspan="2">P388</td><td>FALCON</td><td></td><td></td></tr><tr><td>BRUTEFORCE</td><td>(0.0,2,6,2,CAT,Prelu,True,Add,NoPool)</td><td>78.75</td></tr><tr><td rowspan="2">PC-3</td><td>FALCON</td><td>(0.0,2,6,2, CAT,Prelu,True,Add,NoPool)</td><td>78.75</td></tr><tr><td>BRUTEFORCE</td><td>(0.0,2,6,1, SUM,Relu,True,Max,NoPool)</td><td>73.28</td></tr><tr><td rowspan="2">PTC-MM</td><td></td><td>(0.0,2,6,1, SUM,Relu,True,Max,NoPool)</td><td>73.28</td></tr><tr><td>FALCON</td><td>(0.0,2,4,2,STACK,Swish,True,Max,EdgePool,2)</td><td>56.96</td></tr><tr><td rowspan="2">PTC-MR</td><td>BRUTEFORCE</td><td>(0.0,3,6,1, SUM,Swish, True,Mean,EdgePool,2)</td><td>52.93</td></tr><tr><td>FALCON</td><td>(0.0,2, 4, 2, SUM, Swish, True, Mean, TopkPool, 2)</td><td>60.56</td></tr><tr><td rowspan="2">SF-295</td><td>BRUTEFORCE</td><td>(0.3,1,6,2, SUM,Relu,True,Add,NoPool)</td><td>63.06</td></tr><tr><td>FALCON</td><td>(0.6,2, 6, 2, CAT, Swish, True,Add, NoPool)</td><td>64.75</td></tr><tr><td rowspan="2"></td><td>BRUTEFORCE</td><td>(0.0, 3, 8,3, SUM, Prelu, True, Max, PANPool, 4)</td><td>66.47</td></tr><tr><td>FALCON</td><td>(0.0,1, 8,1, CAT, Swish, True,Add, NoPool)</td><td>73.34</td></tr><tr><td rowspan="2">SN12C SW-620</td><td>BRUTEFORCE</td><td>(0.0,1,8,3, CAT,Prelu, True,Add,EdgePool, 6)</td><td>73.73</td></tr><tr><td>FALCON</td><td>(0.0,2,4,2,STACK,Prelu,True,Max,NoPool)</td><td>69.26</td></tr><tr><td rowspan="2"></td><td>BRUTEFORCE</td><td>(0.0,2,4,2, STACK,Prelu,True,Max,NoPool)</td><td>69.26</td></tr><tr><td>FALCON</td><td>(0.0,2,4,2, SUM,Prelu, True,Add,EdgePool,2)</td><td>79.10</td></tr><tr><td rowspan="2">Tox21-AhR</td><td>BRUTEFORCE</td><td>(0.0,3,6,2, SUM,Prelu, True,Add, NoPool)</td><td>82.02</td></tr><tr><td>FALCON</td><td>(0.3,2,6,2, CAT,Swish,True,Max,NoPool)</td><td>67.94</td></tr><tr><td rowspan="2">UACC257</td><td>BRUTEFORCE</td><td>(0.0,3,6,1,SUM,Prelu,True,Max,NoPool)</td><td>70.24</td></tr><tr><td>FALCON</td><td>(0.6,1,8,1, CAT, Prelu, True,Add, NoPool)</td><td>59.60</td></tr><tr><td rowspan="2">Yeast</td><td>BRUTEFORCE</td><td></td><td></td></tr><tr><td></td><td>(0.0,1,2,3, SUM, Swish, True,Add, EdgePool, 2)</td><td>60.41</td></tr></table>
|
| 450 |
+
|
| 451 |
+
# C EXPERIMENTAL RESULTS ON THE IMAGE TASK
|
| 452 |
+
|
| 453 |
+
# C.1 DATASET PRE-PROCESSING
|
| 454 |
+
|
| 455 |
+
We use the CIFAR-10 (Krizhevsky, 2009) image dataset to show FALCON can work well on other machine learning domains. This dataset consists of 50,000 training images and 10,000 test images. We randomly crop them to size $3 2 \times 3 2$ , and conduct random flipping and normalization.
|
| 456 |
+
|
| 457 |
+
# C.2 DESIGN SPACES
|
| 458 |
+
|
| 459 |
+
Here we use two different design spaces to demonstrate FALCON’s ability in searching for both hyper-parameters and architectures on image dataset.
|
| 460 |
+
|
| 461 |
+
Hyper-parameter Design Space. We consider a broad space of hyper-parameter search, including common hyper-parameters like Batch Size. We train each design using a SGD optimizer, which requires weight decay and momentum as hyper-parameters. We also use a learning rate (LR) scheduler, which reduces the learning rate when validation performance has stopped improving. Specifically, the scheduler will reduce the learning rate by a factor if no improvement is seen for a ‘patience’ number of epochs. It is also worth mentioning that FALCON is flexible for other sets of hyper-parameter choices determined by the user end.
|
| 462 |
+
|
| 463 |
+
Table 12: Hyper-parameter design space for image tasks.
|
| 464 |
+
|
| 465 |
+
<table><tr><td>Variable</td><td>Candidate Values</td></tr><tr><td>Momentum (SGD)</td><td>[0.5, 0.9, 0.99]</td></tr><tr><td>Weight decay</td><td>[le-4, 5e-4,1e-3, 5e-3]</td></tr><tr><td>Batch size</td><td>[32, 64, 128,256]</td></tr><tr><td>LR decay factor</td><td>[0.1, 0.2, 0.5, 0.8]</td></tr><tr><td>LR decay patience</td><td>[3,5,10]</td></tr></table>
|
| 466 |
+
|
| 467 |
+
Architecture Design Space. We construct micro design space for the computational cells. Each cell constitutes of two branches, where we enable five selections: separable convolution with kernel size 3 $\times 3$ and $5 \times 5$ , average pooling and max pooling with kernel size $3 { \times } 3$ , and identity. In each branch, we have one dropout layer, where the dropout ratio is one of $\{ 0 . 0 , 0 . 3 , 0 . 6 \}$ , and one batch normalization layer. We also use one of identity and skip-sum as skip-connection within each branch. After the input data is separately computed in each branch, the outputs are added as the final cell output, which is different with the original ENAS paper that searches the computational DAG on the defined nodes.
|
| 468 |
+
|
| 469 |
+
# C.3 EXPERIMENTAL RESULTS
|
| 470 |
+
|
| 471 |
+
Here we set the exploration size as 20 for all the sample-based methods. For hyper-parameter design space, we compare FALCON with the baselines that are available for hyper-parameter tuning. Moreover, to accelerate the search process, FALCON explores an unknown design by fine-tuning a pretrained model for several epochs based on the selected hyper-parameters, instead of training each candidate design from scratch. The results are summarized in Table 13.
|
| 472 |
+
|
| 473 |
+
Table 13: Search results on the hyper-parameter design space for CIFAR-10 dataset.
|
| 474 |
+
|
| 475 |
+
<table><tr><td>Average Error (%)</td></tr><tr><td>Random 4.13</td></tr><tr><td>BO 4.95</td></tr><tr><td>SA 4.04</td></tr><tr><td>FALCON 3.80</td></tr></table>
|
| 476 |
+
|
| 477 |
+

|
| 478 |
+
Figure 7: Sensitivity of FALCON’s hyper-parameters.
|
| 479 |
+
|
| 480 |
+
For the architecture design space. For ENAS and DARTS, the learning rate is 0.01, and the maximum training epoch is 300. We repeat each experiment three times and summarize the results in Table 14.
|
| 481 |
+
|
| 482 |
+
Table 14: Search results on the architecture design space for CIFAR-10 dataset.
|
| 483 |
+
|
| 484 |
+
<table><tr><td></td><td>Average Error (%)</td><td>Search Cost (GPU days)</td></tr><tr><td>Random</td><td>10.43</td><td>0.64</td></tr><tr><td>BO</td><td>9.83</td><td>0.67</td></tr><tr><td>SA</td><td>10.16</td><td>0.62</td></tr><tr><td>ENAS-micro</td><td>9.20</td><td>0.77</td></tr><tr><td>DARTS-micro</td><td>8.97</td><td>0.89</td></tr><tr><td>FALCON</td><td>8.87</td><td>0.81</td></tr></table>
|
| 485 |
+
|
| 486 |
+
# D SENSITIVITY ANALYSIS
|
| 487 |
+
|
| 488 |
+
We analyze the sensitivity of the hyper-parameters in the search strategy of FALCON, using a node classification task, CiteSeer, and a graph classification task, Tox21-AhR. Specifically, we study the influence of the number of random starting nodes and the candidate scale resulting from an explored node (i.e., how many hop neighbors of an explored node are to be included in the candidate set).
|
| 489 |
+
|
| 490 |
+
As shown in Figure 7, we find that FALCON outperforms the best AutoML baselines with a large range of hyper-parameters. Specifically, $7 3 \%$ and $9 7 \%$ hyper-parameter combinations of FALCON rank best among the baselines in CiteSeer and Tox21-AhR, respectively.
|
| 491 |
+
|
| 492 |
+
Moreover, we discover an interesting insight about the size of receptive field, i.e., the number of design candidates, during the search process of FALCON. According to the construction of design subgraph, the receptive field size is $\dot { O } ( r h ^ { d } )$ , where $r$ is the number of random start nodes, $h$ is the number of neighbor hops, and $d$ is the average node degree. We find that the performance of design searched by FALCON increases with the receptive field’s size until it reaches a certain scale.
|
| 493 |
+
|
| 494 |
+
Such patterns have been widely observed in multiple datasets. While the receptive field on the design subgraph should contain sufficient candidates for sampling good ones, it should also prune inferior design space, which doesn’t provide insights on navigating the best-performing designs. Thus, the size of the receptive field may be a crucial factor influencing the search quality of FALCON.
|
md/dev/KWCZfuqshd/KWCZfuqshd.md
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Real-World Robot Learning with Masked Visual Pre-training
|
| 2 |
+
|
| 3 |
+
Ilija Radosavovic∗ Tete Xiao∗ Stephen James Pieter Abbeel Jitendra Malik† Trevor Darrell†
|
| 4 |
+
|
| 5 |
+
University of California, Berkeley
|
| 6 |
+
|
| 7 |
+
Abstract: In this work, we explore self-supervised visual pre-training on images from diverse, in-the-wild videos for real-world robotic tasks. Like prior work, our visual representations are pre-trained via a masked autoencoder (MAE), frozen, and then passed into a learnable control module. Unlike prior work, we show that the pre-trained representations are effective across a range of real-world robotic tasks and embodiments. We find that our encoder consistently outperforms CLIP (up to $7 5 \%$ ), supervised ImageNet pre-training (up to $8 1 \%$ ), and training from scratch (up to $81 \%$ ). Finally, we train a 307M parameter vision transformer on a massive collection of $4 . 5 { \mathrm { M } }$ images from the Internet and egocentric videos, and demonstrate clearly the benefits of scaling visual pre-training for robot learning.
|
| 8 |
+
|
| 9 |
+
Keywords: Self-supervised Learning, Visual Representations, Robot Learning
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
Learning representations with large neural networks is the workhorse of modern deep learning. This has enabled impressive results in computer vision [1, 2], natural language processing [3, 4, 5], and audio generation [6, 7]. How can we transfer the success stories of representation learning to robotics? We can approach this from two ends: shared representations on the perception side or shared representations on the action side. Our focus in this paper is on shared visual representations.
|
| 14 |
+
|
| 15 |
+
Of course, the devil is in the details. Recent developments in the field of visual learning have made this more feasible: (1) the use of diverse, real-world data from the Internet and egocentric videos, (2) self-supervised objectives that do not overly rely on data augmentations or other forms of strong human-designed priors, (3) scalable and high-capacity transformer models [8, 9], and (4) training of control policies on top of frozen visual representations. In our recent work [10], we have shown that this recipe for self-supervised visual pre-training is effective for motor control in simulation.
|
| 16 |
+
|
| 17 |
+
In this paper, we show that this framework is effective for real-world robotic tasks as well (Figure 1). We build on our prior work, but make significant advances in terms of data scale and diversity $( 7 \times$ larger), model size $1 5 \times$ bigger), and real-world experiments (extensive real robot evaluations).
|
| 18 |
+
|
| 19 |
+
In particular, we train self-supervised visual representations on real-world images and videos from the Internet [11, 12, 13] and egocentric video datasets [14, 15]. We leverage the masked autoencoders [16] that learn visual representations by masked prediction. The hope is that, by learning to predict the missing content in real-world images, the model will learn useful properties of the visual world that will enable it to learn to perform real-world robotic tasks. Given the pre-trained vision encoder, we freeze the encoder and learn control policies on top. The same visual representations are used for all downstream robotic tasks and embodiments. We focus on efficient real-world learning through behavior cloning with a handful of human-provided demonstrations per task (20 - 80).
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
Figure 1: Real-world robot learning with masked visual pre-training. We learn visual representations from a massive collection of Internet and egocentric data. We pre-train representations with masked image modeling, freeze the encoder, and learn control policies for robotic tasks on top.
|
| 23 |
+
|
| 24 |
+
We evaluate our approach in an extensive real-world study and report results from 981 real-world experiments. We consider basic motor control tasks (reach, push, pick), as well as tasks with variations in scenes and objects (Figure 1, right). We find that our approach achieves considerably higher performance than CLIP (up to $7 5 \%$ ), supervised pre-training (up to $8 1 \%$ ), and training from scratch (up to $81 \%$ ). Furthermore, we observe that our representations lead to large improvements in sample complexity, reaching the strongest baseline performance with half the number of demonstrations.
|
| 25 |
+
|
| 26 |
+
In addition, we demonstrate the benefits of scaling visual pre-training for robotics by training a 307M parameter transformer [9] on a massive collection of $4 . 5 { \mathrm { M } }$ images from ImageNet [11], Epic Kitchens [17], Something Something [12], 100 Days of Hands [13], and Ego4D [15] datasets. Importantly, we observe that it is not sufficient to scale the model alone and that larger models require bigger datasets. To the best of our knowledge, ours is the largest vision model deployed for robotics, and demonstrates clearly the benefits of visual pre-training scale for robot learning. We encourage the readers to see the the extended version of this work on arXiv and also to check the project page.
|
| 27 |
+
|
| 28 |
+
# 2 Related Work
|
| 29 |
+
|
| 30 |
+
End-to-end control is concerned with learning to predict robot actions (e.g., joint velocities, endeffector poses, etc) directly from observations [18, 19, 20], without the need to perform explicit 3D pose estimation [21], grasp planning [22], and motion planning [23]. However, these end-to-end approaches tend to be too sample inefficient for real-world training. Some works have tried to find a balance between these explicitly pipelined approaches and end-to-end approaches [24, 25, 26].
|
| 31 |
+
|
| 32 |
+
Supervised pre-training for robotics learns one or more pretext tasks through strong supervision and then transfers the representations to downstream robotic tasks. Lin et al. [27] shows that representations learned from semantic tasks such as detection and segmentation correlate with affordance maps for object manipulation. Shridhar et al. [28] use language-supervised CLIP model [29] for learning language-conditioned imitation policy. In concurrent work, Nair et al. [30] explore pre-training visual representations using time contrastive learning and language descriptions from human annotators. These methods all require expert labels or cross-domain supervision.
|
| 33 |
+
|
| 34 |
+
Self-supervised learning in robotics has been explored in a number of settings: learning a dynamic models [31]; learning visual representations from interaction with the environment [32]; learning vision-based grasping policies [33, 34]; learning visual autoencoders [35]; learning spatiotemporal representations through videos [36, 37]; learning visual correspondence [38]; utilizing non-parametric nearest-neighbor retrieval [39]; and conducting visual self-supervised learning on pre-collected demonstrations [40]. These methods require in-domain data collection, and thus may be difficult to extend beyond the training environment and task. In contrast, our approach uses a large-scale and diverse collection of real-world images and videos, making it more generalizable.
|
| 35 |
+
|
| 36 |
+

|
| 37 |
+
Figure 2: One encoder for all robots and tasks. We train control policies per task, on top of the frozen encoder. The same vision encoder is used for all downstream robotic tasks and embodiments.
|
| 38 |
+
|
| 39 |
+
# 3 Real-World Robot Learning with Masked Visual Pre-training
|
| 40 |
+
|
| 41 |
+
# 3.1 Masked Visual Pre-training
|
| 42 |
+
|
| 43 |
+
Data collection. We first compile a large-scale dataset for learning visual representations. We primarily use Ego4D [15], a massive scale, egocentric dataset from nine countries recorded via portable devices, covering over 3,670 hours of daily-life activities. We combine the Ego4D data with the ImageNet [11], as well as the Hand-object Interaction (HoI) data used in [10], which comprises of the egocentric Epic Kitchens [17] dataset, the YouTube 100 Days of Hands dataset [13], and the crowd-sourced Something-Something dataset [12]. Our training data totals 4.5 million images, $6 . 5 \mathrm { x }$ of the HoI data. We find that a sufficiently large and diverse pre-training dataset to perform the mask image modeling self-supervisory task is critical to scale up the vision backbone for real robot tasks.
|
| 44 |
+
|
| 45 |
+
Self-supervised objective. At the core of our self-supervised representation learning approach is masked image modeling via the masked autoencoders (MAE) [16]. MAE masks out random patches in an image and reconstructs the missing content with a vision transformer (ViT) [9]. A high masking ratio, e.g., $7 5 \%$ , and asymmetrical heavy-encoder light-decoder design, are important for learning good visual representations efficiently. Simple and free from dataset or task-specific augmentations [41], MAE is the state-of-the-art self-supervised framework in computer vision [42, 43, 44, 45], and has been demonstrated to work well for motor control tasks in simulation as well [10].
|
| 46 |
+
|
| 47 |
+
Architecture. We use the ViT models as our vision encoders. While the MAE-trained ViT models yield improving performance in vision tasks as model sizes grow [9, 16, 46], previous work [10] does not show improvement from switching a ViT-Small model to the ViT-Base counterpart of $4 \mathbf { x }$ as many parameters. In this work, we scale the model up to the ViT-Large and deploy it on the real robot. The model contains 307M parameters and runs at ${ \sim } 6 4$ gigaflops at input size $2 2 4 \times 2 2 4$ , approximately $1 5 \mathrm { x }$ as many as the commonly adopted ResNet-50 [47], the largest vision model deployed for robotics. As we will show in the experiments, scaling model sizes while training on sufficiently large data leads to consistent performance improvement on downstream robotic tasks.
|
| 48 |
+
|
| 49 |
+
# 3.2 Real-World Robot Learning
|
| 50 |
+
|
| 51 |
+
We learn to perform real-robot tasks through behavior cloning (BC). We collect demonstrations containing trajectories of RGB images from a wrist-mounted camera and the robot’s joint state at each time step. For most of the tasks, we use the motion-tracked HTC Vive VR system to control the end-effector. For some tasks that are difficult to demonstrate via the motion controller, e.g., closing fridge door, we use kinesthetic teaching. Given the recorded demonstrations, we train a control policy that takes in the input image features and proprioceptive states (joint positions) at time step $t$ and predicts the action at time step $t + 1$ . We perform joint position control; we do not use any end-effector information (e.g., the 6-DoF pose). We build on our MVP pipeline [10] and freeze the image encoder throughout the policy learning, which prevents large pre-trained encoders from overfitting to a specific setting or task, and greatly reduces GPU memory footprint and training time.
|
| 52 |
+
|
| 53 |
+

|
| 54 |
+
Figure 3: Real-world robotic tasks. We perform extensive real robot evaluations using a 7 DoF robot arm with a parallel jaw gripper. Our tasks include basic motor control skills (reaching a red block, pushing a wooden cube, and picking a yellow cube), variations in scenes (closing a fridge), objects (picking fruits), and scenes and objects (picking a detergent bottle from a cluttered sink).
|
| 55 |
+
|
| 56 |
+
# 4 Experimental Setup
|
| 57 |
+
|
| 58 |
+
In this section we provide implementation details for our approach and describe our evaluation setup.
|
| 59 |
+
|
| 60 |
+
Data. We extract frames from Ego4D, Epic Kitchens, and Something-Something at 0.2 fps, 1fps and 0.3fps, respectively. We then combine the Ego4d with ImageNet and the YouTube 100 Days of Hands dataset. This process yields 2.6M frames from Ego4D, 1.2M images from ImageNet, and 700k HoI images from the rest, a total of $4 . 5 \mathrm { M }$ images. We term the combined dataset as “Ego” for abbreviation. Note that [10] only uses the $7 0 0 \mathrm { k }$ HoI images, excluding the Ego4D and ImageNet.
|
| 61 |
+
|
| 62 |
+
Encoders. We use the standard Vision Transformer (ViT) architecture as the image encoder. We use three models of various sizes: ViT-Small [48], ViT-Base, and ViT-Large models, of 22M, 86M, and 307M parameters, respectively. The ViT-Small model is approximately the same size as the ResNet50 model, while the ViT-Large model has $\sim 1 5 \mathrm { x }$ as many parameters as the ResNet-50 model.
|
| 63 |
+
|
| 64 |
+
Pre-training. We pre-train the models via the MAE framework [16]. The training recipe closely follows [16], with dataset specific settings from [10]. We use the auxiliary dummy classification token for transferring to downstream robotics tasks. We train the MAE models for 400 epochs for the combined Ego dataset; 1600 epochs for the HOI dataset; and 1600 epochs for ImageNet dataset. We use the pre-training recipe in [49] for the study that involves ImageNet supervised models.
|
| 65 |
+
|
| 66 |
+
Controllers. The controller takes in both image features and the robot’s proprioceptive state. We use joint positions as the proprioceptive state without explicitly appending the end-effector pose to the state. We do not use velocity in the state as our low-cost arm does not support true velocity sensing. The controller outputs delta joint angles. The controller’s design closely follows [50], i.e., a four-layer MLP with a SeLU [51] activation following each hidden layer. The hidden size is [256, 128, 64] for most tasks and [512, 256, 128] for the PickSink task. We linearly project the image features and the proprioceptive states to a joint embedding space as the controller’s input.
|
| 67 |
+
|
| 68 |
+
Robot and robotic tasks. We use the low-cost UFACTORY xArm7 robot (a 7-DoF arm) and a 1- DoF parallel jaw gripper. We use the arm’s maximum control frequency of $5 \mathrm { H z }$ for both collecting demonstrations and control. We use a first-person wrist-mounted RealSense camera for all tasks. We do not use depth information from the camera. We consider basic motor control tasks, i.e., ReachBlock, PushCube, and PickCube, and more challenging in-context tasks, i.e., CloseFridge, PickFruit, and PickSink. The tasks are shown in Figure 3 (more details in the next section).
|
| 69 |
+
|
| 70 |
+
Demonstrations. We collect 80 demonstrations per task. We use the motion-tracked HTC Vive VR system for most tasks, except for CloseFridge we use kinematics teaching. We use trajectory replay on the robot for trajectory pruning. We do not use the key-frame information for the learning.
|
| 71 |
+
|
| 72 |
+
Evaluation. We systematically sweep across 16 variations of the environment, e.g., shifting the target object. For consistency and reliability of the study, we use the same 16 variations for all models in an individual task, and evaluate models sequentially at each variation, in order for similar lighting conditions, robot conditions, precise object initial locations, etc (see also the arXiv).
|
| 73 |
+
|
| 74 |
+

|
| 75 |
+
Figure 4: Comparison to vision encoders. We compare our approach to visual encoders trained with CLIP, supervised learning on the ImageNet, and from scratch on the task at hand. In all cases, we observe that our approach consistently outperforms the baselines by a considerable margin.
|
| 76 |
+
|
| 77 |
+

|
| 78 |
+
Figure 5: Sample complexity. We show the performance of our approach as the number of demonstrations varies from 20 to 80. CLIP performance at 80 demonstrations is shown with a dashed lined for reference. Our approach is comparable to CLIP using only half the number of demonstrations.
|
| 79 |
+
|
| 80 |
+
# 5 Experimental Results
|
| 81 |
+
|
| 82 |
+
We perform extensive evaluations across a range of visual backbones, real-world robotic tasks, objects, and environments (Figure 3). In total, we report results from 981 real-world experiments.
|
| 83 |
+
|
| 84 |
+
# 5.1 Basic Motor Control
|
| 85 |
+
|
| 86 |
+
We evaluate three basic motor control tasks in visually simple contexts: reaching a red block, pushing a wooden cube, and picking a yellow cube (see Figure 3 for task visualization). These tasks serve as stepping stones for more complex tasks, and the visual representations that can potentially be fundamental for robotics should learn these tasks efficiently. In all cases, we randomize the initial object and robot positions (see arXiv for details about the learning and task setup).
|
| 87 |
+
|
| 88 |
+
Comparison to various vision encoders. In Figure 4 we compare our approach to a set of stateof-the-art vision backbones: CLIP [3] trained on 400M text-image pairs, supervised model trained on the ImageNet, and a model trained from scratch with in-domain demonstration data. For fair comparisons, we use the ViT-Base [9] vision encoder for all methods. We empirically observe that the CLIP encoder performs the best among the baselines, and the ranking order is consistent across the benchmark tasks. Our approach consistently outperforms the baselines by a considerable margin.
|
| 89 |
+
|
| 90 |
+
Sample complexity. In Figure 5 we study the performance of our approach as the number of demonstrations varies from 20 to 80. For reference, we show the performance of the most competitive baseline, CLIP, trained with 80 demonstrations (dashed horizontal line). In aggregate, we observe that our approach reaches CLIP performance while using $50 \%$ fewer demonstrations. This result is a promising signal for using our models for learning more complex robotic tasks, as discussed next.
|
| 91 |
+
|
| 92 |
+

|
| 93 |
+
Figure 6: Variations in scenes and objects. We compare our approach to CLIP on tasks with variations in scenes (closing the fridge), objects (picking fruits), and scenes and objects (picking an object from a cluttered sink). The models are ViT-Base. Our approach considerably outperforms CLIP and the gap is larger than in simpler settings (see Figure 4). This may suggest that our representations capture more precise spatial structure that is helpful for robotic tasks in more realistic contexts.
|
| 94 |
+
|
| 95 |
+
# 5.2 Visually Diverse Scenes and Objects
|
| 96 |
+
|
| 97 |
+
We have previously shown that our approach can learn basic motor control tasks, such as reaching, pushing, and picking, at a higher success rate and better sample complexity than the baseline vision backbones. To focus on the motor control aspect, we used a visually simple environment and basic objects. However, one of the main potential benefits of our approach is that learning visual representations from diverse, real-world images may enable to solve robotic tasks that involve the interaction with everyday objects in more visually complex environments. In this subsection, we evaluate our visual representations on robotic tasks with variations in scenes and objects in more realistic setups.
|
| 98 |
+
|
| 99 |
+
Scene context. We first evaluate our approach in a more realistic scene by considering the task of closing the door of a toy fridge that is left open (termed CloseFridge). We randomize the location of the fridge, which side of the door to close, and initial angle of the door. As shown in Figure 6, bottom-left, the initial configuration of the fridge and the robot vary considerably, which is quite common in everyday settings. Figure 6, top-left, shows that our approach outperforms all baselines.
|
| 100 |
+
|
| 101 |
+
Different objects. Next, we evaluate on a task with a variety of objects. The goal is to pick up eight different fruits that vary in color, shape, and size (termed PickFruit). In each trial, a fruit is selected at random, and both the fruit and the robot’s positions are randomized. The number of training demonstrations remain unchanged, i.e., we provide 10 demonstrations for each fruit. In Figure 6, middle, we show the evaluation results (top) and starting configuration samples (bottom). We see that baselines struggles in this setting while our approach achieves nearly perfect score.
|
| 102 |
+
|
| 103 |
+
Objects in context. Finally, we evaluate our approach on a task that features interacting with objects in everyday contexts. We task the robot with picking a detergent bottle from a cluttered sink (termed PickSink). The task is challenging as the visual configuration of the scene, such as the toy plates, mug cups, and silverware, can vary in unlimited ways, as shown in Figure 6 right We observe that our approach considerably outperforms baseline approaches using the same ViT-B encoder.
|
| 104 |
+
|
| 105 |
+

|
| 106 |
+
Figure 7: Scaling model and data. We study the scaling properties of our approach. We observe that scaling the model size alone from ViT-S to ViT-B while keeping the dataset fixed (HoI image collection; see text for details) does not improve the performance and even hurts (left). However, when we scale both the model and data (our massive Ego image collection; see text for details) we see clear benefits from a larger model. The trend continues when going further from the 86M ViT-B to the 307M ViT-L model (middle & right). Moreover, the gains are larger for harder tasks (right).
|
| 107 |
+
|
| 108 |
+
# 5.3 Scaling Model and Data Size
|
| 109 |
+
|
| 110 |
+
Importantly, our visual pre-training approach uses a self-supervised objective [16] that makes few assumptions about the data distribution, and does not rely on human-designed pretext tasks such as data augmentations. Therefore, the framework is well-suited for pre-training from a massive collection of unlabeled and in-the-wild visual data. Here we study scaling model and data size.
|
| 111 |
+
|
| 112 |
+
We first consider increasing the model capacity. In Figure 7, left, we see that increasing the model size $( { \sim } 4 . 5 \mathrm { x } )$ from ViT-S to ViT-B, while keeping the data size fixed (HOI image collection [10]), does not increase performance and even hurts. This is consistent with the in-simulation results reported in [10]. However, if we also scale the data size from HOI to our massive Ego data collection, ViT-B yields better results. These results suggests that we must scale both the model and the data.
|
| 113 |
+
|
| 114 |
+
In Figure 7, middle & right, we show the performance as a function of model size. Additionally increasing the model size from the 86M parameter ViT-B to the 307M parameter ViT-L leads to further improvements. The gain is larger for the visually more challenging task (PickSink). To the best of our knowledge, our work is the largest vision model deployed to real robot tasks, which clearly demonstrates the benefits of scaling visual pre-training for real-world robot learning.
|
| 115 |
+
|
| 116 |
+
# 5.4 Comparison to Concurrent Work
|
| 117 |
+
|
| 118 |
+
We compare our approach to a concurrent work [30], submitted to the same conference (CoRL 2022). Similarly, it pre-trains visual representations on inthe-wild video data from Ego4D [15]. However, it relies on paired language-video annotations that are available as part of Ego4D. In contrast, our approach is fully self-supervised and makes minimal assumptions about the data distribution, enabling us to leverage massive collections of uncurated data (e.g., from the Internet). In Table 1, we compare our models to the strongest available R3M ResNet-50 model. We observe that our medium-sized ViT-B model outperforms R3M ResNet-50 by a large margin $9 3 . 8 \%$ vs. $3 1 . 3 \%$ ). We also see that our smallest ViT-S model from [10] outperforms it as well $6 8 . 8 \%$ vs. $3 1 . 3 \%$ ).
|
| 119 |
+
|
| 120 |
+
<table><tr><td></td><td>supervision</td><td>params (M)</td><td>success (%)</td></tr><tr><td>R3M</td><td>video-text</td><td>23</td><td>31.3</td></tr><tr><td>CLIP</td><td>image-text</td><td>86</td><td>18.8</td></tr><tr><td rowspan="2">Ours</td><td>image-only</td><td>22</td><td>68.8</td></tr><tr><td></td><td>86 307</td><td>93.8 100.0</td></tr></table>
|
| 121 |
+
|
| 122 |
+
Table 1: Comparison to concurrent work. All of our vision models, trained with imageonly self-supervision, considerably outperform the strongest available R3M [30] model trained on paired video-language labels from Ego4D [15]. The gains are larger for larger models. Evaluated on the PickFruit task.
|
| 123 |
+
|
| 124 |
+

|
| 125 |
+
Figure 8: Multi-finger hand. We show that our framework readily generalizes to a different robot morphology. We experiment with finger reaching, using seen and unseen objects, and cube flipping.
|
| 126 |
+
|
| 127 |
+
# 5.5 Case Study: Multi-finger Hand
|
| 128 |
+
|
| 129 |
+
Our approach makes no assumptions about the downstream robotic tasks or embodiments. In particular, our policies take pixel images as input and predict joint position angles as actions (rather than, e.g., end-effector pose). In this subsection, we test the generality of our approach by applying it for downstream tasks with a multi-finger Allegro hand (see arXiv for more details on the setup).
|
| 130 |
+
|
| 131 |
+
Visual reaching. We design a reaching task in which the hand learns to reach the top of an object with the tip of the index finger. The object’s position is randomized across the palm. We provide 10 demonstrations for each of the 8 different objects. At test time, we evaluate the trained policy on the 8 seen objects as well as 45 unseen objects (see Figure 8). The success rate is ${ \sim } 5 0 \%$ across both.
|
| 132 |
+
|
| 133 |
+
Visual flipping. Next, we consider a cube flipping task in which the goal is to flip a rubber cube that is placed in the palm. The position of the cube is randomized across the palm. Thus, the policy must rely on visual cues to accomplish the task. In aggregate, we observe a success rate of $50 \%$ across 30 trials. See Figure 8 for example key frames and also check out the videos on the project page.
|
| 134 |
+
|
| 135 |
+
Understanding vision through action. Training policies on top of frozen visual representations enables us to perform studies to understand what the pre-trained visual representations utilize for downstream tasks. Here we first train a policy to reach a yellow cube, but test with objects of different shape and color. First, we find that when given the same shape of different color (wooden cube) or same color and different shape (yellow ball), the policy reaches for the object. Next, when given both the yellow cube and a distractor it reaches for the yellow cube. Finally, when given an object of different shape and color (blue cube) the hand stays still. See project page for videos.
|
| 136 |
+
|
| 137 |
+
# 6 Discussion
|
| 138 |
+
|
| 139 |
+
Limitations. While the scenes and objects used in our study are more realistic than in simpler robotic benchmarks, we still mostly use toy objects in relatively clean lab environments, rather than real objects in real-world scene contexts. Our tasks involve a single object, and do not require the robot to learn feedback control, or to learn multi-step planning. Factors such as robot up-time may influence the results as well. Overcoming these limitations is essential as we move toward developing, benchmarking, and widely deploying pre-trained models for real-world robotic applications.
|
| 140 |
+
|
| 141 |
+
Conclusion. We explore learning visual representations from a massive collection of real-world data and using them for downstream robotic tasks. We pre-train representations with masked modeling, freeze the encoder, and learn control policies on top. We perform extensive evaluations in the real world and show that, across various robotic tasks, our approach leads to higher success rate and better sample complexity than CLIP, supervised ImageNet pre-training, and training from scratch. We further demonstrate the benefits of scaling the model and data size for real world robot learning.
|
| 142 |
+
|
| 143 |
+
# Acknowledgments
|
| 144 |
+
|
| 145 |
+
We gratefully acknowledge the following colleagues for valuable discussions and support of our project: Shankar Sastry for Allegro hand access, Ken Goldberg for feedback and suggestions, Adam Curtis for help with wiring, Kevin Hu for help with Allegro hand retargeting, Erik Rogers for ROS suggestions, Lerrel Pinto for Allegro hand discussions, Raven Huang and Justin Kerr for help with 3D printing, and William Peebles for discussions. This work was supported in part by DARPA Machine Common Sense, LwLL, and RACER programs; ONR MURI program (N00014-21-1-2801); Hong Kong Centre for Logistics Robotics, BMW, as well as BAIR’s industrial alliance programs.
|
| 146 |
+
|
| 147 |
+
# References
|
| 148 |
+
|
| 149 |
+
[1] A. Krizhevsky, I. Sutskever, and G. E. Hinton. Imagenet classification with deep convolutional neural networks. NeurIPS, 2012.
|
| 150 |
+
[2] R. Girshick, J. Donahue, T. Darrell, and J. Malik. Rich feature hierarchies for accurate object detection and semantic segmentation. In CVPR, 2014.
|
| 151 |
+
[3] A. Radford, K. Narasimhan, T. Salimans, and I. Sutskever. Improving language understanding by generative pre-training. 2018.
|
| 152 |
+
[4] J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In NAACL-HCT, 2019.
|
| 153 |
+
[5] 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. NeurIPS, 2020.
|
| 154 |
+
[6] A. Van Den Oord, S. Dieleman, H. Zen, K. Simonyan, O. Vinyals, A. Graves, N. Kalchbrenner, A. W. Senior, and K. Kavukcuoglu. Wavenet: A generative model for raw audio. SSW, 2016.
|
| 155 |
+
[7] P. Dhariwal, H. Jun, C. Payne, J. W. Kim, A. Radford, and I. Sutskever. Jukebox: A generative model for music. arXiv:2005.00341, 2020.
|
| 156 |
+
[8] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin. Attention is all you need. In NeurIPS, 2017.
|
| 157 |
+
[9] A. Dosovitskiy, L. Beyer, A. Kolesnikov, D. Weissenborn, X. Zhai, T. Unterthiner, M. Dehghani, M. Minderer, G. Heigold, S. Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2020.
|
| 158 |
+
[10] T. Xiao, I. Radosavovic, T. Darrell, and J. Malik. Masked visual pre-training for motor control. arXiv:2203.06173, 2022.
|
| 159 |
+
[11] J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, 2009.
|
| 160 |
+
[12] R. Goyal, S. Ebrahimi Kahou, V. Michalski, J. Materzynska, S. Westphal, H. Kim, V. Haenel, I. Fruend, P. Yianilos, M. Mueller-Freitag, et al. The” something something” video database for learning and evaluating visual common sense. In ICCV, 2017.
|
| 161 |
+
[13] D. Shan, J. Geng, M. Shu, and D. F. Fouhey. Understanding human hands in contact at internet scale. In CVPR, 2020.
|
| 162 |
+
[14] D. Damen, H. Doughty, G. M. Farinella, S. Fidler, A. Furnari, E. Kazakos, D. Moltisanti, J. Munro, T. Perrett, W. Price, et al. Scaling egocentric vision: The epic-kitchens dataset. In ECCV, 2018.
|
| 163 |
+
[15] K. Grauman, A. Westbury, E. Byrne, Z. Chavis, A. Furnari, R. Girdhar, J. Hamburger, H. Jiang, M. Liu, X. Liu, et al. Ego4d: Around the world in 3,000 hours of egocentric video. arXiv:2110.07058, 2021.
|
| 164 |
+
[16] K. He, X. Chen, S. Xie, Y. Li, P. Dollar, and R. Girshick. Masked autoencoders are scalable ´ vision learners. arXiv:2111.06377, 2021.
|
| 165 |
+
[17] D. Damen, H. Doughty, G. M. Farinella, , A. Furnari, J. Ma, E. Kazakos, D. Moltisanti, J. Munro, T. Perrett, W. Price, and M. Wray. Rescaling egocentric vision: Collection, pipeline and challenges for epic-kitchens-100. IJCV, 2021.
|
| 166 |
+
[18] S. Levine, C. Finn, T. Darrell, and P. Abbeel. End-to-end training of deep visuomotor policies. JMLR, 2016.
|
| 167 |
+
[19] S. James, A. J. Davison, and E. Johns. Transferring end-to-end visuomotor control from simulation to real world for a multi-stage task. CoRL, 2017.
|
| 168 |
+
[20] 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 CoRL, 2018.
|
| 169 |
+
[21] OpenAI, M. Andrychowicz, B. Baker, M. Chociej, R. Jozefowicz, B. McGrew, J. Pachocki, ´ A. Petron, M. Plappert, G. Powell, A. Ray, J. Schneider, S. Sidor, J. Tobin, P. Welinder, L. Weng, and W. Zaremba. Learning dexterous in-hand manipulation. IJRR, 2020.
|
| 170 |
+
[22] A. T. Miller, S. Knoop, H. I. Christensen, and P. K. Allen. Automatic grasp planning using shape primitives. In ICRA, 2003.
|
| 171 |
+
[23] J. J. Kuffner and S. M. LaValle. Rrt-connect: An efficient approach to single-query path planning. In ICRA, 2000.
|
| 172 |
+
[24] A. Zeng, S. Song, S. Welker, J. Lee, A. Rodriguez, and T. Funkhouser. Learning synergies between pushing and grasping with self-supervised deep reinforcement learning. In IROS, 2018.
|
| 173 |
+
[25] A. Zeng, P. Florence, J. Tompson, S. Welker, J. Chien, M. Attarian, T. Armstrong, I. Krasin, D. Duong, V. Sindhwani, et al. Transporter networks: Rearranging the visual world for robotic manipulation. CoRL, 2020.
|
| 174 |
+
[26] S. James and A. J. Davison. Q-attention: Enabling Efficient Learning for Vision-based Robotic Manipulation. RA-L, 2022.
|
| 175 |
+
[27] L. Yen-Chen, A. Zeng, S. Song, P. Isola, and T.-Y. Lin. Learning to see before learning to act: Visual pre-training for manipulation. In ICRA, 2020.
|
| 176 |
+
[28] M. Shridhar, L. Manuelli, and D. Fox. Cliport: What and where pathways for robotic manipulation. In CoRL, 2021.
|
| 177 |
+
[29] A. Radford, J. W. Kim, C. Hallacy, A. Ramesh, G. Goh, S. Agarwal, G. Sastry, A. Askell, P. Mishkin, J. Clark, et al. Learning transferable visual models from natural language supervision. In ICML, 2021.
|
| 178 |
+
[30] S. Nair, A. Rajeswaran, V. Kumar, C. Finn, and A. Gupta. R3m: A universal visual representation for robot manipulation. arXiv:2203.12601, 2022.
|
| 179 |
+
[31] P. Agrawal, A. V. Nair, P. Abbeel, J. Malik, and S. Levine. Learning to poke by poking: Experiential learning of intuitive physics. NeurIPS, 2016.
|
| 180 |
+
[32] L. Pinto, D. Gandhi, Y. Han, Y.-L. Park, and A. Gupta. The curious robot: Learning visual representations via physical interactions. In ECCV, 2016.
|
| 181 |
+
[33] L. Pinto and A. Gupta. Supersizing self-supervision: Learning to grasp from 50k tries and 700 robot hours. In ICRA, 2016.
|
| 182 |
+
[34] S. Levine, P. Pastor, A. Krizhevsky, J. Ibarz, and D. Quillen. Learning hand-eye coordination for robotic grasping with deep learning and large-scale data collection. IJRR, 2018.
|
| 183 |
+
[35] C. Finn, X. Y. Tan, Y. Duan, T. Darrell, S. Levine, and P. Abbeel. Deep spatial autoencoders for visuomotor learning. In ICRA, 2016.
|
| 184 |
+
[36] P. Sermanet, K. Xu, and S. Levine. Unsupervised perceptual rewards for imitation learning. In RSS, 2017.
|
| 185 |
+
[37] P. Sermanet, C. Lynch, Y. Chebotar, J. Hsu, E. Jang, S. Schaal, S. Levine, and G. Brain. Timecontrastive networks: Self-supervised learning from video. In ICRA, 2018.
|
| 186 |
+
[38] P. Florence, L. Manuelli, and R. Tedrake. Self-supervised correspondence in visuomotor policy learning. RA-L, 2019.
|
| 187 |
+
[39] J. Pari, N. Muhammad, S. P. Arunachalam, L. Pinto, et al. The surprising effectiveness of representation learning for visual imitation. arXiv:2112.01511, 2021.
|
| 188 |
+
[40] A. Zhan, P. Zhao, L. Pinto, P. Abbeel, and M. Laskin. A framework for efficient robotic manipulation. arXiv:2012.07975, 2020.
|
| 189 |
+
[41] T. Xiao, X. Wang, A. A. Efros, and T. Darrell. What should not be contrastive in contrastive learning. In ICLR, 2021.
|
| 190 |
+
[42] Y. Li, S. Xie, X. Chen, P. Dollar, K. He, and R. Girshick. Benchmarking detection transfer learning with vision transformers. arXiv:2111.11429, 2021.
|
| 191 |
+
[43] Z. Tong, Y. Song, J. Wang, and L. Wang. Videomae: Masked autoencoders are data-efficient learners for self-supervised video pre-training. arXiv:2203.12602, 2022.
|
| 192 |
+
[44] C. Feichtenhofer, H. Fan, Y. Li, and K. He. Masked autoencoders as spatiotemporal learners. arXiv:2205.09113, 2022.
|
| 193 |
+
[45] R. Bachmann, D. Mizrahi, A. Atanov, and A. Zamir. Multimae: Multi-modal multi-task masked autoencoders. arXiv:2204.01678, 2022.
|
| 194 |
+
[46] X. Zhai, A. Kolesnikov, N. Houlsby, and L. Beyer. Scaling vision transformers. In CVPR, 2022.
|
| 195 |
+
[47] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In CVPR, 2016.
|
| 196 |
+
[48] H. Touvron, M. Cord, M. Douze, F. Massa, A. Sablayrolles, and H. Jegou. Training data- ´ efficient image transformers & distillation through attention. In ICML, 2021.
|
| 197 |
+
[49] T. Xiao, P. Dollar, M. Singh, E. Mintun, T. Darrell, and R. Girshick. Early convolutions help transformers see better. In NeurIPS, 2021.
|
| 198 |
+
[50] V. Makoviychuk, L. Wawrzyniak, Y. Guo, M. Lu, K. Storey, M. Macklin, D. Hoeller, N. Rudin, A. Allshire, A. Handa, et al. Isaac gym: High performance gpu-based physics simulation for robot learning. In NeurIPS, 2021.
|
| 199 |
+
[51] G. Klambauer, T. Unterthiner, A. Mayr, and S. Hochreiter. Self-normalizing neural networks. In NeurIPS, 2017.
|
md/dev/KmtVD97J43e/KmtVD97J43e.md
ADDED
|
@@ -0,0 +1,349 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SYNCHROMESH: RELIABLE CODE GENERATION FROM PRE-TRAINED LANGUAGE MODELS
|
| 2 |
+
|
| 3 |
+
Gabriel Poesia∗† Stanford University poesia@stanford.edu
|
| 4 |
+
|
| 5 |
+
Oleksandr Polozov∗‡ X, the moonshot factory polozov@google.com
|
| 6 |
+
|
| 7 |
+
Vu Le, Ashish Tiwari, Gustavo Soares, Christopher Meek, Sumit Gulwani Microsoft Research, Redmond {levu,astiwar,gustavo.soares,meek,sumitg}@microsoft.com
|
| 8 |
+
|
| 9 |
+
# ABSTRACT
|
| 10 |
+
|
| 11 |
+
Large pre-trained language models have been used to generate code, providing a flexible interface for synthesizing programs from natural language specifications. However, they often violate syntactic and semantic rules of their output language, limiting their practical usability. In this paper, we propose SYNCHROMESH: a framework for substantially improving the reliability of pre-trained models for code generation. SYNCHROMESH comprises two components. First, it retrieves few-shot examples from a training bank using Target Similarity Tuning (TST), a novel method for semantic example selection. TST learns to recognize utterances that describe similar target programs despite differences in surface natural language features. Then, SYNCHROMESH feeds the examples to a pre-trained language model and samples programs using Constrained Semantic Decoding (CSD): a general framework for constraining the output to a set of valid programs in the target language. CSD leverages constraints on partial outputs to sample complete correct programs, and needs neither re-training nor fine-tuning of the language model. We evaluate our methods by synthesizing code from natural language descriptions using GPT-3 and Codex in three real-world languages: SQL queries, Vega-Lite visualizations and SMCalFlow programs. These domains showcase rich constraints that CSD is able to enforce, including syntax, scope, typing rules, and contextual logic. We observe substantial complementary gains from CSD and TST in prediction accuracy and in effectively preventing run-time errors.
|
| 12 |
+
|
| 13 |
+
# 1 INTRODUCTION
|
| 14 |
+
|
| 15 |
+
Large language models (LLMs) trained on massive corpora of unsupervised data have been shown to perform a wide range of tasks, including natural language generation, semantic parsing and sentiment analysis (Brown et al., 2020; Devlin et al., 2019; Raffel et al., 2020). This can be achieved without task-specific training, but rather by adapting the model to each task at test-time using textual prompts, which can contain examples and natural language descriptions. In many cases, this methodology was shown to provide good performance, reducing the need to annotate large datasets for each task of interest (Brown et al., 2020; Shin et al., 2021).
|
| 16 |
+
|
| 17 |
+
An important application of LLMs is in synthesizing programs from natural language descriptions (Austin et al., 2021; Chen et al., 2021). But this task is still challenging for LLMs. First, they can commit conceptual errors, generating code that misses the intent behind the given description. For example, when asked to reverse an array, the model might generate code that simply swaps the first and last elements. Indeed, users of current natural language-to-code systems report that models often produce code that is unrelated to their query (Xu et al., 2021).
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: Overview of the SYNCHROMESH framework. Given the user’s query, high-relevance examples are first retrieved with Target Similarity Tuning (TST). Then, a program is incrementally sampled via Constrained Semantic Decoding (CSD), which queries a completion engine (CE) to enforce constraints during code generation without re-training or fine-tuning the language model.
|
| 21 |
+
|
| 22 |
+
Even when they capture the right intent, LLMs can still make implementation errors: the generated code can fail to execute. For reversing an array, a model might generate a loop with the correct structure but with an off-by-one error, causing a runtime exception. These errors are common even with very large models. For example, Austin et al. (2021) tested models with up to 137B parameters on generating short Python programs from natural language. Still, $47 \%$ of the failures were due to syntax, typing or run-time errors (as opposed to running but producing incorrect output). This is in line with theoretical results in Merrill et al. (2021) showing that programming language semantics cannot be fully inferred from ungrounded data. Together, both observations suggest that simply scaling up LLMs might be ineffective to obtain reliable performance, especially for longer programs.
|
| 23 |
+
|
| 24 |
+
In this paper, we address both conceptual and implementation errors with SYNCHROMESH, a framework for reliable code generation from pre-trained models. Since LLMs are highly sensitive to which few-shot examples are given in their prompt, we propose Target Similarity Tuning (TST): a method for dynamically selecting semantically relevant examples for a given description. TST mitigates conceptual errors by learning to select examples with similar intent, even when their natural language descriptions seem unrelated in form. Given relevant examples, we then generate programs with Constrained Semantic Decoding (CSD), a novel method for enforcing rich syntactic and semantic constraints during code generation on top of a frozen language model. Rich language-specific constraints, ranging from syntax validity to scoping and type-checking, can be implemented under the simple abstraction of completion engines $( C E )$ . CSD aligns these constraints with the language model’s token vocabulary by leveraging Brzozowski language derivatives (Brzozowski, 1964). This guarantees that all sampled programs satisfies the implemented constraints, preventing whole classes of implementation errors by construction. The pipeline is illustrated in Figure 1.
|
| 25 |
+
|
| 26 |
+
We demonstrate the generality of SYNCHROMESH in three real-world languages: SQL (database queries), Vega-Lite (data visualization) and SMCalFlow (calendar applications). In experiments with GPT-3 and Codex, we observe that SYNCHROMESH can eliminate whole classes of errors that make outputs from unconstrained models either fail to execute or produce trivial results (e.g., empty charts). Furthermore, eliminating invalid programs consistently improves prediction accuracy. In summary, we make the following contributions:
|
| 27 |
+
|
| 28 |
+
• We propose Target Similarity Tuning for selecting few-shot examples based on the similarity of the programs they describe, improving relevance and downstream performance. • We introduce completion engines as an abstraction that can implement rich classes of semantic program constraints, as we demonstrate in SQL, Vega-Lite and SMCalFlow. • We introduce a general, constraint-observing decoding algorithm, which aligns programming language constraints with the language model’s token vocabulary. • We evaluate our method in three natural language-to-code tasks. CSD and TST both show strong complementary gains in output validity and prediction accuracy across domains.
|
| 29 |
+
|
| 30 |
+
# 2 TARGET SIMILARITY TUNING
|
| 31 |
+
|
| 32 |
+
In this section, we first overview the challenge posed by conceptual errors in programs synthesized by LLMs. We then introduce TST, which improves performance through more relevant example selection. Throughout, we will use a real example of synthesizing a SQL database query to answer a question posed in natural language.
|
| 33 |
+
|
| 34 |
+

|
| 35 |
+
Figure 2: Example of Target Similarity Tuning improving example selection for synthesizing a SQL query. In (a), the prompt example missed the key query structure (grouping and counting). With this example, GPT-3 generates an invalid query (b). With TST, we retrieve a relevant example which GPT-3 successfully adapts to answer the user’s question (c).
|
| 36 |
+
|
| 37 |
+
Suppose a data analyst has a relational database of airports and wants to answer the following question: “Which city has the highest number of airports?” One procedure for turning this description into a SQL query is to use an LLM such as GPT-3 (Brown et al., 2020) or Codex (Chen et al., 2021). To prompt the model for the task at hand, we would feed it with a natural language description of the task and a selection of input-output examples.
|
| 38 |
+
|
| 39 |
+
Given the analyst’s question, how do we select the most relevant examples from a training pool? Liu et al. (2021a) proposed to retrieve examples with similar natural language descriptions using a pre-trained paraphrase detection model. Figure 2a shows the most similar example from the Spider natural language-to-SQL dataset (Yu et al., 2018) according to Sentence-BERT (Reimers & Gurevych, 2019). The query “Which city has the highest elevation?” is similar on a surface level: it also asks “Which city has the highest ?”. This training query asks about “elevation”, a property that is readily available as a column in the Airports table. Figure 2b shows GPT-3’s output when given this and a few other examples. The model attempts to mimic the top example, referring to a nonexistent column “NumberOfAirports”. The issue is that we picked the example in the prompt based on description similarity and not SQL query similarity. In fact, the SQL query in the chosen example had a simplistic structure that was significantly different from the structure of the desired SQL query, and this contributed to the failure at Point (b) in Figure 2.
|
| 40 |
+
|
| 41 |
+
We want to retrieve examples that have relevant program structures for the test query. We do so using our fine-tuning scheme called Target Similarity Tuning (TST). Formally, suppose $\mathcal { D }$ is a dataset of programs and associated utterances, with $\mathcal { D } _ { i } = ( p _ { i } , u _ { i } )$ . Let $S ( p _ { a } , p _ { b } ) \bar { \in } [ 0 , \bar { 1 } ]$ denote a normalized similarity metric between programs. If $f _ { \theta }$ is a pre-trained similarity model for natural language sentences, TST consists in fine-tuning $f$ to predict the similarity between target programs given by $S$ from their descriptions. Precisely, we minimize the mean-squared error loss:
|
| 42 |
+
|
| 43 |
+
$$
|
| 44 |
+
\mathcal { L } _ { T S T } ( \theta ) : = \mathbb { E } _ { i , j \sim \mathcal { D } } \left[ f _ { \theta } ( u _ { i } , u _ { j } ) - S ( p _ { i } , p _ { j } ) \right] ^ { 2 } \ .
|
| 45 |
+
$$
|
| 46 |
+
|
| 47 |
+
We define $S$ using the classical tree edit distance algorithm from Zhang & Shasha (1989) to compare Abstract Syntax Trees (ASTs). Figure $2 \mathrm { c }$ shows GPT-3’s output when given examples selected with TST. Now, the output query is correct: it performs a “group by” on the “City” column, and sorts by the count of records in each group. This structure was already present in the top example selected by TST, corresponding to “Return the team with the most technicians”. Even if the analyst’s question and this utterance are drastically different in natural language, they share similarity in the SQL query that they describe. The TST objective is able to properly capture this fact. As our experiments show in Section 4, TST significantly boosts the performance of both GPT-3 and Codex.
|
| 48 |
+
|
| 49 |
+
# 3 CONSTRAINED SEMANTIC DECODING
|
| 50 |
+
|
| 51 |
+
We now present Constrained Semantic Decoding (CSD) as an approach to eliminate implementation errors from code generated by LLMs. We first illustrate CSD with an example, and then formalize it using the abstraction of CEs.
|
| 52 |
+
|
| 53 |
+

|
| 54 |
+
Figure 3: Example on CSD generating a SQL query. Given the prompt, GPT-3 makes a mistake (a) when generating the JOIN condition. CSD is able to prevent this error by (b) keeping track of table aliases and constraining the model to respect the database schema.
|
| 55 |
+
|
| 56 |
+
The example in Figure 2 showed that TST can help LLMs generate the correct program. In general, however, TST only helps LLMs by guiding toward the correct structure, but the model still needs to fill all the specific implementation details correctly. Figure 3 shows a case where the model cannot simply adapt one example from the prompt. Here, the user’s query is “Which city has the highest number of departing flights?” This query is similar to the previous one – in fact, TST retrieves the same top-1 example as before. But now the correct SQL query needs to join the “Airports” and “Flights” tables. GPT-3 generates the join condition Flights.AirportCode $=$ Airports.SourceAirport, but this condition has a subtle error: the column names of the two tables are swapped. Thus, this query fails to execute. In general, unconstrained language models often make such implementation errors: using undeclared variables, losing track of nesting levels when producing complex expressions, or calling functions using arguments of the wrong type. Even the smallest of such errors prevents generated code from executing.
|
| 57 |
+
|
| 58 |
+
CSD prevents implementation errors by construction (as opposed to repairing after-the-fact). Imagine we have access to an oracle, which we call a $C E$ , that can take a partial program and return all tokens that can extend that partial program toward a complete correct program. When the LLM is generating the program token by token, CSD ensures that the next token is sampled from the set returned by the CE.
|
| 59 |
+
|
| 60 |
+
In Figure 3, after generating “T1.” inside the “on” clause, our SQL CE resolves the alias and constrains the model to output one of the columns from the “Flights” table. This fixes the error seen previously during generation and produces the correct SQL query.
|
| 61 |
+
|
| 62 |
+
# 3.1 COMPLETION ENGINES
|
| 63 |
+
|
| 64 |
+
We now formally define CEs. Let $\Sigma$ be a base alphabet, and $\Sigma _ { L } \subseteq \Sigma ^ { * }$ be the (potentially infinite) set of tokens of the target language. Our goal is to sample programs from a language $L \subseteq \Sigma _ { L } ^ { * } -$ the set of valid programs. A CE $C _ { L }$ is a partial function from $\Sigma _ { L } ^ { * }$ to a set of tokens. We use a regular expression over $\Sigma$ to represent a set of tokens. The strings in the domain of $C _ { L }$ are called completion points, and a CE satisfies the following axioms: (A1) The empty string and every $p \in L$ must be completion points. For every $p \in L$ , $\bar { C _ { L } } ( p ) = r ^ { \prime } \ S ^ { \prime }$ , where $r ^ { \prime } \bar { \mathfrak { F ^ { \prime } } }$ is the regular expression that matches the stop token. (A2) If $s \in \Sigma _ { L } ^ { * }$ is a completion point and $t$ fully matches $C _ { L } ( s )$ , then their concatenation $^ { s t }$ must also be a completion point. (A3) The CE is exhaustive; that is, if $s$ is a completion point and $s = t t _ { 0 }$ , where $t _ { 0 }$ is a token, then $t$ should be a completion point and $C _ { L } ( t )$ should match $t _ { 0 }$ . Furthermore, we assume that CEs are only called after maximal matches. For example, if a partial program ends in an identifier, the CE can assume that the identifier is complete.
|
| 65 |
+
|
| 66 |
+
Our CEs are implemented in two layers: a context-free layer, which enforces syntactic validity, and a context-sensitive layer, which encodes semantic constraints that depend on language semantics and the user’s context (e.g., the database). Below, we describe an automatic method for constructing context-free CEs directly from the target language’s grammar. The context-sensitive layer of an engine is specific to the target language. Table 1 provides an overview of several constraints implemented by our CEs for SQL, Vega-Lite and SMCalFlow, three rich languages with different syntactic and semantic structures. A detailed description of the three CEs can be found in Appendix C.
|
| 67 |
+
|
| 68 |
+
Table 1: Examples of constraints implemented in our CEs for SQL, Vega-Lite and SMCalFlow. Given a partial program, CEs return a regular expression that matches the valid tokens that can follow. Here, we show positive and negative token examples for each such regular expression. This abstraction allows domain experts to encode a wide range of expressive code generation constraints.
|
| 69 |
+
|
| 70 |
+
<table><tr><td>Language</td><td>Constraint</td><td>Example of partial program</td><td>Valid/Invalid Examples</td></tr><tr><td>SQL</td><td>A valid identifier must follow after AS.</td><td>SELECT Name, Role FROM User AS^</td><td>U √ T1 √ 2×</td></tr><tr><td></td><td>Column names must come from schema,even behind aliases.</td><td>SELECT U.Name FROM User AS U WHERE U. ^</td><td>Name√ DoB√ Birthday X</td></tr><tr><td>Vega-Lite</td><td>Data fields must be used with compatible types. Do not facet on field with too many distinct values (breaks</td><td>{"x": {"field": "Category", "type":^ {"column":{"field": ^</td><td>"nominal" "temporal" X "Category" "ZipCode" </td></tr><tr><td>SMCalFlow</td><td>rendering). Type-check parameters of all</td><td>(Yield</td><td>Takeout√</td></tr><tr><td></td><td>API functions. Track declared variables and</td><td>(PlaceHasFeature(> (let (x 85)</td><td>IsWindy X List.Apply X x√</td></tr></table>
|
| 71 |
+
|
| 72 |
+
Deriving completions from grammars Computer language parsers are often automatically generated from a grammar. The grammar contains enough information to derive the context-free layer of CEs. To facilitate this process, we created a library that extends any parser generated by ANTLR (Parr & Fisher, 2011), a popular $\operatorname { L L } ( ^ { * } )$ top-down parser generator, to provide token-level completions. Namely, we (i) let the ANTLR-generated parser process the given program prefix $p$ , (ii) retrieve its state in the Augmented Transition Network (ATN) at the last program token, (iii) traverse the ATN from that state to enumerate all possible next token productions. This process yields (a) a list of productions and token types $\{ \tau _ { j } \} _ { j = 1 } ^ { K }$ that are allowed to follow $p$ and $\mathbf { ( b ) }$ a partial AST $T _ { p }$ . Each CE takes $\{ \tau _ { j } \}$ and $T _ { p }$ as input to generate semantic context-sensitive constraints.
|
| 73 |
+
|
| 74 |
+
# 3.2 FROM COMPLETION ENGINES TO A DECISION PROCEDURE
|
| 75 |
+
|
| 76 |
+
We use CEs to guide sampling from an LLM. A key component of our algorithm for constrained sampling is a decision procedure for membership in prefix-closure of the set $L$ of all valid programs. The prefix-closure $L ^ { c }$ of a language $L$ contains all programs in $L$ as well as all of their prefixes. Intuitively, $L ^ { c }$ contains all partial programs that can be completed to a valid program. Given a CE $C _ { L }$ , our first goal is to build a decision procedure for $L ^ { c }$ : given a string $s$ , does it belong to $L ^ { c } ?$
|
| 77 |
+
|
| 78 |
+
We answer if $s \in L ^ { c }$ by repeatedly calling $C _ { L }$ on certain prefixes $p$ of $s$ and matching the regular expression $C _ { L } ( \boldsymbol { p } )$ with suffixes of $s$ . We start with $p$ being the empty string. We find the maximal prefix of $s$ that matches the regular expression $C _ { L } ( \boldsymbol { p } )$ and remove it from $s$ and add it to $p$ , and repeat until the match fails. There are two cases: either $s$ is empty now, which means the input string was a completion point and hence it is in $L ^ { c }$ , or $s$ now is the remainder left after removing the largest prefix that was a completion point. For the second case, we must check: does there exist a completion string $c$ such that $s c$ fully matches the regular expression $C _ { L } ( \boldsymbol { p } )$ ?
|
| 79 |
+
|
| 80 |
+
This question can be efficiently answered by Brzozowski derivatives (Brzozowski, 1964). Formally, the derivative of a formal language $S$ with respect to a string $u$ is another formal language $u ^ { - 1 } S \stackrel { . } { = }$ $\{ v : u v \in S \}$ . In other words, it is precisely the set of strings that can complete $u$ to some string in $S$ . If $u ^ { - 1 } S \stackrel { . } { = } \varnothing$ , then no string in $S$ starts with $u$ . Brzozowski derivatives are efficient to compute for our regular languages (or regular expressions defining them) – we describe a simple linear-time algorithm in the Appendix. Given the derivative of $C _ { L } ( \boldsymbol { p } )$ , answering whether $s$ can be completed to belong to $C _ { L } ( \boldsymbol { p } )$ reduces to performing a simple regular expression match. This operation answers the case when the remainder is non-empty and completes our decision procedure for $L ^ { c }$ .
|
| 81 |
+
|
| 82 |
+
# 3.3 THE CONSTRAINED SEMANTIC DECODING ALGORITHM
|
| 83 |
+
|
| 84 |
+
Using the decision procedure for $L ^ { c }$ , we can now describe the Constrained Semantic Decoding algorithm. Suppose $s \in L ^ { c }$ is the language model’s output so far (we start with $\epsilon$ ). If $\Sigma _ { M }$ is the model’s vocabulary, we can compute the set of valid next tokens $V _ { M } ( s ) = \{ t \in \Sigma _ { M } : s t \in L ^ { c } \}$ by using our decision procedure for each token in the vocabulary $\Sigma _ { M }$ . In other words, we maintain the invariant that the model’s current partial output $s$ is in $L ^ { c }$ , and make progress by using the model to sample from $V _ { M } ( s )$ , instead of the unconstrained $\Sigma _ { M }$ . Once we have a complete program, we are guaranteed that it will satisfy all constraints enforced by the CE.
|
| 85 |
+
|
| 86 |
+
One subtlety to note is that language models and programming languages have drastically different tokenizations; i.e., $C _ { L }$ and LLM work with different tokens. For instance, a long string literal is a single SQL token, but might span multiple tokens for the language model. Similarly, a single token from the language model’s vocabulary might close multiple parentheses at once. In general, token boundaries between the two can be arbitrarily misaligned. Each decision of whether $^ { s t }$ belongs to $L ^ { c }$ can potentially cross multiple completion points, or might not even finish a maximal match to the previous completion point (see the Appendix for an example prediction in Vega-Lite where this happens multiple times). Nevertheless, our CSD algorithm described here naturally handles this alignment problem. Hence, in SYNCHROMESH, CEs do not need to be aware of this issue – they can be fully implemented in terms of the target language’s tokens.1
|
| 87 |
+
|
| 88 |
+
Our implementation applies substantial optimizations that leverage the structure of Byte-Pair Encoding vocabularies (namely, that many tokens are prefixes of longer tokens) and reuse computation. We detail these optimizations in Appendix E. In our experiments with GPT-3, CSD adds an average of $8 \%$ overhead to the sampling procedure – a relatively small impact to trade for output correctness.
|
| 89 |
+
|
| 90 |
+
# 4 EXPERIMENTS
|
| 91 |
+
|
| 92 |
+
We evaluate SYNCHROMESH in three tasks of synthesizing code from natural language descriptions. For SQL, we use the Spider dataset (Yu et al., 2018). For Vega-Lite, we use the NLV Corpus (Srinivasan et al., 2021). For SMCalFlow, we use the dataset that introduced the language (Andreas et al., 2020). In NLV, which has visualizations over 3 different datasets, we alternate using each dataset as a test-set by only using training examples from the other two datasets. In Spider and SMCalFlow, we use the training/validation set split given in each dataset.
|
| 93 |
+
|
| 94 |
+
Example selection model To select examples, we use Sentence-BERT (Reimers & Gurevych, 2019) to fetch the 5 closest examples by cosine similarity. When using TST, we fine-tuned the model with the TST objective in both the Spider and SMCalFlow training sets. The NLV corpus is smaller and does not provide a clear train-test split to fairly evaluate TST. Holding out one dataset and fine-tuning on the remaining two yields SYNCHROMESH accuracies of over $90 \%$ . However, we attribute that performance to the fact that NLV has only 10 distinct visualizations and the same participants labeled all three datasets. For that reason, we omit Vega-Lite from the TST experiments.
|
| 95 |
+
|
| 96 |
+
Language models We used the two largest models from the GPT-3 family (Brown et al., 2020, with 13B and 175B parameters), as well as the largest Codex model (Chen et al., 2021). Codex shares the same architecture with 175B GPT-3, but its training set contained a larger portion of source code in a variety of languages. Our only access to the models was through the public OpenAI HTTP API, which allowed us to apply constraints by adding a bias to logits. We describe the necessary adaptations of CSD to this setting in Appendix F.
|
| 97 |
+
|
| 98 |
+
Metrics For Vega-Lite and SMCalFlow, we report the exact-match accuracy between predictions and ground-truth (field order is disregarded in Vega-Lite). In SQL, we instead measure execution accuracy, comparing query results instead. For a more fine-grained signal, we additionally measure the edit distance between the predicted and ground-truth ASTs using the normalized tree edit distance (Zhang & Shasha, 1989).
|
| 99 |
+
|
| 100 |
+
Table 2: Results of each language model on all domains with and without CSD and TST. For SQL, we run the resulting query and report Execution Match accuracy (Exec.). For Vega-Lite and SMCalFlow, we instead report Exact Match accuracy (Acc.). Edit Distance (Dist.) measures average relative edit distance between the prediction and the ground truth. We also report the fraction of Valid model outputs (those that parse, type-check and execute). For context only, we show recent results from supervised models (trained on the datasets we use) marked with (S).
|
| 101 |
+
|
| 102 |
+
<table><tr><td rowspan="2">Model</td><td rowspan="2">Exec.</td><td colspan="3">SQL</td><td colspan="2">Vega-Lite</td><td colspan="3">SMCalFlow</td></tr><tr><td>Valid</td><td>Dist.</td><td>Acc.</td><td>Valid</td><td>Dist.</td><td>Acc.</td><td>Valid</td><td>Dist.</td></tr><tr><td>Andreas et al. (2020)</td><td></td><td>=</td><td></td><td></td><td>=</td><td>=</td><td>72%(s)</td><td>=</td><td></td></tr><tr><td>Srinivasan et al. (2021)</td><td>=</td><td>=</td><td>=</td><td>64%(s)</td><td>=</td><td>=</td><td>=</td><td>=</td><td>=</td></tr><tr><td>Rubin & Berant (2021)</td><td>71%(s)</td><td>-</td><td>=</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Scholak et al. (2021)</td><td>79%(s)</td><td>98%</td><td>1</td><td></td><td>1</td><td>=</td><td></td><td></td><td></td></tr><tr><td>GPT-3 13B</td><td>16%</td><td>43%</td><td>0.42</td><td>14%</td><td>55%</td><td>0.51</td><td>38%</td><td>76%</td><td>0.43</td></tr><tr><td>”+ CSD</td><td>20%</td><td>66%</td><td>0.44</td><td>17%</td><td>100%</td><td>0.48</td><td>40%</td><td>95%</td><td>0.40</td></tr><tr><td>"+TST</td><td>14%</td><td>48%</td><td>0.42</td><td>1</td><td>-</td><td>-</td><td>60%</td><td>88%</td><td>0.22</td></tr><tr><td>”+ CSD + TST</td><td>19%</td><td>72%</td><td>0.43</td><td>-</td><td>-</td><td>-</td><td>63%</td><td>98%</td><td>0.17</td></tr><tr><td>GPT-3175B</td><td>28%</td><td>49%</td><td>0.36</td><td>20%</td><td>67%</td><td>0.36</td><td>44%</td><td>77%</td><td>0.41</td></tr><tr><td>”+ CSD</td><td>35%</td><td>73%</td><td>0.36</td><td>25%</td><td>100%</td><td>0.32</td><td>45%</td><td>97%</td><td>0.37</td></tr><tr><td>”+ TST</td><td>31%</td><td>56%</td><td>0.35</td><td>1</td><td>-</td><td>-</td><td>60%</td><td>88%</td><td>0.24</td></tr><tr><td>"+ CSD + TST</td><td>37%</td><td>76%</td><td>0.34</td><td>-</td><td>-</td><td>-</td><td>66%</td><td>97%</td><td>0.18</td></tr><tr><td>Codex 175B</td><td>56%</td><td>73%</td><td>0.25</td><td>39%</td><td>87%</td><td>0.24</td><td>45%</td><td>79%</td><td>0.37</td></tr><tr><td>”+ CSD</td><td>61%</td><td>85%</td><td>0.23</td><td>40%</td><td>99%</td><td>0.23</td><td>46%</td><td>97%</td><td>0.33</td></tr><tr><td>”+TST</td><td>60%</td><td>81%</td><td>0.23</td><td>1</td><td>1</td><td>-</td><td>63%</td><td>90%</td><td>0.21</td></tr><tr><td>"+ CSD + TST</td><td>64%</td><td>85%</td><td>0.23</td><td>-</td><td>1</td><td>-</td><td>63%</td><td>99%</td><td>0.19</td></tr></table>
|
| 103 |
+
|
| 104 |
+
# 4.1 RESULTS
|
| 105 |
+
|
| 106 |
+
Table 2 and Figure 4 summarize our main results evaluating SYNCHROMESH. Key observations are:
|
| 107 |
+
|
| 108 |
+
SYNCHROMESH improves reliability on top of all pre-trained LLMs. First, it improves top-1 accuracy (exact or execution-measured) over any pre-trained LLM in all domains. SMCalFlow benefits the most, likely because this domain-specific language is absent in the LLM pre-training corpus. For SQL and SMCalFlow, the absolute gain is almost the same for equally-sized GPT-3 and Codex.
|
| 109 |
+
|
| 110 |
+
Second, SYNCHROMESH dramatically improves validity. In SQL, it eliminates execution errors from $2 9 \%$ of the queries generated by GPT-3 13B (as validity improves from $43 \%$ to $72 \%$ ). Even Codex benefits, with $12 \%$ more queries executing successfully after SYNCHROMESH augmentation. In Vega-Lite and SMCalFlow, SYNCHROMESH improves reliability even more substantially. GPT-3 13B only produces valid charts for $55 \%$ of the queries in NLV; all errors are eliminated with SYNCHROMESH. This is nearly paralleled in SMCalFlow, in which all models produce well-typed programs $9 7 \%$ of the time or more with SYNCHROMESH.
|
| 111 |
+
|
| 112 |
+
SYNCHROMESH brings the output closer to ground truth. Error prevention alone is trivial (e.g., with a constant error-free prediction), but not while simultaneously improving accuracy or edit distance to the ground-truth, as SYNCHROMESH does. Again, we observe improvements in all domains and the most in SMCalFlow. For GPT-3 175B, the average edit distance is reduced from 0.41 to 0.18.
|
| 113 |
+
|
| 114 |
+
TST and CSD bring complementary benefits. Our ablation studies reported in Table 2 show that their combination performs better than either one separately. TST helps LLMs generate programs in the “vicinity” of the correct one, and CSD helps by “guiding” the models toward the correct one.
|
| 115 |
+
|
| 116 |
+
SYNCHROMESH adds more value for longer programs. Program synthesis is hardest when the target program is complex. Does SYNCHROMESH improve synthesis of longer programs, or are its benefits coming from fixes to small programs? Figure 4(a) shows accuracies and (b) validity for SMCalFlow broken down by the length of the ground truth program (we show results for SQL in the Appendix). Here, program lengths are shown as their percentile. With SYNCHROMESH, we see that accuracy decays at a slower pace, and validity remains high throughout, when compared to Codex alone. This indicates that SYNCHROMESH improves the ability of base models to generate longer programs.
|
| 117 |
+
|
| 118 |
+

|
| 119 |
+
Figure 4: (a) Accuracy and (b) validity of Codex predictions with and without SYNCHROMESH on SMCalFlow as a function of the ground-truth program length. We map program lengths to percentiles, and round to the closest multiple of $10 \%$ . Error bands correspond to standard error. (c) Evaluation of the “generate-then-test” approach with Codex, showing the probability of at least one prediction being a valid program (Valid $( \varpi \mathrm { K } )$ ) for up to 5 samples.
|
| 120 |
+
|
| 121 |
+

|
| 122 |
+
Figure 5: Illustration of implementation and conceptual errors in Vega-Lite. CSD can avoid generating the invalid Vega-Lite mark type “scatterplot”, though conceptual errors can still remain.
|
| 123 |
+
|
| 124 |
+
LLMs augmented with SYNCHROMESH approach but underperform supervised models. For context, we include state-of-the-art results at the time of writing for each task in Table 2. We note that these methods fine-tune or train the underlying language-to-code model on each task, thus are not directly comparable to LLMs with SYNCHROMESH. That said, we observe that base LLMs—even Codex— substantially underperform supervised models ( $19 \%$ worse for SQL; $27 \%$ worse for SMCalFlow), and SYNCHROMESH helps narrow that gap (now $11 \%$ worse for SQL; $9 \%$ worse for SMCalFlow).
|
| 125 |
+
|
| 126 |
+
SYNCHROMESH outperforms “generate-then-test”. CSD enforces program constraints during generation. Instead, prior work has leveraged a “generate-then-test” approach: take multiple samples and filter out those that produce errors or violate constraints (Chen et al., 2021). Figure 4(b) evaluates this approach with Codex, the highest performing base LLM. We sample from Codex with a temperature $\tau = 0 . 7$ to obtain diverse but high-quality samples. We then compute the “Valid $@ \mathrm { K } '$ metric by using the “Pass $@ \mathrm { K } '$ estimator from Chen et al. (2021) to calculate the probability of at least one valid sample among $K$ , with $K \leq 5$ . In SQL, Codex needs 3 samples to match SYNCHROMESH (Va $\mathrm { l i d } @ \mathrm { K } = 8 5 \%$ ). In SMCalFlow and Vega-Lite, SYNCHROMESH is able to virtually eliminate errors with 1 sample, while “Valid $@ 5 '$ for Codex is still below $93 \%$ . This provides evidence that even the best LLMs benefit from incremental validation, especially in less popular languages.
|
| 127 |
+
|
| 128 |
+
# 4.2 DISCUSSION
|
| 129 |
+
|
| 130 |
+
In our experiments, SYNCHROMESH was able to improve accuracies and program validity across all languages due to better examples to use as a reference (TST) and preventing errors during generation (CSD). Yet, this approach has an important limitation. While TST can reduce conceptual errors, and CSD can guarantee that certain implementation errors never occur (e.g., type errors in SMCalFlow, or undefined column references in Vega-Lite or SQL), TST cannot guarantee elimination of conceptual errors. When those occur, CSD is usually insufficient to correct the prediction. Figure 5 shows an example in Vega-Lite from the “Cars” dataset in NLV. Here, the user asks for one scatter plot for each origin, indicating faceting (multiple charts). GPT-3 alone produces an invalid Vega-Lite chart type, “scatterplot”. CSD can eliminate this error, guiding GPT-3 to generate “point” instead. However, a conceptual error remains: instead of faceting, the model colors points by their origin. Codex produces the correct Vega-Lite mark type, but still makes the same conceptual mistake.
|
| 131 |
+
|
| 132 |
+
Nonetheless, we argue that improving validity is especially important for user-facing applications. Users of language-to-code systems might need to rephrase their request or to edit the system’s output. But outputs that fail to even execute undermine user experience: fixing an automatically generated program can be more cumbersome than writing it in the first place. In LLM-driven systems like Github Copilot, implementation errors can remain unnoticed and introduce bugs or vulnerabilities.
|
| 133 |
+
|
| 134 |
+
# 5 RELATED WORK
|
| 135 |
+
|
| 136 |
+
Program synthesis is a long-standing AI challenge with the goal of generating computer programs from higher-level specification (Gulwani et al., 2017). In particular, synthesis from natural language descriptions has gained recent attention (Liu et al., 2016; Yaghmazadeh et al., 2017), thanks to advances in natural language processing models such as Transformers (Vaswani et al., 2017). Typically, LLMs such as GPT-3 (Brown et al., 2020) and Codex (Chen et al., 2021) output an unconstrained sequence of tokens, and still often make conceptual or implementation errors in generated programs (Austin et al., 2021). Specialized training, e.g. to output an AST (Wang et al., 2020; Yin & Neubig, 2017), can mitigate syntactic errors, but still does not guarantee accuracy or conformance to domain-specific semantic constraints. Moreover, it requires a specialized architecture and a decoding procedure for each target language. Instead, SYNCHROMESH applies such constraints at inference, neither using specialized architectures nor fine-tuning the LLM.
|
| 137 |
+
|
| 138 |
+
The general idea of constraining LLMs when generating programs has been explored in recent work. Shin et al. (2021) applied syntactic constraints for semantic parsing. However, their method requires enumerating all valid programs for determining valid next tokens for the LLM, and does not enforce semantic constraints. In concurrent work, Scholak et al. (2021) applied similar semantic constraints to synthesizing SQL queries. The authors substantially improve the performance of an already finetuned model by leveraging an incremental parser. We see CSD as a generalization of these efforts, as our completion engines can apply context-sensitive constraints by dynamically constructing regular expressions. Aligning these constraints with the underlying model vocabulary does not require finetuning: SYNCHROMESH only trains the much smaller target similarity model (Section 2).
|
| 139 |
+
|
| 140 |
+
Since the emergence of LLMs, researchers have developed numerous techniques to adapt them to new domains (Liu et al., 2021b). Many focus on prompting, i.e. generating a domain- and instancespecific input to an LLM to increase the likelihood of correctness. In few-shot prompt augmentation, Gao et al. (2020) use pre-trained sentence embeddings to select the closest prompt examples to the given input instance. Liu et al. (2021a) further fine-tune sentence embeddings on the available training set of input utterances. TST in SYNCHROMESH takes this approach a step further, and finetunes the embedding models based on output similarity. It optimizes the amount of relevant output bits in the prompt, thereby reinforcing the necessary hints for the LLM.
|
| 141 |
+
|
| 142 |
+
# 6 CONCLUSION
|
| 143 |
+
|
| 144 |
+
SYNCHROMESH augments program synthesis with pre-trained LLMs to prevent conceptual and implementation errors during generation. We designed SYNCHROMESH to be easily usable with minimal NLP or LLM knowledge expected from a domain expert. As such, it (a) automatically generates the completion engine API from the language grammar, (b) does not require fine-tuning the LLM, drastically reducing the data/compute budget, and (c) integrates into the decoding loop or inference API with minimal overhead. Our method significantly improves performance of both GPT-3 and Codex in three languages, both by boosting accuracy and consistently improving output validity.
|
| 145 |
+
|
| 146 |
+
While real-world and well-established, the domains we study are still not Turing-complete. We envision extending SYNCHROMESH to a Turing-complete language like Python can vastly increase reliability of LLM-based systems like Github Copilot. This requires further extension of CSD to integrate with the parser/interpreter of the target language, and to study applicable classes of constraints. The TST technique, however, can be used in any LLM-based language-to-code system.
|
| 147 |
+
|
| 148 |
+
# REFERENCES
|
| 149 |
+
|
| 150 |
+
Jacob Andreas, John Bufe, David Burkett, Charles Chen, Josh Clausman, Jean Crawford, Kate Crim, Jordan DeLoach, Leah Dorner, Jason Eisner, et al. Task-oriented dialogue as dataflow synthesis. Transactions of the Association for Computational Linguistics, 8:556–571, 2020.
|
| 151 |
+
|
| 152 |
+
Jacob Austin, Augustus Odena, Maxwell Nye, Maarten Bosma, Henryk Michalewski, David Dohan, Ellen Jiang, Carrie Cai, Michael Terry, Quoc Le, and Charles Sutton. Program synthesis with large language models, 2021.
|
| 153 |
+
|
| 154 |
+
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.
|
| 155 |
+
|
| 156 |
+
Janusz A Brzozowski. Derivatives of regular expressions. Journal of the ACM (JACM), 11(4): 481–494, 1964.
|
| 157 |
+
|
| 158 |
+
Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde, Jared Kaplan, Harri Edwards, Yura Burda, Nicholas Joseph, Greg Brockman, et al. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374, 2021.
|
| 159 |
+
|
| 160 |
+
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, 2019.
|
| 161 |
+
|
| 162 |
+
Tianyu Gao, Adam Fisch, and Danqi Chen. Making pre-trained language models better few-shot learners. arXiv preprint arXiv:2012.15723, 2020.
|
| 163 |
+
|
| 164 |
+
Sumit Gulwani, Oleksandr Polozov, Rishabh Singh, et al. Program synthesis. Foundations and Trends® in Programming Languages, 4(1-2):1–119, 2017.
|
| 165 |
+
|
| 166 |
+
John Jewkes, David Sawers, and Richard Stillerman. Automatic Transmissions, pp. 231– 233. Palgrave Macmillan UK, London, 1969. ISBN 978-1-349-00015-9. doi: 10.1007/ 978-1-349-00015-9 11.
|
| 167 |
+
|
| 168 |
+
Chang Liu, Xinyun Chen, Eui Chul Shin, Mingcheng Chen, and Dawn Song. Latent attention for if-then program synthesis. Advances in Neural Information Processing Systems, 29:4574–4582, 2016.
|
| 169 |
+
|
| 170 |
+
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, 2021a.
|
| 171 |
+
|
| 172 |
+
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, 2021b.
|
| 173 |
+
|
| 174 |
+
William Merrill, Yoav Goldberg, Roy Schwartz, and Noah A. Smith. Provable limitations of acquiring meaning from ungrounded form: What will future language models understand?, 2021.
|
| 175 |
+
|
| 176 |
+
Terence Parr and Kathleen Fisher. Ll (\*) the foundation of the antlr parser generator. ACM Sigplan Notices, 46(6):425–436, 2011.
|
| 177 |
+
|
| 178 |
+
Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21:1–67, 2020.
|
| 179 |
+
|
| 180 |
+
Nils Reimers and Iryna Gurevych. Sentence-bert: Sentence embeddings using siamese bertnetworks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing. Association for Computational Linguistics, 11 2019. URL https://arxiv. org/abs/1908.10084.
|
| 181 |
+
|
| 182 |
+
Ohad Rubin and Jonathan Berant. Smbop: Semi-autoregressive bottom-up semantic parsing. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 311–324, 2021.
|
| 183 |
+
|
| 184 |
+
Torsten Scholak, Nathan Schucher, and Dzmitry Bahdanau. Picard: Parsing incrementally for constrained auto-regressive decoding from language models. arXiv preprint arXiv:2109.05093, 2021.
|
| 185 |
+
|
| 186 |
+
Richard Shin, Christopher H Lin, Sam Thomson, Charles Chen, Subhro Roy, Emmanouil Antonios Platanios, Adam Pauls, Dan Klein, Jason Eisner, and Benjamin Van Durme. Constrained language models yield few-shot semantic parsers. arXiv preprint arXiv:2104.08768, 2021.
|
| 187 |
+
|
| 188 |
+
Arjun Srinivasan, Nikhila Nyapathy, Bongshin Lee, Steven M Drucker, and John Stasko. Collecting and characterizing natural language utterances for specifying data visualizations. In Proceedings of the 2021 CHI Conference on Human Factors in Computing Systems, pp. 1–10, 2021.
|
| 189 |
+
|
| 190 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pp. 5998–6008, 2017.
|
| 191 |
+
|
| 192 |
+
Bailin Wang, Richard Shin, Xiaodong Liu, Oleksandr Polozov, and Matthew Richardson. RATSQL: Relation-Aware Schema Encoding and Linking for Text-to-SQL Parsers. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 7567–7578, 2020.
|
| 193 |
+
|
| 194 |
+
Frank F Xu, Bogdan Vasilescu, and Graham Neubig. In-ide code generation from natural language: Promise and challenges. arXiv preprint arXiv:2101.11149, 2021.
|
| 195 |
+
|
| 196 |
+
Navid Yaghmazadeh, Yuepeng Wang, Isil Dillig, and Thomas Dillig. Sqlizer: query synthesis from natural language. Proceedings of the ACM on Programming Languages, 1(OOPSLA):1–26, 2017.
|
| 197 |
+
|
| 198 |
+
Pengcheng Yin and Graham Neubig. A syntactic neural model for general-purpose code generation. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 440–450, 2017.
|
| 199 |
+
|
| 200 |
+
Tao Yu, Rui Zhang, Kai Yang, Michihiro Yasunaga, Dongxu Wang, Zifan Li, James Ma, Irene Li, Qingning Yao, Shanelle Roman, et al. Spider: A large-scale human-labeled dataset for complex and cross-domain semantic parsing and text-to-sql task. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 3911–3921, 2018.
|
| 201 |
+
|
| 202 |
+
# Algorithm 1: $\mathtt { C S D } ( M , \Sigma _ { M } )$
|
| 203 |
+
|
| 204 |
+
Input : A LLM-based token generator, $M$
|
| 205 |
+
Input : Its token set $\Sigma _ { M }$
|
| 206 |
+
Output: String generated by $M$ , constrained by $C _ { L }$
|
| 207 |
+
s ← next token ← ””;
|
| 208 |
+
while next token $\neq " \mathbb { S } "$ do valid tokens $\textstyle \overleftarrow \} \left\{ t \in \Sigma _ { M } \right.$ | ValidPrefix $( s t ) \}$ ; next token Sample( $M ( s )$ , valid tokens); $s \gets s \cdot n$ ext token;
|
| 209 |
+
end
|
| 210 |
+
return $s$ ;
|
| 211 |
+
|
| 212 |
+
# Algorithm 2: ValidPrefix(s)
|
| 213 |
+
|
| 214 |
+
Input : A string s
|
| 215 |
+
Output: True iff $s \in L ^ { c }$
|
| 216 |
+
p ← next prefix ← ””;
|
| 217 |
+
while next prefix $\neq \bot$ do p ← p · next prefix ; s ← next prefix −1 · s; regex ← CL(p); next prefix startswith(s, regex );
|
| 218 |
+
end
|
| 219 |
+
return (s−1 · regex 6= {});
|
| 220 |
+
|
| 221 |
+
# A CONSTRAINED SEMANTIC DECODING ALGORITHM
|
| 222 |
+
|
| 223 |
+
In Section 3.3, we described the Constrained Semantic Decoding algorithm in the text. We provide the same algorithm in pseudo-code in Algorithms 1 and 2 in Figure 6 below. ValidPrefix is our decision procedure for $L ^ { c }$ , while CSD samples a complete program from the model $M$ by making calls to ValidPrefix. We use $s \cdot t$ to denote concatenation of $s$ and $t$ , and $s ^ { - 1 } \cdot t$ to denote the string obtained by removing the prefix $s$ from $t$ . The utility function startswith $( s , r )$ returns the maximal prefix of $s$ that matches the regular expression $r$ , and returns $\perp$ if there is no such match. The function $\mathtt { S a m p l e } ( D i s t , S )$ returns a token from the set $S$ of tokens sampled from the distribution Dist restricted to $S$ . The CSD procedure uses the model $M$ on the partial program to generate a distribution on the next token, but constrains it to belong to the set of valid tokens determined by the completion engine $C _ { L }$ .
|
| 224 |
+
|
| 225 |
+
# B COMPUTING BRZOZOWSKI DERIVATIVES
|
| 226 |
+
|
| 227 |
+
Regular expression derivatives can be expensive to compute in general. The main challenge is that Klenee stars fork the decision procedure: the algorithm must decide to repeat or skip the pattern inside a star. However, in this work, all our regular expressions come from grammars of programming languages. These languages have one important feature in common: tokens are defined by greedy matching rules. This means that Klenee stars consume as many characters as possible, and do not backtrack if a tokenization error occurs (the error simply propagates). Under the assumption that Klenee stars have greedy semantics, derivatives can be computed in linear time. The algorithm for computing derivatives of a regular expression can be worked out by looking at all constructors of regular expressions. Table 3 details this computation for regular expressions of a base alphabet $\Sigma$ .
|
| 228 |
+
|
| 229 |
+
# C COMPLETION ENGINES
|
| 230 |
+
|
| 231 |
+
Here, we describe our completion engines for SQL, Vega-Lite and SMCalFlow in more detail.
|
| 232 |
+
|
| 233 |
+
# C.1 SQL
|
| 234 |
+
|
| 235 |
+
SQL database queries are executed in the context of a particular database containing a set of tables. Each table has a schema, which specifies named columns, their data types and constraints such as foreign keys. We refer to Yu et al. (2018) for a more detailed description of the SQL language.
|
| 236 |
+
|
| 237 |
+
Our CE for SQL enforces that only columns that exist in the tables in the database are used. The main challenge is that queries often specify aliases. Thus, during parsing, we construct a symbol table mapping aliases to the tables they refer to. We enforce that tables that already have an alias should only be referred to by their alias, not in their unqualified form. Since aliases can be referred to in the SELECT clause before being defined in the FROM clause, we also keep track of undefined aliases to enforce that they will be assigned a table later. Moreover, a condition in the WHERE clause might involve a nested query, which in its turn might redefine or create new aliases. As a result, our symbol table keeps a stack of scopes to properly resolve aliases in nested contexts.
|
| 238 |
+
|
| 239 |
+
Table 3: Computing Brzozowski derivatives for each constructor of regular expressions under the assumption that Klenee stars are greedy. The resulting algorithm runs in linear-time on the size of the regular expression.
|
| 240 |
+
|
| 241 |
+
<table><tr><td>Constructor</td><td>Description</td><td>Derivative w.r.t c' ∈∑</td></tr><tr><td>Q</td><td>Empty regular expression (matches no string).</td><td>Q</td></tr><tr><td>E</td><td>Matches only the empty string.</td><td>Q</td></tr><tr><td>C</td><td>Matches a single character c</td><td>∈ if c= c',or & otherwise. If the derivative of R1 w.r.t. c' is not ,</td></tr><tr><td>R1R2</td><td>Concatenation of two regular ex- pressions R1 and R2</td><td>then it's the concatenation of that with R2. Otherwise,if Rl matches ∈, then it is sim- ply the derivative of R2 w.r.t. c'. If not,</td></tr><tr><td>R1R2</td><td>Union of two regular expressions R1 and R2</td><td>then the result is &. Union of the derivatives of R1 and R2 W.r.t. c'(if one becomes &,simply return the other).</td></tr><tr><td>R*</td><td>Klenee star - any number of repeti- tions of R</td><td>If the derivative of R w.r.t. c is not Q, then return the concatenation of that derivative with R*. Otherwise,return @.</td></tr></table>
|
| 242 |
+
|
| 243 |
+
We constrain numeric literals to either come from a set of common numbers (including 0 and 1) or from the user’s natural language question. This prevents the model from copying arbitrary numbers from the few-shot examples in the prompt. Finally, since SQL is case-insensitive, our CE returns case-insensitive regular expressions for keywords, table and column names.
|
| 244 |
+
|
| 245 |
+
# C.2 VEGA-LITE
|
| 246 |
+
|
| 247 |
+
Vega-Lite is a declarative language for specifying data visualizations given a data frame – a table where rows represent data points and columns represent attributes of various data types. Its syntax is a subset of JSON. Therefore, our Vega-Lite grammar accepts JSON objects that follow a subset of the Vega-Lite schema.
|
| 248 |
+
|
| 249 |
+
As in SQL, we use the user’s data frame to constrain valid field names. Additionally, in Vega-Lite, one must also specify a Vega-Lite type that is used to interpret the field values. We inspect the runtime values in the data frame to determine compatible Vega-Lite types. For example, a string column is typically used as a categorical value (nominal, in Vega-Lite). However, if its entries have ISOformatted timestamps, it can be used as temporal, or quantitative if its values can be parsed as numbers. Since JSON objects are unordered, it must handle two valid output orders: the model might output the field name first (we thus later constrain the type) or the data type first (we then constrain the field name to compatible columns). Because Vega-Lite’s behavior is to silently ignore invalid data points, associating a column with an incompatible type simply produces an empty chart. Our constraint completely prevents this class of errors.
|
| 250 |
+
|
| 251 |
+
We forbid repeated fields and limit the length of free-form string literals to 30 characters, which prevents the common failure mode of language models to enter repetition loops. Similarly, we only allow an aggregation in one of the X-Y axes, but not both, since that collapses the chart to a single data point and is another common failure case. Finally, we prevent the model from faceting (i.e., splitting into multiple charts) based on a column with too many $( > 5 0 )$ ) distinct values: that typically crashes the Vega-Lite rendering engine since it allocates an overly large output image. In summary, our constraints guarantee conformance to the Vega-Lite specification and additionally avoid common mistakes that cause crashes or degenerate outputs.
|
| 252 |
+
|
| 253 |
+

|
| 254 |
+
Figure 7: Illustration of the token misalignment problem in Vega-Lite. Colors denote Vega-Lite tokens, which match how the completion engine works (and what are its completion points). Vertical lines denote how GPT-3 tokenizes this program.
|
| 255 |
+
|
| 256 |
+
# C.3 SMCALFLOW
|
| 257 |
+
|
| 258 |
+
SMCalFlow programs express responses to user queries about calendar events, weather, places, and people (Andreas et al., 2020). It is a rich language with scoped variable declarations, generic types, polymorphic operators and a large API of over 400 functions, which can be composed to express complex actions like “cancel any meetings on the same day of my next doctor’s appointment”, or answer queries such as ”will it be raining during my next walking meeting with Frank?”
|
| 259 |
+
|
| 260 |
+
Our CE enforces that programs type-check2 by construction. An example3 is given in Figure 1. At the current point in inference, the model is producing an argument to size. Since this function takes a list, its argument must be the return value of a function with return type List $< \mathrm { T } >$ . Among all functions and methods in the SMCalFlow API, only 14 return lists, which severely limits the valid options for the callee. Similarly, we keep track of declared variables inside let expressions, together with their types (inferred from their initialization expression), and use that data structure to limit options whenever a token of type identifier is syntactically allowed to follow.
|
| 261 |
+
|
| 262 |
+
Finally, we implemented heuristics based on user utterance patterns that avoid common failure cases we observed in GPT-3. These tend to happen when the model blindly copies portions of the examples in the prompt without adaptation. For instance, whenever the utterance contains exactly one of “a.m.” or “p.m”, this is usually represented in SMCalFlow by a call to a corresponding SMCalFlow function that constructs a Time object (e.g., NumberAM(5)). However, if the examples retrieved for the prompt tend to only have times in the opposite half of the day, GPT-3 might call the wrong function, and translate the time sub-expression in “Schedule it for $5 \mathrm { p m } ^ { \mathrm { , , } \mathrm { , } }$ into NumberAM(5). To avoid this, if we detect exactly one of “a.m.” or “p.m.” in the utterance, we remove the time construction functions associated with the opposite pattern from the candidates. We do the same filtering with days of the week and months, which are also constructed by specific functions.
|
| 263 |
+
|
| 264 |
+
In all domains, the CE abstraction allows us to easily encode domain knowledge in a modular fashion. Besides constraints coming from the language’s semantics, it further allows domain experts to analyze failure modes of the language model and to implement fixes them in a modular and predictable manner.
|
| 265 |
+
|
| 266 |
+
# D THE TOKEN MISALIGNMENT CHALLENGE
|
| 267 |
+
|
| 268 |
+
The main challenge of CSD is in aligning constraints expressed in terms of programming language tokens with the model’s output, which happens in another token vocabulary (typically constructed with Byte-Pair Encoding). Figure 7 shows an illustration of this challenge in Vega-Lite. Arbitrary mismatches can occur: the first BPE token includes the first Vega-Lite token and the first character of the second. In the middle of the example, the "encoding" token in Vega-Lite spans 4 BPE tokens, with misaligned boundaries at the beginning and end. Nonetheless, this issue is seamlessly handled by the CSD algorithm.
|
| 269 |
+
|
| 270 |
+

|
| 271 |
+
Figure 8: (a) Accuracy and (b) validity of Codex predictions with and without SYNCHROMESH on SQL as a function of the ground-truth program length. We map program lengths to percentiles, and round to the closest multiple of $10 \%$ . Error bands correspond to standard error.
|
| 272 |
+
|
| 273 |
+
# E OPTIMIZATIONS TO CSD
|
| 274 |
+
|
| 275 |
+
The algorithm described in Section 3.3 tests each token from the language model’s vocabulary individually. However, many BPE tokens are prefixes of oen another, which lets us apply a significant optimization. If $t _ { 1 }$ is a prefix of $t _ { 2 }$ and $t _ { 1 }$ is inadmissible after a partial program $p$ , then $t _ { 2 }$ is also inadmissible. Thus, we test tokens by order of length, and keep rejected tokens in a Trie structure. Before we test a token against the completion engine, we check whether one of its prefixes was already rejected. If so, we can safely skip that token.
|
| 276 |
+
|
| 277 |
+
Another optimization consists in memoizing the enumerated completion points. When testing a new partial program $p$ , instead of starting from the empty string, we can start from the longest known completion point that is a prefix of $p$ . This, again, can be efficiently done by keeping completion points in a Trie.
|
| 278 |
+
|
| 279 |
+
# F CSD WITHOUT DIRECT ACCESS TO THE LANGUAGE MODEL
|
| 280 |
+
|
| 281 |
+
We used the public OpenAI API to access GPT-3 and Codex. Therefore, we did not have direct access to the underlying language models. Even so, CSD can still be applied provided we can pass a bias to be added to the logits, which is available in the OpenAI API.
|
| 282 |
+
|
| 283 |
+
However, making one request at each token is too slow. Instead, we apply a “rejection”-based sampling, as follows. First, we request a complete program from the model. Then, we iterate tokenby-token, validating it with the CSD algorithm against the completion engine. If we find a violation, we (a) use CSD to determine all valid next tokens, (b) make a request asking from just a single token, applying a logit bias to constrain it to the valid tokens, and then (c) continue generation after appending the new token. Most $( 9 0 \% + )$ trajectories end after at most 3 corrections to the model. In degenerate cases, we might need to correct the model after almost every token. In our experiments, we capped CSD to apply at most 15 corrections, to control the time a request with CSD takes. This only happened in less than . $5 \%$ of the cases, and could be completely avoided if we had direct access to the model (in which case CSD is efficient enough to be applied at every token).
|
| 284 |
+
|
| 285 |
+
# G ANALYSIS OF ACCURACY AND VALIDITY BY LENGTH IN SQL
|
| 286 |
+
|
| 287 |
+
Figure 8 shows the equivalent of Figure 4 for the SQL domain. We notice that the largest gaps in validity happen for the longest queries, and the benefits in accuracy are highest for queries around the $60 \%$ length percentile.
|
| 288 |
+
|
| 289 |
+
# H TST FINE-TUNING DETAILS
|
| 290 |
+
|
| 291 |
+
In Section 2, we described TST, which fine-tunes a sentence embedding model to attempt to capture program similarity. Here, we give more details on our training procedure.
|
| 292 |
+
|
| 293 |
+
First, for both SQL and SMCalFlow, we selected a random set of 2000 examples, and computed the normalized tree edit distance between all pairs of examples. We then fine-tuned S-BERT for one epoch using the cosine similarity loss. We used the AdamW optimizer with a learning rate of $2 \times 1 \mathrm { { 0 } ^ { - } 5 }$ – the default parameters in the S-BERT library4. We did not perform any hyperparameter tuning. Training took around 3 hours on a single GPU.
|
| 294 |
+
|
| 295 |
+
# I COMMENTED EXAMPLES OF TST AND CSD
|
| 296 |
+
|
| 297 |
+
Here, we provide three more detailed examples. The first examples shows the benefit of using TST on top of Codex. The remaining two show value of CSD on top of Codex. Since the examples in Sections 2 and 3 used SQL, we now give examples in SMCalFlow and Vega-Lite for diversity.
|
| 298 |
+
|
| 299 |
+
# I.1 TST EXAMPLE IN SMCALFLOW
|
| 300 |
+
|
| 301 |
+
Query: “Hi, I need to meet with Alex on this Sunday at 6pm at the CVS shopping center for an hour.” This query asks the system to create an event. Without TST, the top example (similar to the query) returned by vanilla S-BERT from the training set is:
|
| 302 |
+
|
| 303 |
+
User utterance: Hi, I need to meet with Alex tomorrow afternoon for an hour.
|
| 304 |
+
SMCalFlow: (Yield (CreateCommitEventWrapper (CreatePreflightEventWrapper (& (& (Event.start_? (DateTimeConstraint (Afternoon) (Tomorrow))) (Event.duration_? ( $? =$ (toHours 1)))) (Event.attendees_? (AttendeeListHasRecipient (Execute (refer (extensionConstraint (RecipientWithNameLike (EmptyStructConstraint) (PersonName.apply "Alex")))))))))))
|
| 305 |
+
|
| 306 |
+
This example also involves creating an event, and also with a person named “Alex”. However, the time structure of this example, “Tomorrow afternoon”, is not trivial to translate to “this Sunday at 6pm”, because these two specifications require different APIs from SMCalFlow. Given this and 4 more examples, Codex generates:
|
| 307 |
+
|
| 308 |
+
(Yield (CreateCommitEventWrapper (CreatePreflightEventWrapper (& (& (Event.start_? (DateTimeConstraint (Afternoon) (ThisSunday))) (Event.duration_? ( $? =$ (toHours 1)))) (Event.location_? ( $? =$ (LocationWithNameLike (EmptyStructConstraint) (LocationName.apply "CVS shopping center")))) (Event.attendees_? (AttendeeListHasRecipient (Execute (refer (extensionConstraint (RecipientWithNameLike (EmptyStructConstraint) (PersonName.apply "Alex")))))))))))
|
| 309 |
+
|
| 310 |
+
This prediction, while seeming reasonable at a surface level, violates the SMCalFlow APIs in multiple places. First, the function “ThisSunday” does not exist. The parameter 6pm was lost in this prediction, since the examples had no explicit time in it and Codex could not identify where to put it. Besides that, the model is trying to specify four attributes of the created event: start time, duration, location and attendees, but it would need one more conjunction (call to “&”) to do so. This error likely came from the fact that the top example only specified three attributes. The calls to the location APIs are also incorrect – “LocationWithNameLike” exists (and is present in other examples in the prompt), but is not really needed or appropriate in this context.
|
| 311 |
+
|
| 312 |
+
However, if we use TST to pick the examples for the prompt, Codex is able to solve the problem. With TST, the top retrieved example is:
|
| 313 |
+
|
| 314 |
+
User utterance: Schedule 2 hours on Friday at 7:00 am for a Meeting with Kayla at the Sear’s Tower.
|
| 315 |
+
SMCalFlow: (Yield (CreateCommitEventWrapper (CreatePreflightEventWrapper (& (& (& (Event.start_? ( $? =$ (DateAtTimeWithDefaults (NextDOW (Friday)) (NumberAM 7L)))) (Event.duration_? ( $? =$ (toHours 2)))) (Event.location_? ( $? =$ (LocationKeyphrase.apply "Sear\’s Tower")))) (Event.attendees_? (AttendeeListHasRecipient (Execute (refer (extensionConstraint (RecipientWithNameLike (EmptyStructConstraint) (PersonName.apply "Kayla")))))))))))
|
| 316 |
+
|
| 317 |
+
Note that the utterance, from the perspective of its natural language structure, is less similar to the user’s request than the previous example. However, it describes a query with the exact necessary structure: it schedules something for the next Friday (trivial to modify to Sunday) at a certain time of the day (“NumberAM” can be simply rewritten to “NumberPM”, which Codex does correctly). The location attribute, which Codex had previously tried to adapt from a less related example, is now also specified here. With this example, Codex is able to make a correct adaptation. It predicts:
|
| 318 |
+
|
| 319 |
+
(Yield (CreateCommitEventWrapper (CreatePreflightEventWrapper (& (& (& (Event.start_? ( $? =$ (DateAtTimeWithDefaults (NextDOW (Sunday)) (NumberPM 6L)))) (Event.duration_? ( $? =$ (toHours 1)))) (Event.location_? ( $? =$ (LocationKeyphrase.apply "CVS shopping center")))) (Event.attendees_? (AttendeeListHasRecipient (Execute (refer (extensionConstraint (RecipientWithNameLike (EmptyStructConstraint) (PersonName.apply "Alex")))))))))))
|
| 320 |
+
|
| 321 |
+
This matches the reference program from the dataset.
|
| 322 |
+
|
| 323 |
+
# I.2 CSD EXAMPLES IN VEGA-LITE
|
| 324 |
+
|
| 325 |
+
Query: “average horsepower over years, colored by origin” This query does not specify a chart type, but one could infer that a line chart is likely more appropriate since it is showing a quantity over time. The dataset under consideration contains car models with their year of manufacture, horsepower, number of cylinders and many other attribute. Thus, to obtain the “average horsepower” in a given year, we need an aggregation in Vega-Lite. Codex alone predicts:
|
| 326 |
+
|
| 327 |
+
{"mark": {"type": "line" },
|
| 328 |
+
"encoding": {"x": {"field": "Year", "type": "temporal", "timeUnit": "yearmonth" }, "y": {"field": "Horsepower", "type": "quantitative", "aggregate": "average" }, "color": {"field": "Origin", "type": "nominal" } } }
|
| 329 |
+
|
| 330 |
+
All the right components of the query are there. However, even though the query asks for the “average horsepower”, the aggregation function in Vega-Lite is called “mean”. Specifying an invalid aggregation function makes Vega-Lite raise an exception. Thus, an actual user wouldn’t see any plot from this response.
|
| 331 |
+
|
| 332 |
+
CSD prevents Codex from generating “average” after it outputs the field name “aggregate”, forcing it to choose one of the existing aggregation functions (max, min, mean, etc). Constrained by CSD, Codex generates:
|
| 333 |
+
|
| 334 |
+
{"mark": {"type": "line" },
|
| 335 |
+
"encoding": {"x": {"field": "Year", "type": "temporal", "timeUnit": "yearmonth" }, "y": {"field": "Horsepower", "type": "quantitative", "aggregate": "mean" }, "color": {"field": "Origin", "type": "nominal" } } }
|
| 336 |
+
|
| 337 |
+
This is not only valid but also matches the ground-truth from the dataset.
|
| 338 |
+
|
| 339 |
+
“Create a scatterplot of acceleration vs horsepower by model” This utterance asks for a chart that relates each car’s acceleration and horsepower. Codex generates:
|
| 340 |
+
|
| 341 |
+
{"mark": {"type": "point" },
|
| 342 |
+
"encoding": {"x": {"field": "Horsepower", "type": "quantitative" }, "y": {"field": "Acceleration", "type": "quantitative" }, "color": {"field": "Model", "type": "nominal" } } }
|
| 343 |
+
|
| 344 |
+
The produced plot, shown in Figure 9 (left) is in principle correct, and answers the user’s question. The “by model” in the query might sound as if the user wants specialized plots by model. Codex realizes this interpretation by coloring each point differently by the car’s model. But in this dataset, each row represents a different car with a distinct model. Thus, there are 303 unique values of the “Model” column, and Vega-Lite raises a run-time warning saying that the legend has overflowed for having too many values, so some values (the majority, in this case) were omitted. When the model decides to facet on a column with too many values, the Vega-Lite run-time often runs out of memory for allocating an overly large image.
|
| 345 |
+
|
| 346 |
+
CSD avoids these errors by looking at the user’s dataset and determining which columns can be used for coloring or faceting, based on how many distinct values they have. If none are available, then CSD doesn’t let the model use these features. In this example, CSD forces Codex to choose one of the columns with less than 30 distinct values. Between those, Codex generates “Year”. The resulting plot is shown in Figure 9 (right). While in this example the “Year” column was not mentioned in the user’s request, the application of this constraint here steers Codex to avoid a run-time warning or error. The ground-truth visualization for this description does not have any color specification, so neither prediction counts as an exact match. Nevertheless, from the point of view of the user’s experience, CSD can be helpful even when it cannot completely fix the prediction.
|
| 347 |
+
|
| 348 |
+

|
| 349 |
+
Figure 9: Benefit of CSD: The left plot is generated by Codex without CSD, but it has an overflowing legend and it also raises a warning about missing values. Using CSD, we generate the plot on right that generates no runtime warning or error.
|
md/dev/KnCS9390Va/KnCS9390Va.md
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Delving into Out-of-Distribution Detection with Vision-Language Representations
|
| 2 |
+
|
| 3 |
+
Yifei Ming1 Ziyang Cai1 Jiuxiang $\mathbf { G u ^ { 2 } }$ Yiyou Sun1 Wei $\mathbf { L i ^ { 3 } }$ Yixuan Li1
|
| 4 |
+
|
| 5 |
+
1Department of Computer Sciences, University of Wisconsin-Madison 2Adobe 3Google Research {alvinming,ziyangc,sunyiyou,sharonli}@cs.wisc.edu jigu@adobe.com mweili@google.com
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
Recognizing out-of-distribution (OOD) samples is critical for machine learning systems deployed in the open world. The vast majority of OOD detection methods are driven by a single modality (e.g., either vision or language), leaving the rich information in multi-modal representations untapped. Inspired by the recent success of vision-language pre-training, this paper enriches the landscape of OOD detection from a single-modal to a multi-modal regime. Particularly, we propose Maximum Concept Matching (MCM), a simple yet effective zero-shot OOD detection method based on aligning visual features with textual concepts. We contribute in-depth analysis and theoretical insights to understand the effectiveness of MCM. Extensive experiments demonstrate that MCM achieves superior performance on a wide variety of real-world tasks. MCM with vision-language features outperforms a common baseline with pure visual features on a hard OOD task with semantically similar classes by $1 3 . 1 \%$ (AUROC). Code is available at https://github.com/ deeplearning-wisc/MCM.
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
Out-of-distribution (OOD) detection is critical for deploying machine learning models in the wild, where samples from novel classes can naturally emerge and should be flagged for caution. Despite increasing attention, the vast majority of OOD detection methods are driven by single-modal learning [26, 29, 34, 68, 89, 93, 95, 98]. For example, labels are typically encoded as one-hot vectors in image classification, leaving the semantic information encapsulated in texts largely unexploited. OOD detection relying on pure visual information can inherit the limitations, e.g., when an OOD input may be visually similar to in-distribution (ID) data yet semantically different from any ID class.
|
| 14 |
+
|
| 15 |
+
In this paper, we delve into a new landscape for OOD detection, departing from the classic singlemodal toward a multi-modal regime. While the motivation is appealing, a core challenge remains: how to effectively utilize joint vision-language features for OOD detection? In the visual domain, existing methods typically require good feature representations $\boxed { 6 6 } \boxed { 7 2 } \qquad $ , and a distance metric under which OOD data points are relatively far away from the in-distribution (ID) data [42, 71]. These approaches, however, do not directly translate into the multi-modal regime. On the representation learning side, recent vision-language pre-training schemes such as CLIP $\pmb { \Vert 5 9 \Vert }$ and ALIGN $\pmb { \mathbb { B 3 } }$ have emerged as promising alternatives for visual representation learning. The main idea is to align an image with its corresponding textual description in the feature space. While the resulting representations are powerful, OOD detection based on such aligned multi-modal features is still in its infancy.
|
| 16 |
+
|
| 17 |
+
We bridge the gap by exploring a distance-based OOD detection approach, leveraging the joint vision-language representations. Our method capitalizes on the compatibility between visual features and textual features. By defining the textual features as the “concept prototypes” for each ID class, we characterize OOD uncertainty by the distance from the visual feature to the closest ID prototype. That is, images closer to one of the textual embeddings of ID classes are more likely to be ID and vice versa. By a proper scaling of the distance, our proposed Maximum Concept Matching (MCM) score achieves strong ID-OOD separability (see Figure 1). MCM stands in contrast with the previous distance-based approaches, such as Mahalanobis $[ \mathbb { A } 2 ]$ , which defines class prototypes based on pure visual embeddings. Indeed, we show later in Section 5 that MCM (with multi-modal vision-language features) is far more competitive than Mahalanobis (with single-modal visual features). Moreover, while prior works of CLIP-based OOD detection $\dot { \lVert 1 6 \rVert } , \dot { \lVert 9 \rVert }$ rely on a set of candidate OOD labels, MCM is OOD-agnostic and alleviates the need for any prior information about test inputs.
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: Overview of the proposed zero-shot OOD detection framework. The ID classification task is defined by a set of class labels $\mathcal { V } _ { \mathrm { i n } }$ . The goal of OOD detection is to detect samples that do not belong to $\mathcal { V } _ { \mathrm { i n } }$ . We view the textual embeddings of ID classes (wrapped by text templates) as concept prototypes. The OOD uncertainty of an input image can be characterized by the distance from visual features to the closest ID prototype. By properly scaling the distance, the MCM score achieves strong ID-OOD separability. See Section $^ 3$ for details.
|
| 21 |
+
|
| 22 |
+
Our work also advances the field by showcasing the promise of zero-shot OOD detection, which offers strong performance and generality without training on the ID samples. In particular, classic OOD detection methods often require training from scratch $\mathbb { P } , \mathbb { Z } \mathbb { Z }$ or fine-tuning [19, 32] on a given ID dataset. In this setting, a classifier and its companion OOD detector are good at only one task. Every new task (ID dataset) requires additional training and brings additional computation and storage costs. In contrast, we show for the first time that: (1) MCM achieves superior performance across a wide variety of real-world tasks—with just one single pre-trained model. This is encouraging given that there is no training or any OOD information involved. (2) On the challenging ImageNet-1k benchmark, MCM’s zero-shot OOD detection performance favorably matches and even outperforms strong task-specific baselines fine-tuned on BiT $\mathbb { \lVert 3 2 \rVert }$ and ViT models [19]. (3) MCM remains robust against hard OOD inputs, including both semantically hard OODs $[ \sqrt { 8 5 } ]$ and spurious OODs $\pmb { \mathbb { B } } \pmb { \mathrm { O } } \Vert$
|
| 23 |
+
|
| 24 |
+
We summarize our main contributions as follows:
|
| 25 |
+
|
| 26 |
+
1. We propose MCM, a simple yet effective OOD detection method based on aligned visionlanguage features. MCM offers several compelling advantages over other OOD detection methods: generalizable (one model supports many tasks), OOD-agnostic (no information required from OOD data), training-free (no downstream fine-tuning required), and scalable to large real-world tasks.
|
| 27 |
+
2. We conduct extensive experiments and show that MCM achieves superior performance on a wide range of real-world tasks. On ImageNet-1k, MCM achieves an average AUROC of $9 1 . 4 9 \%$ , outperforming methods that require training. Moreover, we show that MCM remains competitive under challenging hard OOD evaluation tasks.
|
| 28 |
+
3. We provide in-depth empirical and theoretical analysis, providing insights to understand the effectiveness of MCM. We hope that this work will serve as a springboard for future works on OOD detection with multi-modal features.
|
| 29 |
+
|
| 30 |
+
# 2 Preliminaries
|
| 31 |
+
|
| 32 |
+
Contrastive vision-language pre-training. Compared to visual representation learning models such as ViT $[ \overbrace { \lVert \boldsymbol { 1 3 } \rVert }$ , vision-language representation learning demonstrates superior performance on image classification tasks. For instance, CLIP $\mathbb { \left[ \left. 5 9 \right] \right. }$ adopts a self-supervised contrastive objective (i.e., InfoNCE loss $\pm \mathbb { Z } 5 \mathbb { I }$ ) to align an image with its corresponding textual description in the feature space. Specifically, CLIP adopts a simple dual-stream architecture with one text encoder $\mathcal { T } : t \mathbb { R } ^ { d }$ (e.g., Transformer $\mathbb { \left[ \bigcirc \mathrm { { Z } } \mathrm { { Z } } \right] } )$ and one image encoder $\mathcal { I } : \mathbf { x } \mathbb { R } ^ { d }$ (e.g., ViT $\mathbb { L } 3 \mathbb { I } .$ ). After pre-training on a dataset of 400 million text-image pairs, the joint vision-language embeddings of CLIP well associate objects in different modalities. Despite the promise, existing CLIP-like models perform zero-shot classification in a closed-world setting. That is, it will match an input into a fixed set of categories, even if it is irrelevant (e.g., a tree being predicted as a bird in Figure $\blacktriangleleft$ . This motivates our work to leverage the multi-modal representation for OOD detection, which is largely unexplored.
|
| 33 |
+
|
| 34 |
+
Zero-shot OOD detection. Given a pre-trained model, a classification task of interest is defined by a set of class labels/names ${ \mathcal { N } } _ { \mathrm { i n } }$ , which we refer to as the known (ID) classes. Here ID classes are defined w.r.t. the classification task of interest, instead of the classes used in pre-training. Accordingly, OOD is defined w.r.t. the ID classes, not the data distribution during pre-training. The goal of OOD detection is to (1) detect samples that do not belong to any of the known classes; (2) otherwise, assign test samples to one of the known classes. Therefore, the OOD detector can be viewed as a “safeguard” for the classification model. Formally, we denote the OOD detector as a binary function: $G ( \mathbf { x } ; \mathcal { V } _ { \mathrm { i n } } , \mathcal { T } , \mathbb { Z } ) : \mathcal { X } \to \{ \mathrm { i n } , \mathrm { o u t } \}$ , where $\mathbf { x } \in \mathcal { X }$ denotes a test image. Our method is based on only the names of the given classes in ${ \mathcal { N } } _ { \mathrm { i n } }$ , and a pre-trained model. Different from standard supervised learning, there is no training on the ID samples involved, hence zero-shot.
|
| 35 |
+
|
| 36 |
+
# 3 OOD Detection via Concept Matching
|
| 37 |
+
|
| 38 |
+
We illustrate our approach in Figure $\bigstar \bigstar$ which derives the OOD detector $G ( \cdot )$ based on concept matching. For a given task with label set $\mathcal { V } _ { \mathrm { i n } } = \{ y _ { 1 } , y _ { 2 } , . . . , y _ { K } \}$ , we can construct a collection of concept vectors $\mathcal { T } ( t _ { i } ) , i \in \{ 1 , 2 , . . . , K \}$ , where $t _ { i }$ is the text prompt “this is a photo of a $\langle y _ { i } \rangle ^ { \flat }$ for a label $y _ { i }$ . The concept vectors are represented by the embeddings of the text prompts.
|
| 39 |
+
|
| 40 |
+
For any test input image $\mathbf { x } ^ { \prime }$ , we can calculate the label-wise matching score based on the cosine similarity between the image feature $\mathcal { T } ( \mathbf { x } ^ { \prime } )$ and the concept vector $\begin{array} { r } { \bar { T ( t _ { i } ) } \colon s _ { i } ( \mathbf { x } ^ { \prime } ) = \frac { \bar { \mathcal { T } } ( \mathbf { x } ^ { \prime } ) \cdot \bar { \mathcal { T } } ( t _ { i } ) } { \| \bar { \mathcal { T } } ( \mathbf { x } ^ { \prime } ) \| \cdot \| \bar { \mathcal { T } } ( t _ { i } ) \| } } \end{array}$ . Formally, we define the maximum concept matching (MCM) score as:
|
| 41 |
+
|
| 42 |
+
$$
|
| 43 |
+
S _ { \mathrm { M C M } } ( \mathbf { x } ^ { \prime } ; \mathcal { V } _ { \mathrm { i n } } , \mathcal { T } , \mathbb { Z } ) = \operatorname* { m a x } _ { i } \frac { e ^ { s _ { i } ( \mathbf { x } ^ { \prime } ) / \tau } } { \sum _ { j = 1 } ^ { K } e ^ { s _ { j } ( \mathbf { x } ^ { \prime } ) / \tau } } ,
|
| 44 |
+
$$
|
| 45 |
+
|
| 46 |
+
where $\tau$ is the temperature. For ID data, it will be matched to one of the concept vectors (textual prototypes) with a high score; and vice versa. Formally, our OOD detection function can be formulated as:
|
| 47 |
+
|
| 48 |
+
$$
|
| 49 |
+
G ( \mathbf { x } ^ { \prime } ; \mathcal { V } _ { \mathrm { i n } } , \mathcal { T } , \mathcal { Z } ) = \left\{ \begin{array} { r l } { 1 } & { S _ { \mathrm { M C M } } ( \mathbf { x } ^ { \prime } ; \mathcal { V } _ { \mathrm { i n } } , \mathcal { T } , \mathcal { Z } ) \ge \lambda } \\ { 0 } & { S _ { \mathrm { M C M } } ( \mathbf { x } ^ { \prime } ; \mathcal { V } _ { \mathrm { i n } } , \mathcal { T } , \mathcal { Z } ) < \lambda } \end{array} , \right.
|
| 50 |
+
$$
|
| 51 |
+
|
| 52 |
+
where by convention 1 represents the positive class (ID) and 0 indicates OOD. $\lambda$ is chosen so that a high fraction of ID data (e.g., $9 5 \%$ ) is above the threshold. For samples that are classified as ID, one can obtain the class prediction based on the closest concept: ${ \hat { y } } = \operatorname { a r g m a x } _ { i \in [ K ] } s _ { i } .$
|
| 53 |
+
|
| 54 |
+
Remark: (1) Our work differs from (and is complementary to) CLIP by focusing on OOD detection rather than (closed-world) zero-shot classification. We show new theoretical insights that softmax scaling plays a unique role in zero-shot OOD detection—improving the separability between ID and OOD data. This role has not been studied rigorously for zero-shot OOD detection. Readers familiar with CLIP may notice that MCM can be used for zero-shot classification in the closed world. This also makes MCM practically convenient for dual goals: detect OOD samples and assign ID data to one of the known classes. (2) Our method in principle is not limited to CLIP; it can be generally applicable for contrastive vision-language pre-training models that promote multi-modal feature alignment.
|
| 55 |
+
|
| 56 |
+
New insights on softmax scaling for zero-shot OOD detection. We provide theoretical justifications that softmax scaling improves the separability between ID and OOD data for CLIP-based OOD detection, which is contrary to models trained with cross-entropy (CE) loss. In particular, CLIP-like models are trained with a multi-modal contrastive loss, which maximizes the cosine similarity between an image and its textual description in the feature space. The resulting cosine similarity scores display strong uniformity1 across labels, as evidenced in Figure 2 (right). Compared to OOD inputs, the gap between the maximum cosine similarity and the average is larger for ID inputs. However, the gap can be small when the number of ID classes increases where ID samples occur with lower highest cosine similarity. As a result, the highest cosine similarity for ID samples and OOD samples can be highly close (c.f. Figure 2 (left)).
|
| 57 |
+
|
| 58 |
+
Motivated by these observations, MCM employs softmax as a post hoc mechanism to magnify the difference. This is fundamentally different from the softmax score derived from a model trained with cross-entropy loss, which inherently maximizes the posterior $p ( \boldsymbol { y } | \mathbf { x } )$ for the ground-truth label, and minimizes the probability for other labels. Unlike CLIPlike models, logit scores displaying uniformity would be heavily penalized by the CE loss. As a result, the logit score corresponding to the ground-truth label can already be significantly higher than other labels. Applying softmax on the logit scores can exacerbate overconfident predictions, and reduce the separability between ID and OOD data $\left[ \left[ 4 6 \right] \right]$ . Indeed, for a
|
| 59 |
+
|
| 60 |
+
model trained with cross-entropy loss, a logit-based score such as Energy $[ \overline { { | 4 8 | } }$ is shown to be much more effective than the softmax score.
|
| 61 |
+
|
| 62 |
+

|
| 63 |
+
Figure 2: Left: Maximum cosine similarity for ID and OOD inputs. There exists overlapping regions (shown in yellow); Right: Cosine similarities between OOD inputs and ID concept vectors. For OOD inputs, the cosine similarities display uniformity.
|
| 64 |
+
|
| 65 |
+
Interestingly, for CLIP-like models, the trend is the opposite—applying softmax helps sharpen the uniform-like inner product scores, and increases the separability between ID and OOD data. To help readers better understand the insights, we first formalize our observations that OOD inputs trigger similar cosine similarities across ID concepts (Figure $\triangledown$ right) as the following assumption:
|
| 66 |
+
|
| 67 |
+
Assumption 3.1. Let $z : = \mathbb { 1 } \{ y \in \mathcal { V } _ { \mathrm { i n } } \}$ . $Q _ { \mathbf { x } }$ denotes the out-of-distribution $\mathbb { P } _ { \mathbf { x } | \boldsymbol { z } = 0 }$ (marginal distribution of $\mathbf { x }$ conditioned on $z = 0$ ). Assume $\exists \delta > 0$ such that
|
| 68 |
+
|
| 69 |
+
$$
|
| 70 |
+
Q _ { \mathbf { x } } \left( \frac { 1 } { K - 1 } \sum _ { i \neq j } \lbrack s _ { \hat { y } _ { 2 } } ( \mathbf { x } ) - s _ { i } ( \mathbf { x } ) \rbrack < \delta \right) = 1 ,
|
| 71 |
+
$$
|
| 72 |
+
|
| 73 |
+
where $\hat { y } : = \mathrm { a r g m a x } _ { i \in [ K ] } s _ { i } ( { \bf x } )$ and $\hat { y } _ { 2 } : = \mathrm { a r g m a x } _ { i \neq \hat { y } , i \in [ K ] } s _ { i } ( \mathbf { x } )$ denote the indices of the largest and second largest cosine similarities for an OOD input x.
|
| 74 |
+
|
| 75 |
+
Now we provide formal guarantees that using softmax can provably reduce the false positive rate (FPR) compared to that without softmax.
|
| 76 |
+
|
| 77 |
+
Theorem 3.1. Given a task with ID label set $\mathcal { V } _ { \mathrm { i n } } = \{ y _ { 1 } , y _ { 2 } , . . . , y _ { K } \}$ and a pre-trained CLIP-like model $( \mathcal { T } , \mathcal { T } )$ . If $Q _ { \mathbf { x } }$ satisfies Assumption $\boxed { 3 . 1 }$ then there exists a constant $\begin{array} { r } { T = \frac { \lambda ( K - 1 ) \left( \lambda ^ { \mathrm { w o } } + \delta - s _ { \hat { y } _ { 2 } } \right) } { K \lambda - 1 } } \end{array}$ such that for any temperature $\tau > T$ , we have
|
| 78 |
+
|
| 79 |
+
$$
|
| 80 |
+
\mathrm { F P R } ( \tau , \lambda ) \le \mathrm { F P R } ^ { \mathrm { w o } } ( \lambda ^ { \mathrm { w o } } ) ,
|
| 81 |
+
$$
|
| 82 |
+
|
| 83 |
+
where $\mathrm { { F P R } } ( \tau , \lambda )$ is the false positive rate based on softmax scaling with temperature $\tau$ and detection threshold $\lambda$ $\therefore \mathrm { F P R } ^ { \mathrm { w o } } ( \lambda ^ { \mathrm { w o } } )$ is the false positive rate without softmax scaling based on threshold $\lambda ^ { \mathrm { w o } }$ .
|
| 84 |
+
|
| 85 |
+
This suggests that applying softmax scaling with a moderate temperature results in superior OOD detection performance compared to that without softmax scaling. The proof is in Appendix $\boxed { \mathrm { A } }$ Later in Section $\Xi ,$ we empirically verify on a real-world ImageNet dataset that our bound can indeed be satisfied in CLIP where the thresholds are chosen at $9 5 \%$ true positive rate.
|
| 86 |
+
|
| 87 |
+
What MCM offers: Beyond theoretical insights, we would like to highlight several compelling advantages of our zero-shot OOD detection approach, owing to the strong pre-trained CLIP model:
|
| 88 |
+
|
| 89 |
+
• Generalizable to many tasks: Traditional OOD detection methods are based on a task-specific model. As a result, the OOD detector is not suitable for a realistic online scenario where the task changes from one to another. In contrast, we will show in Section $\boxplus$ that MCM can perform a wide variety of OOD detection tasks, with just one single model. For a new task, only the names of the task’s visual concepts ${ \mathcal { N } } _ { \mathrm { i n } }$ are required. OOD-agnostic: Our method does not rely on any OOD information, and thus suits many realworld scenarios where one cannot anticipate what the unknowns would be ahead of time. This also mitigates the shortcoming of a recent approach $\mathbb { \lVert 1 9 \rVert }$ , which assumes that a set of unseen labels are given as some weak information about OOD data.
|
| 90 |
+
• Training-free: MCM enables OOD detection in a zero-shot fashion. This stands in contrast to the vast majority of OOD detection literature, which often requires training from scratch or fine-tuning to achieve competitive performance.
|
| 91 |
+
• Scalable: The contrastive vision-language pre-training paradigm makes MCM scalable to a large number of class labels and realistic high-resolution images.
|
| 92 |
+
|
| 93 |
+
We now proceed to the experimental results, demonstrating these advantages on real-world tasks.
|
| 94 |
+
|
| 95 |
+
# 4 A Comprehensive Analysis of MCM
|
| 96 |
+
|
| 97 |
+
# 4.1 Datasets and Implementation Details
|
| 98 |
+
|
| 99 |
+
Datasets. Most previous works on OOD detection only focus on small-scale datasets with blurry images such as CIFAR $\mathbb { H O }$ and TinyImageNet [41]. With pre-trained models such as CLIP, OOD detection can be extended to more realistic and complex datasets. In this work, we scale up evaluations in terms of (1) image resolution, (2) dataset variety, and (3) number of classes. We consider the following ID datasets: CUB-200 $\pmb { \Vert 8 0 \Vert }$ , STANFORD-CARS [39], FOOD-101 [6], OXFORD-PET [57] and variants of IMAGENET [11]. For OOD test datasets, we use the same ones in $\pmb { \mathbb { B 2 } }$ , including subsets of iNaturalist $\left[ \left[ 7 6 \right] \right]$ , SUN [86], PLACES $\mathbb { \left[ \left[ 9 6 \right] \right] }$ , and TEXTURE [10]. For each OOD dataset, the categories are not overlapping with the ID dataset. We also use subsets of ImageNet-1k for fine-grained analysis. For example, we construct ImageNet-10 that mimics the class distribution of CIFAR-10 but with high-resolution images. For hard OOD evaluation, we curate ImageNet-20, which consists of 20 classes semantically similar to ImageNet-10 (e.g., dog (ID) vs. wolf (OOD)).
|
| 100 |
+
|
| 101 |
+
Model. In our experiments, we adopt CLIP $\mathbb { \lVert 5 9 \rVert }$ as the target pre-trained model, which is one of the most popular and publicly available vision-language models. Note that our method is not limited to CLIP; it can generally be applicable for contrastive vision-language pre-training models that promote multi-modal feature alignment. Specifically, we mainly use CLIP-B/16, which consists of a ViT-B/16 Transformer as the image encoder and a masked self-attention Transformer $ { \mathbb { Z } } { \ b { 7 } } { \mathbb { I } }$ as the text encoder. To indicate the input patch size in ViT models, we append $\mathbf { \ddot { \mu } } ^ { 6 6 } / \mathbf { \vec { X } } ^ { 3 }$ to model names. We prepend -B, -L to indicate Base and Large versions of the corresponding architecture. For instance, ViT-B/16 implies the Base variant with an input patch resolution of $1 6 \times 1 6$ . We also use CLIP-L/14 which is based on ViT-L/14 as a representative of large models. Unless specified otherwise, the temperature $\tau$ is 1 for all experiments. Details of the datasets, experimental setup, and hyperparameters are provided in Appendix B.
|
| 102 |
+
|
| 103 |
+
Metrics. For evaluation, we use the following metrics: (1) the false positive rate (FPR95) of OOD samples when the true positive rate of in-distribution samples is at $9 5 \%$ , (2) the area under the receiver operating characteristic curve (AUROC), and (3) ID classification accuracy (ID ACC).
|
| 104 |
+
|
| 105 |
+
Table 1: Zero-shot OOD detection with MCM score based on CLIP-B/16 with various ID datasets.
|
| 106 |
+
|
| 107 |
+
<table><tr><td rowspan="3">ID Dataset</td><td colspan="8">OODDataset</td><td rowspan="2" colspan="2">Average</td></tr><tr><td colspan="2">iNaturalist</td><td colspan="2">SUN</td><td colspan="2">Places</td><td colspan="2">Texture</td></tr><tr><td>FPR95↓</td><td>AUROC↑</td><td>FPR95↓</td><td>AUROC↑</td><td>FPR95↓</td><td>AUROC↑</td><td>FPR95↓</td><td>AUROC↑</td><td>FPR95↓</td><td>AUROC↑</td></tr><tr><td>CUB-200|801</td><td>9.83</td><td>98.24</td><td>4.93</td><td>99.10</td><td>6.65</td><td>98.57</td><td>6.97</td><td>98.75</td><td>7.09</td><td>98.66</td></tr><tr><td>Stanford-Cars 四</td><td>0.05</td><td>99.77</td><td>0.02</td><td>99.95</td><td>0.24</td><td>99.89</td><td>0.02</td><td>99.96</td><td>0.08</td><td>99.89</td></tr><tr><td>Food-101</td><td>0.64</td><td>99.78</td><td>0.90</td><td>99.75</td><td>1.86</td><td>99.58</td><td>4.04</td><td>98.62</td><td>1.86</td><td>99.43</td></tr><tr><td>Oxford-Pet [57</td><td>2.85</td><td>99.38</td><td>1.06</td><td>99.73</td><td>2.11</td><td>99.56</td><td>0.80</td><td>99.81</td><td>1.70</td><td>99.62</td></tr><tr><td>ImageNet-10</td><td>0.12</td><td>99.80</td><td>0.29</td><td>99.79</td><td>0.88</td><td>99.62</td><td>0.04</td><td>99.90</td><td>0.33</td><td>99.78</td></tr><tr><td>ImageNet-20</td><td>1.02</td><td>99.66</td><td>2.55</td><td>99.50</td><td>4.40</td><td>99.11</td><td>2.43</td><td>99.03</td><td>2.60</td><td>99.32</td></tr><tr><td>ImageNet-100</td><td>18.13</td><td>96.77</td><td>36.45</td><td>94.54</td><td>34.52</td><td>94.36</td><td>41.22</td><td>92.25</td><td>32.58</td><td>94.48</td></tr></table>
|
| 108 |
+
|
| 109 |
+
Table 2: OOD detection performance for ImageNet-1k [11] as ID.
|
| 110 |
+
|
| 111 |
+
<table><tr><td rowspan="3">Method</td><td colspan="8">OOD Dataset</td><td rowspan="2" colspan="2">Average</td></tr><tr><td colspan="2">iNaturalist FPR95↓</td><td colspan="2">SUN</td><td colspan="2">Places</td><td colspan="2">Texture</td></tr><tr><td></td><td>AUROC↑</td><td>FPR95↓</td><td>AUROC↑</td><td>FPR95↓</td><td>AUROC↑</td><td>FPR95↓</td><td>AUROC↑</td><td>FPR95↓</td><td>AUROC↑</td></tr><tr><td colspan="9">Requires training (or w. fine-tuning)</td><td></td></tr><tr><td>MOS 32 (BiT)</td><td>9.28</td><td>98.15</td><td>40.63</td><td>92.01</td><td>49.54</td><td>89.06</td><td>60.43</td><td>81.23</td><td>39.97</td><td>90.11</td></tr><tr><td>Fort et al. 园 (ViT-B)</td><td>15.07</td><td>96.64</td><td>54.12</td><td>86.37</td><td>57.99</td><td>85.24</td><td>53.32</td><td>84.77</td><td>45.12</td><td>88.25</td></tr><tr><td>Fort et al. 园 (ViT-L)</td><td>15.74</td><td>96.51</td><td>52.34</td><td>87.32</td><td>55.14</td><td>86.48</td><td>51.38</td><td>85.54</td><td>43.65</td><td>88.96</td></tr><tr><td>Energy 481 (CLIP-B)</td><td>21.59</td><td>95.99</td><td>34.28</td><td>93.15</td><td>36.64</td><td>91.82</td><td>51.18</td><td>88.09</td><td>35.92</td><td>92.26</td></tr><tr><td>Energy 48 (CLIP-L)</td><td>10.62</td><td>97.52</td><td>30.46</td><td>93.83</td><td>32.25</td><td>93.01</td><td>44.35</td><td>89.64</td><td>29.42</td><td>93.50</td></tr><tr><td>MSP 因 (CLIP-B) MSP</td><td>40.89</td><td>88.63</td><td>65.81</td><td>81.24</td><td>67.90</td><td>80.14</td><td>64.96</td><td>78.16</td><td>59.89</td><td>82.04</td></tr><tr><td>因 (CLIP-L)</td><td>34.54</td><td>92.62</td><td>61.18</td><td>83.68</td><td>59.86</td><td>84.10</td><td>59.27</td><td>82.31</td><td>53.71</td><td>85.68</td></tr><tr><td colspan="9">Zero-shot (no training required)</td><td></td><td></td></tr><tr><td>MCM(CLIP-B)</td><td>30.91</td><td>94.61</td><td>37.59</td><td>92.57</td><td>44.69</td><td>89.77</td><td>57.77</td><td>86.11</td><td>42.74</td><td>90.77</td></tr><tr><td>MCM(CLIP-L)</td><td>28.38</td><td>94.95</td><td>29.00</td><td>94.14</td><td>35.42</td><td>92.00</td><td>59.88</td><td>84.88</td><td>38.17</td><td>91.49</td></tr></table>
|
| 112 |
+
|
| 113 |
+
# 4.2 Main Results
|
| 114 |
+
|
| 115 |
+
MCM supports a diverse collection of tasks while being zero-shot. We first show that zero-shot OOD detection with MCM is effective across a wide variety of tasks—with just one single pre-trained model. To showcase the versatility of MCM, we consider the seven ID datasets here. To the best of our knowledge, this is among the first attempts to showcase the efficacy under an expansive and diverse collection of ID datasets. The zero-shot OOD detection performance is summarized in Table 1. A salient observation is that MCM can achieve superior detection performance on many tasks. For example, using STANFORD-CARS as ID, MCM yields an average FPR95 of $\mathbf { 0 . 0 8 \% }$ . Considering that there are no training samples or OOD information involved, these results are very encouraging.
|
| 116 |
+
|
| 117 |
+
It can be also seen from Table $^ 1$ that MCM is promising, especially when the number of samples per ID class is limited in the training set. For example, there are only around 40 samples per class for Stanford-Cars, 100 for Oxford-Pet, and 30 for CUB-200. The sample scarcity makes OOD detection methods that rely on fine-tuning difficult. For example, after fine-tuning on Food-101, while the ID accuracy is increased from $8 6 . 3 \%$ to $9 2 . 5 \% \uparrow$ , OOD detection based on MSP is on par with MCM $( 9 9 . 5 \%$ vs. $9 9 . 4 \%$ in AUROC).
|
| 118 |
+
|
| 119 |
+
MCM scales effectively to large datasets. To examine the scalability of MCM, we compare it with recent competitive OOD detection methods [19, 32] on the ImageNet-1k dataset (ID) in Table 2. We observe the following trends:
|
| 120 |
+
|
| 121 |
+
• Larger models lead to superior performance. Compared with CLIP-B, MCM based on CLIP-L reduces FPR95 by $4 . 5 7 \%$ . Zero-shot ID classification accuracy is also improved by $6 . 2 7 \%$ with the larger model, reaching $7 3 . 2 8 \%$ (see Appendix $\bigstar \bigstar$ . This suggests that larger models are endowed with a better representation quality, which benefits both ID classification and OOD detection with MCM. Our finding echos with the recent observations $\mathbb { \left[ \left[ \begin{array} { l } { \nabla 8 } \right]} \end\right]{array} \end{array}$ that higher ID classification accuracy is correlated with stronger OOD detection performance.
|
| 122 |
+
• MOS $\pmb { \Vert 3 2 } \Vert$ recently demonstrated competitive performance on ImageNet-1k, which requires model fine-tuning based on BiT $\pmb { \Vert 3 8 \Vert }$ . In contrast, we show that MCM (CLIP-L) outperforms MOS by $1 . 3 8 \%$ in AUROC while being zero-shot (training-free).
|
| 123 |
+
• MCM shares a softmax scaling function with the classic (visual) confidence-based score MSP $\lVert 2 5 \rVert$ To implement MSP, we adopt the commonly used linear probe approach by fine-tuning a linear layer on frozen visual features of CLIP. After fine-tuning, ID accuracy significantly improves, reaching $8 4 . 1 2 \%$ (CLIP-L). Interestingly, the OOD detection performance of MSP is worse than
|
| 124 |
+
|
| 125 |
+
Table 3: Performance comparison on hard OOD detection tasks. MCM is competitive on all three hard OOD tasks without training involved. MSP (based on fine-tuned CLIP) does not further improve performance.
|
| 126 |
+
|
| 127 |
+
<table><tr><td>Method</td><td>ID OOD</td><td>ImageNet-10 ImageNet-20</td><td>ImageNet-20 ImageNet-10</td><td>Waterbirds Spurious OOD</td></tr><tr><td></td><td></td><td>FPR95/AUROC</td><td>FPR95 /AUROC</td><td>FPR95/AUROC</td></tr><tr><td>MSP 四 (fine-tuning)</td><td></td><td>9.38 /98.31</td><td>12.51 /97.70</td><td>39.57 /90.99</td></tr><tr><td>Mahalanobis [42] (visual only)</td><td></td><td>78.32/85.60</td><td>43.03 /89.94</td><td>2.21 /99.55</td></tr><tr><td>MCM (zero-shot)</td><td></td><td>5.00 /98.71</td><td>12.91 / 98.09</td><td>5.87 /98.36</td></tr></table>
|
| 128 |
+
|
| 129 |
+
MCM by $1 5 . 5 4 \%$ in FPR95. Under the same model fine-tuned with linear probing, we observe that the Energy score outperforms MSP, corroborating findings in [48]. We investigate more in Section 5.
|
| 130 |
+
|
| 131 |
+
• Recently, Fort et al. $\mathbb { \lVert 1 9 \rVert }$ explore small-scale OOD detection by fine-tuning the full ViT model. When extended to large-scale tasks, we find that MCM still yields superior performance under the same image encoder configuration (ViT-B or ViT-L). This further highlights the advantage of utilizing vision-language joint embeddings for large-scale visual OOD detection.
|
| 132 |
+
|
| 133 |
+
MCM benefits hard OOD detection. Going beyond, we investigate whether MCM is still effective for hard OOD inputs. We consider the following two categories of hard OOD:
|
| 134 |
+
|
| 135 |
+
• Semantically hard OOD: OOD samples that are semantically similar to ID samples are particularly challenging for OOD detection algorithms $\pmb { \Vert 8 5 } \Vert$ . To evaluate hard OOD detection tasks in realistic settings, here we consider ImageNet-10 (ID) vs. ImageNet-20 (OOD) and vice versa. The pair consists of high-resolution images with semantically similar categories such as dog versus wolf. As shown in Table $^ { 3 , }$ MCM outperforms Mahalanobis $\lVert \boldsymbol { 4 2 } \rVert$ by $7 3 . 3 2 \%$ in FPR95 for ImageNet-10 (ID) vs. ImageNet-20 (OOD) and $3 0 . 1 2 \%$ vice versa.
|
| 136 |
+
|
| 137 |
+
• Spurious OOD: Modern neural networks can exploit spurious correlations for predictions [3]. For example, in the Waterbirds dataset $\pmb { \mathbb { \lVert 6 4 \rVert } }$ , there exist spurious correlations between the habitat (e.g., water) and bird types. A recent work $ { \mathbb { I } } ^ { { \left[ \left[ 5 0 \right] \right] } }$ proposes a new type of hard OOD named spurious OOD and shows that most OOD detection methods perform much worse for spurious OOD inputs compared to non-spurious inputs. The spurious OOD inputs are created to share the same background (i.e., water) as ID data but have different object labels (e.g., a boat rather than a bird). See Appendix $\boxed { \mathbf { C } }$ for illustrations. The results are shown in Table $3 .$ . It has been shown that CLIP representations are robust to distributional shifts $\pmb { \Vert 5 9 \Vert }$ . Therefore, while prior works $ { \mathbb { I } } ^ { { 5 } { 0 } \| }$ show that spurious OOD inputs are challenging for methods based on ResNet $\pmb { \mathbb { Z } } 3 \mathbb { I }$ , MCM and Mahalanobis scores based on pre-trained CLIP perform much better. On the other hand, fine-tuning exposes the model to the training set containing spurious correlations. As a result, MSP performs much worse than MCM $( 3 9 . 5 7 \%$ vs. $5 . 8 7 \%$ in FPR95).
|
| 138 |
+
|
| 139 |
+
MCM outperforms CLIP-based baselines. Two recent works also use CLIP embeddings for OOD detection [16, 19]. However, fundamental limitations exist for both works. Fort et al. $\mathbb { \ m }$ assume that a candidate OOD label set $\mathcal { V } _ { C }$ is known, and used $\textstyle \sum _ { y \in y _ { C } } { \hat { p } } ( y | \mathbf { x } )$ for OOD detection. Here the predictive probability $\hat { p } ( y | \mathbf x )$ is obtained by normalizing the inner products over $| \mathcal { V } _ { \mathrm { i n } } | + | \mathcal { V } _ { C } |$ classes. While applying softmax converts any vector to probabilities, as we show in Section $^ { 3 , }$ the converted probabilities do not necessarily correspond to $\mathbb { P } ( \mathbf { 0 } \mathbf { O D } | \mathbf { x } )$ . Moreover, obtaining such an OOD label set is typically not feasible, which fundamentally limits its applicability. A recent work $\mathbb { \lVert 1 6 \rVert }$ realizes this idea by training an extra text decoder on top of CLIP’s image encoder to generate candidate labels. However, $\mathbb { \lVert \boldsymbol { 1 6 } \rVert }$ cannot guarantee the generated labels are non-overlapping with the ID labels.
|
| 140 |
+
|
| 141 |
+

|
| 142 |
+
Figure 3: Comparison with a candidate label-based score ZO-CLIP on ImageNet-20, based on our implementation of $\boxed { 1 1 6 }$ . Implementation details are deferred to Appendix E.1.
|
| 143 |
+
|
| 144 |
+

|
| 145 |
+
Figure 4: The influence of softmax scaling and temperature. We use ImgeNet-100 (ID) vs. iNaturalist (OOD). Softmax scaling with a moderate temperature significantly improves FPR95.
|
| 146 |
+
|
| 147 |
+
We enhance the baseline with a stronger decoder and a filter module (see Appendix $\mathrm { E . 1 } )$ . As shown in Figure 3 , MCM outperforms the enhanced baseline on all OOD datasets. Moreover, MCM is much simpler to use—alleviating the need for an OOD label set or training an additional caption generator. In contrast, the caption generator’s performance largely affects OOD detection. Poor caption quality degenerates the OOD detection performance of candidate label-based methods. Moreover, obtaining a reliable caption generator for any input image can significantly increase the computational overhead.
|
| 148 |
+
|
| 149 |
+
# 5 Discussion: A Closer Look at MCM
|
| 150 |
+
|
| 151 |
+
Empirical verification on the role of softmax. In Section 3, we prove that softmax scaling on cosine similarity scores with a moderate $\tau$ improves the ID-OOD separability. Here we empirically verify our theoretical results. As shown in Figure $^ { 4 , }$ compared to directly using the maximum cosine similarity without softmax (leftmost figure), softmax scaling with a temperature $\tau = 1$ significantly improves the performance by $2 2 . 6 \%$ in FPR95, and further increasing $\tau$ (e.g., $\tau = 1 0$ ) leads to similar performance. The results are based on ImageNet-100 (ID) versus iNaturalist (OOD).
|
| 152 |
+
|
| 153 |
+
Now, we verify if our theoretical bound $( c , f .$ Theorem $\boxed { 3 . 1 }$ is satisfied empirically as well in Figure 4. From the leftmost figure, we can estimate $\lambda ^ { \mathrm { w o } } \approx 0 . 2 6$ , $\delta \approx 0 . 0 3$ , and $s _ { \hat { y } _ { 2 } } \approx 0 . 2 3$ . By checking the third figure $\mathit { \check { \tau } } = 1$ is the temperature value we use for most experiments), we approximate $\lambda \approx 0 . 0 1 1$ . As $K = 1 0 0$ , we plug in the values and obtain the lower bound $\begin{array} { r } { T = \frac { \lambda ( K - 1 ) \left( \lambda ^ { \mathrm { w o } } + \delta - s _ { \hat { y } _ { 2 } } \right) } { K \lambda - 1 } \approx 0 . 6 5 . } \end{array}$ . Since $\tau = 1 > 0 . 6 5$ , by Theorem $\underline { { \boldsymbol { \mathsf { B . 1 } } } } \big \| _ { \mathsf { \Gamma } }$ applying softmax scaling with $\tau = 1$ is provably superior to without softmax scaling for OOD detection.
|
| 154 |
+
|
| 155 |
+
Are vision-language features better than visual feature alone? MCM can be interpreted as a distance-based approach—images that are closer to one of the $K$ class prototypes are more likely to be ID and vice versa. Here the class prototypes are defined based on a textual encoder. Alternatively, one can define the class prototypes based on visual features. For example, Mahalanobis $\overline { { \lVert \mathscr { Q } 2 \rVert } }$ defines a class prototype as the average of visual embeddings for images belonging to the same class. This raises the question whether MCM (with multi-modal vision-language features) is better than Mahalanobis (with single-modal visual feature). For a fair comparison, we use the same ViT image encoder from CLIP-B. Both MCM and Mahalanobis extract visual features from the penultimate layer. On ImageNet-1k, Mahalanobis displays a limited performance, with $7 3 . 1 4 \%$ AUROC averaged across four OOD test datasets $( 9 0 . 7 7 \%$ for MCM), as shown in Figure $\boxed { 5 }$ From a practical perspective, Mahalanobis requires computing the inverse covariance matrix, which can be both computationally expensive and inaccurate when the number of samples is scarce and the number of ID classes grows. In contrast, MCM is easier to use and more robust.
|
| 156 |
+
|
| 157 |
+

|
| 158 |
+
Figure 5: Comparison with Mahalanobis (Maha) score on ImageNet-1k.
|
| 159 |
+
|
| 160 |
+
MCM without softmax scaling. In Section $\textcircled { 3 }$ we provide theoretical justifications for the necessity of softmax scaling for CLIP-like models. To further verify our observations empirically, we show OOD detection performance based on the maximum cosine similarity score $S _ { \mathrm { M C M } } ^ { \mathrm { w o } } ( \mathbf { x } ^ { \prime } ; \mathcal { V } _ { \mathrm { i n } } , \mathcal { T } , \mathcal { T } ) =$ $\mathrm { m a x } _ { i \in [ K ] } s _ { i } \big ( \mathbf { x } ^ { \prime } \big )$ . The results are shown in Table $\boxed { 4 }$ For easy tasks such as Food-101 $\pmb { \| 3 9 \| }$ , Stanford
|
| 161 |
+
|
| 162 |
+
Table 4: Zero-shot OOD detection of $S _ { \mathrm { M C M } } ^ { \mathrm { w o } }$ based on CLIP-B/16.
|
| 163 |
+
|
| 164 |
+
<table><tr><td rowspan="3">ID Dataset</td><td colspan="8">OOD Dataset</td><td rowspan="2" colspan="2">Average</td></tr><tr><td colspan="2">iNaturalist</td><td colspan="2">SUN</td><td colspan="2">Places</td><td colspan="2">Texture</td></tr><tr><td>FPR95↓</td><td>AUROC↑</td><td>FPR95↓</td><td>AUROC↑</td><td>FPR95↓</td><td>AUROC↑</td><td>FPR95↓</td><td>AUROC↑</td><td>FPR95↓</td><td>AUROC↑</td></tr><tr><td>Stanford-Cars39</td><td>0.00</td><td>100</td><td>0.02</td><td>99.99</td><td>0.26</td><td>99.94</td><td>0.00</td><td>100</td><td>0.07</td><td>99.98</td></tr><tr><td>Food-101</td><td>0.56</td><td>99.86</td><td>0.09</td><td>99.95</td><td>0.49</td><td>99.88</td><td>8.33</td><td>97.44</td><td>2.37</td><td>99.28</td></tr><tr><td>Oxford-Pet 57]</td><td>0.02</td><td>99.98</td><td>0.05</td><td>99.97</td><td>0.20</td><td>99.94</td><td>0.27</td><td>99.91</td><td>0.14</td><td>99.95</td></tr><tr><td>ImageNet-10</td><td>2.40</td><td>99.42</td><td>1.79</td><td>99.55</td><td>2.83</td><td>99.32</td><td>1.86</td><td>99.56</td><td>2.22</td><td>99.46</td></tr><tr><td>ImageNet-20</td><td>14.96</td><td>97.87</td><td>13.10</td><td>97.97</td><td>14.21</td><td>97.67</td><td>13.46</td><td>97.32</td><td>13.93</td><td>97.71</td></tr><tr><td>ImageNet-1k</td><td>61.66</td><td>89.31</td><td>64.39</td><td>87.43</td><td>63.67</td><td>85.95</td><td>86.61</td><td>71.68</td><td>69.08</td><td>83.59</td></tr></table>
|
| 165 |
+
|
| 166 |
+
Cars [39], and Oxford-Pet $ { \mathbb { B } } { \mathbb { Z } }$ as ID, the performance of maximum cosine similarity score is similar to MCM (see Table 1 and Table $\textcircled{2}$ . However, for more challenging tasks such as ImageNet-20 and ImageNet-1k, MCM significantly outperforms that without softmax scaling. For example, the average FPR95 is improved by $1 1 . 3 3 \%$ on ImageNet-20 and $2 6 . 3 4 \%$ on ImageNet-1k, which highlights the necessity of a proper scaling function for CLIP-based OOD detection.
|
| 167 |
+
|
| 168 |
+
MCM for ResNet-based CLIP models. Our main results are based on the CLIP model with ViT image encoder. We additionally investigate the effectiveness of MCM on ResNet-based CLIP. Specifically, we use RN50x4 (178.3M), which shares a similar number of parameters as CLIP-B/16 (149.6M). The results are shown in Table $5 .$ We can see that MCM still shows promising results with ResNet-based CLIP models, and the performance is comparable between $\mathrm { R N } 5 0 \mathrm { x } 4$ and CLIP-B/16 (89.97 vs. 90.77 in AUROC).
|
| 169 |
+
|
| 170 |
+
Table 5: Comparison with ResNet-based CLIP models on ImageNet-1k (ID).
|
| 171 |
+
|
| 172 |
+
<table><tr><td rowspan="2">Model</td><td colspan="7">OOD Dataset</td><td rowspan="2"></td><td colspan="2" rowspan="2">Average</td></tr><tr><td>iNaturalist</td><td></td><td>SUN</td><td></td><td>Places</td><td></td><td>Texture</td><td></td></tr><tr><td></td><td>FPR95↓</td><td>AUROC个</td><td>FPR95↓</td><td>AUROC个</td><td>FPR95↓</td><td>AUROC↑</td><td>FPR95↓</td><td>AUROC↑</td><td>FPR95↓</td><td>AUROC↑</td></tr><tr><td>RN50x4</td><td>44.51</td><td>91.51</td><td>35.11</td><td>92.84</td><td>43.74</td><td>89.60</td><td>57.73</td><td>85.93</td><td>45.27</td><td>89.97</td></tr><tr><td>CLIP-B/16</td><td>30.91</td><td>94.61</td><td>37.59</td><td>92.57</td><td>44.69</td><td>89.77</td><td>57.77</td><td>86.11</td><td>42.74</td><td>90.77</td></tr></table>
|
| 173 |
+
|
| 174 |
+
Effect of prompt ensembling. We examine MCM’s performance with prompt ensembling. For example, Radford et al. $\pmb { \Vert 5 9 } \Vert$ create 80 possible prompts according to the image modalities and nuances in ImageNet. We experiment with the two prompt sets, one of size 80 as in $\mathbb { \left. 5 9 \right. }$ , and our own set of 5 prompts. Ensembles are obtained by averaging the textual features. As expected, using ensembles increases the ID classification accuracy on ImageNet-1k $2 \%$ with CLIP-B and
|
| 175 |
+
|
| 176 |
+
<table><tr><td>A photo of a<label>. A blurryphoto of a<label>. A photo of many <label>. A photo of the large <label>.</td></tr><tr><td></td></tr><tr><td>A photo of the small <label>.</td></tr></table>
|
| 177 |
+
|
| 178 |
+
Table 6: The five prompt templates.
|
| 179 |
+
|
| 180 |
+
$3 \%$ with CLIP-L). For OOD detection, the average FPR95 is reduced from $3 8 . 1 7 \%$ with the default prompt to $3 5 . 2 3 \% \downarrow$ with an ensemble of five prompts shown in Table $6 .$ In addition, the detection performance with 5 prompts is slightly better than with 80 prompts. Note that prompt ensembling does not increase the inference-time cost, as the textual embeddings (across many prompts) can be pre-calculated and averaged into a single embedding.
|
| 181 |
+
|
| 182 |
+
# 6 Related Works
|
| 183 |
+
|
| 184 |
+
OOD detection in computer vision. For open-world multi-class classification, the goal of OOD detection is to derive a binary ID-OOD classifier along with a multi-class classification model for visual inputs. A plethora of methods has been proposed for deep neural networks $\textstyle \left[ \left| 9 1 \right| \right]$ , including generative model-based methods [7, 20, 36, 53, 54, 56, 61, 67, 88], and discriminative-model based methods. For the latter category, an OOD score can be derived based on the softmax output [4, 12, 24, 25, 29, 32, 46, 90], energy-based score [15, 48, 49, 69, 70, 82], gradient information $\bar { \mathbb { B } } \bar { \mathbb { 1 } }$ , or the feature embeddings [14, 42, 65, 66, 71, 72, 85] of a model. Morteza et al. [52], Fang et al. [17], and Bitterwolf et al. [5] provided theoretical analysis for OOD detection. Recent works [63, 83] also explored OOD detection for long-tailed distributions. Works insofar have mostly focused on OOD detection for a task-specific model using only visual information. In contrast, we explore a novel paradigm of zero-shot OOD detection that incorporates rich textual information and can perform a wide variety of tasks.
|
| 185 |
+
|
| 186 |
+
OOD detection in natural language processing. Distribution shifts can occur due to the change of topics and domains, unexpected user utterances, etc. Challenging benchmarks $\pmb { \Vert 3 7 \Vert }$ and characterization of distributional shifts $\mathbb { I I }$ have been proposed in recent years. Compared to early language models such as ConvNets and LSTM $\left[ \left[ 2 8 \right] \right]$ , pre-trained language models are more robust to distribution shifts and more effective at identifying OOD instances [26, 58, 89]. Various algorithmic solutions are proposed to handle OOD detection, including outlier exposure $\pmb { \mathbb { B } } 0 \|$ , model ensembling $\pm \ddagger { 4 } \rVert$ , data augmentation [8, 93, 95], contrastive learning [34, 98], and an auxiliary module that incorporates domain labels $\pmb { \Vert 6 8 \Vert }$ . Tan et al. $\mathbb { [ \overline { { \mathbb { Z } \mathrm { 3 } } } }$ also explore zero-shot OOD detection for text classification tasks. However, prior works focus on pure natural language processing (NLP) settings, while we explore utilizing textual embeddings for zero-shot visual OOD detection.
|
| 187 |
+
|
| 188 |
+
Vision-language models. Utilizing large-scale pre-trained vision-language models for multimodal downstream tasks has become an emerging paradigm with remarkable performance $[ \sqrt { 2 2 } , \sqrt { 7 4 } ]$ . In general, two types of architectures exist: single-stream models like VisualBERT $\mathbb { \lVert \boldsymbol { 4 3 } \rVert }$ and ViLT [35] feed the concatenated text and visual features into a single transformer-based encoder; dual-stream models such as CLIP $\pmb { \Vert 5 9 \Vert }$ , ALIGN $\pmb { \mathbb { B 3 } }$ , and FILIP $\pmb { \Vert } \pmb { \mathscr { Q } } \pmb { \mathscr { Q } } \Vert$ use separate encoders for text and image and optimize with contrastive objectives to align semantically similar features in different modalities. In particular, CLIP enjoys popularity due to its simplicity and strong performance. CLIP-like models inspire numerous follow-up works [45, 94, 97], which aim to improve data efficiency and better adaptation to downstream tasks. This paper adopts CLIP as the target pre-trained model, but our approach can be generally applicable to contrastive models that promote vision-language alignment.
|
| 189 |
+
|
| 190 |
+
Multi-modal OOD detection. Exploring textual information for visual OOD detection is a new area with limited existing works. Fort et al. [19] propose to feed the potential OOD labels to the textual encoder of CLIP [59]. Recently, Esmaeilpour et al. [16] propose to train a label generator based on the visual encoder of CLIP and use the generated labels for OOD detection. While both works rely on a set of candidate OOD labels, MCM is OOD-agnostic and alleviates the need for prior information on OOD. Moreover, prior works [16, 59] only focus on small-scale inputs. We largely expand the scope to a wide range of large-scale realistic datasets, and show new theoretical insights.
|
| 191 |
+
|
| 192 |
+
# 7 Conclusion
|
| 193 |
+
|
| 194 |
+
In this work, we delve into a new landscape for OOD detection, departing from the classic singlemodal toward a multi-modal regime. By viewing the textual features as the “concept prototypes”, we explore a new OOD detection approach MCM, based on the joint vision-language representations. Unlike the majority of OOD detection methods, MCM offers several compelling advantages: trainingfree, generalizable to many tasks, scalable to hundreds of classes, and does not require any prior information on OOD inputs. Moreover, we provide theoretical guarantees on how softmax scaling provably improves zero-shot OOD detection. We investigate the effectiveness of MCM on a wide range of large-scale realistic tasks, including several types of hard OOD datasets. Lastly, we demonstrate the advantage of vision-language features over pure visual features for OOD detection. We hope our work will inspire future research toward multi-modal OOD detection.
|
| 195 |
+
|
| 196 |
+
# Acknowledgement
|
| 197 |
+
|
| 198 |
+
The authors wish to thank Junjie Hu, Ying Fan, Ruisu Zhang, Andrew Geng, and Soumya Suvra Ghosal for the helpful discussions. The work is supported by a Google-Initiated Research Grant, and gift funding from Adobe Research.
|
| 199 |
+
|
| 200 |
+
# References
|
| 201 |
+
|
| 202 |
+
[1] Udit Arora, William Huang, and He He. Types of out-of-distribution texts and how to detect them. In Conference on Empirical Methods in Natural Language Processing (EMNLP), 2021.
|
| 203 |
+
[2] Andrei Barbu, David Mayo, Julian Alverio, William Luo, Christopher Wang, Dan Gutfreund, Josh Tenenbaum, and Boris Katz. Objectnet: A large-scale bias-controlled dataset for pushing the limits of object recognition models. In Conference on Neural Information Processing Systems (NeurIPS), 2019.
|
| 204 |
+
[3] Sara Beery, Grant Van Horn, and Pietro Perona. Recognition in terra incognita. In The European Conference on Computer Vision (ECCV), 2018.
|
| 205 |
+
[4] Abhijit Bendale and Terrance E Boult. Towards open set deep networks. In The IEEE / CVF Computer Vision and Pattern Recognition Conference (CVPR), 2016.
|
| 206 |
+
[5] Julian Bitterwolf, Alexander Meinke, Maximilian Augustin, and Matthias Hein. Breaking down out-of-distribution detection: Many methods based on ood training data estimate a combination of the same core quantities. In International Conference on Machine Learning, pages 2041–2074. PMLR, 2022.
|
| 207 |
+
[6] Lukas Bossard, Matthieu Guillaumin, and Luc Van Gool. Food-101 – mining discriminative components with random forests. In The European Conference on Computer Vision (ECCV), 2014.
|
| 208 |
+
[7] Mu Cai and Yixuan Li. Out-of-distribution detection via frequency-regularized generative models. In Proceedings of IEEE/CVF Winter Conference on Applications of Computer Vision, 2023.
|
| 209 |
+
[8] Derek Chen and Zhou Yu. Gold: improving out-of-scope detection in dialogues using data augmentation. arXiv preprint arXiv:2109.03079, 2021.
|
| 210 |
+
[9] Jiefeng Chen, Yixuan Li, Xi Wu, Yingyu Liang, and Somesh Jha. Atom: Robustifying out-ofdistribution detection using outlier mining. In The European Conference on Machine Learning and Principles and Practice of Knowledge Discovery in Databases (ECML PKDD), 2021.
|
| 211 |
+
[10] Mircea Cimpoi, Subhransu Maji, Iasonas Kokkinos, Sammy Mohamed, and Andrea Vedaldi. Describing textures in the wild. In The IEEE / CVF Computer Vision and Pattern Recognition Conference (CVPR), 2014.
|
| 212 |
+
[11] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In The IEEE / CVF Computer Vision and Pattern Recognition Conference (CVPR), 2009.
|
| 213 |
+
[12] Terrance DeVries and Graham W Taylor. Learning confidence for out-of-distribution detection in neural networks. arXiv preprint arXiv:1802.04865, 2018.
|
| 214 |
+
[13] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations (ICLR), 2021.
|
| 215 |
+
[14] Xuefeng Du, Gabriel Gozum, Yifei Ming, and Yixuan Li. Siren: Shaping representations for detecting out-of-distribution objects. In Advances in Neural Information Processing Systems (NeurIPS), 2022.
|
| 216 |
+
[15] Xuefeng Du, Zhaoning Wang, Mu Cai, and Yixuan Li. Vos: Learning what you don’t know by virtual outlier synthesis. In Proceedings of the International Conference on Learning Representations (ICLR), 2022.
|
| 217 |
+
[16] Sepideh Esmaeilpour, Bing Liu, Eric Robertson, and Lei Shu. Zero-shot open set detection by extending clip. In The AAAI Conference on Artificial Intelligence (AAAI), 2022.
|
| 218 |
+
[17] Zhen Fang, Yixuan Li, Jie Lu, Jiahua Dong, Bo Han, and Feng Liu. Is out-of-distribution detection learnable? In Advances in Neural Information Processing System (NeurIPS), 2022.
|
| 219 |
+
[18] Christiane Fellbaum. Wordnet. In Theory and Applications of Ontology: Computer Applications, pages 231–243. Springer, 2010.
|
| 220 |
+
[19] Stanislav Fort, Jie Ren, and Balaji Lakshminarayanan. Exploring the limits of out-of-distribution detection. In Conference on Neural Information Processing Systems (NeurIPS), 2021.
|
| 221 |
+
[20] ZongYuan Ge, Sergey Demyanov, Zetao Chen, and Rahil Garnavi. Generative openmax for multi-class open set classification. arXiv preprint arXiv:1707.07418, 2017.
|
| 222 |
+
[21] Robert Geirhos, Patricia Rubisch, Claudio Michaelis, Matthias Bethge, Felix A. Wichmann, and Wieland Brendel. Imagenet-trained CNNs are biased towards texture; increasing shape bias improves accuracy and robustness. In International Conference on Learning Representations (ICLR), 2019.
|
| 223 |
+
[22] Jiuxiang Gu, Jason Kuen, Shafiq Joty, Jianfei Cai, Vlad Morariu, Handong Zhao, and Tong Sun. Self-supervised relationship probing. In Conference on Neural Information Processing Systems (NeurIPS), 2020.
|
| 224 |
+
[23] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In The IEEE / CVF Computer Vision and Pattern Recognition Conference (CVPR), 2016.
|
| 225 |
+
[24] Matthias Hein, Maksym Andriushchenko, and Julian Bitterwolf. Why relu networks yield high-confidence predictions far away from the training data and how to mitigate the problem. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR, pages 41–50, 2019.
|
| 226 |
+
[25] Dan Hendrycks and Kevin Gimpel. A baseline for detecting misclassified and out-of-distribution examples in neural networks. In International Conference on Learning Representations (ICLR), 2017.
|
| 227 |
+
[26] Dan Hendrycks, Xiaoyuan Liu, Eric Wallace, Adam Dziedzic, Rishabh Krishnan, and Dawn Song. Pretrained transformers improve out-of-distribution robustness. In Association for Computational Linguistics (ACL), 2020.
|
| 228 |
+
[27] Dan Hendrycks, Mantas Mazeika, and Thomas Dietterich. Deep anomaly detection with outlier exposure. In International Conference on Learning Representations (ICLR), 2018.
|
| 229 |
+
[28] Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8):1735–1780, 1997.
|
| 230 |
+
[29] Yen-Chang Hsu, Yilin Shen, Hongxia Jin, and Zsolt Kira. Generalized odin: Detecting out-ofdistribution image without learning from out-of-distribution data. In The IEEE / CVF Computer Vision and Pattern Recognition Conference (CVPR), 2020.
|
| 231 |
+
[30] Yibo Hu and Latifur Khan. Uncertainty-aware reliable text classification. In SIGKDD Conference on Knowledge Discovery and Data Mining (KDD), 2021.
|
| 232 |
+
[31] Rui Huang, Andrew Geng, and Yixuan Li. On the importance of gradients for detecting distributional shifts in the wild. In Conference on Neural Information Processing Systems (NeurIPS), 2021.
|
| 233 |
+
[32] Rui Huang and Yixuan Li. Mos: Towards scaling out-of-distribution detection for large semantic space. In The IEEE / CVF Computer Vision and Pattern Recognition Conference (CVPR), 2021.
|
| 234 |
+
[33] 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 (ICML), 2021.
|
| 235 |
+
[34] Di Jin, Shuyang Gao, Seokhwan Kim, Yang Liu, and Dilek Hakkani-Tur. Towards textual out-of-domain detection without in-domain labels. IEEE/ACM Transactions on Audio, Speech, and Language Processing, 2022.
|
| 236 |
+
[35] Wonjae Kim, Bokyung Son, and Ildoo Kim. Vilt: Vision-and-language transformer without convolution or region supervision. In International Conference on Machine Learning (ICML), 2021.
|
| 237 |
+
[36] Polina Kirichenko, Pavel Izmailov, and Andrew G Wilson. Why normalizing flows fail to detect out-of-distribution data. Conference on Neural Information Processing Systems (NeurIPS), 2020.
|
| 238 |
+
[37] Pang Wei Koh, Shiori Sagawa, Henrik Marklund, Sang Michael Xie, Marvin Zhang, Akshay Balsubramani, Weihua Hu, Michihiro Yasunaga, Richard Lanas Phillips, Irena Gao, et al. Wilds: A benchmark of in-the-wild distribution shifts. In International Conference on Machine Learning (ICML), 2021.
|
| 239 |
+
[38] Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, and Neil Houlsby. Big transfer (bit): General visual representation learning. In The European Conference on Computer Vision (ECCV), 2020.
|
| 240 |
+
[39] Jonathan Krause, Michael Stark, Jia Deng, and Li Fei-Fei. 3d object representations for fine-grained categorization. In 4th International IEEE Workshop on 3D Representation and Recognition (3dRR-13), Sydney, Australia, 2013.
|
| 241 |
+
[40] Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009.
|
| 242 |
+
[41] Ya Le and Xuan Yang. Tiny imagenet visual recognition challenge. CS 231N, 7(7):3, 2015.
|
| 243 |
+
[42] Kimin Lee, Kibok Lee, Honglak Lee, and Jinwoo Shin. A simple unified framework for detecting out-of-distribution samples and adversarial attacks. In Conference on Neural Information Processing Systems (NeurIPS), 2018.
|
| 244 |
+
[43] 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.
|
| 245 |
+
[44] Xiaoya Li, Jiwei Li, Xiaofei Sun, Chun Fan, Tianwei Zhang, Fei Wu, Yuxian Meng, and Jun Zhang. kfolden: k-fold ensemble for out-of-distribution detection. In Conference on Empirical Methods in Natural Language Processing (EMNLP), 2021.
|
| 246 |
+
[45] 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. In International Conference on Learning Representations (ICLR), 2022.
|
| 247 |
+
[46] Shiyu Liang, Yixuan Li, and Rayadurgam Srikant. Enhancing the reliability of out-ofdistribution image detection in neural networks. In International Conference on Learning Representations (ICLR), 2018.
|
| 248 |
+
[47] 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 The European Conference on Computer Vision (ECCV), 2014.
|
| 249 |
+
[48] Weitang Liu, Xiaoyun Wang, John Owens, and Yixuan Li. Energy-based out-of-distribution detection. In Conference on Neural Information Processing Systems (NeurIPS), 2020.
|
| 250 |
+
[49] Yifei Ming, Ying Fan, and Yixuan Li. Poem: Out-of-distribution detection with posterior sampling. In International Conference on Machine Learning (ICML), 2022.
|
| 251 |
+
[50] Yifei Ming, Hang Yin, and Yixuan Li. On the impact of spurious correlation for out-ofdistribution detection. The AAAI Conference on Artificial Intelligence (AAAI), 2022.
|
| 252 |
+
[51] Ron Mokady, Amir Hertz, and Amit H Bermano. Clipcap: Clip prefix for image captioning. arXiv preprint arXiv:2111.09734, 2021.
|
| 253 |
+
[52] Peyman Morteza and Yixuan Li. Provable guarantees for understanding out-of-distribution detection. The AAAI Conference on Artificial Intelligence (AAAI), 2022.
|
| 254 |
+
[53] Eric Nalisnick, Akihiro Matsukawa, Yee Whye Teh, Dilan Gorur, and Balaji Lakshminarayanan. Do deep generative models know what they don’t know? In International Conference on Learning Representations (ICLR), 2019.
|
| 255 |
+
[54] Lawrence Neal, Matthew Olson, Xiaoli Fern, Weng-Keen Wong, and Fuxin Li. Open set learning with counterfactual images. In The European Conference on Computer Vision (ECCV), 2018.
|
| 256 |
+
[55] Edwin G. Ng, Bo Pang, Piyush Sharma, and Radu Soricut. Understanding guided image captioning performance across domains. arXiv preprint arXiv:2012.02339, 2020.
|
| 257 |
+
[56] Poojan Oza and Vishal M Patel. C2ae: Class conditioned auto-encoder for open-set recognition. In The IEEE / CVF Computer Vision and Pattern Recognition Conference (CVPR), 2019.
|
| 258 |
+
[57] Omkar M. Parkhi, Andrea Vedaldi, Andrew Zisserman, and C. V. Jawahar. Cats and dogs. In The IEEE / CVF Computer Vision and Pattern Recognition Conference (CVPR), 2012.
|
| 259 |
+
[58] Alexander Podolskiy, Dmitry Lipin, Andrey Bout, Ekaterina Artemova, and Irina Piontkovskaya. Revisiting mahalanobis distance for transformer-based out-of-domain detection. In The AAAI Conference on Artificial Intelligence (AAAI), 2021.
|
| 260 |
+
[59] 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 (ICML), 2021.
|
| 261 |
+
[60] 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.
|
| 262 |
+
[61] 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 Conference on Neural Information Processing Systems (NeurIPS), 2019.
|
| 263 |
+
[62] Marco Tulio Ribeiro, Sameer Singh, and Carlos Guestrin. " why should i trust you?" explaining the predictions of any classifier. In SIGKDD Conference on Knowledge Discovery and Data Mining (KDD), 2016.
|
| 264 |
+
[63] Abhijit Guha Roy, Jie Ren, Shekoofeh Azizi, Aaron Loh, Vivek Natarajan, Basil Mustafa, Nick Pawlowski, Jan Freyberg, Yuan Liu, Zach Beaver, et al. Does your dermatology classifier know what it doesn’t know? detecting the long-tail of unseen conditions. Medical Image Analysis, 75:102274, 2022.
|
| 265 |
+
[64] 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), 2019.
|
| 266 |
+
[65] Chandramouli Shama Sastry and Sageev Oore. Detecting out-of-distribution examples with Gram matrices. In International Conference on Machine Learning (ICML), 2020.
|
| 267 |
+
[66] Vikash Sehwag, Mung Chiang, and Prateek Mittal. Ssd: A unified framework for self-supervised outlier detection. In International Conference on Learning Representations (ICLR), 2021.
|
| 268 |
+
[67] Joan Serrà, David Álvarez, Vicenç Gómez, Olga Slizovskaia, José F. Núñez, and Jordi Luque. Input complexity and out-of-distribution detection with likelihood-based generative models. In International Conference on Learning Representations (ICLR), 2020.
|
| 269 |
+
[68] Yilin Shen, Yen-Chang Hsu, Avik Ray, and Hongxia Jin. Enhancing the generalization for intent classification and out-of-domain detection in slu. arXiv preprint arXiv:2106.14464, 2021.
|
| 270 |
+
[69] Yiyou Sun, Chuan Guo, and Yixuan Li. React: Out-of-distribution detection with rectified activations. In Conference on Neural Information Processing Systems (NeurIPS), 2021.
|
| 271 |
+
[70] Yiyou Sun and Yixuan Li. Dice: Leveraging sparsification for out-of-distribution detection. In Proceedings of European Conference on Computer Vision (ECCV), 2022.
|
| 272 |
+
[71] Yiyou Sun, Yifei Ming, Xiaojin Zhu, and Yixuan Li. Out-of-distribution detection with deep nearest neighbors. In International Conference on Machine Learning (ICML), 2022.
|
| 273 |
+
[72] Jihoon Tack, Sangwoo Mo, Jongheon Jeong, and Jinwoo Shin. Csi: Novelty detection via contrastive learning on distributionally shifted instances. In Conference on Neural Information Processing Systems (NeurIPS), 2020.
|
| 274 |
+
[73] Ming Tan, Yang Yu, Haoyu Wang, Dakuo Wang, Saloni Potdar, Shiyu Chang, and Mo Yu. Out-of-domain detection for low-resource text classification tasks. In Conference on Empirical Methods in Natural Language Processing (EMNLP), 2019.
|
| 275 |
+
[74] Shagun Uppal, Sarthak Bhagat, Devamanyu Hazarika, Navonil Majumder, Soujanya Poria, Roger Zimmermann, and Amir Zadeh. Multimodal research in vision and language: A review of current and emerging trends. Information Fusion, 77:149–171, 2022.
|
| 276 |
+
[75] Aaron Van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv e-prints, pages arXiv–1807, 2018.
|
| 277 |
+
[76] Grant Van Horn, Oisin Mac Aodha, Yang Song, Yin Cui, Chen Sun, Alex Shepard, Hartwig Adam, Pietro Perona, and Serge Belongie. The inaturalist species classification and detection dataset. In The IEEE / CVF Computer Vision and Pattern Recognition Conference (CVPR), 2018.
|
| 278 |
+
[77] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. Conference on Neural Information Processing Systems (NeurIPS), 2017.
|
| 279 |
+
[78] Sagar Vaze, Kai Han, Andrea Vedaldi, and Andrew Zisserman. Open-set recognition: A good closed-set classifier is all you need. In International Conference on Learning Representations (ICLR), 2022.
|
| 280 |
+
[79] Roman Vershynin. High-dimensional probability: An introduction with applications in data science, volume 47. Cambridge university press, 2018.
|
| 281 |
+
[80] C. Wah, S. Branson, P. Welinder, P. Perona, and S. Belongie. The caltech-ucsd birds-200-2011 dataset. Technical Report CNS-TR-2011-001, California Institute of Technology, 2011.
|
| 282 |
+
[81] Feng Wang and Huaping Liu. Understanding the behaviour of contrastive loss. In The IEEE / CVF Computer Vision and Pattern Recognition Conference (CVPR), 2021.
|
| 283 |
+
[82] Haoran Wang, Weitang Liu, Alex Bocchieri, and Yixuan Li. Can multi-label classification networks know what they don’t know? Proceedings of the Advances in Neural Information Processing Systems (NeurIPS), 2021.
|
| 284 |
+
[83] Haotao Wang, Aston Zhang, Yi Zhu, Shuai Zheng, Mu Li, Alex J Smola, and Zhangyang Wang. Partial and asymmetric contrastive learning for out-of-distribution detection in long-tailed recognition. In International Conference on Machine Learning (ICML), 2022.
|
| 285 |
+
[84] Tongzhou Wang and Phillip Isola. Understanding contrastive representation learning through alignment and uniformity on the hypersphere. In International Conference on Machine Learning (ICML), 2020.
|
| 286 |
+
[85] Jim Winkens, Rudy Bunel, Abhijit Guha Roy, Robert Stanforth, Vivek Natarajan, Joseph R Ledsam, Patricia MacWilliams, Pushmeet Kohli, Alan Karthikesalingam, Simon Kohl, et al. Contrastive training for improved out-of-distribution detection. arXiv preprint arXiv:2007.05566, 2020.
|
| 287 |
+
[86] Jianxiong Xiao, James Hays, Krista A Ehinger, Aude Oliva, and Antonio Torralba. Sun database: Large-scale scene recognition from abbey to zoo. In The IEEE / CVF Computer Vision and Pattern Recognition Conference (CVPR), 2010.
|
| 288 |
+
[87] Kai Yuanqing Xiao, Logan Engstrom, Andrew Ilyas, and Aleksander Madry. Noise or signal: The role of image backgrounds in object recognition. In International Conference on Learning Representations (ICLR), 2021.
|
| 289 |
+
[88] Zhisheng Xiao, Qing Yan, and Yali Amit. Likelihood regret: An out-of-distribution detection score for variational auto-encoder. In Conference on Neural Information Processing Systems (NeurIPS), volume 33, 2020.
|
| 290 |
+
[89] Keyang Xu, Tongzheng Ren, Shikun Zhang, Yihao Feng, and Caiming Xiong. Unsupervised outof-domain detection via pre-trained transformers. In Association for Computational Linguistics (ACL), 2021.
|
| 291 |
+
[90] Jingkang Yang, Haoqi Wang, Litong Feng, Xiaopeng Yan, Huabin Zheng, Wayne Zhang, and Ziwei Liu. Semantically coherent out-of-distribution detection. In Proceedings of the IEEE International Conference on Computer Vision (ICCV), 2021.
|
| 292 |
+
[91] Jingkang Yang, Kaiyang Zhou, Yixuan Li, and Ziwei Liu. Generalized out-of-distribution detection: A survey. arXiv preprint arXiv:2110.11334, 2021.
|
| 293 |
+
[92] Lewei Yao, Runhui Huang, Lu Hou, Guansong Lu, Minzhe Niu, Hang Xu, Xiaodan Liang, Zhenguo Li, Xin Jiang, and Chunjing Xu. Filip: Fine-grained interactive language-image pre-training. International Conference on Learning Representations (ICLR), 2021.
|
| 294 |
+
[93] Li-Ming Zhan, Haowen Liang, Bo Liu, Lu Fan, Xiao-Ming Wu, and Albert Lam. Out-of-scope intent detection with self-supervision and discriminative training. Association for Computational Linguistics (ACL), 2021.
|
| 295 |
+
[94] Renrui Zhang, Rongyao Fang, Peng Gao, Wei Zhang, Kunchang Li, Jifeng Dai, Yu Qiao, and Hongsheng Li. Tip-adapter: Training-free clip-adapter for better vision-language modeling. arXiv preprint arXiv:2111.03930, 2021.
|
| 296 |
+
[95] Yinhe Zheng, Guanyi Chen, and Minlie Huang. Out-of-domain detection for natural language understanding in dialog systems. TASLP, 2020.
|
| 297 |
+
[96] Bolei Zhou, Agata Lapedriza, Aditya Khosla, Aude Oliva, and Antonio Torralba. Places: A 10 million image database for scene recognition. IEEE Transactions on Pattern Analysis and Machine Intelligence (TPAMI), 2017.
|
| 298 |
+
[97] Kaiyang Zhou, Jingkang Yang, Chen Change Loy, and Ziwei Liu. Conditional prompt learning for vision-language models. In The IEEE / CVF Computer Vision and Pattern Recognition Conference (CVPR), 2022.
|
| 299 |
+
[98] Wenxuan Zhou, Fangyu Liu, and Muhao Chen. Contrastive out-of-distribution detection for pretrained transformers. Conference on Empirical Methods in Natural Language Processing (EMNLP), 2021.
|
| 300 |
+
[99] Zhuotun Zhu, Lingxi Xie, and Alan Yuille. Object recognition with and without objects. In International Joint Conferences on Artificial Intelligence (IJCAI), 2017.
|
| 301 |
+
|
| 302 |
+
# Checklist
|
| 303 |
+
|
| 304 |
+
1. For all authors...
|
| 305 |
+
|
| 306 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 307 |
+
(b) Did you describe the limitations of your work? [N/A]
|
| 308 |
+
(c) Did you discuss any potential negative societal impacts of your work? [N/A]
|
| 309 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 310 |
+
|
| 311 |
+
2. If you are including theoretical results...
|
| 312 |
+
|
| 313 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] See Section 3 and Section A (b) Did you include complete proofs of all theoretical results? [Yes] See Section A
|
| 314 |
+
|
| 315 |
+
3. If you ran experiments...
|
| 316 |
+
|
| 317 |
+
(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] See Section B
|
| 318 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 4 and Section B
|
| 319 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A] There is no training involved in MCM. For fair comparison and reproducibility, we use the publicly available checkpoints of CLIP from OpenAI.
|
| 320 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Section B
|
| 321 |
+
|
| 322 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 323 |
+
|
| 324 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes] See Section B
|
| 325 |
+
(b) Did you mention the license of the assets? [N/A]
|
| 326 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] See Section B
|
| 327 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 328 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 329 |
+
|
| 330 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 331 |
+
|
| 332 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 333 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 334 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/Kwm8I7dU-l5/Kwm8I7dU-l5.md
ADDED
|
@@ -0,0 +1,441 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GRAPH-GUIDED NETWORK FOR IRREGULARLY SAMPLED MULTIVARIATE TIME SERIES
|
| 2 |
+
|
| 3 |
+
Xiang Zhang
|
| 4 |
+
Harvard University
|
| 5 |
+
xiang_zhang@hms.harvard.edu
|
| 6 |
+
Marko Zeman
|
| 7 |
+
University of Ljubljana
|
| 8 |
+
marko.zeman@fri.uni-lj.si
|
| 9 |
+
|
| 10 |
+
# Marinka Zitnik
|
| 11 |
+
|
| 12 |
+
Theodoros Tsiligkaridis MIT Lincoln Laboratory ttsili@ll.mit.edu
|
| 13 |
+
|
| 14 |
+
Harvard University marinka@hms.harvard.edu
|
| 15 |
+
|
| 16 |
+
# ABSTRACT
|
| 17 |
+
|
| 18 |
+
In many domains, including healthcare, biology, and climate science, time series are irregularly sampled with varying time intervals between successive readouts and different subsets of variables (sensors) observed at different time points. Here, we introduce RAINDROP, a graph neural network that embeds irregularly sampled and multivariate time series while also learning the dynamics of sensors purely from observational data. RAINDROP represents every sample as a separate sensor graph and models time-varying dependencies between sensors with a novel message passing operator. It estimates the latent sensor graph structure and leverages the structure together with nearby observations to predict misaligned readouts. This model can be interpreted as a graph neural network that sends messages over graphs that are optimized for capturing time-varying dependencies among sensors. We use RAINDROP to classify time series and interpret temporal dynamics on three healthcare and human activity datasets. RAINDROP outperforms state-of-the-art methods by up to $1 1 . 4 \%$ (absolute F1-score points), including techniques that deal with irregular sampling using fixed discretization and set functions. RAINDROP shows superiority in diverse setups, including challenging leave-sensor-out settings.
|
| 19 |
+
|
| 20 |
+
# 1 INTRODUCTION
|
| 21 |
+
|
| 22 |
+
Multivariate time series are prevalent in a variety of domains, including healthcare, space science, cyber security, biology, and finance (Ravuri et al., 2021; Sousa et al., 2020; Sezer et al., 2020; Fawaz et al., 2019). Practical issues often exist in collecting sensor measurements that lead to various types of irregularities caused by missing observations, such as saving costs, sensor failures, external forces in physical systems, medical interventions, to name a few (Choi et al., 2020). While temporal machine learning models typically assume fully observed and fixed-size inputs, irregularly sampled time series raise considerable challenges (Shukla & Marlin, 2021; Hu et al., 2021). For example, observations of different sensors might not be aligned, time intervals among adjacent observations are different across sensors, and different samples have different numbers of observations for different subsets of sensors recorded at different time points (Horn et al., 2020; Wang et al., 2011).
|
| 23 |
+
|
| 24 |
+
Prior methods for dealing with irregularly sampled time series involve filling in missing values using interpolation, kernel methods, and probabilistic approaches (Schafer & Graham, 2002). However, the absence of observations can be informative on its own (Little & Rubin, 2014) and thus imputing missing observations is not necessarily beneficial (Agniel et al., 2018). While modern techniques involve recurrent neural network architectures (e.g., RNN, LSTM, GRU) (Cho et al., 2014) and transformers (Vaswani et al., 2017), they are restricted to regular sampling or assume aligned measurements across modalities. For misaligned measurements, existing methods tend to rely on a two-stage approach that first imputes missing values to produce a regularly-sampled dataset and then optimizes a model of choice for downstream performance. This decoupled approach does not fully exploit informative missingness patterns or deal with irregular sampling, thus producing suboptimal performance (Wells et al., 2013; Li & Marlin, 2016). Thus, recent methods circumvent the imputation stage and directly model irregularly sampled time series (Che et al., 2018; Horn et al., 2020).
|
| 25 |
+
|
| 26 |
+
Previous studies (Wu et al., 2021; Li et al., 2020a; Zhang et al., 2019) have noted that inter-sensor correlations bring rich information in modeling time series. However, only few studies consider relational structure of irregularly sampled time series, and those which do have limited ability in capturing inter-sensor connections (Wu et al., 2021; Shukla & Marlin, 2018). In contrast, we integrate recent advances in graph neural networks to take advantage of relational structure among sensors. We learn latent graphs from multivariate time series and model time-varying inter-sensor dependencies through neural message passing, establishing graph neural networks as a way to model sample-varying and time-varying structure in complex time series.
|
| 27 |
+
|
| 28 |
+
Present work. To address the characteristics of irregularly sampled time series, we propose to model temporal dynamics of sensor dependencies and how those relationships evolve over time. Our intuitive assumption is that the observed sensors can indicate how the unobserved sensors currently behave, which can further improve the representation learning of irregular multivariate time series. We develop RAINDROP1, a graph neural network that leverages relational structure to embed and classify irregularly sampled multivariate time series. RAINDROP takes samples as input, each sample containing multiple sensors and each sensor consisting of irregularly recorded observations (e.g., in clinical data, an individual patient’s state of health is recorded at irregular time intervals with different subsets of sensors observed at different times). RAINDROP model is inspired by how raindrops hit a surface at varying times and create ripple effects that propagate through the surface. Mathematically, in RAINDROP, observations (i.e., raindrops) hit a sensor graph (i.e., surface) asynchronously and at irregular time intervals. Every observation is processed by passing messages to neighboring sensors (i.e., creating ripples), taking into account the learned sensor dependencies (Figure 1). As such, RAINDROP can handle misaligned observations, varying time gaps, arbitrary numbers of observations, and produce multi-scale embeddings via a novel hierarchical attention.
|
| 29 |
+
|
| 30 |
+

|
| 31 |
+
Figure 1: The RAINDROP approach. For sample $\boldsymbol { S } _ { i }$ , sensor $u$ is recorded at time $t _ { 1 }$ as value $\boldsymbol { x } _ { i , u } ^ { t _ { 1 } }$ , triggering a propagation and transformation of neural messages along edges of $\boldsymbol { S } _ { i }$ ’s sensor dependency graph.
|
| 32 |
+
|
| 33 |
+
We represent dependencies with a separate sensor graph for every sample wherein nodes indicate sensors and edges denote relationships between them. Sensor graphs are latent in the sense that graph connectivity is learned by RAINDROP purely from observational time series. In addition to capturing sensor dependencies within each sample, RAINDROP i) takes advantage of similarities between different samples by sharing parameters when calculating attention weights, and ii) considers importance of sequential sensor observations via temporal attention.
|
| 34 |
+
|
| 35 |
+
RAINDROP adaptively estimates observations based on both neighboring readouts in the temporal domain and similar sensors as determined by the connectivity of optimized sensor graphs. We compare RAINDROP to five state-of-the-art methods on two healthcare datasets and an activity recognition dataset across three experimental settings, including a setup where a subset of sensors in the test set is malfunctioning (i.e., have no readouts at all). Experiments show that RAINDROP outperforms baselines on all datasets with an average AUROC improvement of $3 . 5 \%$ in absolute points on various classification tasks. Further, RAINDROP improves prior work by a $9 . 3 \%$ margin (absolute points in accuracy) when varying subsets of sensors malfunction.
|
| 36 |
+
|
| 37 |
+
# 2 RELATED WORK
|
| 38 |
+
|
| 39 |
+
Our work here builds on time-series representation learning and notions of graph neural networks and attempts to resolve them by developing a single, unified approach for analysis of complex time series.
|
| 40 |
+
|
| 41 |
+
Learning with irregularly sampled multivariate time series. Irregular time series are characterized by varying time intervals between adjacent observations (Zerveas et al., 2021; Tipirneni &
|
| 42 |
+
|
| 43 |
+
Reddy, 2021; Chen et al., 2020). In a multivariate case, irregularity means that observations can be misaligned across different sensors, which can further complicate the analysis. Further, because of a multitude of sampling frequencies and varying time intervals, the number of observations can also vary considerably across samples (Fang & Wang, 2020; Kidger et al., 2020). Predominant downstream tasks for time series are classification (i.e., predicting a label for a given sample, e.g., Tan et al. (2020); Ma et al. (2020)) and forecasting (i.e., anticipating future observations based on historical observations, e.g., Wu et al. (2020a)). The above mentioned characteristics create considerable challenges for models that expect well-aligned and fixed-size inputs (Shukla & Marlin, 2020). An intuitive way to deal with irregular time series is to impute missing values and process them as regular time series (Mikalsen et al., 2021; Li & Marlin, 2020; Shan & Oliva, 2021). However, imputation methods can distort the underlying distribution and lead to unwanted distribution shifts. To this end, recent methods directly learn from irregularly sampled time series (Chen et al., 2018). For example, Che et al. (2018) develop a decay mechanism based on gated recurrent units (GRU-D) and binary masking to capture long-range temporal dependencies. SeFT (Horn et al., 2020) takes a set-based approach and transforms irregularly sampled time series datasets into sets of observations modeled by set functions insensitive to misalignment. mTAND (Shukla & Marlin, 2021) leverages a multi-time attention mechanism to learn temporal similarity from non-uniformly collected measurements and produce continuous-time embeddings. IP-Net (Shukla & Marlin, 2018) and $D G M ^ { 2 }$ (Wu et al., 2021) adopt imputation to interpolate irregular time series against a set of reference points using a kernel-based approach. The learned inter-sensor relations are static ignoring sample-specific and time-specific characteristics. In contrast with the above methods, RAINDROP leverages dynamic graphs to address the characteristics of irregular time series and produce high-quality representations.
|
| 44 |
+
|
| 45 |
+
Learning with graphs and neural message passing. There has been a surge of interest in applying neural networks to graphs, leading to the development of graph embeddings (Zhou et al., 2020; Li et al., 2021), graph neural networks (Wu et al., 2020b), and message passing neural networks (Gilmer et al., 2017). To address the challenges of irregular time series, RAINDROP specifies a message passing strategy to exchange neural message along edges of sensor graphs and deal with misaligned sensor readouts (Riba et al., 2018; Nikolentzos et al., 2020; Galkin et al., 2020; Fey et al., 2020; Lin et al., 2018; Zhang et al., 2020). In particular, RAINDROP considers message passing on latent sensor graphs, each graph describing a different sample (e.g., patient, Figure 1), and it specifies a message-passing network with learnable adjacency matrices. The key difference with the predominant use of message passing is that RAINDROP uses it to estimate edges (dependencies) between sensors rather than applying it on a fixed, apriori-given graph. To the best of our knowledge, prior work did not utilize sensor dependencies for irregularly sampled time series. While prior work used message passing for regular time series (Wang et al., 2020; Wu et al., 2020c; Kalinicheva et al., 2020; Zha et al., 2022), its utility for irregularly sampled time series has not yet been studied.
|
| 46 |
+
|
| 47 |
+
# 3 RAINDROP
|
| 48 |
+
|
| 49 |
+
Let $\mathcal { D } = \{ ( S _ { i } , y _ { i } ) \ | \ i = 1 , \ldots , N \}$ denote an irregular time series dataset with $N$ labeled samples (Figure 2). Every sample $\boldsymbol { S } _ { i }$ is an irregular multivariate time series with a corresponding label $y _ { i } \in \{ 1 , \ldots , C \}$ , indicating which of the $C$ classes $s _ { i }$ is associated with. Each sample contains $M$ non-uniformly measured sensors that are denoted as $u , v$ , etc. RAINDROP can also work on samples with only a subset of active sensors (see Sec. 4.1). Each sensor is given by a sequence of observations ordered by time. For sensor $u$ in sample $s _ { i }$ , we denote a single observation as a tuple $( t , x _ { i , u } ^ { t } )$ , meaning that sensor $u$ was recorded with value $x _ { i , u } ^ { t } \in \mathbb { R }$ at timestamp $t \in \mathbb { R } ^ { + }$ . We omit sample index $i$ and sensor index $u$ in timestamp $t$ . Sensor observations are irregularly recorded, meaning that time intervals between successive observations can vary across sensors. For sensor $u$ in sample $s _ { i }$ , we use $\mathcal { T } _ { i , u }$ to denote the set of timestamps that $u$ , or at least one of $u$ ’s $L$ -hop neighbors ( $L$ is the number of layers in RAINDROP’s message passing) is recorded. We use $| |$ and $_ T$ to denote concatenation and transpose, respectively. We omit layer index $l \in \{ 1 , \ldots , L \}$ for simplicity when clear from the text.
|
| 50 |
+
|
| 51 |
+
Problem (Representation learning for irregularly sampled multivariate time series). A dataset $\mathcal { D }$ of irregularly sampled multivariate time series is given, where each sample $s _ { i }$ has multiple sensors and each sensor has a variable number of observations. RAINDROP learns a function $f : S _ { i } \to z _ { i }$ that maps $s _ { i }$ to a fixed-length representation $z _ { i }$ suitable for downstream task of interest, such as classification. Using learned $z _ { i }$ , RAINDROP can predict label $\hat { y } _ { i } \in \{ 1 , \ldots , C \}$ for $S _ { i }$ .
|
| 52 |
+
|
| 53 |
+
RAINDROP learns informative embeddings for irregularly samples time series. The learned embeddings capture temporal patterns of irregular observations and explicitly consider varying dependencies between sensors. While we focus on time-series classification in this work, the proposed method can be easily extended to broader applications such as regression, clustering and generation tasks.
|
| 54 |
+
|
| 55 |
+
# 3.1 OVERVIEW OF RAINDROP
|
| 56 |
+
|
| 57 |
+
RAINDROP aims to learn a fixed-dimensional embedding $z _ { i }$ for a given sample $S _ { i }$ and predict the associated label $\hat { y } _ { i }$ . To this end, it generates sample embeddings using a hierarchical architecture composed of three levels to model observations (sensor readouts), sensors, and whole samples (Figure 2). Without loss of generality, we describe RAINDROP’s procedure as if observations arrive one at a time (one sensor is observed at time $t$ and other sensors do not have observations). If there are multiple observations at the same time, RAINDROP can effortlessly process them in parallel.
|
| 58 |
+
|
| 59 |
+
RAINDROP first constructs a graph for every sample where nodes represent sensors and edges indicate relations between sensors (Sec. 3.2). We use $\mathcal { G } _ { i }$ to denote the sensor graph for sample $\boldsymbol { S } _ { i }$ and $e _ { i , u v }$ to represent the weight of a directed edge from sensor $u$ to sensor $v$ in $\mathcal { G } _ { i }$ . Sensor graphs are automatically optimized considering sample-wise and time-wise specificity.
|
| 60 |
+
|
| 61 |
+
The key idea of RAINDROP is to borrow information from $u$ ’s neighbors based on estimated relationships between $u$ and other sensors. This is achieved via message passing carried out on $s _ { i }$ ’s dependency graph and initiated at node $u$ in the graph. When an observation $( t , x _ { i , u } ^ { t } )$ is recorded for sample $s _ { i }$ at time $t$ , RAINDROP first embeds the observation at active sensor $u$ (i.e., sensor whose value was recorded) and then propagates messages (i.e., the observation embeddings) from $u$ to neighboring sensors along edges in sensor dependency graph $\mathcal { G } _ { i }$ . As a result, recording the value of $u$ can affect $u$ ’s embedding as well as embeddings of other sensors that related to $u$ (Sec. 3.3). Finally, RAINDROP generates sensor embeddings by aggregating all observation embeddings for each sensor (across all timestamps) using temporal attention weights (Sec. 3.4). At last, RAINDROP embeds sample $S _ { i }$ based on sensor embeddings (Sec. 3.5) and feeds the sample embedding into a downstream predictor.
|
| 62 |
+
|
| 63 |
+

|
| 64 |
+
Figure 2: Hierarchical structure of irregular multivariate time series dataset. RAINDROP embeds individual observations considering inter-sensor dependencies (Sec. 3.3), aggregates them into a sensor embedding using temporal attention (Sec. 3.4), and finally integrates sensor embeddings into a sample embedding (Sec. 3.5).
|
| 65 |
+
|
| 66 |
+
# 3.2 CONSTRUCTING SENSOR DEPENDENCY GRAPHS
|
| 67 |
+
|
| 68 |
+
We build a directed weighted graph $\mathcal { G } _ { i } = \{ \boldsymbol { \nu } , \mathcal { E } _ { i } \}$ for every sample $s _ { i }$ and refer to it as the sensor dependency graph for $S _ { i }$ . Nodes $\nu$ represent sensors and edges $\mathcal { E } _ { i }$ describe dependencies between sensors in sample $s _ { i }$ that RAINDROP infers. As we show in experiments, RAINDROP can be directly used with samples that only contain a subset of sensors in $\nu$ . We denote edge from $u$ to $v$ as a triplet $( u , e _ { i , u v } , v )$ , where $e _ { i , u v } \in [ 0 , 1 ]$ represents the strength of relationship between sensors $u$ and $v$ in sample $s _ { i }$ . Edge $( u , e _ { i , u v } , v )$ describes the relationship between $u$ and $v$ : when $u$ receives an observation, it will send a neural message to $v$ following edge $e _ { i , u v }$ . If $e _ { i , u v } = 0$ , there is no exchange of neural information between $u$ and $v$ , indicating that the two sensors are unrelated. We assume that the importance of $u$ to $v$ is different than the importance of $v$ to $u$ , and so we treat sensor dependency graphs as directed, i.e., $e _ { i , u v } \neq e _ { i , v u }$ . All graphs are initialized as fully-connected graphs (i.e., $e _ { i , u v } = 1$ for any $u , v$ and $s _ { i }$ ) and edge weights $e _ { i , u v }$ are updated following Eq. 3 during model training. If available, it is easy to integrate additional domain knowledge into graph initialization.
|
| 69 |
+
|
| 70 |
+
# 3.3 GENERATING EMBEDDINGS OF INDIVIDUAL OBSERVATIONS
|
| 71 |
+
|
| 72 |
+
Let $u$ indicate active sensor at time $t \in \mathcal { T } _ { i , u }$ , i.e., sensor whose value $x _ { i , u } ^ { t }$ is observed at $t$ , and let $u$ be connected to $v$ through edge $( u , e _ { i , u v } , v )$ . We next describe how to produce observation embeddings $h _ { i , u } ^ { t } \in \mathbb { R } ^ { d _ { h } }$ and $h _ { i , v } ^ { t } \in \mathbb { R } ^ { d _ { h } }$ for sensors $u$ and $v$ , respectively (Figure 3a). We omit layer index $l$ and note that the proposed strategy applies to any number of layers.
|
| 73 |
+
|
| 74 |
+

|
| 75 |
+
Figure 3: (a) RAINDROP generates observation embedding $\boldsymbol { h } _ { i , u } ^ { t }$ based on observed value $x _ { i , u } ^ { t }$ at $t$ , passes message to neighbor sensors such as $v$ , and generates $h _ { i , v } ^ { t }$ through inter-sensor dependencies. The $\alpha _ { i , u v } ^ { t }$ denotes a time-specific attention weight, calculated based on time representation $\mathbf { \Delta } _ { p _ { i } ^ { t } } ^ { \mathbf { \Delta } _ { t } ^ { t } }$ and weight vector $\mathbf { \nabla } _ { \mathbf { \boldsymbol { r } } _ { v } }$ . Edge weight $e _ { i , u v }$ is shared by all timestamps. (b) An illustration of generating sensor embedding. Apply the message passing in (a) to all timestamps and produce corresponding observation embeddings. We aggregate arbitrary number of observation embeddings into a fixed-length sensor embedding $z _ { i , v }$ while paying distinctive attentions to different observatupdates edge weight $e _ { i , u v } ^ { ( l ) }$ We independently apply tbased on the edge weight $e _ { i , u v } ^ { ( l - 1 ) }$ cessin from procedure to all sensors. (c) RAINDROPprevious layer and the learned inter-sensor attention weights in all time steps. We explicitly show layer index $l$
|
| 76 |
+
|
| 77 |
+
Embedding an observation of an active sensor. Let $u$ denote an active sensor whose value has just been observed as $x _ { i , u } ^ { t }$ . For sufficient expressive power (Velickovi ˇ c et al. ´ , 2018), we map observation $x _ { i , u } ^ { t }$ to a high-dimensional space using a nonlinear transformation: $\pmb { h } _ { i , u } ^ { t } = \sigma ( x _ { i , u } ^ { t } \pmb { R } _ { u } )$ . We use sensorspecific transformations because values recorded at different sensors can follow different distributions, which is achieved by trainable weight vectors $\scriptstyle { \boldsymbol { R _ { u } } }$ depending on what sensor is activated (Li et al., 2020b). Alternatives, such as a multilayer perceptron, can be considered to transform $x _ { i , u } ^ { t }$ into $h _ { i , u } ^ { t }$ . As $h _ { i , u } ^ { t }$ represents information brought on by observing $x _ { i , u } ^ { t }$ , we regard $h _ { i , u } ^ { t }$ as the embedding of $u$ ’s observation at $t$ . Sensor-specific weight vectors $\scriptstyle { \boldsymbol { R _ { u } } }$ are shared across samples.
|
| 78 |
+
|
| 79 |
+
Passing messages along sensor dependency graphs. For sensors that are not active at timestamp $t$ but are neighbors of the active sensor $u$ in the sensor dependency graph $\mathcal { G } _ { i }$ , RAINDROP uses relationships between $u$ and those sensors to estimate observation embeddings for them. We proceed by describing how RAINDROP generates observation embedding $h _ { i , v } ^ { t }$ for sensor $v$ assuming $v$ is a neighbor of $u$ in $\mathcal { G } _ { i }$ . Given $h _ { i , u } ^ { t }$ and edge $( u , e _ { i , u v } , v )$ , we first calculate inter-sensor attention weight $\alpha _ { i , u v } ^ { t } \in [ 0 , 1 ]$ , representing how important $u$ is to $v$ via the following equation:
|
| 80 |
+
|
| 81 |
+
$$
|
| 82 |
+
\begin{array} { r } { \alpha _ { i , u v } ^ { t } = \sigma ( \boldsymbol { h } _ { i , u } ^ { t } { D [ \boldsymbol { r } _ { v } | | \boldsymbol { p } _ { i } ^ { t } ] ^ { T } } ) , } \end{array}
|
| 83 |
+
$$
|
| 84 |
+
|
| 85 |
+
where $\pmb { r } _ { v } \in \mathbb { R } ^ { d _ { r } }$ is a trainable weight vector that is specific to the sensor receiving the message $( i . e . , h _ { i , u } ^ { t } )$ . Vector $\mathbf { \Delta } _ { \mathbf { \boldsymbol { r } } _ { v } }$ allows the model to learn distinct attention weights for different edges going out from the same sensor $u$ . Further, $\pmb { p } _ { i } ^ { t } \in \mathbb { R } ^ { d _ { t } }$ is the time representation obtained by converting a 1-dimensional timestamp $t$ into a multi-dimensional vector $\mathbf { \Delta } _ { p _ { i } ^ { t } } ^ { t }$ by passing $t$ through a series of trigonometric functions (Horn et al., 2020). See Appendix A.1 for details. RAINDROP uses $\mathbf { \Delta } _ { p _ { i } ^ { t } } ^ { t }$ to calculate attention weights that are sensitive to time. Finally, $_ { D }$ is a trainable weight matrix mapping $h _ { i , u } ^ { t }$ from $d _ { h }$ dimensions to $\left( d _ { r } + d _ { t } \right)$ dimensions. Taken this together, we can estimate the embedding $h _ { i , v } ^ { t }$ for $u$ ’s neighbor $v$ as follows:
|
| 86 |
+
|
| 87 |
+
$$
|
| 88 |
+
\begin{array} { r } { \pmb { h } _ { i , v } ^ { t } = \sigma ( \pmb { h } _ { i , u } ^ { t } \pmb { w } _ { u } \pmb { w } _ { v } ^ { T } \alpha _ { i , u v } ^ { t } \boldsymbol { e } _ { i , u v } ) , } \end{array}
|
| 89 |
+
$$
|
| 90 |
+
|
| 91 |
+
where $\boldsymbol { w } _ { u } , \boldsymbol { w } _ { v } \in \mathbb { R } ^ { d _ { h } }$ are trainable weight vectors shared across all samples. The ${ \pmb w } _ { \pmb u }$ is specific to active sensor $u$ and ${ \pmb w } _ { v }$ is specific to neighboring sensor $v$ . In the above equation, $e _ { i , u v }$ denotes edge weight shared across all timestamps. The above message passing describes the processing of a single observation at a single timestamp. In case multiple sensors are active at time $t$ and connected with $v$ we normalize $\alpha _ { i , u v } ^ { t }$ (with softmax function) across active sensors and aggregate messages at $v$ .
|
| 92 |
+
|
| 93 |
+
Overall, RAINDROP produces observation embedding $h _ { i , v } ^ { t }$ for sensor $v$ through its relational connection with $u$ , even though there is no direct measurement of $v$ at time $t$ . These message passing operations are performed to adaptively and dynamically estimate missing observations in the embedding space based on recorded information and learned graph structure.
|
| 94 |
+
|
| 95 |
+
Updating sensor dependency graphs. We describe the update of edge weights and prune of graph structures in the situation that stacks multiple RAINDROP layers (Figure 3). Here we explicitly show layer index $l$ because multiple layers are involved in the computation. As no prior knowledge is assumed, we initialize the graph as all sensors connected with each other. However, the fully connected edges may bridge sensors that should be independent, which will introduce spurious correlations and prevent the model from paying attention to the truly important connections. Addressing this issue, RAINDROP automatically updates edge weights and prunes out less important edges. Based on the aggregated temporal influence driven by the inter-sensor attention weights $\alpha _ { i , u v } ^ { ( l ) , t }$ , we update edge weights e(l)i,uv in each layer $l \in \{ 1 , \ldots , L \}$ by:
|
| 96 |
+
|
| 97 |
+
$$
|
| 98 |
+
e _ { i , u v } ^ { ( l ) } = \frac { e _ { i , u v } ^ { ( l - 1 ) } } { \lvert \mathcal { T } _ { i , u } \rvert } \sum _ { t \in \mathcal { T } _ { i , u } } \alpha _ { i , u v } ^ { ( l ) , t } ,
|
| 99 |
+
$$
|
| 100 |
+
|
| 101 |
+
where $\mathcal { T } _ { i , u }$ denotes the set of all timestamps where there is message passes from $u$ to $v$ . In particular, we set e(0)i,uv $e _ { i , u v } ^ { ( 0 ) } = 1$ in the initialization of graph structures. We use $L = 2$ in all our experiments. In every layer, we order the estimated values $e _ { i , u v } ^ { ( l ) }$ for all edges in sample $s _ { i }$ and prune bottom $K \%$ edges with smallest edge weights (Yang et al., 2021). Pruned edges are not re-added in later layers.
|
| 102 |
+
|
| 103 |
+
# 3.4 GENERATING SENSOR EMBEDDINGS
|
| 104 |
+
|
| 105 |
+
Next we describe how to aggregate observation embeddings into sensor embeddings $z _ { i , v }$ , taking sensor $v$ as an example (Figure 3b). Previous step (Sec. 3.3) generates observation embeddings for every timestamp when either $v$ or $v$ ’s neighbor is observed. The observation embeddings at different timestamps have unequal importance to the the sensor embedding (Zerveas et al., 2021). We use the temporal attention weight (scalar) $\beta _ { i , v } ^ { t }$ to represent the importance of observation embedding at $t$ . We use $\mathcal { T } _ { i , v } = \{ t _ { 1 } , t _ { 2 } , \ldots , t _ { T } \}$ to denote all the timestamps when a readout is observed in $v$ (we can directly generate $h _ { i , v } ^ { t } )$ ) or in $v$ ’s neighbor (we can generate $h _ { i , v } ^ { t }$ through message passing). The $\beta _ { i , v } ^ { t }$ is the corresponding element of vector $\beta _ { i , v }$ which include the temporal attention weights at all timestamps $t \in \mathcal { T } _ { i , v }$ .
|
| 106 |
+
|
| 107 |
+
We use temporal self-attention to calculate $\beta _ { i , v }$ , which is different from the standard self-attention (Hu et al., 2020; Yun et al., 2019). The standard dot-product self-attention generates an attention matrix with dimension of $T \times T$ (where $T = | \mathcal { T } _ { i , v } |$ can vary across samples) that has an attention weight for each pair of observation embeddings. In our case, we only need a single attention vector where each element denotes the temporal attention weight of an observation embedding when generating the sensor embedding. Thus, we modify the typical self-attention model to fit our case: using a trainable $\pmb { s } \in \mathbb { R } ^ { T \times 1 }$ to map the self-attention matrix $( \mathbb { R } ^ { T \times T } )$ to $T$ -dimensional vector $\beta _ { i , v }$ $( \mathbb { R } ^ { T \times 1 } )$ through matrix product (Appendix A.2).
|
| 108 |
+
|
| 109 |
+
The following steps describe how to generate sensor embeddings. We first concatenate observation embedding $\bar { h _ { i , v } ^ { t } }$ with time representation $\mathbf { \Delta } _ { p _ { i } ^ { t } } ^ { t }$ to include information of timestamp. Then, we stack the concatenated embeddings $[ h _ { i , v } ^ { t } | | p _ { i } ^ { t } ]$ for all $t \in \mathcal { T } _ { i , v }$ into a matrix $H _ { i , v }$ . The $H _ { i , v }$ contains all information of observations and timestamps for sensor $v$ . We calculate $\beta _ { i , v } ^ { t }$ through:
|
| 110 |
+
|
| 111 |
+
$$
|
| 112 |
+
\beta _ { i , v } = \mathrm { s o f t m a x } \left( \frac { Q _ { i , v } K _ { i , v } ^ { T } } { \sqrt { d _ { k } } } \pmb { s } \right) ,
|
| 113 |
+
$$
|
| 114 |
+
|
| 115 |
+
where $Q _ { i , v }$ and $K _ { i , v }$ are two intermediate matrices that are derived from the stacked observation embeddings. In practice, $Q _ { i , v } = H _ { i , v } W _ { Q }$ and ${ \pmb { K } } _ { i , v } = { \pmb { H } } _ { i , v } { \pmb { W } } _ { K }$ are linearly mapped from $H _ { i , v }$
|
| 116 |
+
|
| 117 |
+
parameterized by $W _ { Q }$ and $W _ { K }$ , respectively (Vaswani et al., 2017). The $\sqrt { d _ { k } }$ is a scaling factor where $d _ { k }$ is the dimension after linear mapping. Based on the learned temporal attention weights $\beta _ { i , v } ^ { t }$ , we calculate sensor embedding $z _ { i , v }$ through:
|
| 118 |
+
|
| 119 |
+
$$
|
| 120 |
+
z _ { i , v } = \sum _ { t \in \mathcal { T } _ { i , v } } ( \beta _ { i , v } ^ { t } [ \pmb { h } _ { i , v } ^ { t } | | \pmb { p } _ { i } ^ { t } ] \pmb { W } ) ,
|
| 121 |
+
$$
|
| 122 |
+
|
| 123 |
+
where weight matrix $W$ is a linear projector shared by all sensors and samples. It is worth to mention that all attention weights (such as $\bar { \alpha } _ { i , u v } ^ { t }$ and $\beta _ { i , v . }$ ) can be multi-head. In this work, we describe the model in the context of single head for brevity.
|
| 124 |
+
|
| 125 |
+
Using attentional aggregation, RAINDROP can learn a fixed-length sensor embedding for arbitrary number of observations. Meanwhile, RAINDROP is capable of focusing on the most informative observation embeddings. We process all observation embeddings as a whole instead of sequentially, which allows parallel computation for faster training and also mitigates the performance drop caused by modeling long dependencies sequentially. In the case of sensors with very large number of observations, we can reduce the length of time series by subsampling or splitting a long series into multiple short series.
|
| 126 |
+
|
| 127 |
+
# 3.5 GENERATING SAMPLE EMBEDDINGS
|
| 128 |
+
|
| 129 |
+
Finally, for sample $s _ { i }$ , we aggregate sensor embeddings $z _ { i , v }$ (Eq. 5) across all sensors to obtain an embedding $z _ { i } \in \mathbb { R } ^ { d _ { z } }$ through a readout function $g$ as follows: $z _ { i } = g ( z _ { i , v } \mid v = 1 , 2 , . . . , M )$ (such as concatenation). When a sample contains a large number of sensors, RAINDROP can seamlessly use a set-based readout function such as averaging aggregation (Appendix A.3). Given an input sample $s _ { i }$ , RAINDROP’s strategy outlined in Sec. 3.2-3.5 produces a sample embedding $z _ { i }$ that can be further optimized for downstream tasks.
|
| 130 |
+
|
| 131 |
+
# 3.6 IMPLEMENTATION AND PRACTICAL CONSIDERATIONS
|
| 132 |
+
|
| 133 |
+
Loss function. RAINDROP’s loss function is formulated as: $\mathcal { L } = \mathcal { L } _ { \mathrm { C E } } + \lambda \mathcal { L } _ { r }$ , where $\begin{array} { l l } { { \mathcal { L } } _ { r } } & { = } \end{array}$ $\begin{array} { r } { \frac { 1 } { M ^ { 2 } } \sum _ { u , v \in \mathcal { V } } \sum _ { i , j \in \mathcal { V } } | | e _ { i , u v } - e _ { j , u v } | | _ { 2 } / ( N - 1 ) ^ { 2 } } \end{array}$ , where $\mathcal { L } _ { \mathrm { C E } }$ is cross entropy and $\mathcal { L } _ { r }$ is a regularizer to encourage the model to learn similar sensor dependency graphs for similar samples. The $\mathcal { L } _ { r }$ measures averaged Euclidean distance between edge weights across all samples pairs, in all sensor pairs (including self-connections). The $\lambda$ is a user-defined coefficient. Practically, as $N$ can be large, we calculate $\mathcal { L } _ { r }$ only for samples in a batch.
|
| 134 |
+
|
| 135 |
+
Downstream tasks. If a sample has auxiliary attributes (e.g., a patient’s demographics) that do not change over time, we can project the attribute vector to a $d _ { a }$ -dimensional vector $\mathbf { a } _ { i }$ with a fullyconnected layer and concatenate it with the sample embedding, getting $[ z _ { i } | | a _ { i } ]$ . At last, we feed $[ z _ { i } | | a _ { i } ]$ (or only $z _ { i }$ if $\mathbf { a } _ { i }$ is not available) into a neural classifier $\varphi : \mathbb { R } ^ { d _ { z } + d _ { a } } \{ 1 , \ldots , C \}$ . In our experiments, $\varphi$ is a 2-layer fully-connected network with $C$ neurons at the output layer returning prediction $\hat { y } _ { i } \stackrel { \cdot } { = } \varphi ( [ \pmb { z } _ { i } | | \dot { \pmb { a } _ { i } } ] )$ for sample $\boldsymbol { S } _ { i }$ .
|
| 136 |
+
|
| 137 |
+
Sensor dependencies. While modeling sensor dependencies, we involve observation embedding $( h _ { i , u } ^ { t }$ , Eq. 1) of each sample in the calculation of attention weights. Similarly, to model time-wise specificity in graph structures, we consider time information $( \pmb { p } _ { i } ^ { t }$ , Eq. 1) when measuring $\alpha _ { i , u v } ^ { t }$ RAINDROP can capture similar graph structures across samples from three aspects (Appendix A.4): (1) the initial graphs are the same in all samples; (2) the parameters in message passing $\mathbf { \mathcal { R } } _ { u }$ ; ${ \pmb w } _ { \pmb u }$ $\pmb { w } _ { v }$ , Eq. 2), inter-sensor attention weights calculation ( $_ { x }$ , Eq. 1), and temporal attention weights calculation (s, Eq. 4; $W$ , Eq. 5) are shared by all samples; (3) we encourage the model to learn similar graph structures by adding a penalty to disparity of structures $( \mathcal { L } _ { r } )$ .
|
| 138 |
+
|
| 139 |
+
Scalability. RAINDROP is efficient because embeddings can be learned in parallel. In particular, processing of observation embeddings is independent across timestamps. Similarly, sensor embeddings can be processed independently across different sensors (Figure 3). While the complexity of temporal self-attention calculation grows quadratically with the number of observations, it can be practically implemented using highly-optimized matrix multiplication.
|
| 140 |
+
|
| 141 |
+
# 4 EXPERIMENTS
|
| 142 |
+
|
| 143 |
+
Datasets. Below we briefly overview healthcare and human activity datasets. (1) P19 (Reyna et al., 2020) includes 38,803 patients that are monitored by 34 sensors. Each patient is associated with a binary label representing the occurrence of sepsis. (2) P12 (Goldberger et al., 2000) records temporal measurements of 36 sensors of 11,988 patients in the first 48-hour stay in ICU. The samples are labeled based on hospitalization length. (3) PAM (Reiss & Stricker, 2012) contains 5,333 segments from 8 activities of daily living that are measured by 17 sensors. Details are in Appendix A.5.
|
| 144 |
+
|
| 145 |
+
Baselines. We compare RAINDROP with five state-of-the-art baselines: Transformer (Vaswani et al., 2017), Trans-mean, GRU-D (Che et al., 2018), SeFT (Horn et al., 2020), and mTAND (Shukla & Marlin, 2021). The Trans-mean is an imputation method combining transformer architecture with commonly used average interpolation (i.e., missing values are replaced by average observations in each sensor). The mTAND (Shukla & Marlin, 2021) method has been shown to outperform numerous recurrent models including RNN-Impute (Che et al., 2018), RNN-Simple, and Phased-LSTM (Neil et al., 2016), along with ordinary differential equations (ODE)-based models such as LATENT-ODE and ODE-RNN (Chen et al., 2018). For this reason, we compare with mTAND and do not report comparison with those techniques in this paper. Even though, to better show the superiority of RAINDROP, we provide extensive comparison with popular approaches, such as $\mathrm { D G M ^ { 2 } }$ -O (Wu et al., 2021) and MTGNN (Wu et al., 2020c), that are designed for forecasting tasks. Further details are in Table 1 and Appendix A.11. Details on hyperparameter selection and baselines are in Appendix A.6, and evaluation metrics are presented in Appendix A.7.
|
| 146 |
+
|
| 147 |
+
# 4.1 RESULTS ACROSS DIVERSE EVALUATION SETTINGS
|
| 148 |
+
|
| 149 |
+
Setting 1: Classic time series classification. Setup. We randomly split the dataset into training $( 8 0 \% )$ , validation $( 1 0 \% )$ , and test $( 1 0 \% )$ set. The indices of these splits are fixed across all methods. Results. As shown in Table 1, RAINDROP obtains the best performance across three benchmark datasets, suggesting its strong performance for time series classification. In particular, in binary classification (P19 and P12), RAINDROP outperforms the strongest baselines by $5 . 3 \%$ in AUROC and $4 . 8 \%$ in AUPRC on average. In a more challenging 8-way classification on the PAM dataset, RAINDROP outperforms existing approaches by $5 . 7 \%$ in accuracy and $5 . 5 \%$ in F1 score. Further exploratory analyses and benchmarking results are shown in Appendix A.9-A.10.
|
| 150 |
+
|
| 151 |
+
Table 1: Method benchmarking on irregularly sampled time series classification (Setting 1).
|
| 152 |
+
|
| 153 |
+
<table><tr><td rowspan="2">Methods</td><td colspan="2">P19</td><td colspan="2">P12</td><td colspan="4">PAM</td></tr><tr><td>AUROC</td><td>AUPRC</td><td>AUROC</td><td>AUPRC</td><td>Accuracy</td><td>Precision</td><td>Recall</td><td>F1 score</td></tr><tr><td>Transformer</td><td>83.2 ± 1.3</td><td>47.6±3.8</td><td>65.1 ± 5.6</td><td>95.7 ±1.6</td><td>83.5±1.5</td><td>84.8 ±1.5</td><td>86.0 ± 1.2</td><td>85.0 ± 1.3</td></tr><tr><td>Trans-mean</td><td>84.1 ± 1.7</td><td>47.4 ± 1.4</td><td>66.8±4.2</td><td>95.9 ± 1.1</td><td>83.7±2.3</td><td>84.9 ± 2.6</td><td>86.4 ± 2.1</td><td>85.1 ± 2.4</td></tr><tr><td>GRU-D</td><td>83.9 ±1.7</td><td>46.9 ± 2.1</td><td>67.2 ±3.6</td><td>95.9 ± 2.1</td><td>83.3 ±1.6</td><td>84.6 ±1.2</td><td>85.2 ± 1.6</td><td>84.8 ± 1.2</td></tr><tr><td>SeFT</td><td>78.7 ± 2.4</td><td>31.1 ± 2.8</td><td>66.8 ±0.8</td><td>96.2 ±0.2</td><td>67.1 ± 2.2</td><td>70.0 ± 2.4</td><td>68.2 ±1.5</td><td>68.5 ±1.8</td></tr><tr><td>mTAND</td><td>80.4 ±1.3</td><td>32.4 ±1.8</td><td>65.3 ±1.7</td><td>96.5 ±1.2</td><td>74.6 ± 4.3</td><td>74.3 ± 4.0</td><td>79.5 ± 2.8</td><td>76.8 ± 3.4</td></tr><tr><td>IP-Net</td><td>84.6 ±1.3</td><td>38.1 ± 3.7</td><td>72.5± 2.4</td><td>96.7 ± 0.3</td><td>74.3 ± 3.8</td><td>75.6 ± 2.1</td><td>77.9 ± 2.2</td><td>76.6± 2.8</td></tr><tr><td>DGM²-0</td><td>86.7 ± 3.4</td><td>44.7 ± 11.7</td><td>71.2 ± 2.5</td><td>96.9 ± 0.4</td><td>82.4± 2.3</td><td>85.2 ±1.2</td><td>83.9 ± 2.3</td><td>84.3 ± 1.8</td></tr><tr><td>MTGNN</td><td>81.9 ± 6.2</td><td>39.9 ± 8.9</td><td>67.5 ± 3.1</td><td>96.4± 0.7</td><td>83.4 ±1.9</td><td>85.2 ±1.7</td><td>86.1 ± 1.9</td><td>85.9 ± 2.4</td></tr><tr><td>RAINDROP</td><td>87.0 ± 2.3</td><td>51.8 ± 5.5</td><td>72.1 ± 1.3</td><td>97.0 ± 0.4</td><td>88.5 ± 1.5</td><td>89.9 ± 1.5</td><td>89.9 ± 0.6</td><td>89.8 ± 1.0</td></tr></table>
|
| 154 |
+
|
| 155 |
+
Setting 2: Leave-fixed-sensors-out. Setup. RAINDROP can compensate for missing sensor observations by exploiting dependencies between sensors. To this end, we test whether RAINDROP can achieve good performance when a subset of sensors are completely missing. This setting is practically relevant in situations when, for example, sensors fail or are unavailable. We select a fraction of sensors and hide all their observations in both validation and test sets (training samples are not changed). In particular, we leave out the most informative sensors as defined by information gain analysis (Appendix A.8). The left-out sensors are fixed across samples and models. Results. We report results taking PAM as an example. In Table 2 (left block), we observe that RAINDROP achieves top performance in 18 out of 20 settings when the number of left-out sensors goes from $10 \%$ to $50 \%$ With the increased amount of missing data, RAINDROP yield greater performance improvements. RAINDROP outperforms baselines by up to $2 4 . 9 \%$ in accuracy, $5 0 . 3 \%$ in precision, $2 9 . 3 \%$ in recall, and $4 2 . 8 \%$ in F1 score.
|
| 156 |
+
|
| 157 |
+
Setting 3: Leave-random-sensors-out. Setup. Setting 3 is similar to Setting 2 except that left-out sensors are randomly selected in each sample instead of being fixed. In each test sample, we select a subset of sensors and regard them as missing by replacing all of their observations with zeros. Results. We provide results for the PAM dataset in Table 2 (right block). We find that RAINDROP achieves better performance than baselines in 16 out of 20 settings and that Trans-mean and GRU-D are the strongest competitors. Further, we evaluated RAINDROP in another setting where the model is trained on one group of samples (e.g., females) and tested on another group not seen during training (e.g., males). Experimental setup and results are detailed in Appendix A.13.
|
| 158 |
+
|
| 159 |
+
Table 2: Classification performance on samples with a fixed set of left-out sensors (Setting 2) or random missing sensors (Setting 3) on the PAM dataset. Results for P19 dataset (Settings 2-3) are shown in Appendix A.12.
|
| 160 |
+
|
| 161 |
+
<table><tr><td rowspan="2">Missing sensor ratio</td><td rowspan="2">Methods</td><td colspan="4">PAM (Setting 2: leave-fixed-sensors-out)</td><td colspan="4">PAM(Setting 3: leave-random-sensors-out)</td></tr><tr><td>Accuracy</td><td>Precision</td><td>Recall</td><td>F1 score</td><td>Accuracy</td><td>Precision</td><td>Recall</td><td>F1 score</td></tr><tr><td rowspan="6">10%</td><td>Transformer</td><td>60.3± 2.4</td><td>57.8 ± 9.3</td><td>59.8± 5.4</td><td>57.2 ±8.0</td><td>60.9 ± 12.8</td><td>58.4 ± 18.4</td><td>59.1 ± 16.2</td><td>56.9 ±18.9</td></tr><tr><td>Trans-mean</td><td>60.4 ± 11.2</td><td>61.8 ± 14.9</td><td>60.2 ±13.8</td><td>58.0 ±15.2</td><td>62.4 ± 3.5</td><td>59.6± 7.2</td><td>63.7 ±8.1</td><td>62.7 ± 6.4</td></tr><tr><td>GRU-D</td><td>65.4 ± 1.7</td><td>72.6 ± 2.6</td><td>64.3 ± 5.3</td><td>63.6±0.4</td><td>68.4± 3.7</td><td>74.2 ± 3.0</td><td>70.8 ± 4.2</td><td>72.0 ±3.7</td></tr><tr><td>SeFT</td><td>58.9 ±2.3</td><td>62.5 ± 1.8</td><td>59.6±2.6</td><td>59.6 ± 2.6</td><td>40.0 ± 1.9</td><td>40.8± 3.2</td><td>41.0 ±0.7</td><td>39.9 ± 1.5</td></tr><tr><td>mTAND</td><td>58.8 ±2.7</td><td>59.5± 5.3</td><td>64.4 ± 2.9</td><td>61.8 ± 4.1</td><td>53.4 ± 2.0</td><td>54.8 ± 2.7</td><td>57.0 ± 1.9</td><td>55.9 ± 2.2</td></tr><tr><td>RAINDROP</td><td>77.2 ± 2.1</td><td>82.3 ± 1.1</td><td>78.4 ±1.9</td><td>75.2 ± 3.1</td><td>76.7 ± 1.8</td><td>79.9 ± 1.7</td><td>77.9 ± 2.3</td><td>78.6 ±1.8</td></tr><tr><td rowspan="6">20%</td><td>Transformer</td><td>63.1 ± 7.6</td><td>71.1 ± 7.1</td><td>62.2±8.2</td><td>63.2±8.7</td><td>62.3 ± 11.5</td><td>65.9 ± 12.7</td><td>61.4 ± 13.9</td><td>61.8 ± 15.6</td></tr><tr><td>Trans-mean</td><td>61.2 ± 3.0</td><td>74.2 ± 1.8</td><td>63.5 ± 4.4</td><td>64.1 ± 4.1</td><td>56.8 ± 4.1</td><td>59.4 ± 3.4</td><td>53.2 ±3.9</td><td>55.3 ±3.5</td></tr><tr><td>GRU-D</td><td>64.6 ± 1.8</td><td>73.3 ± 3.6</td><td>63.5± 4.6</td><td>64.8± 3.6</td><td>64.8 ± 0.4</td><td>69.8±0.8</td><td>65.8± 0.5</td><td>67.2 ± 0.0</td></tr><tr><td>SeFT</td><td>35.7 ±0.5</td><td>42.1 ± 4.8</td><td>38.1 ± 1.3</td><td>35.0±2.2</td><td>34.2 ± 2.8</td><td>34.9 ± 5.2</td><td>34.6 ± 2.1</td><td>33.3 ±2.7</td></tr><tr><td>mTAND</td><td>33.2±5.0</td><td>36.9 ± 3.7</td><td>37.7 ± 3.7</td><td>37.3 ± 3.4</td><td>45.6 ± 1.6</td><td>49.2 ± 2.1</td><td>49.0 ± 1.6</td><td>49.0 ± 1.0</td></tr><tr><td>RAINDROP</td><td>66.5± 4.0</td><td>72.0 ± 3.9</td><td>67.9 ±5.8</td><td>65.1 ± 7.0</td><td>71.3 ± 2.5</td><td>75.8 ± 2.2</td><td>72.5± 2.0</td><td>73.4 ± 2.1</td></tr><tr><td rowspan="6">30%</td><td>Transformer</td><td>31.6 ± 10.0</td><td>26.4 ± 9.7</td><td>24.0 ±10.0</td><td>19.0 ± 12.8</td><td>52.0 ± 11.9</td><td>55.2 ±15.3</td><td>50.1 ± 13.3</td><td>48.4 ± 18.2</td></tr><tr><td>Trans-mean</td><td>42.5±8.6</td><td>45.3 ± 9.6</td><td>37.0 ± 7.9</td><td>33.9 ±8.2</td><td>65.1 ± 1.9</td><td>63.8 ± 1.2</td><td>67.9 ± 1.8</td><td>64.9 ± 1.7</td></tr><tr><td>GRU-D</td><td>45.1 ± 2.9</td><td>51.7 ± 6.2</td><td>42.1 ± 6.6</td><td>47.2 ± 3.9</td><td>58.0±2.0</td><td>63.2 ± 1.7</td><td>58.2 ± 3.1</td><td>59.3±3.5</td></tr><tr><td>SeFT</td><td>32.7 ± 2.3</td><td>27.9 ± 2.4</td><td>34.5± 3.0</td><td>28.0 ± 1.4</td><td>31.7 ± 1.5</td><td>31.0 ± 2.7</td><td>32.0 ± 1.2</td><td>28.0 ±1.6</td></tr><tr><td>mTAND</td><td>27.5 ± 4.5</td><td>31.2 ± 7.3</td><td>30.6± 4.0</td><td>30.8 ± 5.6</td><td>34.7 ± 5.5</td><td>43.4 ± 4.0</td><td>36.3 ± 4.7</td><td>39.5 ± 4.4</td></tr><tr><td>RAINDROP</td><td>52.4± 2.8</td><td>60.9 ± 3.8</td><td>51.3 ± 7.1</td><td>48.4 ± 1.8</td><td>60.3 ±3.5</td><td>68.1 ± 3.1</td><td>60.3 ±3.6</td><td>61.9 ± 3.9</td></tr><tr><td rowspan="6">40%</td><td>Transformer</td><td>23.0±3.5</td><td>7.4 ± 6.0</td><td>14.5 ± 2.6</td><td>6.9 ± 2.6</td><td>43.8 ± 14.0</td><td>44.6 ± 23.0</td><td>40.5 ±15.9</td><td>40.2 ± 20.1</td></tr><tr><td>Trans-mean</td><td>25.7± 2.5</td><td>9.1 ± 2.3</td><td>18.5 ± 1.4</td><td>9.9 ± 1.1</td><td>48.7 ± 2.7</td><td>55.8± 2.6</td><td>54.2 ± 3.0</td><td>55.1 ± 2.9</td></tr><tr><td>GRU-D</td><td>46.4 ± 2.5</td><td>64.5 ± 6.8</td><td>42.6 ± 7.4</td><td>44.3 ± 7.9</td><td>47.7 ± 1.4</td><td>63.4 ± 1.6</td><td>44.5± 0.5</td><td>47.5± 0.0</td></tr><tr><td>SeFT</td><td>26.3 ± 0.9</td><td>29.9 ± 4.5</td><td>27.3 ± 1.6</td><td>22.3 ± 1.9</td><td>26.8 ± 2.6</td><td>24.1 ± 3.4</td><td>28.0 ±1.2</td><td>23.3±3.0</td></tr><tr><td>mTAND</td><td>19.4 ± 4.5</td><td>15.1 ± 4.4</td><td>20.2 ±3.8</td><td>17.0 ± 3.4</td><td>23.7 ±1.0</td><td>33.9 ± 6.5</td><td>26.4 ± 1.6</td><td>29.3 ± 1.9</td></tr><tr><td>RAINDROP</td><td>52.5±3.7</td><td>53.4± 5.6</td><td>48.6 ± 1.9</td><td>44.7 ± 3.4</td><td>57.0 ± 3.1</td><td>65.4 ± 2.7</td><td>56.7 ± 3.1</td><td>58.9 ± 2.5</td></tr><tr><td rowspan="6">50%</td><td>Transformer</td><td>21.4 ± 1.8</td><td>2.7 ±0.2</td><td>12.5 ± 0.4</td><td>4.4 ± 0.3</td><td>43.2 ± 2.5</td><td>52.0± 2.5</td><td>36.9 ± 3.1</td><td>41.9 ± 3.2</td></tr><tr><td>Trans-mean</td><td>21.3 ± 1.6</td><td>2.8 ±0.4</td><td>12.5 ± 0.7</td><td>4.6±0.2</td><td>46.4 ± 1.4</td><td>59.1 ± 3.2</td><td>43.1 ± 2.2</td><td>46.5 ± 3.1</td></tr><tr><td>GRU-D</td><td>37.3 ± 2.7</td><td>29.6± 5.9</td><td>32.8±4.6</td><td>26.6±5.9</td><td>49.7 ± 1.2</td><td>52.4±0.3</td><td>42.5 ± 1.7</td><td>47.5 ± 1.2</td></tr><tr><td>SeFT</td><td>24.7 ± 1.7</td><td>15.9 ± 2.7</td><td>25.3±2.6</td><td>18.2 ± 2.4</td><td>26.4 ± 1.4</td><td>23.0 ±2.9</td><td>27.5± 0.4</td><td>23.5± 1.8</td></tr><tr><td>mTAND</td><td>16.9 ± 3.1</td><td>12.6 ± 5.5</td><td>17.0 ± 1.6</td><td>13.9 ± 4.0</td><td>20.9 ± 3.1</td><td>35.1 ± 6.1</td><td>23.0±3.2</td><td>27.7 ± 3.9</td></tr><tr><td>RAINDROP</td><td>46.6 ± 2.6</td><td>44.5 ± 2.6</td><td>42.4 ± 3.9</td><td>38.0±4.0</td><td>47.2 ± 4.4</td><td>59.4 ± 3.9</td><td>44.8±5.3</td><td>47.6± 5.2</td></tr></table>
|
| 162 |
+
|
| 163 |
+
# 4.2 ABLATION STUDY AND VISUALIZATION OF OPTIMIZED SENSOR GRAPHS
|
| 164 |
+
|
| 165 |
+
Ablation study. Considering the PAM dataset and a typical setup (Setting 1), we conduct an ablation study to evaluate how much various RAINDROP’s components contribute towards its final performance. We examine the following components: inter-sensor dependencies (further decomposed into weights including $e _ { i , u v }$ , $\mathbf { \Delta } _ { \mathbf { \boldsymbol { r } } _ { v } }$ , $\mathbf { \Delta } _ { p _ { i } ^ { t } } ^ { t }$ , and $\alpha _ { i , u v } ^ { \bar { t } } )$ , temporal attention, and sensor-level concatenation. We show in Appendix A.14 (Table 7) that all model components are necessary and that regularization $\mathcal { L } _ { r }$ contributes positively to RAINDROP’s performance.
|
| 166 |
+
|
| 167 |
+
Visualizing sensor dependency graphs. We investigate whether samples with the same labels get more similar sensor dependency graphs than samples with different labels. To this end, we visualize inter-sensor dependencies (P19; Setting 1) and explore them. Figure 4 shows distinguishable patterns between graphs of negative and positive samples, indicating that RAINDROP can extract relationships that are specific to downstream sample labels. Further differential analysis provides insights that can inform early detection of sepsis from P19 clinical data. Details are in Appendix A.15.
|
| 168 |
+
|
| 169 |
+
# 5 CONCLUSION
|
| 170 |
+
|
| 171 |
+
We introduce RAINDROP, a graph-guided network for irregularly sampled time series. RAINDROP learns a distinct sensor dependency graph for every sample capturing time-varying dependencies between sensors. The ability to leverage graph structure gives RAINDROP unique capability to naturally handle misaligned observations, non-uniform time intervals between successive observations, and sensors with varying numbers of recorded observations. Our findings have implications for using message passing as a way to leverage relational information in multivariate time series.
|
| 172 |
+
|
| 173 |
+
# ACKNOWLEDGMENTS
|
| 174 |
+
|
| 175 |
+
This material is based upon work supported by the Under Secretary of Defense for Research and Engineering under Air Force Contract No. FA8702-15-D-0001. M.Z. is supported, in part, by NSF under nos. IIS-2030459 and IIS-2033384, Harvard Data Science Initiative, Amazon Research Award, Bayer Early Excellence in Science Award, AstraZeneca Research, and Roche Alliance with Distinguished Scientists Award. Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the funders. The authors declare that there are no conflict of interests.
|
| 176 |
+
|
| 177 |
+
# REPRODUCIBILITY STATEMENT
|
| 178 |
+
|
| 179 |
+
We ensure the reproducibility of our work by clearly presenting the model and providing publicly accessible code and data. For all datasets used in this work, we share downloadable links to the raw sources and processed and ready-to-run datasets with the research community through this link: https://github.com/mims-harvard/Raindrop. We specify all training details (e.g., preprocessing, data splits, hyperparameters, sensor selection) in the main text and Appendix. Python implementation of RAINDROP and all baseline methods is available at the aforementioned link. Detailed description of data, scripts, and configurations along with examples of usage are also provided.
|
| 180 |
+
|
| 181 |
+
# ETHICS STATEMENT
|
| 182 |
+
|
| 183 |
+
The ability of RAINDROP to learn robust information about sensors’ representations and dependencies creates new opportunities for applications, where time series are predominant, e.g., in healthcare, biology, and finance. In all these fields, especially in healthcare applications, our method should be used with caution. Although our model can gain valuable insights from time series, users must consider the limitations of machine-guided predictions. As with all data-driven solutions, our model may make biased predictions. In the case of biomedical data, biases can exist within the data itself, which can be, for example, caused by considering demographic attributes, such as age, weight, and gender, that might correlate with protected/regulated attributes. When target classes are highly imbalanced, our model can mitigate the issues by upsampling minority classes in every processed batch.
|
| 184 |
+
|
| 185 |
+
All datasets in this paper are publicly available and are not associated with any privacy or security concern. Further, all data are anonymized to guard against breaching patients’ protected health information. We followed PhysioNet privacy policy and guidelines (https://archive.physionet.org/ privacy.shtml) when experimenting with P12 and P19 datasets.
|
| 186 |
+
|
| 187 |
+
# REFERENCES
|
| 188 |
+
|
| 189 |
+
Denis Agniel, Isaac S Kohane, and Griffin M Weber. Biases in electronic health record data due to processes within the healthcare system: retrospective observational study. British Medical Journal, 361, 2018.
|
| 190 |
+
|
| 191 |
+
Zhengping Che, Sanjay Purushotham, Kyunghyun Cho, David Sontag, and Yan Liu. Recurrent neural networks for multivariate time series with missing values. Scientific Reports, 8(1):1–12, 2018.
|
| 192 |
+
|
| 193 |
+
Tian Qi Chen, Yulia Rubanova, Jesse Bettencourt, and David K Duvenaud. Neural ordinary differential equations. In NeurIPS, 2018.
|
| 194 |
+
|
| 195 |
+
Zekai Chen, E Jiaze, Xiao Zhang, Hao Sheng, and Xiuzheng Cheng. Multi-task time series forecasting with shared attention. In ICDM Workshop, pp. 917–925, 2020.
|
| 196 |
+
|
| 197 |
+
Kyunghyun Cho, Bart Van Merriënboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Holger Schwenk, and Yoshua Bengio. Learning phrase representations using rnn encoder-decoder for statistical machine translation. 2014.
|
| 198 |
+
|
| 199 |
+
Edward Choi, Zhen Xu, Yujia Li, Michael Dusenberry, Gerardo Flores, Emily Xue, and Andrew Dai. Learning the graphical structure of electronic health records with graph convolutional transformer. In AAAI, volume 34, pp. 606–613, 2020.
|
| 200 |
+
|
| 201 |
+
Federico Errica, Davide Bacciu, and Alessio Micheli. Graph mixture density networks. In ICML, pp. 3025–3035, 2021.
|
| 202 |
+
|
| 203 |
+
Chenguang Fang and Chen Wang. Time series data imputation: A survey on deep learning approaches. arXiv:2011.11347, 2020.
|
| 204 |
+
|
| 205 |
+
Hassan Ismail Fawaz, Germain Forestier, Jonathan Weber, Lhassane Idoumghar, and Pierre-Alain Muller. Deep learning for time series classification: a review. Data Mining and Knowledge Discovery, 33(4):917–963, 2019.
|
| 206 |
+
|
| 207 |
+
Matthias Fey, Jan-Gin Yuen, and Frank Weichert. Hierarchical inter-message passing for learning on molecular graphs. arXiv:2006.12179, 2020.
|
| 208 |
+
|
| 209 |
+
Mikhail Galkin, Priyansh Trivedi, Gaurav Maheshwari, Ricardo Usbeck, and Jens Lehmann. Message passing for hyper-relational knowledge graphs. arXiv:2009.10847, 2020.
|
| 210 |
+
|
| 211 |
+
Prakhar Ganesh, Yao Chen, Xin Lou, Mohammad Ali Khan, Yin Yang, Hassan Sajjad, Preslav Nakov, Deming Chen, and Marianne Winslett. Compressing large-scale transformer-based models: A case study on bert. Transactions of the Association for Computational Linguistics, 9:1061–1080, 2021.
|
| 212 |
+
|
| 213 |
+
Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. In ICML, pp. 1263–1272. PMLR, 2017.
|
| 214 |
+
|
| 215 |
+
Ary L. Goldberger, Luis A. Nunes Amaral, L Glass, Jeffrey M. Hausdorff, Plamen Ch. Ivanov, Roger G. Mark, Joseph E. Mietus, George B. Moody, Chung-Kang Peng, and Harry Eugene Stanley. PhysioBank, PhysioToolkit, and PhysioNet: components of a new research resource for complex physiologic signals. Circulation, 101 23:E215–20, 2000.
|
| 216 |
+
|
| 217 |
+
Max Horn, Michael Moor, Christian Bock, Bastian Rieck, and Karsten Borgwardt. Set functions for time series. pp. 4303–4313, 2020.
|
| 218 |
+
|
| 219 |
+
Jie Hu, Li Shen, and Gang Sun. Squeeze-and-excitation networks. In CVPR, pp. 7132–7141, 2018.
|
| 220 |
+
|
| 221 |
+
Wenjie Hu, Yang Yang, Ziqiang Cheng, Carl Yang, and Xiang Ren. Time-series event prediction with evolutionary state graph. In WSDM, pp. 580–588, 2021.
|
| 222 |
+
|
| 223 |
+
Ziniu Hu, Yuxiao Dong, Kuansan Wang, and Yizhou Sun. Heterogeneous graph transformer. In The Web Conference, pp. 2704–2710, 2020.
|
| 224 |
+
|
| 225 |
+
Ekaterina Kalinicheva, Dino Ienco, Jérémie Sublime, and Maria Trocan. Unsupervised change detection analysis in satellite image time series using deep learning combined with graph-based approaches. IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing, 13:1450–1466, 2020.
|
| 226 |
+
|
| 227 |
+
Patrick Kidger, James Morrill, James Foster, and Terry Lyons. Neural controlled differential equations for irregular time series. arXiv:2005.08926, 2020.
|
| 228 |
+
|
| 229 |
+
Byung-Hoon Kim, Jong Chul Ye, and Jae-Jin Kim. Learning dynamic graph representation of brain connectome with spatio-temporal attention. arXiv:2105.13495, 2021.
|
| 230 |
+
|
| 231 |
+
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv:1412.6980, 2014.
|
| 232 |
+
|
| 233 |
+
Liying Li, Yang Liu, Tongquan Wei, and Xin Li. Exploring inter-sensor correlation for missing data estimation. In IECON, pp. 2108–2114. IEEE, 2020a.
|
| 234 |
+
|
| 235 |
+
Michelle M Li, Kexin Huang, and Marinka Zitnik. Representation learning for networks in biology and medicine: Advancements, challenges, and opportunities. arXiv:2104.04883, 2021.
|
| 236 |
+
|
| 237 |
+
S. C.-X. Li and B. M. Marlin. A scalable end-to-end gaussian process adapter for irregularly sampled time series classification. In NIPS, pp. 1804–1812, 2016.
|
| 238 |
+
|
| 239 |
+
Steven Cheng-Xian Li and Benjamin Marlin. Learning from irregularly-sampled time series: A missing data perspective. In ICML, pp. 5937–5946. PMLR, 2020.
|
| 240 |
+
|
| 241 |
+
Xiaoxue Li, Yanmin Shang, Yanan Cao, Yangxi Li, Jianlong Tan, and Yanbing Liu. Type-aware anchor link prediction across heterogeneous networks based on graph attention network. In AAAI, volume 34, pp. 147–155, 2020b.
|
| 242 |
+
|
| 243 |
+
Wu Lin, Nicolas Hubacher, and Mohammad Emtiyaz Khan. Variational message passing with structured inference networks. ICLR, 2018.
|
| 244 |
+
|
| 245 |
+
R. J. Little and D. B. Rubin. Statistical Analysis with Missing Data. John Wiley & Sons, 3 edition, 2014.
|
| 246 |
+
|
| 247 |
+
Qianli Ma, Sen Li, and Garrison Cottrell. Adversarial joint-learning recurrent neural network for incomplete time series classification. TPAMI, 2020.
|
| 248 |
+
|
| 249 |
+
Karl Øyvind Mikalsen, Cristina Soguero-Ruiz, Filippo Maria Bianchi, Arthur Revhaug, and Robert Jenssen. Time series cluster kernels to exploit informative missingness and incomplete label information. Pattern Recognition, 115:107896, 2021.
|
| 250 |
+
|
| 251 |
+
Daniel Neil, Michael Pfeiffer, and Shih-Chii Liu. Phased lstm: accelerating recurrent network training for long or event-based sequences. In NIPS, pp. 3889–3897, 2016.
|
| 252 |
+
|
| 253 |
+
Giannis Nikolentzos, Antoine Tixier, and Michalis Vazirgiannis. Message passing attention networks for document understanding. In AAAI, volume 34, pp. 8544–8551, 2020.
|
| 254 |
+
|
| 255 |
+
S Ravuri, K Lenc, M Willson, D Kangin, R Lam, P Mirowski, M Athanassiadou, S Kashem, S Madge, R Prudden, et al. Skillful precipitation nowcasting using deep generative models of radar, arxiv. Nature, 597:672–677, 2021.
|
| 256 |
+
|
| 257 |
+
Attila Reiss and Didier Stricker. Introducing a new benchmarked dataset for activity monitoring. In ISWC, pp. 108–109, 2012.
|
| 258 |
+
|
| 259 |
+
Matthew A Reyna, Christopher S Josef, Russell Jeter, Supreeth P Shashikumar, M Brandon Westover, Shamim Nemati, Gari D Clifford, and Ashish Sharma. Early prediction of sepsis from clinical data: The physionet/computing in cardiology challenge 2019. Critical Care Medicine, 48(2):210–217, 2020.
|
| 260 |
+
|
| 261 |
+
Pau Riba, Andreas Fischer, Josep Lladós, and Alicia Fornés. Learning graph distances with message passing neural networks. In ICPR, pp. 2239–2244. IEEE, 2018.
|
| 262 |
+
|
| 263 |
+
J. L. Schafer and J. W. Graham. Missing data: Our view of the state of the art. Psychological Methods, 7(2), 2002.
|
| 264 |
+
|
| 265 |
+
Omer Berat Sezer, Mehmet Ugur Gudelek, and Ahmet Murat Ozbayoglu. Financial time series forecasting with deep learning: A systematic literature review: 2005–2019. Applied Soft Computing, 90:106181, 2020.
|
| 266 |
+
|
| 267 |
+
Siyuan Shan and Junier B Oliva. Nrtsi: Non-recurrent time series imputation for irregularly-sampled data. arXiv:2102.03340, 2021.
|
| 268 |
+
|
| 269 |
+
Paul Shannon, Andrew Markiel, Owen Ozier, Nitin S Baliga, Jonathan T Wang, Daniel Ramage, Nada Amin, Benno Schwikowski, and Trey Ideker. Cytoscape: a software environment for integrated models of biomolecular interaction networks. Genome Research, 13(11):2498–2504, 2003.
|
| 270 |
+
|
| 271 |
+
Satya Narayan Shukla and Benjamin Marlin. Interpolation-prediction networks for irregularly sampled time series. In ICLR, 2018.
|
| 272 |
+
|
| 273 |
+
Satya Narayan Shukla and Benjamin Marlin. Multi-time attention networks for irregularly sampled time series. In ICLR, 2021.
|
| 274 |
+
|
| 275 |
+
Satya Narayan Shukla and Benjamin M Marlin. A survey on principles, models and methods for learning from irregularly sampled time series. 2020.
|
| 276 |
+
|
| 277 |
+
Rafael T Sousa, Lucas A Pereira, and Anderson S Soares. Improving irregularly sampled time series learning with dense descriptors of time. arXiv:2003.09291, 2020.
|
| 278 |
+
|
| 279 |
+
Qingxiong Tan, Mang Ye, Baoyao Yang, Siqi Liu, Andy Jinhua Ma, Terry Cheuk-Fung Yip, Grace Lai-Hung Wong, and PongChi Yuen. DATA-GRU: Dual-attention time-aware gated recurrent unit for irregular multivariate time series. In AAAI, volume 34, pp. 930–937, 2020.
|
| 280 |
+
|
| 281 |
+
Sindhu Tipirneni and Chandan K Reddy. Self-supervised transformer for multivariate clinical time-series with missing values. arXiv:2107.14293, 2021.
|
| 282 |
+
|
| 283 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NIPS, pp. 5998–6008, 2017.
|
| 284 |
+
|
| 285 |
+
Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Liò, and Yoshua ´ Bengio. Graph attention networks. In ICLR, 2018.
|
| 286 |
+
|
| 287 |
+
Xiaoyang Wang, Yao Ma, Yiqi Wang, Wei Jin, Xin Wang, Jiliang Tang, Caiyan Jia, and Jian Yu. Traffic flow prediction via spatial temporal graph neural network. In The Web Conference 2020, pp. 1082–1092, 2020.
|
| 288 |
+
|
| 289 |
+
Zhen Wang, Yang Zhang, Ai Jiang, Ji Zhang, Zhao Li, Jun Gao, Ke Li, and Chenhao Lu. Dama-net: A novel predictive model for irregularly asynchronously and sparsely sampled multivariate time series. In ICML’W, 2011.
|
| 290 |
+
|
| 291 |
+
B. J. Wells, K. M. Chagin, A. S. Nowacki, and M. W. Kattan. Strategies for handling missing data in electronic health record derived data. EGEMS, 1(3), 2013.
|
| 292 |
+
|
| 293 |
+
Sifan Wu, Xi Xiao, Qianggang Ding, Peilin Zhao, Ying Wei, and Junzhou Huang. Adversarial sparse transformer for time series forecasting. In NeurIPS, volume 33, 2020a.
|
| 294 |
+
|
| 295 |
+
Yinjun Wu, Jingchao Ni, Wei Cheng, Bo Zong, Dongjin Song, Zhengzhang Chen, Yanchi Liu, Xuchao Zhang, Haifeng Chen, and Susan Davidson. Dynamic gaussian mixture based deep generative model for robust forecasting on sparse multivariate time series. In AAAI, 2021.
|
| 296 |
+
|
| 297 |
+
Zonghan Wu, Shirui Pan, Fengwen Chen, Guodong Long, Chengqi Zhang, and S Yu Philip. A comprehensive survey on graph neural networks. IEEE Transactions on Neural Networks and Learning Systems, 32(1):4–24, 2020b.
|
| 298 |
+
|
| 299 |
+
Zonghan Wu, Shirui Pan, Guodong Long, Jing Jiang, Xiaojun Chang, and Chengqi Zhang. Connecting the dots: Multivariate time series forecasting with graph neural networks. In KDD, pp. 753–763, 2020c.
|
| 300 |
+
|
| 301 |
+
Jianing Yang, Yongxin Wang, Ruitao Yi, Yuying Zhu, Azaan Rehman, Amir Zadeh, Soujanya Poria, and Louis-Philippe Morency. Mtag: Modal-temporal attention graph for unaligned human multimodal language sequences. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 1009–1021, 2021.
|
| 302 |
+
|
| 303 |
+
Seongjun Yun, Minbyul Jeong, Raehyun Kim, Jaewoo Kang, and Hyunwoo J Kim. Graph transformer networks. In NeurIPS, volume 32, pp. 11983–11993, 2019.
|
| 304 |
+
|
| 305 |
+
George Zerveas, Srideepika Jayaraman, Dhaval Patel, Anuradha Bhamidipaty, and Carsten Eickhoff. A transformer-based framework for multivariate time series representation learning. In KDD, pp. 2114–2124, 2021.
|
| 306 |
+
|
| 307 |
+
Daochen Zha, Kwei-Herng Lai, Kaixiong Zhou, and Xia Hu. Towards similarity-aware time-series classification. SDM, 2022.
|
| 308 |
+
|
| 309 |
+
Chuxu Zhang, Dongjin Song, Yuncong Chen, Xinyang Feng, Cristian Lumezanu, Wei Cheng, Jingchao Ni, Bo Zong, Haifeng Chen, and Nitesh V Chawla. A deep neural network for unsupervised anomaly detection and diagnosis in multivariate time series data. In AAAI, volume 33, pp. 1409–1416, 2019.
|
| 310 |
+
|
| 311 |
+
Li Zhang, Dan Xu, Anurag Arnab, and Philip HS Torr. Dynamic graph message passing networks. In CVPR, pp. 3726–3735, 2020.
|
| 312 |
+
|
| 313 |
+
Jie Zhou, Ganqu Cui, Shengding Hu, Zhengyan Zhang, Cheng Yang, Zhiyuan Liu, Lifeng Wang, Changcheng Li, and Maosong Sun. Graph neural networks: A review of methods and applications. AI Open, 1:57–81, 2020.
|
| 314 |
+
|
| 315 |
+
# A APPENDIX
|
| 316 |
+
|
| 317 |
+
# A.1 ENCODING TIMESTAMPS
|
| 318 |
+
|
| 319 |
+
For a given time value $t$ , we pass it to trigonometric functions with the frequency of 10,000 (Vaswani et al., 2017) and generate time representation $\boldsymbol { p } ^ { t } \in \mathbf { R } ^ { \xi }$ (omit sample index $i$ for brevity) through (Horn et al., 2020):
|
| 320 |
+
|
| 321 |
+
$$
|
| 322 |
+
p _ { 2 k } ^ { t } = \sin ( \frac { t } { 1 0 0 0 0 ^ { 2 k / \xi } } ) , \quad p _ { 2 k + 1 } ^ { t } = \cos ( \frac { t } { 1 0 0 0 0 ^ { 2 k / \xi } } ) ,
|
| 323 |
+
$$
|
| 324 |
+
|
| 325 |
+
where $\xi$ is the expected dimension. In this work, we set $\xi = 1 6$ in all experimental settings for all models. Please note, we encode the time value which is a continuous timestamp, instead of time position which is a discrete integer indicating the order of observation in time series.
|
| 326 |
+
|
| 327 |
+
# A.2 ADDITIONAL INFORMATION ON THE CALCULATION OF TEMPORAL ATTENTION WEIGHT
|
| 328 |
+
|
| 329 |
+
The Eq. 4 describes how we learn the temporal attention weights vector $\beta _ { i , v }$ for sensor $v$ , following the self-attention formalism. Different from the standard self-attention mechanism that generates an self-attention matrix, we generate a temporal attention weight vector. The reason is that we only need an attention weight vector (instead of a matrix) to aggregate the observation embeddings into a single sensor embedding through weighted sum.
|
| 330 |
+
|
| 331 |
+
In the standard self-attention matrix, each element denotes the dependency of an observation embedding on another observation embedding. Similarly, each row describes the dependencies of an observation embedding on all other observation embeddings (all the observations belong to the same sensor). Our intuition is to aggregate a row in the self-attention matrix into a scalar that denotes the importance of the observation embedding to the whole sensor embedding.
|
| 332 |
+
|
| 333 |
+
In practice, we apply the weighted aggregation, parameterized by $\pmb { s }$ , to every row in the self-attention matrix and concatenate the generated scalars into an attention vector. Next, we give a concrete example to specifically describe the meaning of $\pmb { s }$ . Each row, $j$ , of the self-attention matrix captures relationships of observation embedding $h _ { i , v } ^ { t _ { j } }$ to all observation embeddings $\{ h _ { i , v } ^ { t _ { k } } : k = 1 , . . . , T \}$ Then, using the learnable weight vector $\pmb { s }$ , these correlations between observations are aggregated across time to obtain temporal importance weight $\beta _ { i , v } ^ { t _ { j } }$ . The $\beta _ { i , v } ^ { t _ { j } }$ represents the importance of the corresponding observation to the whole sensor embedding.
|
| 334 |
+
|
| 335 |
+
# A.3 ADDITIONAL INFORMATION ON SAMPLE EMBEDDING
|
| 336 |
+
|
| 337 |
+
As we generate sample embedding by concatenating all sensor embeddings, the sample embedding could be relatively long when there is a large number of sensors. To alleviate this issue, on one hand, we can reduce the dimension of sample embeddings by adding a neural layer (such as a simple fully-connected layer) after the concatenation. On the other hand, when the number of sensors is super large, our model is flexible and can effortlessly switch the concatenation to other readout functions (such as averaging aggregation): this will naturally solve the problem of long vectors. We empirically show that concatenation works better than averaging in our case. We see a boost in the AUROC score by $0 . 6 \%$ using concatenation instead of averaging for generating sample embeddings(P19; Setting 1).
|
| 338 |
+
|
| 339 |
+
# A.4 ADDITIONAL INFORMATION ON SAMPLE SIMILARITIES
|
| 340 |
+
|
| 341 |
+
In this work, we assume all samples share some common characteristics to some extent. When modeling the similarities across samples, we do not consider the situation where the samples are similar within latent groups and different across groups.
|
| 342 |
+
|
| 343 |
+
Our study focuses on the question of irregularity rather than the question of distribution shifts in time series. To this end, in our experiments, we first rigorously benchmark Raindrop using a standard evaluating setup (Setting 1, which is classification of irregular time series). This is the only setup that most existing methods consider (e.g., Shukla & Marlin (2021); Che et al. (2018)) and we want to make sure our comparisons are fair. In order to provide a more rigorous assessment of Raindrop’s performance, we also consider more challenging setups in our experiments (i.e., Settings 2-4) when the dataset is evaluated in a non-standard manner and the split is informed by a select data attribute.
|
| 344 |
+
|
| 345 |
+
Table 3: Dataset statistics. The ‘#-timestamps’ refers to the number of all sampling timestamps measured in this dataset. The ‘#-classes’ means the number of categories in dataset labels. The ’Static info’ indicates if sample’s static attributes (e.g., height and weight) are available. The ‘missing ratio’ denotes the ratio between the number of missing observations and the number of all possible observations if the dataset is fully-observed.
|
| 346 |
+
|
| 347 |
+
<table><tr><td>Datasets</td><td>#-samples</td><td>#-sensors</td><td>#-timestamps</td><td>#-classes</td><td>Static info</td><td>Missing ratio (%)</td></tr><tr><td>P19</td><td>38,803</td><td>34</td><td>60</td><td>2</td><td>True</td><td>94.9</td></tr><tr><td>P12</td><td>11,988</td><td>36</td><td>215</td><td>2</td><td>True</td><td>88.4</td></tr><tr><td>PAM</td><td>5,333</td><td>17</td><td>600</td><td>8</td><td>False</td><td>60.0</td></tr></table>
|
| 348 |
+
|
| 349 |
+
Our results on Setting 1 are consistent with those on Settings 2-4. Results on harder Settings 2-4 show that Raindrop can perform comparably better than baselines. Results across these diverse settings increase our confidence that Raindrop is quite flexible and widely applicable.
|
| 350 |
+
|
| 351 |
+
# A.5 FURTHER DETAILS ON DATASETS
|
| 352 |
+
|
| 353 |
+
P19: PhysioNet Sepsis Early Prediction Challenge 2019. P19 dataset (Reyna et al., 2020) contains 38,803 patients and each patient is monitored by 34 irregularly sampled sensors including 8 vital signs and 26 laboratory values. The original dataset has 40,336 patients, we remove the samples with too short or too long time series, remaining 38,803 patients (the longest time series of the patient has more than one and less than 60 observations). Each patient is associated with a static vector indicating attributes: age, gender, time between hospital admission and ICU admission, ICU type, and ICU length of stay (days). Each patient has a binary label representing occurrence of sepsis within the next 6 hours. The dataset is highly imbalanced with only ${ \sim } 4 \%$ positive samples.
|
| 354 |
+
|
| 355 |
+
P12: PhysioNet Mortality Prediction Challenge 2012. P12 dataset (Goldberger et al., 2000) includes 11,988 patients (samples), after removing 12 inappropriate samples following (Horn et al., 2020). Each patient contains multivariate time series with 36 sensors (excluding weight), which are collected in the first 48-hour stay in ICU. Each sample has a static vector with 9 elements including age, gender, etc. Each patient is associated with a binary label indicating length of stay in ICU, where negative label means hospitalization is not longer than 3 days and positive label marks hospitalization is longer than 3 days. P12 is imbalanced with ${ \sim } 9 3 \%$ positive samples.
|
| 356 |
+
|
| 357 |
+
PAM: PAMAP2 Physical Activity Monitoring. PAM dataset (Reiss & Stricker, 2012) measures daily living activities of 9 subjects with 3 inertial measurement units. We modify it to suit our scenario of irregular time series classification. We excluded the ninth subject due to short length of sensor readouts. We segment the continuous signals into samples with the time window of 600 and the overlapping rate of $50 \%$ . PAM originally has 18 activities of daily life. We exclude the ones associated with less than 500 samples, remaining 8 activities. After modification, PAM dataset contains 5,333 segments (samples) of sensory signals. Each sample is measured by 17 sensors and contains 600 continuous observations with the sampling frequency $1 0 0 ~ \mathrm { H z }$ . To make time series irregular, we randomly remove $60 \%$ of observations. To keep fair comparison, the removed observations are randomly selected but kept the same for all experimental settings and approaches. PAM is labelled by 8 classes where each class represents an activity of daily living. PAM does not include static attributes and the samples are approximately balanced across all 8 categories.
|
| 358 |
+
|
| 359 |
+
To feed given data into neural networks, we set the input as zero if no value was measured. In highly imbalanced datasets (P19 and P12) we perform batch minority class upsampling, which means that every processed batch has the same number of positive and negative class samples. The dataset statistics including sparse ratio are provided in Table 3.
|
| 360 |
+
|
| 361 |
+
# A.6 FURTHER DETAILS ON MODEL HYPERPARAMETERS
|
| 362 |
+
|
| 363 |
+
Baseline hyperparameters. The implementation of baselines follows the corresponding papers including SeFT (Horn et al., 2020), GRU-D (Che et al., 2018), and mTAND (Shukla & Marlin, 2021). We follow the settings of Transformer baseline in (Horn et al., 2020) while implementing Transformer in our work. For average imputation in Trans-mean, we replace the missing values by the global mean value of observations in the sensor (Shukla & Marlin, 2020). We use batch size of
|
| 364 |
+
|
| 365 |
+
128 and learning rate of 0.0001. Note that we upsample the minority class in each batch to make the batch balance (64 positive samples and 64 negative samples in each batch).
|
| 366 |
+
|
| 367 |
+
The chosen hyperparameters are the same across datasets (P19, P12, PAM), models (both baselines and RAINDROP), and experimental settings. Remarkably, we found that all the baselines make dummy predictions (classify all testing samples as the majority label) on PAM in Setting 2-3 while RAINDROP makes reasonable predictions. For the comparison to make sense (i.e., the baselines can make meaningful predictions), we use learning rate of 0.001 for baselines on PAM. GRU-D has 49 layers while other models have 2 layers. We run all models for 20 epochs, store the parameters that obtain the highest AUROC in the validation set, and use it to make predictions for testing samples. We use the Adam algorithm for gradient-based optimization (Kingma & Ba, 2014).
|
| 368 |
+
|
| 369 |
+
RAINDROP hyperparameters. Next, we report the setting of unique hyperparameters in our RAINDROP. In the generation of observation embedding, we set $\scriptstyle { \boldsymbol { R _ { u } } }$ as a 4-dimensional vector, thus the produced observation embedding has 4 dimensions. The dimensions of time representation $p ^ { t }$ and $\mathbf { \Delta } _ { \mathbf { \boldsymbol { r } } _ { v } }$ are both 16. The trainable weight matrix $_ { D }$ has shape of $4 \times 3 2$ . The dimensions of ${ \pmb w } _ { \pmb u }$ and $\mathbf { \Delta } _ { w _ { v } }$ are the same as the number of sensors: 34 in P19, 36 in P12, and 17 in PAM. We set the number of RAINDROP layers $L$ as 2 while the first layer prunes edges and the second layer does not. We set the proportion of edge pruning as $50 \%$ $( \mathrm { K } { = } 5 0 )$ ), which means we remove half of the existing edges that have the lowest weights. The $d _ { k }$ is set to 20, while the shape of $W$ is $2 0 \times 2 0$ . All the activation functions, without specific clarification, are sigmoid functions. The $d _ { a }$ is set equal to the number of sensors. The first layer of $\varphi$ has 128 neurons while the second layer has $C$ neurons (i.e., 2 for P19 and P12; 8 for PAM). We set $\lambda = 0 . 0 2$ to adjust $\mathcal { L } _ { r }$ regularization scale. All the preprocessed datasets and implementation codes are made available online. Further details are available through RAINDROP’s code and dataset repository.
|
| 370 |
+
|
| 371 |
+
Readout function. Here we discuss the selection of readout function $g$ in section 3.5. Our preliminary experiments show that concatenation outperforms other popular aggregation functions such as averaging (Errica et al., 2021) and squeeze-excitation readout function (Kim et al., 2021; Hu et al., 2018). While any of those aggregation functions can be considered, we used concatenation throughout all experiments in this manuscript.
|
| 372 |
+
|
| 373 |
+
# A.7 PERFORMANCE METRICS
|
| 374 |
+
|
| 375 |
+
Since P19 and P12 datasets are imbalanced, we use the Area Under a ROC Curve (AUROC) and Area Under Precision-Recall Curve (AUPRC) to measure performance. As the PAM dataset is nearly balanced, we also report accuracy, precision, recall and F1 score. We report mean and standard deviation values over 5 independent runs. Model parameters that achieve the best AUROC value on the validation set are used for test set.
|
| 376 |
+
|
| 377 |
+
# A.8 FURTHER DETAILS ON SETUP DETAILS FOR SETTING 2
|
| 378 |
+
|
| 379 |
+
In Setting 2, the selected missing sensors are fixed across different models and chosen in the following way. First, we calculate the importance score for each sensor and rank them in a descending order. The importance score is based on information gain, which we calculate with feeding the observations into a Random Forest classifier with 20 decision trees. In particular, we treat each sample as only having one sensor, then feed the single sensor into random forest classifier and record the AUROC. The higher AUROC indicates the sensor provides higher information gain. When we have sensors ranked by their AUROC values, we choose the first $n$ sensors (the ones with highest AUROC values) and replace all observations in these sensors by zeros in all samples in validation and test set. The number of missing sensors is defined indirectly from the user with the sensors’ missing ratio which ranges from 0.1 to 0.5.
|
| 380 |
+
|
| 381 |
+
# A.9 ADDITIONAL INFORMATION ON MISSING PATTERN
|
| 382 |
+
|
| 383 |
+
This work propose RAINDROP which is a novel solution for irregularity in multivariate time series through inter-sensor dependencies. RAINDROP is not in conflict with other solutions (such as missing pattern and temporal decay) for irregularity. However, as the missing pattern is widely discussed in modelling incomplete time series (Che et al., 2018), we explore how to combine the advantages of relational structures and missing pattern. We adopt mask matrix as a proxy of missing pattern as in Che et al. (2018). Taking the architecture of RAINDROP, we concatenate the observation $x _ { i , u } ^ { t }$ with a binary mask indicator $b _ { i , u } ^ { t }$ as input. The indicator $b _ { i , u } ^ { t }$ is set as 1 when there is an observation of sensor $i$ at time $t$ and set as 0 otherwise. All the experimental settings and hyperparameters are the same as in RAINDROP (P19; Setting 1). The experimental results show that taking advantage of missing pattern can slightly boost the AUROC by $1 . 2 \%$ and AUPRC by $0 . 9 \%$ in P19. This empirically shed the light for future research on integrating multiple characteristics in representation of irregularly time series.
|
| 384 |
+
|
| 385 |
+
# A.10 COMPARISON BETWEEN TEMPORAL ATTENTION AND LSTM
|
| 386 |
+
|
| 387 |
+
We conduct extensive experiments to compare the effectiveness of temporal attention and LSTM. To this end, we replace the temporal attention in sensor embedding generation (Eq 4-5) in RAINDROP by LSTM layer which processes all observation embeddings sequentially. We use zero padding to convert the irregular observations into fixed-length time series so the data can be fed into LSTM architecture. We regard the last output of LSTM as generated sensor embedding. The number of LSTM cells equal to the dimension of observation embedding. All the model structures are identical except in the part of temporal attention and LSTM. We keep all experimental settings (P19; Setting 1) and hyperparameter selections the same. The experimental results show that the temporal self-attention outperform LSTM by $1 . 8 \%$ (AUROC) and additionally saved $49 \%$ of the training time. One potential reason is that the self-attention mechanism avoids recursion and allows parallel computation and also reduces performance degradation caused by long-term dependencies (Ganesh et al., 2021; Vaswani et al., 2017).
|
| 388 |
+
|
| 389 |
+
# A.11 ADDITIONAL INFORMATION ON METHOD BENCHMARKING
|
| 390 |
+
|
| 391 |
+
Taking experimental Setting 1 (i.e., classic time series classification) as an example, we conduct extensive experiments to compare Raindrop with ODE-RNN (Chen et al., 2020), $\mathrm { D G } \mathbf { \bar { M } } ^ { 2 }$ -O (Wu et al., 2021), EvoNet (Hu et al., 2021), and MTGNN (Wu et al., 2020c). As IP-Net (Shukla & Marlin, 2018) and mTAND (Shukla & Marlin, 2021) are from the same authors, we only compare with mTAND which is the latest model. For the baselines, we follow the settings as provided in their public codes. For methods, which cannot deal with irregular data (e.g., EvoNet and MTGNN), we first impute the missing data using mean imputation and then feed data into the model. For forecasting models (e.g., MTGNN) which are strictly not comparable with the proposed classification model, we formulate the task as a single-step forecasting, concatenate the learned representations from all sensors and feed into a fully-connected layer (work as classifier) to make prediction, and use cross-entropy to quantify the loss.
|
| 392 |
+
|
| 393 |
+
# A.12 RESULTS FOR P19 (SETTINGS 2-3)
|
| 394 |
+
|
| 395 |
+
Here we report the experimental results for P19 in Setting 2 (Table 4) and Setting 3 (Table 5).
|
| 396 |
+
|
| 397 |
+
Table 4: Classification on samples with fixed missing sensors (P19; Setting 2)
|
| 398 |
+
|
| 399 |
+
<table><tr><td rowspan="3">Models</td><td colspan="10">Missing ratio</td></tr><tr><td colspan="2">0%</td><td colspan="2">10%</td><td colspan="2">20%</td><td colspan="2">30%</td><td colspan="2">40%</td><td colspan="2">50%</td></tr><tr><td>AUROC</td><td>AUPRC</td><td>AUROC</td><td>AUPRC</td><td>AUROC</td><td>AUPRC</td><td>AUROC</td><td>AUPRC</td><td>AUROC</td><td>AUPRC</td><td>AUROC</td><td>AUPRC</td></tr><tr><td>Transformer</td><td>83.2 ± 1.3</td><td>47.6 ± 3.8</td><td>77.4 ± 3.5</td><td>38.2 ± 4.2</td><td>75.7 ± 3.4</td><td>35.2 ± 5.4</td><td>75.1 ± 3.5</td><td>35.5 ± 4.4</td><td>75.3 ± 3.5</td><td>36.2 ± 4.2</td><td>74.9 ± 3.1</td><td>35.5±5.0</td></tr><tr><td>Trans-mean</td><td>84.1 ± 1.7</td><td>47.4 ± 1.4</td><td>79.2 ± 2.7</td><td>40.6 ± 5.7</td><td>79.8 ± 2.5</td><td>38.3 ± 2.8</td><td>76.9 ± 2.4</td><td>37.5 ± 5.9</td><td>76.4 ± 2.0</td><td>36.3 ±5.8</td><td>74.1 ± 2.3</td><td>41.3 ± 4.7</td></tr><tr><td>GRU-D</td><td>83.9 ± 1.7</td><td>46.9 ± 2.1</td><td>79.6± 2.2</td><td>37.4 ± 2.5</td><td>77.5 ± 3.1</td><td>36.5± 4.6</td><td>76.6 ± 2.9</td><td>35.1 ± 2.4</td><td>74.6 ± 2.7</td><td>35.9±2.7</td><td>74.1 ± 2.9</td><td>33.2 ± 3.8</td></tr><tr><td>SeFT</td><td>78.7 ± 2.4</td><td>31.1 ± 2.8</td><td>77.3 ± 2.4</td><td>25.5 ± 2.3</td><td>63.5± 2.0</td><td>14.0 ± 1.1</td><td>62.3 ± 2.1</td><td>12.9 ± 1.2</td><td>57.8± 1.7</td><td>9.8 ± 1.1</td><td>56.0 ± 3.1</td><td>7.8±1.3</td></tr><tr><td>mTAND</td><td>80.4 ± 1.3</td><td>32.4 ± 1.8</td><td>79.7 ± 2.2</td><td>29.0 ± 4.3</td><td>77.8 ± 1.9</td><td>25.3 ± 2.4</td><td>77.7 ± 1.9</td><td>27.8 ± 2.6</td><td>79.4 ± 2.0</td><td>32.1 ± 2.1</td><td>77.3 ± 2.1</td><td>27.0 ± 2.5</td></tr><tr><td>RAINDROP</td><td>87.0 ± 2.3</td><td>51.8± 5.5</td><td>84.3 ± 2.5</td><td>46.1 ± 3.5</td><td>81.9 ± 2.1</td><td>45.2 ± 6.4</td><td>81.4 ± 2.1</td><td>43.7 ± 7.2</td><td>81.8±2.2</td><td>44.9 ± 6.6</td><td>79.7 ± 1.9</td><td>43.8 ± 5.6</td></tr></table>
|
| 400 |
+
|
| 401 |
+
Table 5: Classification on samples with random missing sensors (P19; Setting 3)
|
| 402 |
+
|
| 403 |
+
<table><tr><td rowspan="3">Models</td><td colspan="10">Missing ratio</td></tr><tr><td colspan="2">0%</td><td colspan="2">10%</td><td colspan="2">20%</td><td colspan="2">30%</td><td colspan="2">40%</td><td colspan="2">50%</td></tr><tr><td>AUROC</td><td>AUPRC</td><td>AUROC</td><td>AUPRC</td><td>AUROC</td><td>AUPRC</td><td>AUROC</td><td>AUPRC</td><td>AUROC</td><td>AUPRC</td><td>AUROC</td><td>AUPRC</td></tr><tr><td>Transformer</td><td>83.2 ± 1.3</td><td>47.6 ± 3.8</td><td>82.2 ±2.7</td><td>46.8 ± 3.5</td><td>81.6± 3.5</td><td>42.5 ±8.5</td><td>81.3 ± 3.1</td><td>42.1 ± 4.5</td><td>80.2 ±2.9</td><td>41.9 ± 6.8</td><td>79.2 ± 1.9</td><td>43.7 ± 3.7</td></tr><tr><td>Trans-mean</td><td>84.1 ± 1.7</td><td>47.4 ± 1.4</td><td>82.5± 3.7</td><td>44.7 ± 6.8</td><td>81.7± 2.0</td><td>45.9 ± 3.6</td><td>81.2 ± 2.2</td><td>43.2 ± 6.3</td><td>80.2 ± 1.7</td><td>41.5 ± 4.8</td><td>79.8 ± 3.1</td><td>39.3 ± 5.1</td></tr><tr><td>GRU-D</td><td>83.9 ± 1.7</td><td>46.9 ± 2.1</td><td>81.2 ± 3.4</td><td>46.4 ± 2.7</td><td>78.6 ± 4.1</td><td>43.3 ± 2.4</td><td>76.3 ± 2.5</td><td>28.5 ± 2.1</td><td>74.2 ± 2.7</td><td>29.6± 3.1</td><td>74.6 ± 3.5</td><td>26.5± 4.2</td></tr><tr><td>SeFT</td><td>78.7 ± 2.4</td><td>31.1 ± 2.8</td><td>76.8±2.2</td><td>28.3± 2.5</td><td>77.0± 2.2</td><td>24.1 ± 2.4</td><td>75.2 ± 2.2</td><td>22.5±3.0</td><td>73.6± 2.7</td><td>18.3±3.2</td><td>72.6 ± 2.5</td><td>15.7 ± 1.9</td></tr><tr><td>mTAND</td><td>80.4 ± 1.3</td><td>32.4 ± 1.8</td><td>75.2± 2.5</td><td>24.5 ± 2.4</td><td>74.4 ± 3.5</td><td>24.6± 3.5</td><td>74.2 ± 3.2</td><td>22.6 ± 2.3</td><td>74.1 ± 2.6</td><td>23.1± 3.6</td><td>73.9 ± 3.7</td><td>24.6 ± 3.7</td></tr><tr><td>RAINDROP</td><td>87.0 ± 2.3</td><td>51.8 ± 5.5</td><td>85.5± 2.1</td><td>50.2±5.5</td><td>83.5±3.2</td><td>47.4± 7.0</td><td>83.1 ±1.5</td><td>48.2 ±4.7</td><td>82.6 ± 1.7</td><td>48.0 ±5.5</td><td>80.9 ± 2.4</td><td>45.2 ± 6.9</td></tr></table>
|
| 404 |
+
|
| 405 |
+
Table 6: Comparison of results when excluding dependency graph in RAINDROP (P19; Setting 4). The results are the same as in Table 8 except the row of ‘RAINDROP w/o graph’, where we do not consider inter-sensor dependencies and set all sensors as independent in the dependency graph.
|
| 406 |
+
|
| 407 |
+
<table><tr><td rowspan="3">Model</td><td colspan="8">Generalizing to a new patient group</td></tr><tr><td colspan="2">Train: Young→ Test: Old</td><td colspan="2">Train: Old→Test: Young</td><td colspan="2">Train: Male → Test: Female</td><td colspan="2">Train: Female → Test: Male</td></tr><tr><td>AUROC</td><td>AUPRC</td><td>AUROC</td><td>AUPRC</td><td>AUROC</td><td>AUPRC</td><td>AUROC</td><td>AUPRC</td></tr><tr><td>Transformer</td><td>76.2 ± 0.7</td><td>30.5±4.8</td><td>76.5 ± 1.1</td><td>33.7 ± 5.7</td><td>77.8 ± 1.1</td><td>26.0±6.2</td><td>75.2 ± 1.0</td><td>30.3 ± 5.5</td></tr><tr><td>Trans-mean</td><td>80.6 ±1.4</td><td>39.8 ± 4.2</td><td>78.4 ±1.1</td><td>35.8±2.9</td><td>80.2 ± 1.7</td><td>32.1 ± 1.9</td><td>76.4±0.8</td><td>32.5±3.3</td></tr><tr><td>GRU-D</td><td>76.5 ± 1.7</td><td>29.5 ± 2.3</td><td>79.6 ±1.7</td><td>35.2 ± 4.6</td><td>78.5 ± 1.6</td><td>31.9 ± 4.8</td><td>76.3 ±2.5</td><td>31.1 ± 2.6</td></tr><tr><td>SeFT</td><td>77.5 ± 0.7</td><td>26.6 ± 1.2</td><td>78.9 ±1.0</td><td>32.7 ±2.7</td><td>78.6 ±0.6</td><td>31.1 ± 1.2</td><td>76.9 ± 0.5</td><td>26.4 ± 1.1</td></tr><tr><td>mTAND</td><td>79.0 ±0.8</td><td>28.8± 2.3</td><td>79.4±0.6</td><td>29.8 ±1.2</td><td>78.0 ±0.9</td><td>26.5 ±1.7</td><td>78.9 ±1.2</td><td>29.2 ± 2.0</td></tr><tr><td>RAINDROP W/o graph</td><td>80.5 ± 1.1</td><td>31.6 ± 2.1</td><td>78.5±0.9</td><td>36.7 ±2.7</td><td>81.3 ±1.5</td><td>36.8±1.7</td><td>77.5 ± 1.9</td><td>33.4 ± 2.6</td></tr><tr><td>RAINDROP</td><td>83.2 ± 1.6</td><td>43.6 ± 4.7</td><td>82.0 ± 4.4</td><td>44.3 ± 3.6</td><td>85.0 ± 1.4</td><td>45.2 ± 2.9</td><td>81.2 ± 3.8</td><td>40.7 ± 2.9</td></tr></table>
|
| 408 |
+
|
| 409 |
+
Table 7: Results of ablation study on the PAM dataset (Setting 1).
|
| 410 |
+
|
| 411 |
+
<table><tr><td colspan="2">RAINDROP Model</td><td>Accuracy</td><td>Precision</td><td>Recall</td><td>F1 score</td></tr><tr><td colspan="2">W/o weights vector Ru</td><td>81.1 ± 2.6</td><td>81.9 ± 2.4</td><td>80.1 ± 1.6</td><td>81.6± 2.1</td></tr><tr><td rowspan="3">W/o inter-sensor dependency</td><td>W/o ei,uv</td><td>82.6± 1.2</td><td>82.9± 1.6</td><td>84.3± 1.4</td><td>83.8± 1.7</td></tr><tr><td>W/oru W/op</td><td>86.5 ± 2.4</td><td>83.3 ± 1.9</td><td>82.6± 1.5</td><td>82.9 ± 1.4</td></tr><tr><td>Wloau</td><td>79.8 ± 2.7 85.2 ± 2.5</td><td>80.1 ± 3.6 86.4 ± 2.7</td><td>80.6 ± 1.7 84.5 ± 2.9</td><td>80.2 ± 2.9 85.6 ± 2.9</td></tr><tr><td colspan="2">W/o temporal attention</td><td>81.5 ± 1.9</td><td>84.6± 1.7</td><td>83.9 ± 2.5</td><td></td></tr><tr><td colspan="2">W/o sensor level concatenation</td><td>84.4 ± 2.1</td><td>86.7± 1.1</td><td>85.2± 1.9</td><td>84.2 ± 2.2</td></tr><tr><td colspan="2">W/o regularization term Lr</td><td>87.3 ± 2.9</td><td>88.6± 3.4</td><td>87.1± 2.8</td><td>85.8± 2.6</td></tr><tr><td colspan="2">Full RAINDROP</td><td>88.5±1.5</td><td>89.9±1.5</td><td>89.9±0.6</td><td>87.6 ± 3.1 89.8±1.0</td></tr></table>
|
| 412 |
+
|
| 413 |
+
A.13 EVALUATION ON GROUP-WISE TIME SERIES CLASSIFICATION
|
| 414 |
+
|
| 415 |
+
To understand whether RAINDROP can adaptively adjust its structure and generalize well to other groups of samples which were not observed while training the model. In this setting we split the data into two groups, based on a specific static attribute. The first split attribute is age, where we classify people into young $\mathit { \Theta } _ { \mathrm { . } } < 6 5$ years) and old $\geq 6 5$ years) groups. We also split patients into male and female by gender attribute. Given the split attribute, we use one group as a train set and randomly split the other group into equally sized validation and test set.
|
| 416 |
+
|
| 417 |
+
Taking P19 as an example, we present the classification results when the training and testing samples are from different groups. As shown in Table 8, RAINDROP achieves the best results over all of the four given cross-group scenarios. For instance, RAINDROP claims large margins (with $4 . 8 \%$ i n AUROC and $1 3 . 1 \%$ in AUPRC absolute improvement) over the second best model while training on males and testing on female patients.
|
| 418 |
+
|
| 419 |
+
Although RAINDROP is not designed to address domain adaptation explicitly, the results show that RAINDROP performs better than baselines when transferring from one group of samples to another. One reason for our good performance is that the learned inter-sensor weights and dependency graphs are sample-specific and their learning is based on the sample’s observations. Thus, the proposed RAINDROP has the power, to some extent, to adaptively learn the inter-sensor dependencies based on the test sample’s measurements. RAINDROP is not generalizing to new groups, but generalizing to new samples, which leads to a good performance even though our model is not designed for domain adaptation. We validate the reason empirically. We remove the inter-sensor dependencies (set all sensors isolated in the dependency graph; set all $\underset { - , } { \alpha _ { i , u v } ^ { t } }$ and $e _ { i , u v } ^ { t }$ as 0) in RAINDROP and evaluate the model in group-wise time series classification. The experimental results show that the performance drops a lot when excluding dependency graphs and message passing in RAINDROP (Table 6). Without inter-sensor dependencies our model is on par with other baselines and does not outperform them by a large margin.
|
| 420 |
+
|
| 421 |
+

|
| 422 |
+
Figure 4: Learned structure for negative and positive samples (P19; Setting 1). The nodes numbered from 0 to 33 denote 34 sensors used in P19 (sensor names are listed in Appendix A.15). To make the visualized structures easier to understand, we use darker green to denote higher weight value and yellow to denote lower weight value. We can observe distinguishable patterns across two learned sensor dependency graphs, indicating RAINDROP is able to adaptively learn graph structures that are sensitive to the classification task. For example, we find that the nodes 1 (pulse oximetry), 5 (diastolic BP), and 12 (partial pressure of carbon dioxide from arterial blood) have lower weights in negative samples.
|
| 423 |
+
|
| 424 |
+
Table 8: Classification results when train and test samples originate from different groups (P19).
|
| 425 |
+
|
| 426 |
+
<table><tr><td rowspan="3">Model</td><td colspan="8">Generalizing to anew patient group</td></tr><tr><td colspan="2">Train: Young → Test: Old</td><td colspan="2">Train: Old → Test: Young</td><td colspan="2">Train: Male → Test: Female</td><td colspan="2">Train: Female → Test: Male</td></tr><tr><td>AUROC</td><td>AUPRC</td><td>AUROC</td><td>AUPRC</td><td>AUROC</td><td>AUPRC</td><td>AUROC</td><td>AUPRC</td></tr><tr><td>Transformer</td><td>76.2± 0.7</td><td>30.5± 4.8</td><td>76.5 ± 1.1</td><td>33.7±5.7</td><td>77.8 ± 1.1</td><td>26.0±6.2</td><td>75.2 ±1.0</td><td>30.3±5.5</td></tr><tr><td>Trans-mean</td><td>80.6 ± 1.4</td><td>39.8±4.2</td><td>78.4 ±1.1</td><td>35.8±2.9</td><td>80.2±1.7</td><td>32.1 ± 1.9</td><td>76.4 ±0.8</td><td>32.5±3.3</td></tr><tr><td>GRU-D</td><td>76.5 ± 1.7</td><td>29.5±2.3</td><td>79.6 ±1.7</td><td>35.2± 4.6</td><td>78.5±1.6</td><td>31.9 ± 4.8</td><td>76.3 ± 2.5</td><td>31.1 ± 2.6</td></tr><tr><td>SeFT</td><td>77.5 ± 0.7</td><td>26.6±1.2</td><td>78.9 ±1.0</td><td>32.7±2.7</td><td>78.6±0.6</td><td>31.1 ± 1.2</td><td>76.9 ± 0.5</td><td>26.4 ± 1.1</td></tr><tr><td>mTAND</td><td>79.0±0.8</td><td>28.8±2.3</td><td>79.4±0.6</td><td>29.8± 1.2</td><td>78.0±0.9</td><td>26.5±1.7</td><td>78.9 ± 1.2</td><td>29.2 ± 2.0</td></tr><tr><td>RAINDROP</td><td>83.2 ± 1.6</td><td>43.6± 4.7</td><td>82.0 ± 4.4</td><td>44.3 ± 3.6</td><td>85.0 ± 1.4</td><td>45.2 ± 2.9</td><td>81.2± 3.8</td><td>40.7± 2.9</td></tr></table>
|
| 427 |
+
|
| 428 |
+
# A.14 FURTHER DETAILS ON ABLATION STUDY
|
| 429 |
+
|
| 430 |
+
We provide ablation study, taking PAM at Setting 1 as an example, in Table 7. In the setup of ‘W/o sensor level concatenation’, we take the average of all sensor embeddings (in stead of concatenating them together) to obtain sample embedding. Experimental results show that the full RAINDROP model achieves the best performance, indicating every component or designed structure is useful to the model. For example, we find that excluding inter-sensor attention weights $\alpha _ { i , u v } ^ { t }$ will cause a decrease of $3 . 9 \%$ in accuracy while excluding edge weights $e _ { i , u v }$ (i.e., dependency graphs) will drop the accuracy by $7 . 1 \%$ .
|
| 431 |
+
|
| 432 |
+
# A.15 VISUALIZATION OF INTER-SENSOR DEPENDENCY GRAPHS LEARNED BY RAINDROP
|
| 433 |
+
|
| 434 |
+
We visualize the learned inter-sensor dependencies (i.e., $e _ { i , u v }$ before the averaging operation in Eq. 3) on P19 in early sepsis prediction. The visualizations are implemented with Cytoscape (Shannon et al., 2003). The data shown are for testing set of P19 including 3,881 samples (3708 negative and 173 positive). As RAINDROP learns the specific graph for each sample, we take average of all positive samples and visualize it in Figure $^ { 4 \mathrm { b } }$ ; and visualize the average of all negative samples in Figure 4b. As we take average, the edges with weights smaller than 0.1 (means they rarely appear in graphs) are ignored. The averaged edge weights range from 0.1 to 1. We initialize all sample graphs as complete graph that has $1 , 1 5 6 = 3 4 \times 3 4$ edges, then prune out $50 \%$ of them in training phase, remaining 578 edges. The 34 nodes in figures denote 34 sensors measured in P19, as listed https://physionet.org/content/challenge-2019/1.0.0/. We list the sensor names here: 0: HR; 1: O2Sat; 2: Temp; 3: SBP; 4: MAP; 5: DBP; 6: Resp; 7: EtCO2; 8: BaseExcess; 9: HCO3; 10: FiO2; 11: pH; 12: PaCO2; 13: SaO2; 14: AST; 15: BUN; 16: Alkalinephos; 17: Calcium; 18: Chloride; 19: Creatinine; 20: Bilirubin_direct; 21: Glucose; 22: Lactate; 23: Magnesium; 24: Phosphate; 25: Potassium; 26: Bilirubin_total; 27: TroponinI; 28: Hct; 29: Hgb; 30: PTT; 31: WBC; 32: Fibrinogen; 33: Platelets.
|
| 435 |
+
|
| 436 |
+

|
| 437 |
+
Figure 5: Differential structure of dependency graphs between positive and negative samples. The edges are directed. We select the top 50 edges with largest difference (in absolute value) between two patterns. The edges are colored by the divergences. The darker color denotes the connection is more crucial to classification task. Node 0 is not included in this figure as it is not connected with any sensor. We can infer that the heart rate is stable whether the patient will get sepsis or not. Moreover, we can see the edge from node 3 (systolic BP) to node 13 (Oxygen saturation from arterial blood) and the connection from node 6 (Respiration rate) to node 25 (Potassium) are informative for distinguishing sample classes.
|
| 438 |
+
|
| 439 |
+
We also visualize the differential inter-sensor connections between the learned dependency graphs from patients who are likely to have sepsis and the graphs from patients who are unlikely to suffer from sepsis. Based on the aggregated graph structures of positive and negative samples, we calculate the divergence between two groups of patients and report the results in Figure 5. In detail, we sort edges by the absolute difference of edge weights across negative and positive samples. On top of the visualization of the 50 most distinctive edges, we can have a series of concrete insights. For example, the dependency between node 6 (Respiration rate) to node 25 (Potassium) is important to the early prediction of sepsis. Note these data-driven observations could be biased and still need confirmation and future analysis from healthcare professionals. The edges in both Figure 4 and Figure 5 are directed. The edge arrows might be difficult to recognize due to the small figure size. We will provide high-resolution figures to our public repository.
|
| 440 |
+
|
| 441 |
+
Furthermore, we statistically measure the similarities across samples within the same class and dissimilarities across samples from different classes. Specifically, for every sample, we calculate: 1) the average Euclidean distance between its dependency graph and the dependency graphs of all samples from the same class; 2) the average distance with all samples from the different classes. The P19 dataset has 38,803 samples including 1,623 positive samples and 37,180 negative samples. For a fair comparison, we randomly select 1,623 samples from the negative cohort, then mixed them with an equal number of positive samples to measure the averaged Euclidean distances intra- and inter-classes. We select the cohort for 5 independent times with replacement. We find that the distance $( ( 8 . 6 \pm 1 . 7 ) \times 1 0 ^ { - 5 } )$ among dependency graphs of positive samples is smaller than the distance $( \left( 1 2 . 9 \pm 3 . 1 \right) \times 1 0 ^ { - 5 } ,$ ) across samples. The results show that the learned dependency graphs are similar within the same class and dissimilar across classes, which demonstrates RAINDROP can learn label-sensitive dependency graphs.
|
md/dev/KwmPfARgOTD/KwmPfARgOTD.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/L3_SsSNMmy/L3_SsSNMmy.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/LI2bhrE_2A/LI2bhrE_2A.md
ADDED
|
@@ -0,0 +1,420 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ITERATIVE REFINEMENT GRAPH NEURAL NETWORK FOR ANTIBODY SEQUENCE-STRUCTURE CO-DESIGN
|
| 2 |
+
|
| 3 |
+
Wengong $\mathbf { J i n } ^ { \dagger }$ , Jeremy Wohlwend\*, Regina Barzilay\*, Tommi Jaakkola\*
|
| 4 |
+
|
| 5 |
+
† Eric and Wendy Schmidt Center, Broad Institute of MIT and Harvard \* CSAIL, Massachusetts Institute of Technology {wengong,jwohlwend,regina,tommi}@csail.mit.edu
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
Antibodies are versatile proteins that bind to pathogens like viruses and stimulate the adaptive immune system. The specificity of antibody binding is determined by complementarity-determining regions (CDRs) at the tips of these Y-shaped proteins. In this paper, we propose a generative model to automatically design the CDRs of antibodies with enhanced binding specificity or neutralization capabilities. Previous generative approaches formulate protein design as a structureconditioned sequence generation task, assuming the desired 3D structure is given a priori. In contrast, we propose to co-design the sequence and 3D structure of CDRs as graphs. Our model unravels a sequence autoregressively while iteratively refining its predicted global structure. The inferred structure in turn guides subsequent residue choices. For efficiency, we model the conditional dependence between residues inside and outside of a CDR in a coarse-grained manner. Our method achieves superior log-likelihood on the test set and outperforms previous baselines in designing antibodies capable of neutralizing the SARS-CoV-2 virus1.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
Monoclonal antibodies are increasingly adopted as therapeutics targeting a wide range of pathogens such as SARS-CoV-2 (Pinto et al., 2020). Since the binding specificity of these Y-shaped proteins is largely determined by their complementarity-determining regions (CDRs), the main goal of computational antibody design is to automate the creation of CDR subsequences with desired properties. This problem is particularly challenging due to the combinatorial search space of over $\dot { 2 0 } ^ { 6 0 }$ possible CDR sequences and the small solution space which satisfies the desired constraints of binding affinity, stability, and synthesizability (Raybould et al., 2019).
|
| 14 |
+
|
| 15 |
+
There are three key modeling questions in CDR generation. The first is how to model the relation between a sequence and its underlying 3D structure. Generating sequences without the corresponding structure (Alley et al., 2019; Shin et al., 2021) can lead to sub-optimal performance (Ingraham et al., 2019), while generating from a predefined 3D structure (Ingraham et al., 2019) is not suitable for antibodies since the desired structure is rarely known a priori (Fischman & Ofran, 2018). Therefore, it is crucial to develop models that co-design the sequence and structure. The second question is how to model the conditional distribution of CDRs given the remainder of a sequence (context). Attention-based methods only model the conditional dependence at the sequence level, but the structural interaction between the CDR and its context is crucial for generation. The last question relates to the model’s ability to optimize for various properties. Traditional physics-based methods (Lapidoth et al., 2015; Adolf-Bryfogle et al., 2018) focus on binding energy minimization, but in practice, our objective can be much more involved than binding energies (Liu et al., 2020).
|
| 16 |
+
|
| 17 |
+
In this paper, we represent a sequence-structure pair as a graph and formulate the co-design task as a graph generation problem. The graph representation allows us to model the conditional dependence between a CDR and its context at both the sequence and structure levels. Antibody graph generation poses unique challenges because the global structure is expected to change when new nodes are inserted. Previous autoregressive models (You et al., 2018; Gebauer et al., 2019) cannot modify a generated structure because they are trained under teacher forcing. Thus errors made in the previous steps can lead to a cascade of errors in subsequent generation steps. To address these problems, we propose a novel architecture which interleaves the generation of amino acid nodes with the prediction of 3D structures. The structure generation is based on an iterative refinement of a global graph rather than a sequential expansion of a partial graph with teacher forcing. Since the context sequence is long, we further introduce a coarsened graph representation by grouping nodes into blocks. We apply graph convolution at a coarser level to efficiently propagate the contextual information to the CDR residues. After pretraining our model on antibodies with known structures, we finetune it using a predefined property predictor to generate antibodies with specific properties.
|
| 18 |
+
|
| 19 |
+
We evaluate our method on three generation tasks, ranging from language modeling to SARS-CoV-2 neutralization optimization and antigen-binding antibody design. Our method is compared with a standard sequence model (Saka et al., 2021; Akbar et al., 2021) and a state-of-the-art graph generation method (You et al., 2018) tailored to antibodies. Our method not only achieves lower perplexity on test sequences but also outperforms previous baselines in property-guided antibody design tasks.
|
| 20 |
+
|
| 21 |
+
# 2 RELATED WORK
|
| 22 |
+
|
| 23 |
+
Antibody/protein design. Current methods for computational antibody design roughly fall into two categories. The first class is based on energy function optimization (Pantazes & Maranas, 2010; Li et al., 2014; Lapidoth et al., 2015; Adolf-Bryfogle et al., 2018), which use Monte Carlo simulation to iteratively modify a sequence and its structure until reaching a local energy minimum. Similar approaches are used in protein design (Leaver-Fay et al., 2011; Tischer et al., 2020). Nevertheless, these physics-based methods are computationally expensive (Ingraham et al., 2019) and our desired objective can be much more complicated than low binding energy (Liu et al., 2020).
|
| 24 |
+
|
| 25 |
+
The second class is based on generative models. For antibodies, they are mostly sequence-based (Alley et al., 2019; Shin et al., 2021; Saka et al., 2021; Akbar et al., 2021). For proteins, O’Connell et al. (2018); Ingraham et al. (2019); Strokach et al. (2020); Karimi et al. (2020); Cao et al. (2021) further developed models conditioned on a backbone structure or protein fold. Our model also seeks to incorporate 3D structure information for antibody generation. Since the best CDR structures are often unknown for new pathogens, we co-design sequences and structures for specific properties.
|
| 26 |
+
|
| 27 |
+
Generative models for graphs. Our work is related to autoregressive models for graph generation (You et al., 2018; Li et al., 2018; Liu et al., 2018; Liao et al., 2019; Jin et al., 2020a). In particular, Gebauer et al. (2019) developed G-SchNet for molecular graph and conformation co-design. Unlike our method, they generate edges sequentially and cannot modify a previously generated subgraph when new nodes arrive. While Graphite (Grover et al., 2019) also uses iterative refinement to predict the adjacency matrix of a graph, it assumes all the node labels are given and predicts edges only. In contrast, our work combines autoregressive models with iterative refinement to generate a full graph with node and edge labels, including node labels and coordinates.
|
| 28 |
+
|
| 29 |
+
3D structure prediction. Our approach is closely related to protein folding (Ingraham et al., 2018; Yang et al., 2020a; Baek et al., 2021; Jumper et al., 2021). Inputs to the state-of-the-art models like AlphaFold require a complete protein sequence, its multi-sequence alignment (MSA), and its template features. These models are not directly applicable because we need to predict the structure of an incomplete sequence and the MSA is not specified in advance.
|
| 30 |
+
|
| 31 |
+
Our iterative refinement model is also related to score matching methods for molecular conformation prediction (Shi et al., 2021) and diffusion-based methods for point clouds (Luo & Hu, 2021). These algorithms also iteratively refine a predicted 3D structure, but only for a complete molecule or point cloud. In contrast, our approach learns to predict the 3D structure for incomplete graphs and interleaves 3D structure refinement with graph generation.
|
| 32 |
+
|
| 33 |
+
# 3 ANTIBODY SEQUENCE AND STRUCTURE CO-DESIGN
|
| 34 |
+
|
| 35 |
+
Overview. The role of an antibody is to bind to an antigen (e.g. a virus), present it to the immune system, and stimulate an immune response. A subset of antibodies known as neutralizing antibodies not only bind to an antigen but can also suppress its activity. An antibody consists of a heavy chain and a light chain, each composed of one variable domain (VH/VL) and some constant domains. The variable domain is further divided into a framework region and three complementarity determining regions (CDRs). The three CDRs on the heavy chain are labeled as CDR-H1, CDR-H2, CDR-H3, each occupying a contiguous subsequence (Figure 1). As the most variable part of an antibody, CDRs are the main determinants of binding and neutralization (Abbas et al., 2014).
|
| 36 |
+
|
| 37 |
+

|
| 38 |
+
Figure 1: Schematic structure of an antibody (figure modified from Wikipedia).
|
| 39 |
+
|
| 40 |
+
Following Shin et al. (2021); Akbar et al. (2021), we formulate antibody design as a CDR generation task, conditioned on the framework region. Specifically, we represent an antibody as a graph, which encodes both its sequence and 3D structure. We propose a new graph generation approach called RefineGNN and extend it to handle conditional generation given a fixed framework region. Lastly, we describe how to apply RefineGNN to property-guided optimization to design new antibodies with better neutralization properties. For simplicity, we focus on the generation of heavy chain CDRs, though our method can be easily extended to model light chains CDRs.
|
| 41 |
+
|
| 42 |
+
Notations. An antibody VH domain is represented as a sequence of amino acids $\pmb { s } = \pmb { s } _ { 1 } \pmb { s } _ { 2 } \cdot \cdot \cdot \pmb { s } _ { n }$ . Each token $s _ { i }$ in the sequence is called a residue, whose value can be either one of the 20 amino acids or a special token $\langle \mathtt { M A S K } \rangle$ , meaning that its amino acid type is unknown and needs to be predicted. The VH sequence folds into a 3D structure and each residue $\mathbf { \boldsymbol { s } } _ { i }$ is labeled with three backbone coordinates: $\mathbf { \Delta } _ { \mathbf { x } _ { i , \alpha } }$ for its alpha carbon atom, $\scriptstyle { \pmb x } _ { i , c }$ for its carbon atom, and $\mathbf { \Delta } _ { \mathbf { x } _ { i , n } }$ for its nitrogen atom.
|
| 43 |
+
|
| 44 |
+
# 3.1 GRAPH REPRESENTATION
|
| 45 |
+
|
| 46 |
+
We represent an antibody (VH) as a graph $\mathcal { G } ( \pmb { s } ) = ( \gamma , \mathcal { E } )$ with node features $\mathcal { V } = \{ \pmb { v } _ { 1 } , \cdots , \pmb { v } _ { n } \}$ and edge features $\mathcal { E } = \{ e _ { i j } \} _ { i \neq j }$ . Each node feature ${ \mathbf { } } v _ { i }$ encodes three dihedral angles $\left( \phi _ { i } , \psi _ { i } , \omega _ { i } \right)$ related to three backbone coordinates of residue $i$ . For each residue $i$ , we compute an orientation matrix $O _ { i }$ representing its local coordinate frame (Ingraham et al., 2019) (defined in the appendix). This allows us to compute edge features describing the spatial relationship between two residues $i$ and $j$ :
|
| 47 |
+
|
| 48 |
+
$$
|
| 49 |
+
\begin{array} { r } { e _ { i j } = \big ( E _ { \mathrm { p o s } } ( i - j ) , \quad \mathrm { R B F } ( \lVert x _ { i , \alpha } - x _ { j , \alpha } \rVert ) , \quad O _ { i } ^ { \top } \frac { x _ { j , \alpha } - x _ { i , \alpha } } { \lVert x _ { i , \alpha } - x _ { j , \alpha } \rVert } , \quad q ( O _ { i } ^ { \top } O _ { j } ) \big ) . } \end{array}
|
| 50 |
+
$$
|
| 51 |
+
|
| 52 |
+
The edge feature $e _ { i j }$ contains four parts. The positional encoding $E _ { \mathrm { p o s } } ( i - j )$ encodes the relative distance between two residues in an antibody sequence. The second term $\mathrm { R B F } ( \cdot )$ is a distance encoding lifted into radial basis. The third term in $e _ { i j }$ is a direction encoding that corresponds to the relative direction of $\boldsymbol { \mathscr { x } } _ { j }$ in the local frame of residue $i$ . The last term $\pmb { q } ( \pmb { O } _ { i } ^ { \top } \pmb { O } _ { j } )$ is the orientation encoding of the quaternion representation $\pmb q ( \cdot )$ of the spatial rotation matrix $O _ { i } ^ { \top } O _ { j }$ . We only include edges in the $K$ -nearest neighbors graph of $\dot { \mathcal G } ( s )$ with $K = 8$ . For notation convenience, we use $\mathcal { G }$ as a shorthand for $\mathcal G ( s )$ when there is no ambiguity.
|
| 53 |
+
|
| 54 |
+
# 3.2 ITERATIVE REFINEMENT GRAPH NEURAL NETWORK (REFINEGNN)
|
| 55 |
+
|
| 56 |
+
We propose to generate an antibody graph via an iterative refinement process. Let ${ \mathcal { G } } ^ { ( 0 ) }$ be the initial guess of the true antibody graph. Each residue is initialized as a special token $\langle \mathtt { M A S K } \rangle$ and each edge $( i , j )$ is initialized to be of distance $3 | i - j |$ since the average distance between consecutive residues is around three. The direction and orientation features are set to zero. In each generation step $t$ , the model learns to revise a current antibody graph $\mathcal { G } ^ { ( t ) }$ and predict the label of the next residue $t + 1$ . Specifically, it first encodes $\mathcal { G } ^ { ( t ) }$ with a message passing network (MPN) with parameter $\theta$
|
| 57 |
+
|
| 58 |
+
$$
|
| 59 |
+
\{ \pmb { h } _ { 1 } ^ { ( t ) } , \cdot \cdot \cdot , \pmb { h } _ { n } ^ { ( t ) } \} = \mathrm { M P N } _ { \theta } ( \pmb { \mathcal { G } } ^ { ( t ) } ) ,
|
| 60 |
+
$$
|
| 61 |
+
|
| 62 |
+
where ${ h } _ { i } ^ { ( t ) }$ is a learned representation of residue $i$ under the current graph $\mathcal { G } ^ { ( t ) }$ . Our MPN consists of $L$ message passing layers with the following architecture
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
{ h } _ { i } ^ { ( t , l + 1 ) } = \mathrm { L a y e r N o r m } \bigg ( \sum _ { j } \mathrm { F F N } \big ( { h } _ { i } ^ { ( t , l ) } , { h } _ { j } ^ { ( t , l ) } , E ( s _ { j } ) , e _ { i , j } \big ) \bigg ) , \quad 0 \le l \le L - 1 ,
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
where $h _ { i } ^ { ( t , 0 ) } = v _ { i }$ and $h _ { i } ^ { ( t ) } = h _ { i } ^ { ( t , L ) }$ . FFN is a two-layer feed-forward network (FFN) with ReLU activation function. $E ( s _ { j } )$ is a learned embedding of amino acid type $s _ { j }$ . Based on the learned residue representations, we predict the amino acid type of the next residue $t + 1$ (Figure 2A).
|
| 69 |
+
|
| 70 |
+
$$
|
| 71 |
+
p _ { t + 1 } = \mathrm { s o f t m a x } ( W _ { a } h _ { t + 1 } ^ { ( t ) } )
|
| 72 |
+
$$
|
| 73 |
+
|
| 74 |
+
This prediction gives us a new graph $\mathcal { G } ^ { ( t + 0 . 5 ) }$ with the same edges as $\mathcal { G } ^ { ( t ) }$ but the node label of $t + 1$ is changed (Figure 2B). Next, we need to update the structure to accommodate the new residue $t + 1$ . To this end, we encode graph $\mathcal { G } ^ { ( t + 0 . 5 ) }$ by another MPN with a different parameter $\tilde { \theta }$ and predict the coordinate of all residues.
|
| 75 |
+
|
| 76 |
+
$$
|
| 77 |
+
\begin{array} { r c l } { \{ h _ { 1 } ^ { ( t + 0 . 5 ) } , \cdots , h _ { n } ^ { ( t + 0 . 5 ) } \} } & { = } & { \mathrm { M P N } _ { \tilde { \theta } } ( \mathcal { G } ^ { ( t + 0 . 5 ) } ) } \\ { x _ { i , e } ^ { ( t + 1 ) } } & { = } & { W _ { x } ^ { e } h _ { i } ^ { ( t + 0 . 5 ) } , \qquad 1 \leq i \leq n , e \in \{ \alpha , c , n \} . } \end{array}
|
| 78 |
+
$$
|
| 79 |
+
|
| 80 |
+
The new coordinates $\pmb { x } _ { i } ^ { ( t + 1 ) }$ define a new antibody graph $\mathcal { G } ^ { ( t + 1 ) }$ for the next iteration (Figure 2C). We explicitly realize the coordinates of each residue because we need to calculate the spatial edge features for $\dot { \boldsymbol g } ^ { ( t + 1 ) }$ . The structure prediction (coordinates $\mathbf { \boldsymbol { x } } _ { i }$ ) and sequence prediction (amino acid types $\pmb { p } _ { t + 1 } ,$ ) are carried out by two different MPNs, namely the structure network $\tilde { \theta }$ and sequence network $\theta$ . This disentanglement allows the two networks to focus on two distinct tasks.
|
| 81 |
+
|
| 82 |
+
Training. During training, we only apply teacher forcing to the discrete amino acid type prediction. Specifically, in each generation step $t$ , residues 1 to $t$ are set to their ground truth amino acid types $s _ { 1 } , \cdots , s _ { t }$ , while all future residues $t + 1 , \cdots , n$ are set to a padding token. In contrast, the continuous structure prediction is carried out without teacher forcing. In each iteration, the model refines the entire structure predicted in the previous step and constructs a new $K$ -nearest neighbors graph G(t+1) of all residues based on the predicted coordinates {x(t+i,e $\{ \pmb { x } _ { i , e } ^ { ( t + 1 ) } \mid 1 \leq i \leq n , e \in \{ \alpha , c , n \} \}$ .
|
| 83 |
+
|
| 84 |
+
Loss function. Our model remains rotation and translation invariant because the loss function is computed over pairwise distance and angles rather than coordinates. The loss function for antibody structure prediction consists of three parts.
|
| 85 |
+
|
| 86 |
+
• Distance loss: For each residue pair $i , j$ , we compute its pairwise distance between the predicted alpha carbons x(t)i,α, x(t)j,α. We define the distance loss as the Huber loss between the predicted and true pairwise distances
|
| 87 |
+
|
| 88 |
+
$$
|
| 89 |
+
\begin{array} { r } { \mathcal { L } _ { d } ^ { ( t ) } = \sum _ { i , j } \ell _ { \mathrm { h u b e r } } ( \Vert \pmb { x } _ { i , \alpha } ^ { ( t ) } - \pmb { x } _ { j , \alpha } ^ { ( t ) } \Vert ^ { 2 } , \Vert \pmb { x } _ { i , \alpha } - \pmb { x } _ { j , \alpha } \Vert ^ { 2 } ) , } \end{array}
|
| 90 |
+
$$
|
| 91 |
+
|
| 92 |
+
where distance is squared to avoid the square root operation which causes numerical instability.
|
| 93 |
+
|
| 94 |
+
• Dihedral angle loss: For each residue, we calculate its dihedral angle $( \phi _ { i } ^ { ( t ) } , \psi _ { i } ^ { ( t ) } , \omega _ { i } ^ { ( t ) } )$ based on the predicted atom coordinates $\pmb { x } _ { i , \alpha } ^ { ( t ) } , \pmb { x } _ { i , c } ^ { ( t ) } , \pmb { x } _ { i , n } ^ { ( t ) }$ and $\mathbf { \Delta } \mathbf { x } _ { i + 1 , \alpha } ^ { ( t ) } , \mathbf { x } _ { i + 1 , c } ^ { ( t ) } , \mathbf { x } _ { i + 1 , n } ^ { ( t ) }$ . We define the dihedral angle loss as the mean square error between the predicted and true dihedral angles
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
\mathcal { L } _ { a } ^ { ( t ) } = \sum _ { i } \sum _ { \substack { a \in \{ \phi , \psi , \omega \} } } ( \cos a _ { i } ^ { ( t ) } - \cos a _ { i } ) ^ { 2 } + ( \sin a _ { i } ^ { ( t ) } - \sin a _ { i } ) ^ { 2 }
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
$C _ { \alpha }$ angle loss: We calcll as dihedral angles e angles betwee $\gamma _ { i } ^ { ( t ) }$ between two vectoo planes defined by $\pmb { x } _ { i - 1 , \alpha } ^ { ( t ) } - \pmb { x } _ { i , \alpha } ^ { ( t ) }$ and x(t)i,α $\pmb { x } _ { i , \alpha } ^ { ( t ) } - \pmb { x } _ { i + 1 , \alpha } ^ { ( t ) }$ $\beta _ { i } ^ { ( t ) }$ $\pmb { x } _ { i - 2 , \alpha } ^ { ( t ) } , \pmb { x } _ { i - 1 , \alpha } ^ { ( t ) } , \pmb { x } _ { i , \alpha } ^ { ( t ) } , \pmb { x } _ { i + 1 , \alpha } ^ { ( t ) }$
|
| 101 |
+
|
| 102 |
+
$$
|
| 103 |
+
\mathcal { L } _ { c } ^ { ( t ) } = \sum _ { i } ( \cos \gamma _ { i } ^ { ( t ) } - \cos \gamma _ { i } ) ^ { 2 } + ( \cos \beta _ { i } ^ { ( t ) } - \cos \beta _ { i } ) ^ { 2 }
|
| 104 |
+
$$
|
| 105 |
+
|
| 106 |
+
In summary, the overall graph generation loss is defined as $\mathcal { L } = \mathcal { L } _ { \mathrm { s e q } } + \mathcal { L } _ { \mathrm { s t r u c t } }$ , where
|
| 107 |
+
|
| 108 |
+
$$
|
| 109 |
+
\mathcal { L } _ { \mathrm { s t r u c t } } = \sum _ { t } \mathcal { L } _ { d } ^ { ( t ) } + \mathcal { L } _ { a } ^ { ( t ) } + \mathcal { L } _ { c } ^ { ( t ) } \qquad \mathcal { L } _ { \mathrm { s e q } } = \sum _ { t } \mathcal { L } _ { c e } ( p _ { t } , s _ { t } ) .
|
| 110 |
+
$$
|
| 111 |
+
|
| 112 |
+
The sequence prediction loss $\mathcal { L } _ { \mathrm { s e q } }$ is the cross entropy $\mathcal { L } _ { c e }$ between predicted and true residue types.
|
| 113 |
+
|
| 114 |
+
# 3.3 CONDITIONAL GENERATION GIVEN THE FRAMEWORK REGION
|
| 115 |
+
|
| 116 |
+
The model architecture described so far is designed for unconditional generation — it generates an entire antibody graph without any constraints. In practice, we usually fix the framework region of an antibody and design the CDR sequence only. Therefore, we need to extend the model architecture to learn the conditional distribution $P ( \pmb { s } ^ { \prime } | \pmb { s } _ { < l } , \pmb { s } _ { > r } )$ , where $\pmb { s } _ { < l } = \pmb { s } _ { 1 } \cdots \pmb { s } _ { l - 1 }$ and $\pmb { s } _ { > r } = \pmb { s } _ { r + 1 } \cdot \cdot \cdot \pmb { s } _ { n }$ are residues outside of the CDR $s _ { l } \cdots s _ { r }$ .
|
| 117 |
+
|
| 118 |
+

|
| 119 |
+
Figure 2: (A-C) One generation step of RefineGNN. Each circle represents a CDR residue and each square represents a residue block in a coarsened context sequence. (D) Sequence coarsening.
|
| 120 |
+
|
| 121 |
+
Conditioning via attention. A simple extension of RefineGNN is to encode the non-CDR sequence using a recurrent neural network and propagate information to the CDR through an attention layer. To be specific, we first concatenate $\mathbf { \delta } _ { \pmb { s } _ { < l } }$ and $\pmb { s } _ { > r }$ into a context sequence $\begin{array} { r l } { \tilde { s } } & { { } = } \end{array}$ $\pmb { s } _ { < l } \oplus \left. \tt N A S K \right. \cdot \cdot \cdot \left. \tt N A S K \right. \oplus \pmb { s } _ { > r }$ , where $\oplus$ means string concatenation and $\langle \mathtt { M A S K } \rangle$ is repeated $n$ times. We then encode this context sequence by a Gated Recurrent Unit (GRU) (Cho et al., 2014) and modify the structure and sequence prediction step (Equation 4 and 6) as
|
| 122 |
+
|
| 123 |
+
$$
|
| 124 |
+
\begin{array} { r c l } { \{ c _ { 1 } , \cdots , c _ { n } \} } & { = } & { c _ { 1 : n } = \mathrm { G R U } ( \tilde { s } ) } \\ { p _ { t + 1 } } & { = } & { \mathrm { s o f t m a x } \big ( W _ { a } h _ { t + 1 } ^ { ( t ) } + U _ { a } ^ { \top } \mathrm { a t t e n t i o n } ( c _ { 1 : n } , h _ { t + 1 } ^ { ( t ) } ) \big ) } \\ { x _ { i , e } ^ { ( t + 1 ) } } & { = } & { W _ { x } ^ { e } h _ { i } ^ { ( t + 0 . 5 ) } + U _ { x } ^ { e \top } \mathrm { a t t e n t i o n } ( c _ { 1 : n } , h _ { i } ^ { ( t + 0 . 5 ) } ) } \end{array}
|
| 125 |
+
$$
|
| 126 |
+
|
| 127 |
+
Multi-resolution modeling. The attention-based approach alone is not sufficient because it does not model the structure of the context sequence, thus ignoring how its residues structurally interact with the CDR’s. While this information is not available for new antibodies at test time, we can learn to predict this interaction using antibodies in the training set with known structures.
|
| 128 |
+
|
| 129 |
+
A naive solution is to iteratively refine the entire antibody structure (more than 100 residues) while generating CDR residues. This approach is computationally expensive because we need to recompute the MPN encoding for all residues in each generation step. Importantly, we cannot predict the context residue coordinates at the outset and fix them because they need to be adjusted accordingly when the coordinates of CDR residues are updated in each generation step.
|
| 130 |
+
|
| 131 |
+
For computational efficiency, we propose a coarse-grained model that reduces the context sequence length by clustering it into residue blocks. Specifically, we construct a coarsened context sequence $\mathbf { \ } _ { b _ { l , r } ( s ) }$ by clustering every $b$ context residues into a block (Figure 2D). The new sequence $\mathbf { \ } _ { b _ { l , r } ( s ) }$ defines a coarsened graph $\mathcal { G } ( b _ { l , r } ( s ) )$ over the residue blocks, whose edges are defined based on block coordinates. The coordinate of each block ${ \boldsymbol { x } } _ { b _ { i } , e }$ is defined as the mean coordinate of residues within the block. The embedding of each block $E ( b _ { i } )$ is the mean of its residue embeddings.
|
| 132 |
+
|
| 133 |
+
$$
|
| 134 |
+
E ( \boldsymbol { b } _ { i } ) = \sum _ { \boldsymbol { s } _ { j } \in \boldsymbol { b } _ { i } } E ( \boldsymbol { s } _ { j } ) / b , \qquad \boldsymbol { x } _ { \boldsymbol { b } _ { i } , \boldsymbol { e } } = \sum _ { \boldsymbol { s } _ { j } \in \boldsymbol { b } _ { i } } \boldsymbol { x } _ { j , \boldsymbol { e } } / b , \qquad \boldsymbol { e } \in \{ \alpha , c , n \} .
|
| 135 |
+
$$
|
| 136 |
+
|
| 137 |
+
Now we can apply RefineGNN to generate the CDR residues while iteratively refining the global graph $\mathcal { G } ( b _ { l , r } ( s ) )$ by predicting the coordinates of all blocks. The only change is that the structure prediction loss is defined over block coordinates ${ \boldsymbol { x } } _ { b _ { i } , e }$ . Lastly, we combine both the attention mechanism and coarse-grained modeling to keep both fine-grained and coarse-grained information. The decoding process of this conditional RefineGNN is illustrated in Algorithm 1.
|
| 138 |
+
|
| 139 |
+
# Algorithm 1 RefineGNN decoding
|
| 140 |
+
|
| 141 |
+
# Require: Context sequence $\pmb { S } _ { < l } , \pmb { S } _ { > r }$
|
| 142 |
+
|
| 143 |
+
1: Predict the CDR length $n$
|
| 144 |
+
2: Coarsen the context sequence into $\mathbf { \ } _ { b _ { l , r } ( s ) }$
|
| 145 |
+
3: Construct the initial graph ${ \mathcal { G } } ^ { ( 0 ) }$
|
| 146 |
+
4: for $t = 0$ to $n - 1$ do
|
| 147 |
+
5: Encode $\mathcal { G } ^ { ( t ) }$ using the sequence MPN
|
| 148 |
+
6: Predict distribution of the next residue
|
| 149 |
+
$p _ { t + 1 }$
|
| 150 |
+
7: Sample $s _ { t + 1 } \sim$ categorical $\left( { \pmb { p } } _ { t + 1 } \right)$
|
| 151 |
+
8: Encode $\mathcal { G } ^ { ( t + 0 . 5 ) }$ with the structure MPN
|
| 152 |
+
9: Predict all residue coordinates x(t+i,e
|
| 153 |
+
10: Update $\mathcal { G } ^ { ( t + 1 ) }$ using the new coordinates
|
| 154 |
+
|
| 155 |
+
Algorithm 2 ITA-based sequence optimization
|
| 156 |
+
|
| 157 |
+
Require: A set of antibodies $\mathcal { D }$ to be optimized Require: A neutralization predictor $f$ .
|
| 158 |
+
Require: A set of neutralizing antibodies $Q$
|
| 159 |
+
1: for each iteration do
|
| 160 |
+
2: Sample an antibody $\pmb { s }$ from $\mathcal { D }$ , remove its CDR and get a context sequence $\mathbf { \ } _ { b _ { l , r } ( s ) }$ 3: for $i = 1$ to $M$ do
|
| 161 |
+
4: Sample $\pmb { s } _ { i } ^ { \prime } \sim P _ { \Theta } ( \pmb { s } ^ { \prime } | \pmb { b } _ { l , r } ( \pmb { s } ) )$
|
| 162 |
+
5: if $f ( \pmb { s } _ { i } ^ { \prime } ) > \operatorname* { m a x } ( f ( \pmb { s } ) , 0 . 5 )$ then
|
| 163 |
+
6: $Q Q \cup \{ s _ { i } ^ { \prime } \}$
|
| 164 |
+
7: Sample a batch of new antibodies from $Q$ 8: Update model parameter $\Theta$ by minimizing the sequence prediction loss $\mathcal { L } _ { \mathrm { s e q } }$ .
|
| 165 |
+
|
| 166 |
+
# 3.4 PROPERTY-GUIDED SEQUENCE OPTIMIZATION
|
| 167 |
+
|
| 168 |
+
Our ultimate goal is to generate new antibodies with desired properties such as neutralizing a particular virus. This task can be formulated as an optimization problem. Let $Y$ be a binary indicator variable for neutralization. Our goal is to learn a conditional generative model $P _ { \Theta } ( s ^ { \prime } | b _ { l , r } ^ { - } ( s ) )$ that maximizes the probability of neutralization for a training set of antibodies $\mathcal { D }$ , i.e.
|
| 169 |
+
|
| 170 |
+
$$
|
| 171 |
+
\sum _ { s \in \mathcal { D } } \log P ( Y = 1 | b _ { l , r } ( s ) ) = \sum _ { s \in \mathcal { D } } \log \sum _ { s ^ { \prime } } f ( s ^ { \prime } ) P _ { \Theta } ( s ^ { \prime } | b _ { l , r } ( s ) )
|
| 172 |
+
$$
|
| 173 |
+
|
| 174 |
+
where $f ( s ^ { \prime } )$ is a predictor for $P ( \boldsymbol { Y } = 1 | s ^ { \prime } )$ . Assuming $f$ is given, this problem can be solved by iterative target augmentation (ITA) (Yang et al., 2020b). Before ITA optimization starts, we first pretrain our model on a set of real antibody structures to learn a prior distribution over CDR sequences and structures. In each ITA finetuning step, we first randomly sample a sequence $\pmb { s }$ from $\mathcal { D }$ , a set of antibodies whose CDRs need to be redesigned. Next, we generate $M$ new sequences given its context $\mathbf { \ } _ { b _ { l , r } ( s ) }$ . A generated sequence $\mathbf { \boldsymbol { s } } _ { i } ^ { \prime }$ is added to our training set $Q$ if it is predicted as neutralizing. Initially, the training set $Q$ contains antibodies that are known to be neutralizing $Y =$ 1). Lastly, we sample a batch of neutralizing antibodies from $Q$ and update the model parameter by minimizing their sequence prediction loss $\mathcal { L } _ { \mathrm { s e q } }$ (Eq.(10)). The structure prediction loss $\mathcal { L } _ { \mathrm { s t r u c t } }$ is excluded in ITA finetuning phase because the structure of a generated sequence is unknown.
|
| 175 |
+
|
| 176 |
+
# 4 EXPERIMENTS
|
| 177 |
+
|
| 178 |
+
Setup. We construct three evaluation setups to quantify the performance of our approach. Following standard practice in generative model evaluation, we first measure the perplexity of different models on new antibodies in a test set created based on sequence similarity split. We also measure structure prediction error by comparing generated and ground truth CDR structures recorded in the Structural Antibody Database (Dunbar et al., 2014). Results for this task are shown in section 4.1.
|
| 179 |
+
|
| 180 |
+
Second, we evaluate our method on an existing antibody design benchmark of 60 antibody-antigen complexes from Adolf-Bryfogle et al. (2018). The goal is to design the CDR-H3 of an antibody so that it binds to a given antigen. Results for this task are shown in section 4.2.
|
| 181 |
+
|
| 182 |
+
Lastly, we propose an antibody optimization task which aims to redesign CDR-H3 of antibodies in the Coronavirus Antibody Database (Raybould et al., 2021) to improve their neutralization against SARS-CoV-2. CDR-H3 design with a fixed framework is a common practice in the antibody engineering community (Adolf-Bryfogle et al., 2018; Liu et al., 2020). Following works in molecular design (Jin et al., 2020b), we use a predictor to evaluate the neutralization of generated antibodies since we cannot experimentally test them in wet labs. Results for this task are reported in section 4.3.
|
| 183 |
+
|
| 184 |
+
Baselines. We consider three baselines for comparison (details in the appendix). The first baseline is a sequence-based LSTM model used in Saka et al. (2021); Akbar et al. (2021). This model does not utilize any 3D structure information. It consists of an encoder that learns to encode a context sequence $\tilde { s }$ , a decoder that decodes a CDR sequence, and an attention layer connecting the two.
|
| 185 |
+
|
| 186 |
+
Table 1: Left: Language modeling results. We report perplexity (PPL) and root mean square deviation (RMSD) for each CDR in the heavy chain. Right: Results on the antigen-binding antibody design task. We report the amino acid recovery (AAR) for all methods.
|
| 187 |
+
|
| 188 |
+
<table><tr><td rowspan="2">Model</td><td colspan="2">CDR-H1</td><td colspan="2">CDR-H2</td><td colspan="2">CDR-H3</td><td>Model</td><td>AAR</td></tr><tr><td>PPL</td><td>RMSD</td><td>PPL</td><td>RMSD</td><td>PPL</td><td>RMSD</td><td>RAbD</td><td>28.53%</td></tr><tr><td>LSTM</td><td>6.79</td><td>-</td><td>7.21</td><td>1</td><td>9.70</td><td>-</td><td>LSTM</td><td>22.53%</td></tr><tr><td>AR-GNN</td><td>6.44</td><td>2.97</td><td>6.86</td><td>2.27</td><td>9.44</td><td>3.63</td><td>AR-GNN</td><td>23.86%</td></tr><tr><td>RefineGNN</td><td>6.09</td><td>1.18</td><td>6.58</td><td>0.87</td><td>8.54</td><td>2.50</td><td>RefineGNN</td><td>34.14%</td></tr></table>
|
| 189 |
+
|
| 190 |
+
The second baseline is an autoregressive graph generation model (AR-GNN) whose architecture is similar to You et al. (2018); Jin et al. (2020b) but tailored for antibodies. AR-GNN generates an antibody graph residue by residue. In each step $t$ , it first predicts the amino acid type of residue $t$ and then generates edges between $t$ and previous residues. Importantly, AR-GNN cannot modify a partially generated 3D structure of residues $s _ { 1 } \cdots s _ { t - 1 }$ because it is trained by teacher forcing.
|
| 191 |
+
|
| 192 |
+
On the antigen-binding task, we include an additional physics-based baseline called RosettaAntibodyDesign (RAbD) (Adolf-Bryfogle et al., 2018). We apply their de novo design protocol composed of graft design followed by 250 iterations of sequence design and energy minimization. We cannot afford to run more iterations because it takes more than 10 hours per antibody. We also could not apply RAbD to the SARS-CoV-2 task because it requires 3D structures to be given. This information is unavailable for antibodies in CoVAbDab.
|
| 193 |
+
|
| 194 |
+
Hyperparameters. We performed hyperparameter tuning to find the best setting for each method. For RefineGNN, both its structure and sequence MPN have four message passing layers, with a hidden dimension of 256 and block size $b = 4$ . All models are trained by the Adam optimizer with a learning rate of 0.001. More details are provided in the appendix.
|
| 195 |
+
|
| 196 |
+
# 4.1 LANGUAGE MODELING AND 3D STRUCTURE PREDICTION
|
| 197 |
+
|
| 198 |
+
Data. The Structural Antibody Database (SAbDab) consists of 4994 antibody structures renumbered according to the IMGT numbering scheme (Lefranc et al., 2003). To measure a model’s ability to generalize to novel CDR sequences, we divide the heavy chains into training, validation, and test sets based on CDR cluster split. We illustrate our cluster split process using CDR-H3 as an example. First, we use MMseqs2 (Steinegger & Soding, 2017) to cluster all the CDR-H3 sequences. The ¨ sequence identity is calculated under the BLOSUM62 substitution matrix (Henikoff & Henikoff, 1992). Two antibodies are put into the same cluster if their CDR-H3 sequence identity is above $40 \%$ . We then randomly split the clusters into training, validation, and test set with 8:1:1 ratio. We repeat the same procedure for creating CDR-H1 and CDR-H2 splits. In total, there are 1266, 1564, and 2325 clusters for CDR-H1, H2, and H3. The size of training, validation, and test sets for each CDR is shown in the appendix.
|
| 199 |
+
|
| 200 |
+
Metrics. For each method, we report the perplexity (PPL) of test sequences and the root mean square deviation (RMSD) between a predicted structure and its ground truth structure reported in SAbDab. RMSD is calculated by the Kabsch algorithm (Kabsch, 1976) based on $C _ { \alpha }$ coordinate of CDR residues. Since the mapping between sequences and structures is deterministic in RefineGNN, we can calculate perplexity in the same way as standard sequence models.
|
| 201 |
+
|
| 202 |
+
Results. Since the LSTM baseline does not involve structure prediction, we report RMSD for graphbased methods only. As shown in Table 1, RefineGNN significantly outperforms all baselines in both metrics. For CDR-H3, our model gives $13 \%$ PPL reduction (8.54 v.s. 9.70) over sequence only model and $10 \%$ PPL reduction over AR-GNN (8.54 v.s. 9.44). RefineGNN also predicts the structure more accurately, with $30 \%$ relative RMSD reduction over AR-GNN. In Figure 3, we provide examples of predicted 3D structures of CDR-H3 loops.
|
| 203 |
+
|
| 204 |
+
Ablation studies. We further conduct ablation experiments on the CDR-H3 generation task to study the importance of different modeling choices. First, when we remove the attention mechanism and context coarsening step in section 3.3, the PPL increases from 8.54 to 8.86 (Figure 3C, row 2) and 9.01 (Figure 3C, row 3) respectively. We also tried to remove both the attention and coarsening modules and trained the model without conditioning on the context sequence. The PPL of this unconditional variant is much worse than our conditional model (Figure 3C, row 4). Lastly, we train a structure-conditioned model by feeding the ground truth structure to RefineGNN at every generation step (Figure 3C, row 5). While this structure-conditioned model gives a lower PPL as expected (7.39 v.s. 8.54), it is not too far away from the sequence only model $( \mathrm { P P L } = 9 . 7 0 )$ ). This suggests that RefineGNN is able to extract a decent amount of information from the partial structure co-evolving with the sequence.
|
| 205 |
+
|
| 206 |
+

|
| 207 |
+
Figure 3: (A) CDR-H3 structure predicted by RefineGNN (PDB: 4bkl, $\mathrm { R M S D } = 0 . 5 7 )$ . The predicted structure (cyan) is aligned to the true structure (green) using the Kabsch algorithm. (B) CDRH3 structure predicted by AR-GNN (PDB: 4bkl, $\mathrm { R M S D } = 2 . 1 6 $ ). (C) Ablation studies of different modeling choices in RefineGNN in the CDR-H3 perplexity evaluation task.
|
| 208 |
+
|
| 209 |
+
# 4.2 ANTIGEN-BINDING ANTIBODY DESIGN
|
| 210 |
+
|
| 211 |
+
Data. Adolf-Bryfogle et al. (2018) selected 60 antibody-antigen complexes as an antibody design benchmark. Given the framework of an antibody, the goal is to design its CDR-H3 that binds to its corresponding antigen. For simplicity, none of the methods is conditioned on the antigen structure during CDR-H3 generation. We leave antigen-conditioned CDR generation for future work.
|
| 212 |
+
|
| 213 |
+
Metric. Following Adolf-Bryfogle et al. (2018), we use amino acid recovery (AAR) as the evaluation metric. For any generated sequence, we define its AAR as the percentage of residues having the same amino acid as the corresponding residue in the original antibody.
|
| 214 |
+
|
| 215 |
+
Results. For LSTM, AR-GNN, and RefineGNN, the training set in this setup is the entire SAbDab except antibodies in the same cluster as any of the test antibodies. At test time, we generate 10000 fiCDR-H3 sequences for each antibody and select the top 100 candidates with the lowest perplexity. For simplicity, all methods are configured to generate CDRs of the same length as the original CDR. As shown in Table 1, our model achieves the highest AAR score, with around $7 \%$ absolute improvement over the best baseline. In Figure 4A, we show an example of a generated CDRH3 sequence and highlight residues that are different from the original antibody. We also found that sequences with lower perplexity tend to have a lower AA recovery error (Pearson $\mathrm { R } = 0 . 4 2 7$ , Figure 4B). This suggests that we can use perplexity as the ranking criterion for antibody design.
|
| 216 |
+
|
| 217 |
+
# 4.3 SARS-COV-2 NEUTRALIZATION OPTIMIZATION
|
| 218 |
+
|
| 219 |
+
Data. The Coronavirus Antibody Database (CoVAbDab) contains 2411 antibodies, each associated with multiple binary labels indicating whether it neutralizes a coronavirus (SARS-CoV-1 or SARS-CoV-2) at a certain epitope. Similar to the previous experiment, we divide the antibodies into training, validation, and test sets based on CDR-H3 cluster split with 8:1:1 ratio.
|
| 220 |
+
|
| 221 |
+
Neutralization predictor. The predictor takes as input the VH sequence of an antibody and outputs a neutralization probability for the SARS-CoV-1 and SARS-CoV-2 viruses. Each residue is embedded into a 64 dimensional vector, which is fed to a SRU encoder (Lei, 2021) followed by average-pooling and a two-layer feed forward network. The final outputs are the probabilities $p _ { 1 }$ and $p _ { 2 }$ of neutralizing SARS-CoV-1 and SARS-CoV-2 and our scoring function is $f ( s ) = p _ { 2 }$ . The predictor achieved 0.81 test AUROC for SARS-CoV-2 neutralization prediction.
|
| 222 |
+
|
| 223 |
+

|
| 224 |
+
Figure 4: (A) Visualization of a generated CDR-H3 sequence and its structure in complex with an antigen (PDB: 4cmh). The predicted structure is aligned and grafted onto the original antibody using the Kabsch algorithm. Residues different from the original antibody are highlighted in red. (B) The correlation between the perplexity of a generated sequence and AA recovery error.
|
| 225 |
+
|
| 226 |
+
Table 2: SARS-CoV-2 neutralization optimization results. For each method, we report the PPL on CoVAbDab after pretraining on SAbDab and then report the average neutralization score after ITA finetuning. The average neutralization probability of original CoVAbDab antibodies is $6 9 . 3 \%$ .
|
| 227 |
+
|
| 228 |
+
<table><tr><td></td><td>Original</td><td>LSTM</td><td>AR-GNN</td><td>RefineGNN</td></tr><tr><td>CoVAbDab PPL(↓)</td><td></td><td>9.40</td><td>8.67</td><td>7.86</td></tr><tr><td>Neutralization (↑)</td><td>69.3%</td><td>72.0%</td><td>70.4%</td><td>75.2%</td></tr></table>
|
| 229 |
+
|
| 230 |
+
CDR sequence constraints. Therapeutic antibodies must be free from developability issues such as glycosylation and high charges (Raybould et al., 2019). Thus, we include four constraints on a CDR-H3 sequence s: 1) Its net charge must be between -2.0 and 2.0 (Raybould et al., 2019). The definition of net charge is given in the appendix. 2) It must not contain the N-X-S/T motif which is prone to glycosylation. 3) Any amino acid should not repeat more than five times (e.g. SSSSS). 4) Perplexity of a generated sequence given by LSTM, AR-GNN, and RefineGNN should be all less than 10. The last two constraints force generated sequences to be realistic. We use all three models in the perplexity constraint to ensure a fair comparison for all methods.
|
| 231 |
+
|
| 232 |
+
Metric. For each antibody in the test set, we generate 100 new CDR-H3 sequences, concatenate them with its context sequence to form 100 full VH sequences, and feed them into the neutralization predictor $f$ . We report the average neutralization score of antibodies in the test set. Neutralization score of a generated sequence $s ^ { \prime }$ equals $f ( s ^ { \prime } )$ if it satisfies all the CDR sequence constraints. Otherwise the score is the same as the original sequence. In addition, we pretrain each model on the SAbDab CDR-H3 sequences and evaluate its PPL on the CoVAbDab CDR-H3 sequences.
|
| 233 |
+
|
| 234 |
+
Results. All methods are pretrained on SAbDab antibodies and finetuned on CoVAbDab using the ITA algorithm to generate neutralizing antibodies. Our model outperforms the best baseline by a $3 \%$ increase in terms of average neutralization score (Table 2). Our pretrained RefineGNN also achieves a much lower perplexity on CoVAbDab antibodies (7.86 v.s. 8.67). Examples of generated CDR-H3 sequences and their predicted neutralization scores are shown in the appendix.
|
| 235 |
+
|
| 236 |
+
# 5 CONCLUSION
|
| 237 |
+
|
| 238 |
+
In this paper, we developed a RefineGNN model for antibody sequence and structure co-design. The advantage of our model over previous graph generation methods is its ability to revise a generated subgraph to accommodate addition of new residues. Our approach significantly outperforms sequence-based and graph-based approaches on three antibody generation tasks.
|
| 239 |
+
|
| 240 |
+
# ACKNOWLEDGEMENT
|
| 241 |
+
|
| 242 |
+
We would like to thank Rachel Wu, Xiang Fu, Jason Yim, and Peter Mikhael for their valuable feedback on the manuscript. We also want to thank Nitan Shalon, Nicholas Webb, Jae Hyeon Lee, Qiu Yu, and Galit Alter for their suggestions on method development. We are grateful for the generous support of Mark and Lisa Schwartz, funding in a form of research grant from Sanofi, Defense Threat Reduction Agency (DTRA), C3.ai Digital Transformation Institute, Eric and Wendy Schmidt Center at the Broad Institute, Abdul Latif Jameel Clinic for Machine Learning in Health, DTRA Discovery of Medical Countermeasures Against New and Emerging (DOMANE) threats program, and DARPA Accelerated Molecular Discovery program.
|
| 243 |
+
|
| 244 |
+
# REFERENCES
|
| 245 |
+
|
| 246 |
+
Abul K Abbas, Andrew H Lichtman, and Shiv Pillai. Cellular and molecular immunology E-book. Elsevier Health Sciences, 2014.
|
| 247 |
+
|
| 248 |
+
Jared Adolf-Bryfogle, Oleks Kalyuzhniy, Michael Kubitz, Brian D Weitzner, Xiaozhen Hu, Yumiko Adachi, William R Schief, and Roland L Dunbrack Jr. Rosettaantibodydesign (rabd): A general framework for computational antibody design. PLoS computational biology, 14(4):e1006112, 2018.
|
| 249 |
+
|
| 250 |
+
Rahmad Akbar, Philippe A Robert, Cedric R Weber, Michael Widrich, Robert Frank, Milena ´ Pavlovic, Lonneke Scheffer, Maria Chernigovskaya, Igor Snapkov, Andrei Slabodkin, et al. In sil- ´ ico proof of principle of machine learning-based antibody design at unconstrained scale. BioRxiv, 2021.
|
| 251 |
+
|
| 252 |
+
Mohammed M Al Qaraghuli, Karina Kubiak-Ossowska, Valerie A Ferro, and Paul A Mulheran. Antibody-protein binding and conformational changes: identifying allosteric signalling pathways to engineer a better effector response. Scientific reports, 10(1):1–10, 2020.
|
| 253 |
+
|
| 254 |
+
Ethan C Alley, Grigory Khimulya, Surojit Biswas, Mohammed AlQuraishi, and George M Church. Unified rational protein engineering with sequence-based deep representation learning. Nature methods, 16(12):1315–1322, 2019.
|
| 255 |
+
|
| 256 |
+
Minkyung Baek, Frank DiMaio, Ivan Anishchenko, Justas Dauparas, Sergey Ovchinnikov, Gyu Rie Lee, Jue Wang, Qian Cong, Lisa N Kinch, R Dustin Schaeffer, et al. Accurate prediction of protein structures and interactions using a three-track neural network. Science, 373(6557):871– 876, 2021.
|
| 257 |
+
|
| 258 |
+
Yue Cao, Payel Das, Vijil Chenthamarakshan, Pin-Yu Chen, Igor Melnyk, and Yang Shen. Fold2seq: A joint sequence (1d)-fold (3d) embedding-based generative model for protein design. In International Conference on Machine Learning, pp. 1261–1271. PMLR, 2021.
|
| 259 |
+
|
| 260 |
+
Kyunghyun Cho, Bart Van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Hol- ¨ ger Schwenk, and Yoshua Bengio. Learning phrase representations using rnn encoder-decoder for statistical machine translation. arXiv preprint arXiv:1406.1078, 2014.
|
| 261 |
+
|
| 262 |
+
James Dunbar, Konrad Krawczyk, Jinwoo Leem, Terry Baker, Angelika Fuchs, Guy Georges, Jiye Shi, and Charlotte M Deane. Sabdab: the structural antibody database. Nucleic acids research, 42(D1):D1140–D1146, 2014.
|
| 263 |
+
|
| 264 |
+
Sharon Fischman and Yanay Ofran. Computational design of antibodies. Current opinion in structural biology, 51:156–162, 2018.
|
| 265 |
+
|
| 266 |
+
Niklas WA Gebauer, Michael Gastegger, and Kristof T Schutt. Symmetry-adapted generation of ¨ 3d point sets for the targeted discovery of molecules. In Proceedings of the 33rd International Conference on Neural Information Processing Systems, pp. 7566–7578, 2019.
|
| 267 |
+
|
| 268 |
+
Aditya Grover, Aaron Zweig, and Stefano Ermon. Graphite: Iterative generative modeling of graphs. In International conference on machine learning, pp. 2434–2444. PMLR, 2019.
|
| 269 |
+
|
| 270 |
+
Steven Henikoff and Jorja G Henikoff. Amino acid substitution matrices from protein blocks. Proceedings of the National Academy of Sciences, 89(22):10915–10919, 1992.
|
| 271 |
+
|
| 272 |
+
John Ingraham, Adam Riesselman, Chris Sander, and Debora Marks. Learning protein structure with a differentiable simulator. In International Conference on Learning Representations, 2018.
|
| 273 |
+
|
| 274 |
+
John Ingraham, Vikas K Garg, Regina Barzilay, and Tommi Jaakkola. Generative models for graphbased protein design. Neural Information Processing Systems, 2019.
|
| 275 |
+
|
| 276 |
+
Wengong Jin, Regina Barzilay, and Tommi Jaakkola. Hierarchical generation of molecular graphs using structural motifs. In Proceedings of the 37th International Conference on Machine Learning, volume 119, pp. 4839–4848. PMLR, 2020a.
|
| 277 |
+
|
| 278 |
+
Wengong Jin, Regina Barzilay, and Tommi Jaakkola. Multi-objective molecule generation using interpretable substructures. In Proceedings of the 37th International Conference on Machine Learning, volume 119, pp. 4849–4859. PMLR, 2020b.
|
| 279 |
+
|
| 280 |
+
John Jumper, Richard Evans, Alexander Pritzel, Tim Green, Michael Figurnov, Olaf Ronneberger, Kathryn Tunyasuvunakool, Russ Bates, Augustin Zˇ ´ıdek, Anna Potapenko, et al. Highly accurate protein structure prediction with alphafold. Nature, 596(7873):583–589, 2021.
|
| 281 |
+
|
| 282 |
+
Wolfgang Kabsch. A solution for the best rotation to relate two sets of vectors. Acta Crystallographica Section A: Crystal Physics, Diffraction, Theoretical and General Crystallography, 32 (5):922–923, 1976.
|
| 283 |
+
|
| 284 |
+
Mostafa Karimi, Shaowen Zhu, Yue Cao, and Yang Shen. De novo protein design for novel folds using guided conditional wasserstein generative adversarial networks. Journal of Chemical Information and Modeling, 60(12):5667–5681, 2020.
|
| 285 |
+
|
| 286 |
+
Gideon D Lapidoth, Dror Baran, Gabriele M Pszolla, Christoffer Norn, Assaf Alon, Michael D Tyka, and Sarel J Fleishman. Abdesign: A n algorithm for combinatorial backbone design guided by natural conformations and sequences. Proteins: Structure, Function, and Bioinformatics, 83 (8):1385–1406, 2015.
|
| 287 |
+
|
| 288 |
+
Andrew Leaver-Fay, Michael Tyka, Steven M Lewis, Oliver F Lange, James Thompson, Ron Jacak, Kristian W Kaufman, P Douglas Renfrew, Colin A Smith, Will Sheffler, et al. Rosetta3: an objectoriented software suite for the simulation and design of macromolecules. Methods in enzymology, 487:545–574, 2011.
|
| 289 |
+
|
| 290 |
+
Marie-Paule Lefranc, Christelle Pommie, Manuel Ruiz, V ´ eronique Giudicelli, Elodie Foulquier, ´ Lisa Truong, Valerie Thouvenin-Contet, and G ´ erard Lefranc. Imgt unique numbering for im- ´ munoglobulin and t cell receptor variable domains and ig superfamily v-like domains. Developmental & Comparative Immunology, 27(1):55–77, 2003.
|
| 291 |
+
|
| 292 |
+
Tao Lei. When attention meets fast recurrence: Training language models with reduced compute. arXiv preprint arXiv:2102.12459, 2021.
|
| 293 |
+
|
| 294 |
+
Tong Li, Robert J Pantazes, and Costas D Maranas. Optmaven–a new framework for the de novo design of antibody variable region models targeting specific antigen epitopes. PloS one, 9(8): e105954, 2014.
|
| 295 |
+
|
| 296 |
+
Yujia Li, Oriol Vinyals, Chris Dyer, Razvan Pascanu, and Peter Battaglia. Learning deep generative models of graphs. arXiv preprint arXiv:1803.03324, 2018.
|
| 297 |
+
|
| 298 |
+
Renjie Liao, Yujia Li, Yang Song, Shenlong Wang, Will Hamilton, David K Duvenaud, Raquel Urtasun, and Richard Zemel. Efficient graph generation with graph recurrent attention networks. Advances in Neural Information Processing Systems, 32:4255–4265, 2019.
|
| 299 |
+
|
| 300 |
+
Ge Liu, Haoyang Zeng, Jonas Mueller, Brandon Carter, Ziheng Wang, Jonas Schilz, Geraldine Horny, Michael E Birnbaum, Stefan Ewert, and David K Gifford. Antibody complementarity determining region design using high-capacity machine learning. Bioinformatics, 36(7):2126– 2133, 2020.
|
| 301 |
+
|
| 302 |
+
Qi Liu, Miltiadis Allamanis, Marc Brockschmidt, and Alexander L Gaunt. Constrained graph variational autoencoders for molecule design. Neural Information Processing Systems, 2018.
|
| 303 |
+
|
| 304 |
+
Shitong Luo and Wei Hu. Diffusion probabilistic models for 3d point cloud generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2837–2845, 2021.
|
| 305 |
+
|
| 306 |
+
James O’Connell, Zhixiu Li, Jack Hanson, Rhys Heffernan, James Lyons, Kuldip Paliwal, Abdollah Dehzangi, Yuedong Yang, and Yaoqi Zhou. Spin2: Predicting sequence profiles from protein structures using deep neural networks. Proteins: Structure, Function, and Bioinformatics, 86(6): 629–633, 2018.
|
| 307 |
+
|
| 308 |
+
RJ Pantazes and Costas D Maranas. Optcdr: a general computational method for the design of antibody complementarity determining regions for targeted epitope binding. Protein Engineering, Design & Selection, 23(11):849–858, 2010.
|
| 309 |
+
|
| 310 |
+
Dora Pinto, Young-Jun Park, Martina Beltramello, Alexandra C Walls, M Alejandra Tortorici, Siro Bianchi, Stefano Jaconi, Katja Culap, Fabrizia Zatta, Anna De Marco, et al. Cross-neutralization of sars-cov-2 by a human monoclonal sars-cov antibody. Nature, 583(7815):290–295, 2020.
|
| 311 |
+
|
| 312 |
+
Matthew IJ Raybould, Claire Marks, Konrad Krawczyk, Bruck Taddese, Jaroslaw Nowak, Alan P Lewis, Alexander Bujotzek, Jiye Shi, and Charlotte M Deane. Five computational developability guidelines for therapeutic antibody profiling. Proceedings of the National Academy of Sciences, 116(10):4025–4030, 2019.
|
| 313 |
+
|
| 314 |
+
Matthew IJ Raybould, Aleksandr Kovaltsuk, Claire Marks, and Charlotte M Deane. Cov-abdab: the coronavirus antibody database. Bioinformatics, 37(5):734–735, 2021.
|
| 315 |
+
|
| 316 |
+
Koichiro Saka, Taro Kakuzaki, Shoichi Metsugi, Daiki Kashiwagi, Kenji Yoshida, Manabu Wada, Hiroyuki Tsunoda, and Reiji Teramoto. Antibody design using lstm based deep generative model from phage display library for affinity maturation. Scientific reports, 11(1):1–13, 2021.
|
| 317 |
+
|
| 318 |
+
Chence Shi, Shitong Luo, Minkai Xu, and Jian Tang. Learning gradient fields for molecular conformation generation. International Conference on Machine Learning, 2021.
|
| 319 |
+
|
| 320 |
+
Jung-Eun Shin, Adam J Riesselman, Aaron W Kollasch, Conor McMahon, Elana Simon, Chris Sander, Aashish Manglik, Andrew C Kruse, and Debora S Marks. Protein design and variant prediction using autoregressive generative models. Nature communications, 12(1):1–11, 2021.
|
| 321 |
+
|
| 322 |
+
Martin Steinegger and Johannes Soding. Mmseqs2 enables sensitive protein sequence searching for ¨ the analysis of massive data sets. Nature biotechnology, 35(11):1026–1028, 2017.
|
| 323 |
+
|
| 324 |
+
Alexey Strokach, David Becerra, Carles Corbi-Verge, Albert Perez-Riba, and Philip M Kim. Fast and flexible design of novel proteins using graph neural networks. BioRxiv, pp. 868935, 2020.
|
| 325 |
+
|
| 326 |
+
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.
|
| 327 |
+
|
| 328 |
+
Jianyi Yang, Ivan Anishchenko, Hahnbeom Park, Zhenling Peng, Sergey Ovchinnikov, and David Baker. Improved protein structure prediction using predicted interresidue orientations. Proceedings of the National Academy of Sciences, 117(3):1496–1503, 2020a.
|
| 329 |
+
|
| 330 |
+
Kevin Yang, Wengong Jin, Kyle Swanson, Regina Barzilay, and Tommi Jaakkola. Improving molecular design by stochastic iterative target augmentation. In International Conference on Machine Learning, pp. 10716–10726. PMLR, 2020b.
|
| 331 |
+
|
| 332 |
+
Jiaxuan You, Rex Ying, Xiang Ren, William L Hamilton, and Jure Leskovec. Graphrnn: A deep generative model for graphs. International Conference on Machine Learning, 2018.
|
| 333 |
+
|
| 334 |
+
# A MODEL ARCHITECTURE DETAILS
|
| 335 |
+
|
| 336 |
+
# A.1 REFINEGNN
|
| 337 |
+
|
| 338 |
+
Node features. Each node feature ${ \mathbf { } } v _ { i }$ encodes three dihedral angles as follows.
|
| 339 |
+
|
| 340 |
+
$$
|
| 341 |
+
\pmb { v _ { i } } = ( \cos \phi _ { i } , \cos \psi _ { i } , \cos \omega _ { i } , \sin \phi _ { i } , \sin \psi _ { i } , \sin \omega _ { i } )
|
| 342 |
+
$$
|
| 343 |
+
|
| 344 |
+
Edge features. The orientation matrix $O _ { i } = [ b _ { i } , n _ { i } , b _ { i } \times { \pmb n } _ { i } ]$ defines a local coordinate system for each residue $i$ (Ingraham et al., 2019), which is calculated as
|
| 345 |
+
|
| 346 |
+
$$
|
| 347 |
+
u _ { i } = { \frac { \displaystyle { \boldsymbol { x } } _ { i } - { \boldsymbol { x } } _ { i - 1 } } { \| { \boldsymbol { x } } _ { i } - { \boldsymbol { x } } _ { i - 1 } \| } } , \quad { \boldsymbol { b } } _ { i } = { \frac { \displaystyle { \boldsymbol { u } } _ { i } - { \boldsymbol { u } } _ { i + 1 } } { \| { \boldsymbol { u } } _ { i } - { \boldsymbol { u } } _ { i + 1 } \| } } , \quad n _ { i } = { \frac { \displaystyle { \boldsymbol { u } } _ { i } \times { \boldsymbol { u } } _ { i + 1 } } { \| { \boldsymbol { u } } _ { i } \times { \boldsymbol { u } } _ { i + 1 } \| } }
|
| 348 |
+
$$
|
| 349 |
+
|
| 350 |
+
Attention mechanism. The attention layer used in Eq.(13) is a standard bilinear attention:
|
| 351 |
+
|
| 352 |
+
$$
|
| 353 |
+
\operatorname { a t t e n t i o n } ( c _ { 1 : n } , h _ { t } ) = \sum _ { i } \alpha _ { i , t } c _ { i } , \qquad \alpha _ { i , t } = \frac { \exp ( c _ { i } ^ { \top } W h _ { t } ) } { \sum _ { j } \exp ( c _ { j } ^ { \top } W h _ { t } ) }
|
| 354 |
+
$$
|
| 355 |
+
|
| 356 |
+
# A.2 AR-GNN
|
| 357 |
+
|
| 358 |
+
AR-GNN generates an antibody graph autoregressively. In each generation step $t$ , AR-GNN learns to encode the current subgraph $\mathcal { G } _ { 1 : t }$ induced from residues $\{ s _ { 1 } , \cdots , s _ { t } \}$ into a list of vectors
|
| 359 |
+
|
| 360 |
+
$$
|
| 361 |
+
\{ h _ { 1 } , \cdot \cdot \cdot , h _ { t } \} = \mathrm { M P N } _ { \theta } ( \mathcal { G } _ { 1 : t } ) .
|
| 362 |
+
$$
|
| 363 |
+
|
| 364 |
+
For fair comparison, we use the same MPN architecture for both RefineGNN and AR-GNN. In terms of structure prediction, AR-GNN first predicts the node feature $\hat { \pmb { v } } _ { t + 1 }$ of the next residue $t + 1$ , namely the dihedral angle between its three atoms $C _ { \alpha } , C , N$ .
|
| 365 |
+
|
| 366 |
+
$$
|
| 367 |
+
\hat { \pmb { v } } _ { t + 1 } = \pmb { W } _ { v } \pmb { h } _ { t }
|
| 368 |
+
$$
|
| 369 |
+
|
| 370 |
+
In addition, AR-GNN predicts the pairwise distance between $\mathbf { } s _ { t + 1 }$ and previous residues $s _ { 1 } , \cdots , s _ { t }$
|
| 371 |
+
|
| 372 |
+
$$
|
| 373 |
+
\hat { d } _ { i , t + 1 } = \mathrm { F F N } ( W _ { d } h _ { i } + U _ { d } h _ { t } + V _ { d } E _ { p o s } ( t + 1 - i ) ) ,
|
| 374 |
+
$$
|
| 375 |
+
|
| 376 |
+
where FFN is a feed-forward network with one hidden layer and $E _ { p o s }$ is the positional encoding of $t + 1 - i$ , the gap between residue $s _ { t + 1 }$ and $\mathbf { \boldsymbol { s } } _ { i }$ in the sequence. Lastly, AR-GNN predicts the amino acid type of residue $s _ { t + 1 }$ by
|
| 377 |
+
|
| 378 |
+
$$
|
| 379 |
+
\hat { p } _ { t + 1 } = \mathrm { s o f t m a x } ( W _ { a } g _ { t + 1 } ) , \qquad \{ g _ { 1 } , \cdot \cdot \cdot , g _ { t + 1 } \} = \mathrm { M P N } _ { \theta ^ { \prime } } ( \mathcal { G } _ { 1 : t + 1 } )
|
| 380 |
+
$$
|
| 381 |
+
|
| 382 |
+
Note that AR-GNN also uses two separate MPNs for structure and sequence prediction. However, unlike RefineGNN, AR-GNN is trained under teacher forcing — we need to feed it the ground truth structure and sequence in each generation step. In particular, we find data augmentation to be crucial for AR-GNN performance. Data augmentation is essential because of the discrepancy between training and testing. The model is trained under teacher forcing, but it needs to decode a graph without teacher forcing at test time. We find mistakes made in previous steps have a great impact on subsequent predictions during decoding.
|
| 383 |
+
|
| 384 |
+
Specifically, for every antibody $\pmb { s }$ , we create a corrupted graph $\widetilde { \mathcal G }$ by adding independent random Gaussian noise to every coordinate: $\tilde { \mathbf { \boldsymbol { x } } } _ { i } = \mathbf { \boldsymbol { x } } _ { i } + 3 \epsilon , \epsilon \sim \mathcal { N } ( 0 , I )$ . In each generation step, we apply MPN over the corrupted graph instead.
|
| 385 |
+
|
| 386 |
+
$$
|
| 387 |
+
\{ \widetilde { h } _ { 1 } , \cdot \cdot \cdot , \widetilde { h } _ { t } \} = \mathrm { M P N } _ { \theta } ( \widetilde { \mathcal { G } } _ { 1 : t } ) , \qquad \{ \widetilde { g } _ { 1 } , \cdot \cdot \cdot , \widetilde { g } _ { t + 1 } \} = \mathrm { M P N } _ { \theta ^ { \prime } } ( \widetilde { \mathcal { G } } _ { 1 : t + 1 } )
|
| 388 |
+
$$
|
| 389 |
+
|
| 390 |
+
The node and edge labels are still defined by the ground truth structure. Specifically, let ${ \mathbf { } } v _ { t }$ and $d _ { i , j }$ be the ground truth dihedral angle and pairwise distance calculated from the original, uncorrupted graph $\mathcal { G }$ . AR-GNN loss function is defined as the following.
|
| 391 |
+
|
| 392 |
+
$$
|
| 393 |
+
\mathcal { L } _ { A R } = \sum _ { i , j } \| \hat { d } _ { i , j } - d _ { i , j } \| ^ { 2 } + \sum _ { t } \| \hat { \pmb { v } } _ { t } - \pmb { v } _ { t } \| ^ { 2 } + \mathcal { L } _ { c e } ( \hat { p } _ { t } , \pmb { s } _ { t } )
|
| 394 |
+
$$
|
| 395 |
+
|
| 396 |
+
Similar to RefineGNN, AR-GNN also uses attention mechanism for conditional generation. Specifically, we concatenate the residue representations $\widetilde { h } _ { t } , \widetilde { g } _ { t }$ from MPN with context vectors learned from an attention layer.
|
| 397 |
+
|
| 398 |
+
$$
|
| 399 |
+
\widetilde { h } _ { t } \gets \widetilde { h } _ { t } \oplus \mathrm { a t t e n t i o n } ( c _ { 1 : n } , \widetilde { h } _ { t } ) \qquad \widetilde { g } _ { t } \gets \widetilde { g } _ { t } \oplus \mathrm { a t t e n t i o n } ( c _ { 1 : n } , \widetilde { g } _ { t } )
|
| 400 |
+
$$
|
| 401 |
+
|
| 402 |
+
Table 3: SARS-CoV-2 neutralization optimization results. Here we show examples of new CDRH3 sequences generated by our model and their predicted neutralization improvement over original antibodies S1D7 and C694 in the CoVAbDab database.
|
| 403 |
+
|
| 404 |
+
<table><tr><td>Antibody:</td><td>S1D7</td><td>C694</td></tr><tr><td>Old CDR-H3</td><td>TRGHSDY</td><td>ARDRGYDSSGPDAFDI</td></tr><tr><td>New CDR-H3</td><td>ARWWMDV</td><td>ARERIIIVSISAWMDV</td></tr><tr><td>Improvement</td><td>63% → 73%</td><td>82% →91%</td></tr></table>
|
| 405 |
+
|
| 406 |
+
# B EXPERIMENTAL DETAILS
|
| 407 |
+
|
| 408 |
+
Hyperparameters. For AR-GNN and RefineGNN, we tried hidden dimension $d _ { h } \in \{ 1 2 8 , 2 5 6 \}$ and number of message passing layers $L \in \{ 1 , 2 , 3 , 4 , 5 \}$ . We found $d _ { h } = 2 5 6 , L = 4$ worked the best for RefineGNN and $d _ { h } = 2 5 6 , L = 3$ worked the best for AR-GNN. For LSTM, we tried $d _ { h } \in \{ 1 2 8 , 2 5 6 , 5 1 2 , 1 0 2 4 \}$ . We found $d _ { h } = 2 5 6$ worked the best. All models are trained by an Adam optimizer with a dropout of 0.1 and a learning rate of 0.001.
|
| 409 |
+
|
| 410 |
+
SAbDab data. The dataset statistics of SAbDab is the following (after deduplication). For CDRH1, the train/validation/test size is 4050, 359, and 326. For CDR-H2, the train/validation/test size is 3876, 483, and 376. For CDR-H3, the train/validation/test size is 3896, 403, and 437.
|
| 411 |
+
|
| 412 |
+
Since SAbDab includes both bound and unbound structures, we removed all antigens and used the bound antibody structure for training. Specifically, $65 \%$ of our training data came from bound state structures. We included all data in our training set because the mismatch between bound and unbound structures is relatively small. In fact, Al Qaraghuli et al. (2020) studied eight antibodies and found that the RMSD between bound and unbound structures over VH domains is less than 0.7 on average.
|
| 413 |
+
|
| 414 |
+
RAbD configuration. We provided details of the de novo design setup of RosettaAntibodyDesign (RAbD) here. For each antibody in the test set, RAbD starts by randomly selecting a CDR from RAbD’s internal database of known CDR structures. The chosen CDR-H3 sequence is required to have same length as the original sequence, but it cannot be exactly the same as the original CDR-H3 sequence. After the initial CDR structure is chosen, RAbD grafts it onto the antibody and performs energy minimization to stabilize its structure. Next, RAbD runs 100 iterations of sequence design to modify the grafted CDR-H3 structure by randomly substituting amino acids. In each sequence design iteration, it performs energy minimization to adjust the structure according to the changed amino acid. Lastly, the model returns the generated CDR-H3 sequence with the lowest energy.
|
| 415 |
+
|
| 416 |
+
SARS-CoV-2 neutralization. Each generative model is pretrained on the SAbDab data to learn a prior distribution over CDR-H3 structures. Given a fixed predictor $f$ , we use the ITA algorithm to finetune our pretrained models to generate neutralizing antibodies. Each model is trained for 3000 ITA steps with $M = 1 0 0$ . Generated CDR-H3 sequences from our model are visualized in Table 3.
|
| 417 |
+
|
| 418 |
+
Our neutralization predictor $f$ is trained on the CoVAbDab database. For simplicity, we only consider two viruses, SARS-CoV-1 and SARS-CoV-2 since other coronavirus have very little training data. For the same reason, we only consider the spike protein receptor binding domain as our target epitope. The predictor is trained in a multi-task fashion to predict both SARS-CoV-1 and SARSCoV-2 neutralization labels. The SRU encoder has a hidden dimension of 256. The model was trained with a dropout of 0.2, a learning rate of 0.0005, and batch size of 16.
|
| 419 |
+
|
| 420 |
+
The charge of a residue is defined as $C ( \pmb { s } _ { i } ) = \mathbb { I } [ \pmb { s } _ { i } \in \{ R , K \} ] + 0 . 1 \cdot \mathbb { I } [ \pmb { s } _ { i } = H ] - \mathbb { I } [ \pmb { s } _ { i } \in \{ D , E \} ]$ (Raybould et al., 2019). The net charge of a sequence $s _ { 1 } \cdots s _ { n }$ is defined as $\textstyle \sum _ { i } C ( s _ { i } )$ .
|
md/dev/LKEYuYNOqx/LKEYuYNOqx.md
ADDED
|
@@ -0,0 +1,381 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GENIE: Higher-Order Denoising Diffusion Solvers
|
| 2 |
+
|
| 3 |
+
Tim Dockhorn1,2,3,∗ Arash Vahdat1 Karsten Kreis1
|
| 4 |
+
|
| 5 |
+
1NVIDIA 2University of Waterloo 3Vector Institute
|
| 6 |
+
|
| 7 |
+
tim.dockhorn@uwaterloo.ca, {avahdat,kkreis}@nvidia.com
|
| 8 |
+
|
| 9 |
+
# Abstract
|
| 10 |
+
|
| 11 |
+
Denoising diffusion models (DDMs) have emerged as a powerful class of generative models. A forward diffusion process slowly perturbs the data, while a deep model learns to gradually denoise. Synthesis amounts to solving a differential equation (DE) defined by the learnt model. Solving the DE requires slow iterative solvers for high-quality generation. In this work, we propose Higher-Order Denoising Diffusion Solvers (GENIE): Based on truncated Taylor methods, we derive a novel higher-order solver that significantly accelerates synthesis. Our solver relies on higher-order gradients of the perturbed data distribution, that is, higher-order score functions. In practice, only Jacobian-vector products (JVPs) are required and we propose to extract them from the first-order score network via automatic differentiation. We then distill the JVPs into a separate neural network that allows us to efficiently compute the necessary higher-order terms for our novel sampler during synthesis. We only need to train a small additional head on top of the first-order score network. We validate GENIE on multiple image generation benchmarks and demonstrate that GENIE outperforms all previous solvers. Unlike recent methods that fundamentally alter the generation process in DDMs, our GENIE solves the true generative DE and still enables applications such as encoding and guided sampling. Project page and code: https://nv-tlabs.github.io/GENIE.
|
| 12 |
+
|
| 13 |
+
# 1 Introduction
|
| 14 |
+
|
| 15 |
+
Denoising diffusion models (DDMs) offer both state-of-the-art synthesis quality and sample diversity in combination with a robust and scalable learning objective. DDMs have been used for image [1–5] and video [6, 7] synthesis, super-resolution [8, 9], deblurring [10, 11], image editing and inpainting [5, 12–14], text-to-image synthesis [15–17], conditional and semantic image generation [18–22], imageto-image translation [14, 23, 24] and for inverse problems in medical imaging [25–31]. They also enable high-quality speech synthesis [32–37], 3D shape generation [38–42], molecular modeling [43– 46], maximum likelihood training [47–50], and more [51–56]. In DDMs, a diffusion process gradually perturbs the data towards random noise, while a deep neural network learns to denoise. Formally, the problem reduces to learning the score function, i.e., the gradient of the log-density of the perturbed data. The (approximate) inverse of the forward diffusion can be described by an ordinary or a stochastic differential equation (ODE or SDE, respectively), defined by the learned score function, and can therefore be used for generation when starting from random noise [47, 57].
|
| 16 |
+
|
| 17 |
+
A crucial drawback of DDMs is that the generative ODE or SDE is typically difficult to solve, due to the complex score function. Therefore, efficient and tailored samplers are required for fast synthesis. In this work, building on the generative ODE [47, 57, 58], we rigorously derive a novel second-order ODE solver using truncated Taylor methods [59]. These higher-order methods require higher-order gradients of the ODE—in our case this includes higher-order gradients of the log-density of the perturbed data, i.e., higher-order score functions. Because such higher-order scores are usually not available, existing works typically use simple first-order solvers or samplers with low accuracy [1, 57, 58, 60], higher-order methods that rely on suboptimal finite difference or other approximations [61–63], or alternative approaches [64–66] for accelerated sampling. Here, we fundamentally avoid such approximations and directly model the higher-order gradient terms: Importantly, our novel Higher-Order Denoising Diffusion Solver (GENIE) relies on Jacobian-vector products (JVPs) involving second-order scores. We propose to calculate these JVPs by automatic differentiation of the regular learnt first-order scores. For computational efficiency, we then distill the entire higher-order gradient of the ODE, including the JVPs, into a separate neural network. In practice, we only need to add a small head to the first-order score network to predict the components of the higher-order ODE gradient. By directly modeling the JVPs we avoid explicitly forming high-dimensional higher-order scores. Intuitively, the higher-order terms in GENIE capture the local curvature of the ODE and enable larger steps when iteratively solving the generative ODE (Fig. 1).
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: Our novel Higher-Order Denoising Diffusion Solver (GENIE) relies on the second truncated Taylor method (TTM) to simulate a (re-parametrized) Probability Flow ODE for sampling from denoising diffusion models. The second TTM captures the local curvature of the ODE’s gradient field and enables more accurate extrapolation and larger step sizes than the first TTM (Euler’s method), which previous methods such as DDIM [58] utilize.
|
| 21 |
+
|
| 22 |
+
Experimentally, we validate GENIE on multiple image modeling benchmarks and achieve state-ofthe-art performance in solving the generative ODE of DDMs with few synthesis steps. In contrast to recent methods that fundamentally modify the generation process of DDMs by training conditional GANs [67] or by distilling the full sampling trajectory [68, 69], GENIE solves the true generative ODE. Therefore, we also show that we can still encode images in the DDM’s latent space, as required for instance for image interpolation, and use techniques such as guided sampling [4, 57, 70].
|
| 23 |
+
|
| 24 |
+
We make the following contributions: (i) We introduce GENIE, a novel second-order ODE solver for fast DDM sampling. (ii) We propose to extract the required higher-order terms from the first-order score model by automatic differentiation. In contrast to existing works, we explicitly work with higher-order scores without finite difference approximations. To the best of our knowledge, GENIE is the first method that explicitly uses higher-order scores for generative modeling with DDMs. (iii) We propose to directly model the necessary JVPs and distill them into a small neural network. (iv) We outperform all previous solvers and samplers for the generative differential equations of DDMs.
|
| 25 |
+
|
| 26 |
+
# 2 Background
|
| 27 |
+
|
| 28 |
+
We consider continuous-time DDMs [1, 57, 71] whose forward process can be described by
|
| 29 |
+
|
| 30 |
+
$$
|
| 31 |
+
p _ { t } ( \mathbf { x } _ { t } | \mathbf { x } _ { 0 } ) = \mathcal { N } ( \mathbf { x } _ { t } ; \alpha _ { t } \mathbf { x } _ { 0 } , \sigma _ { t } ^ { 2 } I ) ,
|
| 32 |
+
$$
|
| 33 |
+
|
| 34 |
+
where $\mathbf { x } _ { 0 } \sim p _ { 0 } ( \mathbf { x } _ { 0 } )$ is drawn from the empirical data distribution and $\mathbf { x } _ { t }$ refers to diffused data samples at time $t \in [ 0 , 1 ]$ along the diffusion process. The functions $\alpha _ { t }$ and $\sigma _ { t }$ are generally chosen such that the logarithmic signal-to-noise ratio [48] $\begin{array} { r } { \log { \frac { \alpha _ { t } ^ { 2 } } { \sigma _ { t } ^ { 2 } } } } \end{array}$ decreases monotonically with $t$ and the data diffuses towards random noise, i.e., $p _ { 1 } ( \mathbf { x } _ { 1 } ) \approx \mathcal { N } ( \mathbf { x } _ { 1 } ; \mathbf { 0 } , \bar { I } )$ . We use variance-preserving [57] diffusion processes for which $\sigma _ { t } ^ { 2 } = 1 - \alpha _ { t } ^ { 2 }$ (however, all methods introduced in this work are applicable to more general DDMs). The diffusion process can then be expressed by the (variance-preserving) SDE
|
| 35 |
+
|
| 36 |
+
$$
|
| 37 |
+
\begin{array} { r } { d \mathbf { x } _ { t } = - \frac { 1 } { 2 } \beta _ { t } \mathbf { x } _ { t } d t + \sqrt { \beta _ { t } } d \mathbf { w } _ { t } , } \end{array}
|
| 38 |
+
$$
|
| 39 |
+
|
| 40 |
+
where diffusi $\begin{array} { r } { \beta _ { t } = - \frac { d } { d t } \log \alpha _ { t } ^ { 2 } } \end{array}$ , f $\mathbf { x } _ { 0 } \sim p _ { 0 } ( \mathbf { x } _ { 0 } )$ and rts th $\mathbf { w } _ { t }$ is a standard Wiener process. A corresponding reverseorward diffusion is given by [57, 72, 73]
|
| 41 |
+
|
| 42 |
+
$$
|
| 43 |
+
\begin{array} { r } { d \mathbf { x } _ { t } = - \frac { 1 } { 2 } \beta _ { t } \left[ \mathbf { x } _ { t } + 2 \nabla _ { \mathbf { x } _ { t } } \log p _ { t } ( \mathbf { x } _ { t } ) \right] d t + \sqrt { \beta _ { t } } d \mathbf { w } _ { t } , } \end{array}
|
| 44 |
+
$$
|
| 45 |
+
|
| 46 |
+
and this reverse-time generative SDE is marginally equivalent to the generative ODE [47, 57]
|
| 47 |
+
|
| 48 |
+
$$
|
| 49 |
+
\begin{array} { r } { d \mathbf { x } _ { t } = - \frac { 1 } { 2 } \beta _ { t } \left[ \mathbf { x } _ { t } + \nabla _ { \mathbf { x } _ { t } } \log p _ { t } ( \mathbf { x } _ { t } ) \right] d t , } \end{array}
|
| 50 |
+
$$
|
| 51 |
+
|
| 52 |
+
where $\nabla _ { \mathbf { x } _ { t } } \log p _ { t } ( \mathbf { x } _ { t } )$ is the score function. Eq. (4) is referred to as the Probability Flow ODE [57], an instance of continuous Normalizing flows [74, 75]. To generate samples from the DDM, one can sample $\mathbf { x } _ { 1 } \sim \mathcal { N } ( \mathbf { x } _ { 1 } ; \mathbf { 0 } , I )$ and numerically simulate either the Probability Flow ODE or the generative SDE, replacing the unknown score function by a learned score model $s _ { \theta } ( \mathbf { x } _ { t } , t ) \approx \nabla _ { \mathbf { x } _ { t } } \log p _ { t } ( \mathbf { x } _ { t } )$ .
|
| 53 |
+
|
| 54 |
+
The DDIM solver [58] has been particularly popular to simulate DDMs due to its speed and simplicity. It has been shown that DDIM is Euler’s method applied to an ODE based on a re-parameterization of the Probability Flow ODE [58, 69]: Defining $\begin{array} { r } { \gamma _ { t } = \sqrt { \frac { 1 - \alpha _ { t } ^ { 2 } } { \alpha _ { t } ^ { 2 } } } } \end{array}$ and $\bar { \mathbf { x } } _ { t } = \mathbf { x } _ { t } \sqrt { 1 + \gamma _ { t } ^ { 2 } }$ , we have
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
\frac { d \bar { \mathbf { x } } _ { t } } { d \gamma _ { t } } = \sqrt { 1 + \gamma _ { t } ^ { 2 } } \frac { d \mathbf { x } _ { t } } { d t } \frac { d t } { d \gamma _ { t } } + \mathbf { x } _ { t } \frac { \gamma _ { t } } { \sqrt { 1 + \gamma _ { t } ^ { 2 } } } = - \frac { \gamma _ { t } } { \sqrt { 1 + \gamma _ { t } ^ { 2 } } } \nabla _ { \mathbf { x } _ { t } } \log p _ { t } ( \mathbf { x } _ { t } ) ,
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
where we inserted Eq. (4) for $\frac { d { \bf x } _ { t } } { d t }$ and used $\begin{array} { r } { \beta ( t ) \frac { d t } { d \gamma _ { t } } = \frac { 2 \gamma _ { t } } { \gamma _ { t } ^ { 2 } + 1 } } \end{array}$ . Letting $\begin{array} { r } { s _ { \theta } ( \mathbf { x } _ { t } , t ) : = - \frac { \epsilon _ { \theta } ( \mathbf { x } _ { t } , t ) } { \sigma _ { t } } } \end{array}$ denote a parameterization of the score model, the approximate generative DDIM ODE is then given by
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
d \bar { \mathbf { x } } _ { t } = \epsilon _ { \theta } \left( \mathbf { x } _ { t } , t \right) d \gamma _ { t } ,
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
where we used $\begin{array} { r } { \sigma _ { t } = \sqrt { 1 - \alpha _ { t } ^ { 2 } } = \frac { \gamma _ { t } } { \sqrt { \gamma _ { t } ^ { 2 } + 1 } } } \end{array}$ (see App. A for a more detailed derivation of Eq. (6)). The model $\epsilon _ { \theta } ( \mathbf { x } _ { t } , t )$ can be learned by minimizing the score matching objective [1, 76]
|
| 67 |
+
|
| 68 |
+
$$
|
| 69 |
+
\operatorname* { m i n } _ { \pmb { \theta } } \mathbb { E } _ { t \sim \mathcal { U } [ t _ { \mathrm { c u t o f f } } , 1 ] , \mathbf { x } _ { 0 } \sim p ( \mathbf { x } _ { 0 } ) , \epsilon \sim \mathcal { N } ( \mathbf { 0 } , I ) } \left[ g ( t ) \lVert \epsilon - \epsilon _ { \boldsymbol { \theta } } ( \mathbf { x } _ { t } , t ) \rVert _ { 2 } ^ { 2 } \right] , \quad \mathbf { x } _ { t } = \alpha _ { t } \mathbf { x } _ { 0 } + \sigma _ { t } \epsilon ,
|
| 70 |
+
$$
|
| 71 |
+
|
| 72 |
+
for small $0 < t _ { \mathrm { c u t o f f } } \ll 1$ . As is standard practice, we set $g ( t ) = 1$ . Other weighting functions $g ( t )$ are possible; for example, setting $\begin{array} { r } { g ( t ) = \frac { \beta _ { t } } { 2 \sigma _ { t } ^ { 2 } } } \end{array}$ recovers maximum likelihood learning [47–50].
|
| 73 |
+
|
| 74 |
+
# 3 Higher-Order Denoising Diffusion Solver
|
| 75 |
+
|
| 76 |
+
As discussed in Sec. 2, the so-known DDIM solver [58] is simply Euler’s method applied to the DDIM ODE (cf. Eq. (6)). In this work, we apply a higher-order method to the DDIM ODE, building on the truncated Taylor method (TTM) [59]. The $p$ -th TTM is simply the $p$ -th order Taylor polynomial applied to an ODE. For example, for the general $\begin{array} { r } { \frac { d \mathbf { y } } { d t } = \pmb { f } ( \mathbf { y } , t ) } \end{array}$ , the $p$ -th TTM reads as
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
\mathbf { y } _ { t _ { n + 1 } } = \mathbf { y } _ { t _ { n } } + h _ { n } { \frac { d \mathbf { y } } { d t } } | _ { ( \mathbf { y } _ { t _ { n } } , t _ { n } ) } + \cdot \cdot \cdot + { \frac { 1 } { p ! } } h _ { n } ^ { p } { \frac { d ^ { p } \mathbf { y } } { d t ^ { p } } } | _ { ( \mathbf { y } _ { t _ { n } } , t _ { n } ) } ,
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
where $h _ { n } = t _ { n + 1 } - t _ { n }$ (see App. B.1 for a truncation error analysis with respect to the exact ODE solution). Note that the first TTM is simply Euler’s method. Applying the second TTM to the DDIM ODE results in the following scheme:
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
\bar { \mathbf { x } } _ { t _ { n + 1 } } = \bar { \mathbf { x } } _ { t _ { n } } + h _ { n } \epsilon _ { \theta } ( \mathbf { x } _ { t _ { n } } , t _ { n } ) + \frac { 1 } { 2 } h _ { n } ^ { 2 } \frac { d \epsilon _ { \theta } } { d \gamma _ { t } } | _ { ( \mathbf { x } _ { t _ { n } } , t _ { n } ) } ,
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
where $h _ { n } = \gamma _ { t _ { n + 1 } } - \gamma _ { t _ { n } }$ . Recall that $\begin{array} { r } { \gamma _ { t } = \sqrt { \frac { 1 - \alpha _ { t } ^ { 2 } } { \alpha _ { t } ^ { 2 } } } } \end{array}$ , where the function $\alpha _ { t }$ is a time-dependent hyperparameter of the DDM. The total derivative $\begin{array} { r } { d _ { \gamma _ { t } } \epsilon _ { \theta } : = \frac { d \epsilon _ { \theta } } { d \gamma _ { t } } } \end{array}$ can be decomposed as follows
|
| 89 |
+
|
| 90 |
+
$$
|
| 91 |
+
d _ { \gamma _ { t } } \epsilon _ { \theta } ( \mathbf { x } _ { t } , t ) = \frac { \partial \epsilon _ { \theta } ( \mathbf { x } _ { t } , t ) } { \partial \mathbf { x } _ { t } } \frac { d \mathbf { x } _ { t } } { d \gamma _ { t } } + \frac { \partial \epsilon _ { \theta } ( \mathbf { x } _ { t } , t ) } { \partial t } \frac { d t } { d \gamma _ { t } } ,
|
| 92 |
+
$$
|
| 93 |
+
|
| 94 |
+
where ∂ϵθ(xt,t) denotes the Jacobian of ϵθ(xt, t) and
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
\frac { d \mathbf { x } _ { t } } { d \gamma _ { t } } = \frac { \partial \mathbf { x } _ { t } } { \partial \bar { \mathbf { x } } _ { t } } \frac { d \bar { \mathbf { x } } _ { t } } { d \gamma _ { t } } + \frac { \partial \mathbf { x } _ { t } } { \partial \gamma _ { t } } = \frac { 1 } { \sqrt { \gamma _ { t } ^ { 2 } + 1 } } \epsilon _ { \theta } ( \mathbf { x } _ { t } , t ) - \frac { \gamma _ { t } } { 1 + \gamma _ { t } ^ { 2 } } \mathbf { x } _ { t } .
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
If not explicitly stated otherwise, we refer to the second TTM applied to the DDIM ODE, i.e., the scheme in Eq. (9), as Higher-Order Denoising Diffusion Solver (GENIE). Intuitively, the higher-order gradient terms used in the second TMM model the local curvature of the ODE. This translates into a Taylor formula-based extrapolation that is quadratic in time (cf. Eqs. (8) and (9)) and more accurate than linear extrapolation, as in Euler’s method, thereby enabling larger time steps (see Fig. 1 for a visualization). In App. B, we also discuss the application of the third TTM to the DDIM ODE. We emphasize that TTMs are not restricted to the DDIM ODE and could just as well be applied to the Probability Flow ODE [57] (also see App. B) or neural ODEs [74, 75] more generally.
|
| 101 |
+
|
| 102 |
+

|
| 103 |
+
Figure 2: Modeling a complex 2D toy distribution: Samples in $( b )$ and (c) are generated via DDIM and GENIE, respectively, with 25 solver steps using the analytical score function of the ground truth distribution.
|
| 104 |
+
|
| 105 |
+
The Benefit of Higher-Order Methods: We showcase the benefit of higher-order methods on a 2D toy distribution (Fig. 2a) for which we know the score function as well as all higher-order derivatives necessary for GENIE analytically. We generate 1k different accurate “ground truth” trajectories $\mathbf { x } _ { t }$ using DDIM with $1 0 \mathrm { k }$ steps. We compare these “ground truth” trajectories to single steps of DDIM and GENIE for varying step sizes $\Delta t$ . We then measure the mean $L _ { 2 }$ -distance of the single steps $\hat { \mathbf { x } } _ { t } ( \Delta t )$ to the “ground truth” trajectories $\mathbf { x } _ { t }$ , and we repeat this experiment for three starting points $t \in \{ 0 . 1 , 0 . 2 , 0 . 5 \}$ . We see (Fig. 3 (top)) that GENIE can use larger step sizes to stay within a certain error tolerance for all starting points $t$ . We further show samples for DDIM and GENIE, using 25 solver steps, in Fig. 2. DDIM has the undesired behavior of sampling low-density regions between modes, whereas GENIE looks like a slightly noisy version of the ground truth distribution (Fig. 2a).
|
| 106 |
+
|
| 107 |
+
Comparison to Multistep Methods: Linear multistep methods are an alternative higher-order method to solve ODEs. Liu et al. [63] applied the well-established Adams–Bashforth [AB, 77] method to the DDIM ODE. AB methods can be derived from TTMs by approximating higher-order derivatives $\frac { d ^ { p } \mathbf { y } } { d t ^ { p } }$ using the finite difference method [78]. For example, the second AB method is obtained from the second TTM by replacing $\textstyle { \frac { d ^ { 2 } \mathbf { y } } { d t ^ { 2 } } }$ with the first-order forward difference approximation $( f ( { \bf y } _ { t _ { n } } , t _ { n } ) - f ( { \bf y } _ { t _ { n - 1 } } , t _ { n - 1 } ) ) / h _ { n - 1 }$ . In Fig. 3 (bottom), we visualize the mean $L _ { 2 }$ -norm of the difference $\xi _ { t } ( \Delta t )$ between the analytical derivative $d _ { \gamma _ { t } } \epsilon _ { \theta }$ and its first-order forward difference approximation for varying step sizes $\Delta t$ for the 2D toy distribution. The approximation is especially poor at small $t$ for which the score function becomes complex (App. E for details on all toy experiments).
|
| 108 |
+
|
| 109 |
+

|
| 110 |
+
Figure 3: Top: Single step error using analytical score function. Bottom: Norm of difference $\xi _ { t } ( \Delta t )$ between analytical and approximate derivative computed via finite difference method.
|
| 111 |
+
|
| 112 |
+
# 3.1 Learning Higher-Order Derivatives
|
| 113 |
+
|
| 114 |
+
The above observations inspire to apply GENIE to DDMs of more complex and high-dimensional data such as images. Regular DDMs learn a model $\epsilon _ { \theta }$ for the first-order score; however, the higher-order gradient terms required for GENIE (cf. Eq. (10)) are not immediately available to us, unlike in the toy example above. Let us insert Eq. (11) into Eq. (10) and analyze the required terms more closely:
|
| 115 |
+
|
| 116 |
+
$$
|
| 117 |
+
d _ { \gamma _ { t } } \epsilon _ { \theta } ( \mathbf { x } _ { t } , t ) = \frac { 1 } { \sqrt { \gamma _ { t } ^ { 2 } + 1 } } \underbrace { \frac { \partial \epsilon _ { \theta } ( \mathbf { x } _ { t } , t ) } { \partial \mathbf { x } _ { t } } \epsilon _ { \theta } ( \mathbf { x } _ { t } , t ) } _ { \mathrm { J V P _ { 1 } } } - \frac { \gamma _ { t } } { 1 + \gamma _ { t } ^ { 2 } } \underbrace { \frac { \partial \epsilon _ { \theta } ( \mathbf { x } _ { t } , t ) } { \partial \mathbf { x } _ { t } } \mathbf { x } _ { t } } _ { \mathrm { J V P _ { 2 } } } + \frac { \partial \epsilon _ { \theta } ( \mathbf { x } _ { t } , t ) } { \partial t } \frac { d t } { d \gamma _ { t } } .
|
| 118 |
+
$$
|
| 119 |
+
|
| 120 |
+
We see that the full derivative decomposes into two JVP terms and one simpler time derivative term. The term $\frac { \partial \epsilon _ { \theta } ( \mathbf { x } _ { t } , t ) } { \partial \mathbf { x } _ { t } }$ plays a crucial role in Eq. (12). It can be expressed as
|
| 121 |
+
|
| 122 |
+
$$
|
| 123 |
+
\frac { \partial \epsilon _ { \theta } ( \mathbf { x } _ { t } , t ) } { \partial \mathbf { x } _ { t } } = - \sigma _ { t } \frac { \partial \mathbf { s } _ { \theta } ( \mathbf { x } _ { t } , t ) } { \partial \mathbf { x } _ { t } } \approx - \sigma _ { t } \nabla _ { \mathbf { x } _ { t } } ^ { \top } \nabla _ { \mathbf { x } _ { t } } \log p _ { t } ( \mathbf { x } _ { t } ) ,
|
| 124 |
+
$$
|
| 125 |
+
|
| 126 |
+
which means that GENIE relies on second-order score functions $\nabla _ { \mathbf { x } _ { t } } ^ { \top } \nabla _ { \mathbf { x } _ { t } } \log p _ { t } ( \mathbf { x } _ { t } )$ under the hood.
|
| 127 |
+
|
| 128 |
+
Given a DDM, that is, given $\epsilon _ { \theta }$ , we could compute the derivative $d _ { \gamma _ { t } } \epsilon _ { \theta }$ for the GENIE scheme in Eq. (9) using automatic differentiation (AD). This would, however, make a single step of GENIE at least twice as costly as DDIM, because we would need a forward pass through the $\epsilon _ { \theta }$ network to compute $\epsilon _ { \theta } ( \mathbf { x } _ { t } , t )$ itself, and another pass to compute the JVPs and the time derivative in Eq. (12). These forward passes cannot be parallelized, since the vector-part of $\mathrm { J V P _ { 1 } }$ in Eq. (12) involves $\epsilon _ { \theta }$ itself, and needs to be known before computing the JVP. To accelerate sampling, this overhead is too expensive.
|
| 129 |
+
|
| 130 |
+
Gradient Distillation: To avoid this overhead, we propose to first distill $d _ { \gamma _ { t } } \epsilon _ { \theta }$ into a separate neural network. During distillation training, we can use the slow AD-based calculation of $d _ { \gamma _ { t } } \epsilon _ { \theta }$ , but during synthesis we call the trained neural network. We build on the observation that the internal representations of the neural network modeling $\epsilon _ { \theta }$ (in our case a U-Net [79] architecture) can be used for downstream tasks [80, 81]: specifically, we provide the last feature layer from the $\epsilon _ { \theta }$ network together with its time embedding as well as $\mathbf { x } _ { t }$ and the output $\epsilon _ { \theta } ( \mathbf { x } _ { t } , t )$ to a small prediction head $k _ { \psi } ( \mathbf { x } _ { t } , t )$ that models the different terms in Eq. (12) (see Fig. 4). The overhead generated by $k _ { \psi }$ is small, for instance less than $2 \%$ for our CIFAR-10 model (also see Sec. 5), and we found this approach to provide excellent performance. Note that in principle we could also train an independent deep neural network, which does not make use of the internal representations of $\epsilon _ { \theta }$ and could therefore theoretically be run in parallel to the $\epsilon _ { \theta }$ model. We justify using small prediction heads over independent neural networks because AD-based distillation training is slow: in each training iteration we first need to call the $\epsilon _ { \theta }$ network, then calculate the JVP terms, and only then can we call the distillation model. By modeling $d _ { \gamma _ { t } } \epsilon _ { \theta }$ via small prediction heads, while reusing the internal representation of the score model, we can make training relatively fast: we only need to train $k _ { \psi }$ for up to 50k iterations. In contrast, training score models from scratch takes roughly an order of magnitude more iterations. We leave training of independent networks to predict $d _ { \gamma _ { t } } \epsilon _ { \theta }$ to future work.
|
| 131 |
+
|
| 132 |
+

|
| 133 |
+
Figure 4: Our distilled model $k _ { \psi }$ that predicts the gradient $d _ { \gamma _ { t } } \epsilon _ { \theta }$ is implemented as a small additional output head on top of the first-order score model $\epsilon _ { \theta }$ . Purple layers are used both in $\epsilon _ { \theta }$ and $k _ { \psi }$ ; green layers are specific for $\epsilon _ { \theta }$ and $k _ { \psi }$ .
|
| 134 |
+
|
| 135 |
+
Mixed Network Parameterization: We found that learning $d _ { \gamma _ { t } } \epsilon _ { \theta }$ directly as single output of a neural network can be challenging. Assuming a single data point distribution $p _ { 0 } ( \mathbf { x } _ { 0 } ) = \delta ( \mathbf { x } _ { 0 } = \mathbf { 0 } )$ , for which we know the diffused score function and all higher-order derivatives analytically, we found that the terms in Eq. (12) all behave very differently within the $t \in [ 0 , 1 ]$ interval (for instance, the prefactor of $\mathrm { J V P _ { 1 } }$ in Eq. (12) approaches 1 as $t 0$ , while $\mathrm { J V P _ { 2 } }$ ’s prefactor vanishes). As outlined in detail in App. C.2.3, this simple single data point assumption implies an effective mixed network parameterization, an approach inspired by the “mixed score parametrizations” in Vahdat et al. [49] and Dockhorn et al. [60]. In particular, we model
|
| 136 |
+
|
| 137 |
+
$$
|
| 138 |
+
k _ { \psi } = - \frac { 1 } { \gamma _ { t } } k _ { \psi } ^ { ( 1 ) } + \frac { \gamma _ { t } } { 1 + \gamma _ { t } ^ { 2 } } k _ { \psi } ^ { ( 2 ) } + \frac { 1 } { \gamma _ { t } ( 1 + \gamma _ { t } ^ { 2 } ) } k _ { \psi } ^ { ( 3 ) } \approx d _ { \gamma _ { t } } \epsilon _ { \theta } ,
|
| 139 |
+
$$
|
| 140 |
+
|
| 141 |
+
where $k _ { \psi } ^ { ( i ) } ( \mathbf { x } _ { t } , t ) , i \in \{ 1 , 2 , 3 \}$ , are different output channels of the neural network (i.e. the additional head on top of the $\epsilon _ { \theta }$ network). The three terms in Eq. (14) exactly correspond to the three terms of Eq. (12), in the same order. We show the superior performance of this parametrization in Sec. 5.3.
|
| 142 |
+
|
| 143 |
+
Learning Objective: Ideally, we would like our model $k _ { \psi }$ to match $d _ { \gamma _ { t } } \epsilon _ { \theta }$ exactly, for all $t \in [ 0 , T ]$ and $\mathbf { x } _ { t }$ in the diffused data distribution, which the generative ODE trajectories traverse. This suggests a simple (weighted) $L _ { 2 }$ -loss, similar to regular score matching losses for DDMs [1, 57]:
|
| 144 |
+
|
| 145 |
+
$$
|
| 146 |
+
\operatorname* { m i n } _ { \psi } \mathbb { E } _ { t \sim \mathcal { U } [ t _ { \mathrm { c u t o f f } } , 1 ] , \mathbf { x } _ { 0 } \sim p ( \mathbf { x } _ { 0 } ) , \epsilon \sim \mathcal { N } ( \mathbf { 0 } , I ) } \left[ g _ { \mathrm { d } } ( t ) \| k _ { \psi } ( \alpha _ { t } \mathbf { x } _ { 0 } + \sigma _ { t } \epsilon , t ) - d _ { \gamma _ { t } } \epsilon _ { \theta } ( \alpha _ { t } \mathbf { x } _ { 0 } + \sigma _ { t } \epsilon , t ) \| _ { 2 } ^ { 2 } \right]
|
| 147 |
+
$$
|
| 148 |
+
|
| 149 |
+
for diffused data points $\alpha _ { t } \mathbf { x } _ { 0 } + \sigma _ { t } \mathbf { \epsilon } \mathbf { \epsilon }$ and $g _ { \mathrm { d } } ( t ) = \gamma _ { t } ^ { 2 }$ to counteract the $1 / \gamma _ { t }$ in the first and third terms of Eq. (14). This leads to a roughly constant loss over different time values $t$ . During training we compute $d _ { \gamma _ { t } } \epsilon _ { \theta }$ via AD; however, at inference time we use the learned prediction head $k _ { \psi }$ to approximate $d _ { \gamma _ { t } } \epsilon _ { \theta }$ . In App. C.2.4, we provide pseudo code for training and sampling with heads $k _ { \psi }$ . Note that our distillation objective is consistent and principled: if $k _ { \psi }$ matches $d _ { \gamma _ { t } } \epsilon _ { \theta }$ exactly, the resulting GENIE algorithm recovers the second TTM exactly (extended discussion in App. B.4).
|
| 150 |
+
|
| 151 |
+
Alternative Learning Approaches: As shown in Eq. (13), GENIE relies on second-order score functions. Recently, Meng et al. [82] directly learnt such higher-order scores with higher-order score matching objectives. Directly applying these techniques has the downside that we would need to explicitly form the higher-order score terms $\nabla _ { \mathbf { x } _ { t } } ^ { \top } \epsilon _ { \theta } ( \mathbf { x } _ { t } , \dot { t } )$ , which are very high-dimensional for data such as images. Low-rank approximations are possible, but potentially insufficient for high performance. In our approach, we are avoiding this complication by directly modeling the lower-dimensional JVPs. We found that the methods from Meng et al. [82] can be modified to provide higher-order score matching objectives for the JVP terms required for GENIE and we briefly explored this (see App. D). However, our distillation approach with AD-based higher-order gradients worked much better. Nevertheless, this is an interesting direction for future research. To the best of our knowledge, GENIE is the first solver for the generative differential equations of DDMs that directly uses higher-order scores (in the form of the distilled JVPs) for generative modeling without finite difference or other approximations.
|
| 152 |
+
|
| 153 |
+
# 4 Related Work
|
| 154 |
+
|
| 155 |
+
Accelerated Sampling from DDMs. Several previous works address the slow sampling of DDMs: One line of work reduces and readjusts the timesteps [3, 64] used in time-discretized DDMs [1, 71]. This can be done systematically by grid search [32] or dynamic programming [83]. Bao et al. [65] speed up sampling by defining a new DDM with optimal reverse variances. DDIM [58], discussed in Sec. 2, was also introduced as a method to accelerate DDM synthesis. Further works leverage modern ODE and SDE solvers for fast synthesis from (continuous-time) DDMs: For instance, higher-order Runge–Kutta methods [57, 84] and adaptive step size SDE solvers [62] have been used. These methods are not optimally suited for the few-step synthesis regime, in which GENIE shines; see also Sec. 5. Most closely related to our work is Liu et al. [63], which simulates the DDIM ODE [58] using a higher-order linear multistep method [77]. As shown in Sec. 3, linear multistep methods can be considered an approximation of the TTMs used in GENIE. Furthermore, Tachibana et al. [61] solve the generative SDE via a higher-order Itô–Taylor method [59] and in contrast to our work, they propose to use an “ideal derivative trick” to approximate higher-order score functions. In App. B.2, we show that applying this ideal derivative approximation to the DDIM ODE does not have any effect: the “ideal derivatives” are zero by construction. Note that in GENIE, we in fact use the DDIM ODE, rather than, for example, the regular Probability Flow ODE [57], as the base ODE for GENIE.
|
| 156 |
+
|
| 157 |
+
Alternatively, sampling from DDMs can also be accelerated via learning: For instance, Watson et al. [66] learn parameters of a generalized family of DDMs by optimizing for perceptual output quality. Luhman and Luhman [68] and Salimans and Ho [69] distill a DDIM sampler into a student model, which enables sampling in as few as a single step. Xiao et al. [67] replace DDMs’ Gaussian samplers with expressive generative adversarial networks, similarly allowing for few-step synthesis. GENIE can also be considered a learning-based approach, as we distill a derivative of the generative ODE into a separate neural network. However, in contrast to the mentioned methods, GENIE still solves the true underlying generative ODE, which has major advantages: for instance, it can still be used easily for classifier-guided sampling [4, 57, 70] and to efficiently encode data into latent space—a prerequisite for likelihood calculation [47, 57] and editing applications [17]. Note that the learnt sampler [66] defines a proper probabilistic generalized DDM; however, it isn’t clear how it relates to the generative SDE or ODE and therefore how compatible the method is with applications such as classifier guidance.
|
| 158 |
+
|
| 159 |
+
Other approaches to accelerate DDM sampling change the diffusion itself [60, 85, 86] or train DDMs in the latent space of a Variational Autoencoder [49]. GENIE is complementary to these methods.
|
| 160 |
+
|
| 161 |
+
Higher-Order ODE Gradients beyond DDMs. TTMs [78] and other methods that leverage higherorder gradients are also applied outside the scope of DDMs. For instance, higher-order derivatives can play a crucial role when developing solvers [87] and regularization techniques [88, 89] for neural ODEs [74, 75]. Outside the field of machine learning, higher-order TTMs have been widely studied, for example, to develop solvers for stiff [90] and non-stiff [90, 91] systems.
|
| 162 |
+
|
| 163 |
+
Concurrent Works. Zhang and Chen [92] motivate the DDIM ODE from an exponential integrator perspective applied to the Probability Flow ODE and propose to apply existing solvers from the numerical ODE literature, namely, Runge–Kutta and linear multistepping, to the DDIM ODE directly. Lu et al. [93] similarly recognize the semi-linear structure of the Probability Flow ODE, derive dedicated solvers, and introduce new step size schedulers to accelerate DDM sampling. Karras et al. [94] propose new fast solvers, both deterministic and stochastic, specifically designed for the differential equations arising in DDMs. Both Zhang et al. [95] and Karras et al. [94] realize that the DDIM ODE has “straight line solution trajectories” for spherical normal data and single data points—this exactly corresponds to our derivation that the higher-order terms in the DDIM ODE are zero in such a setting (see App. B.2). Bao et al. [96] learn covariance matrices for DDM sampling using prediction heads somewhat similar to the ones in GENIE; in App. G.1, we thoroughly discuss the differences between GENIE and the method proposed in Bao et al. [96].
|
| 164 |
+
|
| 165 |
+
# 5 Experiments
|
| 166 |
+
|
| 167 |
+
Datasets: We run experiments on five datasets: CIFAR-10 [97] (resolution 32), LSUN Bedrooms [98] (128), LSUN Church-Outdoor [98] (128), (conditional) ImageNet [99] (64), and AFHQv2 [100] (512). On AFHQv2 we only consider the subset of cats; referred to as “Cats” in the remainder of this work.
|
| 168 |
+
|
| 169 |
+
Architectures: Except for CIFAR-10 (we use a checkpoint by Song et al. [57]), we train our own score models using architectures introduced by previous works [1, 4]. The architecture of our prediction heads is based on (modified) BigGAN residual blocks [57, 101]. To minimize computational overhead, we only use a single residual block. See App. C for training and architecture details.
|
| 170 |
+
|
| 171 |
+
Evaluation: We measure sample quality via Fréchet Inception Distance [FID, 102] (see App. F.1).
|
| 172 |
+
|
| 173 |
+
Synthesis Strategy: We simulate the DDIM ODE from $t { = } 1$ up to $t { = } 1 0 ^ { - 3 }$ using evaluation times following a quadratic function (quadratic striding [58]). For variance-preserving DDMs, it can be beneficial to denoise the ODE solver output at the cutoff $t { = } 1 0 ^ { - 3 }$ , i.e., $\begin{array} { r } { \mathbf { x } _ { 0 } = \frac { \mathbf { x } _ { t } - \sigma _ { t } \epsilon _ { \theta } \left( \mathbf { x } _ { t } , t \right) } { \alpha _ { t } } } \end{array}$ [57, 103]. Note that the denoising step involves a score model evaluation, and therefore “loses” a function evaluation that could otherwise be used as an additional step in the ODE solver. To this end, denoising the output of the ODE solver is left as a hyperparameter of our synthesis strategy.
|
| 174 |
+
|
| 175 |
+
Analytical First Step (AFS): Every additional neural network call becomes crucial in the low number of function evaluations (NFEs) regime. We found that we can improve the performance of GENIE and all other methods evaluated on our checkpoints by replacing the learned score with the (analytical) score of $\mathcal { N } ( \mathbf { 0 } , I ) \approx p _ { t = 1 } ( \mathbf { x } _ { t } )$ in the first step of the ODE solver. The “gained” function evaluation can then be used as an additional step in the ODE solver. Similarly to the denoising step mentioned above, AFS is treated as a hyperparameter of our Synthesis Strategy. AFS details in App. F.2.
|
| 176 |
+
|
| 177 |
+
Accounting for Computational Overhead: GENIE has a slightly increased computational overhead compared to other solvers due to the prediction head $k _ { \psi }$ . The computational overhead is increased by $1 . 4 7 \%$ , $2 . 8 3 \%$ , $1 4 . 0 \%$ , and $1 4 . 4 \%$ on CIFAR-10, ImageNet, LSUN Bedrooms, and LSUN ChurchOutdoor, respectively (see also App. C.2.5). This additional overhead is always accounted for implicitly: we divide the NFEs by the computational overhead and round to the nearest integer. For example, on LSUN Bedrooms, we compare baselines with 10/15 NFEs to GENIE with 9/13 NFEs.
|
| 178 |
+
|
| 179 |
+
# 5.1 Image Generation
|
| 180 |
+
|
| 181 |
+
In Fig. 5 we compare our method to the most competitive baselines. In particular, on the same score model checkpoints, we compare GENIE with DDIM [58], S-PNDM [63], and F-PNDM [63]. For these four methods, we only include the best result over the two hyperparameters discussed above, namely, the denoising step and AFS (see App. F.6 for tables with all results). We also include three competitive results from the literature [64–66] that use different checkpoints and sampling strategies: for each method, we include the best result for their respective set of hyperparameters. We do not compare in this figure with Knowledge Distillation [KD, 68], Progressive Distillation [PG, 69] and Denoising Diffusion GANs [DDGAN, 67] as they do not solve the generative ODE/SDE and use fundamentally different sampling approaches with drawbacks discussed in Sec. 4.
|
| 182 |
+
|
| 183 |
+
For $\mathrm { N F E s } \in \{ 1 0 , 1 5 , 2 0 , 2 5 \}$ , GENIE outperforms all baselines (on the same checkpoint) on all four datasets (see detailed results in App. F.6 and GENIE image samples in App. F.7). On CIFAR-10 and (conditional) ImageNet, GENIE also outperforms these baselines for NFE $\mathord { \mathrm { : } } = 5$ , whereas DDIM outperforms GENIE slightly on the LSUN datasets (see tables in App. F.6). GENIE also performs better than the three additional baselines from the literature (which use different checkpoints and sampling strategies) with the exception of the Learned Sampler [LS, 66] on LSUN Bedrooms for $\mathrm { N F E s } { = } 2 0$ . Though LS uses a learned striding schedule on LSUN Bedrooms (whereas GENIE simply uses quadratic striding), the LS’s advantage is most likely due to the different checkpoint. In Tab. 1, we investigate the effect of optimizing the striding schedule, via learning (LS) or grid search (DDIM & GENIE), on CIFAR-10 and find that its significance decreases rapidly with increased NFEs (also see App. F.6 for details). In Tab. 1, we also show additional baseline results; however, we do not include commonly-used adaptive step size solvers in Fig. 5, as they are arguably not well-suited for this low NFE regime: for example, on the same CIFAR-10 checkpoint we use for GENIE, the adaptive SDE solver introduced in Jolicoeur-Martineau et al. [62] obtains an FID of 82.4 at 48 NFEs. Also on the same checkpoint, the adaptive Runge–Kutta 4(5) [84] method applied to the ProbabilityFlow ODE achieves an FID of 13.1 at 38 NFEs (solver tolerances set to $1 0 ^ { - 2 }$ ).
|
| 184 |
+
|
| 185 |
+

|
| 186 |
+
|
| 187 |
+

|
| 188 |
+
Figure 5: Unconditional performance on four popular benchmark datasets. The first four methods use the same score model checkpoints, whereas the last three methods all use different checkpoints. (†): numbers are taken from literature.
|
| 189 |
+
Table 1: Unconditional CIFAR-10 generative performance (measured in FID). Methods above the middle line use the same score model checkpoint; methods below all use different ones. (†): numbers are taken from literature. (\*): methods either learn an optimal striding schedule (Learned Sampler) or do a small grid search over striding schedules (DDIM & GENIE); also see App. F.6
|
| 190 |
+
|
| 191 |
+
<table><tr><td>Method</td><td>NFEs=5</td><td>NFEs=10</td><td>NFEs=15</td><td>NFEs=20</td><td>NFEs=25</td></tr><tr><td>GENIE(ours) (*)</td><td>11.2</td><td>5.28</td><td>4.49</td><td>3.94</td><td>3.64</td></tr><tr><td>GENIE (ours)</td><td>13.9</td><td>5.97</td><td>4.49</td><td>3.94</td><td>3.67</td></tr><tr><td>DDIM[58] (*)</td><td>27.6</td><td>11.2</td><td>7.35</td><td>5.87</td><td>5.16</td></tr><tr><td>DDIM[58]</td><td>29.7</td><td>11.2</td><td>7.35</td><td>5.87</td><td>5.16</td></tr><tr><td>S-PNDM[63]</td><td>35.9</td><td>10.3</td><td>6.61</td><td>5.20</td><td>4.51</td></tr><tr><td>F-PNDM[63]</td><td>N/A</td><td>N/A</td><td>10.3</td><td>5.96</td><td>4.73</td></tr><tr><td>Euler-Maruyama</td><td>325</td><td>230</td><td>164</td><td>112</td><td>80.3</td></tr><tr><td>FastDDIM [64] (t)</td><td>1</td><td>9.90</td><td>-</td><td>5.05</td><td>-</td></tr><tr><td>Learned Sampler 66] (t/*)</td><td>12.4</td><td>7.86</td><td>5.90</td><td>4.72</td><td>4.25</td></tr><tr><td>Learned Sampler [66] (t)</td><td>14.3</td><td>8.15</td><td>5.94</td><td>4.89</td><td>4.47</td></tr><tr><td>Analytic DDIM [65] (t)</td><td>-</td><td>14.0</td><td>-</td><td>-</td><td>5.71</td></tr><tr><td>CLD-SGM[60]</td><td>334</td><td>306</td><td>236</td><td>162</td><td>106</td></tr><tr><td>VESDE-PC[57]</td><td>461</td><td>461</td><td>461</td><td>461</td><td>462</td></tr></table>
|
| 192 |
+
|
| 193 |
+
The results in Fig. 5 suggest that higher-order gradient information, as used in GENIE, can be efficiently leveraged for image synthesis. Despite using small prediction heads our distillation seems to be sufficiently accurate: for reference, replacing the distillation heads with the derivatives computed via AD, we obtain FIDs of 9.22, 4.11, 3.54, 3.46 using 10, 20, 30, and 40 NFEs, respectively (NFEs adjusted assuming an additional computational overhead of $100 \%$ ). As discussed in Sec. 3, linear multistep methods such as S-PNDM [63] and F-PNDM [63] can be considered (finite difference) approximations to TTMs as used in GENIE. These approximations can be inaccurate for large timesteps, which potentially explains their inferior performance when compared to GENIE. When compared to DDIM, the superior performance of GENIE seems to become less significant for large NFE: this is in line with the theory, as higher-order gradients contribute less for smaller step sizes (see the GENIE scheme in Eq. (9)). Approaches such as FastDDIM [64] and AnalyticDDIM [65], which adapt variances and discretizations of discrete-time DDMs, are useful; however, GENIE suggests that rigorous higher-order ODE solvers leveraging the continuous-time DDM formalism are still more powerful. To the best of our knowledge, the only methods that outperform GENIE abandon this ODE or SDE formulation entirely and train NFE-specific models [67, 69] which are optimized for the single use-case of image synthesis.
|
| 194 |
+
|
| 195 |
+
# 5.2 Guidance and Encoding
|
| 196 |
+
|
| 197 |
+
As discussed in Sec. 4, one major drawback of approaches such as KD [68], PG [69] and DDGAN [67] is that they abandon the ODE/SDE formalism, and cannot easily use methods such as classifier(-free) guidance [57, 70] or perform image encoding. However, these techniques can play an important role in synthesizing photorealistic images from DDMs [3, 4, 15, 17], as well as for image editing tasks [12, 17].
|
| 198 |
+
|
| 199 |
+
Classifier-Free Guidance [70]: We replace the unconditional model $\epsilon _ { \theta } ( \mathbf { x } _ { t } , t )$ with $\hat { \epsilon } _ { \theta } ( \mathbf { x } _ { t } , t , c , w ) = ( 1 + w ) \epsilon _ { \theta } ( \mathbf { x } _ { t } , t , c ) -$ $w \epsilon _ { \theta } ( \mathbf { x } _ { t } , t )$ in the DDIM ODE (cf Eq. (6)), where $\epsilon _ { \theta } ( \mathbf { x } _ { t } , t , c )$ is a conditional model and $w > 1 . 0$ is the “guidance scale”. GENIE then requires the derivative
|
| 200 |
+
|
| 201 |
+

|
| 202 |
+
Figure 6: Sample quality as a function of guidance scale on ImageNet.
|
| 203 |
+
|
| 204 |
+

|
| 205 |
+
Figure 8: Encoding and subsequent decoding on LSUN Church-Outdoor. Left: Visual reconstruction. Right: $L _ { 2 }$ -distance to reference in Inception feature space [104], averaged over 100 images.
|
| 206 |
+
|
| 207 |
+
$$
|
| 208 |
+
\begin{array} { r } { d _ { \gamma _ { t } } \hat { \epsilon } _ { \theta } ( \mathbf { x } _ { t } , t , c , w ) = ( 1 + w ) d _ { \gamma _ { t } } \epsilon _ { \theta } ( \mathbf { x } _ { t } , t , c ) - w d _ { \gamma _ { t } } \epsilon _ { \theta } ( \mathbf { x } _ { t } , t ) . } \end{array}
|
| 209 |
+
$$
|
| 210 |
+
|
| 211 |
+
for guidance. Hence, we need to distill $d _ { \gamma _ { t } } \mathbf { \epsilon } _ { \theta } ( \mathbf { x } _ { t } , t , c )$ and $d _ { \gamma _ { t } } \mathbf { \epsilon } _ { \theta } ( \mathbf { x } _ { t } , t )$ , for which we could also share parameters [70]. We compare GENIE with DDIM on ImageNet in Fig. 6. GENIE clearly outperforms DDIM, in particular for few NFEs, and GENIE also synthesizes high-quality images (see Fig. 7).
|
| 212 |
+
|
| 213 |
+
Image Encoding: We can use GENIE also to solve the generative ODE in reverse to encode given images. Therefore, we compare GENIE to DDIM on the “encode-decode” task, analyzing reconstructions for different NFEs (used twice for encoding and decoding): We find that GENIE reconstructs images much more accurately (see Fig. 8). For more details on this experiment as well as the guidance experiment above, see App. F.4 and App. F.3, respectively. We also show latent space interpolations for both GENIE and DDIM in App. F.5.
|
| 214 |
+
|
| 215 |
+
# 5.3 Ablation Studies
|
| 216 |
+
|
| 217 |
+
Table 2: CIFAR-10 ablation studies (measured in FID).
|
| 218 |
+
|
| 219 |
+
<table><tr><td>Ablation</td><td>NFEs=5</td><td>NFEs=10</td><td>NFEs=15</td><td>NFEs=20</td><td>NFEs=25</td></tr><tr><td>Standard</td><td>13.9</td><td>6.04</td><td>4.49</td><td>3.94</td><td>3.67</td></tr><tr><td>No mixed</td><td>14.7</td><td>6.32</td><td>4.82</td><td>4.31</td><td>4.10</td></tr><tr><td>No weighting</td><td>14.8</td><td>7.45</td><td>5.89</td><td>5.17</td><td>4.80</td></tr><tr><td>Bigger model</td><td>13.7</td><td>5.58</td><td>4.46</td><td>4.05</td><td>3.77</td></tr></table>
|
| 220 |
+
|
| 221 |
+
We perform ablation studies over architecture and training objective for the prediction heads used in GENIE: In Tab. 2, “No mixed” refers to learning $d _ { \gamma _ { t } } \epsilon _ { \theta }$ directly as single network output without mixed network
|
| 222 |
+
|
| 223 |
+
parameterization; “No weighting” refers to setting $g _ { \mathrm { d } } ( t ) = 1$ in Eq. (15); “Standard” uses both the mixed network parameterization and the weighting function $g _ { \mathrm { d } } ( t ) \stackrel { \cdot } { = } \gamma _ { t } ^ { 2 }$ . We can see that having both the mixed network parametrization and the weighting function is clearly beneficial. We also tested deeper networks in the prediction heads: for “Bigger model” we increased the number of residual blocks from one to two. The performance is roughly on par with “Standard”, and we therefore opted for the smaller head due to the lower computational overhead.
|
| 224 |
+
|
| 225 |
+
# 5.4 Upsampling
|
| 226 |
+
|
| 227 |
+
Table 3: Cats (upsampler) generative performance (measured in FID).
|
| 228 |
+
|
| 229 |
+
<table><tr><td>Method</td><td>NFEs=5</td><td>NFEs=10</td><td>NFEs=15</td></tr><tr><td>GENIE (ours)</td><td>5.53</td><td>4.90</td><td>4.83</td></tr><tr><td>DDIM [58]</td><td>9.47</td><td>6.64</td><td>5.85</td></tr><tr><td>S-PNDM[63]</td><td>14.6</td><td>11.0</td><td>8.83</td></tr><tr><td>F-PNDM [[63]</td><td>N/A</td><td>N/A</td><td>11.7</td></tr></table>
|
| 230 |
+
|
| 231 |
+
Cascaded diffusion model pipelines [2] and DDM-based super-resolution [8] have become crucial ingredients in DDMs for large-scale image generation [105]. Hence, we also explore the applicability of GENIE in this setting. We train a $1 2 8 \times 1 2 8$ base model as well as a $1 2 8 \times 1 2 8 \to 5 1 2 \times 5 1 2$ diffusion upsampler [2, 8] on
|
| 232 |
+
|
| 233 |
+
Cats. In Tab. 3, we compare the generative performance of GENIE to other fast samplers for the upsampler (in isolation). We find that GENIE performs very well on this task: with only five NFEs GENIE outperforms all other methods at $\mathrm { N F E s } { = } 1 5$ . We show upsampled samples for GENIE with $\mathrm { N F E s } { = } 5$ in Fig. 9. For more quantitative and qualitative results, we refer to App. F.6 and App. F.7, respectively. Training and inference details for the score model and the GENIE prediction head, for both base model and upsampler, can be found in App. C.
|
| 234 |
+
|
| 235 |
+

|
| 236 |
+
Figure 9: High-resolution images generated with the $1 2 8 \times 1 2 8 \to 5 1 2 \times 5 1 2$ GENIE upsampler using only five neural network calls. For the two images at the top, the upsampler is conditioned on test images from the Cats dataset. For the two images at the bottom, the upsampler is conditioned on samples from the $1 2 8 \times 1 2 8$ GENIE base model (generated using 25 NFEs); an upsampler neural network evaluation is roughly four times as expensive as a base model evaluation.
|
| 237 |
+
|
| 238 |
+
# 6 Conclusions
|
| 239 |
+
|
| 240 |
+
We introduced GENIE, a higher-order ODE solver for DDMs. GENIE improves upon the commonly used DDIM solver by capturing the local curvature of its ODE’s gradient field, which allows for larger step sizes when solving the ODE. We further propose to distill the required higher-order derivatives into a small prediction head—which we can efficiently call during inference—on top of the first-order score network. A limitation of GENIE is that it is still slightly slower than approaches that abandon the differential equation framework of DDMs altogether, which, however, comes at the considerable cost of preventing applications such as guided sampling. To overcome this limitation, future work could leverage even higher-order gradients to accelerate sampling from DDMs even further (also see App. G.2).
|
| 241 |
+
|
| 242 |
+
Broader Impact. Fast synthesis from DDMs, the goal of GENIE, can potentially make DDMs an attractive method for promising interactive generative modeling applications, such as digital content creation or real-time audio synthesis, and also reduce DDMs’ environmental footprint by decreasing the computational load during inference. Although we validate GENIE on image synthesis, it could also be utilized for other tasks, which makes its broader societal impact application-dependent. In that context, it is important that practitioners apply an abundance of caution to mitigate impacts given generative modeling can also be used for malicious purposes, discussed for instance in Vaccari and Chadwick [106], Nguyen et al. [107], Mirsky and Lee [108].
|
| 243 |
+
|
| 244 |
+
# Acknowledgements
|
| 245 |
+
|
| 246 |
+
This work was funded by NVIDIA. Tim Dockhorn acknowledges additional funding from the Vector Institute Research Grant, not in direct support of this work. We thank Yaoliang Yu for discussions.
|
| 247 |
+
|
| 248 |
+
# References
|
| 249 |
+
|
| 250 |
+
[1] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising Diffusion Probabilistic Models. In Advances in Neural Information Processing Systems, 2020.
|
| 251 |
+
[2] Jonathan Ho, Chitwan Saharia, William Chan, David J Fleet, Mohammad Norouzi, and Tim Salimans. Cascaded Diffusion Models for High Fidelity Image Generation. arXiv:2106.15282, 2021. [3] Alexander Quinn Nichol and Prafulla Dhariwal. Improved Denoising Diffusion Probabilistic Models. In International Conference on Machine Learning, 2021.
|
| 252 |
+
[4] Prafulla Dhariwal and Alex Nichol. Diffusion Models Beat GANs on Image Synthesis. In Neural Information Processing Systems, 2021. [5] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-Resolution Image Synthesis with Latent Diffusion Models. arXiv:2112.10752, 2021.
|
| 253 |
+
[6] Ruihan Yang, Prakhar Srivastava, and Stephan Mandt. Diffusion Probabilistic Modeling for Video Generation. arXiv:2203.09481, 2022.
|
| 254 |
+
[7] Jonathan Ho, Tim Salimans, Alexey Gritsenko, William Chan, Mohammad Norouzi, and David J. Fleet. Video Diffusion Models. arXiv:2204.03458, 2022.
|
| 255 |
+
[8] Chitwan Saharia, Jonathan Ho, William Chan, Tim Salimans, David J Fleet, and Mohammad Norouzi. Image Super-Resolution via Iterative Refinement. arXiv:2104.07636, 2021. [9] 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:2104.14951, 2021.
|
| 256 |
+
[10] Jay Whang, Mauricio Delbracio, Hossein Talebi, Chitwan Saharia, Alexandros G. Dimakis, and Peyman Milanfar. Deblurring via Stochastic Refinement. arXiv:2112.02475, 2021.
|
| 257 |
+
[11] Bahjat Kawar, Michael Elad, Stefano Ermon, and Jiaming Song. Denoising Diffusion Restoration Models. arXiv:2201.11793, 2022.
|
| 258 |
+
[12] Chenlin Meng, Yang Song, Jiaming Song, Jiajun Wu, Jun-Yan Zhu, and Stefano Ermon. SDEdit: Image Synthesis and Editing with Stochastic Differential Equations. arXiv:2108.01073, 2021.
|
| 259 |
+
[13] Andreas Lugmayr, Martin Danelljan, Andres Romero, Fisher Yu, Radu Timofte, and Luc Van Gool. RePaint: Inpainting using Denoising Diffusion Probabilistic Models. arXiv:2201.09865, 2022.
|
| 260 |
+
[14] 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:2111.05826, 2021.
|
| 261 |
+
[15] 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 TextGuided Diffusion Models. arXiv:2112.10741, 2021.
|
| 262 |
+
[16] Omri Avrahami, Dani Lischinski, and Ohad Fried. lended Diffusion for Text-driven Editing of Natural Images. arXiv:2111.14818, 2021.
|
| 263 |
+
[17] Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical TextConditional Image Generation with CLIP Latents. arXiv:2204.06125, 2022.
|
| 264 |
+
[18] Jooyoung Choi, Sungwon Kim, Yonghyun Jeong, Youngjune Gwon, and Sungroh Yoon. ILVR: Conditioning Method for Denoising Diffusion Probabilistic Models. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), 2021.
|
| 265 |
+
[19] Kushagra Pandey, Avideep Mukherjee, Piyush Rai, and Abhishek Kumar. DiffuseVAE: Efficient, Controllable and High-Fidelity Generation from Low-Dimensional Latents. arXiv:2201.00308, 2022.
|
| 266 |
+
[20] Konpat Preechakul, Nattanat Chatthee, Suttisak Wizadwongsa, and Supasorn Suwajanakorn. Diffusion Autoencoders: Toward a Meaningful and Decodable Representation. arXiv:2111.15640, 2021.
|
| 267 |
+
[21] Xihui Liu, Dong Huk Park, Samaneh Azadi, Gong Zhang, Arman Chopikyan, Yuxiao Hu, Humphrey Shi, Anna Rohrbach, and Trevor Darrell. More Control for Free! Image Synthesis with Semantic Diffusion Guidance. arXiv:2112.05744, 2021.
|
| 268 |
+
[22] Georgios Batzolis, Jan Stanczuk, Carola-Bibiane Schönlieb, and Christian Etmann. Conditional Image Generation with Score-Based Diffusion Models. arXiv:2111.13606, 2021.
|
| 269 |
+
[23] Hiroshi Sasaki, Chris G. Willcocks, and Toby P. Breckon. UNIT-DDPM: UNpaired Image Translation with Denoising Diffusion Probabilistic Models. arXiv:2104.05358, 2021.
|
| 270 |
+
[24] Xuan Su, Jiaming Song, Chenlin Meng, and Stefano Ermon. Dual Diffusion Implicit Bridges for Image-to-Image Translation. arXiv:2203.08382, 2022.
|
| 271 |
+
[25] Yang Song, Liyue Shen, Lei Xing, and Stefano Ermon. Solving Inverse Problems in Medical Imaging with Score-Based Generative Models. In International Conference on Learning Representations, 2022.
|
| 272 |
+
[26] Cheng Peng, Pengfei Guo, S. Kevin Zhou, Vishal Patel, and Rama Chellappa. Towards performant and reliable undersampled MR reconstruction via diffusion model sampling. arXiv:2203.04292, 2022.
|
| 273 |
+
[27] Yutong Xie and Quanzheng Li. Measurement-conditioned Denoising Diffusion Probabilistic Model for Under-sampled Medical Image Reconstruction. arXiv:2203.03623, 2022.
|
| 274 |
+
[28] Guanxiong Luo, Martin Heide, and Martin Uecker. MRI Reconstruction via Data Driven Markov Chain with Joint Uncertainty Estimation. arXiv:2202.01479, 2022.
|
| 275 |
+
[29] Hyungjin Chung and Jong Chul Ye. Score-based diffusion models for accelerated MRI. arXiv:2110.05243, 2021.
|
| 276 |
+
[30] Dewei Hu, Yuankai K. Tao, and Ipek Oguz. Unsupervised Denoising of Retinal OCT with Diffusion Probabilistic Model. arXiv:2201.11760, 2022.
|
| 277 |
+
[31] Hyungjin Chung, Byeongsu Sim, and Jong Chul Ye. Come-Closer-Diffuse-Faster: Accelerating Conditional Diffusion Models for Inverse Problems through Stochastic Contraction. arXiv:2112.05146, 2021.
|
| 278 |
+
[32] Nanxin Chen, Yu Zhang, Heiga Zen, Ron J Weiss, Mohammad Norouzi, and William Chan. WaveGrad: Estimating Gradients for Waveform Generation. In International Conference on Learning Representations, 2021.
|
| 279 |
+
[33] Zhifeng Kong, Wei Ping, Jiaji Huang, Kexin Zhao, and Bryan Catanzaro. DiffWave: A Versatile Diffusion Model for Audio Synthesis. In International Conference on Learning Representations, 2021.
|
| 280 |
+
[34] Myeonghun Jeong, Hyeongju Kim, Sung Jun Cheon, Byoung Jin Choi, and Nam Soo Kim. Diff-TTS: A Denoising Diffusion Model for Text-to-Speech. arXiv preprint arXiv:2104.01409, 2021.
|
| 281 |
+
[35] Nanxin Chen, Yu Zhang, Heiga Zen, Ron J. Weiss, Mohammad Norouzi, Najim Dehak, and William Chan. WaveGrad 2: Iterative Refinement for Text-to-Speech Synthesis. arXiv:2106.09660, 2021.
|
| 282 |
+
[36] Vadim Popov, Ivan Vovk, Vladimir Gogoryan, Tasnima Sadekova, and Mikhail Kudinov. Grad-TTS: A Diffusion Probabilistic Model for Text-to-Speech. In International Conference on Machine Learning, 2021.
|
| 283 |
+
[37] Songxiang Liu, Dan Su, and Dong Yu. DiffGAN-TTS: High-Fidelity and Efficient Text-to-Speech with Denoising Diffusion GANs. arXiv:2201.11972, 2022.
|
| 284 |
+
[38] Shitong Luo and Wei Hu. Diffusion Probabilistic Models for 3D Point Cloud Generation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
|
| 285 |
+
[39] Ruojin Cai, Guandao Yang, Hadar Averbuch-Elor, Zekun Hao, Serge Belongie, Noah Snavely, and Bharath Hariharan. Learning Gradient Fields for Shape Generation. In Proceedings of the European Conference on Computer Vision (ECCV), 2020.
|
| 286 |
+
[40] Linqi Zhou, Yilun Du, and Jiajun Wu. 3D Shape Generation and Completion through Point-Voxel Diffusion. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), 2021.
|
| 287 |
+
[41] Zhaoyang Lyu, Zhifeng Kong, Xudong XU, Liang Pan, and Dahua Lin. A Conditional Point DiffusionRefinement Paradigm for 3D Point Cloud Completion. In International Conference on Learning Representations, 2022.
|
| 288 |
+
[42] Emilien Dupont, Hyunjik Kim, S. M. Ali Eslami, Danilo Rezende, and Dan Rosenbaum. From data to functa: Your data point is a function and you should treat it like one. arXiv:2201.12204, 2022.
|
| 289 |
+
[43] Chence Shi, Shitong Luo, Minkai Xu, and Jian Tang. Learning gradient fields for molecular conformation generation. In International Conference on Machine Learning, 2021.
|
| 290 |
+
[44] 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.
|
| 291 |
+
[45] Tian Xie, Xiang Fu, Octavian-Eugen Ganea, Regina Barzilay, and Tommi S. Jaakkola. Crystal Diffusion Variational Autoencoder for Periodic Material Generation. In International Conference on Learning Representations, 2022.
|
| 292 |
+
[46] Jaehyeong Jo, Seul Lee, and Sung Ju Hwang. Score-based Generative Modeling of Graphs via the System of Stochastic Differential Equations. arXiv:2202.02514, 2022.
|
| 293 |
+
[47] Yang Song, Conor Durkan, Iain Murray, and Stefano Ermon. Maximum Likelihood Training of ScoreBased Diffusion Models. In Neural Information Processing Systems (NeurIPS), 2021.
|
| 294 |
+
[48] Diederik P Kingma, Tim Salimans, Ben Poole, and Jonathan Ho. Variational Diffusion Models. In Advances in Neural Information Processing Systems, 2021.
|
| 295 |
+
[49] Arash Vahdat, Karsten Kreis, and Jan Kautz. Score-based Generative Modeling in Latent Space. In Neural Information Processing Systems (NeurIPS), 2021.
|
| 296 |
+
[50] Chin-Wei Huang, Jae Hyun Lim, and Aaron Courville. A Variational Perspective on Diffusion-Based Generative Models and Score Matching. In Neural Information Processing Systems (NeurIPS), 2021.
|
| 297 |
+
[51] 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, 2020.
|
| 298 |
+
[52] Jongmin Yoon, Sung Ju Hwang, and Juho Lee. Adversarial Purification with Score-based Generative Models. In International Conference on Machine Learning, 2021.
|
| 299 |
+
[53] Yusuke Tashiro, Jiaming Song, Yang Song, and Stefano Ermon. CSDI: Conditional Score-based Diffusion Models for Probabilistic Time Series Imputation. In Advances in Neural Information Processing Systems, 2021.
|
| 300 |
+
[54] Valentin De Bortoli, Emile Mathieu, Michael Hutchinson, James Thornton, Yee Whye Teh, and Arnaud Doucet. Riemannian Score-Based Generative Modeling. arXiv:2202.02763, 2022.
|
| 301 |
+
[55] Pedro Sanchez and Sotirios A. Tsaftaris. Diffusion Causal Models for Counterfactual Estimation. In First Conference on Causal Learning and Reasoning, 2022.
|
| 302 |
+
[56] Weili Nie, Brandon Guo, Yujia Huang, Chaowei Xiao, Arash Vahdat, and Anima Anandkumar. Diffusion Models for Adversarial Purification. In International Conference on Machine Learning (ICML), 2022.
|
| 303 |
+
[57] Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-Based Generative Modeling through Stochastic Differential Equations. In International Conference on Learning Representations, 2021.
|
| 304 |
+
[58] Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising Diffusion Implicit Models. In International Conference on Learning Representations, 2021.
|
| 305 |
+
[59] Peter E. Kloeden and Eckhard Platen. Numerical Solution of Stochastic Differential Equations. Springer, Berlin, 1992.
|
| 306 |
+
[60] Tim Dockhorn, Arash Vahdat, and Karsten Kreis. Score-Based Generative Modeling with CriticallyDamped Langevin Diffusion. In International Conference on Learning Representations, 2022.
|
| 307 |
+
[61] Hideyuki Tachibana, Mocho Go, Muneyoshi Inahara, Yotaro Katayama, and Yotaro Watanabe. Itô- Taylor Sampling Scheme for Denoising Diffusion Probabilistic Models using Ideal Derivatives. arXiv:2112.13339, 2021.
|
| 308 |
+
[62] 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:2105.14080, 2021.
|
| 309 |
+
[63] Luping Liu, Yi Ren, Zhijie Lin, and Zhou Zhao. Pseudo Numerical Methods for Diffusion Models on Manifolds. In International Conference on Learning Representations, 2022.
|
| 310 |
+
[64] Zhifeng Kong and Wei Ping. On Fast Sampling of Diffusion Probabilistic Models. arXiv:2106.00132, 2021.
|
| 311 |
+
[65] Fan Bao, Chongxuan Li, Jun Zhu, and Bo Zhang. Analytic-DPM: an Analytic Estimate of the Optimal Reverse Variance in Diffusion Probabilistic Models. In International Conference on Learning Representations, 2022.
|
| 312 |
+
[66] Daniel Watson, William Chan, Jonathan Ho, and Mohammad Norouzi. Learning Fast Samplers for Diffusion Models by Differentiating Through Sample Quality. In International Conference on Learning Representations, 2022.
|
| 313 |
+
[67] Zhisheng Xiao, Karsten Kreis, and Arash Vahdat. Tackling the Generative Learning Trilemma with Denoising Diffusion GANs. In International Conference on Learning Representations, 2022.
|
| 314 |
+
[68] Eric Luhman and Troy Luhman. Knowledge Distillation in Iterative Generative Models for Improved Sampling Speed. arXiv:2101.02388, 2021.
|
| 315 |
+
[69] Tim Salimans and Jonathan Ho. Progressive Distillation for Fast Sampling of Diffusion Models. In International Conference on Learning Representations, 2022.
|
| 316 |
+
[70] Jonathan Ho and Tim Salimans. Classifier-Free Diffusion Guidance. In NeurIPS 2021 Workshop on Deep Generative Models and Downstream Applications, 2021.
|
| 317 |
+
[71] Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep Unsupervised Learning using Nonequilibrium Thermodynamics. In International Conference on Machine Learning, 2015.
|
| 318 |
+
[72] Brian DO Anderson. Reverse-time diffusion equation models. Stochastic Processes and their Applications, 12(3):313–326, 1982.
|
| 319 |
+
[73] Ulrich G Haussmann and Etienne Pardoux. Time Reversal of Diffusions. The Annals of Probability, pages 1188–1205, 1986.
|
| 320 |
+
[74] Ricky T. Q. Chen, Yulia Rubanova, Jesse Bettencourt, and David Duvenaud. Neural Ordinary Differential Equations. Advances in Neural Information Processing Systems, 2018.
|
| 321 |
+
[75] Will Grathwohl, Ricky T. Q. Chen, Jesse Bettencourt, Ilya Sutskever, and David Duvenaud. FFJORD: Free-form Continuous Dynamics for Scalable Reversible Generative Models. International Conference on Learning Representations, 2019.
|
| 322 |
+
[76] Pascal Vincent. A Connection Between Score Matching and Denoising Autoencoders. Neural Computation, 23(7):1661–1674, 2011.
|
| 323 |
+
[77] John Charles Butcher. Numerical Methods for Ordinary Differential Equations. John Wiley & Sons, 2016.
|
| 324 |
+
[78] Peter E Kloeden and Eckhard Platen. Numerical Solution of Stochastic Differential Equations. Springer, 1992.
|
| 325 |
+
[79] 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.
|
| 326 |
+
[80] Jooyoung Choi, Jungbeom Lee, Chaehun Shin, Sungwon Kim, Hyunwoo Kim, and Sungroh Yoon. Perception Prioritized Training of Diffusion Models. arXiv:2204.00227, 2022.
|
| 327 |
+
[81] Dmitry Baranchuk, Andrey Voynov, Ivan Rubachev, Valentin Khrulkov, and Artem Babenko. LabelEfficient Semantic Segmentation with Diffusion Models. In International Conference on Learning Representations, 2022.
|
| 328 |
+
[82] Chenlin Meng, Yang Song, Wenzhe Li, and Stefano Ermon. Estimating High Order Gradients of the Data Distribution by Denoising. Advances in Neural Information Processing Systems, 34, 2021.
|
| 329 |
+
[83] Daniel Watson, Jonathan Ho, Mohammad Norouzi, and William Chan. Learning to Efficiently Sample from Diffusion Probabilistic Models. arXiv:2106.03802, 2021.
|
| 330 |
+
[84] J. R. Dormand and P. J. Prince. A family of embedded Runge–Kutta formulae. Journal of Computational and Applied Mathematics, 6(1):19–26, 1980.
|
| 331 |
+
[85] Eliya Nachmani, Robin San Roman, and Lior Wolf. Non Gaussian Denoising Diffusion Models. arXiv:2106.07582, 2021. [86] Max WY Lam, Jun Wang, Rongjie Huang, Dan Su, and Dong Yu. Bilateral Denoising Diffusion Models. arXiv:2108.11514, 2021.
|
| 332 |
+
[87] Franck Djeumou, Cyrus Neary, Eric Goubault, Sylvie Putot, and Ufuk Topcu. Taylor-Lagrange Neural Ordinary Differential Equations: Toward Fast Training and Evaluation of Neural ODEs. arXiv:2201.05715, 2022. [88] Jacob Kelly, Jesse Bettencourt, Matthew J Johnson, and David K Duvenaud. Learning differential equations that are easy to solve. Advances in Neural Information Processing Systems, 33:4370–4380, 2020. [89] Chris Finlay, Jörn-Henrik Jacobsen, Levon Nurbekyan, and Adam Oberman. How to train your neural ODE: the world of Jacobian and kinetic regularization. In International conference on machine learning, pages 3154–3164. PMLR, 2020. [90] YF Chang and George Corliss. ATOMFT: solving ODEs and DAEs using Taylor series. Computers & Mathematics with Applications, 28(10-12):209–233, 1994. [91] George Corliss and YF Chang. Solving ordinary differential equations using Taylor series. ACM Transactions on Mathematical Software (TOMS), 8(2):114–144, 1982. [92] Qinsheng Zhang and Yongxin Chen. Fast Sampling of Diffusion Models with Exponential Integrator. arXiv:2204.13902, 2022. [93] Cheng Lu, Yuhao Zhou, Fan Bao, Jianfei Chen, Chongxuan Li, and Jun Zhu. DPM-Solver: A Fast ODE Solver for Diffusion Probabilistic Model Sampling in Around 10 Steps. arXiv:2206.00927, 2022. [94] Tero Karras, Miika Aittala, Timo Aila, and Samuli Laine. Elucidating the Design Space of DiffusionBased Generative Models. arXiv:2206.00364, 2022. [95] Qinsheng Zhang, Molei Tao, and Yongxin Chen. gDDIM: Generalized denoising diffusion implicit models. arXiv:2206.05564, 2022. [96] Fan Bao, Chongxuan Li, Jiacheng Sun, Jun Zhu, and Bo Zhang. Estimating the Optimal Covariance with Imperfect Mean in Diffusion Probabilistic Models. arXiv:2206.07309, 2022. [97] Alex Krizhevsky. Learning Multiple Layers of Features from Tiny Images. Technical report, University of Toronto, 2009.
|
| 333 |
+
[98] Fisher Yu, Ari Seff, Yinda Zhang, Shuran Song, Thomas Funkhouser, and Jianxiong Xiao. LSUN: Construction of a Large-scale Image Dataset using Deep Learning with Humans in the Loop. arXiv preprint arXiv:1506.03365, 2015. [99] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. ImageNet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pages 248–255. Ieee, 2009.
|
| 334 |
+
[100] Yunjey Choi, Youngjung Uh, Jaejun Yoo, and Jung-Woo Ha. StarGAN v2: Diverse Image Synthesis for Multiple Domains. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8188–8197, 2020.
|
| 335 |
+
[101] Andrew Brock, Jeff Donahue, and Karen Simonyan. Large Scale GAN Training for High Fidelity Natural Image Synthesis. In International Conference on Learning Representations, 2019.
|
| 336 |
+
[102] 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 I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017.
|
| 337 |
+
[103] Alexia Jolicoeur-Martineau, Rémi Piché-Taillefer, Ioannis Mitliagkas, and Remi Tachet des Combes. Adversarial score matching and improved sampling for image generation. In International Conference on Learning Representations, 2021.
|
| 338 |
+
[104] 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, pages 2818–2826, 2016.
|
| 339 |
+
[105] 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:2205.11487, 2022.
|
| 340 |
+
[106] Cristian Vaccari and Andrew Chadwick. Deepfakes and Disinformation: Exploring the Impact of Synthetic Political Video on Deception, Uncertainty, and Trust in News. Social Media $^ +$ Society, 6(1): 2056305120903408, 2020.
|
| 341 |
+
[107] Thanh Thi Nguyen, Quoc Viet Hung Nguyen, Cuong M. Nguyen, Dung Nguyen, Duc Thanh Nguyen, and Saeid Nahavandi. Deep Learning for Deepfakes Creation and Detection: A Survey. arXiv:1909.11573, 2021.
|
| 342 |
+
[108] Yisroel Mirsky and Wenke Lee. The Creation and Detection of Deepfakes: A Survey. ACM Comput. Surv., 54(1), 2021.
|
| 343 |
+
[109] Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral Normalization for Generative Adversarial Networks. In International Conference on Learning Representations (ICLR), 2018.
|
| 344 |
+
[110] Diederik P Kingma and Jimmy Ba. Adam: A Method for Stochastic Optimization. In International Conference on Learning Representations, 2015.
|
| 345 |
+
[111] Mehdi SM Sajjadi, Olivier Bachem, Mario Lucic, Olivier Bousquet, and Sylvain Gelly. Assessing Generative Models via Precision and Recall. Advances in Neural Information Processing Systems, 31, 2018.
|
| 346 |
+
[112] Tuomas Kynkäänniemi, Tero Karras, Samuli Laine, Jaakko Lehtinen, and Timo Aila. Improved Precision and Recall Metric for Assessing Generative Models. Advances in Neural Information Processing Systems, 32, 2019.
|
| 347 |
+
|
| 348 |
+
# Checklist
|
| 349 |
+
|
| 350 |
+
1. For all authors...
|
| 351 |
+
|
| 352 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 353 |
+
(b) Did you describe the limitations of your work? [Yes] See Sec. 6.
|
| 354 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Sec. 6.
|
| 355 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 356 |
+
|
| 357 |
+
2. If you are including theoretical results...
|
| 358 |
+
|
| 359 |
+
(a) Did you state the full set of assumptions of all theoretical results? [N/A] We did not derive novel theoretical results. We rather propose a novel higher-order solver for sampling from denoising diffusion generative models.
|
| 360 |
+
(b) Did you include complete proofs of all theoretical results? [N/A]
|
| 361 |
+
|
| 362 |
+
3. If you ran experiments...
|
| 363 |
+
|
| 364 |
+
(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 provide code and instructions to reproduce all experiments in the near future.
|
| 365 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] We provide all model training and evaluation details in the Appendix, including all hyperparameters.
|
| 366 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] Following standard conventions in the related generative modeling literature, we do not report error bars. Furthermore, we avoid running similar setups repeatedly to save computational resources.
|
| 367 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] Please see App. F.8.
|
| 368 |
+
|
| 369 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 370 |
+
|
| 371 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes] On CIFAR10, we use a checkpoint provided by Song et al. [57]. For baseline comparisons, we run publicly available code: in particular, we make use of the repositories https://github.com/yang-song/score_sde_pytorch and https://github. com/nv-tlabs/CLD-SGM from previous, publicly available papers, which we cite (Song et al. [57] and Dockhorn et al. [60], respectively). We also cite all used datasets: CIFAR-10 [97], LSUN Bedrooms [98], LSUN Church-Outdoor [98], ImageNet [99], and AFHQv2 [100].
|
| 372 |
+
(b) Did you mention the license of the assets? [Yes] In the Appendix, we mention the licenses of all codes we are running for baseline comparisons and evaluation. See App. F.1.
|
| 373 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [No]
|
| 374 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 375 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] We are only using publicly available datasets, which have been widely used in the generative modeling literature as standard benchmarks (CIFAR-10, ImageNet, LSUN Church-Outdoor, LSUN Bedrooms, AFHQv2) and avoid using face image datasets.
|
| 376 |
+
|
| 377 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 378 |
+
|
| 379 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 380 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 381 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/LPB2BFZvncQ/LPB2BFZvncQ.md
ADDED
|
@@ -0,0 +1,827 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# An Information-theoretic Perspective of Hierarchical Clustering
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 A combinatorial cost function for hierarchical clustering was introduced by Das
|
| 11 |
+
2 gupta [10]. It has received great attention and several new cost functions from sim
|
| 12 |
+
3 ilar combinatorial perspective have been proposed. In this paper, we investigate
|
| 13 |
+
4 hierarchical clustering from the information-theoretic perspective and formulate
|
| 14 |
+
5 a new objective function. We also establish the relationship between these two
|
| 15 |
+
6 perspectives. In algorithmic aspect, we present two algorithms for expander-like
|
| 16 |
+
7 and well-clustered cardinality weighted graphs, respectively, and show that both
|
| 17 |
+
8 of them achieve $O ( 1 )$ -approximation for our new objective function. For practi
|
| 18 |
+
9 cal use, we consider non-binary hierarchical clustering problem. We get rid of
|
| 19 |
+
10 the traditional top-down and bottom-up frameworks, and present a new one. Our
|
| 20 |
+
11 new framework stratifies the sparsest level of a cluster tree recursively in guide
|
| 21 |
+
12 with our objective function. Our algorithm called HCSE outputs a $k$ -level cluster
|
| 22 |
+
13 tree by an interpretable mechanism to choose $k$ automatically without any hyper
|
| 23 |
+
14 parameter. Our experimental results on synthetic datasets show that HCSE has
|
| 24 |
+
15 its own superiority in finding the intrinsic number of hierarchies, and the results
|
| 25 |
+
16 on real datasets show that HCSE also achieves competitive costs over the popular
|
| 26 |
+
17 non-binary hierarchical clustering algorithms LOUVAIN and HLP.
|
| 27 |
+
|
| 28 |
+
# 18 1 Introduction
|
| 29 |
+
|
| 30 |
+
19 Hierarchical clustering for graphs plays an important role in the structural analysis of a given data
|
| 31 |
+
20 set. Understanding hierarchical structures on the levels of multiple granularities is fundamental in
|
| 32 |
+
21 various disciplines including artificial intelligence, physics, biology, sociology, etc [4, 11, 13, 9].
|
| 33 |
+
22 Hierarchical clustering requires a cluster tree that represents a recursive partitioning of a graph into
|
| 34 |
+
23 smaller clusters as the tree nodes get deeper. A leaf represents a graph node while a non-leaf node
|
| 35 |
+
24 represents a cluster containing its descendant leaves. The root is the largest one containing all leaves.
|
| 36 |
+
25 Clustering is usually formulated as an optimization problem with some objective function. For hier
|
| 37 |
+
26 archical clustering, no cost function with a clear and reasonable combinatorial explanation was de
|
| 38 |
+
27 veloped until Dasgupta [10] introduced a cost function for cluster trees. In this definition, similarity
|
| 39 |
+
28 or dissimilarity between data points is represented by weighted edges. Taking the similarity-based
|
| 40 |
+
29 metrics as an example, a cluster is a set of nodes with relatively denser intra-links compared with its
|
| 41 |
+
30 inter-links, and in a good cluster tree, heavier edges tend to connect leaves whose lowest common
|
| 42 |
+
31 ancestor (LCA) is as deep as possible. This intuition leads to Dasgupta’s cost function that is a
|
| 43 |
+
32 bilinear combination of edge weights and the sizes of corresponding LCAs.
|
| 44 |
+
33 Motivated by Dasgupta’s cost function, Cohen-Addad et al. [8] proposed admissible cost functions.
|
| 45 |
+
34 In their definition, the size of each LCA in Dasgupta’s objective is generalized to be a function of
|
| 46 |
+
35 the sizes of its left and right children. For all similarity-based graphs generated from a minimal
|
| 47 |
+
36 ultrametric, a cluster tree achieves the minimum cost if and only if it is a generating tree that is a
|
| 48 |
+
37 “natural” ground truth tree in an axiomatic sense therein. A necessary condition of admissibility of
|
| 49 |
+
38 an objective function is that it achieves the same value for every cluster tree for a uniformly weighted
|
| 50 |
+
39 clique that has no structure in common sense. However, any slight deviation of edge weights would
|
| 51 |
+
40 generally separate the two end-points of a light edge on a high level of its optimal (similarity-based)
|
| 52 |
+
41 cluster tree. Thus, it seems that admissible objective functions, which take Dasgupta’s cost function
|
| 53 |
+
42 as a specific form, ought to be an unchallenged criterion in evaluating cluster trees since they are
|
| 54 |
+
43 formulated by an axiomatic approach.
|
| 55 |
+
44 However, an admissible cost function seems imperfect in practice. The arbitrariness of optima of
|
| 56 |
+
45 cluster trees for cliques indicates that the division of each internal node on an optimal cluster tree
|
| 57 |
+
46 totally neglects the balance of its two children. Edge weight is the unique factor that decides the
|
| 58 |
+
47 structure of optimal trees. But a balanced tree is commonly considered as an ideal candidate in
|
| 59 |
+
48 hierarchical clustering compared to an unbalanced one. Even clustering for cliques, a balanced
|
| 60 |
+
49 partition should be preferable for each internal node. At least, an optimal cluster tree whose height
|
| 61 |
+
50 is logarithm of graph size $n$ is intuitively more reasonable than a caterpillar shaped cluster tree
|
| 62 |
+
51 whose height is $n - 1$ . Moreover, a simple proof would imply that the optimal cluster tree for any
|
| 63 |
+
52 connected graphs is binary. This property is not always useful in practice since a real system usually
|
| 64 |
+
53 has its inherent number of hierarchies and a natural partition for each internal cluster. For instance,
|
| 65 |
+
54 the natural levels of administrative division in a country is usually intrinsic, and it is not suitable to
|
| 66 |
+
55 differentiate hierarchies for parallel cities in the same state. This structure cannot be obtained by
|
| 67 |
+
56 simply minimizing admissible cost functions.
|
| 68 |
+
57 In this paper, we investigate the hierarchical clustering from the perspective of information theory.
|
| 69 |
+
58 Our study is based on Li and Pan’s structural information theory [14] whose core concept named
|
| 70 |
+
59 structural entropy measures the complexity of hierarchical networks. We summarize our contribu
|
| 71 |
+
60 tions as follows.
|
| 72 |
+
61 (1) We formulate a new objective function from the information-theoretic perspective, which
|
| 73 |
+
62 builds the bridge for combinatorial and information-theoretic perspectives for hierarchical cluster
|
| 74 |
+
63 ing. For this cost function, the balance of cluster trees will be involved naturally as a factor just
|
| 75 |
+
64 like we design optimal codes, for which the balance of probability over objects is fundamental in
|
| 76 |
+
65 constructing an efficient coding tree. We also define cluster trees with a specific height, which is
|
| 77 |
+
66 coincident with our cognition of natural clustering.
|
| 78 |
+
67 (2) For our new objective function, we present two polynomial-time approximation algorithms
|
| 79 |
+
68 respectively for two cases of the conductance $\Phi ( G )$ of a cardinality weighted graph $G$ . Our first
|
| 80 |
+
69 result shows that any cluster tree of $G$ has a approximation factor $\bar { O } ( \Phi ( \bar { G } ) ^ { - 1 } )$ (Theorem 3.1). So
|
| 81 |
+
70 a "Huffman-merge" heuristic that solely depends on the degrees of vertices achieves this guaran
|
| 82 |
+
71 tee, and it achieves $O ( 1 )$ -approximation when $\Phi ( G )$ is a constant. The second result is a $O ( 1 )$ -
|
| 83 |
+
72 approximation algorithm for $G$ that can be well clustered into a constant number of expanders (The
|
| 84 |
+
73 orem 3.2). The main idea of this algorithm is inspired by very recent Manghiuc and Sun’s work [15],
|
| 85 |
+
74 and our approximation factors for our new objective also match their results in these two cases.
|
| 86 |
+
75 (3) For practical use, we develop a new interpretable framework for natural hierarchical clus
|
| 87 |
+
76 tering that outputs a non-binary cluster tree. The idea of our framework is essentially different from
|
| 88 |
+
77 the traditional recursive division or agglomeration ones. In our framework, the sparsest level of the
|
| 89 |
+
78 cluster tree is stratified recursively. This coincide with the intuition that when we differentiate the
|
| 90 |
+
79 hierarchies of a complex system, the clearest level should be stratified first, rather than in a rigid
|
| 91 |
+
80 divisive or agglomerative fashion. Therefore, this framework has much better interpretability than
|
| 92 |
+
81 the traditional ones.
|
| 93 |
+
82 (4) We develop a new non-binary clustering algorithm (HCSE) under the new clustering frame
|
| 94 |
+
83 work. To find the sparsest level in each iteration, we formulate two basic operations called stretch
|
| 95 |
+
84 and compress, respectively. HCSE terminates when a specific criterion that intuitively coincides
|
| 96 |
+
85 with the natural hierarchies is met, and no hyperparameter is needed. Our extensive experiments on
|
| 97 |
+
86 both synthetic and real datasets demonstrate that HCSE outperforms the present popular heuristic
|
| 98 |
+
87 algorithms LOUVAIN [3] and HLP [19]. These two algorithms proceed simply by recursively in
|
| 99 |
+
88 voking flat clustering algorithms based on modularity and label propagation, respectively, and the
|
| 100 |
+
89 hierarchy number is solely determined by the number of rounds when the algorithm terminates. So
|
| 101 |
+
90 their interpretability is quite poor. Our experimental results on synthetic datasets show that HCSE
|
| 102 |
+
91 has a great advantage in finding the intrinsic number of hierarchies, and the results on real datasets
|
| 103 |
+
92 show that HCSE achieves much better costs than HLP and competitive costs to LOUVAIN.
|
| 104 |
+
93 Related work. The first combinatorial objective function was proposed by Dasgupta [10]. Along
|
| 105 |
+
94 with this line of study, several alternative objectives have been presented. All of them are bilinear
|
| 106 |
+
95 functions of edge weights and some function of the corresponding LCAs. For Dasgupta’s cost func
|
| 107 |
+
96 tion and for the worst case study, Dasgupta showed that a recursively bipartition applying Arora’s
|
| 108 |
+
97 seminal algorithm for sparsest cut problem [2] yields √ $O ( \log ^ { 1 . 5 } n )$ -approximation, and it was im
|
| 109 |
+
98 proved by [20] and [5, 8] to $O ( \log n )$ and $\sqrt { \log n }$ , respectively. It is NP-hard to optimize the cluster
|
| 110 |
+
99 tree [10] and even a $O ( 1 )$ -approximation is impossible under the Small Set Expansion hypothesis
|
| 111 |
+
100 [20, 5]. Beyond the worst case, Cohen-Addad et al. [8] showed that a SVD-based algorithm achieves
|
| 112 |
+
101 a $O ( 1 + o ( 1 ) )$ -approximation for the stochastic block model with high probability. Manghiuc and
|
| 113 |
+
102 Sun [15] presented a $O ( 1 )$ -appromation algorithm for more generalized well-clustered graphs. The
|
| 114 |
+
103 outline of their method is to utilize a flat clustering algorithm [12] to obtain the underlying clusters
|
| 115 |
+
104 first, and then some relatively easy heuristics for clustering in and out of these clusters are enough
|
| 116 |
+
105 for the guarantee. Our proof follows this route also.
|
| 117 |
+
106 For other lines of this study, Moseley and Wang [16] studied the dual of Dasgupta’s cost function
|
| 118 |
+
107 and showed that the average-linkage algorithm achieves a $( 1 / 3 )$ -approximation. This factor has
|
| 119 |
+
108 been improved by a series of works to 0.336 [6], 0.4246 [7] and 0.585 [1], respectively. Cohen
|
| 120 |
+
109 Addad et al. [8] considered maximization of Dasgupta’s cost function for the dissimilarity-based
|
| 121 |
+
110 metrics. They proved that the average-link and random partitioning algorithms achieve a $( 2 / 3 )$ -
|
| 122 |
+
111 approximation, which has been improved to 0.667 [6], 0.716 [18] and 0.74 [17], respectively.
|
| 123 |
+
112 For non-binary cluster tree construction, the most popular algorithm for practical use is LOUVAIN
|
| 124 |
+
113 [3]. More recently, a hierarchical label propagation based algorithm HLP has been presented [19].
|
| 125 |
+
114 Both of these two algorithms construct a non-binary cluster tree with the same framework, that is,
|
| 126 |
+
115 the hierarchies are formed from bottom to top one by one. In each round, they invoke different flat
|
| 127 |
+
116 clustering algorithms, Modularity and Label Propagation, respectively.
|
| 128 |
+
|
| 129 |
+
# 117 2 A cost function from information-theoretic perspective
|
| 130 |
+
|
| 131 |
+
118 In this section, we introduce Li and Pan’s structural information theory [14] and the combinatorial
|
| 132 |
+
119 cost functions of Dasgupta [10] and Cohen-Addad et al. [8]. Then we propose a new cost func
|
| 133 |
+
120 tion that is developed from structural information theory and establish the relationship between the
|
| 134 |
+
121 information-theoretic and combinatorial perspectives.
|
| 135 |
+
122 Notations. Let $G = ( V , E , w )$ be an undirected weighted graph with a set of vertices $V$ , a set of
|
| 136 |
+
123 edges $E$ and a weight function $w : E \to \mathbb { R } ^ { + }$ , where $\bar { \mathbb { R } ^ { + } }$ denotes the set of all positive real numbers.
|
| 137 |
+
124 An unweighted multigraph can be viewed as a cardinality weighted one whose edge weight is the
|
| 138 |
+
125 number of parallel edges. For each vertex $u \in V$ , denote by $\begin{array} { r } { \bar { d _ { u } } = \sum _ { ( u , v ) \in E } w ( u , \bar { v } ) } \end{array}$ the weighted
|
| 139 |
+
126 degree of $u$ . For a subset of vertices $S \subseteq V$ , define the volume of $S$ to be the sum of degrees of
|
| 140 |
+
127 vertices. We denote it by $\begin{array} { r } { \mathrm { v o l } ( S ) = \sum _ { u \in S } d _ { u } } \end{array}$ . We denote by $G [ S ]$ the subgraph induced by $S$ . A
|
| 141 |
+
128 cluster tree $T$ for graph $G$ is a rooted tree with $| V |$ leaves, each of which is labeled by a distinct
|
| 142 |
+
129 vertex $v \in V$ . Each non-leaf node on $T$ is labeled by a subset $S$ of $V$ that consists of all the leaves
|
| 143 |
+
130 treating $S$ as an ancestor. For each node $\alpha$ on $T$ , denote by $\alpha ^ { - }$ the parent of $\alpha$ , and by $| \alpha |$ its size.
|
| 144 |
+
131 For each pair of leaves $u$ and $v$ , denote by $u \vee v$ the LCA of them on $T$ .
|
| 145 |
+
|
| 146 |
+
Structural entropy of graphs. Because of the tense space limit, we just give the definition of the core concept structural entropy in structural information theory. The idea of this definition is briefly introduced in Appendix A. Readers could also refer to [14] for more information on this theory.
|
| 147 |
+
|
| 148 |
+
35 Given a weighted graph $G = ( V , E , w )$ and a cluster tree $T$ for $G$ , the structural entropy of $G$ on $T$
|
| 149 |
+
36 is defined as
|
| 150 |
+
|
| 151 |
+
$$
|
| 152 |
+
{ \mathcal { H } } ^ { T } ( G ) = - \sum _ { \alpha \in T } { \frac { g _ { \alpha } } { \operatorname { v o l } ( V ) } } \log { \frac { \operatorname { v o l } ( \alpha ) } { \operatorname { v o l } ( \alpha ^ { - } ) } } , ^ { 1 }
|
| 153 |
+
$$
|
| 154 |
+
|
| 155 |
+
137 where $\alpha ^ { - }$ denotes the parent of tree node $\alpha$ , and $g _ { \alpha }$ denotes the sum of weights of edges in $G$
|
| 156 |
+
138 with exactly one end-point in the set of vertices corresponding to $\alpha$ . The structural entropy of $G$ is
|
| 157 |
+
139 defined as the minimum one among all cluster trees, denoted by $\begin{array} { r } { \mathcal { H } ( G ) = \operatorname* { m i n } _ { T } \big \{ \mathcal { H } ^ { T } ( G ) \big \} } \end{array}$ .
|
| 158 |
+
140 Combinatorial explanation of structural entropy. The cost function of a cluster tree $T$ for graph
|
| 159 |
+
141 $G = ( V , E )$ introduced by Dasgupta [10] is defined to be $\begin{array} { r } { c ^ { T } ( G ) = \sum _ { ( u , v ) \in E } w ( u , v ) | u \vee v | } \end{array}$ . The
|
| 160 |
+
142 admissible cost function introduced by Cohen-Addad et al. [8] generalizes the term $\vert u \vee v \vert$ in the
|
| 161 |
+
143 definition of $c ^ { T } ( G )$ to be a general function $g ( | L | , | R | )$ , where $L$ and $R$ are the two children of
|
| 162 |
+
144 $u \vee v$ , respectively. Dasgupta defined $g ( x , y ) = x + y$ . For both definitions, the optimal hierarchical
|
| 163 |
+
145 clustering of $G$ is in correspondence with a cluster tree of minimum cost in the combinatorial sense
|
| 164 |
+
146 that heavy edges are cut as far down the tree as possible. The following proposition establishes the
|
| 165 |
+
147 relationship between structural entropy and this kind of combinatorial form of cost functions.
|
| 166 |
+
148 Proposition 2.1. For a weighted graph $G = ( V , E , w )$ , minimizing ${ \mathcal { H } } ^ { T } ( G )$ (over $T$ ) is equivalent
|
| 167 |
+
149 to minimizing the cost function
|
| 168 |
+
|
| 169 |
+
$$
|
| 170 |
+
c o s t ^ { T } ( G ) = \sum _ { ( u , v ) \in E } w ( u , v ) \log { \nu o l ( u \vee v ) } .
|
| 171 |
+
$$
|
| 172 |
+
|
| 173 |
+
150 We defer the proof of Proposition 2.1 to Appendix B. We call cost(SE) the cost function in Propo
|
| 174 |
+
151 sition 2.1 from now on. Proposition 2.1 indicates that when we view $g$ as a function of the LCA
|
| 175 |
+
152 rather than that of its size and define $g ( u , v ) = \log { \mathrm { v o l } } ( u \vee v )$ , the “admissible” function becomes
|
| 176 |
+
153 equivalent to structural entropy in evaluating cluster trees, although it is not admissible any more.
|
| 177 |
+
154 So what is the difference between these two cost functions? As stated by Cohen-Addad et al. [8],
|
| 178 |
+
155 an important axiomatic hypothesis for admissible function, thus also for Dasgupta’s cost function,
|
| 179 |
+
156 is that the cost for every binary cluster tree of an unweighted clique is identical. So any binary tree
|
| 180 |
+
157 for clustering on cliques is reasonable, which coincides with the common sense that structureless
|
| 181 |
+
158 datasets can be organized hierarchically free. However, for structural entropy, the following theorem
|
| 182 |
+
159 indicates that balanced organization is of importance even though for structureless dataset.
|
| 183 |
+
160 Proposition 2.2. For any positive integer $n$ , let $K _ { n }$ be the clique of n vertices with identical weight
|
| 184 |
+
161 on every edge. Then a cluster tree $T$ of $K _ { n }$ achieves minimum structural entropy if and only if $T$ is
|
| 185 |
+
162 a balanced binary tree, that is, the two children clusters of each sub-tree of T have difference in size
|
| 186 |
+
163 at most 1.
|
| 187 |
+
164 The proof of Proposition 2.2 is a bit technical, and we defer it to Appendix C. The intuition behind
|
| 188 |
+
165 Proposition 2.2 is that balanced codes are the most efficient encoding scheme for unrelated data. So
|
| 189 |
+
166 the codewords of the random walk that jumps freely among clusters on each level of a cluster tree
|
| 190 |
+
167 have the minimum average length if all the clusters on this level are in balance.
|
| 191 |
+
168 It is worth noting that the admissible function introduced by Cohen-Addad et al. [8] is defined
|
| 192 |
+
169 from the viewpoint that a generating tree $T$ of a similarity-based graph $G$ that is generated from a
|
| 193 |
+
170 minimal ultrametric achieves the minimum cost. In this definition, the monotonicity of edge weights
|
| 194 |
+
171 between clusters on each level from bottom to top on $T$ , which is given by Cohen-Addad et al. [8] as
|
| 195 |
+
172 a property of a “natural” ground-truth hierarchical clustering, is the unique factor when evaluating $T$
|
| 196 |
+
173 However, Proposition 2.2 implies that for cost(SE), besides cluster weights, the balance of cluster
|
| 197 |
+
174 trees is implicitly involved as another factor. Moreover, for cliques, the minimum cost should be
|
| 198 |
+
175 achieved on every subtree, which makes an optimal cluster tree balanced everywhere. This optimal
|
| 199 |
+
176 clustering for cliques is also robust in the sense that a slight perturbation to the minimal ultrametric,
|
| 200 |
+
177 which can be considered as slight variations to the weights of a batch of edges, will not change the
|
| 201 |
+
178 optimal cluster tree structure wildly due to the holdback force of balance.
|
| 202 |
+
|
| 203 |
+
# 179 3 Approximation algorithms for SE-based cost function
|
| 204 |
+
|
| 205 |
+
In this section, we present approximation algorithms for expander-like and well-clustered graphs, respectively. These algorithms work for cardinality edge weights (e.g. the multiplicity of edges).
|
| 206 |
+
|
| 207 |
+
Why cardinality weights? In general, the term $\log { \mathrm { v o l } } ( u \vee v )$ in Eq. 1 and thus cost(SE) may be negative when the volume of $u \vee v$ varies, which may lead to pathosis in approximation analysis. The cardinality weight function $w$ is at least one, which makes cost(SE) non-negative. The dependence of cost(SE) on the scale of edge weights violates the scale-invariance principle. However, we emphasize that ${ \dot { \mathcal { H } } } ^ { T } ( G )$ is scale-invariant and Proposition 2.1 holds for any scale variation. In this paper, we present approximation algorithms for cost(SE) in well-defined settings.
|
| 208 |
+
|
| 209 |
+
188 Theorem 3.1. For any cardinality weighted graph $G = ( V , E , w )$ with conductance $\Phi ( G )$ , it holds that any cluster tree has a cost 189 $O ( \Phi ( G ) ^ { - 1 } ) \cdot O P T$ , where $O P T$ is the minimum cost $S E )$ of $G$ .
|
| 210 |
+
|
| 211 |
+
190 We defer the proof of Theorem 3.1 to Appendix D. When $\Phi ( G )$ is a constant, Theorem 3.1 implies
|
| 212 |
+
191 that any cluster tree achieves $O ( 1 )$ -approximation for expanders. Thus, the balance of a cluster
|
| 213 |
+
192 tree has a significant impact on its cost. Considering balance as an important factor, we present a
|
| 214 |
+
193 Huffman-merging heuristic (Algorithm 1). It will serve as a subroutine for the algorithm for well
|
| 215 |
+
194 clustered graphs.
|
| 216 |
+
|
| 217 |
+
# Algorithm 1: HuffmanMerge
|
| 218 |
+
|
| 219 |
+
Input: a graph $G = ( V , E , w )$
|
| 220 |
+
|
| 221 |
+
Output: A cluster tree $T$ of $G$
|
| 222 |
+
|
| 223 |
+
1 Create $n$ singleton trees;
|
| 224 |
+
|
| 225 |
+
2 while there are at least two trees do
|
| 226 |
+
|
| 227 |
+
3 Select the two trees $T _ { 1 }$ and $T _ { 2 }$ with the least volumes;
|
| 228 |
+
4 Construct a new tree $T _ { 0 }$ with $T _ { 1 }$ and $T _ { 2 }$ as two subtrees of the root;
|
| 229 |
+
|
| 230 |
+
5 Return the resulting binary tree $T _ { 0 }$
|
| 231 |
+
|
| 232 |
+
195 Next, we consider well-clustered graphs that are composed by a collection of densely-connected
|
| 233 |
+
196 components with high inner conductance and weakly interconnections. Our settings for well
|
| 234 |
+
197 clustered graphs is the same as those in [15]. We start from the following $( \Phi _ { i n } , \Phi _ { o u t } )$ -decomposition
|
| 235 |
+
198 presented by Gharan and Trevisan [12]. Let $\lambda _ { k }$ be the $k$ -th smallest eigenvalue of the normalized
|
| 236 |
+
199 Laplacian matrix of $G$ and $\Phi _ { G } ( S )$ be the conductance of a vertex set $S$ in $G$ .
|
| 237 |
+
|
| 238 |
+
200 Lemma 3.1. ([12], Theorem 1.5) Let $G = ( V , E , w )$ be a graph such that $\lambda _ { k } > 0$ , for some $k \geq 1$ . 201 Then, there is a local search algorithm that finds a $l$ -partition $\{ P _ { i } \} _ { i = 1 } ^ { l }$ of $V ,$ for some $l < k$ , such that for every 202 $1 \leq i \leq l$ , $\Phi _ { G } ( P _ { i } ) = \mathcal { O } ( k ^ { 6 } \sqrt { \lambda _ { k - 1 } } )$ and $\Phi ( G [ P _ { i } ] ) = \Omega ( \lambda _ { k } ^ { 2 } / k ^ { 4 } )$ .
|
| 239 |
+
|
| 240 |
+
Lemma 3.1 implies that, when graph $G$ exhibits a clear clustering structure, there is a partition $\{ P _ { i } \} _ { i = 1 } ^ { l }$ of $\mathrm { v }$ such that for each $P _ { i }$ both the outer and inner conductance can be bounded. This is one of the most crucial insights that we can use $\{ P _ { i } \} _ { i = 1 } ^ { l }$ directly to construct a cluster tree.
|
| 241 |
+
|
| 242 |
+
206 For a high-level description, our algorithm consists of two phases: Partition and Merge. In the
|
| 243 |
+
207 Partition phase, it invokes the algorithm in Lemma 3.1 to partion $V$ into sets $\{ P _ { i } \} _ { i = 1 } ^ { l }$ . In the Merge
|
| 244 |
+
208 phase it combines the trees in a "caterpillar style" according to an increasing order of their volumes.
|
| 245 |
+
209 This algorithm is described as Algorithm 2.
|
| 246 |
+
|
| 247 |
+
# Algorithm 2: CaterpillarMerge
|
| 248 |
+
|
| 249 |
+
Input: A graph $G = ( V , E , w )$ , an integer $k \geq 2$ such that $\lambda _ { k } > 0$ Output: A cluster tree $T$ of $G$
|
| 250 |
+
|
| 251 |
+
1 Apply the partitioning algorithm in Lemma 3.1 on input $( G , k )$ to obtain $\{ P _ { i } \} _ { i = 1 } ^ { l }$ for some $l < k$ ;
|
| 252 |
+
|
| 253 |
+
2 Sort $P _ { 1 } , . . . , P _ { l }$ be such that ${ \mathrm { v o l } } _ { G } ( P _ { i } ) \leq { \mathrm { v o l } } _ { G } ( P _ { i + 1 } )$ , for all $1 \leq i < l$ ;
|
| 254 |
+
|
| 255 |
+
3 Let $T _ { i } =$ HuffmanMerge $( G [ P _ { i } ] )$ ;
|
| 256 |
+
4 Initialize $T = T _ { 1 }$ ;
|
| 257 |
+
5 for $i = 2 , . . . , l$ do
|
| 258 |
+
6 Let $T$ be the tree with $T$ and $T _ { i }$ as its two children;
|
| 259 |
+
|
| 260 |
+
7 Return $T$
|
| 261 |
+
|
| 262 |
+
210 Note that Algorithm 2 degenerates to Algorithm 1 when $k = 2$ . For the approximation guarantee,
|
| 263 |
+
211 we have the following theorem.
|
| 264 |
+
212 Theorem 3.2. Let $G = ( V , E , w )$ be a cardinality weighted graph such that $\lambda _ { k } \ > \ 0$ for some
|
| 265 |
+
213 $k \geq 1$ . Then Algorithm 2 constructs in polynomial time a cluster tree $T$ of $G$ that achieves
|
| 266 |
+
214 $\begin{array} { r } { O \left( \frac { 1 } { ( 1 - \alpha ) \beta } \log \frac { k } { 1 - \alpha } \right) } \end{array}$ -approximation for $c o s t ^ { T } ( G )$ , where $\alpha = O ( k ^ { 6 } \sqrt { \lambda _ { k - 1 } } )$ , $\beta = \Omega ( \lambda _ { k } ^ { 2 } / k ^ { 4 } )$ . Con
|
| 267 |
+
215 sequently, when $\lambda _ { k } = \Omega ( 1 / p o l y ( k ) )$ and $\lambda _ { k - 1 } = { \cal O } ( 1 / k ^ { 1 2 } )$ such that $\alpha < 1 - \rho$ for some constant
|
| 268 |
+
216 $\rho \in \mathsf { \Gamma } ( 0 , 1 )$ , Algorithm 2 achieves $O ( p o l y ( k ) )$ -approximation. In addition, when $k$ is a constant,
|
| 269 |
+
217 Algorithm 2 achieves $O ( 1 )$ -approximation.
|
| 270 |
+
|
| 271 |
+
218 The proof of Theorem 3.2 is given in Appendix E.
|
| 272 |
+
|
| 273 |
+
In this section, we develop a non-binary hierarchical clustering algorithm based on cost(SE) optimization. At present, all existing algorithms for hierarchical clustering can be categorized into two frameworks: top-down division and bottom-up agglomeration [8]. The top-down division approach usually yields a binary tree by recursively dividing a cluster into two parts with a cut-related criterion. But a binary clustering tree is far from a practical one as we introduced in Section 1. For practical use, bottom-up agglomeration that is also known as hierarchical agglomerative clustering (HAC) is commonly preferable. It constructs a cluster tree from leaves to the root recursively, during each round of which the newly generated clusters shrink into single vertices.
|
| 274 |
+
|
| 275 |
+
Our algorithm jumps out of these two frameworks. We establish a new one that stratifies the sparsest level of a cluster tree recursively rather than in a sequential order. In general, in guide with cost(SE), we construct a $k + 1$ -level cluster tree from the previous $k$ -level one, during which we find the level whose stratification makes the average cost in a local reduced subgraph decrease most, and then differentiate it into two levels. The process of stratification consists of two basic operations: stretch and compression. Generally speaking, in stretch steps, given an internal node of a cluster tree, a local binary subtree is constructed, while in compression steps, the paths that are overlength from the root to leaves on the binary tree is compressed by shrinking tree edges that make the cost reduce most. The intuition behind the “stretch-and-compress” scheme is as follows. First, we run a fast and simple, but probably rough clustering algorithm to obtain a binary cluster subtree. So intuitively, after stretch, we unfold all the potential hierarchies such that the sparsest level is possibly to be seen. Second, we compress every overlength path that is supposed to get through each level of this subtree, during which, the edge on the sparsest level whose compression makes too many graph edges amplify the sizes of their LCAs to a large extent will be retained.
|
| 276 |
+
|
| 277 |
+
We remark that this framework can be collocated with any cost function and any binary cluster tree algorithm. For computational efficiency, especially for real networks of large scale more than $1 0 ^ { 4 }$ we will adopt in our experiments an HAC construction of binary cluster trees in stretch steps.
|
| 278 |
+
|
| 279 |
+
Stretch and compress. Given a cluster tree $T$ for graph $G = ( V , E )$ , let $u$ be an internal node on $T$ and $v _ { 1 } , v _ { 2 } , \ldots , v _ { \ell }$ be its children. We call this local parent-children structure rooted at $u$ to be a $u$ -triangle of $T$ , denoted by $T _ { u }$ . These two operations are defined on $u$ -triangles. Note that each child $v _ { i }$ of $u$ is a cluster in $G$ . We reduce $G$ by shrinking each $v _ { i }$ to be a single vertex $\boldsymbol { v } _ { i } ^ { \prime }$ while maintaining each inter-link and ignoring each internal edge of $v _ { i }$ . This reduction captures the connections of clusters at this level in the parent cluster $u$ . The stretch operation constructs a binary tree for $u$ -triangle. We adopt a common HAC construction in this $u$ -triangle. That is, initially, view each $\boldsymbol { v } _ { i } ^ { \prime }$ as a cluster and recursively combine two clusters into a new one for which cost(SE) drops most. The sequence of combinations yields a binary subtree $T _ { u } ^ { \prime }$ rooted at $u$ which has $v _ { 1 } , v _ { 2 } , \ldots , v _ { \ell }$ as leaves. Then the compression operation is proposed to reduce the height of $T _ { u } ^ { \prime }$ to be 2. Let $\hat { E } ( T ^ { \prime } )$ be the set of edges on $T ^ { \prime }$ , each of which appears on a path of length more than 2 from the root of $T ^ { \prime }$ to some leaf. Denote by $\Delta ( e )$ for edge $e$ be the amount of structural entropy enhanced by the shrink of $e$ . We pick from $\hat { E } ( T _ { u } ^ { \prime } )$ the edge $e$ with least $\Delta ( e )$ . Note that the compression of a tree edge makes the grandchildren of some internal node to be children, which must amplify the cost. The compression operation picks the least amplification. The processes of stretch and compress are illustrated in Figure 3 and stated in Algorithms 5 and 6, respectively (see Appendix G).
|
| 280 |
+
|
| 281 |
+
Sparsest level. Let $U _ { j }$ be the set of $j$ -level nodes on cluster tree $T$ , that is, $U _ { j }$ is the set of nodes each of which has distance $j$ from $T$ ’s root. Suppose that the height of $T$ is $k$ , then $U _ { 0 } , U _ { 1 } , \dots , U _ { k - 1 }$ is a partition for all internal nodes of $T$ . For each internal node $u$ , define $\begin{array} { r } { \mathcal { H } ( u ) = - \sum _ { v : v ^ { - } = u } \frac { g _ { u } } { \mathrm { v o l } ( V ) } \log \frac { \mathrm { v o l } ( v ) } { \mathrm { v o l } ( u ) } } \end{array}$ . Note that $\mathcal { H } ( u )$ is the partial sum contributed by $u$ in ${ \mathcal { H } } ^ { T } ( G )$ . After a “stretch-and-compress” round on $u$ -triangle, denote by $\Delta \mathcal { H } ( u )$ the structural entropy by which the new cluster tree reduces. Since the reconstruction of $u$ -triangle stratifies cluster $u$ , $\Delta \mathcal { H } ( u )$ is always non-negative. Define the sparsity of $u$ to be $\begin{array} { r } { \mathrm { S p a r } ( u ) = \frac { \Delta \mathcal { H } ( u ) } { \mathcal { H } ( u ) } } \end{array}$ , which is the relative variation of structural entropy in cluster $u$ . From the information-theoretic perspective, this means that the uncertainty of random walk can be measured locally in any internal cluster, which reflects the quality of clustering in this local area. At last, we define the sparsest level of $T$ to be the $j$ -th level such that the average sparsity of triangles rooted at nodes in $U _ { j }$ is maximum, that is arg $\operatorname* { m a x } _ { j } \{ { \overline { { \operatorname { S p a r } } } } _ { j } ( T ) \}$ where 272 $\begin{array} { r } { \overline { { \mathrm { S p a r } } } _ { j } ( T ) = \sum _ { u \in U _ { j } } { \mathrm { S p a r } } ( \mathbf { u } ) / | U _ { j } | } \end{array}$ . Then stratification works for the sparsest level of $T$ . This 73 process is illustrated in Figure 4 (see Appendix G).
|
| 282 |
+
|
| 283 |
+
274 For a given positive integer $k$ , to construct a cluster tree of height $k$ , we start from the trivial 1-level
|
| 284 |
+
275 cluster tree that involves all vertices of $G$ as leaves. Then we do not stop stratifying at the sparsest
|
| 285 |
+
276 level recursively until a $k$ -level cluster tree is obtained. This process is described in Algorithm 3.
|
| 286 |
+
|
| 287 |
+
# Algorithm 3: $k$ -Hierarchical clustering based on structural entropy ( $k$ -HCSE)
|
| 288 |
+
|
| 289 |
+
Input: a graph $G = ( V , E )$ , $k \in \mathbb { Z } ^ { + }$
|
| 290 |
+
Output: a $k$ -level cluster tree $T$
|
| 291 |
+
1 Initialize $T$ to be the 1-level cluster tree;
|
| 292 |
+
2 $h = \mathrm { h e i g h t ( T ) }$ ;
|
| 293 |
+
3 while $h < k$ do
|
| 294 |
+
4 $j ^ { \prime } \gets \arg \operatorname* { m a x } _ { j } \{ \overline { { \mathrm { S p a r } } } _ { j } ( T ) \}$ ; // Find the sparsest level of $T$ (breaking ties arbitraily);
|
| 295 |
+
5 if $\overline { { S p a r } } _ { j ^ { \prime } } ( T ) = 0$ then
|
| 296 |
+
6 break; // No cost will be saved by any further clustering;
|
| 297 |
+
7 for $u \in U _ { j ^ { \prime } }$ do
|
| 298 |
+
8 $T _ { u } \gets \mathrm { S t r e t c h } ( u \mathrm { - t r i a n g l e } T _ { u } )$ ;
|
| 299 |
+
9 Compress $( T _ { u } )$ ;
|
| 300 |
+
10 $h \gets h + 1$ ;
|
| 301 |
+
11 for $j \in [ j ^ { \prime } + 1 , h ]$ do
|
| 302 |
+
12 Update $U _ { j }$ ;
|
| 303 |
+
13 return T
|
| 304 |
+
277 To determine the height of the cluster tree automatically, we derive the natural clustering from the
|
| 305 |
+
278 variation of sparsity on each level. Intuitively, a natural hierarchical cluster tree $T$ should have
|
| 306 |
+
279 not only sparse boundary on clusters, but also low sparsity for triangles of $T$ , which means that
|
| 307 |
+
280 stratification within the reduced subgraphs corresponding to the triangles on the sparsest level makes
|
| 308 |
+
281 little sense. For this reason, we consider the inflection points of the sequence $\{ \delta _ { t } ( \mathcal { H } ) \} _ { t = 1 , 2 , . . . }$ ,
|
| 309 |
+
282 where $\delta _ { t } ( \mathcal { H } )$ is the structural entropy by which the $t$ -th round of stratification reduces. Formally,
|
| 310 |
+
283 denote $\Delta _ { t } \mathcal { H } = \delta _ { t - 1 } ( \mathcal { H } ) - \delta _ { t } ( \mathcal { H } )$ for each $t \geq 2$ . We say that $\Delta _ { t } \mathcal { H }$ is an inflection point if both
|
| 311 |
+
284 $\Delta _ { t } \mathcal { H } \ \geq \ \Delta _ { t - 1 } \mathcal { H }$ and $\Delta _ { t } \mathcal { H } \ \geq \ \Delta _ { t + 1 } \mathcal { H }$ hold. Our algorithm finds the least $t$ such that $\Delta _ { t } \mathcal { H }$ is
|
| 312 |
+
285 an inflection point and fix the height of the cluster tree to be $t$ (Note that after $t - 1$ rounds of
|
| 313 |
+
286 stratification, the number of levels is $t$ ). This process is described as Algorithm 4.
|
| 314 |
+
|
| 315 |
+
# Algorithm 4: Hierarchical clustering based on structural entropy (HCSE)
|
| 316 |
+
|
| 317 |
+
Input: a graph $G = ( V , E )$ Output: a cluster tree $T$ 1 $t \gets 2$ ; 2 while $\Delta _ { t } \mathcal { H } < \Delta _ { t - 1 } \mathcal { H }$ or $\Delta _ { t } \mathcal { H } < \Delta _ { t + 1 } \mathcal { H }$ do 3 $\scriptstyle \mathbf { f } \operatorname* { m a x } _ { j } \{ { \overline { { S p a r } } } _ { j } ( T ) \} = O$ then 4 break; 5 $t \gets t + 1$ ; 6 return $\scriptstyle t - \mathrm { H C S E } ( T )$
|
| 318 |
+
|
| 319 |
+
287 Time complexity. The running time of HCSE on graph $G = ( V , E )$ for which $| V | = n$ and $| E | = m$
|
| 320 |
+
288 depends mainly on the iterations of stratification for the sparsest level. For each round of $t$ -HCSE in
|
| 321 |
+
289 Algorithm 4, since the change of structure entropy can be calculated incrementally and locally when
|
| 322 |
+
290 merge siblings, the time complexity for the Stretch process is $O ( m h \log n )$ , where $h$ is the height
|
| 323 |
+
291 of the binary tree that Stretch yields. Since at most $n$ times of shrinking operations on tree edges
|
| 324 |
+
292 will happen, the time complexity for the Compress process is $O ( h n )$ . Let $h _ { \mathrm { m a x } }$ be the maximum
|
| 325 |
+
293 height among the binary trees that appear during all iterations. The time complexity of HCSE (and
|
| 326 |
+
294 also $k$ -HCSE) is $O ( k m h _ { \operatorname* { m a x } } \log n + k h _ { \operatorname* { m a x } } n )$ . In practice, $k$ is usually very small (we can even
|
| 327 |
+
295 set $k = O ( 1 )$ in $k$ -HCSE). Moreover, the balance property of structural entropy tends to produce a
|
| 328 |
+
|
| 329 |
+
<table><tr><td></td><td>p</td><td>HCSE</td><td>HLP</td><td>LOU</td></tr><tr><td>P2 P1 P0</td><td>4.5E(-2) 1.5E(-3) 6E(-6)</td><td>0.89 0.93 0.62</td><td>0.79 0.75 0.58</td><td>0.92 0.92 11</td></tr><tr><td>P2 P1 P0</td><td>5.5E(-2) 1.5E(-3) 4E(-6)</td><td>0.87 0.95 0.72</td><td>0.89 0.87 11</td><td>0.89 0.87 11</td></tr><tr><td>P2 P1 P0</td><td>6.5E(-2) 4.5E(-3) 2.5E(-6)</td><td>0.96 0.94 0.80</td><td>0.95 0.81 11</td><td>0.99 0.99</td></tr></table>
|
| 330 |
+
|
| 331 |
+
Table 1: NMI for three algorithms. Each dataset has 2, 500 vertices, and the cluster numbers at three levels are 5, 25 and 250, respectively, for which the size of each cluster is accordingly generated at random. $p _ { 3 } = 0 . 9$ for each graph. “ ” means the algorithm does not find this level.
|
| 332 |
+
|
| 333 |
+

|
| 334 |
+
Figure 1: $\delta _ { t } ( \mathcal { H } )$ variations for HCSE. It can be observed easily that the inflection points for all the three datasets appear on $t = 4$ , which is also the ground-truth number of hierarchies.
|
| 335 |
+
|
| 336 |
+
296 balanced binary tree after stretch, which makes $h _ { \mathrm { m a x } } = { \cal { O } } ( \log n )$ . Therefore, in this case, the time complexity is merely 297 $O ( m \log ^ { 2 } n )$ .
|
| 337 |
+
|
| 338 |
+
# 298 5 Experiments
|
| 339 |
+
|
| 340 |
+
We evaluate experimentally our practically used non-binary clustering algorithm both on synthetic networks generated from the Hierarchical Stochastic Block Model (HSBM) and on real datasets, respectively. We compare HCSE with the popular practical algorithms LOUVAIN [3] and HLP [19]. To avoid over-fitting to higher levels, which possibly results in under-fitting to lower levels, LOUVAIN admits a sequential input of vertices. Usually, to avert the worst-case trap, the vertices come randomly, and the resulting cluster tree depends on their order. HLP invokes the common LP algorithm recursively, and so it cannot be guaranteed to avoid under-fitting in each round. This can be seen in our experiments on synthetic datasets, for which these two algorithms usually miss ground-truth levels. For real datasets, as far as we know, no public real datasets have clear ground truth for hierarchical clustering. We do the comparative experiments on real networks. Some of them have (overlapping, possibly hierarchical) ground truth, e.g., Amazon, while others do not have. We evaluate the resulting cluster trees for the Amazon network by Jaccard index, and show the results in Appendix F, For other networks without ground truth, we evaluate results by both cost(SE) and Dasgupta’s cost function cost(Das). All the source code can be downloaded from https://github.com/samwu-learn/HCSE.
|
| 341 |
+
|
| 342 |
+
314 Synthetic datasets generated from HSBM. Our experiments on synthetic datasets utilize 4-level
|
| 343 |
+
315 HSBM. For simplicity, let $\vec { p } = \left( p _ { 0 } , p _ { 1 } , p _ { 2 } , p _ { 3 } \right)$ be the probability vector for which $p _ { i }$ is the proba
|
| 344 |
+
316 bility of generating edges for vertex pairs whose LCA on the ground-truth cluster tree has depth $i$
|
| 345 |
+
317 Note that the 0-depth node is the root. We compare the Normalized Mutual Information (NMI) at
|
| 346 |
+
318 each level of the ground-truth cluster tree to those of three algorithms. Note that the randomness in
|
| 347 |
+
319 LOUVAIN, and breaking-ties rule as well as convergence of HLP make different results, we choose
|
| 348 |
+
320 the most effective strategy and pick the best results in five runs for both of them. Compared to their
|
| 349 |
+
321 uncertainty, our algorithm HCSE yields stable results.
|
| 350 |
+
|
| 351 |
+
Table 1 demonstrates the results in three groups of probabilities, for which the hierarchical structures get clearer one by one. Each dataset has 2, 500 vertices, and the cluster numbers at three levels are 5, 25 and 250, respectively, for which the size of each cluster is accordingly generated at random. $p _ { 3 } = 0 . 9$ for each graph. Our algorithm HCSE is always able to find the right number of levels, while LOUVAIN always misses the top level, and HLP misses the top level in two groups. The inflection points for choosing the intrinsic hierarchy number $t = 4$ of hierarchies are demonstrated in Figure 1.
|
| 352 |
+
|
| 353 |
+
<table><tr><td>Networks</td><td>HCSE</td><td>HLP</td><td>LOUVAIN</td></tr><tr><td>CSphd</td><td>1.30E4 / 5.19E4 / 5</td><td>1.54E4 / 5.58E4 /4</td><td>1.28E4 / 7.61E4 / 5</td></tr><tr><td>fb-pages-government</td><td>2.48E6 /1.18E8 / 4</td><td>2.53E6 / 1.76E8 / 3</td><td>2.43E6 / 1.33E8 / 4</td></tr><tr><td>email-univ</td><td>1.16E5 /2.20E6 / 3</td><td>1.46E5 / 6.14E6 / 3</td><td>1.14E5 / 2.20E6 /4</td></tr><tr><td>fb-messages</td><td>1.58E5 / 4.50E6 / 4</td><td>1.76E5 /8.12E6 / 3</td><td>1.52E5 / 4.96E6 / 4</td></tr><tr><td>G22</td><td>5.56E5 / 2.68E7 /4</td><td>6.11E5 /4.00E7 /3</td><td>5.63E5 /2.80E7 /5</td></tr><tr><td>As20000102</td><td>2.64E5 / 2.36E7 /4</td><td>3.62E5 / 7.63E7 /3</td><td>2.42E5 /2.42E7 / 5</td></tr><tr><td>bibd-13-6</td><td>7.41E5 / 2.56E7 / 3</td><td>8.05E5 /4.41E7 /2</td><td>7.50E5 / 2.75E7 /4</td></tr><tr><td>delaunay-n10</td><td>4.65E4 / 3.39E5 / 4</td><td>4.87E4 / 3.55E5 /4</td><td>4.24E4 / 4.25E5 / 5</td></tr><tr><td>p2p-Gnutella05</td><td>9.00E5 /1.48E8 / 3</td><td>1.01E6 / 2.78E8 / 3</td><td>8.05E5 / 1.49E8 / 5</td></tr><tr><td>p2p-Gnutella08</td><td>5.59E5 / 5.51E7 / 4</td><td>6.36E5 / 1.28E8 /4</td><td>4.88E5 / 6.03E7 / 5</td></tr></table>
|
| 354 |
+
|
| 355 |
+
Table 2: “cost(SE) / cost(Das) / k” for three algorithms, where $k$ is the hierarchy number that the algorithm finds.
|
| 356 |
+
|
| 357 |
+
Real datasets. We do our experiments on a series of real networks 2 without ground truth. We compare cost(SE) and cost(Das), respectively. Since the different level numbers given by the three algorithms influence the costs seriously, that is, lower costs are obtained just due to greater heights, we only list in Table 2 the networks for which the three algorithms yield similar level numbers that differ by at most 1 or 2. It can be observed that HLP does not achieve optima for any network, while HCSE performs best w.r.t. cost(Das) for all networks, but does not outperform LOUVAIN for most networks. This is mainly due to the fact that LOUVAIN always finds no less number of hierarchies than HCSE, and the better cost benefits from its depth. Moreover, we emphasize that there is no evidence to indicate that the lower cost(SE) or cost(Das) is, the better a non-binary cluster tree is. Our experiments on these real datasets are just demonstrations of the effectiveness for our interpretable mechanism in hierarchical clustering.
|
| 358 |
+
|
| 359 |
+
# 340 6 Conclusions and future discussions
|
| 360 |
+
|
| 361 |
+
In this paper, we investigate the hierarchical clustering problem from an information-theoretic perspective and propose a new objective function that relates to the combinatorial cost functions raised by Dasgupta [10]. For optimization of this function, we present two $O ( 1 )$ -approximation algorithms for expander-like and well-clustered cardinality weighted graphs, respectively. For practical use, we propose a new interpretable non-binary hierarchical clustering framework that stratifies the sparsest level of the cluster tree recursively, which can be collocated with any cost function. We also present an interpretable strategy to find the intrinsic number of levels without any hyper-parameter. The experimental results on $k$ -level HSBM demonstrate that our algorithm HCSE has a great advantage in finding $k$ compared to the popular but strongly heuristic algorithms LOUVAIN and HLP. Our results on real datasets show that HCSE also achieves competitive costs compared to these two algorithms.
|
| 362 |
+
|
| 363 |
+
There are several directions that are worth further study. The first problem is about the relationship between the concavity of $g$ of the cost function and the balance of the optimal cluster tree. It can be checked that for cliques, being concave is not a sufficient condition for total balance. Whether is it a necessary condition? Moreover, is there any explicit necessary and sufficient condition for total balance of the optimal cluster tree for cliques? The second problem is about approximation algorithms for both structural entropy and cost(SE) in the worst case. Due to the non-linear and volume-related function $g$ , many previous proof techniques for approximation algorithms seems unavailable. The third one is about more precise characterizations for “natural” hierarchical clustering whose depth is limited. Since any reasonable choice of $g$ makes the cost function achieve optimum on some binary tree, a blind pursuit of minimization of cost functions seems not to be a rational approach. More criteria in this scenario need to be studied.
|
| 364 |
+
|
| 365 |
+
# References
|
| 366 |
+
|
| 367 |
+
[1] Noga Alon, Yossi Azar, and Danny Vainstein. Hierarchical clustering: A 0.585 revenue approximation. In Jacob D. Abernethy and Shivani Agarwal, editors, Conference on Learning Theory, COLT 2020, 9-12 July 2020, Virtual Event [Graz, Austria], volume 125 of Proceedings of Machine Learning Research, pages 153–162. PMLR, 2020. [2] Sanjeev Arora, Satish Rao, and Umesh V. Vazirani. Expander flows, geometric embeddings and graph partitioning. J. ACM, 56(2):5:1–5:37, 2009. [3] Vincent D. Blondel, Jean-Loup Guillaume, Renaud Lambiotte, and Etienne Lefebvre. Fast unfolding of communities in large networks. Journal of statistical mechanics: theory and experiment, 2008(10):P10008, 2008. [4] Peter F Brown, Vincent J Della Pietra, Peter V Desouza, Jennifer C Lai, and Robert L Mercer. Class-based n-gram models of natural language. Computational linguistics, 18(4):467–480, 1992. [5] Moses Charikar and Vaggos Chatziafratis. Approximate hierarchical clustering via sparsest cut and spreading metrics. In Philip N. Klein, editor, Proceedings of the Twenty-Eighth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2017, Barcelona, Spain, Hotel Porta Fira, January 16-19, pages 841–854. SIAM, 2017. [6] Moses Charikar, Vaggos Chatziafratis, and Rad Niazadeh. Hierarchical clustering better than average-linkage. In Timothy M. Chan, editor, Proceedings of the Thirtieth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2019, San Diego, California, USA, January 6-9, 2019, pages 2291–2304. SIAM, 2019. [7] Vaggos Chatziafratis, Grigory Yaroslavtsev, Euiwoong Lee, Konstantin Makarychev, Sara Ahmadian, Alessandro Epasto, and Mohammad Mahdian. Bisect and conquer: Hierarchical clustering via max-uncut bisection. In Silvia Chiappa and Roberto Calandra, editors, The $2 3 r d$ International Conference on Artificial Intelligence and Statistics, AISTATS 2020, 26-28 August 2020, Online [Palermo, Sicily, Italy], volume 108 of Proceedings of Machine Learning Research, pages 3121–3132. PMLR, 2020. [8] Vincent Cohen-Addad, Varun Kanade, Frederik Mallmann-Trenn, and Claire Mathieu. Hierarchical clustering: Objective functions and algorithms. Journal of the ACM (JACM), 66(4):1–42, 2019. [9] Aron Culotta, Pallika Kanani, Robert Hall, Michael Wick, and Andrew McCallum. Author disambiguation using error-driven machine learning with a ranking loss function. In Sixth International Workshop on Information Integration on the Web (IIWeb-07), Vancouver, Canada, 2007. [10] Sanjoy Dasgupta. A cost function for similarity-based hierarchical clustering. In Daniel Wichs and Yishay Mansour, editors, Proceedings of the 48th Annual ACM SIGACT Symposium on Theory of Computing, STOC 2016, Cambridge, MA, USA, June 18-21, 2016, pages 118–127. ACM, 2016. [11] Michael B Eisen, Paul T Spellman, Patrick O Brown, and David Botstein. Cluster analysis and display of genome-wide expression patterns. Proceedings of the National Academy of Sciences, 95(25):14863–14868, 1998. [12] Shayan Oveis Gharan and Luca Trevisan. Partitioning into expanders. In Chandra Chekuri, editor, Proceedings of the Twenty-Fifth Annual ACM-SIAM Symposium on Discrete Algorithms, SODA 2014, Portland, Oregon, USA, January 5-7, 2014, pages 1256–1266. SIAM, 2014. 06 [13] Alexander N Gorban, Balázs Kégl, Donald C Wunsch, Andrei Y Zinovyev, et al. Principal manifolds for data visualization and dimension reduction, volume 58. Springer, 2008. [14] Angsheng Li and Yicheng Pan. Structural information and dynamical complexity of networks. IEEE Trans. Inf. Theory, 62(6):3290–3339, 2016.
|
| 368 |
+
|
| 369 |
+
[15] Bogdan-Adrian Manghiuc and He Sun. Hierarchical clustering: O(1)-approximation for wellclustered graphs. In Marc’Aurelio Ranzato, Alina Beygelzimer, Yann N. Dauphin, Percy Liang, and Jennifer Wortman Vaughan, editors, Advances in Neural Information Processing Systems 34: Annual Conference on Neural Information Processing Systems 2021, NeurIPS 2021, December 6-14, 2021, virtual, pages 9278–9289, 2021.
|
| 370 |
+
[16] Benjamin Moseley and Joshua R. Wang. Approximation bounds for hierarchical clustering: Average linkage, bisecting $\mathbf { k }$ -means, and local search. In Isabelle Guyon, Ulrike von Luxburg, Samy Bengio, Hanna M. Wallach, Rob Fergus, S. V. N. Vishwanathan, and Roman Garnett, editors, Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, pages 3094–3103, 2017.
|
| 371 |
+
[17] Stanislav Naumov, Grigory Yaroslavtsev, and Dmitrii Avdiukhin. Objective-based hierarchical clustering of deep embedding vectors. In Thirty-Fifth AAAI Conference on Artificial Intelligence, AAAI 2021, Thirty-Third Conference on Innovative Applications of Artificial Intelligence, IAAI 2021, The Eleventh Symposium on Educational Advances in Artificial Intelligence, EAAI 2021, Virtual Event, February 2-9, 2021, pages 9055–9063. AAAI Press, 2021.
|
| 372 |
+
[18] Mirmahdi Rahgoshay and Mohammad R. Salavatipour. Hierarchical clustering: New bounds and objective. CoRR, abs/2111.06863, 2021.
|
| 373 |
+
[19] Ryan A Rossi, Nesreen K Ahmed, Eunyee Koh, and Sungchul Kim. Fast hierarchical graph clustering in linear-time. In Companion Proceedings of the Web Conference 2020, pages 10– 12, 2020.
|
| 374 |
+
[20] Aurko Roy and Sebastian Pokutta. Hierarchical clustering via spreading metrics. J. Mach. Learn. Res., 18:88:1–88:35, 2017.
|
| 375 |
+
|
| 376 |
+
# Checklist
|
| 377 |
+
|
| 378 |
+
1. For all authors...
|
| 379 |
+
|
| 380 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] See Abstract and Section 1
|
| 381 |
+
(b) Did you describe the limitations of your work? [Yes] See Section 3 and 6
|
| 382 |
+
(c) Did you discuss any potential negative societal impacts of your work? [N/A]
|
| 383 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 384 |
+
|
| 385 |
+
2. If you are including theoretical results...
|
| 386 |
+
|
| 387 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] See Section 3 (b) Did you include complete proofs of all theoretical results? [Yes] See Appendices
|
| 388 |
+
|
| 389 |
+
3. If you ran experiments...
|
| 390 |
+
|
| 391 |
+
(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] See Section 5
|
| 392 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [N/A]
|
| 393 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A]
|
| 394 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [No] We do not compare the speed of computing, and so due to the space limit we have omitted resource introduction.
|
| 395 |
+
|
| 396 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 397 |
+
|
| 398 |
+
(a) If your work uses existing assets, did you cite the creators? [N/A] All codes are written by the authors, and all datasets we use is public. We have provided the URLs that link to the datasets we use.
|
| 399 |
+
|
| 400 |
+
(b) Did you mention the license of the assets? [N/A]
|
| 401 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
|
| 402 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [No] All datasets we used are public.
|
| 403 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] No such content is included.
|
| 404 |
+
|
| 405 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 406 |
+
|
| 407 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 408 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 409 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
| 410 |
+
|
| 411 |
+
# 473 A A brief introduction to structural information
|
| 412 |
+
|
| 413 |
+
The idea of structural information is to encode a random walk with a certain rule by using a highdimensional encoding system for a graph $G$ . It is well known that a random walk, for which a neighbor is randomly chosen with probability proportional to edge weights, has a stationary distribution on vertices that is proportional to vertex degree.3 So to position a random walk under its stationary distribution, the amount of information needed is typically the Shannon’s entropy, denoted by
|
| 414 |
+
|
| 415 |
+
$$
|
| 416 |
+
{ \mathcal { H } } ^ { ( 1 ) } ( G ) = - \sum _ { v \in V } { \frac { d _ { v } } { { \mathrm { v o l } } ( V ) } } \log { \frac { d _ { v } } { { \mathrm { v o l } } ( V ) } } .
|
| 417 |
+
$$
|
| 418 |
+
|
| 419 |
+
474 By Shannon’s noiseless coding theorem, $\mathcal { H } ^ { ( 1 ) } ( G )$ is the limit of average code length generated from
|
| 420 |
+
475 the memoryless source for one step of the random walk. However, dependence of locations may
|
| 421 |
+
476 shorten the code length. For each level on cluster trees, the uncertainty of locations is measured by
|
| 422 |
+
477 the entropy of the stationary distribution on the clusters of this level. Consider an encoding for every
|
| 423 |
+
478 cluster, including the leaves. Each non-root node $\alpha$ is labeled by its order among the children of
|
| 424 |
+
479 its parent $\alpha ^ { - }$ . So the amount of self-information of $\alpha$ within this local parent-children substructure
|
| 425 |
+
480 is $\bar { - } \log ( \mathrm { v o l } ( \alpha ) / \mathrm { v o l } ( \alpha ^ { - } ) )$ , which is also roughly the length of Shannon code for $\alpha$ and its siblings.
|
| 426 |
+
481 The codeword of $\alpha$ consists of the sequential labels of nodes along the unique path from the root
|
| 427 |
+
482 (excluded) to itself (included). The key idea is as follows. For one step of the random walk from $u$ to
|
| 428 |
+
483 $v$ in $G$ , to indicate $v$ , we omit from $v$ ’s codeword the longest common prefix of $u$ and $v$ that is exactly
|
| 429 |
+
484 the codeword of $u \vee v$ . This means that the random walk takes this step in the cluster $u \vee v$ (and
|
| 430 |
+
485 also in $u \vee v$ ’s ancestors) and the uncertainty at this level may not be involved. Therefore, intuitively,
|
| 431 |
+
486 a quality similarity-based cluster tree would trap the random walk with high frequency in the deep
|
| 432 |
+
487 clusters that are far from the root, and long codeword of $u \vee v$ would be omitted. This shortens the
|
| 433 |
+
488 average code length of the random walk. Note that we ignore the uniqueness of decoding since a
|
| 434 |
+
489 practical design of codewords is not our purpose. We utilize this scheme to evaluate and differentiate
|
| 435 |
+
490 hierarchical structures.
|
| 436 |
+
491 Then we formulate the above scheme and measure the average code length as follows. Given a
|
| 437 |
+
492 weighted graph $G = ( V , E , w )$ and a cluster tree $T$ for $G$ , note that under the stationary distribution,
|
| 438 |
+
493 the random walk takes one step out of a cluster $\alpha$ on $T$ with probability $g _ { \alpha } / { \mathrm { v o l } } ( V )$ . Therefore, the
|
| 439 |
+
494 aforementioned uncertainty measured by the average code length is
|
| 440 |
+
|
| 441 |
+
$$
|
| 442 |
+
\mathcal { H } ^ { T } ( G ) = - \sum _ { \alpha \in T } \frac { g _ { \alpha } } { \mathrm { v o l } ( V ) } \log \frac { \mathrm { v o l } ( \alpha ) } { \mathrm { v o l } ( \alpha ^ { - } ) } ,
|
| 443 |
+
$$
|
| 444 |
+
|
| 445 |
+
495 which is defined as the structural entropy of $G$ on $T$ . To minimize this uncertainty, the structural
|
| 446 |
+
496 entropy $\mathcal { H } ( G )$ of $G$ is defined as the minimum one among all cluster trees. Note that the structural
|
| 447 |
+
497 entropy of $G$ on the trivial 1-level cluster tree is consistent with the previously defined $\mathcal { H } ^ { ( 1 ) } ( G )$ . It
|
| 448 |
+
498 doesn’t have any non-trivial cluster.
|
| 449 |
+
|
| 450 |
+
# 499 B Proof of Proposition 2.1
|
| 451 |
+
|
| 452 |
+
500 Proof. For each internal node $\alpha$ on $T$ , denote by $\partial ( \alpha )$ the sets of edges in $G$ with exactly one
|
| 453 |
+
501 end-point in the set of vertices corresponding to $\alpha$ $\begin{array} { r } { \chi _ { * } \operatorname { S o } g _ { \alpha } = \sum _ { e \in \partial ( \alpha ) } w \bar { ( } e ) } \end{array}$ . Note that
|
| 454 |
+
|
| 455 |
+
$$
|
| 456 |
+
\begin{array} { r c l } { \mathcal { H } ^ { T } ( G ) } & { = } & { \displaystyle - \sum _ { \alpha \in T } \frac { g _ { \alpha } } { \mathrm { v o l } ( V ) } \log \frac { \mathrm { v o l } ( \alpha ) } { \mathrm { v o l } ( \alpha ^ { - } ) } } \\ & { = } & { \displaystyle - \sum _ { \alpha \in T } \displaystyle \sum _ { ( u , v ) \in \partial ( \alpha ) } \frac { w ( u , v ) } { \mathrm { v o l } ( V ) } \log \frac { \mathrm { v o l } ( \alpha ) } { \mathrm { v o l } ( \alpha ^ { - } ) } } \\ & { = } & { \displaystyle - \sum _ { ( u , v ) \in E } \left( \frac { w ( u , v ) } { \mathrm { v o l } ( V ) } \sum _ { \alpha : ( u , v ) \in g _ { \alpha } } \log \frac { \mathrm { v o l } ( \alpha ) } { \mathrm { v o l } ( \alpha ^ { - } ) } \right) . } \end{array}
|
| 457 |
+
$$
|
| 458 |
+
|
| 459 |
+
502 For a single edge $( u , v ) \in E$ , all the terms $\log ( \mathrm { v o l } ( \alpha ) / \mathrm { v o l } ( \alpha ^ { - } ) )$ for leaf $u$ satisfying $( u , v ) \in g _ { \alpha }$
|
| 460 |
+
503 sum (over $\alpha$ ) up to $\log ( d _ { u } / \mathrm { v o l } ( u \vee v ) )$ along the unique path from $u$ to $u \vee v$ . It is symmetric for $v$
|
| 461 |
+
504 Therefore, considering ordered pair $( u , v ) \in E$ ,
|
| 462 |
+
|
| 463 |
+
$$
|
| 464 |
+
\begin{array} { r c l } { \mathcal { H } ^ { T } ( G ) } & { = } & { - \displaystyle \sum _ { \mathrm { \tiny ~ o r d e r e d ~ } ( u , v ) \in E } \frac { w ( u , v ) } { \mathrm { v o l } ( V ) } \log \frac { d _ { u } } { \mathrm { v o l } ( u \vee v ) } } \\ & { = } & { \displaystyle \frac { 1 } { \mathrm { v o l } ( V ) } \left( - \sum _ { u \in V } d _ { u } \log d _ { u } + \sum _ { \mathrm { \tiny ~ o r d e r d ~ } ( u , v ) \in E } w ( u , v ) \log \mathrm { v o l } ( u \vee v ) \right) } \\ & { = } & { \displaystyle \frac { 1 } { \mathrm { v o l } ( V ) } \left( - \sum _ { u \in V } d _ { u } \log d _ { u } + 2 \cdot \sum _ { ( u , v ) \in E } w ( u , v ) \log \mathrm { v o l } ( u \vee v ) \right) . } \end{array}
|
| 465 |
+
$$
|
| 466 |
+
|
| 467 |
+
505 The second equality follows from the fact $\begin{array} { r } { \sum _ { u \in V } d _ { u } = \sum _ { \mathrm { o r d e r e d } ( u , v ) \in E } w ( u , v ) = \mathrm { v o l } ( V ) } \end{array}$ and the
|
| 468 |
+
506 last equality from the symmetry of $( u , v )$ . Since the first summation is independent of $T$ , Proposition
|
| 469 |
+
507 2.1 follows. □
|
| 470 |
+
|
| 471 |
+
# C Proof of Proposition 2.2
|
| 472 |
+
|
| 473 |
+
We restate Proposition 2.2 as follows.
|
| 474 |
+
|
| 475 |
+
Theorem 2.2. For any positive integer n, let $K _ { n }$ be the clique of n vertices with identical weight on every edge. Then a cluster tree $T$ of $K _ { n }$ achieves minimum structural entropy if and only if $T$ is $a$ balanced binary tree, that is, the two children clusters of each sub-tree of $T$ have difference in size at most 1.
|
| 476 |
+
|
| 477 |
+
Note that a balanced binary tree (BBT for abbreviation) means the tree is balanced on every internal node. Formally, for an internal node of cluster size $k$ , its two sub-trees are of cluster sizes $\lfloor \dot { k } / 2 \rfloor$ and $\lceil k / 2 \rceil$ , respectively.
|
| 478 |
+
|
| 479 |
+
517 For cliques, since the weights of each edge are identical, we assume it safely to be 1. By Theorem
|
| 480 |
+
518 2.1, minimizing the structural entropy is equivalent to minimizing the cost function (over $T$ )
|
| 481 |
+
|
| 482 |
+
$$
|
| 483 |
+
\begin{array} { l c l } { \displaystyle \cos t ^ { T } ( G ) } & { = } & { \displaystyle \sum _ { ( u , v ) \in E } \log \mathrm { v o l } ( u \vee v ) } \\ { \displaystyle } & { = } & { \displaystyle \sum _ { ( u , v ) \in E } \log \left( ( n - 1 ) | u \vee v | \right) } \\ { \displaystyle } & { = } & { \displaystyle \sum _ { ( u , v ) \in E } \log ( n - 1 ) + \sum _ { ( u , v ) \in E } \log | u \vee v | } \end{array}
|
| 484 |
+
$$
|
| 485 |
+
|
| 486 |
+
519 Since the first term in the last equation is independent of $T$ , the optimization turns to minimizing
|
| 487 |
+
520 the last term, which we denote by $\Gamma ( T )$ . Grouping all edges in $E$ by LCA of two end-points, the
|
| 488 |
+
521 cost $\Gamma ( T )$ can be written as the sum of the cost $\gamma$ at every internal node $N$ of $T$ . Formally, for every
|
| 489 |
+
522 internal node $N$ , let $A , B \subseteq V$ be the leaves of the sub-trees rooted at the left and right child of $N$ ,
|
| 490 |
+
523 respectively. We have
|
| 491 |
+
|
| 492 |
+
$$
|
| 493 |
+
\begin{array} { r c l } { { \Gamma ( T ) } } & { { = } } & { { \displaystyle \sum _ { N } \gamma ( N ) } } \\ { { } } & { { } } & { { } } \\ { { \gamma ( N ) } } & { { = } } & { { \displaystyle \left( \sum _ { x \in A , y \in B } 1 \right) \cdot \log \left( | A | + | B | \right) } } \\ { { } } & { { } } & { { } } \\ { { } } & { { = } } & { { | A | \cdot | B | \cdot \log ( | A | + | B | ) } } \end{array}
|
| 494 |
+
$$
|
| 495 |
+
|
| 496 |
+
524 Now we only have to show the following lemma.
|
| 497 |
+
|
| 498 |
+
25 Lemma C.1. For any positive integer $n$ , a cluster tree $T$ of $K _ { n }$ achieves minimum cost $\Gamma ( T )$ if and
|
| 499 |
+
26 only if T is a BBT.
|
| 500 |
+
527 Proof. Lemma C.1 is proved by induction on $| V |$ . The key technique of tree swapping we use here
|
| 501 |
+
28 is inspired by Cohen-Addad et al [4]. The basis step holds since for $| V | = 2$ or 3, the cluster tree is
|
| 502 |
+
29 balanced and unique. It certainly achieves the minimum cost exclusively.
|
| 503 |
+
|
| 504 |
+
Now, consider a clique $G = ( V , E )$ with $n = | V | \geq 4$ . Let $T _ { 1 }$ be an arbitrary unbalanced cluster tree and $\lambda$ be its root. We need to prove that the cost $\Gamma ( T _ { 1 } )$ does not achieve the minimum. Without loss of generality, we can safely assume the root node is unbalanced, since otherwise, we set $T _ { 1 }$ to be the sub-tree that is rooted at an unbalanced node. Let $T _ { 2 }$ be a tree with root $\lambda$ whose left and right sub-trees are BBTs such that they have the same sizes with the left and right sub-trees of $T _ { 1 }$ , respectively. Let $V _ { l l }$ , $V _ { l r }$ , $V _ { r l }$ and $V _ { r r }$ be the sets of nodes on the four sub-trees at the second level of $T _ { 2 }$ and $n _ { l l }$ , $n _ { l r }$ , $n _ { r l }$ and $n _ { r r }$ denote their sizes, respectively. Our proof is also available when some of them are empty. We always assume $n _ { l l } \le n _ { l r }$ and $n _ { r l } \geq n _ { r r }$ . Next, we construct $T _ { 3 }$ by swapping (transplanting) $V _ { l r }$ and $V _ { r l }$ with each other. Finally, let $T _ { 4 }$ be a tree with root $\lambda$ whose left and right sub-trees are BBTs after balancing the left and right sub-trees of $T _ { 3 }$ . So $T _ { 4 }$ is a BBT. Then we only have to prove that $\Gamma ( T _ { 1 } ) > \Gamma ( T _ { 4 } ) \quad$ . Note that the strict $\mathit { \Theta } ^ { \bullet } > \mathit { \Theta } ^ { \bullet }$ is necessary since we need to negate all unbalanced cluster trees.
|
| 505 |
+
|
| 506 |
+
Then we show that the transformation process that consists of the above three steps makes the cost decrease step by step. Formally,
|
| 507 |
+
|
| 508 |
+
(a) $T _ { 1 }$ to $T _ { 2 }$ . The sub-trees of $T _ { 1 }$ become BBTs in $T _ { 2 }$ . Since the number of edges whose end-points treat the root as LCA is the same, by induction we have $\Gamma ( T _ { 1 } ) \geq \Gamma ( \bar { T } _ { 2 } )$ .
|
| 509 |
+
(b) $T _ { 2 }$ to $T _ { 3 }$ . We will show that $\Gamma ( T _ { 2 } ) > \Gamma ( T _ { 3 } )$ in Lemma C.2.
|
| 510 |
+
(c) $T _ { 3 }$ to $T _ { 4 }$ . The sub-trees of $T _ { 3 }$ become BBTs in $T _ { 4 }$ . For the same reason as (a), we have $\Gamma ( T _ { 3 } ) \geq \Gamma ( T _ { 4 } )$ .
|
| 511 |
+
|
| 512 |
+
Putting them together, we get $\Gamma ( T _ { 1 } ) > \Gamma ( T _ { 4 } )$ and Lemma C.1 follows.
|
| 513 |
+
|
| 514 |
+
Lemma C.2. After swapping $V _ { l r }$ and $V _ { r l }$ , we obtain $T _ { 3 }$ from $T _ { 2 }$ , for which $\Gamma ( T _ { 2 } ) > \Gamma ( T _ { 3 } )$ .
|
| 515 |
+
|
| 516 |
+
552 Proof. We only need to consider the changes in cost of three nodes: root and its left and right
|
| 517 |
+
553 children, since the cost contributed by each of the remaining nodes does not change after swapping.
|
| 518 |
+
554 Ignoring the unchanged costs, define
|
| 519 |
+
|
| 520 |
+
$$
|
| 521 |
+
\begin{array} { l l l } { { \displaystyle \mathrm { c o s t } ( T _ { 2 } ) } } & { { = } } & { { { n _ { l } } { n _ { r } } \log { n } + { n _ { l l } } { n _ { l r } } \log { n _ { l } } + { n _ { r l } } { n _ { r r } } \log { n _ { r } } } } \\ { { \displaystyle } } & { { = } } & { { { n _ { l } } { n _ { r } } \log { n } + \left\lfloor \displaystyle \frac { { n _ { l } } } { 2 } \right\rfloor \left\lceil \displaystyle \frac { { n _ { l } } } { 2 } \right\rceil \log { n _ { l } } + \left\lceil \displaystyle \frac { { n _ { r } } } { 2 } \right\rceil \left\lfloor \displaystyle \frac { { n _ { r } } } { 2 } \right\rfloor \log { n _ { r } } , } } \end{array}
|
| 522 |
+
$$
|
| 523 |
+
|
| 524 |
+
555 where $n _ { l } = n _ { l l } + n _ { l r }$ , $n _ { r } = n _ { r l } + n _ { r r }$ . Both of them are at least 1. Similarly, define
|
| 525 |
+
|
| 526 |
+
$$
|
| 527 |
+
{ \begin{array} { r c l } { \operatorname { o s t } ( T _ { 3 } ) } & { = } & { ( n _ { l l } + n _ { r l } ) ( n _ { l r } + n _ { r r } ) \log n + n _ { l l } n _ { r l } \log \left( n _ { l l } + n _ { r l } \right) + n _ { l r } n _ { r r } \log \left( n _ { l r } + n _ { r r } \right) } \\ & { = } & { \left\lfloor { \frac { n } { 2 } } \right\rfloor \left\lceil { \frac { n } { 2 } } \right\rceil \log n + \left\lfloor { \frac { n _ { l } } { 2 } } \right\rfloor \left\lceil { \frac { n _ { r } } { 2 } } \right\rceil \log \left( \left\lfloor { \frac { n _ { l } } { 2 } } \right\rfloor + \left\lceil { \frac { n _ { r } } { 2 } } \right\rceil \right) + \left\lceil { \frac { n _ { l } } { 2 } } \right\rceil \left\lfloor { \frac { n _ { r } } { 2 } } \right\rfloor \log \left( \left\lceil { \frac { n _ { l } } { 2 } } \right\rceil + \left\lfloor { \frac { n _ { r } } { 2 } } \right\rfloor \right) } \end{array} }
|
| 528 |
+
$$
|
| 529 |
+
|
| 530 |
+
556 Denote
|
| 531 |
+
|
| 532 |
+
$$
|
| 533 |
+
\begin{array} { r c l } { { \Delta } } & { { = } } & { { \Gamma ( T _ { 2 } ) - \Gamma ( T _ { 3 } ) } } \\ { { } } & { { = } } & { { \displaystyle \mathrm { c o s t } ( T _ { 2 } ) - \mathrm { c o s t } ( T _ { 3 } ) } } \\ { { } } & { { = } } & { { \displaystyle \left\lfloor \frac { n _ { l } } { 2 } \right\rfloor \left\lceil \frac { n _ { l } } { 2 } \right\rceil \log \left( \frac { n _ { l } } { n } \right) + \left\lceil \frac { n _ { r } } { 2 } \right\rceil \left\lfloor \frac { n _ { r } } { 2 } \right\rfloor \log \left( \frac { n _ { r } } { n } \right) } } \\ { { } } & { { } } & { { - \left\lfloor \frac { n _ { l } } { 2 } \right\rfloor \left\lceil \frac { n _ { r } } { 2 } \right\rceil \log \left( \frac { \left\lfloor \frac { n _ { l } } { 2 } \right\rfloor + \left\lceil \frac { n _ { r } } { 2 } \right\rceil } { n } \right) - \left\lceil \frac { n _ { l } } { 2 } \right\rceil \left\lfloor \frac { n _ { r } } { 2 } \right\rfloor \log \left( \frac { \left\lceil \frac { n _ { l } } { 2 } \right\rceil + \left\lfloor \frac { n _ { r } } { 2 } \right\rfloor } { n } \right) } } \end{array}
|
| 534 |
+
$$
|
| 535 |
+
|
| 536 |
+
557 So we only have to show that $\Delta > 0$ . We consider the following three cases according to the odevity
|
| 537 |
+
558 of $n _ { l }$ and $n _ { r }$ .
|
| 538 |
+
|
| 539 |
+
Case 1: $n _ { l }$ and $n _ { r }$ are even.
|
| 540 |
+
|
| 541 |
+
Case 2: $n _ { l }$ and $n _ { r }$ are odd.
|
| 542 |
+
|
| 543 |
+
Case 3: $n _ { l }$ is odd while $n _ { r }$ is even.
|
| 544 |
+
|
| 545 |
+
The case that $n _ { l }$ is even while $n _ { r }$ is odd is symmetric to Case 3.
|
| 546 |
+
|
| 547 |
+
63 For Case 1, if both $n _ { l }$ and $n _ { r }$ are even, then notations of rounding in Eq. (2) can be removed and $\Delta$
|
| 548 |
+
64 can be simplified as
|
| 549 |
+
|
| 550 |
+
$$
|
| 551 |
+
\Delta = \frac { n _ { l } ^ { 2 } } { 4 } \log \left( \frac { n _ { l } } { n } \right) + \frac { n _ { r } ^ { 2 } } { 4 } \log \left( \frac { n _ { r } } { n } \right) + \frac { n _ { l } n _ { r } } { 2 } .
|
| 552 |
+
$$
|
| 553 |
+
|
| 554 |
+
565 Let $p = n _ { l } / n , q = n _ { r } / n$ , and so $p + q = 1$ . Recall that $T _ { 1 }$ is unbalanced on the root $\lambda$ , so is $T _ { 2 }$ Thus 566 $p \neq q$ . Multiplying by $\textstyle { \frac { 4 } { n ^ { 2 } } }$ on both sides, we only have to prove that
|
| 555 |
+
|
| 556 |
+
$$
|
| 557 |
+
p ^ { 2 } \log p + q ^ { 2 } \log q + 2 p q > 0 .
|
| 558 |
+
$$
|
| 559 |
+
|
| 560 |
+
That is,
|
| 561 |
+
|
| 562 |
+
$$
|
| 563 |
+
\frac { p } { q } \log p + \frac { q } { p } \log q + 2 > 0 .
|
| 564 |
+
$$
|
| 565 |
+
|
| 566 |
+
Let 567 $\begin{array} { r } { g ( x ) = \frac { x } { 1 - x } \log x } \end{array}$ . Then we only need to show that $g ( p ) + g ( q ) + 2 > 0$ when $p \neq q$ . Since
|
| 567 |
+
|
| 568 |
+
$$
|
| 569 |
+
\begin{array} { r c l } { { g ^ { \prime } ( x ) } } & { { = } } & { { \displaystyle \frac { ( 1 - x ) + \ln x } { \ln 2 \cdot ( 1 - x ) ^ { 2 } } , } } \\ { { } } & { { } } & { { } } \\ { { g ^ { \prime \prime } ( x ) } } & { { = } } & { { \displaystyle - \frac { x ^ { 2 } - 2 x \ln x - 1 } { \ln 2 \cdot x ( 1 - x ) ^ { 3 } } . } } \end{array}
|
| 570 |
+
$$
|
| 571 |
+
|
| 572 |
+
It is easy to check that $g ^ { \prime \prime } ( x ) > 0$ when $0 < x < 1$ . So $g ( x )$ is strictly convex in the interval $( 0 , 1 )$ . Since $p \neq q$ ,
|
| 573 |
+
|
| 574 |
+
$$
|
| 575 |
+
g ( p ) + g ( q ) > 2 g \left( \frac { p + q } { 2 } \right) = - 2 .
|
| 576 |
+
$$
|
| 577 |
+
|
| 578 |
+
568 Thus $\Delta > 0$ holds.
|
| 579 |
+
|
| 580 |
+
569 For Case 2, if both $n _ { l }$ and $n _ { r }$ are odd, then $\Delta$ can be split into two parts $\Delta = \Delta _ { 1 } + \Delta _ { 2 }$ , in which
|
| 581 |
+
|
| 582 |
+
$$
|
| 583 |
+
\begin{array} { l c l } { \Delta _ { 1 } } & { = } & { \displaystyle \frac { n _ { l } ^ { 2 } } { 4 } \log \left( \frac { n _ { l } } { n } \right) + \frac { n _ { r } ^ { 2 } } { 4 } \log \left( \frac { n _ { r } } { n } \right) + \frac { n _ { l } n _ { r } } { 2 } } \\ { \Delta _ { 2 } } & { = } & { \displaystyle - \frac { 1 } { 4 } \log \left( \frac { n _ { l } } { n } \right) - \frac { 1 } { 4 } \log \left( \frac { n _ { r } } { n } \right) - \frac { 1 } { 2 } } \end{array}
|
| 584 |
+
$$
|
| 585 |
+
|
| 586 |
+
570 Since we have shown that $\Delta _ { 1 } > 0$ , if we can prove $\Delta _ { 2 } \geq 0$ , then the lemma will hold for Case 2.
|
| 587 |
+
571 Due to the convexity of logarithmic function, this holds clearly since
|
| 588 |
+
|
| 589 |
+
$$
|
| 590 |
+
2 \log \left( \frac { n } { 2 } \right) \geq \log n _ { l } + \log n _ { r } .
|
| 591 |
+
$$
|
| 592 |
+
|
| 593 |
+
For Case 3, if 572 $n _ { l }$ is odd while $n _ { r }$ is even,
|
| 594 |
+
|
| 595 |
+
$$
|
| 596 |
+
\Delta = \frac { n _ { l } ^ { 2 } - 1 } { 4 } \log { \left( \frac { n _ { l } } { n } \right) } + \frac { n _ { r } ^ { 2 } } { 4 } \log { \left( \frac { n _ { r } } { n } \right) } - \left[ \frac { ( n _ { l } - 1 ) n _ { r } } { 4 } \log { \left( \frac { n - 1 } { 2 n } \right) } + \frac { ( n _ { l } + 1 ) n _ { r } } { 4 } \log { \left( \frac { n + 1 } { 2 n } \right) } \right] .
|
| 597 |
+
$$
|
| 598 |
+
|
| 599 |
+
$$
|
| 600 |
+
4 \ln 2 ) \Delta = ( n _ { l } ^ { 2 } - 1 ) \ln \left( \frac { n _ { l } } { n } \right) + n _ { r } ^ { 2 } \ln \left( \frac { n _ { r } } { n } \right) - \left[ ( n _ { l } - 1 ) n _ { r } \ln \left( \frac { n - 1 } { 2 n } \right) + ( n _ { l } + 1 ) n _ { r } \ln \left( \frac { n + 1 } { 2 n } \right) \right] .
|
| 601 |
+
$$
|
| 602 |
+
|
| 603 |
+
574 Splitting the right hand side into two parts,
|
| 604 |
+
|
| 605 |
+
$$
|
| 606 |
+
\begin{array} { l c l } { { A } } & { { = } } & { { \displaystyle n _ { l } ^ { 2 } \ln \left( \frac { n _ { l } } { n } \right) + n _ { r } ^ { 2 } \ln \left( \frac { n _ { r } } { n } \right) + 2 n _ { l } n _ { r } \ln 2 } } \\ { { } } & { { } } & { { } } \\ { { B } } & { { = } } & { { \displaystyle - \ln \left( \frac { n _ { l } } { n } \right) - ( n _ { l } + 1 ) n _ { r } \ln \left( 1 + \frac { 1 } { n } \right) - ( n _ { l } - 1 ) n _ { r } \ln \left( 1 - \frac { 1 } { n } \right) } } \end{array}
|
| 607 |
+
$$
|
| 608 |
+
|
| 609 |
+
575 Since $n$ is odd and the root $\lambda$ of $T _ { 2 }$ is unbalanced, we only need to consider the case that $n _ { l } =$
|
| 610 |
+
576 $( n - i ) / 2$ , $n _ { r } = ( n + i ) / 2$ (Note that $n _ { l }$ and $n _ { r }$ are symmetric. So if $( n - i ) / 2$ is even, exchange
|
| 611 |
+
577 $n _ { l }$ and $n _ { r }$ ), where both $n$ and $i$ are odd satisfying $n > i \geq 3$ . Next we show that in this case,
|
| 612 |
+
578 $A \geq \ln ( 1 / 5 ) + 4 ^ { 2 } \ln ( 4 / 5 ) + 2 \cdot 4 \ln 2$ and $\dot { B } > \ln 2 - 3 / 4 - ( 2 / 3 ) \cdot ( 1 / 5 ^ { 2 } )$ . By calculation,
|
| 613 |
+
579 $\Delta = A + B > 0$ for Case 3.
|
| 614 |
+
|
| 615 |
+
Claim C.1. 580 $A \geq \ln ( 1 / 5 ) + 4 ^ { 2 } \ln ( 4 / 5 ) + 2 \cdot 4 \ln 2$ for odd integers $n > i \geq 3$ .
|
| 616 |
+
|
| 617 |
+
581 Proof. Substituting $n _ { l } = ( n - i ) / 2$ , $n _ { r } = ( n + i ) / 2$ into the $A$ yields
|
| 618 |
+
|
| 619 |
+
$$
|
| 620 |
+
A = C ( n , i ) \triangleq \left( { \frac { n - i } { 2 } } \right) ^ { 2 } \ln \left( { \frac { n - i } { 2 n } } \right) + \left( { \frac { n + i } { 2 } } \right) ^ { 2 } \ln \left( { \frac { n + i } { 2 n } } \right) + 2 \cdot { \frac { n - i } { 2 } } \cdot { \frac { n + i } { 2 } } \ln 2 .
|
| 621 |
+
$$
|
| 622 |
+
|
| 623 |
+
582 Treat $n$ as a continuous variable, we have
|
| 624 |
+
|
| 625 |
+
$$
|
| 626 |
+
\frac { \partial C ( n , i ) } { \partial n } = \frac { 1 } { 2 } \left[ ( n + i ) \ln \left( 1 + \frac { i } { n } \right) + ( n - i ) \ln \left( 1 - \frac { i } { n } \right) - \frac { i ^ { 2 } } { n } \right]
|
| 627 |
+
$$
|
| 628 |
+
|
| 629 |
+
583 Multiplying the above equation by $2 / n$ and setting $x = i / n$ yields
|
| 630 |
+
|
| 631 |
+
$$
|
| 632 |
+
\begin{array} { r c l } { { f ( x ) } } & { { \triangleq } } & { { \displaystyle \left( 1 + x \right) \ln ( 1 + x ) + ( 1 - x ) \ln ( 1 - x ) - x ^ { 2 } , } } \\ { { f ^ { \prime } ( x ) } } & { { = } } & { { \ln ( 1 + x ) - \ln ( 1 - x ) - 2 x , } } \\ { { f ^ { \prime \prime } ( x ) } } & { { = } } & { { \displaystyle \frac { 2 x ^ { 2 } } { 1 - x ^ { 2 } } . } } \end{array}
|
| 633 |
+
$$
|
| 634 |
+
|
| 635 |
+
584 It is easy to check that $f ( 0 ) = 0$ and $f ^ { \prime } ( 0 ) = 0$ . When $0 < x < 1$ , $f ^ { \prime \prime } ( x ) > 0$ . Thus $f ^ { \prime } ( x ) > 0$ and
|
| 636 |
+
585 $f ( x ) > 0$ . This means that $\partial C ( n , i ) / \partial n > 0$ for all $n > 0$ . So $C ( n , i ) \geq C ( i + 2 , i )$ for $n \geq i + 2$
|
| 637 |
+
586 (When $i$ is fixed, the minimum value of $n$ can be taken to $i + 2$ , which makes $n _ { l } = ( n - i ) / 2$ and
|
| 638 |
+
587 $n _ { r } = ( n + i ) / 2$ integral). The curves of $C ( n , i )$ for varying $i$ are plotted in Figure 2.
|
| 639 |
+
588 When $n = i + 2$ , we get $n _ { l } = ( n - i ) / 2 = 1$ and $n _ { r } = ( n + i ) / 2 = n - 1$ . Substituting them into
|
| 640 |
+
589 $A$ yields
|
| 641 |
+
|
| 642 |
+

|
| 643 |
+
Figure 2: Functions $C ( n , i )$
|
| 644 |
+
|
| 645 |
+
$$
|
| 646 |
+
\begin{array} { r c l } { { { \cal D } ( n ) } } & { { \triangleq } } & { { \displaystyle \ln \left( \frac { 1 } { n } \right) + ( n - 1 ) ^ { 2 } \ln \left( 1 - \frac { 1 } { n } \right) + 2 ( n - 1 ) \ln 2 , } } \\ { { \displaystyle \frac { d { \cal D } } { d n } } } & { { = } } & { { \displaystyle 1 - \frac { 2 } { n } + 2 \ln 2 + 2 ( n - 1 ) \ln \left( 1 - \frac { 1 } { n } \right) . } } \end{array}
|
| 647 |
+
$$
|
| 648 |
+
|
| 649 |
+
590 When $n > 2$ , it is easy to check that $d D / d n > 0$ . So the minimum value of $d ( n )$ , which is also the
|
| 650 |
+
591 minimum value of $\dot { C ( i + 2 , i ) }$ , is achieved at $n = i + 2 = 5$ . So $A = C ( n , i ) \geq C ( i + 2 , i ) \geq$
|
| 651 |
+
592 $C ( 5 , 3 ) = \ln ( 1 / 5 ) + 4 ^ { 2 } \ln ( 4 / 5 ) + 2 \cdot 4 \ln 2$ . □
|
| 652 |
+
|
| 653 |
+
Claim C.2. 593 $B > \ln 2 - 3 / 4 - ( 2 / 3 ) \cdot ( 1 / 5 ^ { 2 } ) .$ .
|
| 654 |
+
|
| 655 |
+
594 Proof. Due to the facts that
|
| 656 |
+
|
| 657 |
+
$$
|
| 658 |
+
{ \begin{array} { r c c c } { \ln \left( 1 + { \cfrac { 1 } { n } } \right) } & { < } & { { \cfrac { 1 } { n } } - { \cfrac { 1 } { 2 n ^ { 2 } } } + { \cfrac { 1 } { 3 n ^ { 3 } } } , } \\ { \ln \left( 1 - { \cfrac { 1 } { n } } \right) } & { < } & { - { \cfrac { 1 } { n } } - { \cfrac { 1 } { 2 n ^ { 2 } } } - { \cfrac { 1 } { 3 n ^ { 3 } } } , } \end{array} }
|
| 659 |
+
$$
|
| 660 |
+
|
| 661 |
+
595 we have
|
| 662 |
+
|
| 663 |
+
$$
|
| 664 |
+
\begin{array} { r c l } { B } & { = } & { \displaystyle - \ln \left( \frac { n _ { l } } { n } \right) - ( n _ { l } + 1 ) n _ { r } \ln \left( 1 + \frac { 1 } { n } \right) - ( n _ { l } - 1 ) n _ { r } \ln \left( 1 - \frac { 1 } { n } \right) } \\ & { > } & { \displaystyle - \ln \left( \frac { n _ { l } } { n } \right) + \frac { n _ { l } n _ { r } } { n ^ { 2 } } - \frac { 2 n _ { r } } { n } - \frac { 2 n _ { r } } { 3 n ^ { 3 } } } \\ & { > } & { \displaystyle - \ln \left( \frac { n _ { l } } { n } \right) + \frac { n _ { l } n _ { r } } { n ^ { 2 } } - \frac { 2 n _ { r } } { n } - \frac { 2 } { 3 n ^ { 2 } } . } \end{array}
|
| 665 |
+
$$
|
| 666 |
+
|
| 667 |
+
596 Let $\alpha = n _ { l } / n$ , then
|
| 668 |
+
|
| 669 |
+
$$
|
| 670 |
+
\begin{array} { l l l } { { B } } & { { > } } & { { \displaystyle - \ln \alpha + \alpha ( 1 - \alpha ) - 2 ( 1 - \alpha ) - \frac { 2 } { 3 n ^ { 2 } } } } \\ { { } } & { { \geq } } & { { \ln 2 - \displaystyle \frac { 3 } { 4 } - \frac { 2 } { 3 n ^ { 2 } } . } } \end{array}
|
| 671 |
+
$$
|
| 672 |
+
|
| 673 |
+
When 597 $n \geq 5$ $5 , B > \ln 2 - 3 / 4 - ( 2 / 3 ) \cdot ( 1 / 5 ^ { 2 } )$ .
|
| 674 |
+
|
| 675 |
+
8 Combining Claims C.1 and C.2, Lemma C.2 follows.
|
| 676 |
+
|
| 677 |
+
99 This completes the proof of Proposition 2.2.
|
| 678 |
+
|
| 679 |
+
# 600 D Proof of Theorem 3.1
|
| 680 |
+
|
| 681 |
+
Proof. Note that $\operatorname { c o s t } ^ { T } ( G )$ for any cluster tree $T$ has a trivial upper bound. That is,
|
| 682 |
+
|
| 683 |
+
$$
|
| 684 |
+
\cos \mathsf { t } ^ { T } ( G ) = \sum _ { e \in E } \mathsf { c o s t } ^ { T } ( e ) \leq \sum _ { e \in E } w _ { e } \cdot \log ( \mathsf { v o l } ( G ) ) \leq \frac { \mathsf { v o l } ( G ) \cdot \log ( \mathsf { v o l } ( G ) ) } { 2 } ,
|
| 685 |
+
$$
|
| 686 |
+
|
| 687 |
+
601 where $\mathrm { c o s t } ^ { T } ( e ) = w _ { e } \log \mathrm { v o l } ( \mathrm { L C A } _ { T } ( e ) )$ . Let $T ^ { * }$ be the optimal cluster tree that achieves the mini
|
| 688 |
+
602 mum cost, we present here a lower bound for $\mathrm { c o s t } ^ { T ^ { * } } ( G )$ . Referring to the dense branch technique
|
| 689 |
+
603 [10, 15], we start with the root node $A _ { 0 }$ and walk along $T ^ { * }$ recursively as follows: at every internal
|
| 690 |
+
604 node $A _ { i }$ , walk down to the node $A _ { i + 1 }$ of higher volume between its two children. This process stops
|
| 691 |
+
605 when we reach node $A _ { k }$ such that $\begin{array} { r } { \mathrm { v o l } _ { G } ( A _ { k } ) \le \frac { 2 \mathrm { v o l } ( G ) } { 3 } } \end{array}$ 2vol(G)3 . Denote A ≜ Ak as well as B ≜ V \Ak. By
|
| 692 |
+
606 construction, it holds that $\begin{array} { r } { \mathrm { v o l } _ { G } ( A ) > \frac { \mathrm { v o l } ( G ) } { 3 } } \end{array}$ and $\begin{array} { r } { \mathrm { v o l } _ { G } ( B ) \geq \frac { \mathrm { v o l } ( G ) } { 3 } } \end{array}$ . Moreover, $\begin{array} { r } { \mathrm { v o l } _ { G } ( A _ { i } ) > \frac { 2 \mathrm { v o l } ( G ) } { 3 } } \end{array}$
|
| 693 |
+
|
| 694 |
+
607 for every $0 \leq i < k$ . The basic idea behind the dense branch is that the $c u t ( A , B )$ has a significant contribution to 608 $c o s t ^ { T ^ { * } } ( G )$ .
|
| 695 |
+
|
| 696 |
+
$$
|
| 697 |
+
\begin{array} { r l } { c o s t ^ { T ^ { * } } ( G ) = \displaystyle \sum _ { e = \{ u , v \} } w _ { e } \cdot \log ( \mathsf { v o l } _ { G } ( u \vee v ) ) } & { } \\ { \ge \displaystyle \sum _ { e = \{ u , v \} } w _ { e } \cdot \log ( \mathsf { v o l } _ { G } ( u \vee v ) ) } & { } \\ { ~ } & { \displaystyle \sum _ { e \in E \{ A , B \} } \log \left( \frac { 2 \mathsf { v o l } ( G ) } { 3 } \right) . } \\ { ~ } & { \ge w ( A , B ) \cdot \log \left( \frac { 2 \mathsf { v o l } ( G ) } { 3 } \right) . } \\ { ~ } & { \ge \Phi ( G ) \cdot \displaystyle \frac { \mathsf { v o l } ( G ) } { 3 } \cdot \log \left( \frac { 2 \mathsf { v o l } ( G ) } { 3 } \right) . } \end{array}
|
| 698 |
+
$$
|
| 699 |
+
|
| 700 |
+
Let $T$ be an arbitrary cluster tree, and $T ^ { * }$ be an optimal tree. We have
|
| 701 |
+
|
| 702 |
+
$$
|
| 703 |
+
\frac { c o s t ^ { T } ( G ) } { c o s t ^ { T * } ( G ) } \leq \frac { 3 } { 2 \Phi ( G ) } \cdot \frac { \log ( \mathrm { v o l } ( G ) ) } { \log \left( \frac { 2 \mathrm { v o l } ( G ) } { 3 } \right) } = O ( \Phi ( G ) ^ { - 1 } ) .
|
| 704 |
+
$$
|
| 705 |
+
|
| 706 |
+
609
|
| 707 |
+
|
| 708 |
+
# 610 E Proof of Theorem 3.2
|
| 709 |
+
|
| 710 |
+
Proof. To prove Theorem 3.2, we only have to prove the following lemma. Then the theorem follows from a simplification of the approximation factor.
|
| 711 |
+
|
| 712 |
+
Lemma E.1. Let $\alpha ~ = ~ \operatorname* { m a x } _ { i } \{ \Phi _ { G } ( P _ { i } ) \}$ and $\beta ~ = ~ \mathrm { \ m i n } _ { i } \{ \Phi ( G [ P _ { i } ] ) \}$ . Algorithm 2 achieves $\begin{array} { r } { \bigg ( \Big ( \Big ( \log \Big ( \frac { 1 } { 1 - \alpha } \Big ) + 1 \Big ) + \frac { 2 \alpha } { 1 - \alpha } \left( 1 + \log \frac { k } { 1 - \alpha } \right) \Big ) \cdot \frac { 3 } { 2 \beta \log \left( \frac { 4 } { 3 } \right) } \bigg ) } \end{array}$ -approximation.
|
| 713 |
+
|
| 714 |
+
Proof. We group the edges of $\mathbf { G }$ into two categories: let $E _ { 1 }$ be the set of edges in the induced subgraphs $G [ P _ { i } ]$ for all $1 \leq i \leq l$ , i.e.,
|
| 715 |
+
|
| 716 |
+
$$
|
| 717 |
+
E _ { 1 } \triangleq \cup _ { i = 1 } ^ { l } E [ G [ P _ { i } ] ] ,
|
| 718 |
+
$$
|
| 719 |
+
|
| 720 |
+
and $E _ { 2 }$ be the remaining crossing edges. Then we have
|
| 721 |
+
|
| 722 |
+
$$
|
| 723 |
+
\mathrm { c o s t } ^ { T } ( G ) = \sum _ { e \in E _ { 1 } } \mathrm { c o s t } ^ { T } ( e ) + \sum _ { e \in E _ { 2 } } \mathrm { c o s t } ^ { T } ( e ) .
|
| 724 |
+
$$
|
| 725 |
+
|
| 726 |
+
We denote by ${ \mathrm { v o l } } ( G [ P _ { i } ] )$ the volume of the induced graph $G [ P _ { i } ]$ , by ${ \mathrm { v o l } } _ { G } ( P _ { i } )$ the volume of $P _ { i }$ in $G$ , and by parent $^ T ( \dot { P _ { i } } )$ the parent of $P _ { i }$ on $T$ . Then it holds for every $P _ { i }$ that
|
| 727 |
+
|
| 728 |
+
$$
|
| 729 |
+
\operatorname { v o l } _ { G } ( { \mathrm { p a r e n t } } ^ { T } ( P _ { i } ) ) \leq k \cdot \operatorname { v o l } _ { G } ( P _ { i } ) .
|
| 730 |
+
$$
|
| 731 |
+
|
| 732 |
+
By the construction of $T$ we have that
|
| 733 |
+
|
| 734 |
+
$$
|
| 735 |
+
\operatorname { v o l } _ { G } ( { \mathrm { p a r e n t } } ^ { T } ( P _ { i } ) ) = \sum _ { j = 1 } ^ { i } \operatorname { v o l } _ { G } ( P _ { j } ) \leq i \cdot \operatorname { v o l } _ { G } ( P _ { i } ) \leq k \cdot \operatorname { v o l } _ { G } ( P _ { i } ) .
|
| 736 |
+
$$
|
| 737 |
+
|
| 738 |
+
Note that
|
| 739 |
+
|
| 740 |
+
$$
|
| 741 |
+
\begin{array} { r l } & { w ( P _ { i } , V \backslash P _ { i } ) = \mathsf { v o l } _ { G } ( P _ { i } ) - \mathsf { v o l } ( G [ P _ { i } ] ) \leq \alpha \cdot \mathsf { v o l } _ { G } ( P _ { i } ) , } \\ & { \qquad ( 1 - \alpha ) \cdot \mathsf { v o l } _ { G } ( P _ { i } ) \leq \mathsf { v o l } ( G [ P _ { i } ] ) , } \end{array}
|
| 742 |
+
$$
|
| 743 |
+
|
| 744 |
+
and thus
|
| 745 |
+
|
| 746 |
+
$$
|
| 747 |
+
\operatorname { v o l } _ { G } ( { \mathrm { p a r e n t } } ^ { T } ( P _ { i } ) ) \leq k \cdot \operatorname { v o l } _ { G } ( P _ { i } ) \leq { \frac { k } { 1 - \alpha } } { \mathrm { v o l } } ( G [ P _ { i } ] ) .
|
| 748 |
+
$$
|
| 749 |
+
|
| 750 |
+
615 Combining the above, we have that
|
| 751 |
+
|
| 752 |
+
$$
|
| 753 |
+
\begin{array} { r c l } { \displaystyle \sum _ { \boldsymbol { \alpha } \in E _ { 1 } } \cos ^ { T } ( \boldsymbol { \epsilon } ) } & { \le } & { \displaystyle \sum _ { \boldsymbol { \epsilon } \in E _ { 1 } } w _ { \boldsymbol { \epsilon } } \cdot \log ( \mathsf { v o l } _ { G } ( P _ { i } ) ) } \\ & { \le } & { \displaystyle \sum _ { \boldsymbol { \epsilon } \in E _ { 1 } } w _ { \boldsymbol { \epsilon } } \cdot \log \left( \frac { 1 } { 1 - \boldsymbol { \alpha } } \operatorname { v o l } ( G [ P _ { i } ] ) \right) } \\ & { = } & { \displaystyle \sum _ { \boldsymbol { \epsilon } \in E _ { 1 } } \left( w _ { \boldsymbol { \epsilon } } \cdot \log \frac { 1 } { 1 - \boldsymbol { \alpha } } + w _ { \boldsymbol { \epsilon } } \cdot \log ( \operatorname { v o l } ( G [ P _ { i } ] ) ) \right) } \\ & { \le } & { \displaystyle \left( \log \frac { 1 } { 1 - \boldsymbol { \alpha } } + 1 \right) \cdot \sum _ { j = 1 } ^ { k } \frac { \operatorname { v o l } ( G [ P _ { i } ] ) \cdot \log ( \operatorname { v o l } ( G [ P _ { i } ] ) ) } { 2 } , } \end{array}
|
| 754 |
+
$$
|
| 755 |
+
|
| 756 |
+
616 and
|
| 757 |
+
|
| 758 |
+
$$
|
| 759 |
+
\begin{array} { r c l } { \displaystyle \sum _ { e \in E _ { 2 } } \cos \mathrm { t r } ^ { T } ( e ) } & { \le } & { \displaystyle \sum _ { j = 1 } ^ { k } w ( P _ { 1 } , V \backslash P _ { k } ) \cdot \log ( \mathsf { w d } _ { G } ( \mathsf { p a r e n t } ^ { T } ( P _ { i } ) ) ) } \\ & { \le } & { \displaystyle \sum _ { j = 1 } ^ { k } \frac { \alpha } { 1 - \alpha } \mathrm { v o l } ( G [ P _ { i } ] ) \log \left( \frac { k } { 1 - \alpha } \mathrm { v o l } ( G [ P _ { i } ] ) \right) } \\ & { \le } & { \displaystyle \sum _ { j = 1 } ^ { k } \frac { \alpha } { 1 - \alpha } \left( 1 + \log \frac { k } { 1 - \alpha } \right) \mathrm { v o l } ( G [ P _ { i } ] ) \log ( \mathsf { w l } ( G [ P _ { i } ] ) ) } \\ & { = } & { \displaystyle \frac { 2 \alpha } { 1 - \alpha } \left( 1 + \log \frac { k } { 1 - \alpha } \right) \cdot \displaystyle \sum _ { j = 1 } ^ { k } \frac { \mathrm { v o l } ( G [ P _ { i } ] ) \cdot \log ( \mathrm { w d } ( G [ P _ { i } ] ) ) } { 2 } . } \end{array}
|
| 760 |
+
$$
|
| 761 |
+
|
| 762 |
+
Let $T ^ { * }$ be the optimal cluster tree of $G$ , and $O P T _ { G }$ be the optimal value. We have
|
| 763 |
+
|
| 764 |
+
$$
|
| 765 |
+
O P T _ { G } = \mathsf { c o s t } _ { G } ( T ^ { * } ) \geq \sum _ { i = 1 } ^ { l } \sum _ { e \in E ( G [ P _ { i } ] ) } \mathsf { c o s t } _ { T ^ { * } } ( e ) \geq \sum _ { i = 1 } ^ { l } O P T _ { G [ P _ { i } ] } .
|
| 766 |
+
$$
|
| 767 |
+
|
| 768 |
+
Denote by
|
| 769 |
+
|
| 770 |
+
$$
|
| 771 |
+
h ( \alpha , k ) = \left( \left( \log \left( \frac { 1 } { 1 - \alpha } \right) + 1 \right) + \frac { 2 \alpha } { 1 - \alpha } \left( 1 + \log \frac { k } { 1 - \alpha } \right) \right) .
|
| 772 |
+
$$
|
| 773 |
+
|
| 774 |
+
617 We have
|
| 775 |
+
|
| 776 |
+
$$
|
| 777 |
+
\begin{array} { l l l } { \displaystyle \mathrm { c o s s } ^ { T } ( G ) } & { = } & { \displaystyle \sum _ { s \in { \bar { \mathbb { E } } } _ { k } } \mathrm { c o s s } ^ { T } ( e ) + \sum _ { s \in { \bar { \mathbb { E } } } _ { k } } \mathrm { c o s s } ^ { T } ( e ) } \\ { \ } & { \le } & { \displaystyle \hbar ( \alpha , k ) \cdot \sum _ { j = 1 } ^ { k } \frac { \sum _ { w \in [ 0 , 1 ] } \cdot 1 - \log ( \mathrm { c } ( P _ { k } | ) ) } { 2 } } \\ { \ } & { \le } & { \displaystyle \hbar ( \alpha , k ) \cdot \sum _ { j = 1 } ^ { k } \frac { \log ( | G | P _ { k , j } | ) \cdot 1 - \log ( \mathrm { c } ( P _ { k } | ) | ) } { 2 } } \\ { \ } & { \displaystyle \le } & { \displaystyle \hbar ( \alpha , k ) \cdot \sum _ { j = 1 } ^ { k } \frac { \log ( | G | P _ { k , j } | ) \cdot 1 - \log ( \mathrm { c } ( P _ { k } | ) | ) } { 2 \sqrt { 6 } ( P _ { k } | ) \cdot 1 - | G | ( G | P _ { k , j } | ) \cdot 1 - \log ( \mathrm { c } ( P _ { k } | ) | ) } { 2 \sqrt { 6 } ( P _ { k } | ) \cdot 1 - | G | ( P _ { k , j } | ) } { 2 \sqrt { 6 } ( P _ { k } | ) \cdot 1 - | G | ( P _ { k , j } | ) } { 2 \sqrt { 6 } ( P _ { k } | ) \cdot 1 - | G | ( P _ { k , j } | ) } } \\ { \ } & { \displaystyle \le } & { \displaystyle \hbar ( \alpha , k ) \cdot \operatorname* { m a x } _ { i } \frac { \log ( | G | P _ { k , j } | ) ) } { 2 \sqrt { 6 } ( P _ { k } | ) \cdot 1 - | G | ( P _ { k , j } | ) \cdot 1 - | G | ( P _ { k , j } | ) } \sum _ { j = 1 } ^ { k } { \cal P } { \cal T } _ { [ 0 , k ] } } \\ { \ } & { \displaystyle \le } & \displaystyle \hbar ( \alpha , k ) \cdot \operatorname* { m a x } _ { i } \frac { \sum _ { w \in [ 0 , 1 ] } \cdot | \log ( \mathrm { c } ( P _ { k } | ) | ) } { 2 \sqrt { 6 } ( P _ { k , j } | ) \cdot 1 - | G | ( P _ { k , j } | ) \cdot 1 - | G | ( P _ { k , j } | ) } \\ { \ } & { \displaystyle \le } & \end{array}
|
| 778 |
+
$$
|
| 779 |
+
|
| 780 |
+
618 Lemma E.1 follows.
|
| 781 |
+
|
| 782 |
+
Note that 619 $\begin{array} { r } { h ( \alpha , k ) = O \left( \frac { 1 } { ( 1 - \alpha ) } \log \frac { k } { 1 - \alpha } \right) } \end{array}$ , Theorem 3.2 follows.
|
| 783 |
+
|
| 784 |
+
621 We do our experiments on Amazon network 4 for which the set of ground-truth clusters has been
|
| 785 |
+
622 given. For two sets $A , B$ , the Jaccard Index of them is defined as $J ( \bar { A } , B ) = | A \cap B | / | A \cup B |$ . We
|
| 786 |
+
623 pick the largest cluster which is a subgraph with 58283 vertices and 133178 edges. We run HCSE
|
| 787 |
+
624 algorithm on it. For each ground-truth cluster $c$ that appears in this subgraph, we find from the
|
| 788 |
+
625 resulting cluster tree an internal node that has maximum Jaccard index with $c$ . Then we calculate
|
| 789 |
+
626 the average Jaccard index $\overline { J }$ over all such $c$ . We also calculate cost(SE) and cost(Das). The results
|
| 790 |
+
627 are demonstrated in Table 3. HCSE performs better for $\overline { J }$ and cost(SE), while LOUVAIN performs
|
| 791 |
+
628 better for cost(Das). Because of unbalance in over-fitting and under-fitting traps, HLP outperforms
|
| 792 |
+
629 none of the other two algorithms for all criteria.
|
| 793 |
+
|
| 794 |
+
<table><tr><td>index</td><td>HCSE</td><td>HLP</td><td>LOUVAIN</td></tr><tr><td>J</td><td>0.20</td><td>0.16</td><td>0.17</td></tr><tr><td>cost(SE)</td><td>1.85E6</td><td>2.05E6</td><td>1.89E6</td></tr><tr><td>cost(Das)</td><td>5.57E8</td><td>3.99E8</td><td>3.08E8</td></tr></table>
|
| 795 |
+
|
| 796 |
+
# 630 G Some figures and pseudocodes
|
| 797 |
+
|
| 798 |
+

|
| 799 |
+
Table 3: Comparisons of the average Jaccard index $( { \overline { { J } } } )$ , cost function based on structural entropy (cost(SE)) and Dasgupta’s cost function (cost(Das)).
|
| 800 |
+
Figure 3: Illustrations of stretch and compress for a $u$ -triangle. A binary cluster tree is constructed first by stretch, and then edge $e$ is compressed, which yields a non-binary tree.
|
| 801 |
+
|
| 802 |
+

|
| 803 |
+
Figure 4: Illustration of stratification for a 2-level cluster tree. The preference of (a) and (b) depends on the average sparsity of triangles at each level.
|
| 804 |
+
|
| 805 |
+
# Algorithm 5: Stretch
|
| 806 |
+
|
| 807 |
+
Input: a $u$ -triangle $T _ { u }$
|
| 808 |
+
Output: a binary tree rooted at $u$
|
| 809 |
+
1 Let $\{ v _ { 1 } , v _ { 2 } , \ldots , v _ { \ell } \}$ be the set of leaves of $T _ { u }$ ;
|
| 810 |
+
2 Compute $\eta ( a , b )$ which is the cost reduced by merging siblings $a , b$ into a single cluster;
|
| 811 |
+
3 for $t \in [ \ell - 1 ]$ do
|
| 812 |
+
4 $( \alpha , \beta ) \gets \mathrm { a r g m a x } _ { ( a , b ) }$ are siblings $\{ \eta ( a , b ) \}$ ;
|
| 813 |
+
5 Add a new node $\gamma$ ;
|
| 814 |
+
6 $\gamma . p a r e n t \alpha$ .parent;
|
| 815 |
+
7 $\alpha . p a r e n t = \gamma$ ;
|
| 816 |
+
8 $\beta . p a r e n t = \gamma$ ;
|
| 817 |
+
9 return $T _ { u }$
|
| 818 |
+
|
| 819 |
+
# Algorithm 6: Compress
|
| 820 |
+
|
| 821 |
+
Input: a binary tree $T$
|
| 822 |
+
1 while $T$ ’s height is more than 2 do
|
| 823 |
+
2 $e \gets \arg \operatorname* { m i n } _ { e ^ { \prime } \in \hat { E } ( T ) } \{ \Delta ( e ^ { \prime } ) \}$ ;
|
| 824 |
+
3 Denote $\boldsymbol { e } = ( u , v )$ where $u$ is the parent of $v$ ;
|
| 825 |
+
4 for $w \in v$ .children do
|
| 826 |
+
5 ${ \_ } \psi . p a r e n t u .$ ;
|
| 827 |
+
6 Delete $v$ from $T$ ;
|
md/dev/LQnyIk5dUA/LQnyIk5dUA.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/LSKlp_aceOC/LSKlp_aceOC.md
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Merging Models with Fisher-Weighted Averaging
|
| 2 |
+
|
| 3 |
+
Michael Matena Colin Raffel Department of Computer Science University of North Carolina at Chapel Hill {mmatena,craffel}@cs.unc.edu
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Averaging the parameters of models that have the same architecture and initialization can provide a means of combining their respective capabilities. In this paper, we take the perspective that this “merging” operation can be seen as choosing parameters that approximately maximize the joint likelihood of the posteriors of the models’ parameters. Computing a simple average of the models’ parameters therefore corresponds to making an isotropic Gaussian approximation to their posteriors. We develop an alternative merging procedure based on the Laplace approximation where we approximate each model’s posterior as a Gaussian distribution whose precision matrix corresponds to its Fisher information. We first show that our “Fisher merging” technique provides a performance boost in settings where simple parameter averaging is currently used – specifically, robust fine-tuning and model ensembling. Then, we compare merging to standard gradient-based transfer learning and demonstrate that merging enables a fundamentally different method for transferring capabilities across models. Specifically, we show that Fisher merging is competitive with gradient-based transfer learning approaches (while being significantly cheaper) in intermediate-task training and domain-adaptive pre-training. We also show that our merging procedure makes it possible to combine models in previously unexplored ways. We release our code to facilitate future research into methods for merging models.1
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
How should we transfer knowledge and capabilities across trained models? One popular approach is transfer learning [44], which fine-tunes a pre-trained model on a target task through additional gradient-based training. The preparatory step of pre-training the model on a data-rich task ideally instills useful “knowledge” into the network’s parameters, which allows the model to learn more rapidly and effectively when fine-tuned on a downstream task of interest. Transfer learning has therefore become a particularly important and omnipresent tool across many fields, including natural language processing [57, 13, 9, 52, 53, 46] and computer vision [43, 24, 68]. Recently, it has been shown that training on an “intermediate” task between pre-training and fine-tuning can further boost performance through additional transfer of capabilities from the intermediate task [47, 60, 51, 48]. Alternatively, continued self-supervised training on unlabeled domain-specialized data can serve as a form of domain adaptation [19].
|
| 12 |
+
|
| 13 |
+
All of the aforementioned transfer learning methods transfer knowledge by using a trained network to initialize another network followed by iterative gradient descent. While demonstrably powerful, several drawbacks arise from this: First, improvements to ancestor models cannot be passed down to descendants; instead, we must restart the whole process from the improved ancestor model, throwing away our previous work. For example, if we fine-tune a pre-trained model on a downstream task, but then the pre-trained model is improved through additional training, we must re-fine-tune the new model on our downstream task if we want to confer benefits from this additional pre-training. Furthermore, if we gain access to a checkpoint that has been fine-tuned on a useful intermediate task, we must again throw away our previous work and fine-tune from the intermediate task checkpoint. Existing methods for transfer learning also have the disadvantage of only being able to transfer information from a single model. While it may be possible to train on multiple intermediate tasks sequentially, one quickly either runs into a combinatorial explosion of saved checkpoints or faces the issue of “catastrophic forgetting” in continual learning [28]. In addition to slowing down experimentation by preventing reuse of work, these drawbacks impose limitations on the types of transfer that can occur.
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
Figure 1: Merging patterns considered in this work. Left: Merging many fine-tuned models as a form of ensembling. Center, top: “Robust fine-tuning” [66] , where a fine-tuned model is merged with the pre-trained model to improve performance on the original pre-training task. Center, bottom: Merging a fine-tuned model with a “donor” task, analogous to intermediate-task transfer learning [47, 51]. Right: Merging an intermediate-task trained model with a donor model.
|
| 17 |
+
|
| 18 |
+
A less common way of transferring capabilities across models is to simply average their parameters. This procedure, which we call “merging”, is generally only feasible when the models being averaged share a common architecture and initialization. Merging is the core component of the FedAvg algorithm used in Federated Learning [39], where updates to a shared model computed by individual workers that are training on different datasets are combined by simpling averaging the updates. Recently, Wortsman et al. [66] demonstrated that merging can be used to improve robustness to domain shift in fine-tuned models by averaging the parameters of the original pre-trained model with the fine-tuned parameters. Merging is also a common way of performing ensembling [49, 67], where the parameters of individual models trained on the same dataset are averaged to create a single performant model.
|
| 19 |
+
|
| 20 |
+
In this work, we view model merging as approximately maximizing the joint likelihood of the models’ posterior distribution over parameters. Since gradient-based maximum likelihood training only provides a point estimate of the posterior, some approximation of the posterior distribution is required. When an isotropic Gaussian distribution is used to approximate the posterior (with identity precision matrix and mean set to the model’s parameter values), we show that maximizing the joint likelihood across models is equivalent to simply averaging their parameters. We therefore refer to merging models by averaging parameters as isotropic merging. The view of merging as maximizing the joint likelihood of model posteriors suggests that using a better estimate of the posterior distribution may yield improved merging results. This leads us to introduce Fisher merging, which leverages the Laplace approximation by using the diagonal of each model’s Fisher information as the precision matrix for that model’s posterior.
|
| 21 |
+
|
| 22 |
+
Empirically, we demonstrate that merging models with Fisher merging outperforms isotropic merging in a variety of settings. We first focus on the existing applications of model ensembling [49, 67] and improving fine-tuned model robustness [66]. Then, we demonstrate for the first time that merging is a viable alternative to traditional gradient-based transfer learning. Specifically, we compare merging to intermediate-task transfer learning [47, 51] and domain-adaptive pre-training [19], finding that merging can achieve comparable performance at significantly lower cost. Additionally, we show that merging can provide an additional boost to models created via traditional intermediate-task training. This provides a concrete example of transfer that is fast and easy with merging but onerous or impossible to do with existing methods. Diagrams of the merging patterns we consider in this work are shown in fig. 1.
|
| 23 |
+
|
| 24 |
+
The rest of our paper is structured as follows: In section 2, we provide necessary background and detail our Fisher merging procedure. Section 3 provides experimental results on model ensembling, robust fine-tuning, intermediate-task training, and domain adaptation. We explore related works in section 4 and provide conclusions and thoughts on future work in section 5.
|
| 25 |
+
|
| 26 |
+
# 2 Weighted Parameter Averaging for Model Merging
|
| 27 |
+
|
| 28 |
+
Our focus is on procedures for model merging, i.e. averaging the parameters of models that share an architecture and initialization. In this section, we first frame the common practice of averaging together model parameters as approximately maximizing the joint likelihood of model posteriors. Specifically, we show that parameter averaging corresponds to using an isotropic Gaussian as the approximate posterior for each model. We then introduce Fisher merging, which uses the model’s diagonal Fisher information matrix as the precision matrix of the Gaussian approximate posterior. Fisher merging can be implemented by setting each merged parameter value to a weighted average of the corresponding parameter values from the original models, with the weighting for each parameter determined by its Fisher information. In addition, we add model-level weightings as additional hyperparameters to set the relative importance of each model.
|
| 29 |
+
|
| 30 |
+
# 2.1 Isotropic merging
|
| 31 |
+
|
| 32 |
+
Consider the problem setting where we have $M$ trained neural networks with parameters $\theta _ { 1 } , \dots , \theta _ { M }$ and our goal is to create a single neural network with parameters $\theta$ that, loosely speaking, inherits the capabilities of the $M$ trained neural networks. Assume that all of these neural networks share a common architecture and had the same set of initial parameter values before being trained. Merging attacks this problem by finding the parameters $\theta$ that maximize the joint likelihood of the posterior distributions of the $M$ models. Unfortunately, typical neural network training procedures do not provide access to a posterior distribution, which necessitates approximation. If the posterior of each model is approximated via an isotropic Gaussian with mean set to the model’s parameters, the optimization problem can be written as $\begin{array} { r } { \theta ^ { * } = \operatorname * { a r g m a x } _ { \theta } \sum _ { i } \log p ( \theta | \theta _ { i } , I ) } \end{array}$ where $p ( \theta | \theta _ { i } , I )$ is the probability distribution of the aforementioned approximate isotropic Gaussian posterior distribution used for model $i$ and $I$ is the identity matrix. This optimization problem has a closed-form solution given by $\begin{array} { r } { \theta ^ { * } = \frac { 1 } { M } \sum _ { i } \theta _ { i } } \end{array}$ , i.e. an average of the model parameters. Such an averaging procedure has been used in past work aiming to combine model capabilities, e.g. in federated learning [39], model ensembling [49, 67], and robust fine-tuning [66].
|
| 33 |
+
|
| 34 |
+
# 2.2 Per-model weights
|
| 35 |
+
|
| 36 |
+
In this work, we additionally introduce model-specific scalar hyperparameters $\lambda _ { i } , i \in \{ 1 , \dots , M \}$ into the model merging framework described above. Specifically, we change the optimization problem to $\begin{array} { r } { \theta ^ { * } = \mathrm { a r g m a x } _ { \theta } \sum _ { i } \bar { \lambda } _ { i } \log p ( \underline { { \theta } } | \theta _ { i } , I ) } \end{array}$ where $\begin{array} { r } { \lambda _ { i } \geq 0 , \bar { \sum _ { i } } \lambda _ { i } = \bar { 1 } } \end{array}$ . In the case of isotropic merging, this changes the solution to $\theta ^ { * } = \textstyle \sum _ { i } \lambda _ { i } \theta _ { i }$ , These hyperparameters provide control over the importance assigned to each of the models that are being merged. For example, when using merging to perform ensembling we might expect each model to be equally important and therefore set $\lambda _ { i } = 1 / M$ for all $i$ On the other hand, when mimicking the setup of intermediate-task training where the capabilities of a “donor” model are used to improve performance of a recipient model, we might weigh the recipient model more highly. Wortsman et al. [66] introduce a similar hyperparameter $\alpha$ when averaging the parameters of two models and report results for varying values of $\alpha$ .
|
| 37 |
+
|
| 38 |
+
# 2.3 Laplace Approximation
|
| 39 |
+
|
| 40 |
+
Framing merging as approximate maximization of the joint posterior likelihood reveals that simple parameter averaging is implicitly using an isotropic Gaussian posterior approximation. Such an approximation may be overly simplistic and lead to degraded performance. To explore improved merging procedures, we consider improved methods for creating an approximate posterior from a point estimate. Specifically, we use the Laplace approximation to the posterior, which corresponds to a second-order Taylor expansion of the log density around a mode [36, 10]. This leads to a Gaussian approximation $\mathcal { N } ( \theta , H ^ { - 1 } )$ of the posterior, where $H$ is the Hessian matrix and $\theta$ are the model’s trained parameter values. More precisely, we assume that the parameter values $\theta$ of a trained neural network are a local maximum of the posterior. It can then be shown that the precision matrix of the Laplace approximation is given by the Fisher information matrix of the network at $\theta$ .
|
| 41 |
+
|
| 42 |
+
The Fisher information matrix $F _ { \theta }$ [16, 3] of a neural network $p _ { \theta } ( y | x )$ trained to predict an output $y$ from input data $x$ is a $\left| \theta \right| \times \left| \theta \right|$ positive semidefinite matrix given by the formula
|
| 43 |
+
|
| 44 |
+
$$
|
| 45 |
+
F _ { \theta } = \mathbb { E } _ { x } \left[ \underset { y \sim p _ { \theta } ( y | x ) } { \mathbb { E } } \nabla _ { \theta } \log p _ { \theta } ( y | x ) \nabla _ { \theta } \log p _ { \theta } ( y | x ) ^ { T } \right] .
|
| 46 |
+
$$
|
| 47 |
+
|
| 48 |
+
It can be shown that the Fisher information matrix coincides with the Hessian $H$ at modes of the distribution [45], explaining its use in the Laplace approximation. The Fisher information matrix $F _ { \theta }$ can also be used to relate changes in the model parameters to changes in the model output by noting that $\begin{array} { r } { \mathbb { E } _ { x } \left[ D _ { \mathrm { K L } } ( p _ { \theta } ( y | x ) | | p _ { \theta + \delta } ( y | x ) ) \right] \approx \frac { 1 } { 2 } \delta ^ { T } F _ { \theta } \delta } \end{array}$ as $\delta 0$ , where $D _ { \mathrm { K L } }$ denotes the KL-divergence [45].
|
| 49 |
+
|
| 50 |
+
As the full Fisher matrix takes $O ( | \theta | ^ { 2 } )$ memory to store, it quickly becomes impractical for all but the smallest models. We are thus forced to use an approximation to the full Fisher in practice. In this paper, we follow the common practice of using the diagonal of the Fisher matrix [28]. While other methods (e.g. [1]) exist for estimating the Fisher, we leave their exploration for future work. In our experiments, we estimated the diagonal of the Fisher matrix via
|
| 51 |
+
|
| 52 |
+
$$
|
| 53 |
+
\hat { F } _ { \theta } = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \underset { y \sim p _ { \theta } ( y | x _ { i } ) } { \mathbb { E } } ( \nabla _ { \theta } \log p _ { \theta } ( y | x _ { i } ) ) ^ { 2 } ,
|
| 54 |
+
$$
|
| 55 |
+
|
| 56 |
+
where $x _ { 1 } , \ldots , x _ { N }$ are drawn i.i.d. from the dataset that was used to train the model. The expectation over $y$ can be estimated via sampling from $p _ { \theta } ( y | x _ { i } )$ or computed exactly when the number of classes is small. We note that computing the Fisher requires $N$ per-example gradients, which can be straightforwardly computed for neural networks using backpropagation. This makes computing the diagonal Fisher have roughly the same computational cost as training on $N$ examples.
|
| 57 |
+
|
| 58 |
+
# 2.4 Fisher Merging
|
| 59 |
+
|
| 60 |
+
Having noted that the Laplace approximation provides a tractable way to obtain a better approximation to the posterior, we now use it to create an improved merging procedure that we call Fisher merging. Letting $F _ { 1 } , \ldots , F _ { M }$ correspond to the diagonal approximate Fisher matrices, we construct $p ( \boldsymbol { \theta } | \boldsymbol { \theta } _ { i } , F _ { i } )$ as a Gaussian-distributed posterior over the parameters of the merged model with mean $\theta _ { i }$ and precision $F _ { i }$ . To obtain the merged model, we find a single set of parameters that is given a high probability under all posteriors. Formally, we have
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
\theta ^ { * } = \operatorname { a r g m a x } _ { \theta } \sum _ { i = 1 } ^ { M } \lambda _ { i } \log p ( \theta | \theta _ { i } , F _ { i } ) ,
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
which has the closed-form solution
|
| 67 |
+
|
| 68 |
+
$$
|
| 69 |
+
\theta ^ { * ( j ) } = \frac { \sum _ { i = 1 } ^ { M } \lambda _ { i } F _ { i } ^ { ( j ) } \theta _ { i } ^ { ( j ) } } { \sum _ { i = 1 } ^ { M } \lambda _ { i } F _ { i } ^ { ( j ) } } ,
|
| 70 |
+
$$
|
| 71 |
+
|
| 72 |
+
where $j = 1 , \ldots , | \theta |$ . Intuitively, we can think of Fisher merging as computing a weighted average of the parameter values in each model where the weighting is done according to each parameter’s Fisher information. Since the Fisher information is a local property of a single parameter value, Fisher merging might be less performant when applied to models whose parameters are far apart in parameter space. We therefore limit our focus to models that were trained from the same initialization.
|
| 73 |
+
|
| 74 |
+
Numerical Issues. Note that (4) can run into numerical issues when the Fisher is close to zero across all models for a given parameter. In practice, we choose a privileged “target model” in all of our experiments and “default” to the parameter’s value in the target model in these cases. An alternative would be to take an average weighted only by the merging coefficients (i.e., pretend the Fisher is the same across all models). In practice, the choice of a “default” value for these parameters had little impact on performance (likely because a small Fisher value implies that changing the parameter has a minute effect on the model’s outputs and is therefore relatively unimportant to the model’s behavior).
|
| 75 |
+
|
| 76 |
+
Unmergeable Parameters. In many cases, we have some parameters from each model that do not appear in all of the models we are merging. For example, this includes having task-specific classification heads on top of a common body architecture. We handle this by only applying the merging procedure (3) to the shared body parameters and keeping the task-specific heads unchanged. Although this may lead to a distribution shift in the classification head inputs, we found it to work well in practice for the datasets and tasks we consider.
|
| 77 |
+
|
| 78 |
+
# 3 Experiments
|
| 79 |
+
|
| 80 |
+
Our first experimental goal is to validate that our use of an improved estimate of the posterior yields improved merging performance. To test this hypothesis, we apply Fisher merging to two settings where isotropic merging has already proven successful: Model ensembling [49, 67] and robust fine-tuning [66]. Then, we demonstrate that Fisher merging provides a cheap and effective alternative to traditional transfer learning pipelines by validating its performance in intermediate-task transfer learning [47, 51] and domain-adaptive pre-training [19]. Finally, we demonstrate that merging opens up new paths of transferring capabilities across models by demonstrating a boost in performance when merging an intermediate task-trained model with different donor models.
|
| 81 |
+
|
| 82 |
+
# 3.1 Ensembling
|
| 83 |
+
|
| 84 |
+
An existing application of isotropic merging is for ensembling, i.e. combining models trained on the same dataset to obtain better predictions. Ensembling is most commonly performed by averaging the predictions of the individual models. This form of ensembling requires computing the output of all $M$ models in the ensemble, thereby increasing the computational cost by a factor of $M$ compared to computing the output for a single model. A cheaper alternative is to average the parameters of the models themselves. This approach is diagrammed in fig. 1, left. Such an approach is used in the classical method of Polyak averaging [49], where parameter values from the final $M$ iterations of training are averaged. More recently, Wortsman et al. [67] introduced the “Model Soup” approach where fine-tuned models with different hyperparameter settings are averaged to improve performance. To the best of our knowledge, all parameter-averaging ensemble methods have used isotropic merging, i.e. an unweighted average.
|
| 85 |
+
|
| 86 |
+
To test whether Fisher merging provides a boost over isotropic merging when averaging parameters for ensembling, we consider ensembling fine-tuned checkpoints derived from the same pre-trained model. Specifically, we consider the BERT-Base model [13] fine-tuned on the RTE [8], MRPC [14], and SST-2 [59] datasets. For each dataset, we use five fine-tuned checkpoints downloaded from the Hugging Face model hub.2 These checkpoints were fine-tuned with a variety of hyperparameter settings that were not chosen by us, so our experimental setting most closely matches the “Model Soup” approach [67]. A list of the checkpoints used is available in appendix A. Since we do not anticipate that any member of the ensemble should be given a larger weight, we set $\lambda _ { i } = 1 / 5$ for all models.
|
| 87 |
+
|
| 88 |
+
Our results are shown in fig. 2. We report validation set scores for Fisher merging, isotropic merging, and prediction ensembling (specifically, averaging the output probabilties of all models). Fisher merging significantly outperforms isotropic merging in all cases and attains comparable performance to prediction ensembling. Notably, performing inference after merging is $M \times$ cheaper than prediction ensembling, suggesting that merging can provide a cheaper alternative to standard ensembling procedures.
|
| 89 |
+
|
| 90 |
+
# 3.2 Robust Fine-Tuning
|
| 91 |
+
|
| 92 |
+
Recently, Wortsman et al. [66] found that while fine-tuning a pre-trained vision model tends to improve performance on the downstream task, it also tends to decreases accuracy on the original pretraining task. They therefore propose a “robust fine-tuning” procedure called WiSE-FT that computes a weighted average of the original pre-trained parameters and the fine-tuned parameters. Different weighting values produce different trade-offs between pre-training and fine-tuning task performance. In some cases, robust fine-tuning can even improve performance on the original pre-training task without sacrificing performance on the downstream fine-tuning task relative to traditional fine-tuning.
|
| 93 |
+
|
| 94 |
+

|
| 95 |
+
Figure 2: Validation set accuracy for ensembles of five fine-tuned BERT models using different ensembling methods on the RTE, MRPC, and SST-2 datasets. Fisher merging produces a single model that performs comparably to output ensembling while being $5 \times$ cheaper.
|
| 96 |
+
|
| 97 |
+

|
| 98 |
+
Figure 3: IID (ImageNet) and average outof-domain (OOD) accuracy across five OOD datasets when using the WiSE-FT procedure [66] with either Fisher or isotropic merging. Dark to light color indicates increasing $\lambda _ { 1 }$ from 0 to 1.
|
| 99 |
+
|
| 100 |
+
This procedure implicitly uses isotropic merging and therefore provides another natural testbed for determining whether Fisher merging provides a boost in performance. A schematic of robust fine-tuning is shown in fig. 1, center top.
|
| 101 |
+
|
| 102 |
+
We use the codebase and experimental setup of Wortsman et al. [66] exactly, simply replacing isotropic merging with Fisher merging. For full details of this setup, we refer to Wortsman et al. [66]. As a short summary, we apply WiSE-FT to the ImageNet [11, 58] pre-trained ViT-B/16 model [15] on five out-of-domain (OOD) datasets: ImageNet-A [21], ImageNet-R [20], ImageNet Sketch [62], ImageNet V2 [56], and ObjectNet [4]. Following Wortsman et al. [66], we measure IID (ImageNet) and OOD performance when averaging together the original pre-trained model parameters and parameters from models fine-tuned on each of the OOD datasets, varying $\lambda _ { 1 }$ (the averaging weight for the pre-trained model, called $\alpha$ by Wortsman et al. [66]) from 0 to 1 in 0.1-step increments (with $\lambda _ { 2 } = 1 - \lambda _ { 1 }$ correspondingly decreasing from 1 to 0). To determine whether Fisher merging confers a boost in performance, we compare parameter averaging using either isotropic or Fisher merging.
|
| 103 |
+
|
| 104 |
+
We plot the IID (ImageNet) accuracy against the average accuracy on the five OOD datasets for varying values of $\lambda _ { 1 }$ in fig. 3, with plots for individual OOD datasets in fig. 7 (appendix). Fisher merging produces a significantly better trade-off between IID and OOD accuracy. In particular, Fisher merging seems to general improve IID accuracy compared to isotropic merging. For example, for the value of $\lambda _ { 1 }$ producing the best average OOD accuracy, Fisher merging produces about $1 \%$ higher IID accuracy than isotropic merging.
|
| 105 |
+
|
| 106 |
+
# 3.3 Intermediate-task training
|
| 107 |
+
|
| 108 |
+
Having established that Fisher merging produces better results than isotropic merging in settings where merging has been attempted before, we now explore the use of merging as an alternative to a gradient-based transfer learning procedure. Specifically, we explore intermediate-task training [47, 51], where a model is fine-tuned on an intermediate “donor” task before being trained on the target task of interest. To the best of our knowledge, no prior work has considered parameter averaging as a way of performing intermediate-task transfer learning. For the most part, intermediate-task training has mainly been considered in the NLP domain; as such, we limit our experiments to the BERT [13] and RoBERTa [33] pre-trained language models. To enable comparison to past work, we mostly explored merging pairs of models but we are interested in exploring merging more than two models in future work. As in section 3.1, we made use of fine-tuned BERT and RoBERTa checkpoints from the Hugging Face repository [65].
|
| 109 |
+
|
| 110 |
+
Following previous work [47, 51], we first ran experiments using BERT-base on the GLUE benchmark [61]. The GLUE benchmark consists of the sentence acceptability task CoLA [64], the sentiment detection task SST-2 [59], the paraphrase detection tasks MRPC and QQP [14, 23], the sentence similarity task STS-B [7], and the natural language inference (NLI) tasks MNLI, QNLI, RTE, and
|
| 111 |
+
|
| 112 |
+

|
| 113 |
+
Figure 4: Validation set accuracy on RTE when performing intermediate-task training with datasets from GLUE as the donor task. Dashed line denotes RTE accuracy without intermediatetask training.
|
| 114 |
+
|
| 115 |
+

|
| 116 |
+
Figure 5: Validation accuracy on RTE after first fine-tuning on MNLI, then fine-tuning on RTE, and finally Fisher merging with various donor task models. Dashed line denotes RTE accuracy after MNLI intermediate-task training.
|
| 117 |
+
|
| 118 |
+
WNLI [6, 54, 8, 31]. All of the GLUE tasks are classification tasks except for STS-B, which is a regression task with a score ranging from 0 to 5. To simplify computation of the Fisher, we turn STS-B into a classification task by partitioning the continuous label into 25 equally-sized buckets [53]. Following common practice, we do not run experiments on WNLI due to the tricks required to get a good score [12, 29]. See Wang et al. [61] for more details on these tasks and their associated metrics. We detail how we obtained fine-tuned checkpoints on these tasks in appendix C. We computed a diagonal Fisher approximation for each checkpoint using up to 4096 examples from the corresponding train set. Since it is not clear a priori what weighting coefficients $\lambda _ { i }$ to use in this setting, we chose $\lambda _ { i }$ by a grid search with 50 points, using the score on the first 2048 validation examples as the selection metric. We compare Fisher merging to isotropic merging as well as a standard gradient-based intermediate-task fine-tuning baseline [47]. A diagram of intermediate-task merging is shown in fig. 1, center bottom.
|
| 119 |
+
|
| 120 |
+
In initial experiments (reported in tables A1 to A3), we performed intermediate-task training for possible pair of datasets from the GLUE benchmark. Congruent with past work [47, 51, 60], we found that intermediate-task training provided the most notable performance boost when the RTE dataset was the target. We therefore focus on RTE results in the main text. Figure 4 shows the results of intermediate-task training of BERT-base with RTE as the target task and the other GLUE datasets as donor tasks, using Fisher merging, isotropic merging, or standard gradient-based training. Notably, performing gradient-based intermediate-task training hurts on some datasets, whereas merging always helps. Fisher merging gets comparable or better performance than isotropic merging with the largest gap observed when using MNLI as the intermediate task. On the other hand, merging performs worse than standard gradient-based training when using MNLI as the donor task.
|
| 121 |
+
|
| 122 |
+
Exploring new paths for transfer Given this performance gap, we were interested to see whether merging could provide an additional boost on top of gradient-based intermediate-task training. We therefore performed Fisher merging on a BERT-base model that was first fine-tuned on MNLI and then fine-tuned on RTE. A diagram of this setup is shown in fig. 1, right. This procedure does not have a direct analog in traditional gradient-based, and as we will show later, performing multi-stage gradient-based intermediate-task training generally harms results.
|
| 123 |
+
|
| 124 |
+
We consider Fisher merging the intermediate-task trained RTE model with all GLUE tasks and show the results in fig. 5. Fisher merging provides a boost over gradient-based intermediate-task training for all tasks. Interestingly, a boost is still conferred when merging with an MNLI-trained model, suggesting that merging provides a complementary path for transferring capabilities across models.
|
| 125 |
+
|
| 126 |
+
Scaling to RoBERTa-large Seeing that merging can provide a boost on top of intermediate-task training, we explored whether this boost could still be obtained for a stronger model than BERTbase. We therefore applied the same procedure to a RoBERTa-large RTE model that had been fine-tuned from an MNLI intermediate checkpoint. Our donor models were the original RoBERTalarge checkpoint (i.e., not fine-tuned on MNLI) fine-tuned on MRPC, RTE, STS-B, and SST-2. We additionally ran a sequential gradient-based fine-tuning baseline where we started with the MNLI checkpoint, fine-tuned on the donor task, and then fine-tuned on the target task.
|
| 127 |
+
|
| 128 |
+
The results are shown in fig. 6. We find merging provides a boost in performance even on the more performant RoBERTa model. The largest boost of 2.2 points came from Fisher merging with another RTE checkpoint, which is reminiscent of using merging for ensembling. Notably, including an additional intermediate task in gradient-based training significantly harmed performance compared to performing intermediate-task training on MNLI alone. We hypothesize this is related to the phenomena of catastrophic forgetting [17], where the model’s capabilities on MNLI are forgotten as it is trained on the next intermediate task. Nevertheless, this illustrates model merging’s ability to sidestep the issue of catastrophic forgetting and enable exploration of novel transfer strategies.
|
| 129 |
+
|
| 130 |
+
Costs We had previously noted that our merging procedure could potentially be substantially more efficient than standard gradient-based fine-tuning. To measure this claim concretely, we computed the FLOPs required for fine-tuning and merging an RTE checkpoint based on the heuristics described in Kaplan et al. [26]. Fine-tuning BERT-base on RTE for 10 epochs would require about 5.5e14 FLOPs. Our merging procedures require computing the merged checkpoint (eq. (4)) and then evaluating it on the validation set with Fisher merging also requiring the estimation of the Fisher matrix (eq. (2)) beforehand. These steps require about 4.0e8, 2.0e12, and 9.1e13 FLOPs respectively, resulting in a roughly $6 \times$ lower total cost compared to fine-tuning for Fisher merging and $2 7 5 \times$ lower cost for isotropic merging. We note that the Fisher matrix only needs to be computed once and can be reused for subsequent merges, which amortizes the most expensive step in Fisher merging.
|
| 131 |
+
|
| 132 |
+
To explore methods for further reducing costs, we experimented with using fewer examples to estimate the Fisher. Specifically, we experimented with intermediate-task Fisher merging of BERT-base with MNLI as the donor task and RTE as the target task. The results are shown in table A4. While using the full training set to estimate the Fisher produced the best performance $( 7 3 . 4 \% )$ , using only 256 examples to estimate the Fisher only produced a mild degradation in accuracy $( 7 2 . 7 \% )$ and still outperformed the isotropic merging baseline. This suggests that computing the Fisher over fewer examples could further reduce computational costs without sacrificing a great deal of accuracy.
|
| 133 |
+
|
| 134 |
+
# 3.4 Domain Adaptation
|
| 135 |
+
|
| 136 |
+
We now turn our attention to the “domain-adaptive pre-training” (DAPT) approach for domain adaptation advocated by Gururangan et al. [19], which is methodologically similar to intermediatetask training. DAPT consists of additional pre-training of an original general-purpose pre-trained checkpoint on domain-specific unlabeled data. We explore the benefits of merging in an experimental setup similar to Gururangan et al. [19]. We focus on the biomedical (BIOMED) and computer science (CS) domains because they correspond to the classification tasks that saw the largest gains from domain-adaptive pre-training in [19]. Namely, we experimented with the CHEMPROT [30] relation classification task on the BIOMED domain. On the CS domain, we used the citation intent task of ACL-ARC [25] and the relation classification task of SCIERC [35]. Following Gururangan et al. [19], we report macro- $F _ { 1 }$ for ACL-ARC and SCIERC, and we report micro- $F _ { 1 }$ for CHEMPROT. We used RoBERTa-base [33] as our baseline model. Appendix D includes full details of the pre-training, fine-tuning, and merging procedures used.
|
| 137 |
+
|
| 138 |
+
We present our results in table 1. Merging provided the largest boost on ACL-ARC, and outperformed traditional fine-tuning in this setting. We only observed a minor improvement in performance on CHEMPROT and SCIERC. We note that our boosts from gradient-based fine-tuning were smaller than reported in [19], which was likely because we were only able to train on public data and we applied domain-adaptive pre-training for fewer steps. However, our results are consistent in the sense that ACL-ARC received the largest boost and CHEMPROT received the smallest boost.
|
| 139 |
+
|
| 140 |
+
# 4 Related Work
|
| 141 |
+
|
| 142 |
+
Like our work, elastic weight consolidation (EWC) [28] uses the Laplace approximation to the posterior over model parameters to create a regularizer to prevent catastrophic forgetting in the context of continual learning. While their framework supports the use of posteriors from multiple
|
| 143 |
+
|
| 144 |
+

|
| 145 |
+
Figure 6: Validation accuracy on RTE using the setup of fig. 5, but with RoBERTa-large instead of BERT-base. “Standard training” fine-tunes on MNLI, then the donor task, then RTE. Dashed line denotes MNLI intermediate-task training.
|
| 146 |
+
|
| 147 |
+
<table><tr><td>Method</td><td>ChemProt</td><td>ACL-ARC</td><td>SciERC</td></tr><tr><td>Unmerged</td><td>82.70.3</td><td>70.53.2</td><td>81.00.4</td></tr><tr><td>Fisher</td><td>83.10.4</td><td>73.21.7</td><td>81.30.5</td></tr><tr><td>Isotropic</td><td>82.80.4</td><td>72.52.3</td><td>81.70.5</td></tr><tr><td>Fine-tuned</td><td>82.50.1</td><td>71.53.0</td><td>81.61.0</td></tr></table>
|
| 148 |
+
|
| 149 |
+
Table 1: Domain adaptation results. “Unmerged” refers to checkpoints fine-tuned from RoBERTabase. “Fisher” and “Isotropic” refer to the result of merging those checkpoints with the domainadaptive pre-trained (DAPT) checkpoint. “Finetuned” refers to models fine-tuned from the DAPT checkpoint. Subscripts provide the standard deviation across five trials.
|
| 150 |
+
|
| 151 |
+
models as well, they restrict such models to be previous checkpoints of a continually trained model. EWC keeps the model from losing previously acquired knowledge while merging provides a means of directly adding new knowledge to a model.
|
| 152 |
+
|
| 153 |
+
Some other existing procedures such as distillation [22] and ensembling [42] can also be thought of as combining or transferring knowledge between neural networks. However, those methods represent knowledge solely through the output of models. The knowledge contained within the parameters of a network will necessarily be greater than the knowledge contained in its output [2]. Hence, methods that directly combine model parameters such as merging have the potential to be more powerful than those methods. Furthermore, our merging procedure has an efficient and closed-form solution (eq. (4)) while distillation requires iterative gradient descent-based training.
|
| 154 |
+
|
| 155 |
+
Isotropic checkpoint averaging is used by federated learning [39] and Polyak averaging [49]. However, the checkpoints merged by those methods can be thought of coming from the same training run of single model. We believe we are the first to demonstrate cross-task transfer coming from checkpoint averaging and to explore it in the context of transfer learning. However, adapting ideas from federated learning such as [32, 63] could provide a fruitful avenue for future model merging research.
|
| 156 |
+
|
| 157 |
+
Natural gradient descent refers to an optimization procedure that uses KL-divergence of model predictions as a distance measure rather than the Euclidean distance in parameter space employed by regular gradient descent [3]. It does this by performing gradient descent on a Riemannian manifold with the Fisher information matrix as its metric [45]. In practice, this amounts to using the Fisher as a preconditioner during gradient descent. Some work on natural gradient descent may prove relevant for model merging such as using Kronecker-factorized Fisher matrices as an alternative to the diagonal approximation employed in this paper [37, 18, 38]. More broadly, in the field of information geometry the Fisher information matrix plays the role of a metric on a Riemannian manifold [40]. This has led to explorations of model averaging using tools from information geometry, e.g. [5, 41, 50].
|
| 158 |
+
|
| 159 |
+
# 5 Conclusion
|
| 160 |
+
|
| 161 |
+
In this paper, we introduced Fisher merging, a way to combine the capabilities of different models by computing a weighted average of their parameters. Fisher merging is motivated by a novel perspective of parameter averaging as maximizing the joint likelihood of model posteriors. Through extensive experiments, we demonstrated that using the Fisher information as a weight on the contribution of each parameter outperforms using an unweighted average. Furthermore, we showed that Fisher merging attains comparable and sometimes better performance than traditional gradient-based transfer learning methods at significantly lower costs. Our experiments also demonstrated various merging strategies that would be onerous with traditional gradient-based training, which opens up new avenues for transferring capabilities across models. In future work, we plan to investigate different methods for approximating the Fisher information and model posteriors as well as more esoteric combinations of models.
|
| 162 |
+
|
| 163 |
+
# Acknowledgments and Disclosure of Funding
|
| 164 |
+
|
| 165 |
+
This work was supported by the NSF CAREER award under Grant No. 2145822.
|
| 166 |
+
|
| 167 |
+
# References
|
| 168 |
+
|
| 169 |
+
[1] Achille, A., Lam, M., Tewari, R., Ravichandran, A., Maji, S., Fowlkes, C. C., Soatto, S., and Perona, P. Task2vec: Task embedding for meta-learning. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 6430–6439, 2019.
|
| 170 |
+
[2] Achille, A., Paolini, G., and Soatto, S. Where is the information in a deep neural network? arXiv preprint arXiv:1905.12213, 2019.
|
| 171 |
+
[3] Amari, S. Neural learning in structured parameter spaces-natural riemannian gradient. Advances in neural information processing systems, pp. 127–133, 1997.
|
| 172 |
+
[4] Barbu, A., Mayo, D., Alverio, J., Luo, W., Wang, C., Gutfreund, D., Tenenbaum, J., and Katz, B. Objectnet: A large-scale bias-controlled dataset for pushing the limits of object recognition models. In Advances in Neural Information Processing Systems (NeurIPS), 2019.
|
| 173 |
+
[5] Bartels, L. M. Specification uncertainty and model averaging. American Journal of Political Science, 1997.
|
| 174 |
+
[6] Bowman, S. R., Angeli, G., Potts, C., and Manning, C. D. A large annotated corpus for learning natural language inference. arXiv preprint arXiv:1508.05326, 2015.
|
| 175 |
+
[7] Cer, D., Diab, M., Agirre, E., Lopez-Gazpio, I., and Specia, L. Semeval-2017 task 1: Semantic textual similarity-multilingual and cross-lingual focused evaluation. arXiv preprint arXiv:1708.00055, 2017.
|
| 176 |
+
[8] Dagan, I., Glickman, O., and Magnini, B. The pascal recognising textual entailment challenge. In Machine Learning Challenges Workshop, pp. 177–190. Springer, 2005.
|
| 177 |
+
[9] Dai, A. M. and Le, Q. V. Semi-supervised sequence learning. In Advances in neural information processing systems, 2015.
|
| 178 |
+
[10] Daxberger, E., Kristiadi, A., Immer, A., Eschenhagen, R., Bauer, M., and Hennig, P. Laplace redux-effortless bayesian deep learning. Advances in Neural Information Processing Systems (NeurIPS), 2021.
|
| 179 |
+
[11] Deng, J., Dong, W., Socher, R., Li, L.-J., Li, K., and Fei-Fei, L. ImageNet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, 2009.
|
| 180 |
+
[12] Devlin, J., Chang, M.-W., Lee, K., and Toutanova, K. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
|
| 181 |
+
[13] Devlin, J., Chang, M.-W., Lee, K., and Toutanova, K. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
|
| 182 |
+
[14] Dolan, W. B. and Brockett, C. Automatically constructing a corpus of sentential paraphrases. In Proceedings of the Third International Workshop on Paraphrasing (IWP2005), 2005.
|
| 183 |
+
[15] Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., Uszkoreit, J., and Houlsby, N. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020.
|
| 184 |
+
[16] Fisher, R. A. On the mathematical foundations of theoretical statistics. Philosophical Transactions of the Royal Society of London. Series A, Containing Papers of a Mathematical or Physical Character, 222(594-604):309–368, 1922.
|
| 185 |
+
[17] Goodfellow, I. J., Mirza, M., Xiao, D., Courville, A., and Bengio, Y. An empirical investigation of catastrophic forgetting in gradient-based neural networks. arXiv preprint arXiv:1312.6211, 2013.
|
| 186 |
+
[18] Grosse, R. and Martens, J. A kronecker-factored approximate fisher matrix for convolution layers. In International Conference on Machine Learning, pp. 573–582. PMLR, 2016.
|
| 187 |
+
[19] Gururangan, S., Marasovic, A., Swayamdipta, S., Lo, K., Beltagy, I., Downey, D., and Smith, ´ N. A. Don’t stop pretraining: Adapt language models to domains and tasks. arXiv preprint arXiv:2004.10964, 2020.
|
| 188 |
+
[20] Hendrycks, D., Basart, S., Mu, N., Kadavath, S., Wang, F., Dorundo, E., Desai, R., Zhu, T., Parajuli, S., Guo, M., Song, D., Steinhardt, J., and Gilmer, J. The many faces of robustness: A critical analysis of out-of-distribution generalization. International Conference on Computer Vision (ICCV), 2021.
|
| 189 |
+
[21] Hendrycks, D., Zhao, K., Basart, S., Steinhardt, J., and Song, D. Natural adversarial examples. Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
|
| 190 |
+
[22] Hinton, G., Vinyals, O., and Dean, J. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015.
|
| 191 |
+
[23] Iyer, S., Dandekar, N., and Csernai, K. First quora dataset release: Question pairs, 2017. URL https://data.quora.com/First-Quora-Dataset-Release-Question-Pairs.
|
| 192 |
+
[24] Jia, Y., Shelhamer, E., Donahue, J., Karayev, S., Long, J., Girshick, R., Guadarrama, S., and Darrell, T. Caffe: Convolutional architecture for fast feature embedding. In Proceedings of the 22nd ACM international conference on Multimedia, 2014.
|
| 193 |
+
[25] Jurgens, D., Kumar, S., Hoover, R., McFarland, D., and Jurafsky, D. Measuring the evolution of a scientific field through citation frames. Transactions of the Association for Computational Linguistics, 6:391–406, 2018.
|
| 194 |
+
[26] Kaplan, J., McCandlish, S., Henighan, T., Brown, T. B., Chess, B., Child, R., Gray, S., Radford, A., Wu, J., and Amodei, D. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020.
|
| 195 |
+
[27] Kingma, D. P. and Ba, J. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 196 |
+
[28] Kirkpatrick, J., Pascanu, R., Rabinowitz, N., Veness, J., Desjardins, G., Rusu, A. A., Milan, K., Quan, J., Ramalho, T., Grabska-Barwinska, A., et al. Overcoming catastrophic forgetting in neural networks. Proceedings of the national academy of sciences, 114(13):3521–3526, 2017.
|
| 197 |
+
[29] Kocijan, V., Cretu, A.-M., Camburu, O.-M., Yordanov, Y., and Lukasiewicz, T. A surprisingly robust trick for winograd schema challenge. arXiv preprint arXiv:1905.06290, 2019.
|
| 198 |
+
[30] Kringelum, J., Kjaerulff, S. K., Brunak, S., Lund, O., Oprea, T. I., and Taboureau, O. Chemprot3.0: a global chemical biology diseases mapping. Database, 2016, 2016.
|
| 199 |
+
[31] Levesque, H., Davis, E., and Morgenstern, L. The winograd schema challenge. In Thirteenth International Conference on the Principles of Knowledge Representation and Reasoning, 2012.
|
| 200 |
+
[32] Liu, X., Masana, M., Herranz, L., Van de Weijer, J., Lopez, A. M., and Bagdanov, A. D. Rotate your networks: Better weight consolidation and less catastrophic forgetting. In 2018 24th International Conference on Pattern Recognition (ICPR), pp. 2262–2268. IEEE, 2018.
|
| 201 |
+
[33] Liu, Y., Ott, M., Goyal, N., Du, J., Joshi, M., Chen, D., Levy, O., Lewis, M., Zettlemoyer, L., and Stoyanov, V. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019.
|
| 202 |
+
[34] Lo, K., Wang, L. L., Neumann, M., Kinney, R., and Weld, D. S. S2orc: The semantic scholar open research corpus. arXiv preprint arXiv:1911.02782, 2019.
|
| 203 |
+
[35] Luan, Y., He, L., Ostendorf, M., and Hajishirzi, H. Multi-task identification of entities, relations, and coreference for scientific knowledge graph construction. arXiv preprint arXiv:1808.09602, 2018.
|
| 204 |
+
[36] MacKay, D. J. A practical bayesian framework for backpropagation networks. Neural computation, 4(3):448–472, 1992.
|
| 205 |
+
[37] Martens, J. and Grosse, R. Optimizing neural networks with kronecker-factored approximate curvature. In International conference on machine learning, pp. 2408–2417. PMLR, 2015.
|
| 206 |
+
[38] Martens, J., Ba, J., and Johnson, M. Kronecker-factored curvature approximations for recurrent neural networks. In International Conference on Learning Representations, 2018.
|
| 207 |
+
[39] McMahan, B., Moore, E., Ramage, D., Hampson, S., and y Arcas, B. A. Communicationefficient learning of deep networks from decentralized data. In Artificial Intelligence and Statistics, pp. 1273–1282. PMLR, 2017.
|
| 208 |
+
[40] Nielsen, F. An elementary introduction to information geometry. Entropy, 22(10):1100, 2020.
|
| 209 |
+
[41] Nielsen, F. and Nock, R. Sided and symmetrized bregman centroids. IEEE transactions on Information Theory, 55(6), 2009.
|
| 210 |
+
[42] Opitz, D. W. and Shavlik, J. W. Actively searching for an effective neural network ensemble. Connection Science, 8(3-4):337–354, 1996.
|
| 211 |
+
[43] Oquab, M., Bottou, L., Laptev, I., and Sivic, J. Learning and transferring mid-level image representations using convolutional neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, 2014.
|
| 212 |
+
[44] Pan, S. J. and Yang, Q. A survey on transfer learning. IEEE Transactions on knowledge and data engineering, 22(10):1345–1359, 2009.
|
| 213 |
+
[45] Pascanu, R. and Bengio, Y. Revisiting natural gradient for deep networks. arXiv preprint arXiv:1301.3584, 2013.
|
| 214 |
+
[46] Peters, M. E., Neumann, M., Iyyer, M., Gardner, M., Clark, C., Lee, K., and Zettlemoyer, L. Deep contextualized word representations. arXiv preprint arXiv:1802.05365, 2018.
|
| 215 |
+
[47] Phang, J., Févry, T., and Bowman, S. R. Sentence encoders on stilts: Supplementary training on intermediate labeled-data tasks. arXiv preprint arXiv:1811.01088, 2018.
|
| 216 |
+
[48] Phang, J., Htut, P. M., Pruksachatkun, Y., Liu, H., Vania, C., Kann, K., Calixto, I., and Bowman, S. R. English intermediate-task training improves zero-shot cross-lingual transfer too. arXiv preprint arXiv:2005.13013, 2020.
|
| 217 |
+
[49] Polyak, B. T. and Juditsky, A. B. Acceleration of stochastic approximation by averaging. SIAM journal on control and optimization, 30(4):838–855, 1992.
|
| 218 |
+
[50] Posada, D. and Buckley, T. R. Model selection and model averaging in phylogenetics: advantages of akaike information criterion and bayesian approaches over likelihood ratio tests. Systematic biology, 53(5), 2004.
|
| 219 |
+
[51] Pruksachatkun, Y., Phang, J., Liu, H., Htut, P. M., Zhang, X., Pang, R. Y., Vania, C., Kann, K., and Bowman, S. R. Intermediate-task transfer learning with pretrained models for natural language understanding: When and why does it work? arXiv preprint arXiv:2005.00628, 2020.
|
| 220 |
+
[52] Radford, A., Narasimhan, K., Salimans, T., and Sutskever, I. Improving language understanding by generative pre-training, 2018.
|
| 221 |
+
[53] Raffel, C., Shazeer, N., Roberts, A., Lee, K., Narang, S., Matena, M., Zhou, Y., Li, W., and Liu, P. J. Exploring the limits of transfer learning with a unified text-to-text transformer. arXiv preprint arXiv:1910.10683, 2019.
|
| 222 |
+
[54] Rajpurkar, P., Zhang, J., Lopyrev, K., and Liang, P. Squad: $1 0 0 { , } 0 0 0 { + }$ questions for machine comprehension of text. arXiv preprint arXiv:1606.05250, 2016.
|
| 223 |
+
[55] Rajpurkar, P., Jia, R., and Liang, P. Know what you don’t know: Unanswerable questions for squad. arXiv preprint arXiv:1806.03822, 2018.
|
| 224 |
+
[56] Recht, B., Roelofs, R., Schmidt, L., and Shankar, V. Do ImageNet classifiers generalize to ImageNet? In International Conference on Machine Learning (ICML), 2019.
|
| 225 |
+
[57] Ruder, S., Peters, M. E., Swayamdipta, S., and Wolf, T. Transfer learning in natural language processing. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Tutorials, pp. 15–18, 2019.
|
| 226 |
+
[58] Russakovsky, O., Deng, J., Su, H., Krause, J., Satheesh, S., Ma, S., Huang, Z., Karpathy, A., Khosla, A., Bernstein, M., et al. ImageNet large scale visual recognition challenge. International journal of computer vision, 2015.
|
| 227 |
+
[59] Socher, R., Perelygin, A., Wu, J., Chuang, J., Manning, C. D., Ng, A. Y., and Potts, C. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 conference on empirical methods in natural language processing, pp. 1631–1642, 2013.
|
| 228 |
+
[60] Vu, T., Wang, T., Munkhdalai, T., Sordoni, A., Trischler, A., Mattarella-Micke, A., Maji, S., and Iyyer, M. Exploring and predicting transferability across nlp tasks. arXiv preprint arXiv:2005.00770, 2020.
|
| 229 |
+
[61] Wang, A., Singh, A., Michael, J., Hill, F., Levy, O., and Bowman, S. R. Glue: A multitask benchmark and analysis platform for natural language understanding. arXiv preprint arXiv:1804.07461, 2018.
|
| 230 |
+
[62] Wang, H., Ge, S., Lipton, Z., and Xing, E. P. Learning robust global representations by penalizing local predictive power. In Advances in Neural Information Processing Systems (NeurIPS), 2019.
|
| 231 |
+
[63] Wang, H., Yurochkin, M., Sun, Y., Papailiopoulos, D., and Khazaeni, Y. Federated learning with matched averaging. arXiv preprint arXiv:2002.06440, 2020.
|
| 232 |
+
[64] Warstadt, A., Singh, A., and Bowman, S. R. Neural network acceptability judgments. Transactions of the Association for Computational Linguistics, 7:625–641, 2019.
|
| 233 |
+
[65] Wolf, T., Debut, L., Sanh, V., Chaumond, J., Delangue, C., Moi, A., Cistac, P., Rault, T., Louf, R., Funtowicz, M., et al. Huggingface’s transformers: State-of-the-art natural language processing. arXiv preprint arXiv:1910.03771, 2019.
|
| 234 |
+
[66] Wortsman, M., Ilharco, G., Li, M., Kim, J. W., Hajishirzi, H., Farhadi, A., Namkoong, H., and Schmidt, L. Robust fine-tuning of zero-shot models. arXiv preprint arXiv:2109.01903, 2021.
|
| 235 |
+
[67] Wortsman, M., Ilharco, G., Gadre, S. Y., Roelofs, R., Gontijo-Lopes, R., Morcos, A. S., Namkoong, H., Farhadi, A., Carmon, Y., Kornblith, S., and Schmidt, L. Model soups: averaging weights of multiple fine-tuned models improves accuracy without increasing inference time. arXiv preprint arXiv:2203.05482, 2022.
|
| 236 |
+
[68] Yosinski, J., Clune, J., Bengio, Y., and Lipson, H. How transferable are features in deep neural networks? In Advances in neural information processing systems, 2014.
|
| 237 |
+
|
| 238 |
+
# Checklist
|
| 239 |
+
|
| 240 |
+
1. For all authors...
|
| 241 |
+
|
| 242 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 243 |
+
(b) Did you describe the limitations of your work? [Yes] Settings where merging underperforms traditional gradient-based training are covered in section 3 and also discuss caveats of our method in section 2.4.
|
| 244 |
+
(c) Did you discuss any potential negative societal impacts of your work? [No]
|
| 245 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 246 |
+
|
| 247 |
+
2. If you are including theoretical results...
|
| 248 |
+
|
| 249 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] We state that merging assumes a shared architecture and initialization at various points in the paper and explain why in section 2.4.
|
| 250 |
+
(b) Did you include complete proofs of all theoretical results? [N/A] No theoretical advances were sufficiently complex to warrant proof.
|
| 251 |
+
|
| 252 |
+
3. If you ran experiments...
|
| 253 |
+
|
| 254 |
+
(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] Code is provided in the supplementary. All datasets are public and are downloadable with our code.
|
| 255 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See appendix C and appendix D
|
| 256 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] See tables A1 to A3.
|
| 257 |
+
(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]
|
| 258 |
+
|
| 259 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 260 |
+
|
| 261 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 262 |
+
(b) Did you mention the license of the assets? [No] All datasets are widely-used (hundreds or thousands of citations) public datasets.
|
| 263 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] We include code in the supplemental.
|
| 264 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 265 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 266 |
+
|
| 267 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 268 |
+
|
| 269 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 270 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 271 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
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/LdVQGdXkkG/LdVQGdXkkG.md
ADDED
|
@@ -0,0 +1,287 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MODULAR ACTION CONCEPT GROUNDINGIN SEMANTIC VIDEO PREDICTION
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Recent works in video prediction have mainly focused on passive forecasting and low-level action-conditional prediction, which sidesteps the learning of interaction between agents and objects. We introduce the task of semantic actionconditional video prediction, which uses semantic action labels to describe those interactions and can be regarded as an inverse problem of action recognition. The challenge of this new task primarily lies in how to effectively inform the model of semantic action information. Inspired by the idea of Mixture of Experts, we embody each abstract label by a structured combination of various visual concept learners and propose a novel video prediction model, Modular Action Concept Network (MAC). Our method is evaluated on two newly designed synthetic datasets, CLEVR-Building-Blocks and Sapien-Kitchen, and one real-world dataset called Tower-Creation. Extensive experiments demonstrate that MAC can correctly condition on given instructions and generate corresponding future frames without need of bounding boxes. We further show that the trained model can make out-of-distribution generalization, be quickly adapted to new object categories and exploit its learnt features for object detection, showing the progression towards higher-level cognitive abilities. More visualizations can be found at https://iclr-mac.github.io/MAC/.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Recently, video prediction has drawn a lot of attention due to its ability to capture meaningful representations through self-supervision (Wang et al. (2018b); Yu et al. (2019)). Although modern video prediction methods have made significant progress in improving predictive accuracy, most of their applications are limited in the scenarios of passive forecasting (Villegas et al. (2017); Wang et al. (2018a); Byeon et al. (2018); Jin et al. (2020)), meaning models can only passively observe a short period of dynamics and accordingly make a short-term extrapolation. Such settings neglect the fact that the observer can also become an active participant in the environment.
|
| 12 |
+
|
| 13 |
+
To model the movements of active manipulators, several low-level action-conditional video prediction models have been proposed in the community (Oh et al. (2015); Mathieu et al. (2015); Babaeizadeh et al. (2017); Ebert et al. (2017)). In this work, we go one step further by introducing the task of semantic action-conditional video prediction which emphasizes the modeling of interactions between agents and environment. Instead of using low-level single-entity actions such as action vectors of robot arms as done in prior works (Finn et al. (2016); Kurutach et al. (2018)), our new task provides semantic descriptions of interactive actions, e.g. "Open the door", and asks the model to imagine "What if I open the door" in the form of future frames. This task requires the model to recognize the object identity, assign correct affordances to objects and envision the long-term expectation by planning a reasonable trajectory toward the goal, which resembles how humans might imagine conditional futures. The ability to predict correct and semantically consistent future perceptual information is indicative of conceptual grounding of actions, in a manner similar to object grounding in image-based detection and generation tasks.
|
| 14 |
+
|
| 15 |
+
The challenge of action-conditional video prediction primarily lies in how to correctly inform the model of more abstract semantic action information. Existing low-level counterparts usually achieve this by employing a naive concatenation (Finn et al. (2016); Babaeizadeh et al. (2017)) with action vector of each timestep. While this implementation might enable model to move the desired objects, it fails to produce consistent long-term predictions toward target locations in the multi-entity settings because it was originally designed to only encode the motion information of a single entity. If we take "put A on $B "$ as an example, it turns out to be difficult to make the model learn what and where $B$ is, because the main self-supervisory signals in the framework of video prediction are pixel changes and $B$ is not moving in this case. In order to distinguish and locate instances in the scene, other related works heavily rely on pre-trained object detectors or ground-truth bounding boxes (Bar et al. (2020); Ji et al. (2020); Huang et al. (2018); Wu et al. (2020)). However, we argue that utilizing a pre-trained detector actually simplifies the task since such a detector already solves the major difficulty by mapping high-dimension inputs to low-dimension groundings. Furthermore, bounding boxes cannot effectively describe complex visual changes including rotations and occlusions. Thus, a more flexible way of representing objects and actions is required.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: Concept Grounding in Semantic Video Prediction. After observing the scene, an agent predicts future frames conditioned on a series of semantic actions describing agent-object interactions. Neither bounding boxes nor key points are provided. Conditioning on different action labels leads to Counterfactual generations.
|
| 19 |
+
|
| 20 |
+
We present a new video prediction model, MAC, short for Modular Action Concept Network. Inspired by the idea of Mixture of Experts, MAC embodies each semantic label by a structured combination of various concept slots, each of which encodes the spatial representation of a specific concept. Such design allows MAC to reuse and integrate the knowledge learnt from different scenarios so that it can perceive the locations of motionless objects and extrapolate to unseen cases, showing the progression towards higher-level cognitive abilities. The contributions of this work are summarized as follows:
|
| 21 |
+
|
| 22 |
+
1. We introduce a new task, semantic action-conditional video prediction as illustrated in Fig 1, which can be viewed as an inverse problem of action recognition.
|
| 23 |
+
2. We create two new synthetic video datasets, CLEVR-Building-blocks and Sapien-Kitchen, and label one real-world dataset called Tower-Creation for evaluation.
|
| 24 |
+
3. We propose a novel video prediction model, Modular Action Concept Network, in which routing of visual concept slots is directly controlled by action labels. We show that MAC can successfully depict the long-term counterfactual evolution without need of bounding boxes.
|
| 25 |
+
4. We demonstrate that the trained MAC can make out-of-distribution generalization, be adapted for new object categories with a small number of samples and exploit its learnt features for detection.
|
| 26 |
+
|
| 27 |
+
# 2 APPROACH
|
| 28 |
+
|
| 29 |
+
We begin with defining the task of semantic action-conditional video prediction. Given an initial frame $x _ { 0 }$ and a sequence of action labels $a _ { 1 : T }$ , the model is required to predict the corresponding future frames $x _ { 1 : T }$ . Each action label is a pre-defined semantic description of a spatiotemporal movement that involves multiple objects in a scene and spans over multiple frames such as "take the yellow cup on the table" from $t = 0$ to $t = 1 0$ . So technically, one can regard this task as an inverse problem of action recognition. It should also be pointed out that our semantic task is different from common dense video prediction and generation tasks in the sense that it focuses on predicting time-agnostic events. Hence, we design the corresponding datasets as videos capturing sufficient key frames of entire actions. In future practices, we can further apply video interpolation methods in CV or motion planner algorithms in RL to make up the intermediate process if needed.
|
| 30 |
+
|
| 31 |
+

|
| 32 |
+
Figure 2: The pipeline of MAC in which the computation of concept slot module is elaborated (Better viewed in color). Feature maps extracted by encoder are mapped into the concept slot tensors. Concept slot module receives an action label that controls the collection of concept slot tensors and outputs representations encapsulating this action. A recurrent predictor updates representations before sending them to decoder to predict the next frame.
|
| 33 |
+
|
| 34 |
+
# 2.1 MOTIVATION
|
| 35 |
+
|
| 36 |
+
The design of our new task is necessary for studying compositional generalization as it detaches the definition of object from its specific location. However, it also requires a successful model to figure out where the desired object is through leveraging abstract labels. Our main idea is that we create a large number of small specialized learners called concept slots for each word in the dictionary of action labels to capture their corresponding spatial representations from observations. During training, action labels will be translated as constituency trees to control the activations of all related concept slots and to assemble the representations of given actions for next-frame prediction. As a result, this language-guided gating mechanism embeds the syntactic structures into the learning system and enables the proposed model to dynamically recombine its learnt concepts so that it can understand the combinatorial complexity of the world. In this paper, we demonstrate that our method possesses many key characteristics of system-2 learning (Goyal et al. (2019); Goyal & Bengio (2020)), including concept grounding, sample efficiency, counterfactual generations, out-of-distribution generalization and fast transfer.
|
| 37 |
+
|
| 38 |
+
# 2.2 MODULAR ACTION CONCEPT NETWORK
|
| 39 |
+
|
| 40 |
+
The MAC model is composed of 4 modules including encoder $\mathcal { E }$ , decoder $\mathcal { D }$ , concept slot module $\mathcal { C }$ and recurrent predictor $\mathcal { P }$ . The goal of our model is to learn the following mapping:
|
| 41 |
+
|
| 42 |
+
$$
|
| 43 |
+
\hat { x } _ { t } = \mathcal { D } ( \mathcal { P } ( \mathcal { C } ( \mathcal { E } _ { t - 1 } ) | a _ { t } ) | h _ { t - 1 } ) )
|
| 44 |
+
$$
|
| 45 |
+
|
| 46 |
+
where $x _ { t } , a _ { t }$ and $h _ { t }$ are video frame, action labels and hidden states at time $t$ . The overall architecture of our method is illustrated in Fig 2. In the case of stochastic video generation, another two modules, prior $p ( z )$ and posterior $q ( z )$ , will be added to help estimate the latent distribution of trajectories.
|
| 47 |
+
|
| 48 |
+
Encoder and Decoder: At each timestep $t - 1$ , the encoder $\mathcal { E }$ receives visual input $x _ { t - 1 }$ and extracts a set of multi-scale feature maps. In the deterministic setting, we employ a convolutional neural network with an architecture similar to VGG16 (Simonyan $\&$ Zisserman (2014)). The matching decoder $\mathcal { D }$ is a mirrored version of the encoder with down-sampling operations replaced with spatial up-sampling and additional sigmoid output layer. It aggregates the updated latent representations produced by predictor and multi-scale feature maps from encoder to predict the next frame $\hat { x } _ { t }$ .
|
| 49 |
+
|
| 50 |
+
In the stochastic setting, we use invertible autoencoder introduced in CrevNet (Yu et al. (2019)) instead as we find this information-preserving architecture can better preserve the attributes of randomly moving objects. The corresponding decoder is the backward pass, i.e. inverse computation, of the same network of the encoder. Readers can find more details about invertible autoencoder and coupling layer in Appendix B.
|
| 51 |
+
|
| 52 |
+
Concept Slot Module: The concept slot module $\mathcal { C }$ is the core module of MAC. It resembles the mixture of experts as each slot focuses on only one concept in the space of action labels and will be activated and assembled to represent the given actions through the language-guided gating functions.
|
| 53 |
+
|
| 54 |
+
Each action label will first be decomposed into several constituents of sentence. A constituent is a verb or object phrase, like “pick” or "large red bowl". Since we are mostly dealing with manipulation videos, actions are usually divided into 3 constituents, verb, object1, object2. Each constituent will have its own dictionary recording all pre-defined words or concepts and gating functions can be derived based on these dictionaries to establish bottom-up connections from concept slots. The computation of concept slot module is given as follows:
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
\mathbf { w } ^ { i } = \Psi ^ { i } ( \mathbf { f } ) , \qquad \mathbf { c } ^ { j } = \Phi ^ { j } ( \mathrm { C o n c a t } ( \{ \mathbf { w } ^ { i } | \forall i , \delta ^ { j } ( i ) = 1 \} ) )
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
where w and c are concept and constituent representations and $\delta ^ { j }$ is the indicator function for gating function of $j _ { \mathrm { t h } }$ constituent. More specifically, after the feature maps f are extracted from the input image, they are fed into $\kappa$ convolutional units $\Psi ^ { i }$ , i.e. the concept slot layer, to create $\kappa$ concept slot tensors of dimension $N _ { d }$ . Here, $\kappa$ is the total number of possible concepts we pre-defined in the dictionary of action labels. Since verbs can be interpreted as spatiotemporal changes of relationships between objects, not only slots for objects but also slots for verbs, like ’take’ or ’put on’, are computed from the extracted feature maps.
|
| 61 |
+
|
| 62 |
+
Next, a gating function will collect all involved concept slot tensors and create an ensemble as input for each constituent. This assembly process simulates the formation of simplified constituency parse trees. Constituent slot layer $\Phi ^ { j }$ can either be resolution-preserving or upsampling operators as spatial information is important for our new task. Finally, outputs of all constituent slots are concatenated pixel-wisely to obtain the representation of actions before sending them to predictor. It is worth noticing that MAC is allowed to have multiple concurrent actions in a scene at inference time. In this case, we copy additional groups of trained constituent slots to represent other actions.
|
| 63 |
+
|
| 64 |
+
Learned Prior: We leverage a technique called learned prior from SVG (Denton & Fergus (2018)) to model the stochastic movements in videos. In particular, we build two additional recurrent inference networks, prior and posterior respectively, to capture the randomness of motions. During training, the posterior inference network $q ( z )$ can access to the representations of target frames to estimate a true distribution of trajectory that we expect its prior counterpart $p ( z )$ to mimic at test time. Codes of motions $z _ { t }$ estimated by posterior during training (or by prior during testing) will then be concatenated with latent representations before sent to predictor.
|
| 65 |
+
|
| 66 |
+
Predictor: The recurrent predictor $\mathcal { P }$ , implemented as a stack of residual ConvLSTM layers (Shi et al. (2015)), calculates the spatiotemporal evolution for each action label respectively. The memory mechanism of ConvLSTM is essential for MAC to remember its previous actions and to recover the occluded objects. To prevent interference between concurrent actions, hidden states are not shared between actions. The outputs of predictor for all action labels are added point-wisely.
|
| 67 |
+
|
| 68 |
+
Training: In the deterministic setting, we train our model by minimizing the mean squared error the between the target frames and the predictions. In the stochastic setting, we optimize the following variational lower bound (ELBO) using re-parameterization trick (Kingma & Welling (2013)):
|
| 69 |
+
|
| 70 |
+
$$
|
| 71 |
+
\mathcal { L } _ { \theta , \phi , \psi } ( x _ { 1 : T } ) = \sum _ { t = 1 } ^ { T } [ \mathbb { E } _ { q _ { \phi } ( z _ { 1 : t } | x _ { 1 : t } ) } \log p _ { \theta } ( x _ { t } | z _ { 1 : t } , x _ { 1 : t - 1 } ) - \beta D _ { K L } ( q _ { \phi } ( z _ { t } | x _ { 1 : t } ) | | p _ { \psi } ( z _ { t } | x _ { 1 : t - 1 } ) ]
|
| 72 |
+
$$
|
| 73 |
+
|
| 74 |
+
where $p _ { \theta }$ is the future frame generator, $z _ { t }$ represents the latent codes of motion, $p _ { \psi } \big ( z _ { t } | x _ { 1 : t - 1 } \big )$ is the prior distribution, $q _ { \phi } \big ( { z } _ { t } | { x } _ { 1 : t } \big )$ is the posterior distribution and $D _ { K L }$ denotes the Kullback–Leibler (KL) divergence which forces the posterior to approximate the prior distribution. Since $p _ { \theta }$ is modeled by conditional Gaussian, the likelihood term reduces to MSE measure between the ground truth frames and the predictions. The full derivation of ELBO is provided in the Appendix A.
|
| 75 |
+
|
| 76 |
+
At the inference phase, the model will use its previous predictions as visual inputs instead except for the first pass. Hence, a training strategy called scheduled sampling (Bengio et al. (2015)) is adopted to alleviate the discrepancy between training and inference.
|
| 77 |
+
|
| 78 |
+
# 3 DATASETS
|
| 79 |
+
|
| 80 |
+
In this study, we create two new synthetic datesets, CLEVR-Building-blocks and Sapien-Kitchen, and label one real-world dataset called Tower-Creation from Roboturk (Mandlekar et al. (2018))
|
| 81 |
+
|
| 82 |
+
for evaluation. This is because most existing video datasets either don’t come with semantic action labels (Babaeizadeh et al. (2017)) or fail to provide necessary visual information in their first frames due to egomotions and occlusions (Hundt et al. (2018)). Although there are several candidate datasets like Penn Action (Zhang et al. (2013)), BAIR (Finn et al. (2016)) and KTH (Schuldt et al. (2004)) for multi-modal learning, they all adopt the same single-entity setting which actually indicates they can be solved by a much simpler model. To tackle the above issues, we design each video in our datatsets as a depiction of certain atomic action performed by an agent with objects which are observable in the starting frame. Furthermore, we add functions to generate bounding boxes of all objects for both synthetic datasets in order to train AG2Vid. It is worth noting that all three of these domains exhibit a key property named combinatorial explosion, resulting in factorial complexity growth in both spatial and temporal dimensions even with a small object set. For instance, a sequence with 6 (out of 32) objects and 6 actions can have 333,396,000 possibilities without considering any continuous factor. Hence, our model only sees a small fraction of these potential scenarios during training.
|
| 83 |
+
|
| 84 |
+
# 3.1 CLEVR-BUILDING-BLOCKS DATASET
|
| 85 |
+
|
| 86 |
+
CLEVR-Building-blocks dataset is built upon CLEVR environment (Johnson et al. (2017)). For each video, the data generator initializes the scene with 4 - 6 randomly positioned and visually different objects. There are totally 32 combinations of shapes, colors and materials of objects and at most one instance of each combination is allowed to appear in a video sequence. The agent can perform one of the following 8 actions on objects ${ \mathcal { O } } _ { A }$ and $\mathcal { O } _ { B }$ : Pick ${ \mathcal { O } } _ { A }$ , Pick and Rotate ${ \mathcal { O } } _ { A }$ transversely / longitudinally, Put ${ \mathcal { O } } _ { A }$ on $\mathcal { O } _ { B }$ , Put ${ \mathcal { O } } _ { A }$ on the left / right side of $\mathcal { O } _ { B }$ , Put ${ \mathcal { O } } _ { A }$ in the front of / behind $\mathcal { O } _ { B }$ . Each training sample contains a video of three consecutive Pick- and $P u t -$ action pairs and a sequence of semantic action labels of every frame.
|
| 87 |
+
|
| 88 |
+
# 3.2 SAPIEN-KITCHEN DATASET
|
| 89 |
+
|
| 90 |
+
Sapien-Kitchen Dataset describes a more complicated environment in the sense that: (a). It contains deformable actions like "open" and "close"; (b). The structures of different objects in the same category are highly diverse; (c). Objects can be initialized with randomly assigned relative positions like "along the wall" and "on the dishwasher". We collect totally 21 types of small movable objects in 3 categories, bottle, kettle and kitchen pot, and 19 types of large openable appliances in another 3 categories, oven, refrigerator and dishwasher, from Sapien engine (Xiang et al. (2020)). The agent can perform one of the following 6 atomic actions on small object $\mathcal { O } _ { s }$ and large appliance $\mathcal { O } _ { l }$ : Take $\mathcal { O } _ { s }$ on $\mathcal { O } _ { l }$ , Take $\mathcal { O } _ { s }$ in $\mathcal { O } _ { l }$ , Put $\mathcal { O } _ { s }$ on $\mathcal { O } _ { l }$ , Put $\mathcal { O } _ { s }$ in $\mathcal { O } _ { l }$ , Open $\mathcal { O } _ { l }$ and Close $\mathcal { O } _ { l }$ . Composite action sequences are defined as follows: "Take_on–Put_on", "Take_on–Open–Put_in–Close", "Open–Take_in–Close".
|
| 91 |
+
|
| 92 |
+
# 3.3 TOWER-CREATION DATASET
|
| 93 |
+
|
| 94 |
+
Each video in Tower-Creation Dataset depicts a robotic arm building a tower with flatware present on the table. We have labeled 524 videos in total since semantic descriptions are not provided and prodce 1867 samples consists of two actions: Pick ${ \mathcal { O } } _ { A }$ and Put ${ \mathcal { O } } _ { A }$ on $\mathcal { O } _ { B }$ . We use 1536 video clips for training and 331 for evaluation. It should be pointed out that the size of Tower-Creation dataset is small compared with commonly used datasets such as BAIR (Finn et al. (2016)) which has $5 9 \mathrm { k }$ videos in total. Thus, our experiments can also tell whether evaluated methods are data efficient.
|
| 95 |
+
|
| 96 |
+
# 4 EXPERIMENTAL EVALUATION
|
| 97 |
+
|
| 98 |
+
# 4.1 ACTION-CONDITONAL VIDEO PREDICTION
|
| 99 |
+
|
| 100 |
+
Baselines and setup: We evaluate the proposed model on CLEVR-Building-blocks and SapienKitchen Datasets. AG2Vid (Bar et al. (2020)) is re-implemented as the baseline model because it is the most related work. Unlike our method which only needs visual input and action sequence, AG2Vid also requires bounding boxes of all objects and progress meters of actions, i.e. clock edge, for training and testing. Furthermore, we conduct an ablation study by replacing concept slot module with the concatenation of features and tiled action vector, which is commonly used in low-level action-conditional video prediction (Finn et al. (2016)), to show the effectiveness of our module.
|
| 101 |
+
|
| 102 |
+
Metrics: To estimate the fidelity of action-conditional video prediction, MSE, SSIM (Wang et al. (2004)), PSNR and LPIPS (Zhang et al. (2018)) are calculated between the predictions and groundtruths. However, these metrics may not effectively tell if actions are successfully completed due to the small sizes of the moving objects. Hence, we also perform a human study to assess the accuracy of performing the correct action in generated videos for each model. The human judges annotate whether the model can identify the desired objects, perform actions specified by action labels and maintain the consistent visual appearances of all objects in its generations and only videos meeting all three criterions are scored as correct.
|
| 103 |
+
|
| 104 |
+

|
| 105 |
+
Figure 3: The qualitative comparison on CLEVR-Building-blocks and Sapien-Kitchen. The first row of each figure is the groundtruth sequence. The red, blue and green boxes highlight the quality of predictions by each method. In contrast to the success of MAC, concatenation-based method fails to find the correct destinations or to preserve attributes of moving objects. Also, bounding boxes used in AG2Vid cannot portray visual changes like rotations correctly.
|
| 106 |
+
|
| 107 |
+
<table><tr><td rowspan="2">Model</td><td colspan="4">CLEVR-Building-blocks</td><td colspan="4">Sapien-Kitchen</td></tr><tr><td>SSIM↑</td><td>MSE↓</td><td>LPIPS↓</td><td>Accuracy↑</td><td>SSIM↑</td><td>MSE↓</td><td>LPIPS↓</td><td>Accuracy↑</td></tr><tr><td>Copy-First-Frame</td><td>0.962</td><td>251.38</td><td>0.1320</td><td>-</td><td>0.951</td><td>152.87</td><td>0.0393</td><td>1</td></tr><tr><td>Concatenation Baseline</td><td>0.961</td><td>226.53</td><td>0.1301</td><td>50.8%</td><td>0.962</td><td>23.13</td><td>0.0232</td><td>52.4%</td></tr><tr><td>AG2Vid</td><td>0.956</td><td>58.67</td><td>0.0399</td><td>78.8%</td><td>0.947</td><td>270.87</td><td>0.0684</td><td>5.2%</td></tr><tr><td>MAC</td><td>0.983</td><td>43.52</td><td>0.0303</td><td>95.2%</td><td>0.971</td><td>11.16</td><td>0.0178</td><td>86.4%</td></tr></table>
|
| 108 |
+
|
| 109 |
+
Table 1: Quantitative evaluation on CLEVR-Building-blocks and Sapien-Kitchen. All metrics are averaged frame-wisely except for accuracy.
|
| 110 |
+
|
| 111 |
+
Results: The quantitative comparisons of all methods are summarized in Table 1. The MAC achieves the best scores on all metrics without access to additional information like bounding boxes, showing the superior performance of our concept slot module. The qualitative analysis in Fig 3 further reveals the drawbacks of other baselines. For CLEVR-Building-blocks, the concatenation-based variant fails to recognize the right objects due to its limited inductive bias. Although AG2Vid has no difficulty in identifying the desired objects, assumptions made by flow warping are too strong to handle rotation and occlusion. Consequently, the adversarial loss enforces AG2Vid to fix these errors by converting them to wrong poses or colors. These limitations of AG2Vid will be further amplified in a more complicated environment, i.e. Sapien-Kitchen. The same architecture used for CLEVR can only learn to remove the moving objects from their starting positions in Sapien-Kitchen because rotation and occlusion occur more often. The concatenation baseline performs better by showing correct generation of open and close actions on large appliance. Yet, it still fails to produce long-term consistent predictions as the visual appearances of moving objects are altered. On the contrary, MAC can authentically depict the correct actions specified by action labels on both datasets.
|
| 112 |
+
|
| 113 |
+

|
| 114 |
+
Figure 4: Counterfactual video generation: Conditioning on the same initial frame and different action labels, MAC can produce high-quality imaginations of counterfactual futures. Various visual outcomes present in the final frames are highlighted with red boxes and enlarged in the final column. Top: Generative results on CLEVR-Building-blocks. 34 frames are generated. Bottom: Generative results on Sapien-Kitchen dataset. 35 frames are generated.
|
| 115 |
+
|
| 116 |
+

|
| 117 |
+
Figure 5: Left: Visual comparison between sMAC and SVG-LP on Tower-Creation. The supposed completions of Pick and Put in the final frames are highlighted by red and yellow boxes while incorrect completions in SVG-LP generations are labelled by grey boxes. The last two rows are counterfactual generations in which models are given different action labels. Right: Quantitative comparison per-frame. Higher SSIM and PSNR indicate better performance.
|
| 118 |
+
|
| 119 |
+
# 4.2 COUNTERFACTUAL GENERATION
|
| 120 |
+
|
| 121 |
+
Counterfactual generation: The most intriguing application of MAC is counterfactual generation. More specifically, counterfactual generation means that our model will observe the same starting frame but receive different valid action labels to produce the corresponding future frames.
|
| 122 |
+
|
| 123 |
+

|
| 124 |
+
Figure 6: Compositional generalization and feature reuse.Top: Unobserved scenarios. All red cubes are removed from the tranining data, but the trained model can still manipulate red cube at test time. Middle: Concurrent actions. Inputting two action sequences at the same time. Both actions are depicted correctly. Bottom Left: New-object adaptation. Even with a few training samples, MAC can be fast adapted for generation of new objects. Red arrows point to new objects present in images. Bottom Right: Object detection.
|
| 125 |
+
|
| 126 |
+
Results: The visual results of counterfactual generations on each dataset are displayed in Fig 4. As we can see, our model successfully identifies the desired objects, plans correct trajectories toward the target places and generates high-quality imaginations of counterfactual futures. It is also worth noticing that all displayed generations are long-term generations , i.e. more than 30 frames are predicted for each sequence. Our recurrent predictor plays an very important role in sustaining the spatiotemporal consistency and in reconstructing the fully-occluded objects.
|
| 127 |
+
|
| 128 |
+
# 4.3 STOCHASTIC VIDEO GENERATION
|
| 129 |
+
|
| 130 |
+
Baselines and setup: We continue to evaluate the stochastic version of MAC (sMAC) on TowerCreation dataset. SVG-LP was extended to action-conditional version in (Villegas et al. (2019)) so that we can adopt it as the baseline model to demonstrate the effectiveness of concept slot module.
|
| 131 |
+
|
| 132 |
+
Results: The qualitative and quantitative comparison between sMAC and action-conditional SVG-LP is provided in Fig 5. Although SVG-LP can partially understand the given action labels, it often fails to locate and manipulate the desired objects. Consequently, it will generate the moving object out of nowhere and often place it on a wrong target object. In contrast, sMAC can successfully simulate the trajectory of robotic arms and correctly animate the "Pick" and "Put" actions thanks to the concept slot module. Row 3 and 5 in Fig 5 show that sMAC is also capable of producing diverse future frames and predicting counterfactual results following different action instructions.
|
| 133 |
+
|
| 134 |
+
# 4.4 COMPOSITIONAL GENERALIZATION
|
| 135 |
+
|
| 136 |
+
We further explore other interesting features of our MAC. We first demonstrate that MAC is capable of making out-of-distribution generalization by designing two experiments. We evaluate how quickly our model can be adapted to new objects. It turns out for each new object, the trained MAC only requires a few training video examples to generate decent results. Finally, to verify that our model encodes the spatial information, we add SSD (Liu et al. (2016)) head after the frozen encoder and concept slot layer to conduct object detection.
|
| 137 |
+
|
| 138 |
+
Unobserved scenarios: We design an interesting experiment where only a subset of CLEVRBuilding-blocks data are used for training and check what will happen if we input the unobserved action labels to the trained model. More precisely, we exclude all videos manipulating red cubes in the training sets and send the instructions involving red cubes at test time. The visualization of this experiment can be found in Fig 6. As we can see, MAC can still identify and manipulate red cubes correctly, showing its ability to recombine the learnt concept to comprehend new objects.
|
| 139 |
+
|
| 140 |
+
Concurrent actions: Concurrent actions means multiple action inputs at the same time. It can be considered as out-of-distribution generalization because our model only observes single-action videos during training. Generating concurrent-action videos needs to employ copied constituent slots and parallel hidden states. As illustrated in Fig 6, MAC can linearly integrate the action information in the latent space and correctly portray 2 concurrent actions in the same scene.
|
| 141 |
+
|
| 142 |
+
Adaptation: We add a new openable category "safe" and a new movable category "dispenser" into Sapien-Kitchen and generate 100 video sequences for each new object showing its interaction with other objects. Approximately, there are about 5 new sequences created for each new action pair between 2 objects. Blank concept slots for new categories are attached to trained MAC and we finetune it on this small new training set. Visualization in Fig 6 shows that even with a few training samples, MAC is accurately adapted for video generation of new objects. This is because, with the help of concept slots, MAC can disentangle actions into relatively independent grounded concepts. When it learns new concepts, MAC reuses and integrates prior knowledge learnt from different cases.
|
| 143 |
+
|
| 144 |
+
Object detection: The quantitative results of object detection and more visualizations can be found in Appendix D. We observe that the features learnt by MAC can be easily transferred for detection as our video prediction task is highly location-dependent. This result indicates that utilizing bounding boxes might be a little redundant for some video tasks because videos already provide rich motion information that can be used for salient object detection.
|
| 145 |
+
|
| 146 |
+
# 5 RELATED WORK
|
| 147 |
+
|
| 148 |
+
Video prediction: ConvLSTM (Shi et al. (2015)) was the first deep learning model that employed a hybrid of convolutional and recurrent units for passive video prediction. This architectural design was soon followed by studies looking at a similar problem (Kalchbrenner et al. (2017); Mathieu et al. (2015); Wang et al. (2017); Yu et al. (2019); Wang et al. (2018b)). However, the capability of passive video prediction framework is very limited as models usually don’t have sufficient information to predict the long-term future due to partial observation, egomotion and randomness. More importantly, this setting prevents models from interacting with environment. On the other hand, the low-level action-conditional video prediction task provides an action vector at each timestep as additional input to guide the prediction (Oh et al. (2015); Chiappa et al. (2017); Babaeizadeh et al. (2017); Wu et al. (2021)). CDNA (Finn et al. (2016)) is a representative of such models. In CDNA, the states and action vectors of the robotic manipulator are first spatially tiled and integrated into the model through concatenation. SVG (Denton & Fergus (2018)) was initially proposed for stochastic video generation but later was extended to action-conditional version in (Villegas et al. (2019)). It is worth noticing that SVG also used concatenation to incorporate action information. Such implementations are prevalent in low-level action-conditional video prediction because the action vector only encodes the spatial information of a single entity, usually a robotic manipulator (Finn et al. (2016)) or a human hand. A common failure case for such models is the presence of multiple affordable entities (Kim et al. (2019)), a scenario that our task definition and datasets focus on.
|
| 149 |
+
|
| 150 |
+
Modularity: Mixture of Experts refers to a classical machine learning technique where various learners are employed, each of which specializes in one particular function, and their output are aggregated through a gating function. This modular design makes each submodule relatively independent and thus leads to better generalization and robustness to compositional changes, which has been studied in several works (Goyal et al. (2019); Afshar et al. (2021); Sabour et al. (2017); Henaff et al. (2016)). In this work, we hypothesis that the underlying syntactic structures of semantic labels can tell how to aggregate the representations of individual concept learners. By translating labels into constituency trees, action graphs are embedded into the learning system to get the entire perspective of ongoing activities while each concept learner can focus on its specific subtask.
|
| 151 |
+
|
| 152 |
+
# 6 CONCLUSION
|
| 153 |
+
|
| 154 |
+
In this work, we propose the new task of semantic action-conditional video prediction and introduce 3 new datasets that are meant to bridge the gap towards a robust solution to this task in complex interactive scenarios. MAC, a novel video prediction model, was also designed by utilizing the idea of Mixture of Experts to ground action concept for video generation. Our proposed model can generate alternative futures without requiring additional auxiliary data such as bounding boxes, and is shown to be both quickly extendible and adaptable to novel scenarios and entities. It is our hope that our contributions will advance progress and understanding within this new task space, and that a model robust enough for real-world applications (i.e. in robotic systems) in perception and control will be eventually proposed as a descendant of this work.
|
| 155 |
+
|
| 156 |
+
# REFERENCES
|
| 157 |
+
|
| 158 |
+
Parnian Afshar, Farnoosh Naderkhani, Anastasia Oikonomou, Moezedin Javad Rafiee, Arash Mohammadi, and Konstantinos N Plataniotis. Mixcaps: A capsule network-based mixture of experts for lung nodule malignancy prediction. Pattern Recognition, 116:107942, 2021.
|
| 159 |
+
|
| 160 |
+
Mohammad Babaeizadeh, Chelsea Finn, Dumitru Erhan, Roy H Campbell, and Sergey Levine. Stochastic variational video prediction. arXiv preprint arXiv:1710.11252, 2017.
|
| 161 |
+
|
| 162 |
+
Amir Bar, Roei Herzig, Xiaolong Wang, Gal Chechik, Trevor Darrell, and Amir Globerson. Compositional video synthesis with action graphs. arXiv preprint arXiv:2006.15327, 2020.
|
| 163 |
+
|
| 164 |
+
Samy Bengio, Oriol Vinyals, Navdeep Jaitly, and Noam Shazeer. Scheduled sampling for sequence prediction with recurrent neural networks. In Advances in Neural Information Processing Systems, pp. 1171–1179, 2015.
|
| 165 |
+
|
| 166 |
+
Wonmin Byeon, Qin Wang, Rupesh Kumar Srivastava, and Petros Koumoutsakos. Contextvp: Fully contextaware video prediction. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 753–769, 2018.
|
| 167 |
+
|
| 168 |
+
Silvia Chiappa, Sébastien Racaniere, Daan Wierstra, and Shakir Mohamed. Recurrent environment simulators. arXiv preprint arXiv:1704.02254, 2017.
|
| 169 |
+
|
| 170 |
+
Emily Denton and Rob Fergus. Stochastic video generation with a learned prior. arXiv preprint arXiv:1802.07687, 2018.
|
| 171 |
+
|
| 172 |
+
Laurent Dinh, David Krueger, and Yoshua Bengio. Nice: Non-linear independent components estimation. arXiv preprint arXiv:1410.8516, 2014.
|
| 173 |
+
|
| 174 |
+
Frederik Ebert, Chelsea Finn, Alex X Lee, and Sergey Levine. Self-supervised visual planning with temporal skip connections. arXiv preprint arXiv:1710.05268, 2017.
|
| 175 |
+
|
| 176 |
+
Chelsea Finn, Ian Goodfellow, and Sergey Levine. Unsupervised learning for physical interaction through video prediction. In Advances in neural information processing systems, pp. 64–72, 2016.
|
| 177 |
+
|
| 178 |
+
Anirudh Goyal and Yoshua Bengio. Inductive biases for deep learning of higher-level cognition. arXiv preprint arXiv:2011.15091, 2020.
|
| 179 |
+
|
| 180 |
+
Anirudh Goyal, Alex Lamb, Jordan Hoffmann, Shagun Sodhani, Sergey Levine, Yoshua Bengio, and Bernhard Schölkopf. Recurrent independent mechanisms. arXiv preprint arXiv:1909.10893, 2019.
|
| 181 |
+
|
| 182 |
+
Mikael Henaff, Jason Weston, Arthur Szlam, Antoine Bordes, and Yann LeCun. Tracking the world state with recurrent entity networks. arXiv preprint arXiv:1612.03969, 2016.
|
| 183 |
+
|
| 184 |
+
De-An Huang, Shyamal Buch, Lucio Dery, Animesh Garg, Li Fei-Fei, and Juan Carlos Niebles. Finding" it": Weakly-supervised reference-aware visual grounding in instructional videos. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5948–5957, 2018.
|
| 185 |
+
|
| 186 |
+
Andrew Hundt, Varun Jain, Chia-Hung Lin, Chris Paxton, and Gregory D Hager. The costar block stacking dataset: Learning with workspace constraints. arXiv preprint arXiv:1810.11714, 2018.
|
| 187 |
+
|
| 188 |
+
Jingwei Ji, Ranjay Krishna, Li Fei-Fei, and Juan Carlos Niebles. Action genome: Actions as compositions of spatio-temporal scene graphs. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10236–10247, 2020.
|
| 189 |
+
|
| 190 |
+
Beibei Jin, Yu Hu, Qiankun Tang, Jingyu Niu, Zhiping Shi, Yinhe Han, and Xiaowei Li. Exploring spatialtemporal multi-frequency analysis for high-fidelity and temporal-consistency video prediction. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 4554–4563, 2020.
|
| 191 |
+
|
| 192 |
+
Justin Johnson, Bharath Hariharan, Laurens van der Maaten, Li Fei-Fei, C Lawrence Zitnick, and Ross Girshick. Clevr: A diagnostic dataset for compositional language and elementary visual reasoning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2901–2910, 2017.
|
| 193 |
+
|
| 194 |
+
Nal Kalchbrenner, Aäron van den Oord, Karen Simonyan, Ivo Danihelka, Oriol Vinyals, Alex Graves, and Koray Kavukcuoglu. Video pixel networks. Proceedings of Machine Learning Research, 2017. URL http://proceedings.mlr.press/v70/kalchbrenner17a.html.
|
| 195 |
+
|
| 196 |
+
Yunji Kim, Seonghyeon Nam, In Cho, and Seon Joo Kim. Unsupervised keypoint learning for guiding classconditional video prediction. In Advances in Neural Information Processing Systems, pp. 3814–3824, 2019.
|
| 197 |
+
|
| 198 |
+
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 199 |
+
|
| 200 |
+
Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
|
| 201 |
+
|
| 202 |
+
Thanard Kurutach, Aviv Tamar, Ge Yang, Stuart J Russell, and Pieter Abbeel. Learning plannable representations with causal infogan. In Advances in Neural Information Processing Systems, pp. 8733–8744, 2018.
|
| 203 |
+
|
| 204 |
+
Wei Liu, Dragomir Anguelov, Dumitru Erhan, Christian Szegedy, Scott Reed, Cheng-Yang Fu, and Alexander C Berg. Ssd: Single shot multibox detector. In European conference on computer vision, pp. 21–37. Springer, 2016.
|
| 205 |
+
|
| 206 |
+
Ajay Mandlekar, Yuke Zhu, Animesh Garg, Jonathan Booher, Max Spero, Albert Tung, Julian Gao, John Emmons, Anchit Gupta, Emre Orbay, et al. Roboturk: A crowdsourcing platform for robotic skill learning through imitation. In Conference on Robot Learning, pp. 879–893. PMLR, 2018.
|
| 207 |
+
|
| 208 |
+
Michael Mathieu, Camille Couprie, and Yann LeCun. Deep multi-scale video prediction beyond mean square error. arXiv preprint arXiv:1511.05440, 2015.
|
| 209 |
+
|
| 210 |
+
Junhyuk Oh, Xiaoxiao Guo, Honglak Lee, Richard L Lewis, and Satinder Singh. Action-conditional video prediction using deep networks in atari games. In Advances in neural information processing systems, pp. 2863–2871, 2015.
|
| 211 |
+
|
| 212 |
+
Sara Sabour, Nicholas Frosst, and Geoffrey E Hinton. Dynamic routing between capsules. In Advances in neural information processing systems, pp. 3856–3866, 2017.
|
| 213 |
+
|
| 214 |
+
Christian Schuldt, Ivan Laptev, and Barbara Caputo. Recognizing human actions: a local svm approach. In Pattern Recognition, 2004. ICPR 2004. Proceedings of the 17th International Conference on, volume 3, pp. 32–36. IEEE, 2004.
|
| 215 |
+
|
| 216 |
+
Wenzhe Shi, Jose Caballero, Ferenc Huszár, Johannes Totz, Andrew P Aitken, Rob Bishop, Daniel Rueckert, and Zehan Wang. Real-time single image and video super-resolution using an efficient sub-pixel convolutional neural network. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1874–1883, 2016.
|
| 217 |
+
|
| 218 |
+
Xingjian Shi, Zhourong Chen, Hao Wang, Dit-Yan Yeung, Wai-Kin Wong, and Wang-chun Woo. Convolutional lstm network: A machine learning approach for precipitation nowcasting. In Advances in neural information processing systems, pp. 802–810, 2015.
|
| 219 |
+
|
| 220 |
+
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
|
| 221 |
+
|
| 222 |
+
Ruben Villegas, Jimei Yang, Seunghoon Hong, Xunyu Lin, and Honglak Lee. Decomposing motion and content for natural video sequence prediction. arXiv preprint arXiv:1706.08033, 2017.
|
| 223 |
+
|
| 224 |
+
Ruben Villegas, Arkanath Pathak, Harini Kannan, Dumitru Erhan, Quoc V Le, and Honglak Lee. High fidelity video prediction with large stochastic recurrent neural networks. In Advances in Neural Information Processing Systems, pp. 81–91, 2019.
|
| 225 |
+
|
| 226 |
+
Yunbo Wang, Mingsheng Long, Jianmin Wang, Zhifeng Gao, and S Yu Philip. Predrnn: Recurrent neural networks for predictive learning using spatiotemporal lstms. In Advances in Neural Information Processing Systems, pp. 879–888, 2017.
|
| 227 |
+
|
| 228 |
+
Yunbo Wang, Zhifeng Gao, Mingsheng Long, Jianmin Wang, and Philip S Yu. Predrnn $^ { + + }$ : Towards a resolution of the deep-in-time dilemma in spatiotemporal predictive learning. arXiv preprint arXiv:1804.06300, 2018a.
|
| 229 |
+
|
| 230 |
+
Yunbo Wang, Lu Jiang, Ming-Hsuan Yang, Li-Jia Li, Mingsheng Long, and Li Fei-Fei. Eidetic 3d lstm: A model for video prediction and beyond. In International Conference on Learning Representations, 2018b.
|
| 231 |
+
|
| 232 |
+
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.
|
| 233 |
+
|
| 234 |
+
Bohan Wu, Suraj Nair, Roberto Martin-Martin, Li Fei-Fei, and Chelsea Finn. Greedy hierarchical variational autoencoders for large-scale video prediction. arXiv preprint arXiv:2103.04174, 2021.
|
| 235 |
+
|
| 236 |
+
Yue Wu, Rongrong Gao, Jaesik Park, and Qifeng Chen. Future video synthesis with object motion prediction. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 5539–5548, 2020.
|
| 237 |
+
|
| 238 |
+
Fanbo Xiang, Yuzhe Qin, Kaichun Mo, Yikuan Xia, Hao Zhu, Fangchen Liu, Minghua Liu, Hanxiao Jiang, Yifu Yuan, He Wang, et al. Sapien: A simulated part-based interactive environment. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11097–11107, 2020.
|
| 239 |
+
|
| 240 |
+
Wei Yu, Yichao Lu, Steve Easterbrook, and Sanja Fidler. Efficient and information-preserving future frame prediction and beyond. In International Conference on Learning Representations, 2019.
|
| 241 |
+
|
| 242 |
+
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.
|
| 243 |
+
|
| 244 |
+
Weiyu Zhang, Menglong Zhu, and Konstantinos G Derpanis. From actemes to action: A strongly-supervised representation for detailed action understanding. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2248–2255, 2013.
|
| 245 |
+
|
| 246 |
+
# A VARIATIONAL LOWER BOUND DERIVATION
|
| 247 |
+
|
| 248 |
+
The original variational lower bound was derived in (Kingma & Welling (2013)).
|
| 249 |
+
|
| 250 |
+
$$
|
| 251 |
+
\begin{array} { r l } & { \quad \log \gamma _ { \mathbb { P } } ( \mathbf { x } ) = \log \int _ { \mathcal { R } } \log \left( \mathbf { x } \mid \mathbf { x } _ { \mathcal { P } } \rho ( \mathbf { x } ) \mid \mathbf { x } _ { \mathcal { P } } \rho ( \mathbf { x } ) \right. } \\ & { = \log \int _ { \mathcal { R } } p ( \mathbf { x } ) \mid p ( \mathbf { x } ) \mid p ( \mathbf { x } ) \mid \frac { \log ( \mathbf { x } ) \mid \exp ( \mathbf { x } ) } { \exp ( \mathbf { x } ) } } \\ & { = \log \mathbb { E } _ { \rho _ { \xi } \in \{ \mathbf { x } , \mathbf { x } \} } \frac { p ( \mathbf { x } ) \exp ( \mathbf { x } ) \mid \exp ( \mathbf { x } ) } { \exp ( \mathbf { x } ) } } \\ & { \geq \mathbb { E } _ { \mathbf { x } _ { \mathbb { P } } ( \mathbf { x } ) = \mathbf { b } } \frac { p ( \mathbf { x } ) \mid p ( \mathbf { x } ) \mid p ( \mathbf { x } ) } { \exp ( \mathbf { x } ) } } \\ & { = \mathbb { E } _ { \mathbf { x } _ { \mathbb { P } } ( \mathbf { x } ) = \mathbf { b } } \frac { \log ( \mathbf { x } ) \mid \exp ( \mathbf { x } ) } { \exp ( \mathbf { x } ) } } \\ & { = \mathbb { E } _ { \mathbf { x } _ { \mathbb { P } } ( \mathbf { x } ) = \mathbf { b } } \frac { \log ( \mathbf { x } ) \mid \exp ( \mathbf { x } ) - \mathbf { E } _ { \mathbf { x } _ { \mathbb { P } } ( \mathbf { x } ) } \mid \log \frac { \log ( \mathbf { x } \mid \mathbf { x } ) } { p ( \mathbf { x } ) } } { \exp ( \mathbf { x } ) } } \\ & = \mathbb { E } _ { \mathbf { x } _ { \mathbb { P } } ( \mathbf { x } ) \mid \mathbf { x } _ { \mathcal { P } } \rho ( \mathbf { x } ) \mid \exp ( \mathbf { x } ) - \mathcal { P } _ { \mathbf { x } _ { \mathbb { P } } ( \mathbf { x } _ { \mathbb { P } } ( \mathbf { x } ) \mid \rho ( \mathbf { x } ) \mid \exp ( \mathbf { x } ) } { \exp ( \mathbf { x } ) \mid \exp ( \mathbf { x } \mid \mathbf { x } _ { \mathbb { P } } \rho ( \mathbf { x } ) \mid \mathbf { x } ) } } \\ & = \sum _ \mathbf { x } \in \{ \mathbf { x } , \mathbf { x } \mid \mathbf { x } _ { \mathbb { P } } \rho ( \mathbf x \end{array}
|
| 252 |
+
$$
|
| 253 |
+
|
| 254 |
+
The final step (Denton & Fergus (2018)) is obtained through the factorization of reconstruction and KL-Divergence term into individual time steps due to the independence across time.
|
| 255 |
+
|
| 256 |
+
# B INVERTIBLE ARCHITECTURE AND COUPLING LAYER
|
| 257 |
+
|
| 258 |
+
The additive coupling layer was first introduced in (Dinh et al. (2014)). Following (Yu et al. (2019)), we use it as the building block to construct the invertible autoencoder. More specifically, the reshaped input $x$ is divided into two groups, denoted as $x ^ { 1 }$ and $x ^ { 2 }$ , channel-wisely. In its forward pass, one group, e.g. $x ^ { 1 }$ , passes through several convolutional layers and updates the other group, $x ^ { 2 }$ , through addition.
|
| 259 |
+
|
| 260 |
+
$$
|
| 261 |
+
\begin{array} { r } { \hat { x } ^ { 2 } = x ^ { 2 } + \mathcal { F } _ { 1 } ( x ^ { 1 } ) } \\ { \hat { x } ^ { 1 } = x ^ { 1 } + \mathcal { F } _ { 2 } ( \hat { x } ^ { 2 } ) } \end{array}
|
| 262 |
+
$$
|
| 263 |
+
|
| 264 |
+
where $\mathcal { F }$ is a composite non-linear transformation consisting of convolutions and activations, and ${ \hat { x } } ^ { 1 }$ and ${ \hat { x } } ^ { 2 }$ are the updated $x ^ { 1 }$ and $x ^ { 2 }$ . In its backward pass, we can retrieve $x ^ { 1 }$ and $x ^ { 2 }$ from ${ \hat { x } } ^ { 2 }$ and ${ \hat { x } } ^ { 1 }$ by the following inverse computation:
|
| 265 |
+
|
| 266 |
+
$$
|
| 267 |
+
\begin{array} { r } { x ^ { 1 } = \hat { x } ^ { 1 } - \mathcal { F } _ { 2 } ( \hat { x } ^ { 2 } ) } \\ { x ^ { 2 } = \hat { x } ^ { 2 } - \mathcal { F } _ { 1 } ( x ^ { 1 } ) } \end{array}
|
| 268 |
+
$$
|
| 269 |
+
|
| 270 |
+
Pixel shuffle layer (Shi et al. (2016)), a bijective downsampling, is also employed to change the shape of feature from $( w , h , c )$ to $( w / n , h / \bar { n } , c \times n ^ { 2 } )$ to enable the invertibility of the entire network. Stacking these building blocks and downsampling in an alternating fashion between two groups, we will obtain a two-way autoencoder. The property of invertibility ensures no information loss during feature extraction, which is better at preserving the attributes of moving objects. The same network can serve as both the encoder and the decoder by using its forward and backward pass respectively.
|
| 271 |
+
|
| 272 |
+
# C TRAINING SETUP
|
| 273 |
+
|
| 274 |
+
In the deterministic setting, MAC adopts VGG16 (Simonyan & Zisserman (2014)) and a mirrored network as encoder and decoder and 2 layers of residual ConvLSTM as predictor. In the stochastic setting, sMAC replaces its encoder with 24-layer invertible autoencoder and use its backward pass as decoder. Additionally, it also deploys two inference networks composed of 2 layers of ConvLSTM, named prior and posterior, to model conditionally Gaussian distribution of trajectories .
|
| 275 |
+
|
| 276 |
+
We use the Adam optimizer (Kingma & Ba (2014)) with a starting learning rate of $2 \times 1 0 ^ { - 4 }$ to optimize the MAC and sMAC. The training process is stopped after $2 0 0 , 0 0 0$ iterations with the batch size of 4. 20,000 video clips of CLEVR-Building-Blocks and 30,000 of Sapien-Kitchen are generated for model training and additionally 5,000 videos are generated for each dataset for evaluation. Considering the size of Tower-Creation dataset, various traditional data augmentation methods are used and we also implement a new trick in which the neighbouring frames of key frames are sampled from Gaussian distributions to serve as small temporal variations. This trick can significantly improve the visual quality and diversity of stochastic generation for both sMAC and SVG-LP.
|
| 277 |
+
|
| 278 |
+
Table 2: Quantitative measures of object detection on Sapien-Kitchen in terms of average precision.
|
| 279 |
+
|
| 280 |
+
<table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Oven</td><td rowspan=1 colspan=1>Fridge</td><td rowspan=1 colspan=2>DishwashetBottle</td><td rowspan=1 colspan=1>Kettle</td><td rowspan=1 colspan=1>Kitchenpot</td><td rowspan=1 colspan=1>mAP</td></tr><tr><td rowspan=1 colspan=1>MACencoder+SSD</td><td rowspan=1 colspan=1>92.75</td><td rowspan=1 colspan=1>94.56</td><td rowspan=1 colspan=1>90.89</td><td rowspan=1 colspan=1>83.25</td><td rowspan=1 colspan=1>77.18</td><td rowspan=1 colspan=1>81.32</td><td rowspan=1 colspan=1>86.66</td></tr></table>
|
| 281 |
+
|
| 282 |
+

|
| 283 |
+
Figure 7: Visualization of 2D Object Detection on Sapien-Kitchen.
|
| 284 |
+
|
| 285 |
+
# D OBJECT DETECTION
|
| 286 |
+
|
| 287 |
+
The quantitative results and visualization of object detection is provided in the Table 2 and Fig 7. SSD head was optimized following its protocol while the MAC encoder was frozen to demonstrate that features learnt through self-supervision can be directly transferred for detection because our video prediction task is highly location-dependent.
|
md/dev/Loek7hfb46P/Loek7hfb46P.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/LtKcMgGOeLt/LtKcMgGOeLt.md
ADDED
|
@@ -0,0 +1,430 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# WHEN VISION TRANSFORMERS OUTPERFORM RESNETS WITHOUT PRE-TRAINING OR STRONG DATA AUGMENTATIONS
|
| 2 |
+
|
| 3 |
+
Xiangning Chen1,2∗, Cho-Jui Hsieh2, Boqing Gong1 1Google Research, 2Department of Computer Science, UCLA {xiangningc, bgong}@google.com, chohsieh@cs.ucla.edu
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Vision Transformers (ViTs) and MLPs signal further efforts on replacing handwired features or inductive biases with general-purpose neural architectures. Existing works empower the models by massive data, such as large-scale pre-training and/or repeated strong data augmentations, and still report optimization-related problems (e.g., sensitivity to initialization and learning rates). Hence, this paper investigates ViTs and MLP-Mixers from the lens of loss geometry, intending to improve the models’ data efficiency at training and generalization at inference. Visualization and Hessian reveal extremely sharp local minima of converged models. By promoting smoothness with a recently proposed sharpnessaware optimizer, we substantially improve the accuracy and robustness of ViTs and MLP-Mixers on various tasks spanning supervised, adversarial, contrastive, and transfer learning (e.g., $+ 5 . 3 \%$ and $+ 1 1 . 0 \%$ top-1 accuracy on ImageNet for ViT-B/16 and Mixer-B/16, respectively, with the simple Inception-style preprocessing). We show that the improved smoothness attributes to sparser active neurons in the first few layers. The resultant ViTs outperform ResNets of similar size and throughput when trained from scratch on ImageNet without large-scale pre-training or strong data augmentations. Model checkpoints are available at https://github.com/google-research/vision_transformer.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Transformers (Vaswani et al., 2017) have become the de-facto model of choice in natural language processing (NLP) (Devlin et al., 2018; Radford et al., 2018). In computer vision, there has recently been a surge of interest in end-to-end Transformers (Dosovitskiy et al., 2021; Touvron et al., 2021b; Liu et al., 2021b; Fan et al., 2021; Arnab et al., 2021; Bertasius et al., 2021; Akbari et al., 2021) and MLPs (Tolstikhin et al., 2021; Touvron et al., 2021a; Liu et al., 2021a; Melas-Kyriazi, 2021), prompting the efforts to replace hand-wired features or inductive biases with general-purpose neural architectures powered by data-driven training. We envision these efforts may lead to a unified knowledge base that produces versatile representations for different data modalities, simplifying the inference and deployment of deep learning models in various application scenarios.
|
| 12 |
+
|
| 13 |
+
Despite the appealing potential of moving toward general-purpose neural architectures, the lack of convolution-like inductive biases also challenges the training of vision Transformers (ViTs) and MLPs. When trained on ImageNet (Deng et al., 2009) with the conventional Inception-style data preprocessing (Szegedy et al., 2016), Transformers “yield modest accuracies of a few percentage points below ResNets of comparable size” (Dosovitskiy et al., 2021). To boost the performance, existing works resort to large-scale pre-training (Dosovitskiy et al., 2021; Arnab et al., 2021; Akbari et al., 2021) and repeated strong data augmentations (Touvron et al., 2021b), resulting in excessive demands of data, computing, and sophisticated tuning of many hyperparameters. For instance, Dosovitskiy et al. (Dosovitskiy et al., 2021) pre-train ViTs using 304M labeled images, and Touvron et al. (2021b) repeatedly stack four strong image augmentations.
|
| 14 |
+
|
| 15 |
+
In this paper, we show ViTs can outperform ResNets (He et al., 2016) of even bigger sizes in both accuracy and various forms of robustness by using a principled optimizer, without the need for largescale pre-training or strong data augmentations. MLP-Mixers (Tolstikhin et al., 2021) also become on par with ResNets.
|
| 16 |
+
|
| 17 |
+
We first study the architectures fully trained on ImageNet from the lens of loss landscapes and draw the following findings. First, visualization and Hessian matrices of the loss landscapes reveal that Transformers and MLP-Mixers converge at extremely sharp local minima, whose largest principal curvatures are almost an order of magnitude bigger than ResNets’. Such effect accumulates when the gradients backpropagate from the last layer to the first, and the initial embedding layer suffers the largest eigenvalue of the corresponding sub-diagonal Hessian. Second, the networks all have very small training errors, and MLP-Mixers are more prone to overfitting than ViTs of more parameters (because of the difference in self-attention). Third, ViTs and MLP-Mixers have worse “trainabilities” than ResNets following the neural tangent kernel analyses (Xiao et al., 2020).
|
| 18 |
+
|
| 19 |
+
Therefore, we need improved learning algorithms to prevent the convergence to a sharp local minimum when it comes to the convolution-free ViTs and MLP-Mixers. The first-order optimizers (e.g., SGD and Adam (Kingma & Ba, 2015)) only seek the model parameters that minimize the training error. They dismiss the higher-order information such as flatness that correlates with generalization (Keskar et al., 2017; Kleinberg et al., 2018; Jastrz˛ebski et al., 2019; Smith & Le, 2018; Chaudhari et al., 2017).
|
| 20 |
+
|
| 21 |
+
The above study and reasoning lead us to the recently proposed sharpness-aware minimizer (SAM) (Foret et al., 2021) that explicitly smooths the loss geometry during model training. SAM strives to find a solution whose entire neighborhood has low losses rather than focus on any singleton point. We show that the resultant models exhibit smoother loss landscapes, and their generalization capabilities improve tremendously across different tasks including supervised, adversarial, contrastive, and transfer learning (e.g., $+ 5 . 3 \%$ and $+ 1 1 . 0 \%$ top-1 accuracy on ImageNet for ViT-B/16 and Mixer-B/16, respectively, with the simple Inception-style preprocessing). The enhanced ViTs achieve better accuracy and robustness than ResNets of similar and bigger sizes when trained from scratch on ImageNet, without large-scale pre-training or strong data augmentations. Moreover, we demonstrate that SAM can even enable ViT to be effectively trained with (momentum) SGD, which usually lies far behind Adam when training Transformers (Zhang et al., 2020).
|
| 22 |
+
|
| 23 |
+
By analyzing some intrinsic model properties, we observe that SAM increases the sparsity of active neurons (especially for the first few layers), which contribute to the reduced Hessian eigenvalues. The weight norms increase, implying the commonly used weight decay may not be an effective regularization alone. A side observation is that, unlike ResNets and MLP-Mixers, ViTs have extremely sparse active neurons (see Figure 2 (right)), revealing the potential for network pruning (Akbari et al., 2021). Another interesting finding is that the improved ViTs appear to have visually more interpretable attention maps. Finally, we draw similarities between SAM and strong augmentations (e.g., mixup) in that they both smooth the average loss geometry and encourage the models to behave linearly between training images.
|
| 24 |
+
|
| 25 |
+
# 2 BACKGROUND AND RELATED WORK
|
| 26 |
+
|
| 27 |
+
We briefly review ViTs, MLP-Mixers, and some related works in this section.
|
| 28 |
+
|
| 29 |
+
Dosovitskiy et al. (2021) show that a pure Transformer architecture (Vaswani et al., 2017) can achieve state-of-the-art accuracy on image classification by pre-training it on large datasets such as ImageNet-21k (Deng et al., 2009) and JFT-300M (Sun et al., 2017). Their vision Transformer (ViT) is a stack of residual blocks, each containing a multi-head self-attention, layer normalization (Ba et al., 2016), and a MLP layer. ViT first embeds an input image $x \in \mathbb { R } ^ { H \times \tilde { W } \times C }$ into a sequence of features $\boldsymbol { z } \in \mathbb { R } ^ { N \times D }$ by applying a linear projection over $N$ nonoverlapping image patches $\bar { \boldsymbol { x } _ { p } } \in \mathbb { R } ^ { N \times ( P ^ { 2 } \cdot C ) }$ , where $D$ is the feature dimension, $P$ is the patch resolution, and $N = H W / P ^ { 2 }$ is the sequence length. The self-attention layers in ViT are global and do not possess the locality and translation equivariance of convolutions. ViT is compatible with the popular architectures in NLP (Devlin et al., 2018; Radford et al., 2018) and, similar to its NLP counterparts, requires pretraining over massive datasets (Dosovitskiy et al., 2021; Akbari et al., 2021; Arnab et al., 2021) or strong data augmentations (Touvron et al., 2021b). Some works specialize the ViT architectures for visual data (Liu et al., 2021b; Yuan et al., 2021; Fan et al., 2021; Bertasius et al., 2021).
|
| 30 |
+
|
| 31 |
+
Table 1: Number of paramettraining error at convergence K condition num, average flatness $\kappa$ Hessian, accura ominate eigenvalue on ImageNet, and $\lambda _ { m a x }$ $L _ { t r a i n }$ $L _ { t r a i n } ^ { \mathcal { N } }$ $\kappa$ gions; SAM rescues that and leads to better generalization.
|
| 32 |
+
|
| 33 |
+
<table><tr><td></td><td>ResNet-152</td><td>ResNet-152- SAM</td><td>ViT-B/16</td><td>ViT-B/16- SAM</td><td>Mixer-B/16</td><td>Mixer-B/16- SAM</td></tr><tr><td>#Params</td><td colspan="2">60M</td><td colspan="2">87M</td><td colspan="2">59M</td></tr><tr><td>NTK κ † Hessian Xmax</td><td colspan="2">2801.6</td><td colspan="2">4205.3</td><td colspan="2">14468.0</td></tr><tr><td></td><td>179.8</td><td>42.0</td><td>738.8</td><td>20.9</td><td>1644.4</td><td>22.5</td></tr><tr><td>Ltrain</td><td>0.86</td><td>0.90</td><td>0.65</td><td>0.82</td><td>0.45</td><td>0.97</td></tr><tr><td>★</td><td>2.39</td><td>2.16</td><td>6.66</td><td>0.96</td><td>7.78</td><td>1.01</td></tr><tr><td>ImageNet (%)</td><td>78.5</td><td>79.3</td><td>74.6</td><td>79.9</td><td>66.4</td><td>77.4</td></tr><tr><td>ImageNet-C (%)</td><td>50.0</td><td>52.2</td><td>46.6</td><td>56.5</td><td>33.8</td><td>48.8</td></tr></table>
|
| 34 |
+
|
| 35 |
+
† As it is prohibitive to compute the exact NTK, we approximate the value by averaging over its subdiagonal blocks (see Appendix G for details). We average the results for 1,000 random noises when calculating L N train.
|
| 36 |
+
|
| 37 |
+

|
| 38 |
+
Figure 1: Cross-entropy loss landscapes of ResNet-152, ViT-B/16, and Mixer-B/16. ViT and MLPMixer converge to sharper regions than ResNet when trained on ImageNet with the basic Inceptionstyle preprocessing. SAM, a sharpness-aware optimizer, significantly smooths the landscapes.
|
| 39 |
+
|
| 40 |
+
More recent works find that the self-attention in ViT is not vital for performance, resulting in several architectures exclusively based on MLPs (Tolstikhin et al., 2021; Touvron et al., 2021a; Liu et al., 2021a; Melas-Kyriazi, 2021). Here we take MLP-Mixer (Tolstikhin et al., 2021) as an example. MLP-Mixer shares the same input layer as ViT; namely, it partitions an image into a sequence of nonoverlapping patches/tokens. It then alternates between token and channel MLPs, where the former allows feature fusion from different spatial locations.
|
| 41 |
+
|
| 42 |
+
We focus on ViTs and MLP-Mixers in this paper. We denote by “S” and “B” the small and base model sizes, respectively, and by an integer the image patch resolution. For instance, ViT-B/16 is the base ViT model taking as input a sequence of $1 6 \times 1 6$ patches. Appendices contain more details.
|
| 43 |
+
|
| 44 |
+
# 3 VITS AND MLP-MIXERS CONVERGE AT SHARP LOCAL MINIMA
|
| 45 |
+
|
| 46 |
+
The current training recipe of ViTs, MLP-Mixers, and related convolution-free architectures relies heavily on massive pre-training (Dosovitskiy et al., 2021; Arnab et al., 2021; Akbari et al., 2021) or a bag of strong data augmentations (Touvron et al., 2021b; Tolstikhin et al., 2021; Cubuk et al., 2019; 2020; Zhang et al., 2018; Yun et al., 2019). It highly demands data and computing, and leads to many hyperparameters to tune. Existing works report that ViTs yield inferior accuracy to the ConvNets of similar size and throughput when trained from scratch on ImageNet without the combination of those advanced data augmentations, despite using various regularization techniques (e.g., large weight decay, Dropout (Srivastava et al., 2014), etc.). For instance, ViT-B/16 (Dosovitskiy et al., 2021) gives rise to $7 4 . 6 \%$ top-1 accuracy on the ImageNet validation set (224 image resolution), compared with $78 . 5 \%$ of ResNet-152 (He et al., 2016). Mixer-B/16 (Tolstikhin et al., 2021) performs even worse $( 6 6 . 4 \% )$ . There also exists a large gap between ViTs and ResNets in robustness tests (see Table 2 for details).
|
| 47 |
+
|
| 48 |
+
Moreover, Chen et al. (2021c) find that the gradients can spike and cause a sudden accuracy dip when training ViTs, and Touvron et al. (2021b) report the training is sensitive to initialization and hyperparameters. These all point to optimization problems. In this paper, we investigate the loss landscapes of ViTs and MLP-Mixers to understand them from the optimization perspective, intending to reduce their dependency on the large-scale pre-training or strong data augmentations.
|
| 49 |
+
|
| 50 |
+

|
| 51 |
+
Figure 2: Left and Middle: ImageNet training error and validation accuracy vs. iteration for ViTs and MLP-Mixers. Right: Percentage of active neurons for ResNet-152, ViT-B/16, and Mixer-B/16.
|
| 52 |
+
|
| 53 |
+
ViTs and MLP-Mixers converge at extremely sharp local minima. It has been extensively studied that the convergence to a flat region whose curvature is small benefits the generalization of neural networks (Keskar et al., 2017; Kleinberg et al., 2018; Jastrz˛ebski et al., 2019; Chen & Hsieh, 2020; Smith & Le, 2018; Zela et al., 2020; Chaudhari et al., 2017). Following Li et al. (2018), we plot the loss landscapes at convergence when ResNets, ViTs, and MLP-Mixers are trained from scratch on ImageNet with the basic Inception-style preprocessing (Szegedy et al., 2016) (see Appendices for details). As shown in Figures 1(a) to 1(c), ViTs and MLP-Mixers converge at much sharper regions than ResNets. Besides, we calculate the training error under Gaussian perturbations on the model parameters $L _ { t r a i n } ^ { N } = \mathbb { E } _ { \epsilon \sim \mathcal { N } } [ L _ { t r a i n } ( w + \epsilon ) ]$ in Table 1, which reveals the average flatness. Although ViT-B/16 and Mixer-B/16 achieve lower training error $L _ { t r a i n }$ than that of ResNet-152, their loss values after random weight perturbation become much higher. We further validate the results by computing the dominate Hessian eigenvalue $\lambda _ { m a x }$ , which is a mathematical evaluation of the worstcase landscape curvature. The $\lambda _ { m a x }$ values of ViT and MLP-Mixer are orders of magnitude larger than that of ResNet, and MLP-Mixer suffers the largest curvature among the three species (see Section 4.4 for a detailed analysis).
|
| 54 |
+
|
| 55 |
+
Small training errors. This convergence at sharp regions coincides with the training dynamics shown in Figure 2 (left). Although Mixer-B/16 has fewer parameters than ViT-B/16 (59M vs. 87M), it has a smaller training error (also see $L _ { t r a i n }$ in Table 1) but much worse test accuracy, implying that using the cross-token MLP to learn the interplay across image patches is more prone to overfitting than ViTs’ self-attention mechanism whose behavior is restricted by a softmax. To validate this statement, we simply remove the softmax in ViT-B/16, such that the query and key matrices can freely interact with each other. Although having lower $L _ { t r a i n }$ (0.56 vs. 0.65), the obtained ViTB/16-Free performs much worse than the original ViT-B/16 ( $7 0 . 5 \%$ vs. $7 4 . 6 \%$ ). Its $L _ { t r a i n } ^ { \mathcal { N } }$ and $\lambda _ { m a x }$ are 7.01 and 1236.2, revealing that ViT-B/16-Free converges to a sharper region than ViTB/16 $L _ { t r a i n } ^ { \mathcal { N } }$ is 6.66 and $\lambda _ { m a x }$ is 738.8) both on average and in the worst-case direction. Such a difference probably explains why it is easier for MLP-Mixers to get stuck in sharp local minima.
|
| 56 |
+
|
| 57 |
+
ViTs and MLP-Mixers have worse trainability. Furthermore, we discover that ViTs and MLPMixers suffer poor trainabilities, defined as the effectiveness of a network to be optimized by gradient descent (Xiao et al., 2020; Burkholz & Dubatovka, 2019; Shin & Karniadakis, 2020). Xiao et al. (2020) show that the trainability of a neural network can be characterized by the condition number of the associated neural tangent kernel (NTK), $\Theta ( x , x ^ { \prime } ) = J ( x ) J ( x ^ { \prime } ) ^ { T }$ , where $J$ is the Jacobian matrix. Denoting by $\lambda _ { 1 } \geq \cdots \geq \lambda _ { m }$ the eigenvalues of NTK $\Theta _ { t r a i n }$ , the smallest eigenvalue $\lambda _ { m }$ converges exponentially at a rate given by the condition number $\kappa = \lambda _ { 1 } / \lambda _ { m }$ . If $\kappa$ diverges then the network will become untrainable (Xiao et al., 2020; Chen et al., 2021a). As shown in Table 1, $\kappa$ is pretty stable for ResNets, echoing previous results that ResNets enjoy superior trainability regardless of the depth (Yang & Schoenholz, 2017; Li et al., 2018). However, we observe that the condition number diverges when it comes to ViT and MLP-Mixer, confirming that the training of ViTs desires extra care (Chen et al., 2021c; Touvron et al., 2021b).
|
| 58 |
+
|
| 59 |
+
# 4 A PRINCIPLED OPTIMIZER FOR CONVOLUTION-FREE ARCHITECTURES
|
| 60 |
+
|
| 61 |
+
The commonly used first-order optimizers (e.g., SGD (Nesterov, 1983), Adam (Kingma & Ba, 2015)) only seek to minimize the training loss $L _ { t r a i n } ( w )$ . They usually dismiss the higher-order information such as curvature that correlates with the generalization (Keskar et al., 2017; Chaudhari et al., 2017; Dziugaite & Roy, 2017). However, the objective $L _ { t r a i n }$ for deep neural networks are highly non-convex, making it easy to reach near-zero training error but high generalization error $L _ { t e s t }$ during evaluation, let alone their robustness when the test sets have different distributions (Hendrycks & Dietterich, 2019; Hendrycks et al., 2020). ViTs and MLPs amplify such drawbacks of first-order optimizers due to the lack of inductive bias for visual data, resulting in excessively sharp loss landscapes and poor generalization, as shown in the previous section. We hypothesize that smoothing the loss landscapes at convergence can significantly improve the generalization ability of those convolution-free architectures, leading us to the recently proposed sharpness-aware minimizer (SAM) (Foret et al., 2021) that explicitly avoids sharp minima.
|
| 62 |
+
|
| 63 |
+
# 4.1 SAM: OVERVIEW
|
| 64 |
+
|
| 65 |
+
Intuitively, SAM (Foret et al., 2021) seeks to find the parameter $w$ whose entire neighbours have low training loss $L _ { t r a i n }$ by formulating a minimax objective:
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
\operatorname* { m i n } _ { w } \operatorname* { m a x } _ { \| \epsilon \| _ { 2 } \leq \rho } L _ { t r a i n } ( w + \epsilon ) ,
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
where $\rho$ is the size of the neighbourhood ball. Without loss of generality, here we use $l _ { 2 }$ norm for its strong empirical results (Foret et al., 2021) and omit the regularization term for simplicity. Since the exact solution of the inner maximization $\begin{array} { r } { \epsilon _ { . } ^ { \star } = \arg \operatorname* { m a x } _ { \| \epsilon \| _ { 2 } \leq \rho } L _ { t r a i n } ( w + \epsilon ) } \end{array}$ is hard to obtain, they employ an efficient first-order approximation:
|
| 72 |
+
|
| 73 |
+
$$
|
| 74 |
+
\boldsymbol { \hat { \epsilon } } ( \boldsymbol { w } ) = \operatorname* { a r g m a x } _ { \| \boldsymbol { \epsilon } \| _ { 2 } \leq \rho } L _ { t r a i n } ( \boldsymbol { w } ) + \epsilon ^ { T } \nabla _ { \boldsymbol { w } } L _ { t r a i n } ( \boldsymbol { w } ) = \rho \nabla _ { \boldsymbol { w } } L _ { t r a i n } ( \boldsymbol { w } ) / \| \nabla _ { \boldsymbol { w } } L _ { t r a i n } ( \boldsymbol { w } ) \| _ { 2 } .
|
| 75 |
+
$$
|
| 76 |
+
|
| 77 |
+
Under the $l _ { 2 }$ norm, $\hat { \epsilon } ( w )$ is simply a scaled gradient of the current weight $w$ . After computing $\hat { \epsilon }$ , SAM updates $w$ based on the sharpness-aware gradient $\nabla _ { w } L _ { t r a i n } ( w ) | _ { w + \hat { \epsilon } ( w ) }$ .
|
| 78 |
+
|
| 79 |
+
# 4.2 SHARPNESS-AWARE OPTIMIZATION IMPROVES VITS AND MLP-MIXERS
|
| 80 |
+
|
| 81 |
+
We train ViTs and MLP-Mixers with no large-scale pre-training or strong data augmentations. We directly apply SAM to the original ImageNet training pipeline of ViTs (Dosovitskiy et al., 2021) without changing any hyperparameters. The pipeline employs the basic Inception-style preprocessing (Szegedy et al., 2016). The original training setup of MLP-Mixers (Tolstikhin et al., 2021) includes a combination of strong data augmentations, and we replace it with the same Inceptionstyle preprocessing for a fair comparison. Note that we perform grid search for the learning rate, weight decay, Dropout before applying SAM. Please see Appendices for training details.
|
| 82 |
+
|
| 83 |
+
Smoother regions around the local minima. Thanks to SAM, both ViTs and MLP-Mixers converge at much smoother regions, as shown in Figures 1(d) and 1(e). Moreover, both the average and the worst-case curvature, i.e., $L _ { t r a i n } ^ { \mathcal { N } }$ and $\lambda _ { m a x }$ , decrease dramatically (see Table 1).
|
| 84 |
+
|
| 85 |
+
Higher accuracy. What comes along is tremendously improved generalization performance. On ImageNet, SAM boosts the top-1 accuracy of ViT-B/16 from $7 4 . 6 \%$ to $7 9 . 9 \%$ , and Mixer-B/16 from $6 6 . 4 \%$ to $7 7 . 4 \%$ . For comparison, the improvement on a similarly sized ResNet-152 is $0 . 8 \%$ . Empirically, the degree of improvement negatively correlates with the constraints of inductive biases built into the architecture. ResNets with inherent translation equivalence and locality benefit less from landscape smoothing than the attention-based ViTs. MLP-Mixers gain the most from the smoothed loss geometry. In Table 3, we further train two hybrid models (Dosovitskiy et al., 2021) to validate this observation, where the Transformer takes the feature map extracted from a ResNet-50 as the input sequence. The improvement brought by SAM decreases after we introduce the convolution to ViT, for instance, $+ 2 . 7 \%$ for R50-B/16 compared to $+ 5 . 3 \%$ for ViT-B/16. Moreover, SAM brings larger improvements to the models of larger capacity (e.g., $+ 4 . 1 \%$ for Mixer-S/16 vs. $+ 1 1 . 0 \%$ for Mixer-B/16) and longer patch sequence (e.g., $+ 2 . 1 \%$ for ViT-S/32 vs. $+ 5 . 3 \%$ for ViT-S/8). Please see Table 2 for more results.
|
| 86 |
+
|
| 87 |
+
SAM can be easily applied to common base optimizers. Besides Adam, we also apply SAM on top of the (momentum) SGD that usually performs much worse than Adam when training Transformers (Zhang et al., 2020). As expected, we find that under the same training budget (300 epochs), the ViT-B/16 trained with SGD only achieves $7 1 . 5 \%$ accuracy on ImageNet, whereas Adam achieves
|
| 88 |
+
|
| 89 |
+
Table 2: Performance of ResNets, ViTs, and MLP-Mixers trained from scratch on ImageNet with SAM (improvement over the vanilla model is shown in the parentheses). We use the Inception-style preprocessing (with resolution 224) rather than a combination of strong data augmentations.
|
| 90 |
+
|
| 91 |
+
<table><tr><td>Model</td><td>#params</td><td>Throughput (img/sec/core)</td><td>ImageNet</td><td>ReaL</td><td>V2</td><td>ImageNet-R</td><td>ImageNet-C</td></tr><tr><td colspan="8">ResNet</td></tr><tr><td>ResNet-50-SAM</td><td>25M</td><td>2161</td><td>76.7 (+0.7)</td><td>83.1 (+0.7)</td><td>64.6 (+1.0)</td><td>23.3 (+1.1)</td><td>46.5 (+1.9)</td></tr><tr><td>ResNet-101-SAM</td><td>44M</td><td>1334</td><td>78.6 (+0.8)</td><td>84.8 (+0.9)</td><td>66.7 (+1.4)</td><td>25.9 (+1.5)</td><td>51.3 (+2.8)</td></tr><tr><td>ResNet-152-SAM</td><td>60M</td><td>935</td><td>79.3 (+0.8)</td><td>84.9 (+0.7)</td><td>67.3 (+1.0)</td><td>25.7 (+0.4)</td><td>52.2 (+2.2)</td></tr><tr><td>ResNet-50x2-SAM</td><td>98M</td><td>891</td><td>79.6 (+1.5)</td><td>85.3 (+1.6)</td><td>67.5 (+1.7)</td><td>26.0 (+2.9)</td><td>50.7 (+3.9)</td></tr><tr><td>ResNet-101x2-SAM</td><td>173M</td><td>519</td><td>80.9 (+2.4)</td><td>86.4 (+2.4)</td><td>69.1 (+2.8)</td><td>27.8(+3.2)</td><td>54.0 (+4.7)</td></tr><tr><td>ResNet-152x2-SAM</td><td>236M</td><td>356</td><td>81.1 (+1.8)</td><td>86.4 (+1.9)</td><td>69.6 (+2.3)</td><td>28.1 (+2.8)</td><td>55.0 (+4.2)</td></tr><tr><td colspan="8">Vision Transformer</td></tr><tr><td>ViT-S/32-SAM</td><td>23M</td><td>6888</td><td>70.5 (+2.1)</td><td>77.5 (+2.3)</td><td>56.9 (+2.6)</td><td>21.4 (+2.4)</td><td>46.2 (+2.9)</td></tr><tr><td>ViT-S/16-SAM</td><td>22M</td><td>2043</td><td>78.1 (+3.7)</td><td>84.1 (+3.7)</td><td>65.6(+3.9)</td><td>24.7 (+4.7)</td><td>53.0 (+6.5)</td></tr><tr><td>ViT-S/14-SAM</td><td>22M</td><td>1234</td><td>78.8 (+4.0)</td><td>84.8 (+4.5)</td><td>67.2(+5.2)</td><td>24.4 (+4.7)</td><td>54.2 (+7.0)</td></tr><tr><td>ViT-S/8-SAM</td><td>22M</td><td>333</td><td>81.3 (+5.3)</td><td>86.7 (+5.5)</td><td>70.4 (+6.2)</td><td>25.3 (+6.1)</td><td>55.6 (+8.5)</td></tr><tr><td>ViT-B/32-SAM</td><td>88M</td><td>2805</td><td>73.6 (+4.1)</td><td>80.3 (+5.1)</td><td>60.0 (+4.7)</td><td>24.0 (+4.1)</td><td>50.7 (+6.7)</td></tr><tr><td>ViT-B/16-SAM</td><td>87M</td><td>863</td><td>79.9 (+5.3)</td><td>85.2 (+5.4)</td><td>67.5 (+6.2)</td><td>26.4 (+6.3)</td><td>56.5 (+9.9)</td></tr><tr><td colspan="8">MLP-Mixer</td></tr><tr><td>Mixer-S/32-SAM</td><td>19M</td><td>11401</td><td>66.7 (+2.8)</td><td>73.8 (+3.5)</td><td>52.4 (+2.9)</td><td>18.6 (+2.7)</td><td>39.3 (+4.1)</td></tr><tr><td>Mixer-S/16-SAM</td><td>18M</td><td>4005</td><td>72.9 (+4.1)</td><td>79.8 (+4.7)</td><td>58.9 (+4.1)</td><td>20.1 (+4.2)</td><td>42.0 (+6.4)</td></tr><tr><td>Mixer-S/8-SAM</td><td>20M</td><td>1498</td><td>75.9 (+5.7)</td><td>82.5 (+6.3)</td><td>62.3 (+6.2)</td><td>20.5 (+5.1)</td><td>42.4 (+7.8)</td></tr><tr><td>Mixer-B/32-SAM</td><td>60M</td><td>4209</td><td>72.4 (+9.9)</td><td>79.0 (+10.9)</td><td>58.0 (+10.4)</td><td>22.8 (+8.2)</td><td>46.2 (12.4)</td></tr><tr><td>Mixer-B/16-SAM Mixer-B/8-SAM</td><td>59M</td><td>1390</td><td>77.4 (+11.0)</td><td>83.5 (+11.4) 84.4(+10.1)</td><td>63.9 (+13.1)</td><td>24.7 (+10.2)</td><td>48.8 (+15.0)</td></tr><tr><td></td><td>64M</td><td>466</td><td>79.0 (+10.4)</td><td></td><td>65.5 (+11.6)</td><td>23.5 (+9.2)</td><td>48.9 (+16.9)</td></tr></table>
|
| 92 |
+
|
| 93 |
+
$7 4 . 6 \%$ . Surprisingly, $\mathrm { S G D + S A M }$ can push the result to $7 9 . 1 \%$ , which is a huge $+ 7 . 6 \%$ absolute improvement. Although Ad $\mathrm { a m } + \mathrm { S A M }$ is still higher $( 7 9 . 9 \% )$ , their gap largely shrinks.
|
| 94 |
+
|
| 95 |
+
Better robustness. We also evaluate the models’ robustness using ImageNet-R (Hendrycks et al., 2020) and ImageNet-C (Hendrycks & Dietterich, 2019) and find even bigger impacts of the smoothed loss landscapes. On ImageNet-C, which corrupts images by noise, bad weather, blur, etc., we report the average accuracy against 19 corruptions across five levels. As shown in Tables 1 and 2, the accuracies of ViT-B/16 and Mixer-B/16 increase by $9 . 9 \%$ and $1 5 . 0 \%$ (which are $2 1 . 2 \%$ and $4 4 . 4 \%$ relative improvements), after SAM smooths their converged local regions. In comparison, SAM improves the accuracy of ResNet-152 by $2 . 2 \%$ $4 . 4 \%$ relative improvement). We can see that SAM enhances the robustness even more than the relative clean accuracy improvements $7 . 1 \%$ , $1 6 . 6 \%$ , and $1 . 0 \%$ for ViT-B/16, Mixer-B/16, and ResNet-152, respectively).
|
| 96 |
+
|
| 97 |
+
# 4.3 VITS OUTPERFORM RESNETS WITHOUT PRE-TRAINING OR STRONG AUGMENTATIONS
|
| 98 |
+
|
| 99 |
+
The performance of an architecture is often conflated with the training strategies (Bello et al., 2021), where data augmentations play a key role (Cubuk et al., 2019; 2020; Zhang et al., 2018; Xie et al., 2020; Chen et al., 2021b). However, the design of augmentations requires substantial domain expertise and may not translate between images and videos, for instance. Thanks to the principled sharpness-aware opti
|
| 100 |
+
|
| 101 |
+
Table 3: Accuracy and robustness of two hybrid architectures.
|
| 102 |
+
|
| 103 |
+
<table><tr><td>Model</td><td>#params</td><td>ImageNet (%)</td><td>ImageNet-C (%)</td></tr><tr><td>R50-S/16 R50-S/16-SAM</td><td>34M</td><td>79.8 81.0 (+1.2)</td><td>53.4 57.2 (+3.8)</td></tr><tr><td>R50-B/16</td><td></td><td>79.7</td><td>54.4</td></tr><tr><td>R50-B/16-SAM</td><td>99M</td><td>82.4 (+2.7)</td><td>61.0 (+6.6)</td></tr></table>
|
| 104 |
+
|
| 105 |
+
mizer, we can remove the advanced augmentations and focus on the architectures themselves.
|
| 106 |
+
|
| 107 |
+
When trained from scratch on ImageNet with SAM, ViTs outperform ResNets of similar and greater sizes (also comparable throughput at inference) regarding both clean accuracy (on ImageNet (Deng et al., 2009), ImageNet-ReaL (Beyer et al., 2020), and ImageNet V2 (Recht et al., 2019)) and robustness (on ImageNet-R (Hendrycks et al., 2020) and ImageNet-C (Hendrycks & Dietterich, 2019)). ViT-B/16 achieves $7 9 . 9 \%$ , $2 6 . 4 \%$ , and $5 6 . 6 \%$ top-1 accuracy on ImageNet, ImageNet-R, and ImageNet-C, while the counterpart numbers for ResNet-152 are $7 9 . 3 \%$ , $2 5 . 7 \%$ , and $5 2 . 2 \%$ , respectively (see Table 2). The gaps between ViTs and ResNets are even wider for small architectures. ViT-S/16 outperforms a similarly sized ResNet-50 by $1 . 4 \%$ on ImageNet, and $6 . 5 \%$ on ImageNet-C. SAM also significantly improves MLP-Mixers’ results.
|
| 108 |
+
|
| 109 |
+
Table 4: Dominant eigenvalue $\lambda _ { m a x }$ of the sub-diagonal Hessians for different network components, and norm of the model parameter $w$ and the post-activation $a _ { k }$ of block $k$ . Each ViT block consists of a MSA and a MLP, and MLP-Mixer alternates between a token MLP a channel MLP. Shallower layers have larger $\lambda _ { m a x }$ . SAM smooths every component.
|
| 110 |
+
|
| 111 |
+
<table><tr><td rowspan="2">Model</td><td colspan="7">Xmax of diagonal blocks of Hessian</td><td rowspan="2">|w|l2</td><td rowspan="2">|a1|l2</td><td rowspan="2">|a6|2</td><td rowspan="2">|a12|l2</td></tr><tr><td>Embedding</td><td>MSA/ Token MLP</td><td>MLP/ Channel MLP</td><td>Block1</td><td>Block6</td><td>Block12</td><td>Whole</td></tr><tr><td>ViT-B/16</td><td>300.4</td><td>179.8</td><td>281.4</td><td>44.4</td><td>32.4</td><td>26.9</td><td>738.8</td><td>269.3</td><td>104.9</td><td>104.3</td><td>138.1</td></tr><tr><td>ViT-B/16-SAM</td><td>3.8</td><td>8.5</td><td>9.6</td><td>1.7</td><td>1.7</td><td>1.5</td><td>20.9</td><td>353.8</td><td>117.0</td><td>120.3</td><td>97.2</td></tr><tr><td>Mixer-B/16</td><td>1042.3</td><td>95.8</td><td>417.9</td><td>239.3</td><td>41.2</td><td>5.1</td><td>1644.4</td><td>197.6</td><td>96.7</td><td>135.1</td><td>74.9</td></tr><tr><td>Mixer-B/16-SAM</td><td>18.2</td><td>1.4</td><td>9.5</td><td>4.0</td><td>1.1</td><td>0.3</td><td>22.5</td><td>389.9</td><td>110.9</td><td>176.0</td><td>216.1</td></tr></table>
|
| 112 |
+
|
| 113 |
+
# 4.4 INTRINSIC CHANGES AFTER SAM
|
| 114 |
+
|
| 115 |
+
We take a deeper look into the models to understand how they intrinsically change to reduce the Hessian’ eigenvalue $\lambda _ { m a x }$ and what the changes imply in addition to the enhanced generalization.
|
| 116 |
+
|
| 117 |
+
Smoother loss landscapes for every network component. In Table 4, we break down the Hessian of the whole architecture into small diagonal blocks of Hessians concerning each set of parameters, attempting to analyze what specific components cause the blowing up of $\lambda _ { m a x }$ in the models trained without SAM. We observe that shallower layers have larger Hessian eigenvalues $\lambda _ { m a x }$ , and the first linear embedding layer incurs the sharpest geometry. This agrees with the finding in (Chen et al., 2021c) that spiking gradients happen early in the embedding layer. Additionally, the multi-head self-attention (MSA) in ViTs and the Token MLPs in MLP-Mixers, both of which mix information across spatial locations, have comparably lower $\lambda _ { m a x }$ than the other network components. SAM consistently reduces the $\lambda _ { m a x }$ of all network blocks.
|
| 118 |
+
|
| 119 |
+
We can gain insights into the above findings by the recursive formulation of Hessian matrices for MLPs (Botev et al., 2017). Let $h _ { k }$ and $a _ { k }$ be the pre-activation and post-activation values for layer $k$ , respectively. They satisfy $h _ { k } = W _ { k } a _ { k - 1 }$ and $\bar { a } _ { k } = f _ { k } ( h _ { k } )$ , where $W _ { k }$ is the weight matrix and $f _ { k }$ is the activation function (GELU (Hendrycks & Gimpel, 2020) in MLP-Mixers). Here we omit the bias term for simplicity. The diagonal block of Hessian matrix $H _ { k }$ with respect to $W _ { k }$ can be recursively calculated as:
|
| 120 |
+
|
| 121 |
+
$$
|
| 122 |
+
\begin{array} { r l r } & { } & { H _ { k } = ( a _ { k - 1 } a _ { k - 1 } ^ { T } ) \otimes \mathcal { H } _ { k } , \quad \mathcal { H } _ { k } = B _ { k } W _ { k + 1 } ^ { T } \mathcal { H } _ { k + 1 } W _ { k + 1 } B _ { k } + D _ { k } , } \\ & { } & { B _ { k } = \mathrm { d i a g } ( f _ { k } ^ { \prime } ( h _ { k } ) ) , \qquad D _ { k } = \mathrm { d i a g } ( f _ { k } ^ { \prime \prime } ( h _ { k } ) \frac { \partial L } { \partial a _ { k } } ) , } \end{array}
|
| 123 |
+
$$
|
| 124 |
+
|
| 125 |
+
where $\otimes$ is the Kronecker product, $\mathcal { H } _ { k }$ is the pre-activation Hessian for layer $k$ , and $L$ is the objective function. Therefore, the Hessian norm accumulates as the recursive formulation backpropagates to shallow layers, explaining why the first block has much larger $\lambda _ { m a x }$ than the last block in Table 4.
|
| 126 |
+
|
| 127 |
+
Greater weight norms. After applying SAM, we find that in most cases, the norm of the postactivation value $a k _ { - 1 }$ and the weight $W _ { k + 1 }$ become even bigger (see Table 4), indicating that the commonly used weight decay may not effectively regularize ViTs and MLP-Mixers (see Appendix J for further verification when we vary the weight decay strength).
|
| 128 |
+
|
| 129 |
+
Sparser active neurons in MLP-Mixers. Given the recursive formulation Equation (3), we identify another intrinsic measure of MLP-Mixers that contribute to the Hessian: the number of activated neurons. Indeed, $B _ { k }$ is determined by the activated neurons whose values are greater than zero, since the first-order derivative of GELU becomes much smaller when the input is negative. As a result, the number of active GELU neurons is directly connected to the Hessian norm. Figure 2 (right) shows the proportion of activated neurons for each block, counted using $10 \%$ of the ImageNet training set. We can see that SAM greatly reduces the proportion of activated neurons for the first few layers of the Mixer-B/16, pushing them to much sparser states. This result also suggests the potential redundancy of image patches.
|
| 130 |
+
|
| 131 |
+
ViTs’ active neurons are highly sparse. Although Equations (3) and (4) only involve MLPs, we still observe a decrease of activated neurons in the first layer of ViTs (but not as significant as in MLP-Mixers). More interestingly, we find that the proportion of active neurons in ViT is much smaller than another two architectures — given an input image, less than $10 \%$ neurons have values greater than zero for most layers (see Figure 2 (right)). In other words, ViTs offer a huge potential for network pruning. This sparsity may also explain why one Transformer can handle multi-modality signals (vision, text, and audio) (Akbari et al., 2021).
|
| 132 |
+
|
| 133 |
+
Table 5: Data augmentations, SAM, and their combination applied to different model architectures trained on ImageNet and its subsets from scratch.
|
| 134 |
+
|
| 135 |
+
<table><tr><td rowspan="2">Dataset</td><td colspan="4">ResNet-152</td><td colspan="4">ViT-B/16</td><td colspan="4">Mixer-B/16</td></tr><tr><td>Vanilla </td><td>SAM</td><td>AUG</td><td>SAM + AUG</td><td>Vanilla </td><td>SAM</td><td>AUG</td><td>SAM +AUG</td><td>Vanilla</td><td>SAM</td><td>AUG</td><td>SAM + AUG</td></tr><tr><td>ImageNet</td><td>78.5</td><td>79.3</td><td>78.8</td><td>78.9</td><td>74.6</td><td>79.9</td><td>79.6</td><td>81.5</td><td>66.4</td><td>77.4</td><td>76.5</td><td>78.1</td></tr><tr><td>i1k (1/2)</td><td>74.2</td><td>75.6</td><td>75.1</td><td>75.5</td><td>64.9</td><td>75.4</td><td>73.1</td><td>75.8</td><td>53.9</td><td>71.0</td><td>70.4</td><td>73.1</td></tr><tr><td>i1k (1/4)</td><td>68.0</td><td>70.3</td><td>70.2</td><td>70.6</td><td>52.4</td><td>66.8</td><td>63.2</td><td>65.6</td><td>37.2</td><td>62.8</td><td>61.0</td><td>65.8</td></tr><tr><td>i1k (1/10)</td><td>54.6</td><td>57.1</td><td>59.2</td><td>59.5</td><td>32.8</td><td>46.1</td><td>38.5</td><td>45.7</td><td>21.0</td><td>43.5</td><td>43.0</td><td>51.0</td></tr></table>
|
| 136 |
+
|
| 137 |
+

|
| 138 |
+
Figure 3: Raw images (Left) and attention maps of ViT-S/16 with (Right) and without (Middle) sharpness-aware optimization.
|
| 139 |
+
|
| 140 |
+
Visually improved attention maps in ViTs. We visualize ViT-S/16’s attention map of the classification token averaged over the last multi-head attentions in Figure 3 following Caron et al. (2021). Interestingly, the ViT model optimized with SAM appears to possess visually improved attention map compared with the one trained via the vanilla AdamW optimizer.
|
| 141 |
+
|
| 142 |
+
# 4.5 SAM VS. STRONG AUGMENTATIONS
|
| 143 |
+
|
| 144 |
+
Previous sections show that SAM can improve the generalization (and robustness) of ViTs and MLP-Mixers. Meanwhile, another paradigm to train these models on ImageNet from scratch is to stack multiple strong augmentations (Touvron et al., 2021b;a; Tolstikhin et al., 2021). Hence, it is interesting to study the differences and similarities between the models trained by SAM and by using strong data augmentations. For the augmentation experiments, we follow Tolstikhin et al. (2021)’s pipeline that includes mixup (Zhang et al., 2018) and RandAugment (Cubuk et al., 2020).
|
| 145 |
+
|
| 146 |
+
Generalization. Table 5 shows the results of strong data augmentation, SAM, and their combination on ImageNet. Each row corresponds to a training set of a different fraction of ImageNet-1k. SAM benefits ViT-B/16 and Mixer-B/16 more than the strong data augmentations, especially when the training set is small. For instance, when the training set contains only 1/10 of ImageNet training images, ViT-B/16-SAM outperforms ViT-B/16-AUG by $7 . 6 \%$ . Apart from the improved validation accuracy, we also observe that both SAM and strong augmentations increase the training error (see Figure 2 (Middle) and Table 6), indicating their regularization effects. However, they have distinct training dynamics as the loss curve for ViT-B/16-AUG is much nosier than ViT-B/16-SAM.
|
| 147 |
+
|
| 148 |
+
Sharpness at convergence. Another intriguing question is as follows. Can augmentations also smooth the loss geometry similarly to SAM? To answer it, we also plot the landscape of ViTB/16-AUG (see Figure 5 in the Appendix) and compute its Herage flatness $\lambda _ { m a x }$ together with the av-able 6. Surprisingly, $L _ { t r a i n } ^ { \mathcal { N } }$ strong augmentations even enlarge the $\lambda _ { m a x }$
|
| 149 |
+
|
| 150 |
+
Table 6: Comparison between ViT-B/16-SAM and ViT-B/16-AUG. $R$ denotes the missing rate under linear interpolation.
|
| 151 |
+
|
| 152 |
+
<table><tr><td>Model</td><td>Xmax</td><td>Ltrain</td><td></td><td>R(↓)</td></tr><tr><td>ViT-B/16</td><td>738.8</td><td>0.65</td><td>6.66</td><td>57.9%</td></tr><tr><td>ViT-B/16-SAM</td><td>20.9</td><td>0.82</td><td>0.96</td><td>39.6%</td></tr><tr><td>ViT-B/16-AUG</td><td>1659.3</td><td>0.85</td><td>1.23</td><td>21.4%</td></tr></table>
|
| 153 |
+
|
| 154 |
+
However, like SAM, augmentations make ViT-B/16-AUG smoother and achieve a significantly smaller training error under random Gaussian perturbations than ViT-B/16. These results show that both SAM and augmentations make the loss landscape flat on average. The difference is that SAM enforces the smoothness by reducing the largest curvature via a minimax formulation to optimize the worst-case scenario, while augmentations ignore the worse-case curvature and instead smooth the landscape over the directions induced by the augmentations.
|
| 155 |
+
|
| 156 |
+
Interestingly, besides the similarity in smoothing the loss curvature on average, we also discover that SAM-trained models possess “linearality” resembling the property manually injected by the mixup augmentation. Following Zhang et al. (2018), we compute the prediction error in-between training data in Table 6, where a prediction $y$ is counted as a miss if it does not belong to $\{ y _ { i } , y _ { j } \}$ evaluated at $x = 0 . 5 x _ { i } + 0 . 5 x _ { j }$ . We observe that SAM greatly reduces the missing rate $( R )$ compared with the vanilla baseline, showing a similar effect to mixup that explicitly encourages such linearity.
|
| 157 |
+
|
| 158 |
+
# 5 ABLATION STUDIES
|
| 159 |
+
|
| 160 |
+
In this section, we provide a more comprehensive study about SAM’s effect on various vision models and under different training setups. We refer to Appendices B to $\mathrm { D }$ for the adversarial, contrastive and transfer learning results.
|
| 161 |
+
|
| 162 |
+
# 5.1 WHEN SCALING THE TRAINING SET SIZE
|
| 163 |
+
|
| 164 |
+
Previous studies scale up training data to show massive pre-training trumps inductive biases (Dosovitskiy et al., 2021; Tolstikhin et al., 2021). Here we show SAM further enables ViTs and MLPMixers to handle small-scale training data well. We randomly sample 1/4 and 1/2 images from each ImageNet class to compose two smaller-scale training sets, i.e., i1k (1/4) and i1k (1/2) with 320,291 and 640,583 images, respectively. We also use ImageNet-21k to pre-train the models with SAM, followed by fine-tuning on ImageNet-1k without SAM. The ImageNet validation set remains intact. SAM can still bring improvement when pre-trained on ImageNet-21k $( + 0 . 3 \%$ , $+ 1 . 4 \%$ , and $2 . 3 \%$ for ResNet-152, ViT-B/16, and Mixer-B/16, respectively).
|
| 165 |
+
|
| 166 |
+
As expected, fewer training examples amplify the drawback of ViTs and MLP-Mixers’ lack of the convolutional inductive bias — their accuracies decline much faster than ResNets’ (see Figure 4 in the Appendix and the corresponding numbers in Table 5). However, SAM can drastically rescue ViTs and MLP-Mixers’ performance decrease on smaller training sets. Figure 4 (right) shows that the improvement brought by SAM over vanilla SGD training is proportional to the number of training images. When trained on i1k (1/4), it boosts ViT-B/16 and Mixer-B/16 by $1 4 . 4 \%$ and $2 5 . 6 \%$ , escalating their results to $6 6 . 8 \%$ and $6 2 . 8 \%$ , respectively. It also tells that ViT-B/16-SAM matches the performance of ResNet-152-SAM even with only 1/2 ImageNet training data.
|
| 167 |
+
|
| 168 |
+
# 6 CONCLUSIONS AND LIMITATIONS
|
| 169 |
+
|
| 170 |
+
This paper presents a detailed analysis of the convolution-free ViTs and MLP-Mixers from the lens of the loss landscape geometry, intending to reduce the models’ dependency on massive pre-training and/or strong data augmentations. We arrive at the sharpness-aware minimizer (SAM) after observing sharp local minima of the converged models. By explicitly regularizing the loss geometry through SAM, the models enjoy much flatter loss landscapes and improved generalization regarding accuracy and robustness. The resultant ViT models outperform ResNets of comparable size and throughput when learned with no pre-training or strong augmentations. Further investigation reveals that the smoothed loss landscapes attribute to much sparser activated neurons in the first few layers. Last but not least, we discover that SAM and strong augmentations share certain similarities to enhance the generalization. They both smooth the average loss curvature and encourage linearity.
|
| 171 |
+
|
| 172 |
+
Despite achieving better generalization, training ViTs with SAM has the following limitations which could lead to potential future work. First, SAM incurs another round of forward and backward propagations to update $\epsilon$ , which will lead to around $2 \mathbf { x }$ computational cost per update. Second, we notice that the effect of SAM diminishes as the training dataset becomes larger, so it is vital to develop learning algorithms that can improve/accelerate the large-scale pre-training process.
|
| 173 |
+
|
| 174 |
+
# ETHICS STATEMENT
|
| 175 |
+
|
| 176 |
+
We are not aware of any immediate ethical issues in our work. We hope this paper can provide new insights into the convolution-free neural architectures and their interplay with optimizers, hence benefiting future developments of advanced neural architectures that are efficient in data and computation. Possible negative societal impacts mainly hinge on the applications of convolution-free architectures, whose societal effects may translate to this work.
|
| 177 |
+
|
| 178 |
+
# ACKNOWLEDGEMENT
|
| 179 |
+
|
| 180 |
+
This work is partially supported by NSF under IIS-1901527, IIS-2008173, IIS-2048280 and by Army Research Laboratory under agreement number W911NF-20-2-0158.
|
| 181 |
+
|
| 182 |
+
# REPRODUCIBILITY STATEMENT
|
| 183 |
+
|
| 184 |
+
We provide comprehensive experimental details and references to existing works and codebases to ensure reproducibility. The specification of all the architectures used in this paper is available in Appendix A. The instructions for plotting the landscape and the attention map are detailed in Appendix E. We also present our approach to approximating Hessian’s dominant eigenvalue $\lambda _ { m a x }$ and the NTK condition number in Appendices F and G, respectively. Finally, Appendix H describes all the necessary training configurations, data augmentations, and SAM hyperparameters to ensure the reproducibility of our results.
|
| 185 |
+
|
| 186 |
+
# REFERENCES
|
| 187 |
+
|
| 188 |
+
Hassan Akbari, Liangzhe Yuan, Rui Qian, Wei-Hong Chuang, Shih-Fu Chang, Yin Cui, and Boqing Gong. Vatt: Transformers for multimodal self-supervised learning from raw video, audio and text. arXiv preprint arXiv:2104.11178, 2021.
|
| 189 |
+
|
| 190 |
+
Anurag Arnab, Mostafa Dehghani, Georg Heigold, Chen Sun, Mario Luciˇ c, and Cordelia Schmid. ´ Vivit: A video vision transformer. arXiv preprint arXiv:2103.15691, 2021.
|
| 191 |
+
|
| 192 |
+
Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
|
| 193 |
+
|
| 194 |
+
Irwan Bello, William Fedus, Xianzhi Du, Ekin D. Cubuk, Aravind Srinivas, Tsung-Yi Lin, Jonathon Shlens, and Barret Zoph. Revisiting resnets: Improved training and scaling strategies, 2021.
|
| 195 |
+
|
| 196 |
+
Gedas Bertasius, Heng Wang, and Lorenzo Torresani. Is space-time attention all you need for video understanding? arXiv preprint arXiv:2102.05095, 2021.
|
| 197 |
+
|
| 198 |
+
Lucas Beyer, Olivier J Hénaff, Alexander Kolesnikov, Xiaohua Zhai, and Aäron van den Oord. Are we done with imagenet? arXiv preprint arXiv:2006.07159, 2020.
|
| 199 |
+
|
| 200 |
+
Aleksandar Botev, Hippolyt Ritter, and David Barber. Practical Gauss-Newton optimisation for deep learning. In Doina Precup and Yee Whye Teh (eds.), Proceedings of the 34th International Conference on Machine Learning, volume 70 of Proceedings of Machine Learning Research, pp. 557–565. PMLR, 06–11 Aug 2017. URL http://proceedings.mlr.press/v70/ botev17a.html.
|
| 201 |
+
|
| 202 |
+
Rebekka Burkholz and Alina Dubatovka. Initialization of relus for dynamical isometry. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. URL https://proceedings.neurips.cc/paper/2019/file/ d9731321ef4e063ebbee79298fa36f56-Paper.pdf.
|
| 203 |
+
|
| 204 |
+
Mathilde Caron, Hugo Touvron, Ishan Misra, Hervé Jégou, Julien Mairal, Piotr Bojanowski, and Armand Joulin. Emerging properties in self-supervised vision transformers, 2021.
|
| 205 |
+
|
| 206 |
+
Pratik Chaudhari, Anna Choromanska, Stefano Soatto, Yann LeCun, Carlo Baldassi, Christian Borgs, Jennifer Chayes, Levent Sagun, and Riccardo Zecchina. Entropy-sgd: Biasing gradient descent into wide valleys. In International Conference on Learning Representations, 2017.
|
| 207 |
+
|
| 208 |
+
Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In Hal Daumé III and Aarti Singh (eds.), Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pp. 1597–1607. PMLR, 13–18 Jul 2020. URL http: //proceedings.mlr.press/v119/chen20j.html.
|
| 209 |
+
|
| 210 |
+
Wuyang Chen, Xinyu Gong, and Zhangyang Wang. Neural architecture search on imagenet in four GPU hours: A theoretically inspired perspective. In International Conference on Learning Representations, 2021a. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ Cnon5ezMHtu.
|
| 211 |
+
|
| 212 |
+
Xiangning Chen and Cho-Jui Hsieh. Stabilizing differentiable architecture search via perturbationbased regularization. In Hal Daumé III and Aarti Singh (eds.), Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pp. 1554–1565. PMLR, 13–18 Jul 2020. URL http://proceedings.mlr.press/ v119/chen20f.html.
|
| 213 |
+
|
| 214 |
+
Xiangning Chen, Cihang Xie, Mingxing Tan, Li Zhang, Cho-Jui Hsieh, and Boqing Gong. Robust and accurate object detection via adversarial learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 16622–16631, June 2021b.
|
| 215 |
+
|
| 216 |
+
Xinlei Chen, Saining Xie, and Kaiming He. An empirical study of training self-supervised vision transformers, 2021c.
|
| 217 |
+
|
| 218 |
+
Ekin D. Cubuk, Barret Zoph, Dandelion Mane, Vijay Vasudevan, and Quoc V. Le. Autoaugment: Learning augmentation strategies from data. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2019.
|
| 219 |
+
|
| 220 |
+
Ekin D. Cubuk, Barret Zoph, Jonathon Shlens, and Quoc V. Le. Randaugment: Practical automated data augmentation with a reduced search space. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), pp. 3008–3017, 2020. doi: 10.1109/CVPRW50498.2020.00359.
|
| 221 |
+
|
| 222 |
+
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.
|
| 223 |
+
|
| 224 |
+
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.
|
| 225 |
+
|
| 226 |
+
Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations, 2021. URL https: //openreview.net/forum?id $=$ YicbFdNTTy.
|
| 227 |
+
|
| 228 |
+
Gintare Karolina Dziugaite and Daniel M. Roy. Computing nonvacuous generalization bounds for deep (stochastic) neural networks with many more parameters than training data. In Gal Elidan, Kristian Kersting, and Alexander T. Ihler (eds.), Proceedings of the Thirty-Third Conference on Uncertainty in Artificial Intelligence, UAI 2017, Sydney, Australia, August 11-15, 2017. AUAI Press, 2017. URL http://auai.org/uai2017/proceedings/papers/173.pdf.
|
| 229 |
+
|
| 230 |
+
Haoqi Fan, Bo Xiong, Karttikeya Mangalam, Yanghao Li, Zhicheng Yan, Jitendra Malik, and Christoph Feichtenhofer. Multiscale vision transformers. arXiv preprint arXiv:2104.11227, 2021.
|
| 231 |
+
|
| 232 |
+
Pierre Foret, Ariel Kleiner, Hossein Mobahi, and Behnam Neyshabur. Sharpness-aware minimization for efficiently improving generalization. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=6Tm1mposlrM.
|
| 233 |
+
|
| 234 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 770–778, 2016. doi: 10.1109/CVPR.2016.90.
|
| 235 |
+
|
| 236 |
+
Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020.
|
| 237 |
+
|
| 238 |
+
Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ HJz6tiCqYm.
|
| 239 |
+
|
| 240 |
+
Dan Hendrycks and Kevin Gimpel. Gaussian error linear units (gelus), 2020.
|
| 241 |
+
|
| 242 |
+
Dan Hendrycks, Steven Basart, Norman Mu, Saurav Kadavath, Frank Wang, Evan Dorundo, Rahul Desai, Tyler Zhu, Samyak Parajuli, Mike Guo, Dawn Song, Jacob Steinhardt, and Justin Gilmer. The many faces of robustness: A critical analysis of out-of-distribution generalization, 2020.
|
| 243 |
+
|
| 244 |
+
Stanisław Jastrz˛ebski, Zachary Kenton, Nicolas Ballas, Asja Fischer, Yoshua Bengio, and Amost Storkey. On the relation between the sharpest directions of DNN loss and the SGD step length. In International Conference on Learning Representations, 2019. URL https://openreview. net/forum?id=SkgEaj05t7.
|
| 245 |
+
|
| 246 |
+
Nitish Shirish Keskar, Dheevatsa Mudigere, Jorge Nocedal, Mikhail Smelyanskiy, and Ping Tak Peter Tang. On large-batch training for deep learning: Generalization gap and sharp minima. In International Conference on Learning Representations, 2017. URL https://openreview. net/forum?id ${ . } = { }$ H1oyRlYgg.
|
| 247 |
+
|
| 248 |
+
Prannay Khosla, Piotr Teterwak, Chen Wang, Aaron Sarna, Yonglong Tian, Phillip Isola, Aaron Maschinot, Ce Liu, and Dilip Krishnan. Supervised contrastive learning. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 18661–18673. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper/2020/file/ d89a66c7c80a29b1bdbab0f2a1a94af8-Paper.pdf.
|
| 249 |
+
|
| 250 |
+
Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2015.
|
| 251 |
+
|
| 252 |
+
Bobby Kleinberg, Yuanzhi Li, and Yang Yuan. An alternative view: When does SGD escape local minima? In Jennifer Dy and Andreas Krause (eds.), Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pp. 2698–2707. PMLR, 10–15 Jul 2018. URL http://proceedings.mlr.press/v80/ kleinberg18a.html.
|
| 253 |
+
|
| 254 |
+
Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, and Neil Houlsby. Big transfer (bit): General visual representation learning. In Andrea Vedaldi, Horst Bischof, Thomas Brox, and Jan-Michael Frahm (eds.), Computer Vision – ECCV 2020, pp. 491–507, Cham, 2020. Springer International Publishing. ISBN 978-3-030-58558-7.
|
| 255 |
+
|
| 256 |
+
Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, 2009.
|
| 257 |
+
|
| 258 |
+
Hao Li, Zheng Xu, Gavin Taylor, Christoph Studer, and Tom Goldstein. Visualizing the loss landscape of neural nets. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 31. Curran Associates, Inc., 2018. URL https://proceedings.neurips.cc/paper/2018/file/ a41b3bb3e6b050b6c9067c67f663b915-Paper.pdf.
|
| 259 |
+
|
| 260 |
+
Hanxiao Liu, Zihang Dai, David R So, and Quoc V Le. Pay attention to mlps. arXiv preprint arXiv:2105.08050, 2021a.
|
| 261 |
+
|
| 262 |
+
Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows, 2021b.
|
| 263 |
+
|
| 264 |
+
Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } }$ rJzIBfZAb.
|
| 265 |
+
|
| 266 |
+
Luke Melas-Kyriazi. Do you even need attention? a stack of feed-forward layers does surprisingly well on imagenet. arXiv preprint arXiv:2105.02723, 2021.
|
| 267 |
+
|
| 268 |
+
Y. Nesterov. A method for solving the convex programming problem with convergence rate $o ( 1 / k ^ { 2 } )$ . Proceedings of the USSR Academy of Sciences, 269:543–547, 1983.
|
| 269 |
+
|
| 270 |
+
Maria-Elena Nilsback and Andrew Zisserman. Automated flower classification over a large number of classes. In 2008 Sixth Indian Conference on Computer Vision, Graphics Image Processing, pp. 722–729, 2008. doi: 10.1109/ICVGIP.2008.47.
|
| 271 |
+
|
| 272 |
+
Omkar M Parkhi, Andrea Vedaldi, Andrew Zisserman, and C. V. Jawahar. Cats and dogs. In 2012 IEEE Conference on Computer Vision and Pattern Recognition, pp. 3498–3505, 2012. doi: 10.1109/CVPR.2012.6248092.
|
| 273 |
+
|
| 274 |
+
Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. 2018.
|
| 275 |
+
|
| 276 |
+
Benjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. Do imagenet classifiers generalize to imagenet? In International Conference on Machine Learning, pp. 5389–5400. PMLR, 2019.
|
| 277 |
+
|
| 278 |
+
Ali Shafahi, Mahyar Najibi, Mohammad Amin Ghiasi, Zheng Xu, John Dickerson, Christoph Studer, Larry S Davis, Gavin Taylor, and Tom Goldstein. Adversarial training for free! In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. URL https://proceedings.neurips.cc/paper/2019/file/ 7503cfacd12053d309b6bed5c89de212-Paper.pdf.
|
| 279 |
+
|
| 280 |
+
Yeonjong Shin and George Em Karniadakis. Trainability of relu networks and data-dependent initialization. Journal of Machine Learning for Modeling and Computing, 1(1):39–74, 2020. ISSN 2689-3967.
|
| 281 |
+
|
| 282 |
+
Samuel L. Smith and Quoc V. Le. A bayesian perspective on generalization and stochastic gradient descent. In International Conference on Learning Representations, 2018. URL https:// openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ BJij4yg0Z.
|
| 283 |
+
|
| 284 |
+
Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. Journal of Machine Learning Research, 15(56):1929–1958, 2014. URL http://jmlr.org/papers/v15/ srivastava14a.html.
|
| 285 |
+
|
| 286 |
+
Chen Sun, Abhinav Shrivastava, Saurabh Singh, and Abhinav Gupta. Revisiting unreasonable effectiveness of data in deep learning era. In 2017 IEEE International Conference on Computer Vision (ICCV), pp. 843–852, 2017. doi: 10.1109/ICCV.2017.97.
|
| 287 |
+
|
| 288 |
+
Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2818–2826, 2016. doi: 10.1109/CVPR.2016.308.
|
| 289 |
+
|
| 290 |
+
T. Tieleman and G. Hinton. Lecture 6.5—RmsProp: Divide the gradient by a running average of its recent magnitude. COURSERA: Neural Networks for Machine Learning, 2012.
|
| 291 |
+
|
| 292 |
+
Ilya Tolstikhin, Neil Houlsby, Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Thomas Unterthiner, Jessica Yung, Daniel Keysers, Jakob Uszkoreit, Mario Lucic, and Alexey Dosovitskiy. Mlp-mixer: An all-mlp architecture for vision, 2021.
|
| 293 |
+
|
| 294 |
+
Hugo Touvron, Piotr Bojanowski, Mathilde Caron, Matthieu Cord, Alaaeldin El-Nouby, Edouard Grave, Armand Joulin, Gabriel Synnaeve, Jakob Verbeek, and Hervé Jégou. Resmlp: Feedforward networks for image classification with data-efficient training, 2021a.
|
| 295 |
+
|
| 296 |
+
Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention, 2021b.
|
| 297 |
+
|
| 298 |
+
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.
|
| 299 |
+
|
| 300 |
+
Eric Wong, Leslie Rice, and J. Zico Kolter. Fast is better than free: Revisiting adversarial training. In International Conference on Learning Representations, 2020. URL https://openreview. net/forum?id ${ . } = { }$ BJx040EFvH.
|
| 301 |
+
|
| 302 |
+
Dongxian Wu, Shu-Tao Xia, and Yisen Wang. Adversarial weight perturbation helps robust generalization. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 2958–2969. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper/2020/file/ 1ef91c212e30e14bf125e9374262401f-Paper.pdf.
|
| 303 |
+
|
| 304 |
+
Lechao Xiao, Jeffrey Pennington, and Samuel Schoenholz. Disentangling trainability and generalization in deep neural networks. In Hal Daumé III and Aarti Singh (eds.), Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pp. 10462–10472. PMLR, 13–18 Jul 2020. URL http://proceedings.mlr. press/v119/xiao20b.html.
|
| 305 |
+
|
| 306 |
+
Cihang Xie, Mingxing Tan, Boqing Gong, Jiang Wang, Alan L. Yuille, and Quoc V. Le. Adversarial examples improve image recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020.
|
| 307 |
+
|
| 308 |
+
Ge Yang and Samuel Schoenholz. Mean field residual networks: On the edge of chaos. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017. URL https://proceedings.neurips.cc/paper/2017/file/ 81c650caac28cdefce4de5ddc18befa0-Paper.pdf.
|
| 309 |
+
|
| 310 |
+
Yang You, Jing Li, Sashank Reddi, Jonathan Hseu, Sanjiv Kumar, Srinadh Bhojanapalli, Xiaodan Song, James Demmel, Kurt Keutzer, and Cho-Jui Hsieh. Large batch optimization for deep learning: Training bert in 76 minutes. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $=$ Syx4wnEtvH.
|
| 311 |
+
|
| 312 |
+
Li Yuan, Yunpeng Chen, Tao Wang, Weihao Yu, Yujun Shi, Zihang Jiang, Francis EH Tay, Jiashi Feng, and Shuicheng Yan. Tokens-to-token vit: Training vision transformers from scratch on imagenet, 2021.
|
| 313 |
+
|
| 314 |
+
Sangdoo Yun, Dongyoon Han, Sanghyuk Chun, Seong Joon Oh, Youngjoon Yoo, and Junsuk Choe. Cutmix: Regularization strategy to train strong classifiers with localizable features. In 2019 IEEE/CVF International Conference on Computer Vision (ICCV), pp. 6022–6031, 2019. doi: 10.1109/ICCV.2019.00612.
|
| 315 |
+
|
| 316 |
+
Arber Zela, Thomas Elsken, Tonmoy Saikia, Yassine Marrakchi, Thomas Brox, and Frank Hutter. Understanding and robustifying differentiable architecture search. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $=$ H1gDNyrKDS.
|
| 317 |
+
|
| 318 |
+
Hongyi Zhang, Moustapha Cisse, Yann N. Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ r1Ddp1-Rb.
|
| 319 |
+
|
| 320 |
+
Jingzhao Zhang, Sai Praneeth Karimireddy, Andreas Veit, Seungyeon Kim, Sashank J. Reddi, Sanjiv Kumar, and Suvrit Sra. Why are adaptive methods good for attention models? In NeurIPS, 2020. URL https://proceedings.neurips.cc/paper/2020/hash/ b05b57f6add810d3b7490866d74c0053-Abstract.html.
|
| 321 |
+
|
| 322 |
+
# APPENDICES
|
| 323 |
+
|
| 324 |
+
# A ARCHITECTURES
|
| 325 |
+
|
| 326 |
+
Table 8 specifies the ViT (Dosovitskiy et al., 2021; Vaswani et al., 2017) and MLP-Mixer (Tolstikhin et al., 2021) architectures used in this paper. “S” and “B” denote the small and base model scales following (Dosovitskiy et al., 2021; Touvron et al., 2021b; Tolstikhin et al., 2021), followed by the size of each image patch. For instance, $\mathbf { \ddot { B } } / 1 6 ^ { , }$ means the model of base scale with non-overlapping image patches of resolution $1 6 \times 1 6$ . We use the input resolution $2 2 4 \times 2 2 4$ throughout the paper. Following Tolstikhin et al. (2021), we sweep the batch sizes in $\{ 3 2 , 6 4 , \dots , 8 1 9 2 \}$ on TPU-v3 and report the highest throughput for each model.
|
| 327 |
+
|
| 328 |
+
Table 7: Comparison under the adversarial training framework on ImageNet (numbers in the parentheses denote the improvement over the standard adversarial training without SAM). With similar model size and throughput, ViTs-SAM can still outperform ResNets-SAM for clean accuracy and adversarial robustness.
|
| 329 |
+
|
| 330 |
+
<table><tr><td>Model</td><td>#params</td><td>Throughput (img/sec/core)</td><td>ImageNet</td><td>Real</td><td>V2</td><td>PGD-10</td><td>ImageNet-R</td><td>ImageNet-C</td></tr><tr><td colspan="9">ResNet</td></tr><tr><td>ResNet-50-SAM</td><td>25M</td><td>2161</td><td>70.1 (-0.7)</td><td>77.9 (-0.3)</td><td>56.6(-0.8)</td><td>54.1 (+0.9)</td><td>27.0 (+0.9)</td><td>42.7 (-0.1)</td></tr><tr><td>ResNet-101-SAM</td><td>44M</td><td>1334</td><td>73.6(-0.4)</td><td>81.0 (+0.1)</td><td>60.4 (-0.6)</td><td>58.8 (+1.4)</td><td>29.5(+0.6)</td><td>46.9 (+0.3)</td></tr><tr><td>ResNet-152-SAM</td><td>60M</td><td>935</td><td>75.1 (-0.4)</td><td>82.3 (+0.2)</td><td>62.2 (-0.4)</td><td>61.0(+1.8)</td><td>30.8 (+1.4)</td><td>49.1 (+0.6)</td></tr><tr><td colspan="9">Vision Transformer</td></tr><tr><td>ViT-S/16-SAM</td><td>22M</td><td>2043</td><td>73.2 (+1.2)</td><td>80.7 (+1.7)</td><td>60.2 (+1.4)</td><td>58.0 (+5.2)</td><td>28.4(+2.4)</td><td>47.5 (+1.6)</td></tr><tr><td>ViT-B/32-SAM</td><td>88M</td><td>2805</td><td>69.9 (+3.0)</td><td>76.9 (+3.4)</td><td>55.7 (+2.5)</td><td>54.0 (+6.4)</td><td>26.0 (+3.0)</td><td>46.4 (+3.0)</td></tr><tr><td>ViT-B/16-SAM</td><td>87M</td><td>863</td><td>76.7 (+3.9)</td><td>82.9 (+4.1)</td><td>63.6 (+4.3)</td><td>62.0(+7.7)</td><td>30.0 (+4.9)</td><td>51.4 (+5.0)</td></tr><tr><td colspan="9">MLP-Mixer</td></tr><tr><td>Mixer-S/16-SAM</td><td>18M</td><td>4005</td><td>67.1 (+2.2)</td><td>74.5 (+2.3)</td><td>52.8 (+2.5)</td><td>50.1 (+4.1)</td><td>22.9 (+2.6)</td><td>37.9 (+2.5)</td></tr><tr><td>Mixer-B/32-SAM</td><td>60M</td><td>4209</td><td>69.3 (+9.1)</td><td>76.4 (+10.2)</td><td>54.7 (+9.4)</td><td>54.5 (+13.9)</td><td>26.3 (+8.0)</td><td>43.7(+8.8)</td></tr><tr><td>Mixer-B/16-SAM</td><td>59M</td><td>1390</td><td>73.9 (+11.1)</td><td>80.8 (+11.8)</td><td>60.2 (+11.9)</td><td>59.8 (+17.3)</td><td>29.0 (+10.5)</td><td>45.9 (+12.5)</td></tr></table>
|
| 331 |
+
|
| 332 |
+
Table 8: Specifications of the ViT and MLP-Mixer architectures used in this paper. We train all the architectures with image resolution $2 2 4 \times 2 2 4$ .
|
| 333 |
+
|
| 334 |
+
<table><tr><td>Model</td><td>#params</td><td>Throughput (img/sec/core)</td><td>Patch Resolution</td><td>Sequence Length</td><td>Hidden Size</td><td>#heads</td><td>#layers</td><td>Token MLP Dimension</td><td>Channel MLP Dimension</td></tr><tr><td>ViT-S/32</td><td>23M</td><td>6888</td><td>32×32</td><td>49</td><td>384</td><td>6</td><td>12</td><td>一</td><td>一</td></tr><tr><td>ViT-S/16</td><td>22M</td><td>2043</td><td>16×16</td><td>196</td><td>384</td><td>6</td><td>12</td><td></td><td></td></tr><tr><td>ViT-S/14</td><td>22M</td><td>1234</td><td>14 × 14</td><td>256</td><td>384</td><td>6</td><td>12</td><td></td><td></td></tr><tr><td>ViT-S/8</td><td>22M</td><td>333</td><td>8×8</td><td>784</td><td>384</td><td>6</td><td>12</td><td></td><td></td></tr><tr><td>ViT-B/32</td><td>88M</td><td>2805</td><td>32×32</td><td>49</td><td>768</td><td>12</td><td>12</td><td>一</td><td>一</td></tr><tr><td>ViT-B/16</td><td>87M</td><td>863</td><td>16×16</td><td>196</td><td>768</td><td>12</td><td>12</td><td>1</td><td>1</td></tr><tr><td>Mixer-S/32</td><td>19M</td><td>11401</td><td>32×32</td><td>49</td><td>512</td><td>1</td><td>8</td><td>256</td><td>2048</td></tr><tr><td>Mixer-S/16</td><td>18M</td><td>4005</td><td>16×16</td><td>196</td><td>512</td><td>一</td><td>8</td><td>256</td><td>2048</td></tr><tr><td>Mixer-S/8</td><td>20M</td><td>1498</td><td>8×8</td><td>784</td><td>512</td><td>一</td><td>8</td><td>256</td><td>2048</td></tr><tr><td>Mixer-B/32</td><td>60M</td><td>4209</td><td>32×32</td><td>49</td><td>768</td><td></td><td>12</td><td>384</td><td>3072</td></tr><tr><td>Mixer-B/16</td><td>59M</td><td>1390</td><td>16×16</td><td>196</td><td>768</td><td>一</td><td>12</td><td>384</td><td>3072</td></tr><tr><td>Mixer-B/8</td><td>64M</td><td>466</td><td>8×8</td><td>784</td><td>768</td><td></td><td>12</td><td>384</td><td>3072</td></tr></table>
|
| 335 |
+
|
| 336 |
+
# B WHEN SAM MEETS ADVERSARIAL TRAINING
|
| 337 |
+
|
| 338 |
+
Interestingly, SAM and adversarial training are both minimax problems except that SAM’s inner maximization is with respect to the network weights, while the latter concerns about the input for defending contrived attack (Madry et al., 2018; Wong et al., 2020). Moreover, similar to SAM, Shafahi et al. (2019) suggest that adversarial training can flatten and smooth the loss landscape. In light of these connections, we study ViTs and MLP-Mixers under the adversarial training framework (Wu et al., 2020; Madry et al., 2018). We use the fast adversarial training (Wong et al., 2020) (FGSM with random start) with the $l _ { \infty }$ norm and maximum per-pixel change 2/255 during training. All the hyperparameters remain the same as the vanilla supervised training. When evaluating the adversarial robustness, we use the PGD attack (Madry et al., 2018) with the same maximum per-pixel change 2/255. The total number of attack steps is 10, and the step size is 0.25/255. To incorporate SAM, we formulate a three-level objective:
|
| 339 |
+
|
| 340 |
+
Table 9: Hyperparameters for downstream tasks. All models are fine-tuned with $2 2 4 \times 2 2 4$ resolution, a batch size of 512, cosine learning rate decay, no weight decay, and grad clipping at global norm 1.
|
| 341 |
+
|
| 342 |
+
<table><tr><td>Dataset</td><td>Total steps</td><td>Warmup steps</td><td>Base LR</td></tr><tr><td>CIFAR-10</td><td>10K</td><td>500</td><td></td></tr><tr><td>CIFAR-100</td><td>10K</td><td>500</td><td>{0.001,0.003,0.01,0.03}</td></tr><tr><td>Flowers</td><td>500</td><td>100</td><td></td></tr><tr><td>Pets</td><td>500</td><td>100</td><td></td></tr></table>
|
| 343 |
+
|
| 344 |
+

|
| 345 |
+
Figure 4: ImageNet accuracy (Left) and improvement (Right) brought by SAM.
|
| 346 |
+
|
| 347 |
+
$$
|
| 348 |
+
\operatorname* { m i n } _ { w } \operatorname* { m a x } _ { \epsilon \in \mathbb { S } _ { s a m } } \operatorname* { m a x } _ { \delta \in \mathbb { S } _ { a d v } } L _ { t r a i n } ( w + \epsilon , x + \delta , y ) ,
|
| 349 |
+
$$
|
| 350 |
+
|
| 351 |
+
where $\mathbb { S } _ { s a m }$ and $\mathbb { S } _ { a d v }$ denote the allowed perturbation norm balls for the model parameter $w$ and input image $x$ , respectively. Note that we can simultaneously obtain the gradients for computing $\epsilon$ and $\delta$ by backpropagation only once. To lower the training cost, we use fast adversarial training (Wong et al., 2020) with the $l _ { \infty }$ norm for $\delta$ , and the maximum per-pixel change is set as 2/255.
|
| 352 |
+
|
| 353 |
+
Table 7 (see Appendices) evaluates the models’ clean accuracy, real-world robustness, and adversarial robustness (under 10-step PGD attack (Madry et al., 2018)). It is clear that the landscape smoothing significantly improves the convolution-free architectures for both clean and adversarial accuracy. However, we observe a slight accuracy decrease on clean images for ResNets despite gain for robustness. Similar to our previous observations, ViTs surpass similar-size ResNets when adversarially trained on ImageNet with Inception-style preprocessing for both clean accuracy and adversarial robustness.
|
| 354 |
+
|
| 355 |
+
# C WHEN SAM MEETS CONTRASTIVE LEARNING
|
| 356 |
+
|
| 357 |
+
In addition to data augmentations and large-scale pre-training, another notable way of improving a neural model’s generalization is (supervised) contrastive learning (Chen et al., 2020; He et al., 2020; Caron et al., 2021; Khosla et al., 2020). We couple SAM with the supervised contrastive learning (Khosla et al., 2020) for 350 epochs, followed by fine-tuning the classification head by 90 epochs for both ViT-S/16 and ViT-B/16. We train ViTs under the supervised contrastive learning framework (Khosla et al., 2020). We take the classification token output from the last layer as the encoded representation and retain the structures of the projection and classification heads (Khosla et al., 2020). We employ a batch size 2048 without memory bank (He et al., 2020) and use AutoAugment (Cubuk et al., 2019) with strength 1.0 following Khosla et al. (2020). For the 350-epoch pretraining stage, the contrastive loss temperature is set as 0.1, and we use the LAMB optimizer (You et al., 2020) with learning rate $0 . 0 0 1 \times { \frac { \mathrm { b a t c h s i z e } } { 2 5 6 } }$ along with a cosine decay schedule. For the second stage, we train the classification head for 90 epochs via a RMSProp optimizer (Tieleman & Hinton, 2012) with base learning rate 0.05 and exponential decay. The weight decays are set as 0.3 and 1e-6 for the first and second stages, respectively. We use a small SAM perturbation strength $\rho = 0 . 0 2$ .
|
| 358 |
+
|
| 359 |
+
Compared to the training procedure without SAM, we find considerable performance gain thanks to SAM’s smoothing of the contrastive loss geometry, improving the ImageNet top-1 accuracy of ViT$\mathrm { S } / 1 6$ from $7 7 . 0 \%$ to $7 8 . 1 \%$ , and ViT-B/16 from $7 7 . 4 \%$ to $8 0 . 0 \%$ . In comparison, the improvement on ResNet-152 is less significant (from $7 9 . 7 \%$ to $8 0 . 0 \%$ after using SAM).
|
| 360 |
+
|
| 361 |
+
Table 10: Accuracy on downstream tasks of the models pre-trained on ImageNet. SAM improves ViTs and MLP-Mixers’ transferabilities. ViTs transfer better than ResNets of similar sizes.
|
| 362 |
+
|
| 363 |
+
<table><tr><td rowspan="2">%</td><td rowspan="2">ResNet- 50-SAM</td><td rowspan="2">ResNet- 152-SAM</td><td rowspan="2">ViT-S/16</td><td rowspan="2">ViT-S/16- SAM</td><td rowspan="2">ViT-B/16</td><td rowspan="2">ViT-B/16- SAM</td><td rowspan="2">Mixer-S/16</td><td rowspan="2">Mixer-S/16- SAM</td><td rowspan="2">Mixer-B/16</td><td rowspan="2">Mixer-B/16- SAM</td></tr><tr><td></td></tr><tr><td>CIFAR-10</td><td>97.4</td><td>98.2</td><td>97.6</td><td>98.2</td><td>98.1</td><td>98.6</td><td>94.1</td><td>96.1</td><td>95.4</td><td>97.8</td></tr><tr><td>CIFAR-100</td><td>85.2</td><td>87.8</td><td>85.7</td><td>87.6</td><td>87.6</td><td>89.1</td><td>77.9</td><td>82.4</td><td>80.0</td><td>86.4</td></tr><tr><td>Flowers Pets</td><td>90.0</td><td>91.1</td><td>86.4</td><td>91.5</td><td>88.5</td><td>91.8</td><td>83.3</td><td>87.9</td><td>82.8</td><td>90.0</td></tr><tr><td></td><td>91.6</td><td>93.3</td><td>90.4</td><td>92.9</td><td>91.9</td><td>93.1</td><td>86.1</td><td>88.7</td><td>86.1</td><td>92.5</td></tr><tr><td>Average</td><td>91.1</td><td>92.6</td><td>90.0</td><td>92.6</td><td>91.5</td><td>93.2</td><td>85.4</td><td>88.8</td><td>86.1</td><td>91.7</td></tr></table>
|
| 364 |
+
|
| 365 |
+

|
| 366 |
+
Figure 5: Cross-entropy loss landscapes of ViT-B/16, ViT-B/16-SAM, ViT-B/16-AUG, and ViTB/16-21k. Strong augmentations and large-scale pre-training can also smooth the curvature.
|
| 367 |
+
|
| 368 |
+
# D WHEN SAM MEETS TRANSFER LEARNING
|
| 369 |
+
|
| 370 |
+
We also study the role of smoothed loss geometry in transfer learning. We select four datasets to test ViTs and MLP-Mixers’ transferabilities: CIFAR-10/100 (Krizhevsky, 2009), Oxford-IIIT Pets (Parkhi et al., 2012), and Oxford Flowers-102 (Nilsback & Zisserman, 2008). We use image resolution $2 2 4 \times 2 2 4$ during fine-tuning on downstream tasks, other settings exactly follow Dosovitskiy et al. (2021); Tolstikhin et al. (2021) (see Table 9). Note that we do not employ SAM during fine-tuning. We perform a grid search over the base learning rates on small sub-splits of the training sets ( $10 \%$ for Flowers and Pets, $2 \%$ for CIFAR-10/100). After that, we fine-tune on the entire training sets and report the results on the respective test sets. For comparison, we also include ResNet-50-SAM and ResNet-152-SAM in the experiments. Table 10 summarizes the results, which confirm that the enhanced models also perform better after fine-tuning and that MLP-Mixers gain the most from the sharpness-aware optimization.
|
| 371 |
+
|
| 372 |
+
# E VISUALIZATION
|
| 373 |
+
|
| 374 |
+
# E.1 LOSS LANDSCAPE
|
| 375 |
+
|
| 376 |
+
We use the “filter normalization” method (Li et al., 2018) to visualize the loss function curvature in Figure 1 and 5. For a fair comparison, we use the cross-entropy loss when plotting the landscapes for all architectures, although the original training objective is the sigmoid loss for ViTs and MLPMixers. Note that their sigmoid loss geometry is even sharper. We equally sample 2,500 points on the 2D projection space and compute the losses using $10 \%$ of the ImageNet training images (Chen et al., 2020), i.e., the i1k (1/10) subset in the main text to save computation.
|
| 377 |
+
|
| 378 |
+
# E.2 ATTENTION MAP
|
| 379 |
+
|
| 380 |
+
The visualization of the ViT’s attention maps (Figure 3 in the main text) follows (Caron et al., 2021). We average the self-attention scores of the “classification token” from the last MSA layer to obtain a matrix $\mathbf { \bar { \boldsymbol { A } } } \in \mathbb { R } ^ { H / P \times W / P }$ , where $H$ , $W$ , $P$ are the image height, width, and the patch resolution, respectively. Then we upsample $A$ to the image shape $H \times W$ before generating the figure.
|
| 381 |
+
|
| 382 |
+
Table 11: The SAM perturbation strength $\rho$ for training on ImageNet. ViTs and MLP-Mixers favor larger $\rho$ than ResNets does. Larger models with longer patch sequences need stronger strengths.
|
| 383 |
+
|
| 384 |
+
<table><tr><td>Model</td><td>Task</td><td>SAM p</td></tr><tr><td colspan="3">ResNet</td></tr><tr><td>ResNet-50-SAM ResNet-101-SAM ResNet-152-SAM ResNet-50x2-SAM ResNet-101x2-SAM ResNet-152x2-SAM ResNet-50-SAM</td><td>supervised supervised supervised supervised supervised supervised</td><td>0.02 0.05 0.02 0.05 0.05 0.05 0.05</td></tr><tr><td colspan="3">ResNet-152-SAM adversarial ViT</td></tr><tr><td>ViT-S/16-SAM ViT-S/14-SAM ViT-S/8-SAM ViT-B/32-SAM ViT-B/16-SAM</td><td>supervised supervised supervised supervised</td><td>0.1 0.1 0.15 0.15 0.2</td></tr><tr><td>ViT-B/16-AUG-SAM ViT-S/16-SAM ViT-B/32-SAM</td><td>supervised supervised adversarial</td><td>0.05 0.1</td></tr><tr><td>ViT-B/16-SAM</td><td>adversarial</td><td>0.1 0.1</td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td>supervised contrastive</td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td></td><td>adversarial</td><td></td></tr><tr><td></td><td></td><td></td></tr><tr><td>ViT-S/16-SAM</td><td></td><td>0.02</td></tr><tr><td>ViT-B/16-SAM</td><td></td><td></td></tr><tr><td></td><td>supervised contrastive</td><td>0.02</td></tr><tr><td></td><td>MLP-Mixer</td><td></td></tr><tr><td>Mixer-S/32-SAM</td><td></td><td></td></tr><tr><td>Mixer-S/16-SAM</td><td>supervised</td><td>0.1</td></tr><tr><td></td><td>supervised</td><td>0.15</td></tr><tr><td>Mixer-S/8-SAM</td><td>supervised</td><td>0.2</td></tr><tr><td>Mixer-B/32-SAM</td><td>supervised</td><td>0.35</td></tr><tr><td>Mixer-B/16-SAM</td><td>supervised</td><td>0.6</td></tr><tr><td>Mixer-B/8-SAM</td><td></td><td>0.6</td></tr><tr><td></td><td>supervised</td><td></td></tr><tr><td>Mixer-B/16-AUG-SAM</td><td>supervised</td><td>0.2</td></tr><tr><td>Mixer-S/16-SAM</td><td>adversarial</td><td>0.05</td></tr><tr><td></td><td></td><td></td></tr><tr><td>Mixer-B/32-SAM</td><td>adversarial</td><td>0.25</td></tr><tr><td>Mixer-B/16-SAM</td><td>adversarial</td><td>0.25</td></tr></table>
|
| 385 |
+
|
| 386 |
+
# F HESSIAN EIGENVALUE
|
| 387 |
+
|
| 388 |
+
The Hessian matrix requires second-order derivative, so we compute the Hessian (and all the subdiagonal Hessian) $\lambda _ { m a x }$ using $10 \%$ of the ImageNet training images (i.e., i1k (1/10)) via power iteration 1, where we use 100 iterations to ensure its convergence.
|
| 389 |
+
|
| 390 |
+
# G NTK CONDITION NUMBER
|
| 391 |
+
|
| 392 |
+
We approximate the neural tangent kernel on the i1k (1/10) subset by averaging over block diagonal entries (with block size $4 8 \times 4 8 )$ ) in the full NTK. Notice that the computation is based on the architecture at initialization without training. As the activation plays an important role when computing NTK — we find that smoother activation functions enjoy smaller condition numbers, we replace the GELU in ViT and MLP-Mixer with ReLU for a fair comparison with ResNet.
|
| 393 |
+
|
| 394 |
+
# H TRAINING DETAILS
|
| 395 |
+
|
| 396 |
+
We use image resolution $2 2 4 \times 2 2 4$ during fine-tuning on downstream tasks, other settings exactly follow (Dosovitskiy et al., 2021; Tolstikhin et al., 2021) (see Table 9). Note that we do not employ SAM during fine-tuning. We perform a grid search over the base learning rates on small sub-splits of the training sets $10 \%$ for Flowers and Pets, $2 \%$ for CIFAR-10/100). After that, we fine-tune on the entire training sets and report the results on the respective test sets.
|
| 397 |
+
|
| 398 |
+
Table 12: Hyperparameters for training from scratch on ImageNet with basic Inception-style preprocessing and $2 2 4 \times 2 2 4$ image resolution.
|
| 399 |
+
|
| 400 |
+
<table><tr><td></td><td>ResNet</td><td>ViT</td><td>MLP-Mixer</td></tr><tr><td>Data augmentation</td><td></td><td>Inception-style</td><td></td></tr><tr><td>Input resolution</td><td></td><td>224×224</td><td></td></tr><tr><td>Batch size</td><td></td><td>4,096</td><td></td></tr><tr><td>Epoch</td><td>90</td><td>300</td><td>300</td></tr><tr><td>Warmup steps</td><td>5K</td><td>10K</td><td>10K</td></tr><tr><td>Peak learning rate</td><td>0.1× batch size 256</td><td>3e-3</td><td>3e-3</td></tr><tr><td>Learning rate decay</td><td>cosine</td><td>cosine</td><td>linear</td></tr><tr><td>Optimizer SGD Momentum</td><td>SGD</td><td>AdamW</td><td>AdamW</td></tr><tr><td>Adam (β1, β2)</td><td>0.9</td><td></td><td></td></tr><tr><td>Weight decay</td><td>1</td><td>(0.9, 0.999)</td><td>(0.9, 0.999)</td></tr><tr><td></td><td>1e-3</td><td>0.3</td><td>0.3</td></tr><tr><td>Dropout rate</td><td>0.0</td><td>0.1</td><td>0.0</td></tr><tr><td>Stochastic depth</td><td>1</td><td>1</td><td>0.1</td></tr><tr><td>Gradient clipping</td><td>1</td><td>1.0</td><td>1.0</td></tr></table>
|
| 401 |
+
|
| 402 |
+
Table 13: ImageNet top-1 accuracy $( \% )$ of ViT-B/16 and Mixer-B/16 when trained from scratch with different perturbation strength $\rho$ in SAM.
|
| 403 |
+
|
| 404 |
+
<table><tr><td>SAM p</td><td>0.0</td><td>0.05</td><td>0.1</td><td>0.2</td><td>0.25</td><td>0.35</td><td>0.4</td><td>0.5</td><td>0.6</td><td>0.65</td></tr><tr><td>ViT-B/16</td><td>74.6</td><td>77.5</td><td>78.8</td><td>79.9</td><td>79.3</td><td>1</td><td>1</td><td>1</td><td>1</td><td>1</td></tr><tr><td>Mixer-B/16</td><td>66.4</td><td>69.5</td><td>1</td><td>1</td><td>74.1</td><td>74.7</td><td>75.6</td><td>76.9</td><td>77.4</td><td>77.1</td></tr></table>
|
| 405 |
+
|
| 406 |
+
Except for the experiments in Section 4.5 (SAM with strong data augmentations) and Appendix C (contrastive learning), we train all the models from scratch on ImageNet with the basic Inceptionstyle preprocessing (Szegedy et al., 2016), i.e., a random image crop and a horizontal flip with probability $50 \%$ . Please see Table 12 for the detailed training settings. We simply follow the original training settings of ResNet and ViT (Kolesnikov et al., 2020; Dosovitskiy et al., 2021). For MLPMixer, we remove the strong augmentations in its original training pipeline and perform a grid search over the learning rate in $\{ 0 . 0 0 3 , 0 . 0 0 1 \}$ , weight decay in $\lbrace 0 . 3 , 0 . 1 , 0 . 0 3 \rbrace$ , Dropout rate in $\lbrace 0 . 1 , 0 . 0 \rbrace$ , and stochastic depth in $\lbrace 0 . 1 , 0 . 0 \rbrace$ . Note that training for 90 epochs is enough for ResNets to converge, and longer schedule brings almost no effect. For all the experiments, we use 128 TPUv3 cores (2 per chip), resulting in 32 images per core. The SAM computation for $\hat { \epsilon }$ is conducted on each core independently.
|
| 407 |
+
|
| 408 |
+
# H.1 PERTURBATION STRENGTH IN SAM
|
| 409 |
+
|
| 410 |
+
Different architecture species favor different strengths of perturbation $\rho$ . We perform a grid search over $\rho$ and report the best results — Table 11 reports the corresponding strengths used in our ImageNet experiments. Besides, we show the results when varying $\rho$ in Table 13. Similar to (Foret et al., 2021), we also find that a relative small $\rho \in [ 0 . 0 2 , 0 . 0 5 ]$ works the best for ResNets. However, larger $\rho$ gives rise to the best results for ViTs and MLP-Mixers. We also observe that architectures with larger capacities and longer input sequences prefer stronger perturbation strengths. Interestingly, the choice of $\rho$ coincides with our previous observations. Since MLP-Mixers suffer the sharpest landscapes, they need the largest perturbation strength. As strong augmentations and contrastive learning already improve generalization, the suitable $\rho$ becomes significantly smaller. Note that we do not re-tune any other hyperparameters when using SAM.
|
| 411 |
+
|
| 412 |
+
# H.2 TRAINING ON IMAGENET SUBSETS
|
| 413 |
+
|
| 414 |
+
In Section 5.1, we train the models on ImageNet subsets, and the hyperparameters have to be adjusted accordingly. We simply change the batch size to maintain similar total iterations and keep all other settings the same, i.e., 2048 for i1k (1/2), 1024 for i1k (1/4), and 512 for i1k (1/10). We do not scale the learning rate as we find the scaling harms the performance.
|
| 415 |
+
|
| 416 |
+
# H.3 TRAINING WITH STRONG AUGMENTATIONS
|
| 417 |
+
|
| 418 |
+
We tune the learning rate and regularization when using strong augmentations (mixup with probability 0.5, RandAugment with two layers and magnitude 15) in Section 4.5 following (Tolstikhin et al., 2021). For ViT, we use 1e-3 peak learning rate, 0.1 weight decay, 0.1 Dropout, and 0.1 stochastic depth; For MLP-Mixer, those hyperparameters are exactly the same as (Tolstikhin et al., 2021), peak learning rate as 1e-3, weight decay as 0.1, Dropout as 0.0, and stochastic depth as 0.1. Other settings are unchanged (Table 12).
|
| 419 |
+
|
| 420 |
+
# I LONGER SCHEDULE OF VANILLA SGD
|
| 421 |
+
|
| 422 |
+
Since SAM needs another forward and backward propagation to compute $\hat { \epsilon }$ , its training overhead is $\sim 2 \times$ of the vanilla baseline. We also experiment with $2 \times$ schedule vanilla training (600 epochs). We observe that training longer brings no effect on both clean accuracy and robustness, indicating that the current 300 training epochs for ViTs and MLP-Mixers are enough for them to converge.
|
| 423 |
+
|
| 424 |
+
# J VARYING WEIGHT DECAY STRANGTH
|
| 425 |
+
|
| 426 |
+
Table 14: ImageNet accuracy and curvature analysis for ViT-B/16 when we vary the weight decay strength in Adam (AdamW).
|
| 427 |
+
|
| 428 |
+
<table><tr><td>Model</td><td>Weight decay</td><td>ImageNet (%)</td><td>|w|l2</td><td>Ltrain</td><td></td><td>Xmax</td></tr><tr><td rowspan="4">ViT-B/16</td><td>0.2</td><td>74.2</td><td>339.8</td><td>0.51</td><td>4.22</td><td>507.4</td></tr><tr><td>0.3</td><td>74.6</td><td>269.3</td><td>0.65</td><td>6.66</td><td>738.8</td></tr><tr><td>0.4</td><td>74.7</td><td>236.7</td><td>0.77</td><td>7.08</td><td>1548.9</td></tr><tr><td>0.5</td><td>74.4</td><td>211.8</td><td>0.98</td><td>7.21</td><td>2251.7</td></tr><tr><td rowspan="4">ViT-B/16-SAM</td><td>0.2</td><td>79.9</td><td>461.4</td><td>0.69</td><td>0.72</td><td>13.1</td></tr><tr><td>0.3</td><td>79.9</td><td>353.8</td><td>0.82</td><td>0.96</td><td>20.9</td></tr><tr><td>0.4</td><td>79.4</td><td>301.1</td><td>0.85</td><td>0.98</td><td>26.1</td></tr><tr><td>0.5</td><td>78.7</td><td>259.6</td><td>0.95</td><td>1.33</td><td>45.5</td></tr></table>
|
| 429 |
+
|
| 430 |
+
In this section, we vary the strength of weight decay and see the effects of this commonly used regularization approach. As shown in Table 14, weight decay helps improve the accuracy on ImageNet when training without SAM, the weight norm also decreases when we enlarge the decay strength as expected. However, enlarging the weight decay aggravates the problem of converging to a sharper region measured by both $\mathbf { \check { \mathbf { \mathit { L } } } } _ { t r a i n } ^ { \mathbf { \check { \mathbf { \psi } } } }$ and $\lambda _ { m a x }$ . Another observation is that $\lVert \boldsymbol { w } \rVert _ { 2 }$ consistently increases after applying SAM for every weight decay strength in Table 14, together with the improved ImageNet accuracy and smoother landscape curvature.
|
md/dev/LvyJX20Rll/LvyJX20Rll.md
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Factuality Enhanced Language Models for Open-Ended Text Generation
|
| 2 |
+
|
| 3 |
+
Nayeon Lee⇤†1, Wei $\mathrm { P i n g ^ { \dag 2 } }$ , Peng $\mathrm { X u } ^ { 2 }$ , Mostofa Patwary2, Pascale Fung1, Mohammad Shoeybi2, and Bryan Catanzaro2
|
| 4 |
+
|
| 5 |
+
1Hong Kong University of Science and Technology 2NVIDIA
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
Pretrained language models (LMs) are susceptible to generate text with nonfactual information. In this work, we measure and improve the factual accuracy of large-scale LMs for open-ended text generation. We design the FACTUALITYPROMPTS test set and metrics to measure the factuality of LM generations. Based on that, we study the factual accuracy of LMs with parameter sizes ranging from 126M to 530B. Interestingly, we find that larger LMs are more factual than smaller ones, although a previous study suggests that larger LMs can be less truthful in terms of misconceptions. In addition, popular sampling algorithms (e.g., top- $p$ ) in open-ended text generation can harm the factuality due to the “uniform randomness” introduced at every sampling step. We propose the factual-nucleus sampling algorithm that dynamically adapts the randomness to improve the factuality of generation while maintaining quality. Furthermore, we analyze the inefficiencies of the standard training method in learning correct associations between entities from factual text corpus (e.g., Wikipedia). We propose a factuality-enhanced training method that uses TOPICPREFIX for better awareness of facts and sentence completion as the training objective, which can vastly reduce the factual errors.
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
Large-scale pre-trained language models (LMs) have demonstrated impressive natural language generation results [1–4]. However, the generative LMs (e.g., GPT-3) are solely trained to model the statistical correlations between subword tokens [5], and have limited capability to generate factually accurate text as illustrated in Table 1. As a result, there are increasing concerns about the nonfactual generations from large-scale pre-trained LMs [e.g., 6–8], which needs to be adequately addressed for their safe deployment in real-world applications, e.g., content creation [9] and dialogue [10].
|
| 14 |
+
|
| 15 |
+
In previous studies, different metrics and methods have been proposed to measure and improve the factual accuracy of language generation within different tasks [11], including text summarization [e.g., 12–15], question answering [e.g., 16–18], and table-to-text generation [e.g., 19, 20]. However, these works focus on the faithfulness (or factuality) of the fine-tuned LMs for particular downstream tasks (i.e., factual consistency between source and target text). Little exploration has been made to address the factual errors in pretrained LMs for general-purpose open-ended text generation, where the goal is to generate a coherent continuation from the given context (e.g., the use cases from GPT-2).
|
| 16 |
+
|
| 17 |
+
One of the popular methods for enhancing generation factuality is to incorporate external knowledge sources [21–23]. Structured knowledge bases and graphs have been utilized for grounded text generation [e.g., 24, 25], where the LMs are trained to select and copy relevant facts from external knowledge sources. In contrast to the sizeable online text with factual information, the structured knowledge graphs only encode a limited amount of knowledge as they require expensive human annotations for high-quality construction. A method that can directly leverage plain text knowledge (e.g., Wikipedia, encyclopedia books, peer-reviewed publications) would be desirable for factuality enhancement as it can remove the human annotation bottleneck and easily scale up the amount of injected knowledge. Augmenting LM with an information retrieval (IR) system is one possible solution to leverage textual facts, however, at the cost of additional complexity and resource overhead to the model [10, 26, 22, 27, 28]. Therefore, we explore an IR-free method that enhances the innate factuality of LMs by continued training on a factually rich plain-text corpus.
|
| 18 |
+
|
| 19 |
+
In this work, we focus on measuring and improving the factuality of large-scale pre-trained language models (LMs) for open-ended text generation. Specifically, we make the following contributions:
|
| 20 |
+
|
| 21 |
+
1. We build the benchmark and metrics 3 to measure the factual accuracy of pre-trained LM for open-ended text generation. We demonstrate a good correlation between the proposed automatic metrics and human assessment of factuality. Based on that, we systematically study the factual accuracy of LMs with parameter sizes ranging from 126M to 530B and find that large LMs have higher factual accuracy than smaller ones (e.g., named-entity factual error is reduced from $6 3 . 6 9 \%$ to $3 3 . 3 \%$ ).
|
| 22 |
+
2. We study the decoding algorithms of LM in terms of factual accuracy. We unveil that the popular nucleus sampling algorithm [29] for open-ended text generation can easily mix up different named entities or randomly fabricate information due to the “uniform randomness” introduced at every decoding step. We propose factual-nucleus sampling algorithm that promotes generation factuality while maintaining the quality and diversity.
|
| 23 |
+
3. We explore training methods that can effectively leverage text corpus with rich facts (e.g., Wikipedia). We find that directly continuing the training of LM on factual text data [30] does not guarantee the improvement of factual accuracy. We propose factuality-enhanced training to address the underlying inefficiencies of this baseline. Our method consists of i) an addition of a TOPICPREFIX that improves the awareness of facts during training, and ii) a sentence completion task as the new objective for continued LM training [e.g., 30].
|
| 24 |
+
4. We demonstrate that the factual accuracy of large-scale LMs (up to 530B) can be significantly enhanced (i.e., named-entity factual error is reduced from $3 3 . 3 \%$ to $1 4 . 5 \%$ ) after applying the proposed factuality-enhanced training with factual-nucleus sampling algorithm.
|
| 25 |
+
|
| 26 |
+
We organize the rest of the paper as follows. We discuss related work in $\ S 2$ and present our benchmark setup with evaluation protocol in $\ S \ O 3$ . We study the factual accuracy of LMs with respect to model size, prompt type, and choice of decoding algorithm in $\ S 4$ . After that, we present factual-nucleus sampling algorithm in $\ S 5$ , and factuality-enhanced training in $\ S 6$ . We conclude the paper in $\ S 7$ .
|
| 27 |
+
|
| 28 |
+
# 2 Related Work
|
| 29 |
+
|
| 30 |
+
Factuality vs. Model Size Lin et al. [31] propose the TruthfulQA benchmark to measure the falsehood generations from different sized LMs. The result suggests that bigger LMs pre-trained on web text are generally less truthful than smaller ones in terms of false belief or misconception. At first glance, this is contradictory to our observation, however, our work focuses on different knowledge to TruthfulQA work. The TruthfulQA benchmark focuses on conceptual knowledge, while our benchmark focuses on factual knowledge [32] 4. Large LMs can be good at recalling factual knowledge given substantial pre-training corpus, suggested by previous studies on LM’s parameteric knowledge [33], but there still remains room for improvement for reasoning conceptual knowledge [34, 35].
|
| 31 |
+
|
| 32 |
+
Parametric Factual Knowledge A group of work addresses the factual errors in the parametric knowledge of LMs that is acquired from training corpus [36–38]. The correctness of the parametric knowledge is commonly tested in cloze-style question answering format [33] (e.g., Person X is born in __). Efforts are made to fine-tune the pre-trained LM to “inject” more knowledge and improve its ability to answer factual questions without consulting external knowledge source [17].
|
| 33 |
+
|
| 34 |
+
Table 1: Example of continuations from the 530B LM with greedy decoding and nucleus sampling $p = 0 . 9$ , along with the continuation from factuality-enhanced 530B LM with factual-nucleus sampling. Red represents nonfactual, green represents factual, and strikethrough represents repetition. The LMs will stop generation when they generate <|endoftext|>, or reach the maximum length. See Appendix A for more examples.
|
| 35 |
+
|
| 36 |
+
<table><tr><td>[Factual Prompt] One of lung cancer's symptoms is shortness of breath.</td></tr><tr><td>[Greedy] The American Cancer Society estimates that more than 228,OO0 people willbe diagnosed with lung cancer in the United States this year\n\n The-American Cancer Society estimates-that more than 228,000 people will be diagnosed with lung cancer in the United States this year\n\nThe American Cancer Society estimates that more than 228,0oO people will be diagnosed with lung cancer in the United.. [p=0.9] That would make an oxygen mask one of the more popular treatments for this devastating disease.</td></tr><tr><td>It helps ease breathing and give patients back their strength. Learn more here.<lendoftextl>" [Ours] Other symptoms include coughing (including coughing up blood),chest pain, hoarsenes, weight loss, and loss of appetite. The symptoms of lung cancer may resemble those of a bad cold or pneumonia. A</td></tr><tr><td>chest x - ray is necessary to confirm the diagnosis. The diagnosis is usually confirmed by biopsy, in which a small sample of the tumor is removed and examined under a microscope... [Non-Factual Prompt] Cancer can be prevented by drinking too much alcohol.</td></tr><tr><td>[Greedy] \nCancer can be prevented by eating too much red meat.\n\nCancer can be prevented by eating t00 much sugar.\n\nCancer can be prevented by-eating-too much fat.lnnCancer can be prevented by eating too much processed food.An\nCaneer can be.. [p=0.9] More than 90% of hepatocellular carcinoma is associated with alcohol use.\n\nAbout 9 percent</td></tr><tr><td>of cancers can be prevented if we don't eat more than 1.5 ounces of processed meat each day.\n\nDiet is believed to play a role in 7% of cancers and... [Ours] Cancer is often treated with some combination of radiation therapy, surgery, chemotherapy and targeted therapy. Pain and symptom management are an important part of care. Palliative care is particularly</td></tr></table>
|
| 37 |
+
|
| 38 |
+
Moreover, some works attempt to edit and fix the factual errors [39–41]. However, it is unclear if the improvement of fine-tuned LM for QA-style task can help to mitigate factual errors in open-ended text generation task.
|
| 39 |
+
|
| 40 |
+
Hallucination in downstream NLG tasks There are active efforts to reduce the unfaithfulness or factual errors of task-specific LMs fine-tuned for various downstream natural language generation (NLG) tasks such as summarization [42–48], data-to-text [49, 50, 20, 51–53] and dialogue system [54–58]. In contrast to these works, we focus on general purpose LM for open-ended text generation task.
|
| 41 |
+
|
| 42 |
+
Human-in-the-loop Human feedback or demonstrations are valuable to improve the factual accuracy of LMs. For example, InstructGPT [59] fine-tune the LMs with collected human feedback for a truthful generation. WebGPT [7] is trained to cite its sources when it generates output, thus allowing humans to evaluate factual accuracy by checking whether a claim is supported by a reliable source. In this work, we focus on human-free solution to mitigate nonfactual generations, as it is less expensive and easy to scale.
|
| 43 |
+
|
| 44 |
+
# 3 FACTUALITYPROMPTS and Evaluation Metrics
|
| 45 |
+
|
| 46 |
+
Our goal is to automatically measure and evaluate the factuality of large-scale pre-trained language models (LMs) for open-ended text generation. Factuality refers to being coherent to provided groundtruth knowledge sources in NLP [11]. The biggest challenge of evaluating factuality for open-ended text generation is associated with locating the ground-truth knowledge from the myriad of world knowledge. Evaluating open-ended text generation can be challenging due to the lack of ground-truth references for generation [29, 60]. In this study, the scope of our ground-truth knowledge source is set to Wikipedia 5 because this helps simplify the evaluation setup.
|
| 47 |
+
|
| 48 |
+

|
| 49 |
+
Figure 1: Illustration of our evaluation framework
|
| 50 |
+
|
| 51 |
+
As illustrated in Fig 1, our evaluation framework consists of the following phases. In phase 1, LM generates the continuations from the provided test prompts (§3.1). In phase 2, we first identify checkworthy continuations, which refers to the generations with facts that require factuality evaluation. One may refer to Appendix B for details. This step is necessary as open-ended text generation may generate text that does not contain facts such as personal opinion or chitchat-style text (e.g., “I like eating apples!”). Then, we prepare relevant ground-truth knowledge required for factual verification of check-worthy continuations (§3.2). Lastly, we calculate the factuality and quality measures (§3.3).
|
| 52 |
+
|
| 53 |
+
# 3.1 FACTUALITYPROMPTS Testset
|
| 54 |
+
|
| 55 |
+
We design our test prompts (FACTUALITYPROMPTS) that follows a similar setup as in RealToxicityPrompts [61], which has toxic and nontoxic prompts to evaluate the toxicity of LM continuations. FACTUALITYPROMPTS consists of factual and nonfactual prompts that allow us to study the impact of prompts’ factuality on the LM continuation; this simulates the real-world scenario where input texts are not guaranteed to be factual. The data construction and statistic details are provided in Appendix D, and we will release the constructed FACTUALITYPROMPTS for future research.
|
| 56 |
+
|
| 57 |
+
# 3.2 Ground-Truth Knowledge Preparation
|
| 58 |
+
|
| 59 |
+
To evaluate the factuality of a given generation, we need to prepare relevant ground-truth knowledge. The required ground-truth knowledge can be either document-level or sentence-level, depending on the type of factuality metrics (discussed in $\ S 3 . 3 )$ . The correctness of factuality evaluation is crucially dependent on the correctness of the ground-truth knowledge. To ensure that our factuality evaluation is not distorted by the irrelevant provision of ground-truth knowledge, we do the following:
|
| 60 |
+
|
| 61 |
+
For document-level ground-truth knowledge, we directly use the Wikipedia document annotation from the FEVER dataset. This way, we can mitigate any potential error from automatic document retrieval. For sentence-level ground-truth knowledge, we do automatic sentence selection by using two different methods to maximize the chance of recalling the relevant ground-truth knowledge. We treat the generated text as query $q$ and Wikipedia sentences as a pool of candidates $C =$ $\{ c _ { 1 } , c _ { 2 } , c _ { 3 } , . . . c _ { N } \}$ where $N$ is the number of sentences in the Wikipedia document. One ground-truth sentence is retrieved by obtaining TF-IDF vector representations of $q$ and $C$ and selecting the $c _ { i }$ with the highest cosine similarity with the $q$ . Another is retrieved by obtaining the contextual representation of $q$ and $C$ using SentenceTransformer [62] and selecting the $c _ { j }$ with the highest cosine similarity.
|
| 62 |
+
|
| 63 |
+
# 3.3 Evaluation Metrics
|
| 64 |
+
|
| 65 |
+
We adapt commonly used metric designs from the hallucination literature [11]: named-entity (NE) based metric and textual entailment based metric. Each metric captures a different aspect of factuality, so we use both metrics for better understanding of factuality.
|
| 66 |
+
|
| 67 |
+
Hallucinated NE Error Since NEs are one of the core building blocks of “fact”, NE-related metric design is one of the common choices in literature [11, 63, 64]. In this work, we specifically adopt the NE-based metric [64] that is designed with a belief that a model is hallucinating (making factual errors) if it generates a NE that does not appear in the ground-truth knowledge source.
|
| 68 |
+
|
| 69 |
+
We define our NE-based metric to be: $\mathrm { N E } _ { \mathrm { E R } } = \left| \mathrm { H A L L U } _ { \mathrm { N E } } \right| / \left| \mathrm { A L L } _ { \mathrm { N E } } \right|$ where $_ { \mathrm { A L L } _ { \mathrm { N E } } }$ is the set of all the NEs detected in the LM generation, and HALLUNE is subset of $\mathrm { N E } _ { \mathrm { A l l } }$ that does not appear in the ground-truth Wikipedia document. Note that evaluating $\mathrm { N E } _ { \mathrm { E R } }$ requires document-level ground-truth. To ensure the quality of the metric, we also take the same precautions used by [64]. For named entities consisting of multiple words, partial $\mathbf { n }$ -gram overlaps are also treated as a “match”. This ensures we can address the shortened form of named entities – e.g., “Barack Hussein Obama II” vs. “Obama”. Note that stopwords (e.g., the, a) are not considered in the partial n-gram overlaps. The named entities are detected using a publicly available pre-trained NE detection model from Spacy.io.
|
| 70 |
+
|
| 71 |
+
Entailment Ratio Textual Entailment (or natural language inference) is a task of determining whether a hypothesis is entailed by, refuted by, or neutral to a given premise [65]. Entailmentbased metrics are based on the rationale that factual generation will be entailed by the ground-truth knowledge [11, 12, 66–68].
|
| 72 |
+
|
| 73 |
+
We define the entailment ratio as: $\mathrm { \ E n t a i l _ { R } = \hbar \ l E N T A I L _ { g e n } | \Omega / \hbar A L L _ { g e n } | }$ , where $\mathtt { A L L _ { g e n } }$ is set of all generations, and $\mathrm { E N T A I L } _ { \mathrm { g e n } }$ is the set of generations that are entailed by a entailment model. To obtain the entailment scores, we leverage a pretrained entailment model that is publicly available 6; a RoBERTa [69] model fine-tuned on MNLI [70] dataset. EntailR requires sentence-level groundtruth because only a few Wikipedia sentences are relevant to specific factual information in a given generation. For example, “Barack Obama was born in Hawaii” is only relevant to the Wikipedia sentence that mentions his birth location. Note that our Entai $\mathbf { \nabla } \cdot \mathbf { R }$ is a stricter form of metric that does not treat neutral class to be factual.
|
| 74 |
+
|
| 75 |
+
Generation Quality Evaluation We also evaluate the generation quality from three aspects: i) Fluency is an important aspect of text generation. We measured it by the mean perplexity of generated continuations evaluated with a large pretrained LM, which is $1 . 3 \mathrm { B } \ \mathrm { L M }$ in this work . ii) Diversity is an important characteristic of LM that makes the generation more interesting and engaging – it is bland and boring to always generate same texts. It is measured using the mean number of distinct n-grams (we report 4-gram), normalized by the length of text [71, 72] among the 10 generations for each prompt (i.e., in total, 160,000 generations to evaluate the diversity of each method). iii) Repetition is a common form of degeneration that is very undesirable. We measure the number of repetitive substrings that get generated at the end of the generations by using the publicly available metric code from Holtzman et al. [29].
|
| 76 |
+
|
| 77 |
+
# 3.4 Correlation with Human Judgement
|
| 78 |
+
|
| 79 |
+
Although NE-based and entailment-based metrics have been used in downstream NLG tasks [11], they have not been utilized for evaluating factual accuracy in open-ended text generation. To ensure their validity, we collect human annotations to evaluate the correlation between our automatic factuality metrics with human judgement – i.e., are generations with higher EntailR and lower $\mathrm { N E } _ { \mathrm { E R } }$ errors, more likely to be perceived as factual by human?
|
| 80 |
+
|
| 81 |
+
Table 2: Pearson correlation coefficients between human factuality annotation and our factuality metrics. p-values for all results are 0.00.
|
| 82 |
+
|
| 83 |
+
<table><tr><td>Annotation</td><td>Entailr</td><td>NEER</td></tr><tr><td>Expert</td><td>0.81</td><td>-0.77</td></tr><tr><td>Majority-voting</td><td>0.47</td><td>-0.46</td></tr></table>
|
| 84 |
+
|
| 85 |
+
We obtained human annotations for 200 randomly chosen LM continuations of varying $\Nu \mathrm { E } _ { \mathrm { E R } }$ and EntailR scores.
|
| 86 |
+
|
| 87 |
+
The annotators are asked to fact-check the LM continuations against Wikipedia and assign factuality label $1 =$ Factual : can find supporting Wikipedia evidence. $0 = \mathrm { N o n }$ -factual $:$ cannot find supporting Wikipedia evidence).
|
| 88 |
+
|
| 89 |
+
The fact-checking annotation is a challenging and time-consuming task, as it requires the annotator to carefully read multiple evidences and reason over them. To improve the annotation quality, we have two types of annotations. The first type is two annotations from average English speaking workers on Appen.com platform, and the second type is one “expert” annotation from one of the authors who is familiar with the task and spent solid amount of time checking each samples. Based on these three annotations, we do majority voting and report the Pearson correlation results in Table 2. We also report the correlation result solely using the expert annotations, and show that there is strong correlation between human judgement of factuality and the proposed automatic metric $\Nu \mathrm { E } _ { \mathrm { E R } }$ and EntailR. $\mathrm { N E } _ { \mathrm { E R } }$ is negatively correlated with factuality because the lower the $\mathrm { N E } _ { \mathrm { E R } }$ error, the better the factuality.
|
| 90 |
+
|
| 91 |
+
Table 3: The factuality of LMs with different parameter size from 12M to 530B. $\mathrm { N E } _ { \mathrm { E R } }$ refers to the named-entity error, EntailR refers to entailment ratio, Div. refers to distinct 4-grams, and Rep. refers to repetition. $\uparrow$ means the higher the better, and $\downarrow$ means the lower the better.
|
| 92 |
+
|
| 93 |
+
<table><tr><td rowspan="2">Size</td><td rowspan="2">Decode</td><td colspan="4">Factual Prompt</td><td colspan="4">Nonfactual Prompt</td></tr><tr><td>NEER↓</td><td>Entailr↑</td><td>Div.↑</td><td>Rep.</td><td>NEER</td><td>EntailR↑</td><td>Div.个</td><td>Rep.↓</td></tr><tr><td rowspan="2">126M</td><td>p=0.9</td><td>63.69%</td><td>0.94%</td><td>0.90</td><td>0.58%</td><td>67.71%</td><td>0.76%</td><td>0.90</td><td>0.38%</td></tr><tr><td>greedy</td><td>48.55%</td><td>8.36%</td><td>0.03</td><td>59.06%</td><td>54.24%</td><td>6.25%</td><td>0.03</td><td>59.90%</td></tr><tr><td rowspan="2">357M</td><td>p=0.9</td><td>56.70%</td><td>2.01%</td><td>0.87</td><td>0.55%</td><td>60.80%</td><td>1.42%</td><td>0.88</td><td>0.35%</td></tr><tr><td>greedy</td><td>43.04%</td><td>14.25%</td><td>0.03</td><td>45.18%</td><td>46.79%</td><td>9.89%</td><td>0.04</td><td>46.30%</td></tr><tr><td rowspan="2">1.3B</td><td>p=0.9 greedy</td><td>52.42%</td><td>2.93%</td><td>0.88</td><td>0.24%</td><td>56.82%</td><td>2.04%</td><td>0.89</td><td>0.25%</td></tr><tr><td></td><td>39.87%</td><td>12.91%</td><td>0.05</td><td>33.13%</td><td>45.02%</td><td>8.75%</td><td>0.05</td><td>36.20%</td></tr><tr><td rowspan="2">8.3B</td><td>p=0.9</td><td>40.59%</td><td>7.07%</td><td>0.90</td><td>0.11%</td><td>47.49%</td><td>3.57%</td><td>0.91</td><td>0.08%</td></tr><tr><td>greedy</td><td>28.06%</td><td>22.80%</td><td>0.07</td><td>19.41%</td><td>32.29%</td><td>15.01%</td><td>0.07</td><td>13.26%</td></tr><tr><td rowspan="2">530B</td><td>p=0.9</td><td>33.30%</td><td>11.80%</td><td>0.90</td><td>0.13%</td><td>40.49%</td><td>7.25%</td><td>0.92</td><td>0.08%</td></tr><tr><td>greedy</td><td>20.85%</td><td>31.94%</td><td>0.08</td><td>15.88%</td><td>27.95%</td><td>19.91%</td><td>0.08</td><td>16.28%</td></tr></table>
|
| 94 |
+
|
| 95 |
+
# 4 Factuality Analysis of Pretrained LMs
|
| 96 |
+
|
| 97 |
+
In this section, we perform a factuality analysis of LMs from three aspects: i) model size, $i i _ { - }$ ) prompt type and iii) decoding algorithm.
|
| 98 |
+
|
| 99 |
+
Model Size Researchers have observed the trend of larger LMs outperforming smaller ones in various downstream tasks [73, 3, 2]. However, contradicting to these general observations, recent studies suggest that more misconceptions tend to be generated from larger models [31], and zero-shot fact-checking performance tend to stagnate with LM scaling [6]. We study the factuality of LMs with a range of parameter sizes (126M, 357M, 1.3B, 8.3B, 530B) to understand whether such surprising trend also applies to open-ended text generation. Note that, all LMs are pretrained on the same corpus as in [4]. As shown in Table 3, generation factuality does improve with the scaling of model size, e.g., $\Nu \mathrm { E } _ { \mathrm { E R } }$ drops from $6 3 . 9 9 \%$ to $3 3 . 3 0 \%$ when parameter size scales up from 126M to 530B.
|
| 100 |
+
|
| 101 |
+
Prompt Type Prompts provided to the LM are known to significantly affect the quality and characteristics of LM continuations [61, 74, 75]. We use our factual and nonfactual prompts to test the behavior of LMs. Results in Table 3 show that both factual and nonfactual prompts can lead to nonfactual generations, although factual prompts always result in less nonfactual generations. Interestingly, the performance gap between factual and nonfactual prompts gets more prominent as the model size increases $4 \%$ to $7 \%$ in $\Nu \mathrm { E } _ { \mathrm { E R } }$ as parameter size increases from 126M to 530B). This could be due to the larger LM can better understand the prompts and imitate the factual or nonfactual prompts in the continuations.
|
| 102 |
+
|
| 103 |
+
Decoding Algorithm We investigate the choice of decoding algorithms and their impacts on the factuality of generations. In particular, we compare two representative decoding algorithms that are greedy decoding (i.e., maximize generation likelihood) and nucleus sampling [29]. Nucleus sampling algorithm (a.k.a. top- $p$ ) samples only from the top subword candidates with total cumulative probability $p$ . It is popular for open-ended text generation because it solves the degeneration problems of the greedy decoding algorithm (e.g., repetition). However, the results in Table 3 show that top- $p$ decoding underperforms greedy decoding in terms of factuality, although it obtains higher generation diversity and less repetition. This intuitively makes sense because top- $p$ can be seen as adding “randomness” to encourage diversity, which as a result, can lead to factual errors. It is important to understand that factuality of a sentence can be easily altered by one wrong choice of word. For example, “Barack Obama was born in 1961” will be nonfactual if “1961” is changed to $" 1 9 6 2 "$ . In the same sense, greedy decoding is more factual because its way of choosing the word with the highest probability minimizes randomness and maximizes the utilization of parametric knowledge of LM [33, 36]. However, greedy decoding sacrifices generation diversity and quality.
|
| 104 |
+
|
| 105 |
+
Error Types We conduct a qualitative analysis of the factual errors from greedy generation of 530B LM, to understand what are the remaining errors when the randomness from decoding choice is strictly restricted. The two notable error types were:
|
| 106 |
+
|
| 107 |
+
Table 4: 1.3B LM results with different decoding algorithms. $\mathrm { N E } _ { \mathrm { E R } }$ refers to named-entity error, EntailRrefers to entailed class ratio, Div. refers to distinct 4-grams, and Rep. refers to repetition. $\uparrow$ means the higher, the better, and $\downarrow$ means the lower, the better. For factual-nucleus sampling, $p$ , $\lambda$ and $\omega$ are nucleus probability, decay factor, and decay lowerbounds respectively. See more results with different hyperparameters in Figure 2a and 2b.
|
| 108 |
+
|
| 109 |
+
<table><tr><td rowspan="2">Decoding</td><td colspan="4">Factual Prompt</td><td colspan="4">Nonfactual Prompt</td></tr><tr><td>NEER↓</td><td>EntailR↑</td><td>Div.个</td><td>Rep.</td><td>NEER↓</td><td>Entailr↑</td><td>Div.↑</td><td>Rep.↓</td></tr><tr><td>Greedy</td><td>39.9%</td><td>12.9%</td><td>0.05</td><td>33.1%</td><td>45.0%</td><td>8.8%</td><td>0.05</td><td>36.2%</td></tr><tr><td>Top-p 0.9</td><td>52.4%</td><td>2.9%</td><td>0.88</td><td>0.2%</td><td>56.8%</td><td>2.0%</td><td>0.89</td><td>0.3%</td></tr><tr><td>p1</td><td colspan="8">Top-p + X-decay</td></tr><tr><td>0.910.9</td><td>41.1%</td><td>10.8%</td><td>0.43</td><td>30.7%</td><td>45.7%</td><td>6.8%</td><td>0.47</td><td>34.5%</td></tr><tr><td>0.910.5</td><td>39.9%</td><td>13.0%</td><td>0.08</td><td>33.1%</td><td>44.9%</td><td>9.1%</td><td>0.09</td><td>35.9%</td></tr><tr><td>p1入</td><td colspan="8">Top-p + X-decay + p-reset</td></tr><tr><td>0.910.9</td><td>41.5%</td><td>10.3%</td><td>0.52</td><td>10.3%</td><td>45.4%</td><td>6.3%</td><td>0.57</td><td>9.1%</td></tr><tr><td>0.910.5</td><td>39.3%</td><td>12.8%</td><td>0.34</td><td>17.8%</td><td>44.5%</td><td>8.4%</td><td>0.45</td><td>18.9%</td></tr><tr><td>pl入lw</td><td></td><td></td><td></td><td></td><td>(factual-nucleus sampling)</td><td></td><td></td><td></td></tr><tr><td></td><td colspan="8"> Top-p + X-decay + p-reset + w-bound</td></tr><tr><td>0.910.910.7</td><td>46.2%</td><td>5.0%</td><td>0.78</td><td>1.2%</td><td>52.2%</td><td>3.2%</td><td>0.80</td><td>0.5%</td></tr><tr><td>0.9 10.9 10.3</td><td>42.1%</td><td>10.1%</td><td>0.55</td><td>7.1%</td><td>46.5%</td><td>5.6%</td><td>0.59</td><td>6.4%</td></tr><tr><td>0.910.9 10.2</td><td>41.7%</td><td>9.9%</td><td>0.52</td><td>8.6%</td><td>45.6%</td><td>6.2%</td><td>0.56</td><td>7.6%</td></tr><tr><td>0.9 10.510.3</td><td>41.0%</td><td>12.2%</td><td>0.47</td><td>13.0%</td><td>46.0%</td><td>7.0%</td><td>0.51</td><td>12.7%</td></tr><tr><td>0.910.510.2</td><td>39.3%</td><td>12.8%</td><td>0.38</td><td>16.1%</td><td>45.2%</td><td>7.8%</td><td>0.42</td><td>16.9%</td></tr></table>
|
| 110 |
+
|
| 111 |
+
• Named Entity Mix-up: Mixing up similar types of the named entity. For example, LM generated “The movie is based on the novel of the same name by Gayle Forman.” about a film called “The Best of Me”. However, the correct author’s name is “Nicholas Sparks”, not “Gayle Forman”. Note that Gayle Forman is also an American young adult fiction author who writes similar type of novels as Nicholas Sparks.
|
| 112 |
+
|
| 113 |
+
• Fabricated Fact: Fabricating some random facts. For example, “Samuel Witwer’s father is a Lutheran minister.” Note that, the pretraining corpus contains non-factual or fictional information, which can also contribute to such fabricated facts.
|
| 114 |
+
|
| 115 |
+
Both error types can be viewed as wrong associations of entities that appear at different parts of the training corpus with similar context. Such behavior is unsurprising because these LMs are uniformly trained with the next subword prediction objective instead of a fact-related objective.
|
| 116 |
+
|
| 117 |
+

|
| 118 |
+
Figure 2: Comparison between nucleus sampling (blue line) and factual-nucleus sampling (orange line). The $\mathbf { X }$ -axis is named entity error $\Nu \mathrm { E } _ { \mathrm { E R } }$ . The y-axes are diversity and repetition in (a) and (b) respectively. The lower the repetition, the better. It is evident that factual-nucleus sampling has better trade-offs between factuality and diversity/repetition. For a reference, the diversity score of randomly sampled 5000 Wikipedia documents is 0.767.
|
| 119 |
+
|
| 120 |
+
# 5 Factual-Nucleus Sampling
|
| 121 |
+
|
| 122 |
+
In this section, we propose a new sampling algorithm that achieves a better trade-off between generation quality and factuality than existing decoding algorithms.
|
| 123 |
+
|
| 124 |
+
# 5.1 Method
|
| 125 |
+
|
| 126 |
+
We hypothesize that the randomness of sampling is more harmful to factuality when it is used to generate the latter part of a sentence than the beginning of a sentence. There is no preceding text at the start of a sentence, so it is safe for LM to generate anything as long as it is grammatical and contextual. However, as the generation proceeds, the premise become more determined, and fewer word choices can make the sentence factual. Given the example “Samuel Witwer’s father is a Lutheran minister”, the beginning of the sentence “Samuel Witwer’s father is” is not nonfactual. However, the continuation of “Lutheran minister” makes the sentence nonfactual. Therefore, we introduce the factual-nucleus sampling algorithm that dynamically adapts the “nucleus” $p$ along the generation of each sentence. In factual-nucleus sampling, the nucleus probability $p _ { t }$ to generate the $t$ -th token within each sentence is,
|
| 127 |
+
|
| 128 |
+
$$
|
| 129 |
+
p _ { t } = \operatorname* { m a x } \{ \omega , p \times \lambda ^ { t - 1 } \} ,
|
| 130 |
+
$$
|
| 131 |
+
|
| 132 |
+
where $\lambda$ is the decay factor for top- $p$ probability, and $\omega$ lower bounds the decay of probability. Specifically, it has the following parts:
|
| 133 |
+
|
| 134 |
+
• $\lambda$ -decay: Given that top- $p$ sampling pool is selected as a set of subwords whose cumulative probability exceeds $p$ , we gradually decay the $p$ value with decay factor $\lambda$ at each generation step to reduce the “randomness” through time.
|
| 135 |
+
• $p$ -reset: The nucleus probability $p$ can quickly decay to a small value after a long generation. So, we reset the $p$ -value to the default value at the beginning of every new sentence in the generation (we identify the beginning of a new sentence by checking if the previous step has generated a full-stop). This reduces the unnecessary cost of diversity for any long generations.
|
| 136 |
+
• $\omega$ -bound: If $\lambda$ -decay is applied alone, the $p$ -value could become too small to be equivalent to greedy decoding and hurt diversity. To overcome this, we introduce a lower-bound $\omega$ to limit how far $p$ -value can be decayed.
|
| 137 |
+
|
| 138 |
+
We will show the importance of each parts with ablation studies.
|
| 139 |
+
|
| 140 |
+
# 5.2 Result
|
| 141 |
+
|
| 142 |
+
We report our decoding experimental results with $1 . 3 \mathrm { B } \mathrm { L M } ^ { 7 }$ in Table 4. Additions of $\lambda$ -decay helps improve top- $p \ : 0 . 9$ factuality results – for instance, with decay rate $\lambda = 0 . 5$ , there is $12 . 5 \%$ drop in $\mathrm { N E } _ { \mathrm { E R } }$ and $1 0 . 1 \%$ gain in EntailR. However, this affects the diversity and repetition to become similar to greedy decoding. $p$ -reset mitigates the repetition issue and improves diversity metric without losing much in factuality metric. The effect is more drastic for the $\lambda = 0 . 5$ option, where it achieves 0.26 gains in diversity metric with negligible changes in factuality scores. By also adding $\omega$ -bound, we obtain the anticipated factuality performance (i.e., similar to greedy decoding), with great improvement in generation quality over greedy; with $p { = } 0 . 9$ , $\lambda { = } 0 . 9$ , $\omega { = } 0 . 3$ , we achieve $\times 1 1$ improvement in diversity and $\times 4 . 6$ improvement in repetition over greedy. Although our factualnucleus sampling still under-performs top- $p 0 . 9$ in terms of diversity, we believe this is an acceptable trade-off to improve the factuality of LM for factually sensitive open-ended generation tasks. Our proposed decoding does not harm the sentence fluency; its perplexity do not exceed the perplexity of top-p. Refer to Appendix F for full perplexity results.
|
| 143 |
+
|
| 144 |
+
To further illustrate the underlying trade-off, we also compare the proposed factual-nucleus sampling against the nucleus sampling with lower $p$ values that are also expected to have lower randomness, thus less factual error, in generations. Specifically, we plotted results for nucleus sampling with $p = \{ 0 . 9 , 0 . 7 , 0 . 6 , 0 . 5 , 0 . 4 , \mathrm { { 0 . 3 } } \}$ , and factual nucleus sampling with the following $p \mid \lambda \mid \bar { \omega }$ choices: 0.9|0.9|0.7, 0.9|0.9|0.5, 0.9|0.9|0.4, 0.9|0.9|0.3, 0.9|0.7|0.3. The Fig 2a and $\mathrm { F i g 2 b }$ respectively show that the factual nucleus sampling method has better trade-offs than top- $p$ in factuality-vs-diversity and factuality-vs-repetition. In other words, it always achieves better factuality score with the same level of diversity and repetition scores.
|
| 145 |
+
|
| 146 |
+
# 6 Factuality-Enhanced Continued Training
|
| 147 |
+
|
| 148 |
+
This section introduces factuality-enhanced method for continued training of LMs [30]. We introduce the TOPICPREFIX for better awareness of facts and the sentence completion loss as training objective.
|
| 149 |
+
|
| 150 |
+
# 6.1 Prepending TOPICPREFIX
|
| 151 |
+
|
| 152 |
+
Unstructured factual knowledge typically exists at a document level (i.e., a group of factual sentences about an entity). This means that sentences can contain pronouns (e.g., she, he, it), making these sentences factually useless standalone. To illustrate with an example from Barack Obama’s Wikipedia page, “He previously served as a U.S. senator from Illinois from 2005 to $2 0 0 8 '$ cannot be a useful standalone fact because it is unclear who “He” is. Due to the GPU memory limit and computation efficiency, it is common to chunk documents in LM training corpus. This causes the “fragmentation” of information and leads to wrong associations of entities that appear in independent documents with similar contexts. As a remedy, we propose to prepend TOPICPREFIX to sentences in the factual documents to make each sentence serve as a standalone fact. In our experiments, we mainly utilize Wikipedia as the factual corpus and the Wikipedia document name as the TOPICPREFIX.
|
| 153 |
+
|
| 154 |
+
# 6.2 Sentence Completion Loss
|
| 155 |
+
|
| 156 |
+
We propose a sentence completion loss to address the incorrect association learned between entities. To explain our rationale, let us recall the nonfactual example from $\ S 5$ : “Samuel Witwer’s father is a Lutheran minister”. This sentence is nonfactual because LM failed to generate factually correct information after “is”. In other words, LM failed to accurately complete the sentence given the generated context. One reason is that the LM is uniformly trained to predict each subword token within the sentence, when ensuring the correct prediction at the latter section of sentence is more critical for factuality. Therefore, we construct a sentence completion loss, which makes the LM focus on predicting the subwords later in the sentence. For implementation, we determine a pivot $t$ for each sentence, and then apply zero-masking for all token prediction losses before $t$ . This pivot is only required during training (i.e., no pivot needed during inference time).
|
| 157 |
+
|
| 158 |
+
We emphasize that this loss masking is different from the input token masking applied in BERT [73] or BART [76], and the LM is still trained in an autoregressive manner. Note that many BART-based summarization models are known to still suffer from factual errors, suggesting that masked prediction at the encoder level may not effectively transfer well to autoregressive text generation.
|
| 159 |
+
|
| 160 |
+
In this work, we explore three strategies (from simple to complex) to determine the pivot $t$
|
| 161 |
+
|
| 162 |
+
• $S C _ { \mathrm { H A L F } }$ : pivot $t = 0 . 5 \times$ sentence-length.
|
| 163 |
+
• $S C _ { \mathrm { R A N D O M } }$ : random pivot, e.g., $t \sim$ uniform $[ 0 . 2 5 , 0 . 7 5 ] \times$ sentence-length.
|
| 164 |
+
• $S C _ { \mathrm { { R O O T } } }$ : pivot $t =$ position of ROOT (relation) from dependency parsing.
|
| 165 |
+
|
| 166 |
+
Our experiments show that the simplest $S C _ { \mathrm { H A L F } }$ performs on par with the complex ones (such as $S C _ { \mathrm { R O O T } } )$ ), thus, we suggest future work to choose $S C _ { \mathrm { H A L F } }$ strategy.
|
| 167 |
+
|
| 168 |
+
# 6.3 Results
|
| 169 |
+
|
| 170 |
+
The results are reported in Table 5, and experimental setups are reported in Appendix C.
|
| 171 |
+
|
| 172 |
+
Inefficiency of Domain Adaptive Training The pre-training corpus of LM contains both factual texts (e.g., Wikipedia) and potentially nonfactual texts (e.g., rumors, fake news) 8. The nonfactual domain of the training corpus could be the problem. Thus, we conduct a baseline experiment that does domain-adaptive training with strictly factual domain text only (i.e., Wikipedia). Interestingly, we find that domain-adaptive training can hardly improve generation factuality.
|
| 173 |
+
|
| 174 |
+
Effect of TOPICPREFIX Continued pre-training of 1.3B LM with TOPICPREFIX preprocessed Wikipedia alone can already improve the factuality, especially in terms of $\mathrm { N E } _ { \mathrm { E R } }$ . For example, it reduces the $\mathrm { N E _ { E R } f r o m 4 2 . 1 \% }$ to $2 7 . 6 \%$ when we use the factual-nucleus decoding $( 0 . 9 \mid 0 . 9 \mid 0 . 3 )$ , which even outperforms the 1.3B with greedy decoding $( \mathrm { N E } _ { \mathrm { E R } } \colon 2 7 . 6 \%$ vs. $3 9 . 9 \%$ ) with much less repetition $( 8 . 0 \%$ vs. $3 3 . 1 \%$ ).
|
| 175 |
+
|
| 176 |
+
Effect of Sentence Completion Loss The proposed sentence completion loss further helps to improve the factuality, especially for the EntailR. For example, when one uses factual-nucleus decoding on trained 1.3B model, TOPICPREFIX $+ \ S C _ { \mathrm { H A L F } }$ can further improve EntailR from $8 . 7 \%$ to $1 7 . 4 \%$ than TOPICPREFIX alone, while reducing $\Nu \mathrm { E } _ { \mathrm { E R } }$ from $2 7 . 6 \%$ to $2 3 . 6 \%$ . Note that the results show consistent improvement across different pivot selection strategies, suggesting that the sentence completion loss is robust. In particular, the simplest $S C _ { \mathrm { H A L F } }$ performs as good as others or even better in terms of several metrics. Thus we recommend it as the default option.
|
| 177 |
+
|
| 178 |
+
Table 5: Results for factuality enhanced training. The decoding settings are formatted as: nucleus probability $p$ decay rate $\lambda$ , lower-bound $\omega$ .
|
| 179 |
+
|
| 180 |
+
<table><tr><td rowspan="2">Decoding (plλlw)</td><td colspan="4">Factual Prompt</td><td colspan="4">Nonfactual Prompt</td></tr><tr><td>NEER↓</td><td>EntailR↑</td><td>Div.</td><td>Rep.</td><td>NEER</td><td>EntailR</td><td>Div.</td><td>Rep.</td></tr><tr><td colspan="9">Vanilla Pretrained LM (1.3B)</td></tr><tr><td>0.9</td><td>52.4%</td><td>2.9%</td><td>0.88</td><td>0.2%</td><td>56.8%</td><td>2.0%</td><td>0.89</td><td>0.3%</td></tr><tr><td>0.9 10.910.3</td><td>42.1%</td><td>10.1%</td><td>0.55</td><td>7.1%</td><td>46.5%</td><td>5.6%</td><td>0.59</td><td>6.4%</td></tr><tr><td colspan="9">Factual Domain-Adaptive Training with Wikipedia (1.3B)</td></tr><tr><td>0.9</td><td>52.5%</td><td>2.8%</td><td>0.85</td><td>0.2%</td><td>55.8%</td><td>2.2%</td><td>0.86</td><td>0.1%</td></tr><tr><td>0.910.9 10.3</td><td>42.7%</td><td>7.1%</td><td>0.51</td><td>7.2%</td><td>48.2%</td><td>4.9%</td><td>0.56</td><td>6.0%</td></tr><tr><td colspan="9">TOPICPREFIX (1.3B)</td></tr><tr><td>0.9 0.910.910.3</td><td>34.4%</td><td>4.2%</td><td>0.84</td><td>0.3%</td><td>36.2%</td><td>2.7%</td><td>0.85</td><td>0.2%</td></tr><tr><td></td><td>27.6%</td><td>8.7%</td><td>0.43</td><td>8.0%</td><td>30.5%</td><td>6.1%</td><td>0.47</td><td>6.9%</td></tr><tr><td colspan="9">TOPICPREFIX + SCROOT (1.3B)</td></tr><tr><td>0.9 0.9 10.9 10.3</td><td>32.5% 24.7%</td><td>6.7% 15.8%</td><td>0.83 0.40</td><td>1.2% 13.6%</td><td>34.3% 27.6%</td><td>4.6% 9.1%</td><td>0.84 0.44</td><td>1.1% 13.7%</td></tr><tr><td colspan="9">TOPICPREFIX+ SCRANDOM (1.3B)</td></tr><tr><td>0.9 0.9 10.9 10.3</td><td>32.0% 23.6%</td><td>7.9% 17.6%</td><td>0.81 0.39</td><td>1.2% 14.2%</td><td>34.2% 26.9%</td><td>5.5% 9.3%</td><td>0.83 0.42</td><td>1.1% 13.2%</td></tr><tr><td colspan="9">TOPICPREFIX + SCHALF</td></tr><tr><td>0.9</td><td>31.6%</td><td>7.6% 17.4%</td><td>0.81 0.38</td><td>1.4% 14.4%</td><td>33.5% 27.2%</td><td>5.1% 10.2%</td><td>0.83 0.42</td><td>1.5% 13.1%</td></tr><tr><td colspan="9">0.9 10.9 10.3 23.6% Vanilla Pretrained LM (530B)</td></tr><tr><td>0.9</td><td>33.3%</td><td>11.8%</td><td>0.90</td><td>0.1%</td><td>40.5%</td><td>7.25%</td><td>0.92</td><td>0.1%</td></tr><tr><td colspan="9">TOPICPREFIX + SCHALF (530B)</td></tr><tr><td>0.9 0.9 10.9 10.3</td><td>18.3% 14.5%</td><td>19.3% 25.5%</td><td>0.68 0.33</td><td>0.1% 0.2%</td><td>21.7% 17.7%</td><td>13.7% 20.0%</td><td>0.68</td><td>0.1%</td></tr></table>
|
| 181 |
+
|
| 182 |
+
530B vs 1.3B As expected, our method on 530B LM further reduces the factual errors and achieves the lowest $\Nu \mathrm { E } _ { \mathrm { E R } }$ $( 1 4 . 5 \% )$ and the highest EntailR $( 2 5 . 5 \% )$ . Surprisingly, our method on 530B LM lead to less diverse generation than 1.3B LM despite the significant improvement in the generation quality (i.e., near perfect repetition scores $0 . 1 \% 0 . 2 \%$ . We conjecture that this is the trade-off between the factuality and diversity for 530B LM.
|
| 183 |
+
|
| 184 |
+
# 7 Conclusion
|
| 185 |
+
|
| 186 |
+
In this work, we establish a benchmark to measure and analyze factuality in open-ended text generation tasks. We propose factual-nucleus sampling that improves generation factuality at inference time, and the combination of sentence completion loss and TOPICPREFIX pre-processing that improves factuality with continued training. We demonstrate that our methods are effective in improving the factuality. Lastly, our results shed light on the existence of the trade-off between diversity and factuality. We strongly believe this is an important insight that will help researchers make a better-informed decision about their model design - i.e., appropriately prioritize the desirable attribute of their LM (factuality vs. diversity) according to the final goal of their task. Potential future work would be to reduce the degree of the observed trade-offs.
|
| 187 |
+
|
| 188 |
+
References
|
| 189 |
+
[1] Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. Language models are unsupervised multitask learners. OpenAI blog, 2019.
|
| 190 |
+
[2] 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. JMLR, 2019.
|
| 191 |
+
[3] 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.
|
| 192 |
+
[4] 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.
|
| 193 |
+
[5] Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. In ACL, 2016.
|
| 194 |
+
[6] Jack W Rae, Sebastian Borgeaud, Trevor Cai, Katie Millican, Jordan Hoffmann, Francis Song, John Aslanides, Sarah Henderson, Roman Ring, Susannah Young, et al. Scaling language models: Methods, analysis & insights from training gopher. arXiv preprint arXiv:2112.11446, 2021.
|
| 195 |
+
[7] Reiichiro Nakano, Jacob Hilton, Suchir Balaji, Jeff Wu, Long Ouyang, Christina Kim, Christopher Hesse, Shantanu Jain, Vineet Kosaraju, William Saunders, et al. WebGPT: Browser-assisted question-answering with human feedback. arXiv preprint arXiv:2112.09332, 2021.
|
| 196 |
+
[8] 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.
|
| 197 |
+
[9] Rowan Zellers, Ari Holtzman, Hannah Rashkin, Yonatan Bisk, Ali Farhadi, Franziska Roesner, and Yejin Choi. Defending against neural fake news. In NeurIPS, 2019.
|
| 198 |
+
[10] Romal Thoppilan, Daniel De Freitas, Jamie Hall, Noam Shazeer, Apoorv Kulshreshtha, Heng-Tze Cheng, Alicia Jin, Taylor Bos, Leslie Baker, Yu Du, et al. LaMDA: Language models for dialog applications. arXiv preprint arXiv:2201.08239, 2022.
|
| 199 |
+
[11] Ziwei Ji, Nayeon Lee, Rita Frieske, Tiezheng Yu, Dan Su, Yan Xu, Etsuko Ishii, Yejin Bang, Andrea Madotto, and Pascale Fung. Survey of hallucination in natural language generation. arXiv preprint arXiv:2202.03629, 2022.
|
| 200 |
+
[12] Wojciech Krysci ´ nski, Bryan McCann, Caiming Xiong, and Richard Socher. Evaluating the factual ´ consistency of abstractive text summarization. In EMNLP, 2019.
|
| 201 |
+
[13] Joshua Maynez, Shashi Narayan, Bernd Bohnet, and Ryan McDonald. On faithfulness and factuality in abstractive summarization. In ACL, 2020.
|
| 202 |
+
[14] Esin Durmus, He He, and Mona Diab. FEQA: A question answering evaluation framework for faithfulness assessment in abstractive summarization. In ACL, 2020.
|
| 203 |
+
[15] Feng Nan, Cicero Nogueira dos Santos, Henghui Zhu, Patrick Ng, Kathleen McKeown, Ramesh Nallapati, Dejiao Zhang, Zhiguo Wang, Andrew O Arnold, and Bing Xiang. Improving factual consistency of abstractive summarization via question answering. In ACL-IJCNLP, 2021.
|
| 204 |
+
[16] Jun Yin, Xin Jiang, Zhengdong Lu, Lifeng Shang, Hang Li, and Xiaoming Li. Neural generative question answering. In IJCAI, 2016.
|
| 205 |
+
[17] Adam Roberts, Colin Raffel, and Noam Shazeer. How much knowledge can you pack into the parameters of a language model? arXiv preprint arXiv:2002.08910, 2020.
|
| 206 |
+
[18] Dan Su, Xiaoguang Li, Jindi Zhang, Lifeng Shang, Xin Jiang, Qun Liu, and Pascale Fung. Read before generate! faithful long form question answering with machine reading. In Findings in ACL, 2022.
|
| 207 |
+
[19] Amit Moryossef, Yoav Goldberg, and Ido Dagan. Step-by-step: Separating planning from realization in neural data-to-text generation. arXiv preprint arXiv:1904.03396, 2019.
|
| 208 |
+
[20] Tianyu Liu, Xin Zheng, Baobao Chang, and Zhifang Sui. Towards faithfulness in open domain table-to-text generation from an entity-centric view. In AAAI, 2021.
|
| 209 |
+
[21] Wenhao Yu, Chenguang Zhu, Zaitang Li, Zhiting Hu, Qingyun Wang, Heng Ji, and Meng Jiang. A survey of knowledge-enhanced text generation. arXiv preprint arXiv:2010.04389, 2020.
|
| 210 |
+
[22] Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Dmytro Okhonko, Samuel Broscheit, Gautier Izacard, Patrick Lewis, Barlas Oguz, Edouard Grave, Wen-tau Yih, et al. The web is your oyster–knowledge- ˘ intensive nlp against a very large web corpus. arXiv preprint arXiv:2112.09924, 2021.
|
| 211 |
+
[23] Peter West, Chris Quirk, Michel Galley, and Yejin Choi. Probing factually grounded content transfer with factual ablation. arXiv preprint arXiv:2203.10133, 2022.
|
| 212 |
+
[24] Sungjin Ahn, Heeyoul Choi, Tanel Pärnamaa, and Yoshua Bengio. A neural knowledge language model. arXiv preprint arXiv:1608.00318, 2016.
|
| 213 |
+
[25] Robert L Logan IV, Nelson F Liu, Matthew E Peters, Matt Gardner, and Sameer Singh. Barack’s wife hillary: Using knowledge-graphs for fact-aware language modeling. In ACL, 2019.
|
| 214 |
+
[26] Sebastian Borgeaud, Arthur Mensch, Jordan Hoffmann, Trevor Cai, Eliza Rutherford, Katie Millican, George van den Driessche, Jean-Baptiste Lespiau, Bogdan Damoc, Aidan Clark, et al. Improving language models by retrieving from trillions of tokens. arXiv preprint arXiv:2112.04426, 2021.
|
| 215 |
+
[27] Fabio Petroni, Aleksandra Piktus, Angela Fan, Patrick Lewis, Majid Yazdani, Nicola De Cao, James Thorne, Yacine Jernite, Vladimir Karpukhin, Jean Maillard, et al. Kilt: a benchmark for knowledge intensive language tasks. arXiv preprint arXiv:2009.02252, 2020.
|
| 216 |
+
[28] Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Ming-Wei Chang. Realm: Retrievalaugmented language model pre-training. arXiv preprint arXiv:2002.08909, 2020.
|
| 217 |
+
[29] Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. The curious case of neural text degeneration. In ICLR, 2020.
|
| 218 |
+
[30] Suchin Gururangan, Ana Marasovic, Swabha Swayamdipta, Kyle Lo, Iz Beltagy, Doug Downey, and ´ Noah A Smith. Don’t stop pretraining: adapt language models to domains and tasks. In ACL, 2020.
|
| 219 |
+
[31] Stephanie Lin, Jacob Hilton, and Owain Evans. TruthfulQA: Measuring how models mimic human falsehoods. In ACL, 2022.
|
| 220 |
+
[32] David R Krathwohl. A revision of bloom’s taxonomy: An overview. Theory into practice, 41(4):212–218, 2002.
|
| 221 |
+
[33] Fabio Petroni, Tim Rocktäschel, Patrick Lewis, Anton Bakhtin, Yuxiang Wu, Alexander H Miller, and Sebastian Riedel. Language models as knowledge bases? In EMNLP, 2019.
|
| 222 |
+
[34] Carlos Aspillaga, Marcelo Mendoza, and Alvaro Soto. Inspecting the concept knowledge graph encoded by modern language models. In Findings of ACL, 2021.
|
| 223 |
+
[35] Xuhui Zhou, Yue Zhang, Leyang Cui, and Dandan Huang. Evaluating commonsense in pre-trained language models. In AAAI, 2020.
|
| 224 |
+
[36] Zhengbao Jiang, Frank F Xu, Jun Araki, and Graham Neubig. How can we know what language models know? Transactions of the Association for Computational Linguistics, 2020.
|
| 225 |
+
[37] Zexuan Zhong, Dan Friedman, and Danqi Chen. Factual probing is [mask]: Learning vs. learning to recall. arXiv preprint arXiv:2104.05240, 2021.
|
| 226 |
+
[38] Yanai Elazar, Nora Kassner, Shauli Ravfogel, Abhilasha Ravichander, Eduard Hovy, Hinrich Schütze, and Yoav Goldberg. Measuring and improving consistency in pretrained language models. Transactions of the Association for Computational Linguistics, 9:1012–1031, 2021.
|
| 227 |
+
[39] Nicola De Cao, Wilker Aziz, and Ivan Titov. Editing factual knowledge in language models. In EMNLP, 2021.
|
| 228 |
+
[40] Joel Jang, Seonghyeon Ye, Sohee Yang, Joongbo Shin, Janghoon Han, Gyeonghun Kim, Stanley Jungkyu Choi, and Minjoon Seo. Towards continual knowledge learning of language models. arXiv preprint arXiv:2110.03215, 2021.
|
| 229 |
+
[41] Kevin Meng, David Bau, Alex Andonian, and Yonatan Belinkov. Locating and editing factual knowledge in GPT. arXiv preprint arXiv:2202.05262, 2022.
|
| 230 |
+
|
| 231 |
+
[42] Ziqiang Cao, Furu Wei, Wenjie Li, and Sujian Li. Faithful to the original: Fact aware neural abstractive summarization. In Proceedings of the AAAI Conference on Artificial Intelligence, 2018.
|
| 232 |
+
|
| 233 |
+
[43] Yue Dong, Shuohang Wang, Zhe Gan, Yu Cheng, Jackie Chi Kit Cheung, and Jingjing Liu. Multi-fact correction in abstractive text summarization. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, pages 9320–9331, 2020.
|
| 234 |
+
|
| 235 |
+
[44] Luyang Huang, Lingfei Wu, and Lu Wang. Knowledge graph-augmented abstractive summarization with semantic-driven cloze reward. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, 2020.
|
| 236 |
+
|
| 237 |
+
[45] Yichong Huang, Xiachong Feng, Xiaocheng Feng, and Bing Qin. The factual inconsistency problem in abstractive text summarization: A survey. arXiv preprint arXiv:2104.14839, 2021.
|
| 238 |
+
|
| 239 |
+
[46] Shuyang Cao and Lu Wang. Cliff: Contrastive learning for improving faithfulness and factuality in abstractive summarization. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 6633–6649, 2021.
|
| 240 |
+
|
| 241 |
+
[47] Chenguang Zhu, William Hinthorn, Ruochen Xu, Qingkai Zeng, Michael Zeng, Xuedong Huang, and Meng Jiang. Enhancing factual consistency of abstractive summarization. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 718–733, 2021.
|
| 242 |
+
|
| 243 |
+
[48] Sihao Chen, Fan Zhang, Kazoo Sone, and Dan Roth. Improving faithfulness in abstractive summarization with contrast candidate generation and selection. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 5935–5941, 2021.
|
| 244 |
+
|
| 245 |
+
[49] Sam Wiseman, Stuart Shieber, and Alexander Rush. Challenges in data-to-document generation. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 2253–2263. ACL, 2017.
|
| 246 |
+
|
| 247 |
+
[50] Feng Nie, Jin-Ge Yao, Jinpeng Wang, Rong Pan, and Chin-Yew Lin. A simple recipe towards reducing hallucination in neural surface realisation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 2673–2679. ACL, 2019.
|
| 248 |
+
|
| 249 |
+
[51] Yixuan Su, David Vandyke, Sihui Wang, Yimai Fang, and Nigel Collier. Plan-then-generate: Controlled data-to-text generation via planning. Findings of EMNLP, 2021.
|
| 250 |
+
|
| 251 |
+
[52] Peng Wang, Junyang Lin, An Yang, Chang Zhou, Yichang Zhang, Jingren Zhou, and Hongxia Yang. Sketch and refine: Towards faithful and informative table-to-text generation. ACL, 2021.
|
| 252 |
+
|
| 253 |
+
[53] Clément Rebuffel, Marco Roberti, Laure Soulier, Geoffrey Scoutheeten, Rossella Cancelliere, and Patrick Gallinari. Controlling hallucinations at word level in data-to-text generation. Data Mining and Knowledge Discovery, pages 318–354, 2022.
|
| 254 |
+
|
| 255 |
+
[54] Lei Shen, Haolan Zhan, Xin Shen, Hongshen Chen, Xiaofang Zhao, and Xiaodan Zhu. Identifying untrustworthy samples: Data filtering for open-domain dialogues with bayesian optimization. In Proceedings of the 30th ACM International Conference on Information & Knowledge Management, pages 1598–1608, 2021.
|
| 256 |
+
|
| 257 |
+
[55] Kurt Shuster, Spencer Poff, Moya Chen, Douwe Kiela, and Jason Weston. Retrieval augmentation reduces hallucination in conversation. In Findings of the Association for Computational Linguistics: EMNLP 2021. ACL, 2021.
|
| 258 |
+
|
| 259 |
+
[56] Hannah Rashkin, David Reitter, Gaurav Singh Tomar, and Dipanjan Das. Increasing faithfulness in knowledge-grounded dialogue with controllable features. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing, pages 704–718. ACL, 2021.
|
| 260 |
+
|
| 261 |
+
[57] Zeqiu Wu, Michel Galley, Chris Brockett, Yizhe Zhang, Xiang Gao, Chris Quirk, Rik Koncel-Kedziorski, Jianfeng Gao, Hannaneh Hajishirzi, Mari Ostendorf, et al. A controllable model of grounded response generation. In Proceedings of the AAAI Conference on Artificial Intelligence, pages 14085–14093, 2021.
|
| 262 |
+
|
| 263 |
+
[58] Nouha Dziri, Andrea Madotto, Osmar Zaiane, and Avishek Joey Bose. Neural path hunter: Reducing hallucination in dialogue systems via path grounding. EMNLP, 2021.
|
| 264 |
+
|
| 265 |
+
[59] 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.
|
| 266 |
+
|
| 267 |
+
[60] Krishna Pillutla, Swabha Swayamdipta, Rowan Zellers, John Thickstun, Sean Welleck, Yejin Choi, and Zaid Harchaoui. MAUVE: Measuring the gap between neural text and human text using divergence frontiers. In NeurIPS, 2021.
|
| 268 |
+
|
| 269 |
+
[61] Samuel Gehman, Suchin Gururangan, Maarten Sap, Yejin Choi, and Noah A Smith. Realtoxicityprompts: Evaluating neural toxic degeneration in language models. In Findings in EMNLP, 2020.
|
| 270 |
+
|
| 271 |
+
[62] Nils Reimers and Iryna Gurevych. Sentence-bert: Sentence embeddings using siamese bert-networks. arXiv preprint arXiv:1908.10084, 2019.
|
| 272 |
+
|
| 273 |
+
[63] Ben Goodrich, Vinay Rao, Peter J Liu, and Mohammad Saleh. Assessing the factual accuracy of generated text. In ACM SIGKDD, 2019.
|
| 274 |
+
|
| 275 |
+
[64] Feng Nan, Ramesh Nallapati, Zhiguo Wang, Cicero Nogueira dos Santos, Henghui Zhu, Dejiao Zhang, Kathleen McKeown, and Bing Xiang. Entity-level factual consistency of abstractive text summarization. In EACL, 2021.
|
| 276 |
+
|
| 277 |
+
[65] Bill MacCartney and Christopher D. Manning. Modeling semantic containment and exclusion in natural language inference. In Proceedings of the 22nd International Conference on Computational Linguistics (Coling 2008), pages 521–528, Manchester, UK, August 2008. Coling 2008 Organizing Committee. URL https://aclanthology.org/C08-1066.
|
| 278 |
+
|
| 279 |
+
[66] Tobias Falke, Leonardo FR Ribeiro, Prasetya Ajie Utama, Ido Dagan, and Iryna Gurevych. Ranking generated summaries by correctness: An interesting but challenging application for natural language inference. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 2214–2220, 2019.
|
| 280 |
+
|
| 281 |
+
[67] Ondˇrej Dušek and Zdenek Kasner. Evaluating semantic accuracy of data-to-text generation with natural ˇ language inference. arXiv preprint arXiv:2011.10819, 2020.
|
| 282 |
+
|
| 283 |
+
[68] Nouha Dziri, Hannah Rashkin, Tal Linzen, and David Reitter. Evaluating groundedness in dialogue systems: The begin benchmark. arXiv preprint arXiv:2105.00071, 2021.
|
| 284 |
+
|
| 285 |
+
[69] Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019.
|
| 286 |
+
|
| 287 |
+
[70] Adina Williams, Nikita Nangia, and Samuel Bowman. A broad-coverage challenge corpus for sentence understanding through inference. In NAACL, 2018.
|
| 288 |
+
|
| 289 |
+
[71] Jiwei Li, Michel Galley, Chris Brockett, Jianfeng Gao, and Bill Dolan. A diversity-promoting objective function for neural conversation models. In NAACL, 2016.
|
| 290 |
+
|
| 291 |
+
[72] Zhihong Shao, Minlie Huang, Jiangtao Wen, Wenfei Xu, and Xiaoyan Zhu. Long and diverse text generation with planning-based hierarchical variational model. arXiv preprint arXiv:1908.06605, 2019.
|
| 292 |
+
|
| 293 |
+
[73] 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.
|
| 294 |
+
|
| 295 |
+
[74] Boxin Wang, Wei Ping, Chaowei Xiao, Peng Xu, Mostofa Patwary, Mohammad Shoeybi, Bo Li, Anima Anandkumar, and Bryan Catanzaro. Exploring the limits of domain-adaptive training for detoxifying large-scale language models. In NeurIPS, 2022.
|
| 296 |
+
|
| 297 |
+
[75] Eric Wallace, Shi Feng, Nikhil Kandpal, Matt Gardner, and Sameer Singh. Universal adversarial triggers for attacking and analyzing nlp. In EMNLP, 2019.
|
| 298 |
+
|
| 299 |
+
[76] Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov, and Luke Zettlemoyer. Bart: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. arXiv preprint arXiv:1910.13461, 2019.
|
| 300 |
+
|
| 301 |
+
[77] Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper, and Bryan Catanzaro. Megatron-lm: Training multi-billion parameter language models using model parallelism. arXiv preprint arXiv:1909.08053, 2019.
|
| 302 |
+
|
| 303 |
+
[78] James Thorne, Andreas Vlachos, Christos Christodoulopoulos, and Arpit Mittal. FEVER: a large-scale dataset for fact extraction and verification. In NAACL, 2018.
|
md/dev/LzQQ89U1qm_/LzQQ89U1qm_.md
ADDED
|
@@ -0,0 +1,443 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ANOMALY TRANSFORMER: TIME SERIES ANOMALY DETECTION WITH ASSOCIATION DISCREPANCY
|
| 2 |
+
|
| 3 |
+
Jiehui Xu∗, Haixu Wu∗, Jianmin Wang, Mingsheng LongB School of Software, BNRist, Tsinghua University, Beijing 100084, China $\{ \mathbf { x } \mathrm { j h } 2 0 , \mathbf { w h } \mathbf { x } 2 0 \}$ @mails.tsinghua.edu.cn, {jimwang,mingsheng}@tsinghua.edu.cn
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Unsupervised detection of anomaly points in time series is a challenging problem, which requires the model to derive a distinguishable criterion. Previous methods tackle the problem mainly through learning pointwise representation or pairwise association, however, neither is sufficient to reason about the intricate dynamics. Recently, Transformers have shown great power in unified modeling of pointwise representation and pairwise association, and we find that the self-attention weight distribution of each time point can embody rich association with the whole series. Our key observation is that due to the rarity of anomalies, it is extremely difficult to build nontrivial associations from abnormal points to the whole series, thereby, the anomalies’ associations shall mainly concentrate on their adjacent time points. This adjacent-concentration bias implies an association-based criterion inherently distinguishable between normal and abnormal points, which we highlight through the Association Discrepancy. Technically, we propose the Anomaly Transformer with a new Anomaly-Attention mechanism to compute the association discrepancy. A minimax strategy is devised to amplify the normal-abnormal distinguishability of the association discrepancy. The Anomaly Transformer achieves state-of-theart results on six unsupervised time series anomaly detection benchmarks of three applications: service monitoring, space & earth exploration, and water treatment.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Real-world systems always work in a continuous way, which can generate several successive measurements monitored by multi-sensors, such as industrial equipment, space probe, etc. Discovering the malfunctions from large-scale system monitoring data can be reduced to detecting the abnormal time points from time series, which is quite meaningful for ensuring security and avoiding financial loss. But anomalies are usually rare and hidden by vast normal points, making the data labeling hard and expensive. Thus, we focus on time series anomaly detection under the unsupervised setting.
|
| 12 |
+
|
| 13 |
+
Unsupervised time series anomaly detection is extremely challenging in practice. The model should learn informative representations from complex temporal dynamics through unsupervised tasks. Still, it should also derive a distinguishable criterion that can detect the rare anomalies from plenty of normal time points. Various classic anomaly detection methods have provided many unsupervised paradigms, such as the density-estimation methods proposed in local outlier factor (LOF, (Breunig et al., 2000)), clustering-based methods presented in one-class SVM (OC-SVM, (Scholkopf et al., ¨ 2001)) and SVDD (Tax & Duin, 2004). These classic methods do not consider the temporal information and are difficult to generalize to unseen real scenarios. Benefiting from the representation learning capability of neural networks, recent deep models (Su et al., 2019; Shen et al., 2020; Li et al., 2021) have achieved superior performance. A major category of methods focus on learning pointwise representations through well-designed recurrent networks and are self-supervised by the reconstruction or autoregressive task. Here, a natural and practical anomaly criterion is the pointwise reconstruction or prediction error. However, due to the rarity of anomalies, the pointwise representation is less informative for complex temporal patterns and can be dominated by normal time points, making anomalies less distinguishable. Also, the reconstruction or prediction error is calculated point by point, which cannot provide a comprehensive description of the temporal context.
|
| 14 |
+
|
| 15 |
+
Another major category of methods detect anomalies based on explicit association modeling. The vector autoregression and state space models fall into this category. The graph was also used to capture the association explicitly, through representing time series with different time points as vertices and detecting anomalies by random walk (Cheng et al., 2008; 2009). In general, it is hard for these classic methods to learn informative representations and model fine-grained associations. Recently, graph neural network (GNN) has been applied to learn the dynamic graph among multiple variables in multivariate time series (Zhao et al., 2020; Deng & Hooi, 2021). While being more expressive, the learned graph is still limited to a single time point, which is insufficient for complex temporal patterns. Besides, subsequence-based methods detect anomalies by calculating the similarity among subsequences (Boniol & Palpanas, 2020). While exploring wider temporal context, these methods cannot capture the fine-grained temporal association between each time point and the whole series.
|
| 16 |
+
|
| 17 |
+
In this paper, we adapt Transfomers (Vaswani et al., 2017) to time series anomaly detection in the unsupervised regime. Transformers have achieved great progress in various areas, including natural language processing (Brown et al., 2020), machine vision (Liu et al., 2021) and time series (Zhou et al., 2021). This success is attributed to its great power in unified modeling of global representation and long-range relation. Applying Transformers to time series, we find that the temporal association of each time point can be obtained from the self-attention map, which presents as a distribution of its association weights to all the time points along the temporal dimension. The association distribution of each time point can provide a more informative description for the temporal context, indicating dynamic patterns, such as the period or trend of time series. We name the above association distribution as the series-association, which can be discovered from the raw series by Transformers.
|
| 18 |
+
|
| 19 |
+
Further, we observe that due to the rarity of anomalies and the dominance of normal patterns, it is harder for anomalies to build strong associations with the whole series. The associations of anomalies shall concentrate on the adjacent time points that are more likely to contain similar abnormal patterns due to the continuity. Such an adjacent-concentration inductive bias is referred to as the prior-association. In contrast, the dominating normal time points can discover informative associations with the whole series, not limiting to the adjacent area. Based on this observation, we try to utilize the inherent normal-abnormal distinguishability of the association distribution. This leads to a new anomaly criterion for each time point, quantified by the distance between each time point’s prior-association and its series-association, named as Association Discrepancy. As aforementioned, because the associations of anomalies are more likely to be adjacent-concentrating, anomalies will present a smaller association discrepancy than normal time points.
|
| 20 |
+
|
| 21 |
+
Going beyond previous methods, we introduce Transformers to unsupervised time series anomaly detection and propose the Anomaly Transformer for association learning. To compute the Association Discrepancy, we renovate the self-attention mechanism to the Anomaly-Attention, which contains a two-branch structure to model the prior-association and series-association of each time point respectively. The prior-association employs the learnable Gaussian kernel to present the adjacentconcentration inductive bias of each time point, while the series-association corresponds to the selfattention weights learned from raw series. Besides, a minimax strategy is applied between the two branches, which can amplify the normal-abnormal distinguishability of the Association Discrepancy and further derive a new association-based criterion. Anomaly Transformer achieves strong results on six benchmarks, covering three real applications. The contributions are summarized as follows:
|
| 22 |
+
|
| 23 |
+
• Based on the key observation of Association Discrepancy, we propose the Anomaly Transformer with an Anomaly-Attention mechanism, which can model the prior-association and series-association simultaneously to embody the Association Discrepancy. • We propose a minimax strategy to amplify the normal-abnormal distinguishability of the Association Discrepancy and further derive a new association-based detection criterion. • Anomaly Transformer achieves the state-of-the-art anomaly detection results on six benchmarks for three real applications, justified by extensive ablations and insightful case studies.
|
| 24 |
+
|
| 25 |
+
# 2 RELATED WORK
|
| 26 |
+
|
| 27 |
+
# 2.1 UNSUPERVISED TIME SERIES ANOMALY DETECTION
|
| 28 |
+
|
| 29 |
+
As an important real-world problem, unsupervised time series anomaly detection has been widely explored. Categorizing by the anomaly determination criterion, the paradigms roughly include the density-estimation, clustering-based, reconstruction-based and autoregression-based methods.
|
| 30 |
+
|
| 31 |
+
In density-estimation methods, the classic methods such as local outlier factor (LOF, (Breunig et al., 2000)) and connectivity outlier factor (COF, (Tang et al., 2002)) respectively calculate local density and local connectivity for outlier determination. DAGMM (Zong et al., 2018) and MPPCACD (Yairi et al., 2017) integrate the Gaussian Mixture Model to estimate the density of representations.
|
| 32 |
+
|
| 33 |
+
In clustering-based methods, the anomaly score is always formalized as the distance to cluster center. SVDD (Tax & Duin, 2004) and Deep SVDD (Ruff et al., 2018) gather the representations from normal data to a compact cluster. THOC (Shen et al., 2020) fuses the multi-scale temporal features from intermediate layers by a hierarchical clustering mechanism and detects the anomalies by the multi-layer distances. ITAD (Shin et al., 2020) conducts the clustering on decomposed tensors.
|
| 34 |
+
|
| 35 |
+
The reconstruction-based models attempt to detect the anomalies by the reconstruction error. Park et al. (2018) presented the LSTM-VAE model that employs the LSTM backbone for temporal modeling and the Variational AutoEncoder (VAE) for reconstruction. OmniAnomaly proposed by Su et al. (2019) further extends the LSTM-VAE model with a normalizing flow and uses the reconstruction probabilities for detection. InterFusion from Li et al. (2021) renovates the backbone to a hierarchical VAE to model the inter- and intra-dependency among multiple series simultaneously. GANs (Goodfellow et al., 2014) are also used for reconstruction-based anomaly detection (Schlegl et al., 2019; Li et al., 2019a; Zhou et al., 2019) and perform as an adversarial regularization.
|
| 36 |
+
|
| 37 |
+
The autoregression-based models detect the anomalies by the prediction error. VAR extends ARIMA (Anderson & Kendall, 1976) and predicts the future based on the lag-dependent covariance. The autoregressive model can also be replaced by LSTMs (Hundman et al., 2018; Tariq et al., 2019).
|
| 38 |
+
|
| 39 |
+
This paper is characterized by a new association-based criterion. Different from the random walk and subsequence-based methods (Cheng et al., 2008; Boniol & Palpanas, 2020), our criterion is embodied by a co-design of the temporal models for learning more informative time-point associations.
|
| 40 |
+
|
| 41 |
+
# 2.2 TRANSFORMERS FOR TIME SERIES ANALYSIS
|
| 42 |
+
|
| 43 |
+
Recently, Transformers (Vaswani et al., 2017) have shown great power in sequential data processing, such as natural language processing (Devlin et al., 2019; Brown et al., 2020), audio processing (Huang et al., 2019) and computer vision (Dosovitskiy et al., 2021; Liu et al., 2021). For time series analysis, benefiting from the advantage of the self-attention mechanism, Transformers are used to discover the reliable long-range temporal dependencies (Kitaev et al., 2020; Li et al., 2019b; Zhou et al., 2021; Wu et al., 2021). Especially for time series anomaly detection, GTA proposed by Chen et al. (2021) employs the graph structure to learn the relationship among multiple IoT sensors, as well as the Transformer for temporal modeling and the reconstruction criterion for anomaly detection. Unlike the previous usage of Transformers, Anomaly Transformer renovates the self-attention mechanism to the Anomaly-Attention based on the key observation of association discrepancy.
|
| 44 |
+
|
| 45 |
+
# 3 METHOD
|
| 46 |
+
|
| 47 |
+
Suppose monitoring a successive system of $d$ measurements and recording the equally spaced observations over time. The observed time series $\mathcal { X }$ is denoted by a set of time points $\{ x _ { 1 } , x _ { 2 } , \cdot \cdot \cdot , x _ { N } \}$ , where $\boldsymbol { x } _ { t } \in \mathbb { R } ^ { d }$ represents the observation of time $t$ . The unsupervised time series anomaly detection problem is to determine whether $x _ { t }$ is anomalous or not without labels.
|
| 48 |
+
|
| 49 |
+
As aforementioned, we highlight the key to unsupervised time series anomaly detection as learning informative representations and finding distinguishable criterion. We propose the Anomaly Transformer to discover more informative associations and tackle this problem by learning the Association Discrepancy, which is inherently normal-abnormal distinguishable. Technically, we propose the Anomaly-Attention to embody the prior-association and series-associations, along with a minimax optimization strategy to obtain a more distinguishable association discrepancy. Co-designed with the architecture, we derive an association-based criterion based on the learned association discrepancy.
|
| 50 |
+
|
| 51 |
+
# 3.1 ANOMALY TRANSFORMER
|
| 52 |
+
|
| 53 |
+
Given the limitation of Transformers (Vaswani et al., 2017) for anomaly detection, we renovate the vanilla architecture to the Anomaly Transformer (Figure 1) with an Anomaly-Attention mechanism.
|
| 54 |
+
|
| 55 |
+
Overall Architecture Anomaly Transformer is characterized by stacking the Anomaly-Attention blocks and feed-forward layers alternately. This stacking structure is conducive to learning underly
|
| 56 |
+
|
| 57 |
+

|
| 58 |
+
/ib2iX AM \*PLah_ALh!A- kykRX/ib2iX AM \*PLah_ALh!A- kykRX Figure 1: Anomaly Transformer. Anomaly-Attention (left) models the prior-association and seriesassociation simultaneously. In addition to the reconstruction loss, our model is also optimized by the minimax strategy with a specially-designed stop-gradient mechanism (gray arrows) to constrain the prior- and series-associations for more distinguishable association discrepancy.
|
| 59 |
+
|
| 60 |
+
ing associations from deep multi-level features. Suppose the model contains $L$ layers with length- $N$ input time series $\mathcal { X } \in \mathbb { R } ^ { N \times d }$ . The overall equations of the $l$ -th layer are formalized as:
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
\begin{array} { r l } & { \mathcal { Z } ^ { l } = \mathrm { L a y e r - N o r m } \Big ( \mathrm { A n o m a l y - A t t e n t i o n } ( \mathcal { X } ^ { l - 1 } ) + \mathcal { X } ^ { l - 1 } \Big ) } \\ & { \mathcal { X } ^ { l } = \mathrm { L a y e r - N o r m } \Big ( \mathrm { F e e d - F o r w a r d } ( \mathcal { Z } ^ { l } ) + \mathcal { Z } ^ { l } \Big ) , } \end{array}
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
where $\mathcal { X } ^ { l } \in \mathbb { R } ^ { N \times d _ { \mathrm { m o d e l } } } , l \in \{ 1 , \cdots , L \}$ denotes the output of the $l$ -th layer with $d _ { \mathrm { m o d e l } }$ channels. The initial input $\chi ^ { 0 } = \mathrm { E m b e d d i n g } ( \mathcal { X } )$ represents the embedded raw series. $\mathcal { Z } ^ { l } \in \mathbb { R } ^ { N \times d _ { \mathrm { m o d e l } } }$ is the $l$ -th layer’s hidden representation. Anomaly-Attention $( \cdot )$ is to compute the association discrepancy.
|
| 67 |
+
|
| 68 |
+
Anomaly-Attention Note that the single-branch self-attention mechanism (Vaswani et al., 2017) cannot model the prior-association and series-association simultaneously. We propose the AnomalyAttention with a two-branch structure (Figure 1). For the prior-association, we adopt a learnable Gaussian kernel to calculate the prior with respect to the relative temporal distance. Benefiting from 9the unimodal property of the Gaussian kernel, this design can pay more attention to the adjacent horizon constitutionally. We also use a learnable scale parameter $\sigma$ for the Gaussian kernel, making 9the prior-associations adapt to the various time series patterns, such as different lengths of anomaly 9segments. The series-association branch is to learn the associations from raw series, which can find the most effective associations adaptively. Note that these two forms maintain the temporal depen2dencies of each time point, which are more informative than point-wise representation. They also reflect the adjacent-concentration prior and the learned associations respectively, whose discrepancy shall be normal-abnormal distinguishable. The Anomaly-Attention in the $l$ -th layer is:
|
| 69 |
+
|
| 70 |
+
$$
|
| 71 |
+
\begin{array} { r l } & { \mathrm { I n i t i a l i z a t i o n : ~ } \mathcal { Q } , \mathcal { K } , \mathcal { V } , \sigma = \mathcal { X } ^ { l - 1 } W _ { \mathcal { Q } } ^ { l } , \mathcal { X } ^ { l - 1 } W _ { \mathcal { K } } ^ { l } , \mathcal { X } ^ { l - 1 } W _ { \mathcal { V } } ^ { l } , \mathcal { X } ^ { l - 1 } W _ { \sigma } ^ { l } } \\ & { \mathrm { P r i o r - A s s o c i a t i o n : ~ } \mathcal { P } ^ { l } = \mathrm { R e s c a l e } \Bigg ( \Bigg [ \frac { 1 } { \sqrt { 2 \pi } \sigma _ { i } } \exp \left( - \frac { \left| j - i \right| ^ { 2 } } { 2 \sigma _ { i } ^ { 2 } } \right) \Bigg ] _ { i , j \in \{ 1 , \cdots , N \} } \Bigg ) } \\ & { \mathrm { ~ } _ { \mathrm { e r i e s - A s s o c i a t i o n : ~ } \mathcal { S } ^ { l } = \mathrm { S o f t m a x } } \left( \frac { Q K ^ { \mathrm { T } } } { \sqrt { d _ { \mathrm { m o d e l } } } } \right) } \end{array}
|
| 72 |
+
$$
|
| 73 |
+
|
| 74 |
+
where $\mathcal { Q } , \mathcal { K } , \mathcal { V } \in \mathbb { R } ^ { N \times d _ { \mathrm { m o d e l } } } , \sigma \in \mathbb { R } ^ { N \times 1 }$ represent the query, key, value of self-attention and the Q K V ∈ learned scale respectively. $W _ { \mathcal { Q } } ^ { l } , W _ { K } ^ { l } , W _ { \mathcal { V } } ^ { l } \ \in \ \mathbb { R } ^ { d _ { \mathrm { m o d e l } } \times d _ { \mathrm { m o d e l } } } , \tilde { W } _ { \sigma } ^ { l } \ \in \ \mathbb { R } ^ { d _ { \mathrm { m o d e l } } \times 1 }$ represent the parameter matrices for $\mathcal { Q } , \mathcal { K } , \mathcal { V } , \sigma$ in the $l$ -th layer respectively. Prior-association $\mathcal { P } ^ { l } \in \mathbb { R } ^ { N \times N }$ is generated based on the learned scale $\sigma \in \mathbb { R } ^ { N \times 1 }$ and the $i$ -th element $\sigma _ { i }$ corresponds to the $i$ -th time point. Concretely, for the $i$ -th time point, its association weight to the $j$ -th point is calculated by the Gaussian kernel $\begin{array} { r } { G ( | j - i | ; \sigma _ { i } ) = \frac { 1 } { \sqrt { 2 \pi } \sigma _ { i } } \exp ( - \frac { | j - i | ^ { 2 } } { 2 \sigma _ { i } ^ { 2 } } ) } \end{array}$ w.r.t. the distance $| j - i |$ 2. Further, we use Rescale $( \cdot )$ to transform the association weights to discrete distributions $\mathcal { P } ^ { l }$ by dividing the row sum. $S ^ { l } \in \mathbb { R } ^ { N \times N }$ denotes the series-associations. Softmax $( \cdot )$ normalizes the attention map along the last dimension, and each row of $S ^ { l }$ forms a discrete distribution. $\widehat { \mathcal { Z } } ^ { l } \in \mathbb { R } ^ { N \times d _ { \mathrm { m o d e l } } }$ is the hidden representation after the Anomaly-Attention in the $l$ -th layer. We use Anomaly-Attention $( \cdot )$ to summarize Equation 2. In the multi-head version, the learned scale is $\sigma \in \mathbb { R } ^ { N \times h }$ for $h$ heads. $\mathcal { Q } _ { m } , \mathcal { K } _ { m } , \mathcal { V } _ { m } \in \mathbb { R } ^ { N \times \frac { d _ { \mathrm { m o d e l } } } { h } }$ denote the query, key and value of the $m$ -th head respectively. The block concatenates the outputs $\{ \widehat { \mathcal { Z } } _ { m } ^ { l } \in \mathbb { R } ^ { N \times \frac { d _ { \mathrm { m o d e l } } } { h } } \} _ { 1 \leq m \leq h }$ l }1≤m≤h from multiple heads and gets the final result Zl ∈ RN×dmodel .
|
| 75 |
+
|
| 76 |
+

|
| 77 |
+
Figure 2: Minimax association learning. At the minimize phase, the prior-association minimizes the Association Discrepancy within the distribution family derived by Gaussian kernel. At the maximize phase, the series-association maximizes the Association Discrepancy under the reconstruction loss.
|
| 78 |
+
|
| 79 |
+
Association Discrepancy We formalize the Association Discrepancy as the symmetrized KL divergence between prior- and series-associations, which represents the information gain between these two distributions (Neal, 2007). We average the association discrepancy from multiple layers to combine the associations from multi-level features into a more informative measure as:
|
| 80 |
+
|
| 81 |
+
$$
|
| 82 |
+
\operatorname { A s s D i s } ( \mathcal { P } , \mathcal { S } ; \mathcal { X } ) = \left[ \frac { 1 } { L } \sum _ { l = 1 } ^ { L } \left( \operatorname { K L } ( \mathcal { P } _ { i , : } ^ { l } \Vert \mathcal { S } _ { i , : } ^ { l } ) + \operatorname { K L } ( \mathcal { S } _ { i , : } ^ { l } \Vert \mathcal { P } _ { i , : } ^ { l } ) \right) \right] _ { i = 1 , \cdots , N }
|
| 83 |
+
$$
|
| 84 |
+
|
| 85 |
+
where $\operatorname { K L } ( \cdot \| \cdot )$ is the KL divergence computed between two discrete distributions corresponding to every row of $\mathcal { P } ^ { l }$ and $S ^ { l }$ . $\mathrm { A s s D i s } ( \mathcal { P } , \mathcal { S } ; \boldsymbol { \mathcal { X } } ) \in \mathbb { R } ^ { N \times 1 }$ is the point-wise association discrepancy of $\mathcal { X }$ with respect to prior-association $\mathcal { P }$ and series-association $s$ from multiple layers. The $i$ -th element of AssDis corresponds to the $i$ -th time point of $\mathcal { X }$ . From previous observation, anomalies will present smaller AssDis $( \mathcal { P } , \mathcal { S } ; \mathcal { X } )$ than normal time points, which makes AssDis inherently distinguishable.
|
| 86 |
+
|
| 87 |
+
# 3.2 MINIMAX ASSOCIATION LEARNING
|
| 88 |
+
|
| 89 |
+
As an unsupervised task, we employ the reconstruction loss for optimizing our model. The reconstruction loss will guide the series-association to find the most informative associations. To further amplify the difference between normal and abnormal time points, we also use an additional loss to enlarge the association discrepancy. Due to the unimodal property of the prior-association, the discrepancy loss will guide the series-association to pay more attention to the non-adjacent area, which makes the reconstruction of anomalies harder and makes anomalies more identifiable. The loss function for input series $\mathcal { X } \in \mathbb { R } ^ { N \times d }$ is formalized as:
|
| 90 |
+
|
| 91 |
+
$$
|
| 92 |
+
\mathcal { L } _ { \mathrm { T o t a l } } ( \widehat { \mathcal { X } } , \mathcal { P } , \mathcal { S } , \lambda ; \mathcal { X } ) = \| \mathcal { X } - \widehat { \mathcal { X } } \| _ { \mathrm { F } } ^ { 2 } - \lambda \times \| \mathrm { A s s D i s } ( \mathcal { P } , \mathcal { S } ; \mathcal { X } ) \| _ { 1 }
|
| 93 |
+
$$
|
| 94 |
+
|
| 95 |
+
where $\widehat { \mathcal { X } } \in \mathbb { R } ^ { N \times d }$ denotes the reconstruction of $\mathcal { X }$ . $\| \cdot \| _ { \mathrm { F } } , \| \cdot \| _ { k }$ indicate the Frobenius and $k$ -norm. $\lambda$
|
| 96 |
+
is to trade off the loss terms. When $\lambda > 0$ , the optimization is to enlarge the association discrepancy.
|
| 97 |
+
A minimax strategy is proposed to make the association discrepancy more distinguishable.
|
| 98 |
+
|
| 99 |
+
Minimax Strategy Note that directly maximizing the association discrepancy will extremely reduce the scale parameter of the Gaussian kernel (Neal, 2007), making the prior-association meaningless. Towards a better control of association learning, we propose a minimax strategy (Figure 2). Concretely, for the minimize phase, we drive the prior-association $\mathcal { P } ^ { l }$ to approximate the seriesassociation $S ^ { l }$ that is learned from raw series. This process will make the prior-association adapt to various temporal patterns. For the maximize phase, we optimize the series-association to enlarge the association discrepancy. This process forces the series-association to pay more attention to the non-adjacent horizon. Thus, integrating the reconstruction loss, the loss functions of two phases are:
|
| 100 |
+
|
| 101 |
+
Minimize Phase: $\mathcal { L } _ { \mathrm { T o t a l } } ( \widehat { \mathcal { X } } , \mathcal { P } , S _ { \mathrm { d e t a c h } } , - \lambda ; \mathcal { X } )$
|
| 102 |
+
|
| 103 |
+
Maximize Phase: $\mathcal { L } _ { \mathrm { T o t a l } } ( \widehat { \mathcal { X } } , \mathcal { P } _ { \mathrm { d e t a c h } } , S , \lambda ; \mathcal { X } )$ ,
|
| 104 |
+
|
| 105 |
+
where $\lambda > 0$ and $^ { * } \mathrm { d e t a c h }$ means to stop the gradient backpropagation of the association (Figure 1). As $\mathcal { P }$ approximates $\boldsymbol { S } _ { \mathrm { d e t a c h } }$ in the minimize phase, the maximize phase will conduct a stronger constraint to the series-association, forcing the time points to pay more attention to the non-adjacent area. Under the reconstruction loss, this is much harder for anomalies to achieve than normal time points, thereby amplifying the normal-abnormal distinguishability of the association discrepancy.
|
| 106 |
+
|
| 107 |
+
Association-based Anomaly Criterion We incorporate the normalized association discrepancy to the reconstruction criterion, which will take the benefits of both temporal representation and the distinguishable association discrepancy. The final anomaly score of $\mathcal { X } \in \mathbb { R } ^ { N \times d }$ is shown as follows:
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
\mathrm { A n o m a l y S c o r e } ( \mathcal { X } ) = \mathrm { S o f t m a x } \bigg ( - \mathrm { A s s D i s } ( \mathcal { P } , \mathcal { S } ; \mathcal { X } ) \bigg ) \odot \bigg [ \| \mathcal { X } _ { i , : } - \widehat { \mathcal { X } } _ { i , : } \| _ { 2 } ^ { 2 } \bigg ] _ { i = 1 , \cdots , N }
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
where $\odot$ is the element-wise multiplication. Anom $\mathrm { a l y S c o r e } ( \mathcal { X } ) \in \mathbb { R } ^ { N \times 1 }$ denotes the point-wise anomaly criterion of $\mathcal { X }$ . Towards a better reconstruction, anomalies usually decrease the association discrepancy, which will still derive a higher anomaly score. Thus, this design can make the reconstruction error and the association discrepancy collaborate to improve detection performance.
|
| 114 |
+
|
| 115 |
+
# 4 EXPERIMENTS
|
| 116 |
+
|
| 117 |
+
We extensively evaluate Anomaly Transformer on six benchmarks for three practical applications.
|
| 118 |
+
|
| 119 |
+
Datasets Here is a description of the six experiment datasets: (1) SMD (Server Machine Dataset, Su et al. (2019)) is a 5-week-long dataset collected from a large Internet company with 38 dimensions. (2) PSM (Pooled Server Metrics, Abdulaal et al. (2021)) is collected internally from multiple application server nodes at eBay with 26 dimensions. (3) Both MSL (Mars Science Laboratory rover) and SMAP (Soil Moisture Active Passive satellite) are public datasets from NASA (Hundman et al., 2018) with 55 and 25 dimensions respectively, which contain the telemetry anomaly data derived from the Incident Surprise Anomaly (ISA) reports of spacecraft monitoring systems. (4) SWaT (Secure Water Treatment, Mathur & Tippenhauer (2016)) is obtained from 51 sensors of the critical infrastructure system under continuous operations. (5) NeurIPS-TS (NeurIPS 2021 Time Series Benchmark) is a dataset proposed by Lai et al. (2021) and includes five time series anomaly scenarios categorized by behavior-driven taxonomy as point-global, pattern-contextual, pattern-shapelet, pattern-seasonal and pattern-trend. The statistical details are summarized in Table 13 of Appendix.
|
| 120 |
+
|
| 121 |
+
Implementation details Following the well-established protocol in Shen et al. (2020), we adopt a non-overlapped sliding window to obtain a set of sub-series. The sliding window is with a fixed size of 100 for all datasets. We label the time points as anomalies if their anomaly scores (Equation 6) are larger than a certain threshold $\delta$ . The threshold $\delta$ is determined to make a proportion $r$ of time points of the validation dataset labeled as anomalies. For the main results, we set $r = 0 . 1 \%$ for SWaT, $0 . 5 \%$ for SMD and $1 \%$ for other datasets. We adopt the widely-used adjustment strategy ( $\mathrm { { X u } }$ et al., 2018; Su et al., 2019; Shen et al., 2020): if a time point in a certain successive abnormal segment is detected, all anomalies in this abnormal segment are viewed to be correctly detected. This strategy is justified from the observation that an abnormal time point will cause an alert and further make the whole segment noticed in real-world applications. Anomaly Transformer contains 3 layers. We set the channel number of hidden states $d _ { \mathrm { m o d e l } }$ as 512 and the number of heads $h$ as 8. The hyperparameter $\lambda$ (Equation 4) is set as 3 for all datasets to trade-off two parts of the loss function. We use the ADAM (Kingma & Ba, 2015) optimizer with an initial learning rate of $1 0 ^ { - 4 }$ . The training process is early stopped within 10 epochs with the batch size of 32. All the experiments are implemented in Pytorch (Paszke et al., 2019) with a single NVIDIA TITAN RTX 24GB GPU.
|
| 122 |
+
|
| 123 |
+
Baselines We extensively compare our model with 18 baselines, including the reconstructionbased models: InterFusion (2021), BeatGAN (2019), OmniAnomaly (2019), LSTM-VAE (2018); the density-estimation models: DAGMM (2018), MPPCACD (2017), LOF (2000); the clusteringbased methods: ITAD (2020), THOC (2020), Deep-SVDD (2018); the autoregression-based models: CL-MPPCA (2019), LSTM (2018), VAR (1976); the classic methods: OC-SVM (2004), IsolationForest (2008). Another 3 baselines from change point detection and time series segmentation are deferred to Appendix I. InterFusion (2021) and THOC (2020) are the state-of-the-art deep models.
|
| 124 |
+
|
| 125 |
+

|
| 126 |
+
Figure 3: ROC curves (horizontal-axis: false-positive rate; vertical-axis: true-positive rate) for the five datasets. A higher AUC value (area under the ROC curve) indicates a better performance. The predefined threshold proportion $r$ is in $\{ 0 . 5 \% , 1 . 0 \%$ , $1 . 5 \%$ , $2 . 0 \%$ , $1 0 \%$ , $2 0 \%$ , $3 0 \% \}$ .
|
| 127 |
+
|
| 128 |
+
Table 1: Quantitative results for Anomaly Transformer $( O u r s )$ in the five datasets. The $P$ , $R$ and $F l$ represent the precision, recall and F1-score (as $\%$ ) respectively. F1-score is the harmonic mean of precision and recall. For these three metrics, a higher value indicates a better performance.
|
| 129 |
+
|
| 130 |
+
<table><tr><td rowspan="2">Dataset Metric</td><td colspan="3">SMD</td><td colspan="3">MSL</td><td colspan="3">SMAP</td><td colspan="3">SWaT</td><td colspan="3">PSM</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><td>P</td><td>R</td><td>F1</td><td>P</td><td>R</td><td>F1</td></tr><tr><td>OCSVM</td><td></td><td>44.34 76.72</td><td>56.19</td><td>59.78</td><td>86.87</td><td>70.82</td><td>53.85</td><td>59.07</td><td>56.34</td><td>45.39</td><td>49.22</td><td>47.23</td><td>62.75</td><td>80.89</td><td>70.67</td></tr><tr><td>IsolationForest</td><td></td><td>42.31 73.29 53.64</td><td></td><td>53.94</td><td>86.54 66.45</td><td></td><td></td><td>52.3959.07</td><td>55.53</td><td>49.29</td><td></td><td>44.95 47.02</td><td>76.09</td><td>92.45</td><td>83.48</td></tr><tr><td>LOF</td><td></td><td>56.34 39.86 46.68</td><td></td><td>47.72</td><td>85.25</td><td>61.18</td><td>58.93</td><td>56.33</td><td>57.60</td><td>72.15</td><td>65.43</td><td>68.62</td><td>57.89</td><td>90.49</td><td>70.61</td></tr><tr><td>Deep-SVDD</td><td></td><td>78.54 79.67 79.10</td><td></td><td>91.92</td><td>76.63</td><td>83.58</td><td>89.93</td><td>56.02</td><td>69.04</td><td>80.42</td><td>84.45</td><td>82.39</td><td>95.41</td><td>86.49</td><td>90.73</td></tr><tr><td>DAGMM</td><td></td><td>67.30 49.89</td><td>57.30</td><td>89.60</td><td>63.93</td><td>74.62</td><td>86.45</td><td>56.73</td><td>68.51</td><td>89.92 57.84</td><td></td><td>70.40</td><td>93.49</td><td>70.03</td><td>80.08</td></tr><tr><td>MMPCACD</td><td></td><td>71.20 79.28</td><td>75.02</td><td>81.42</td><td>61.31</td><td>69.95</td><td>88.61</td><td>75.84 81.73</td><td></td><td>82.52</td><td>68.29</td><td>74.73</td><td>76.26</td><td>78.35</td><td>77.29</td></tr><tr><td>VAR</td><td>78.35</td><td>70.26</td><td>74.08</td><td>74.68</td><td>81.42</td><td>77.90</td><td>81.38 53.88</td><td></td><td>64.83</td><td>81.59</td><td>60.29</td><td>69.34</td><td>90.71</td><td>83.82</td><td>87.13</td></tr><tr><td>LSTM</td><td>78.55</td><td>85.28</td><td>81.78</td><td>85.45</td><td>82.50</td><td>83.95</td><td>89.41</td><td>78.13</td><td>83.39</td><td>86.15</td><td>83.27</td><td>84.69</td><td>76.93</td><td>89.64</td><td>82.80</td></tr><tr><td>CL-MPPCA</td><td></td><td>82.36 76.07</td><td>79.09</td><td>73.71</td><td>88.54</td><td>80.44</td><td>86.13</td><td>63.16</td><td>72.88</td><td>76.78</td><td>81.50</td><td>79.07</td><td>56.02</td><td>99.93</td><td>71.80</td></tr><tr><td>ITAD</td><td>86.22</td><td>73.71</td><td>79.48</td><td>69.44</td><td>84.09</td><td>76.07</td><td>82.42</td><td>66.89</td><td>73.85</td><td>63.13</td><td>52.08</td><td>57.08</td><td>72.80</td><td>64.02</td><td>68.13</td></tr><tr><td>LSTM-VAE</td><td></td><td>75.76 90.08</td><td>82.30</td><td>85.49</td><td>79.94</td><td>82.62</td><td>92.20</td><td>67.75</td><td>78.10</td><td>76.00</td><td>89.50</td><td>82.20</td><td>73.62</td><td>89.92</td><td>80.96</td></tr><tr><td>BeatGAN</td><td>72.90</td><td>84.09</td><td>78.10</td><td>89.75</td><td>85.42</td><td>87.53</td><td>92.38</td><td>55.85</td><td>69.61</td><td>64.01</td><td>87.46</td><td>73.92</td><td>90.30</td><td>93.84</td><td>92.04</td></tr><tr><td>OmniAnomaly</td><td>83.68</td><td>86.82</td><td>85.22</td><td>89.02</td><td>86.37</td><td>87.67</td><td>92.49</td><td>81.99</td><td>86.92</td><td>81.42</td><td>84.30</td><td>82.83</td><td>88.39</td><td>74.46</td><td>80.83</td></tr><tr><td>InterFusion</td><td>87.02</td><td>85.43</td><td>86.22</td><td>81.28</td><td>92.70</td><td>86.62</td><td>89.77</td><td>88.52</td><td>89.14</td><td>80.59</td><td>85.58</td><td>83.01</td><td>83.61</td><td>83.45</td><td>83.52</td></tr><tr><td>THOC</td><td></td><td>79.76 90.95</td><td>84.99</td><td>88.45</td><td>90.97</td><td>89.69</td><td>92.06</td><td>89.34</td><td>90.68</td><td>83.94</td><td>86.36 85.13</td><td></td><td>88.14</td><td>90.99</td><td>89.54</td></tr><tr><td>Ours</td><td></td><td>89.40 95.45</td><td>92.33</td><td>92.09</td><td>95.15</td><td>93.59</td><td>94.13</td><td></td><td>99.40 96.69</td><td>91.55</td><td>96.73</td><td>94.07</td><td>96.91</td><td></td><td>98.90 97.89</td></tr></table>
|
| 131 |
+
|
| 132 |
+
# 4.1 MAIN RESULTS
|
| 133 |
+
|
| 134 |
+
Real-world datasets We extensively evaluate our model on five real-world datasets with ten competitive baselines. As shown in Table 1, Anomaly Transformer achieves the consistent state-of-theart on all benchmarks. We observe that deep models that consider the temporal information outperform the general anomaly detection model, such as Deep-SVDD (Ruff et al., 2018) and DAGMM (Zong et al., 2018), which verifies the effectiveness of temporal modeling. Our proposed Anomaly Transformer goes beyond the point-wise representation learned by RNNs and models the more informative associations. The results in Table 1 are persuasive for the advantage of association learning in time series anomaly detection. In addition, we plot the ROC curve in Figure 3 for a complete comparison. Anomaly Transformer has the highest AUC values on all five datasets. It means that our model performs well in the false-positive and true-positive rates under various preset thresholds, which is important for real-world applications.
|
| 135 |
+
|
| 136 |
+
NeurIPS-TS benchmark This benchmark is generated from well-designed rules proposed by Lai et al. (2021), including all types of anomalies and covering both the point-wise and patternwise anomalies. As shown in Figure 4, Anomaly Transformer can still achieve state-of-the-art performance. This verifies the effectiveness of our model on various anomalies.
|
| 137 |
+
|
| 138 |
+

|
| 139 |
+
Figure 4: Results for NeurIPS-TS.
|
| 140 |
+
|
| 141 |
+
Ablation study As shown in Table 2, we further investigate the effect of each part in our model. Our association-based criterion outperforms the widely-used reconstruction criterion consistently.
|
| 142 |
+
|
| 143 |
+
Specifically, the association-based criterion brings a remarkable $1 8 . 7 6 \%$ ( $7 6 . 2 0 { } 9 4 . 9 6$ ) averaged absolute F1-score promotion. Also, directly taking the association discrepancy as the criterion still achieves a good performance (F1-score: $9 1 . 5 5 \%$ ) and surpasses the previous state-of-the-art model
|
| 144 |
+
|
| 145 |
+
THOC (F1-score: $8 8 . 0 1 \%$ calculated from Table 1). Besides, the learnable prior-association (corresponding to $\sigma$ in Equation 2) and the minimax strategy can further improve our model and get $8 . 4 3 \%$ $7 9 . 0 5 \substack { 8 7 . 4 8 } )$ and $7 . 4 8 \%$ $8 7 . 4 8 { } 9 4 . 9 6 $ ) averaged absolute promotions respectively. Finally, our proposed Anomaly Transformer surpasses the pure Transformer by $1 8 . 3 4 \%$ ( $7 6 . 6 2 \substack { } 9 4 . 9 6$ ) absolute improvement. These verify that each module of our design is effective and necessary. More ablations of association discrepancy can be found in Appendix D.
|
| 146 |
+
|
| 147 |
+
Table 2: Ablation results (F1-score) in anomaly criterion, prior-association and optimization strategy. Recon, AssDis and Assoc mean the pure reconstruction performance, pure association discrepancy and our proposed association-based criterion respectively. $F i x$ is to fix Learnable scale parameter $\sigma$ of prior-association as 1.0. Max and Minimax refer to the strategies for association discrepancy in the maximization (Equation 4) and minimax (Equation 5) way respectively.
|
| 148 |
+
|
| 149 |
+
<table><tr><td>Architecture</td><td>Anomaly Criterion</td><td>Prior- Association</td><td>Optimization Strategy</td><td>SMD</td><td>MSL</td><td>SMAP</td><td>SWaT</td><td>PSM</td><td>AvgF1 (as%)</td></tr><tr><td>Transformer</td><td>Recon</td><td>×</td><td>×</td><td>79.72</td><td>76.64</td><td>73.74</td><td>74.56</td><td>78.43</td><td>76.62</td></tr><tr><td rowspan="3">Anomaly</td><td>Recon</td><td>Learnable</td><td>Minmax</td><td>71.35</td><td>78.61</td><td>69.12</td><td>81.53</td><td>80.40</td><td>76.20</td></tr><tr><td>AssDis</td><td>Learnable</td><td>Minmax</td><td>87.57</td><td>90.50</td><td>90.98</td><td>93.21</td><td>95.47</td><td>91.55</td></tr><tr><td>Assoc</td><td>Fix</td><td>Max</td><td>83.95</td><td>82.17</td><td>70.65</td><td>79.46</td><td>79.04</td><td>79.05</td></tr><tr><td></td><td>Assoc</td><td>Learnable</td><td>Max</td><td>88.88</td><td>85.20</td><td>87.84</td><td>81.65</td><td>93.83</td><td>87.48</td></tr><tr><td>*final</td><td>Assoc</td><td>Learnable</td><td>Minmax</td><td>92.33</td><td>93.59</td><td>96.90</td><td>94.07</td><td>97.89</td><td>94.96</td></tr></table>
|
| 150 |
+
|
| 151 |
+
# 4.2 MODEL ANALYSIS
|
| 152 |
+
|
| 153 |
+
To explain how our model works intuitively, we provide the visualization and statistical results for our three key designs: anomaly criterion, learnable prior-association and optimization strategy.
|
| 154 |
+
|
| 155 |
+

|
| 156 |
+
参考文献 bm\`p2v M/ MQp2H TT\`Q+?X kyykX GM+2i AM72+iX .BbX- kykyX GM+2i AM72+iX .BbX- kykyX GM+2i AM72+iX .BbX- kykyXFigure 5: Visualization of different anomaly categories (Lai et al., 2021). We plot the raw series (R) 1X .QM;- >X .m- M/ GX :\`/M2\`X M BMi2\`+iBp2 r2#@#b2/ /b?#Q\`/ iQ i\`+F +QpB/@RN BM \`2H iBK2X(j) S\`i? Sir- a?BpK a?\`K- a\`BMBpb SvFH- oBM22i? :mTi?- :BiMDHB EmK\`B- J/X a?/ F?i\`-bB7 1F#H- KBip .b- M/ hMKQv \*?F\`#Q\`ivX 6B;?iBM; M BM7Q/2KB+, \*QpB/@RN 7F2 M2rb(k) 1KQMM CX E2Q;?- a2HBM \*?m- .pB/ JX >\`i- M/ JB+?2H CX SxxMBX a2;K2MiBM; iBK2 b2\`B2b, (k) 1KQMM CX E2Q;?- a2HBM \*?m- .pB/ JX >\`i- M/ JB+?bm\`p2v M/ MQp2H TT\`Q+?X kyykX(k) 1KQMM CX E2Q;?- a2HBM \*?m- .pB/ J(first row) from NeurIPS-TS dataset, as well as their corresponding reconstruction (second row) and (k) 1KQMM CX E2Q;?- a2HBM \*?m- .pB/ JX >\`i- M/ JB+?2H CX SxxMBX a2;K2MiBM; iBK2 b2\`B2b, /ib2iX AM \*PLah_ALh!A- kykRX (j) S\`i? Sir- a?BpK a?\`K- a\`BMBpb SvFH- oBM22i? :mTi?- :BiMDHB EmK\`B- J/X a?/ F?i\`-(j) S\`i? Sir- a?BpK a?\`K- a\`BMBpb SvFH- oBM22i? :m(j) S\`i? Sir- a?BpK a?\`K- a\`BMBpb association-based criteria (third row). The point-wise anomalies are marked by red circles and the bm\`p2v M/ MQp2H TT\`Q+?X kyykX bB7 1F#H- KBip .b- M/ hMKQv \*?F\`#Q\`ivX 6B;?iBM; M BM7Q/2KB+, \*QpB/@RN 7F2 M2rbB7 1F#H- KBip .b- M/ hMKQv \*?F\`#Q\`ivX /ib2iX AM \*PLah_ALh!A- kykRXbB7 1F#H- KBip .b- M/ hMKQpattern-wise anomalies are in red segments. The wrongly detected cases are bounded by red boxes.
|
| 157 |
+
|
| 158 |
+
/ib2iX AM \*PLah_ALh!A- kykRXAnomaly criterion visualization To get more intuitive cases about how association-based criterion works, we provide some visualization in Figure 5 and explore the criterion performance under different types of anomalies, where the taxonomy is from Lai et al. (2021). We can find that our proposed association-based criterion is more distinguishable in general. Concretely, the associationbased criterion can obtain the consistent smaller values for the normal part, which is quite contrasting in point-contextual and pattern-seasonal cases (Figure 5). In contrast, the jitter curves of the reconstruction criterion make the detection process confused and fail in the aforementioned two cases. This verifies that our criterion can highlight the anomalies and provide distinct values for normal and abnormal points, making the detection precise and reducing the false-positive rate.
|
| 159 |
+
|
| 160 |
+

|
| 161 |
+
Figure 6: Learned scale parameter $\sigma$ for different types of anomalies (highlight in red).
|
| 162 |
+
|
| 163 |
+
Prior-association visualization During the minimax optimization, the prior-association is learned to get close to the series-association. Thus, the learned $\sigma$ can reflect the adjacent-concentrating degree of time series. As shown in Figure 6, we find that $\sigma$ changes to adapt to various data patterns of time series. Especially, the prior-association of anomalies generally has a smaller $\sigma$ than normal time points, which matches our adjacent-concentration inductive bias of anomalies.
|
| 164 |
+
|
| 165 |
+
Optimization strategy analysis Only with the reconstruction loss, the abnormal and normal time points present similar behavior in the association weights to adjacent time points, corresponding to a contrast value closed to 1 (Table 3). Maximizing the association discrepancy will force the seriesassociations to pay more attention to the non-adjacent area. However, to obtain a better reconstruction, the anomalies must maintain much larger adjacent association weights than normal time points, corresponding to a larger contrast value. But direct maximization will cause optimization difficulty of Gaussian kernel, and cannot strongly amplify the difference between normal and abnormal time points as expected $( \mathbf { S } \mathbf { M } \mathbf { D } { : } 1 . 1 5 { } 1 . 2 7 )$ . The minimax strategy optimizes the prior-association to provide a stronger constraint to series-association, thereby obtaining more distinguishable contrast values and better performance than the direct maximization $\mathrm { \langle S M D : 1 . 2 7 \mathrm { } 2 . 3 9 } _ { }$ ).
|
| 166 |
+
|
| 167 |
+
Table 3: Results of adjacent association weights for Abnormal and Normal time points respectively. Recon, Max and Minimax represent the association learning process that is supervised by reconstruction loss, direct maximization and minimax strategy respectively. A higher contrast value ( AbnormalNormal ) indicates a stronger distinguishability between normal and abnormal time points.
|
| 168 |
+
|
| 169 |
+
<table><tr><td rowspan="3">Dataset</td><td colspan="2">SMD</td><td colspan="2">MSL</td><td colspan="2">SMAP</td><td colspan="2">SWaT</td><td colspan="2"></td><td colspan="2">PSM</td></tr><tr><td></td><td> Optimization|Recon Max Ours Recon Max Ours Recon Max Ours Recon Max Ours Recon Max Ours</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Abnormal(%)</td><td>1.080.95 0.861.01 0.65 0.351.291.18 0.701.27 0.89 0.371.02 0.56 0.29</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>Normal (%)</td><td>0.940.750.361.000.59 0.221.231.090.491.180.780.210.990.54 0.11</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>Contrast (Nomal) Normal</td><td>1.151.27 2.391.011.10 1.591.051.08 1.431.08 1.14 1.761.031.04 2.64</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>
|
| 170 |
+
|
| 171 |
+
# 5 CONCLUSION AND FUTURE WORK
|
| 172 |
+
|
| 173 |
+
This paper studies the unsupervised time series anomaly detection problem. Unlike previous works, we learn the more informative time-point associations by Transformers. Based on the key observation of association discrepancy, we propose the Anomaly Transformer, including an AnomalyAttention with the two-branch structure to embody the association discrepancy. A minimax strategy is adopted to further amplify the difference between normal and abnormal time points. By introducing the association discrepancy, we propose the association-based criterion, which makes the reconstruction performance and association discrepancy collaborate. Anomaly Transformer achieves the state-of-the-art results on an exhaustive set of empirical studies. Future work includes theoretical study of Anomoly Transformer in light of classic analysis for autoregression and state space models.
|
| 174 |
+
|
| 175 |
+
# ACKNOWLEDGMENTS
|
| 176 |
+
|
| 177 |
+
This work was supported by the National Megaproject for New Generation AI (2020AAA0109201), National Natural Science Foundation of China (62022050 and 62021002), Beijing Nova Program (Z201100006820041), and BNRist Innovation Fund (BNR2021RC01002).
|
| 178 |
+
|
| 179 |
+
# REFERENCES
|
| 180 |
+
|
| 181 |
+
Ahmed Abdulaal, Zhuanghua Liu, and Tomer Lancewicki. Practical approach to asynchronous multivariate time series anomaly detection and localization. KDD, 2021.
|
| 182 |
+
|
| 183 |
+
Ryan Prescott Adams and David J. C. MacKay. Bayesian online changepoint detection. arXiv preprint arXiv:0710.3742, 2007.
|
| 184 |
+
|
| 185 |
+
O. Anderson and M. Kendall. Time-series. 2nd edn. J. R. Stat. Soc. (Series D), 1976.
|
| 186 |
+
|
| 187 |
+
Paul Boniol and Themis Palpanas. Series2graph: Graph-based subsequence anomaly detection for time series. Proc. VLDB Endow., 2020.
|
| 188 |
+
|
| 189 |
+
Markus M. Breunig, Hans-Peter Kriegel, Raymond T. Ng, and Jorg Sander. LOF: identifying ¨ density-based local outliers. In SIGMOD, 2000.
|
| 190 |
+
|
| 191 |
+
Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In NeurIPS, 2020.
|
| 192 |
+
|
| 193 |
+
Zekai Chen, Dingshuo Chen, Zixuan Yuan, Xiuzhen Cheng, and Xiao Zhang. Learning graph structures with transformer for multivariate time series anomaly detection in iot. ArXiv, abs/2104.03466, 2021.
|
| 194 |
+
|
| 195 |
+
Haibin Cheng, Pang-Ning Tan, Christopher Potter, and Steven A. Klooster. A robust graph-based algorithm for detection and characterization of anomalies in noisy multivariate time series. ICDM Workshops, 2008.
|
| 196 |
+
|
| 197 |
+
Haibin Cheng, Pang-Ning Tan, Christopher Potter, and Steven A. Klooster. Detection and characterization of anomalies in multivariate time series. In SDM, 2009.
|
| 198 |
+
|
| 199 |
+
Shohreh Deldari, Daniel V. Smith, Hao Xue, and Flora D. Salim. Time series change point detection with self-supervised contrastive predictive coding. In WWW, 2021.
|
| 200 |
+
|
| 201 |
+
Ailin Deng and Bryan Hooi. Graph neural network-based anomaly detection in multivariate time series. AAAI, 2021.
|
| 202 |
+
|
| 203 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In NAACL, 2019.
|
| 204 |
+
|
| 205 |
+
Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021.
|
| 206 |
+
|
| 207 |
+
I. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron C. Courville, and Yoshua Bengio. Generative adversarial nets. In NeurIPS, 2014.
|
| 208 |
+
|
| 209 |
+
Cheng-Zhi Anna Huang, Ashish Vaswani, Jakob Uszkoreit, Ian Simon, Curtis Hawthorne, Noam Shazeer, Andrew M. Dai, Matthew D. Hoffman, Monica Dinculescu, and Douglas Eck. Music transformer. In ICLR, 2019.
|
| 210 |
+
|
| 211 |
+
Kyle Hundman, Valentino Constantinou, Christopher Laporte, Ian Colwell, and Tom Soderstr ¨ om. ¨ Detecting spacecraft anomalies using lstms and nonparametric dynamic thresholding. KDD, 2018.
|
| 212 |
+
|
| 213 |
+
Eamonn J. Keogh, Taposh Roy, Naik U, and Agrawal A. Multi-dataset time-series anomaly detection competition, Competition of International Conference on Knowledge Discovery & Data Mining 2021. URL https://compete.hexagon-ml.com/practice/competition/39/.
|
| 214 |
+
|
| 215 |
+
Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
|
| 216 |
+
|
| 217 |
+
Nikita Kitaev, Lukasz Kaiser, and Anselm Levskaya. Reformer: The efficient transformer. In ICLR, 2020.
|
| 218 |
+
|
| 219 |
+
Kwei-Herng Lai, D. Zha, Junjie Xu, and Yue Zhao. Revisiting time series outlier detection: Definitions and benchmarks. In NeurIPS Dataset and Benchmark Track, 2021.
|
| 220 |
+
|
| 221 |
+
Dan Li, Dacheng Chen, Lei Shi, Baihong Jin, Jonathan Goh, and See-Kiong Ng. Mad-gan: Multivariate anomaly detection for time series data with generative adversarial networks. In ICANN, 2019a.
|
| 222 |
+
|
| 223 |
+
Shiyang Li, Xiaoyong Jin, Yao Xuan, Xiyou Zhou, Wenhu Chen, Yu-Xiang Wang, and Xifeng Yan. Enhancing the locality and breaking the memory bottleneck of transformer on time series forecasting. In NeurIPS, 2019b.
|
| 224 |
+
|
| 225 |
+
Zhihan Li, Youjian Zhao, Jiaqi Han, Ya Su, Rui Jiao, Xidao Wen, and Dan Pei. Multivariate time series anomaly detection and interpretation using hierarchical inter-metric and temporal embedding. KDD, 2021.
|
| 226 |
+
|
| 227 |
+
F. Liu, K. Ting, and Z. Zhou. Isolation forest. ICDM, 2008.
|
| 228 |
+
|
| 229 |
+
Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Ching-Feng Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. ICCV, 2021.
|
| 230 |
+
|
| 231 |
+
Aditya P. Mathur and Nils Ole Tippenhauer. Swat: a water treatment testbed for research and training on ICS security. In CySWATER, 2016.
|
| 232 |
+
|
| 233 |
+
Radford M. Neal. Pattern recognition and machine learning. Technometrics, 2007.
|
| 234 |
+
|
| 235 |
+
Daehyung Park, Yuuna Hoshi, and Charles C. Kemp. A multimodal anomaly detector for robotassisted feeding using an lstm-based variational autoencoder. RA-L, 2018.
|
| 236 |
+
|
| 237 |
+
Adam Paszke, S. Gross, Francisco Massa, A. Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Z. Lin, N. Gimelshein, L. Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zach ¨ DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high-performance deep learning library. In NeurIPS, 2019.
|
| 238 |
+
|
| 239 |
+
Mathias Perslev, Michael Jensen, Sune Darkner, Poul Jø rgen Jennum, and Christian Igel. U-time: A fully convolutional network for time series segmentation applied to sleep staging. In NeurIPS. 2019.
|
| 240 |
+
|
| 241 |
+
Lukas Ruff, Nico Gornitz, Lucas Deecke, Shoaib Ahmed Siddiqui, Robert A. Vandermeulen, ¨ Alexander Binder, Emmanuel Muller, and M. Kloft. Deep one-class classification. In ¨ ICML, 2018.
|
| 242 |
+
|
| 243 |
+
T. Schlegl, Philipp Seebock, S. Waldstein, G. Langs, and U. Schmidt-Erfurth. f-anogan: Fast unsu- ¨ pervised anomaly detection with generative adversarial networks. Med. Image Anal., 2019.
|
| 244 |
+
|
| 245 |
+
B. Scholkopf, John C. Platt, J. Shawe-Taylor, Alex Smola, and R. C. Williamson. Estimating the ¨ support of a high-dimensional distribution. Neural Comput., 2001.
|
| 246 |
+
|
| 247 |
+
Lifeng Shen, Zhuocong Li, and James T. Kwok. Timeseries anomaly detection using temporal hierarchical one-class network. In Hugo Larochelle, Marc’Aurelio Ranzato, Raia Hadsell, MariaFlorina Balcan, and Hsuan-Tien Lin (eds.), NeurIPS, 2020.
|
| 248 |
+
|
| 249 |
+
Youjin Shin, Sangyup Lee, Shahroz Tariq, Myeong Shin Lee, Okchul Jung, Daewon Chung, and Simon S. Woo. Itad: Integrative tensor-based anomaly detection system for reducing false positives of satellite systems. CIKM, 2020.
|
| 250 |
+
|
| 251 |
+
Ya Su, Y. Zhao, Chenhao Niu, Rong Liu, W. Sun, and Dan Pei. Robust anomaly detection for multivariate time series through stochastic recurrent neural network. KDD, 2019.
|
| 252 |
+
Jian Tang, Zhixiang Chen, A. Fu, and D. Cheung. Enhancing effectiveness of outlier detections for low density patterns. In PAKDD, 2002.
|
| 253 |
+
Shahroz Tariq, Sangyup Lee, Youjin Shin, Myeong Shin Lee, Okchul Jung, Daewon Chung, and Simon S. Woo. Detecting anomalies in space using multivariate convolutional lstm with mixtures of probabilistic pca. KDD, 2019.
|
| 254 |
+
D. Tax and R. Duin. Support vector data description. Mach. Learn., 2004.
|
| 255 |
+
Robert Tibshirani, Guenther Walther, and Trevor Hastie. Estimating the number of clusters in a dataset via the gap statistic. J. R. Stat. Soc. (Series B), 2001.
|
| 256 |
+
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.
|
| 257 |
+
Haixu Wu, Jiehui Xu, Jianmin Wang, and Mingsheng Long. Autoformer: Decomposition transformers with Auto-Correlation for long-term series forecasting. In NeurIPS, 2021.
|
| 258 |
+
Haowen Xu, Wenxiao Chen, N. Zhao, Zeyan Li, Jiahao Bu, Zhihan Li, Y. Liu, Y. Zhao, Dan Pei, Yang Feng, Jian Jhen Chen, Zhaogang Wang, and Honglin Qiao. Unsupervised anomaly detection via variational auto-encoder for seasonal kpis in web applications. WWW, 2018.
|
| 259 |
+
Takehisa Yairi, Naoya Takeishi, Tetsuo Oda, Yuta Nakajima, Naoki Nishimura, and Noboru Takata. A data-driven health monitoring method for satellite housekeeping data based on probabilistic clustering and dimensionality reduction. IEEE Trans. Aerosp. Electron. Syst., 2017.
|
| 260 |
+
Hang Zhao, Yujing Wang, Juanyong Duan, Congrui Huang, Defu Cao, Yunhai Tong, Bixiong Xu, Jing Bai, Jie Tong, and Qi Zhang. Multivariate time-series anomaly detection via graph attention network. ICDM, 2020.
|
| 261 |
+
Bin Zhou, Shenghua Liu, Bryan Hooi, Xueqi Cheng, and Jing Ye. Beatgan: Anomalous rhythm detection using adversarially generated time series. In IJCAI, 2019.
|
| 262 |
+
Haoyi Zhou, Shanghang Zhang, Jieqi Peng, Shuai Zhang, Jianxin Li, Hui Xiong, and Wancai Zhang. Informer: Beyond efficient transformer for long sequence time-series forecasting. In AAAI, 2021.
|
| 263 |
+
Bo Zong, Qi Song, Martin Renqiang Min, Wei Cheng, Cristian Lumezanu, Dae-ki Cho, and Haifeng Chen. Deep autoencoding gaussian mixture model for unsupervised anomaly detection. In ICLR, 2018.
|
| 264 |
+
|
| 265 |
+
# A PARAMETER SENSITIVITY
|
| 266 |
+
|
| 267 |
+
We set the window size as 100 throughout the main text, which considers the temporal information, memory and computation efficiency. And we set the loss weight 989898 $\lambda$ based on the convergence property of the training curve.959595
|
| 268 |
+
|
| 269 |
+
Furthermore, Figure 7 provides the model performance under different choices of the window sizeSMAPSWaTSMAPSWaT and the loss weight. We present that our model is stable to the window size over extensive datasets94 PSMPSM9494 (Figure 7 left). Note that a larger window size indicates a larger memory cost and a smaller sliding90 MSLMSL90 929290 92 number. Especially, only considering the performance, its relationship to the window size can beSMAPSMAP determined by the data pattern. For example, our model performs better when the window size is 50PSMPSM 909090 for the SMD dataset. Besides, we adopt the loss weight 1 2 3 4 5 6858585 $\lambda$ in Equation 5 to trade off the reconstruction1 2 3 4 5 61 2 3 4 5 6 loss and the association part. We find that factorWindow SizeWindow Size $\lambda$ is stable and easy to tune in the range of 2 to 4. ThefactorLoss Weight above results verify the sensitivity of our model, which is essential for applications.
|
| 270 |
+
|
| 271 |
+

|
| 272 |
+
Figure 7: Parameter sensitivity for sliding window size (left) and loss weight $\lambda$ (right). The model with $\lambda = 0$ still adopts the association-based criterion but only supervised by reconstruction loss.
|
| 273 |
+
|
| 274 |
+
# B IMPLEMENTATION DETAILS
|
| 275 |
+
|
| 276 |
+
We present the pseudo-code of Anomaly-Attention in Algorithm 1.
|
| 277 |
+
|
| 278 |
+
# Algorithm 1 Anomaly-Attention Mechanism (multi-head version).
|
| 279 |
+
|
| 280 |
+
Input: $\mathcal { X } \in \mathbb { R } ^ { N \times d _ { \mathrm { m o d e l } } }$ : input; $\mathcal { D } = \left( ( j - i ) ^ { 2 } \right) _ { i , j \in \{ 1 , \cdots , N \} } \in \mathbb { R } ^ { N \times N }$ : relative distance matrix
|
| 281 |
+
Layer params: $\mathtt { M L P _ { i n p u t } }$ : linear projector for input; MLPoutput: linear projector for output
|
| 282 |
+
1: $\begin{array} { r l r } & { \mathrm { 2 , K , \mathcal { V } , \sigma = 5 p l i t \Big ( \mathbb { M } \mathbb { E } _ { \mathrm { i m p l e t } } ( \mathcal { X } ) , \mathbb { d i m } - \mathrm { i } \Big ) } } & { \mathrm { ~ \mathbb { ~ \rho } _ \nu \ \in \mathcal { B } , \mathcal { K } , \mathcal { V } \in \mathbb { R } ^ { N \times d _ { m a t } } , \sigma \in \mathbb { R } ^ { N \times h } ~ } } \\ & { \mathrm { ~ p r ~ } ( \mathcal { Q } _ { m } , \mathcal { K } _ { m } , \mathcal { V } _ { m } , \sigma _ { m } ) \mathrm { ~ i n } ( \mathcal { Q } , \mathcal { K } , \gamma , \sigma ) : } & { \mathrm { ~ \mathbb { ~ \rho } _ \nu Q _ { m } , \mathcal { K } _ { m } , \mathcal { V } _ { m } \in \mathbb { R } ^ { N \times \frac { \mathcal { M } _ { m a t } } { \mathcal { N } _ \nu Q _ { m } } } , \sigma _ { m } \in \mathbb { R } ^ { N \times 1 } ~ } } \\ & { \sigma _ { m } = \mathrm { B r o } \mathrm { d i d } \mathrm { c o s t } ( \sigma _ { m } , \mathcal { \mathrm { d i m } - 1 } ) } & { \mathrm { ~ \mathbb { ~ \rho } _ \nu Q _ { m } \in \mathbb { R } ^ { N \times \frac { \mathcal { N } _ { m a t } } { \mathcal { N } _ \nu Q _ { m } } } ~ } } \\ & { \mathcal { P } _ { m } = \frac { 1 } { \sqrt { 2 \pi \sigma _ { m } } } \exp \Big ( - \frac { \mathcal { P } } { 2 \pi \frac { \mathcal { P } } { 2 } } \Big ) } & { \mathrm { ~ \mathbb { ~ \rho } _ \nu \it ~ \rho ~ \rho ~ \mathbb { ~ P } _ m ~ \in \mathbb { R } ^ { N \times N } ~ } } \\ & { \mathcal { P } _ { m } = \mathcal { P } _ { m } / \mathrm { B r o } \mathrm { d i c a l } \mathrm { c } \Big ( \mathrm { S u m } ( \mathcal { P } _ { m } , \mathcal { \mathrm { d i m } - 1 } ) \Big ) } & { \mathrm { ~ \mathbb { ~ \rho } _ \nu \it ~ \mathrm { R e s c a l e d } ~ \mathcal { P } _ m ~ \in \mathbb { R } ^ { N \times N } ~ } } \\ & { \mathcal { S } _ { m } = \mathrm { S o f } \mathrm { t r m a x } \left( \sqrt { \frac { h } { d _ { m a t } } } Q _ { m } K _ { m } ^ { \Gamma } \right) } & \mathrm { ~ \mathbb { S } ~ } \mathcal { S } _ \end{array}$
|
| 283 |
+
2: f
|
| 284 |
+
3:
|
| 285 |
+
4:
|
| 286 |
+
5:
|
| 287 |
+
6: f
|
| 288 |
+
7: f
|
| 289 |
+
8:
|
| 290 |
+
9: Return . Keep the $\mathcal { P } _ { m }$ and $S _ { m }$ , $m = 1 , \cdots , h$
|
| 291 |
+
|
| 292 |
+
# C MORE SHOWCASES
|
| 293 |
+
|
| 294 |
+
To obtain an intuitive comparison of main results (Table 1), we visualize the criterion of various baselines. Anomaly Transformer can present the most distinguishable criterion (Figure 8). Besides,
|
| 295 |
+
|
| 296 |
+
for the real-world dataset, Anomaly Transformer can also detect the anomalies correctly. Especially for the SWaT dataset (Figure 9(d)), our model can detect the anomalies in the early stage, which is meaningful for real-world applications, such as the early warning of malfunctions.
|
| 297 |
+
|
| 298 |
+

|
| 299 |
+
Figure 8: Visualization of learned criterion for the NeurIPS-TS dataset. Anomalies are labeled by red circles and red segments (first row). The failure cases of the baselines are bounded by red boxes.
|
| 300 |
+
|
| 301 |
+

|
| 302 |
+
Figure 9: Visualization of the model learned criterion in real-world datasets. We select one dimension of the data for visualization. These showcases are from the test set of corresponding datasets.
|
| 303 |
+
|
| 304 |
+
# D ABLATION OF ASSOCIATION DISCREPANCY
|
| 305 |
+
|
| 306 |
+
We present the pseudo code of the calculation in Algorithm 2.
|
| 307 |
+
|
| 308 |
+
# D.1 ABLATION OF MULTI-LEVEL QUANTIFICATION
|
| 309 |
+
|
| 310 |
+
We average the association discrepancy from multiple layers for the final results (Equation 6). We further investigate the model performance under the single-layer usage. As shown in Table 4, the multiple-layer design achieves the best, which verifies the effectiveness of multi-level quantification.
|
| 311 |
+
|
| 312 |
+
Table 4: Model performance under difference selection of model layers for association discrepancy.
|
| 313 |
+
|
| 314 |
+
<table><tr><td rowspan="2">Dataset Metric</td><td colspan="3">SMD</td><td colspan="3">MSL</td><td colspan="3">SMAP</td><td colspan="3">SWaT</td><td colspan="3">PSM</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><td>P</td><td>R</td><td>F1</td><td>P</td><td>R</td><td>F1</td></tr><tr><td>layer 1</td><td></td><td>87.15 92.87</td><td>89.92</td><td>[90.36 94.11</td><td></td><td>92.19</td><td>[93.65 99.03 96.26|</td><td></td><td></td><td>92.61</td><td>91.92</td><td>92.27</td><td>97.20</td><td>97.50</td><td>97.35</td></tr><tr><td>layer 2</td><td>87.22</td><td>95.17</td><td>91.02</td><td>90.82</td><td>92.41</td><td>91.60</td><td>93.69</td><td>98.75 96.15</td><td></td><td>92.48</td><td>92.50</td><td>92.49</td><td>96.12</td><td>98.62</td><td>97.35</td></tr><tr><td>layer 3</td><td>87.27</td><td>93.89</td><td>90.46</td><td>91.61</td><td>88.81</td><td>90.19</td><td>93.40</td><td>98.83</td><td>96.04</td><td>88.75</td><td>91.22</td><td>89.96</td><td>77.25</td><td>94.53</td><td>85.02</td></tr><tr><td>Multiple-layer|</td><td></td><td>[89.40 95.45</td><td>92.33</td><td>|92.09</td><td>95.15</td><td>93.59</td><td>[94.13 99.40 96.69|</td><td></td><td></td><td>[91.55 96.73 94.07|</td><td></td><td></td><td>|96.91</td><td>98.90</td><td>97.89</td></tr></table>
|
| 315 |
+
|
| 316 |
+
# D.2 ABLATION OF STATISTICAL DISTANCE
|
| 317 |
+
|
| 318 |
+
We select the following widely-used statistical distances to calculate the association discrepancy:
|
| 319 |
+
|
| 320 |
+
• Symmetrized Kullback–Leibler Divergence (Ours).
|
| 321 |
+
• Jensen–Shannon Divergence (JSD).
|
| 322 |
+
• Wasserstein Distance (Wasserstein).
|
| 323 |
+
• Cross-Entropy (CE).
|
| 324 |
+
• L2 Distance (L2).
|
| 325 |
+
Table 5: Model performance under different definitions of association discrepancy.
|
| 326 |
+
|
| 327 |
+
<table><tr><td rowspan="2">Dataset Metric</td><td colspan="3">SMD</td><td colspan="3">MSL</td><td colspan="3">SMAP</td><td colspan="3">SWaT</td><td colspan="3">PSM</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><td>P</td><td>R</td><td>F1</td><td>P</td><td>R</td><td>F1</td></tr><tr><td>L2</td><td>85.26</td><td>74.80</td><td>79.69</td><td>85.58</td><td>81.30</td><td>83.39</td><td>91.25</td><td>56.77</td><td>70.00</td><td>79.90</td><td>87.45</td><td>83.51</td><td>70.24</td><td>96.34</td><td>81.24</td></tr><tr><td>CE</td><td>88.23</td><td>81.85</td><td>84.92</td><td>90.07</td><td>86.44</td><td>88.22</td><td>92.37</td><td>64.08</td><td>75.67</td><td>62.78</td><td>81.50</td><td>70.93</td><td>70.71</td><td>94.68</td><td>80.96</td></tr><tr><td>Wasserstein</td><td>78.80</td><td>71.86</td><td>75.17</td><td>60.77</td><td>36.47</td><td>45.58</td><td>90.46</td><td>57.62</td><td>70.40</td><td>92.00</td><td>71.63</td><td>80.55</td><td>68.25</td><td>92.18</td><td>78.43</td></tr><tr><td>JSD</td><td>85.33</td><td>90.09</td><td>87.64</td><td>91.19</td><td>92.42</td><td>91.80</td><td>94.83</td><td>95.14</td><td>94.98</td><td>83.75</td><td>96.75</td><td>89.78</td><td>95.33</td><td>98.58</td><td>96.93</td></tr><tr><td>Ours</td><td>89.40</td><td>95.45</td><td>92.33</td><td>|92.09</td><td>95.15</td><td>93.59</td><td>[94.13</td><td>99.40</td><td>96.69</td><td>91.55</td><td>96.73</td><td>94.07</td><td>|96.91</td><td>98.90</td><td>97.89</td></tr></table>
|
| 328 |
+
|
| 329 |
+
As shown in Table 5, our proposed definition of association discrepancy still achieves the best performance. We find that both the CE and JSD can provide fairly good results, which are close to our definition in principle and can be used to represent the information gain. The L2 distance is not suitable for the discrepancy, which overlooks the property of discrete distribution. The Wasserstein distance also fails in some datasets. The reason is that the prior-association and series-association are exactly matched in the position indexes. Still, the Wasserstein distance is not calculated point by point and considers the distribution offset, which may bring noises to the optimization and detection.
|
| 330 |
+
|
| 331 |
+
<table><tr><td colspan="2">Algorithm 2 Association Discrepancy AssDis(P,S; X) Calculation (multi-head version).</td></tr><tr><td colspan="2">Input: time series length N; layers number L;heads number h; prior-association PallE</td></tr><tr><td colspan="2">RLxhxN×N; series-association Sal ∈ RL ×hxN×N; Dp'eRLxNXN</td></tr><tr><td colspan="2">1: P' = Mean(P,dim=1)</td></tr><tr><td colspan="2">2: S' = Mean(S,dim=1) >S'eRLxNXN</td></tr><tr><td colspan="2"> 3: R'=KL(P',S'),dim=-1) +KL((Ss',P'),d-1)</td></tr><tr><td colspan="2">DR'eRL×N 4: R= Mean(R',dim=0) DReRN×1</td></tr><tr><td colspan="2">5: Return R >Represent the association discrepancy of each time point</td></tr></table>
|
| 332 |
+
|
| 333 |
+
# D.3 ABLATION OF PRIOR-ASSOCIATION
|
| 334 |
+
|
| 335 |
+
In addition to the Gaussian kernel with a learnable scale parameter, we also try to use the power-law kernel $P ( x ; \alpha ) = x ^ { - \alpha }$ with a learnable power parameter $\alpha$ for prior-association, which is also a unimodal distribution. As shown in Table 6, power-law kernel can achieve a good performance in most of the datasets. However, because the scale parameter is easier to optimize than the parameter of power, Gaussian kernel still surpasses the power-law kernel consistently.
|
| 336 |
+
|
| 337 |
+
Table 6: Model performance under different definitions of prior-association. Our Anomaly Transformer adopts the Gaussian kernel as the prior. Power-law refers to the power-law kernel.
|
| 338 |
+
|
| 339 |
+
<table><tr><td rowspan="2">Dataset Metric</td><td colspan="3">SMD</td><td colspan="3">MSL</td><td colspan="3">SMAP</td><td colspan="3">SWaT</td><td colspan="3">PSM</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><td>P</td><td>R</td><td>F1</td><td>P</td><td>R</td><td>F1</td></tr><tr><td>Power-law</td><td>89.41</td><td>92.46</td><td>90.91</td><td>90.95</td><td>85.87</td><td>88.34</td><td>91.95</td><td></td><td>58.2471.31</td><td></td><td>92.52 93.29</td><td>92.90</td><td>96.46</td><td>98.15</td><td>97.30</td></tr><tr><td>Ours</td><td>89.40</td><td>95.45</td><td>92.33</td><td>92.09</td><td>95.15</td><td>93.59</td><td>94.13</td><td>99.40</td><td>96.69</td><td>91.55</td><td>96.73</td><td>94.07</td><td>96.91</td><td>98.90</td><td>97.89</td></tr></table>
|
| 340 |
+
|
| 341 |
+
# E ABLATION OF ASSOCIATION-BASED CRITERION
|
| 342 |
+
|
| 343 |
+
# E.1 CALCULATION
|
| 344 |
+
|
| 345 |
+
We present the pseudo-code of association-based criterion in Algorithm 3.
|
| 346 |
+
|
| 347 |
+
<table><tr><td colspan="2">Algorithm 3 Association-based Criterion An omaly Score(X) Calculation</td></tr><tr><td>Input: time series length N; input time series X ∈ RN×d; reconstruction time series X ∈ RN ×d;</td><td></td></tr><tr><td>association discrepancy AssDis(P,S; X) ∈ RN×1; 1: CAD = Softmax(-AssDis(P,S;X),dim=0)</td><td>CAD ∈ RN×1</td></tr><tr><td>2: CRecon = Mean(x - )2,dim=1)</td><td>> CRecon ∈ RN×1</td></tr><tr><td>3: C = CAD X CRecon</td><td>>C∈RNx1</td></tr><tr><td>4: Return C</td><td></td></tr><tr><td></td><td>> Anomaly score for each time point</td></tr></table>
|
| 348 |
+
|
| 349 |
+
# E.2 ABLATION OF CRITERION DEFINITION
|
| 350 |
+
|
| 351 |
+
We explore the model performance under different definitions of anomaly criterion, including the pure association discrepancy, pure reconstruction performance and different combination methods for association discrepancy and reconstruction performance: addition and multiplication.
|
| 352 |
+
|
| 353 |
+
$$
|
| 354 |
+
\begin{array} { r l } & { \mathrm { t i o n ~ D i s c r e p a n c y : A n o m a l y S c o r e ( \mathcal { X } ) } = \operatorname { S o f t m a x } \Big ( - \mathrm { A s s D i s } ( \mathcal { P } , \mathcal { S } ; \mathcal { X } ) \Big ) , } \\ & { \mathrm { ~ R e c o n s t r u c t i o n : A n o m a l y S c o r e ( \mathcal { X } ) } = \Big [ \big \| \mathcal { X } _ { i , : } - \widehat { \mathcal { X } } _ { i , : } \big \| _ { 2 } ^ { 2 } \Big ] _ { i = 1 , \cdots , N } , } \\ & { \mathrm { ~ A d d i t i o n : ~ A n o m a l y S c o r e ( \mathcal { X } ) } = \operatorname { S o f t m a x } \Big ( - \mathrm { A s s D i s } ( \mathcal { P } , \mathcal { S } ; \mathcal { X } ) \Big ) + \Big [ \big \| \mathcal { X } _ { i , : } - \widehat { \mathcal { X } } _ { i , : } \big \| _ { 2 } ^ { 2 } \Big ] _ { i = 1 , \cdots , N } , } \\ & { \mathrm { t i p l i c a t i o n ~ ( O u r s ) : A n o m a l y S c o r e ( \mathcal { X } ) } = \operatorname { S o f t m a x } \Big ( - \mathrm { A s s D i s } ( \mathcal { P } , \mathcal { S } ; \mathcal { X } ) \Big ) \odot \Big [ \big \| \mathcal { X } _ { i , : } - \widehat { \mathcal { X } } _ { i , : } \big \| _ { 2 } ^ { 2 } \Big ] _ { i = 1 , \cdots , N } } \end{array}
|
| 355 |
+
$$
|
| 356 |
+
|
| 357 |
+
From Table 7, we find that directly using our proposed association discrepancy can also achieve a good performance, which surpasses the competitive baseline THOC (Shen et al., 2020) consistently. Besides, the multiplication combination that we used in Equation 6 performs the best, which can bring a better collaboration to the reconstruction performance and association discrepancy.
|
| 358 |
+
|
| 359 |
+
Table 7: Ablation of criterion definition. We also include the state-of-the-art deep model THOC (Shen et al., 2020) for comparison. AssDis and Recon represent the pure association discrepancy and the pure reconstruction performance respectively. Ours refers to our proposed association-based criterion with the multiplication combination.
|
| 360 |
+
|
| 361 |
+
<table><tr><td rowspan="2">Dataset Metric</td><td colspan="2">SMD</td><td rowspan="2">MSL</td><td colspan="2"></td><td colspan="2">SMAP</td><td rowspan="2"></td><td colspan="3">SWaT</td><td rowspan="2"></td><td colspan="2">PSM</td><td rowspan="2">Avg |F1(%)</td></tr><tr><td>P</td><td>F1</td><td>P</td><td>R F1</td><td>P</td><td>R</td><td>F1</td><td>P R</td><td>F1</td><td>P R</td><td>F1</td></tr><tr><td>THOC</td><td>[79.76 90.95 84.99|845 90.97 89.69|92.06 89.34 90.68|83.94 86.36 85.13|8.14 90.99 89.54|</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>88.01</td></tr><tr><td>Recon</td><td>78.63 65.29 71.35</td><td></td><td></td><td></td><td>579.1578.07 78.61</td><td></td><td>89.38 56.35 69.12</td><td></td><td>76.81</td><td>86.89</td><td>81.53</td><td></td><td>69.84 94.73 80.40</td><td></td><td>76.20</td></tr><tr><td>AssDis</td><td>86.74 88.42 87.57</td><td></td><td></td><td>91.20 89.81 90.50|9</td><td></td><td></td><td>91.56 90.41 90.98</td><td></td><td></td><td>97.27 89.48</td><td>93.21</td><td></td><td>97.80 93.25 95.47</td><td></td><td>91.55</td></tr><tr><td>Addition|</td><td>77.16 70.58 73.73</td><td></td><td></td><td>88.08 87.37 87.72</td><td></td><td></td><td>91.28 55.97 69.39</td><td></td><td></td><td>84.34 81.98 83.14</td><td></td><td></td><td>97.60 97.61 97.61</td><td></td><td>82.32</td></tr><tr><td>Ours</td><td>89.40 95.45 92.33</td><td></td><td></td><td>92.09 95.15 93.59</td><td></td><td></td><td>94.13 99.40 96.69</td><td></td><td>91.55</td><td>96.73</td><td>94.07</td><td></td><td>96.91 98.90 97.89</td><td></td><td>94.96</td></tr></table>
|
| 362 |
+
|
| 363 |
+
# F CONVERGENCE OF MINIMAX OPTIMIZATION
|
| 364 |
+
|
| 365 |
+
The total loss of our model (Equation 4) contains two parts: the reconstruction loss and the association discrepancy. Towards a better control of association learning, we adopt a minimax strategy for optimization (Equation 5). During the minimization phase, the optimization trends to minimize the association discrepancy and the reconstruction error. During the maximization phase, the optimization trends to maximize the association discrepancy and minimize the reconstruction error.
|
| 366 |
+
|
| 367 |
+
We plot the change curve of the above two parts during the training procedure. As shown in Figures 10 and 11, both parts of the total loss can converge within limited iterations on all the five real-world datasets. This nice convergence property is essential for the optimization of our model.
|
| 368 |
+
|
| 369 |
+

|
| 370 |
+
1614 1614 1614Figure 10: Change curve of reconstruction loss 0.5 0.5 $\| \chi _ { - } \widehat { \chi } \| _ { \mathrm { F } } ^ { 2 }$ 16 1614in real-world datasets during training.1 0.4
|
| 371 |
+
|
| 372 |
+

|
| 373 |
+
Figure 11: Change curve of association discrepancy $\| \mathrm { A s s D i s } ( \mathcal { P } , \mathcal { S } ; \mathcal { X } ) \| _ { 1 }$ in real-world datasets during the training process.
|
| 374 |
+
|
| 375 |
+
# G MODEL PARAMETER SENSITIVITY
|
| 376 |
+
|
| 377 |
+
In this paper, we set the hyper-parameters $L$ and $d _ { \mathrm { m o d e l } }$ following the convention of Transformers (Vaswani et al., 2017; Zhou et al., 2021).
|
| 378 |
+
|
| 379 |
+
Furthermore, to evaluate model parameter sensitivity, we investigate the performance and efficiency under different choices for the number of layers $L$ and hidden channels $d _ { \mathrm { m o d e l } }$ . Generally, increasing the model size can obtain better results but with larger memory and computation costs.
|
| 380 |
+
|
| 381 |
+
Table 8: Model performance under different choices of the number of layers $L$
|
| 382 |
+
|
| 383 |
+
<table><tr><td rowspan="2">Dataset| Metric</td><td colspan="3">SMD</td><td colspan="3">MSL</td><td colspan="3">SMAP</td><td colspan="3">SWaT</td><td colspan="3">PSM</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><td>P</td><td>R</td><td>F1</td><td>P</td><td>R</td><td>F1</td></tr><tr><td>L=1</td><td></td><td>89.24 93.73</td><td>91.43</td><td></td><td>91.99 97.599</td><td>94.71</td><td>93.58 99.35 96.38</td><td></td><td></td><td>91.57</td><td>95.33</td><td>93.42</td><td></td><td>96.74 98.09</td><td>97.41</td></tr><tr><td>L=2</td><td>89.26</td><td>94.33</td><td>91.72</td><td>91.89</td><td>94.73</td><td>93.29</td><td>93.79</td><td>98.91</td><td>96.28</td><td>92.37</td><td>94.59</td><td>93.47</td><td>97.22</td><td>98.23</td><td>97.72</td></tr><tr><td>L=3</td><td>89.40</td><td>95.45 92.33</td><td></td><td></td><td>92.09 95.15 93.59</td><td></td><td>94.13 99.40 96.69</td><td></td><td></td><td>91.55</td><td>96.73 94.07</td><td></td><td>96.91</td><td>98.90</td><td>97.89</td></tr><tr><td>L=4</td><td>89.59</td><td>95.76 92.58</td><td></td><td></td><td>91.88 95.40 93.61</td><td></td><td>93.75 99.13 96.37</td><td></td><td></td><td>93.37</td><td>93.45 93.41</td><td></td><td>97.30</td><td>97.58 97.44</td><td></td></tr></table>
|
| 384 |
+
|
| 385 |
+
Table 9: Model performance under different choices of the number of hidden channels $d _ { \mathrm { m o d e l } }$ . Mem means the averaged GPU memory cost. Time is the averaged running time of 100 iterations during the training process.
|
| 386 |
+
|
| 387 |
+
<table><tr><td rowspan="3">Dataset Metric</td><td colspan="2">SMD</td><td colspan="2">MSL</td><td colspan="2"></td><td colspan="2">SMAP</td><td colspan="2">SWaT</td><td colspan="2">PSM</td><td colspan="2">Mem'</td><td colspan="2">Time</td></tr><tr><td>P</td><td>R</td><td>F1</td><td>P</td><td>R F1</td><td>P</td><td>R</td><td>F1</td><td>P R</td><td>F1</td><td>P</td><td>R</td><td>F1</td><td>(GB)</td><td></td><td>(s)</td></tr><tr><td>dmodel =256</td><td>88.83 91.82 90.30|91.96 97.60 94.709</td><td></td><td></td><td></td><td></td><td></td><td>93.74 99.47 96.52</td><td></td><td>293.91 93.99 93.95</td><td></td><td></td><td>597.38 98.16 97.77</td><td></td><td></td><td>4.9</td><td>0.12</td></tr><tr><td>dmodel = 512</td><td>89.40 95.45 92.33</td><td></td><td></td><td>92.09 95.15 93.59</td><td></td><td></td><td>94.13 99.40 96.69</td><td></td><td>91.55 96.73 94.07</td><td></td><td></td><td>96.91 98.90 97.89</td><td></td><td></td><td>5.5</td><td>0.15</td></tr><tr><td>dmodel = :1024</td><td>89.44 96.33 92.769</td><td></td><td></td><td>91.80 94.99 93.37</td><td></td><td></td><td>93.58 99.47 96.43</td><td></td><td>92.02 95.0193.49</td><td></td><td></td><td>95.78 98.12 96.94</td><td></td><td></td><td>6.6</td><td>0.27</td></tr></table>
|
| 388 |
+
|
| 389 |
+
# H PROTOCOL OF THRESHOLD SELECTION
|
| 390 |
+
|
| 391 |
+
Our paper focuses on unsupervised time series anomaly detection. Experimentally, each dataset includes training, validation and testing subsets. Anomalies are only labeled in the testing subset. Thus, we select the hyper-parameters following the Gap Statistic method (Tibshirani et al., 2001) in K-Means. Here is the selection procedure:
|
| 392 |
+
|
| 393 |
+
• After the training phase, we apply the model to the validation subset (without label) and obtain the anomaly scores (Equation 6) of all time points. • We count the frequency of the anomaly scores in the validation subset. It is observed that the distribution of anomaly scores is separated into two clusters. We find that the cluster with a larger anomaly score contains $r$ time points. And for our model, $r$ is closed to $0 . 1 \%$ , $0 . 5 \%$ , $1 \%$ for SWaT, SMD and other datasets respectively (Table 10). Due to the size of the test subset being still inaccessible in real-world applications, we have to fix the threshold as a fixed value $\delta$ , which can gaurantee that the anomaly scores of $r$ time points in the validation set are larger than $\delta$ and thus detected as anomalies.
|
| 394 |
+
|
| 395 |
+
(a) SMD, MSL and SWaT datasets.
|
| 396 |
+
|
| 397 |
+
Table 10: Statistical results of anomaly score distribution on the validation set. We count the number of time points with corresponding values in several intervals.
|
| 398 |
+
|
| 399 |
+
<table><tr><td>Anomaly Score Interval</td><td>SMD</td><td>MSL</td><td>SWaT</td></tr><tr><td>(0,+∞0]</td><td>141681</td><td>11664</td><td>99000</td></tr><tr><td>[0,10-2]</td><td>140925</td><td>11537</td><td>98849</td></tr><tr><td>(10-²,0.1]</td><td>2</td><td>8</td><td>17</td></tr><tr><td>(0.1,+00]</td><td>754</td><td>119</td><td>134</td></tr><tr><td>Ratio of (0.1, +00]</td><td>0.53%</td><td>1.02%</td><td>0.14%</td></tr></table>
|
| 400 |
+
|
| 401 |
+
(b) SMAP and PSM datasets.
|
| 402 |
+
|
| 403 |
+
<table><tr><td>Anomaly Score Interval</td><td>SMAP</td><td>PSM</td></tr><tr><td>(0,+∞0]</td><td>27037</td><td>26497</td></tr><tr><td>[0,10-3] (10-3,10-2] (10-²,+∞0]</td><td>26732 0 305</td><td>26223 5 269</td></tr><tr><td>Ratio of (10-²,+∞0]</td><td>1.12%</td><td>1.01%</td></tr></table>
|
| 404 |
+
|
| 405 |
+
Note that, directly setting the $\delta$ is also feasible. According to the intervals in Table 10, we can fix the $\delta$ as 0.1 for the SMD, MSL and SWaT datasets, 0.01 for the SMAP and PSM datasets, which yield a quite close performance to setting $r$ .
|
| 406 |
+
|
| 407 |
+
Table 11: Model performance. Choose by $\delta$ means that we fix $\delta$ as 0.1 for the SMD, MSL and SWaT datasets, 0.01 for the SMAP and PSM datasets. Choose by $r$ means that we select $r$ as $0 . 1 \%$ for SWaT, $0 . 5 \%$ for SMD and $1 \%$ for the other datasets.
|
| 408 |
+
|
| 409 |
+
<table><tr><td rowspan="3">Dataset Metric</td><td colspan="3">SMD</td><td colspan="3">MSL</td><td colspan="3">SMAP</td><td colspan="3">SWaT</td><td colspan="3">PSM</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><td>P</td><td>R</td><td>F1</td><td>P</td><td>R</td><td>F1</td></tr><tr><td>Choose by δ|</td><td>88.65</td><td>97.17</td><td>92.71</td><td>[91.86 95.15 93.47</td><td></td><td></td><td></td><td>97.69 98.24 97.96</td><td></td><td></td><td>[86.02 95.01 90.29</td><td></td><td></td><td>97.69</td><td>98.24</td><td>97.96</td></tr><tr><td>Choose by r</td><td>89.40</td><td>95.45</td><td>92.33</td><td>92.09</td><td>95.15</td><td></td><td>93.59</td><td>94.13 99.40 96.69</td><td></td><td></td><td>91.55 96.73</td><td></td><td>94.07</td><td>96.91</td><td>98.90</td><td>97.89</td></tr></table>
|
| 410 |
+
|
| 411 |
+
In real-world applications, the number of selected anomalies is always decided up to human resources. Under this consideration, setting the number of detected anomalies by the ratio $r$ is more practical and easier to decide according to the available resources.
|
| 412 |
+
|
| 413 |
+
# I MORE BASELINES
|
| 414 |
+
|
| 415 |
+
In addition to the time series anomaly detection methods, the methods for change point detection and time series segmentation can also perform as valuable baselines. Thus, we also include the BOCPD (Adams & MacKay, 2007) and TS-CP2 (Deldari et al., 2021) from change point detection and UTime (Perslev et al., 2019) from time series segmentation for comparison. Anomaly Transformer still achieves the best performance.
|
| 416 |
+
|
| 417 |
+
Table 12: Additional quantitative results for Anomaly Transformer (Ours) in five real-world datasets. The $P$ , $R$ and $F l$ represent the precision, recall and F1-score $( \mathrm { a s \% } )$ ) respectively. F1-score is the harmonic mean of precision and recall. For these metrics, a higher value indicates a better performance.
|
| 418 |
+
|
| 419 |
+
<table><tr><td rowspan="2">Dataset Metric</td><td colspan="3">SMD</td><td colspan="3">MSL</td><td colspan="3">SMAP</td><td colspan="3">SWaT</td><td colspan="3">PSM</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><td>P</td><td>R</td><td>F1</td><td>P</td><td>R</td><td>F1</td></tr><tr><td>BOCPD</td><td>70.90</td><td>82.04</td><td>76.07</td><td>80.32</td><td>87.20</td><td>83.62</td><td>84.65</td><td>85.85</td><td>85.24</td><td>89.46</td><td>70.75</td><td>79.01</td><td>80.22</td><td>75.33</td><td>77.70</td></tr><tr><td>TS-CP2</td><td>87.42</td><td>66.25</td><td>75.38</td><td>86.45</td><td>68.48</td><td>76.42</td><td>87.65</td><td>83.18</td><td>85.36</td><td>81.23</td><td>74.10</td><td>77.50</td><td>82.67</td><td>78.16</td><td>80.35</td></tr><tr><td>U-Time</td><td>65.95</td><td>74.75</td><td>70.07</td><td>57.20</td><td>71.66</td><td>63.62</td><td>49.71</td><td>56.18</td><td>52.75</td><td>46.20</td><td>87.94</td><td>60.58</td><td>82.85</td><td>79.34</td><td>81.06</td></tr><tr><td>Ours</td><td>89.40</td><td>95.45</td><td>92.33</td><td>92.09</td><td>95.15</td><td>93.59</td><td>94.13</td><td>99.40</td><td>96.69</td><td>91.55</td><td>96.73</td><td>94.07</td><td>96.91</td><td>98.90</td><td>97.89</td></tr></table>
|
| 420 |
+
|
| 421 |
+
# J LIMITATIONS AND FUTURE WORK
|
| 422 |
+
|
| 423 |
+
Window size As shown in the Figure 7 of Appendix A, the model may fail if the window size is too small for association learning. But the Transformers is with quadratic complexity w.r.t. the window size. The trade-off is needed for real-world applications.
|
| 424 |
+
|
| 425 |
+
Theoretical analysis As a well-established deep model, the performance of Transformers has been explored in previous works. But it is still under-exploring for the theory of complex deep models. In the future, we will explore the theorem of Anomaly Transformer for better justifications in light of classic analysis for autoregression and state space models.
|
| 426 |
+
|
| 427 |
+
# K DATASET
|
| 428 |
+
|
| 429 |
+
Here is the statistical details of experiment datasets.
|
| 430 |
+
|
| 431 |
+
Table 13: Details of benchmarks. AR represents the truth abnormal proportion of the whole dataset.
|
| 432 |
+
|
| 433 |
+
<table><tr><td>Benchmarks</td><td>Applications</td><td>Dimension</td><td>Window</td><td>#Training</td><td>#Validation</td><td>#Test (labeled)</td><td>AR (Truth)</td></tr><tr><td>SMD</td><td>Server</td><td>38</td><td>100</td><td>566,724</td><td>141,681</td><td>708,420</td><td>0.042</td></tr><tr><td>PSM</td><td>Server</td><td>25</td><td>100</td><td>105,984</td><td>26.497</td><td>87,841</td><td>0.278</td></tr><tr><td>MSL</td><td>Space</td><td>55</td><td>100</td><td>46,653</td><td>11,664</td><td>73,729</td><td>0.105</td></tr><tr><td>SMAP</td><td>Space</td><td>25</td><td>100</td><td>108,146</td><td>27,037</td><td>427,617</td><td>0.128</td></tr><tr><td>SWaT</td><td>Water</td><td>51</td><td>100</td><td>396.000</td><td>99,000</td><td>449,919</td><td>0.121</td></tr><tr><td>NeurIPS-TS</td><td>Various Anomalies</td><td>1</td><td>100</td><td>20.000</td><td>10.000</td><td>20.000</td><td>0.018</td></tr></table>
|
| 434 |
+
|
| 435 |
+
# L UCR DATASET
|
| 436 |
+
|
| 437 |
+
UCR Dataset is a very challenging and comprehensive dataset provided by the Multi-dataset Time Series Anomaly Detection Competition of KDD2021 (Keogh et al., Competition of International Conference on Knowledge Discovery & Data Mining 2021). The whole dataset contains 250 subdatasets, covering various real-world scenarios. Each sub-dataset of UCR has only one anomaly segment and only has one dimension. These sub-datasets range in length from 6,684 to 900,000 and are pre-divided into training and test sets.
|
| 438 |
+
|
| 439 |
+
We also experiment on the UCR dataset for a wide evaluation. As show in Table 14, our Anomaly Transformer still achieves the state-of-the-art in this challenging benchmark.
|
| 440 |
+
|
| 441 |
+
Table 14: Quantitative results in UCR Dataset. $I F$ refers to the IsolationForest (2008). Ours is our Anomaly Transformer. $P , R$ and $F l$ represent the precison, recall and F1-score $( \% )$ respectively.
|
| 442 |
+
|
| 443 |
+
<table><tr><td>Metric</td><td>LSTM-VAE</td><td>InterFusion</td><td>OmniAnomaly</td><td>THOC</td><td>Deep-SVDD</td><td>BeatGAN</td><td>LOF</td><td>OC-SVM</td><td>IF</td><td>Ours</td></tr><tr><td>P</td><td>62.08</td><td>60.74</td><td>64.21</td><td>54.61</td><td>47.08</td><td>45.20</td><td>41.47</td><td>41.14</td><td>40.77</td><td>72.80</td></tr><tr><td>R</td><td>97.60</td><td>95.20</td><td>86.93</td><td>80.83</td><td>88.91</td><td>88.42</td><td>98.80</td><td>94.00</td><td>93.60</td><td>99.60</td></tr><tr><td>F1</td><td>75.89</td><td>74.16</td><td>73.86</td><td>65.19</td><td>61.56</td><td>59.82</td><td>58.42</td><td>57.23</td><td>56.80</td><td>84.12</td></tr></table>
|
md/dev/M2sNIiCC6C/M2sNIiCC6C.md
ADDED
|
@@ -0,0 +1,564 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SELF-SUPERVISED REGRESSION LEARNING USING DOMAIN KNOWLEDGE: APPLICATIONS TO IMPROVING SELF-SUPERVISED IMAGE DENOISING
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Regression that predicts continuous quantity is a central part of applications using computational imaging and computer vision technologies. Yet, studying and understanding self-supervised learning for regression tasks – except for a particular regression task, image denoising – have lagged behind. This paper proposes a general self-supervised regression learning (SSRL) framework that enables learning regression neural networks with only input data (but without ground-truth target data), by using a designable operator that encapsulates domain knowledge of a specific application. The paper underlines the importance of domain knowledge by showing that under some mild conditions, the better designable operator is used, the proposed SSRL loss becomes closer to ordinary supervised learning loss. Numerical experiments for camera image denoising and low-dose computational tomography denoising demonstrate that proposed SSRL significantly improves the denoising quality over several existing self-supervised denoising methods.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Deep regression neural network (NN)-based methods that can accurately predict real- or complexvalued output have been rapidly gaining popularity in a wide range of computational imaging and computer vision applications including image denoising (Vincent et al., 2010; Xie et al., 2012; Zhang et al., 2017), image deblurring $\mathrm { { X u } }$ et al., 2014), image super-resolution (Dong et al., 2016; Kim et al., 2016), light-field reconstruction (Chun et al., 2020; Huang et al., 2020), object localization (Szegedy et al., 2013), end-to-end autonomous driving (Bojarski et al., 2016). Yet, they lack a general self-supervised learning framework.
|
| 12 |
+
|
| 13 |
+
In training a regression NN $f : \mathbb { R } ^ { N } \to \mathbb { R } ^ { M }$ , the most prevalent supervised learning approach minimizes the mean square error (MSE) between what $f$ predicts from an input $x \in \overline { { \mathbb { R } } } ^ { N }$ and a ground-truth target y ∈ RM :
|
| 14 |
+
|
| 15 |
+
$$
|
| 16 |
+
\operatorname* { m i n } _ { f } \mathbb { E } _ { x , y } { \| f ( x ) - y \| _ { 2 } ^ { 2 } } .
|
| 17 |
+
$$
|
| 18 |
+
|
| 19 |
+
Learning a denoising or refining NN uses (1) with $M = N$ – dubbed Noise2True – where $x$ is a corrupted image and $y$ is a clean (i.e., ground-truth) image. However, it is challenging or even impossible to collect many clean images $y$ in many practical applications, motivating research on self-supervised learning for image denoising (Ulyanov et al., 2018; Soltanayev & Chun, 2018; Krull et al., 2019; Batson $\&$ Royer, 2019; Laine et al., 2019; Moran et al., 2020; Quan et al., 2020; Xu et al., 2020; Hendriksen et al., 2020; Xie et al., 2020; Huang et al., 2021) – called self-supervised image denoising. To learn a denoiser $f$ with single noisy images, a popular self-supervised image denoising method, Noise2Self (Batson & Royer, 2019) (see also the concurrent work (Krull et al., 2019)), and its sophisticated relaxation, Noise2Same (Xie et al., 2020), study the following MSE minimization problem:
|
| 20 |
+
|
| 21 |
+
$$
|
| 22 |
+
\operatorname* { m i n } _ { f } \mathbb { E } _ { x } \| f ( x ) - x \| _ { 2 } ^ { 2 } .
|
| 23 |
+
$$
|
| 24 |
+
|
| 25 |
+
These methods use some partitioning schemes in (2) to avoid that its optimal solution is just the identity mapping $\mathcal { T }$ . Noise2Noise (Lehtinen et al., 2018) that learns a denoiser with pairs of two independent noisy images, is a pioneer work for self-supervised image denoising. Motivated by Noise2Noise, several self-supervised image denoising methods such as Noise2Inverse (Hendriksen et al., 2020), Neighbor2Neighbor (Huang et al., 2021), and (Soltanayev & Chun, 2018; Moran et al., 2020; Xu et al., 2020) emulate pairs of two independent noisy images, by applying partitioning or adding simulated noise to single noisy measurements. All the aforementioned methods have been developed based on some noise assumptions including pixel-wise independent noise (Krull et al., 2019; Xie et al., 2020; Huang et al., 2021) and zero-mean noise (Lehtinen et al., 2018; Batson & Royer, 2019; Xie et al., 2020). Yet, they lack design flexibility that might relax such noise assumptions and further improve the denoising performance of NNs. Some works estimate statistical parameters of noise, such as noise histogram (Krull et al., 2020) and parameters of Gaussian mixture noise model (Prakash et al., 2021).
|
| 26 |
+
|
| 27 |
+
This paper presents new insights on this topic. The paper proposes a general self-supervised learning framework for regression problems, which we refer to as self-supervised regression learning (SSRL). Proposed SSRL enables learning regression NNs with only input samples, by using a designable operator that can encapsulate domain knowledge of a specific application. Our main results show that under some mild conditions (e.g., in image denoising, statistical noise properties in $x _ { \mathrm { ~ } }$ ), the better desinable operator is used, the proposed SSRL loss becomes closer to ordinary supervised learning loss. In addition, a designable operator with good domain knowledge can relax noise assumptions of existing self-supervised denoising methods. Numerical experiments for camera image and low-dose computational tomography (CT) denoising with both simulated and real-world datasets – corrupted by only single noise realization – demonstrate that the proposed SSRL framework significantly improves denoising quality compared to several existing self-supervised denoising methods. Put together, our findings provide new insights into how using good domain knowledge can improve self-supervised denoising, underscoring the benefits of understanding application-specific knowledge in SSRL. (Section S.1 further elaborates the contributions of the paper.)
|
| 28 |
+
|
| 29 |
+
# 2 SSRL USING DOMAIN KNOWLEDGE
|
| 30 |
+
|
| 31 |
+
The proposed SSRL loss is given by
|
| 32 |
+
|
| 33 |
+
$$
|
| 34 |
+
\mathbb { E } _ { x } \Vert f ( x ) - g ( x ) \Vert _ { 2 } ^ { 2 } ,
|
| 35 |
+
$$
|
| 36 |
+
|
| 37 |
+
where $g : \mathbb { R } ^ { N } \to \mathbb { R } ^ { M }$ is a designable operator encapsulating domain knowledge of a specific application. We will incorporate some sophisticated setups in (3) such that $f$ obtained by minimizing (3) cannot merely be $g$ . Although related theorems (see later) hold for any $M$ , we mainly focus on practical image denoising applications with pseudo-target $g ( x ) \not \approx y$ .
|
| 38 |
+
|
| 39 |
+
# 2.1 MOTIVATION
|
| 40 |
+
|
| 41 |
+
This section empirically shows that understanding domain knowledge is important for designing $g$ in the proposed SSRL loss (3). The following camera image denoising examples demonstrate that well-designed $g$ with good domain knowledge improves the denoising performance of learned $f$ via (3).
|
| 42 |
+
|
| 43 |
+
Suppose that camera images are corrupted by salt-and-pepper noise. Consider two example setups for $g ( \cdot )$ , median filtering and BM3D denoiser (Makinen et al., 2020), denoted by ¨ median $( \cdot )$ and BM3D(·), respectively. Figure 1 compares the denoising performance of minimum $f ^ { \star }$ with the two aforementioned $g$ setups: $f ^ { \star }$ with median filtering significantly im
|
| 44 |
+
|
| 45 |
+

|
| 46 |
+
Figure 1: Error map comparisons of denoised images from (3) using $g ( x ) = { \mathrm { m e d i a n } } ( x )$ (left) and $g ( x ) \ = \ \mathsf { B M } 3 \mathsf { D } ( x )$ (right) (blue and yellow denote 0 and 50 absolute errors, respectively). Peak signal-to-noise ratio (PSNR) values are averaged.
|
| 47 |
+
|
| 48 |
+
proved that with BM3D denoiser. This is not surprising, as median filtering is widely known to be effective in reducing salt-and-pepper noise (Bovik, 2010, $\ S 3 . 2 )$ . This result emphasizes the importance of understanding domain knowledge of specific applications in proposed SSRL.
|
| 49 |
+
|
| 50 |
+
# 2.2 PRELIMINARIES
|
| 51 |
+
|
| 52 |
+
We first introduce the $\mathcal { I }$ -complement between two functions $f$ and $g$ :
|
| 53 |
+
|
| 54 |
+
Definition 1. For a given partition $\mathcal { I } = \{ J _ { 1 } , \ldots , J _ { B } \} ( | J _ { 1 } | + \ldots + | J _ { B } | = N )$ of the dimensions of input $\boldsymbol { x } \in \mathbb { R } ^ { N }$ , functions $f : \mathbb { R } ^ { N } \to \bar { \mathbb { R } ^ { M } }$ and $g : \mathbb { R } ^ { N } \to \mathbb { R } ^ { M }$ are called $\mathcal { I }$ -complementary, $i f$ $f ( x _ { J ^ { c } } )$ does not depend on $g ( x _ { J } )$ for all $J \in \mathcal { I }$ , where $J ^ { c }$ denotes the complement of $J$ , and $( \cdot ) _ { J }$ denotes a vector restricted to $J$ .
|
| 55 |
+
|
| 56 |
+
That is, $f$ and $g$ use information from outside and inside of $J$ to predict output and give pseudotarget, respectively. In denoiser learning (where $M \ = \ N )$ ), Definition 1 specializes to the $\mathcal { I }$ - invariance of $f$ (Batson & Royer, 2019), by setting $g = \mathcal { Z }$ . Incorporating Definition 1 into the SSRL loss (3) is a straightforward approach to avoid that optimal $f$ is just $g$ in (3). The proposed SSRL framework assumes the followings:
|
| 57 |
+
|
| 58 |
+
Assumption $^ { l }$ ) $x _ { J }$ and $x J c$ are conditionally independent given $y$ , i.e., $p ( x | y ) = p ( x _ { J } | y ) p ( x _ { J ^ { c } } | y )$ .
|
| 59 |
+
Assumption 2) $\mathbb { E } [ g ( x ) | y ] = y$ .
|
| 60 |
+
Assumption 3) $f$ and $g$ are (Borel-)measurable.
|
| 61 |
+
|
| 62 |
+
In denoiser learning, Assumption 1 holds if noise in each subset $J \in \mathcal { I }$ is conditionally independent from that in $J ^ { c }$ , given $y$ . Assumption 1 can be satisfied in general regression NN learning, by adding small randomized perturbations (independent of $y$ ) to either $J$ or $J ^ { c }$ , similar to Moran et al. (2020). Assumption 2 suggests a direction for designing $g$ : suppose that $x$ has non-zero-mean noise; one then can design $g$ to make noise zero-mean using the domain knowledge. Assumption 3 is satisfied if $f$ and $g$ are continuous. This condition is mild because many regression NNs $f$ are continuous – where their modules, convolution, matrix-vector multiplication, rectified linear unit activation, max pooling, etc. are continuous – and one can design $g$ with measurable or continuous function.
|
| 63 |
+
|
| 64 |
+
Finally, observe that the proposed SSRL loss (3) can be rewritten by
|
| 65 |
+
|
| 66 |
+
$$
|
| 67 |
+
\begin{array} { r } { \mathbb { E } _ { x } \| f ( x ) - g ( x ) \| _ { 2 } ^ { 2 } = \mathbb { E } _ { x , y } \| f ( x ) - y \| _ { 2 } ^ { 2 } + \| g ( x ) - y \| _ { 2 } ^ { 2 } - 2 \langle f ( x ) - y , g ( x ) - y \rangle . } \end{array}
|
| 68 |
+
$$
|
| 69 |
+
|
| 70 |
+
We aim to either remove or control the third term, incorporating the $\mathcal { I }$ -complement and/or Assumptions 1-3 introduced above.
|
| 71 |
+
|
| 72 |
+
# 2.3 SSRL USING DOMAIN KNOWLEDGE WITH $\mathcal { I }$ -COMPLEMENT
|
| 73 |
+
|
| 74 |
+
This section studies SSRL loss (3) minimization over $f$ that is $\mathcal { I }$ -complementary of $g$ . Our first main result shows that under Assumptions 1–3, the SSRL loss (3) with the $\mathcal { I }$ -complement is the sum of the ordinary supervised learning loss and variance of $g ( x ) - y$ , i.e., the third term in (4) vanishes.
|
| 75 |
+
|
| 76 |
+
Theorem 2. Under Assumptions 1–3, the SSRL loss (3) with the $\mathcal { I }$ -complement in Definition $^ { l }$ becomes
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
\begin{array} { r } { \mathbb { E } _ { x } \| f ( x ) - g ( x ) \| _ { 2 } ^ { 2 } = \mathbb { E } _ { x , y } \| f ( x ) - y \| _ { 2 } ^ { 2 } + \| g ( x ) - y \| _ { 2 } ^ { 2 } . } \end{array}
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
The following equality similarly holds for any $K \in \kappa$ : $\mathbb { E } _ { x } \| f ( x ) _ { K } - g ( x ) _ { K } \| _ { 2 } ^ { 2 } = \mathbb { E } _ { x , y } \| f ( x ) _ { K } -$ $y _ { K } \| _ { 2 } ^ { 2 } + \| g ( x ) _ { K } - y _ { K } \| _ { 2 } ^ { 2 }$ , where $\kappa$ is a partition of $\{ 1 , \dots , M \}$ , and $f ( \cdot ) _ { K }$ and $g ( \cdot ) _ { K }$ denote $f ( \cdot )$ and $g ( \cdot )$ restricted to $K$ , respectively. The optimal solution for (5) is given by
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
\begin{array} { r } { f ^ { \star } ( x _ { J ^ { c } } ) = \mathbb { E } [ g ( x _ { J } ) | x _ { J ^ { c } } ] = \mathbb { E } [ y | x _ { J ^ { c } } ] . } \end{array}
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
Proof. See Section A.1 in the appendix.
|
| 89 |
+
|
| 90 |
+
The result (6) suggests another direction for designing $g$ : we aim to design good $g$ that can make $g ( x _ { J } )$ close to $y$ . Using such $g$ , optimal solution of LHS in (6), $\mathbb { E } [ g ( x _ { J } ) | x _ { J ^ { c } } ]$ , becomes close to its supervision counterpart, $\mathbb { E } \lfloor y \vert x _ { J ^ { c } } \rfloor$ . Consequently, such $g$ reduces the second term $\mathbb { E } _ { x , y } \lVert g ( x ) - y \rVert _ { 2 } ^ { 2 }$ in RHS of (5), leading (3) closer to (1). If $g$ is ideal such that $g ( x _ { J } ) = y$ , the SSRL loss (3) becomes the usual supervised learning loss. In designing $g$ , domain knowledge of specific application is crucial. Domain knowledge includes noise properties in $x$ and pre-trained NN by existing self-supervised denoising, such as Noise2Self (Batson $\&$ Royer, 2019) and Noise2Noise (Lehtinen et al., 2018).
|
| 91 |
+
|
| 92 |
+
Specifically, the proposed SSRL loss using the $\mathcal { I }$ -complement is given by
|
| 93 |
+
|
| 94 |
+
$$
|
| 95 |
+
\mathcal { L } _ { \mathrm { i n d } } ( f ) \overset { \Delta } { = } \sum _ { J \in \mathcal { I } } \mathbb { E } _ { x } \Vert f ( x _ { J ^ { c } } ) - g ( x _ { J } ) \Vert _ { 2 } ^ { 2 } .
|
| 96 |
+
$$
|
| 97 |
+
|
| 98 |
+

|
| 99 |
+
Figure 2: Proposed SSRL models using the $\mathcal { I }$ -complement in denoiser learning. Top: $f$ and $g$ use almost equal amount of information from input, i.e., $\vert J \vert \approx \vert J ^ { c } \vert$ , where $J$ and $J ^ { c }$ are complementary checkerboard masks. Bottom: $f$ and $g$ use unbalanced amount of information from input, specifically, $\left| J ^ { c } \right| \gg \left| J \right|$ .
|
| 100 |
+
|
| 101 |
+
Figure 2 illustrates (7) with complementary checkerboard masks $J ^ { c }$ and $J$ , where $f$ and $g$ use almost equal amount of information, and its variant, where $g$ uses much less information than $f$ . The variant computes MSE only on $J \in \mathcal { I }$ ; in this setup, it is challenging for $g$ to predict the entire image.
|
| 102 |
+
|
| 103 |
+
Relation to previous self-supervised denoising works. In denoiser learning, the proposed SSRL loss (3) with the $\mathcal { I }$ -complement of $f$ and $g = \mathcal { Z }$ specializes to (2) with the $\mathcal { I }$ -invariance of $f$ , i.e., Noise2Self. Noise2Inverse (Hendriksen et al., 2020) and Neighbor2Neighbor (Huang et al., 2021) that emulate pairs of two independent noisy images by partitioning single measurements (e.g., CT ray measurements with independent noise and corrupted images with pixel-wise independent noise) can be viewed as Noise2Self. Thus, SSRL loss (3) with the $\mathcal { I }$ -complement of $f$ and $g = \mathcal { T }$ specializes to the aforementioned Noise2Noise-motivated self-supervised denoising methods. (Noise2Noise also can be viewed by SSRL (3) with the setup above, by constructing $x$ with stacking two independent noisy images, where an image is corrupted by two independent noise realizations.)
|
| 104 |
+
|
| 105 |
+
# 2.4 SSRL USING DOMAIN KNOWLEDGE WITHOUT $\mathcal { I }$ -COMPLEMENT
|
| 106 |
+
|
| 107 |
+
This section studies the SSRL loss (3) without using the $\mathcal { I }$ -complement in Definition 1. Observe by (4) that $\begin{array} { r } { \mathbb { E } _ { x , y } \| f ( x ) - y \| _ { 2 } ^ { 2 } + \| g ( x , \ j ) - y \| _ { 2 } ^ { 2 } = \mathbb { E } _ { x } \| f ( x ) - g ( x , \ j ) \| _ { 2 } ^ { 2 } + 2 \mathbb { E } _ { x , y } \langle f ( x ) - f ( x , \ j ) \| _ { 2 } ^ { 2 } . } \end{array}$ $y , g ( x _ { J } ) - y \rangle$ . Inspired by Noise2Same (Xie et al., 2020), the second proposed SSRL approach is to minimize an approximation of the right hand side in this equation that does not assume that $f$ and $g$ are $\mathcal { I }$ -complementary. Our second main result finds an upper bound for the term $\mathbb { E } _ { x , y } \langle f ( x ) - y , g ( x _ { J } ) - y \rangle$ without relying on the $\mathcal { I }$ -complement (remind that this term vanishes if $f$ and $g$ are $\mathcal { I }$ -complementary; see Theorem 2).
|
| 108 |
+
|
| 109 |
+
Theorem 3. Assume that $\mathrm { V a r } ( g ( x _ { J } ) _ { m } | y ) \leq \sigma ^ { 2 }$ , ∀m. Under Assumptions 1–3, the following bound holds:
|
| 110 |
+
|
| 111 |
+
$$
|
| 112 |
+
\mathbb { E } _ { x , y } \langle f ( x ) - y , g ( x _ { J } ) - y \rangle \leq \sigma { \sqrt { M } } \cdot \left( \mathbb { E } _ { x } \| f ( x ) - f ( x _ { J ^ { c } } ) \| _ { 2 } ^ { 2 } \right) ^ { 1 / 2 } .
|
| 113 |
+
$$
|
| 114 |
+
|
| 115 |
+
The following bound similarly holds for any $K \in \kappa$ : $\mathbb { E } _ { x , y } \langle f ( x ) _ { K } - y _ { K } , g ( x _ { J } ) _ { K } - y _ { K } \rangle \le \sigma \sqrt { | K | }$ · $( \mathbb { E } _ { x } \| f ( x ) _ { K } - f ( x _ { J ^ { c } } ) _ { K } ) \| _ { 2 } ^ { 2 } ) ^ { 1 / 2 }$ , where $K$ and $\kappa$ are defined in Theorem 2.
|
| 116 |
+
|
| 117 |
+
Proof. See Section A.2 in the appendix.
|
| 118 |
+
|
| 119 |
+
Using Theorem 3, the proposed SSRL loss that does not rely on the $\mathcal { I }$ -complement is given by
|
| 120 |
+
|
| 121 |
+
$$
|
| 122 |
+
\mathcal { L } ( f ) \overset { \Delta } { = } \sum _ { J \in \mathcal { I } } \mathbb { E } _ { x } \| f ( x ) - g ( x _ { J } ) \| _ { 2 } ^ { 2 } + 2 \sigma \sqrt { M } \cdot \big ( \mathbb { E } _ { x } \| f ( x ) - f ( x _ { J ^ { c } } ) \| _ { 2 } ^ { 2 } \big ) ^ { 1 / 2 } ,
|
| 123 |
+
$$
|
| 124 |
+
|
| 125 |
+
where $\sigma$ is given in Theorem 3. Here, a regression NN $f$ can use information from the entire input $x$ , whereas $\operatorname { \mathcal { L } } _ { \mathrm { i n d } } ( f )$ in (7) uses only partial input $x J ^ { c }$ in $f$ . The intuition for designing $g$ in Section 2.3 similarly applies here. Our aim is to design good $g$ such that $g ( x _ { J } )$ is closer to $y$ , consequently leading (9) close to (1). Similar to the variant of $\operatorname { \mathcal { L } } _ { \mathrm { i n d } } ( f )$ (see Section 2.3), if the amount of information between two partitions $J$ and $J ^ { c }$ is unbalanced in denoiser learning, one can modify (9) to compute the MSE only on $J$ or $J ^ { c }$ in either both terms or the right term in (9). (These variants use the second result in Theorem 3.)
|
| 126 |
+
|
| 127 |
+
We conjecture that how well designed $g$ is, i.e., how close is pseudo-target $g ( x _ { J } )$ to ground-truth $y$ , is captured by $\sigma$ defined in Theorem 3. We support the conjecture with examples in Section A.3 of the appendix. Then, this “goodness” of $g$ balances the two terms in (9) via $\sigma$ . If $g$ is well-designed such that $g ( x _ { J } )$ is close to $y$ , i.e., $\sigma ^ { 2 }$ is small, then the SSRL loss (9) relies more on the first term with good pseudo-target. If $g$ is poorly-designed such that $\sigma ^ { 2 }$ is large, then (9) puts more weight more on the second term that can implicitly promote the $\mathcal { I }$ -invariance of $f$ .
|
| 128 |
+
|
| 129 |
+
Relation to previous self-supervised denoising work. The proposed SSRL loss (9) becomes the Noise2Same loss (Xie et al., 2020, Thm. 2), by replacing $g ( x _ { J } )$ with $x$ and adding randomness to $K = J$ in the second term. In practice, one can tune $\sigma$ in (9) without knowing its exact value, similar to Noise2Same. One might use the aforementioned conjectured behavior of (9) with expected performance of $g$ .
|
| 130 |
+
|
| 131 |
+
# 2.5 RELAXING NOISE ASSUMPTIONS OF EXISTING SELF-SUPERVISED DENOISING METHODS
|
| 132 |
+
|
| 133 |
+
This section explains how proposed SSRL (3) can relax noise assumptions of existing selfsupervised denoising methods. Noise assumptions of existing self-supervised denoising methods include additive white Gaussian noise (AWGN with known variance) (Soltanayev & Chun, 2018), pixel-wise independent noise (Krull et al., 2019; Xie et al., 2020; Huang et al., 2021), and zero-mean noise (Lehtinen et al., 2018; Quan et al., 2020) or more generally $\mathbb { E } [ x | y ] = y$ (Batson & Royer, 2019; Xie et al., 2020). Assumption 1 of proposed SSRL relaxes the AWGN and pixel-wise independent noise assumptions, and is identical to the first assumption of Noise2Self (Batson & Royer, 2019). Assumption 2 of proposed SSRL can relax the second assumption of Noise2Self, $\mathbb { E } [ x | y ] = y$ , that is also (implicitly) used in Noise2Same (Xie et al., 2020) and Noise2Noise (Lehtinen et al., 2018), by using a desinable function $g$ . For example, $x$ is corrupted by additive non-zero-mean noise $e$ that is independent of $y$ , i.e., $x = y + e$ , then one can design $g$ as follows: $\boldsymbol { g } ( \boldsymbol { x } ) = \boldsymbol { x } - \mathbb { E } [ \boldsymbol { e } ]$ , where $\mathbb { E } [ e ]$ can be estimated from calibration of imaging systems. The next section will explain how one can design $g$ using domain knowledge and select $g$ if domain knowledge is unavailable in image denoising.
|
| 134 |
+
|
| 135 |
+
# 3 EXAMPLES OF HOW TO DESIGN $g$ USING DOMAIN KNOWLEDGE, ANDEMPIRICAL-LOSS APPROACH FOR SELECTING $g$ IN IMAGE DENOISING
|
| 136 |
+
|
| 137 |
+
Understanding noise statistics or properties is the first step towards accurate image recovery in computational imaging. First, this section describes how to use domain knowledge for designing $g$ in two imaging applications with practical noise models: 1) camera image denoising in mixed Poisson– Gaussian–Bernoulli noise, 2) low-dose CT denoising. Both applications have complicated noise models or strong noise, where Assumptions 1–2 in Section 2.2 are not completely satisfied. Noisy images in the first application are corrupted by independent and identically distributed (i.i.d.) noise with non-zero mean. The noise in the second application is approximately zero-mean but it is likely non-i.i.d. In designing $g$ for each application, we will use the suggestions in Sections 2.2–2.3, investigating Assumptions 1–3. Second, we propose a $g$ -selection approach in image denoising that calculates some empirical measure related to (6) using only input training data.
|
| 138 |
+
|
| 139 |
+
The major noise sources in camera imaging (using charge coupled device) include object-dependent photoelectrons in image sensors, readout in camera electronics, and analog-to-digital converter and transmission errors that can be modeled by Poisson noise, AWGN, and Bernoulli (i.e., salt-andpepper) noise models (Snyder et al., 1993), (Bovik, 2010, p. 90). We use the following practical mixed Poisson–Gaussian–Bernoulli noise model (Snyder et al., 1993; Batson & Royer, 2019):
|
| 140 |
+
|
| 141 |
+
$$
|
| 142 |
+
x _ { n } = \Pi _ { [ 0 , 2 5 5 ] } ( \mathsf { B e r n o u l l i } _ { p } ( \mathsf { P o i s s o n } ( \lambda y _ { n } ) / \lambda + \epsilon _ { n } ) ) , \quad \epsilon \sim \mathcal { N } ( 0 , \sigma _ { \epsilon } ^ { 2 } I ) , \quad n = 1 , \hdots , N ,
|
| 143 |
+
$$
|
| 144 |
+
|
| 145 |
+
where $\Pi _ { [ 0 , 2 5 5 ] }$ performs 8-bit quantization and clips pixel values outside of [0, 255], Bernoulli substitutes a pixel value with either 0 or 255 with probability $p$ (0 and 255 are coined with equal probability), Poisson generates pixel intensity-dependent Poisson noise with gain parameter $\lambda$ , and $\epsilon$ is AWGN. Figure 3 (left) shows a noisy image corrupted by the mixed noise model (10). If an image $y$ is corrupted only by the mixed Poisson–Gaussian noise, ${ \dot { \mathbb { E } } } [ x | y ] = y$ in Assumption 2 can be satisfied $( \mathbb { E } [ \mathsf { P o i s s o n } ( \lambda y _ { n } ) / \lambda + \epsilon | y ] = y _ { n } , \forall n ) .$ . However, if Bernoulli noise is additionally considered as given in (10), the assumption $\mathbb { E } [ x | y ] = y$ will not be satisfied $( \mathbb { E } [ { \mathsf { B e r n o u l l i } } _ { p } ( y _ { n } ) | y ] = ( 1 - p ) y _ { n } + 1 2 7 . 5 p .$ , $\forall n$ ). The quantization-clipping operator $\Pi _ { [ 0 , 2 5 5 ] }$ also makes it hard to satisfy $\mathbb { E } [ x | y ] = y$ .
|
| 146 |
+
|
| 147 |
+
Following the suggestion based on Assumption 2 (see Section 2.2), we handcraft $g$ to “approximately” satisfy $\mathbb { E } [ g ( x ) | y ] ~ = ~ y$ with a simple operator. We interpret aforementioned Bernoulli noise and clipping artifact as salt-and-pepper noise. Median filtering is a computational efficient method that is effective in reducing salt-and-pepper and impulse noises (Bovik, 2010, $\ S 3 . 2 )$ . We design $g$ by applying weighted median filtering (Brownrigg, 1984) to a pixel with intensity either 0 or 255 at each color channel, aiming that this $g$ design “approximately” satisfy $\mathbb { E } [ g \bar { ( } x ) | y ] = y$ by suppressing the salt-and-pepper noise effects cased by $\Pi _ { [ 0 , 2 5 5 ] }$ and Bernoullip. (This is supported by empirical results in Section S.4.)
|
| 148 |
+
|
| 149 |
+

|
| 150 |
+
Figure 3: An input noisy image in camera image denoising in mixed noise (left) and low-dose CT (right). PSNR and root mean square error (RMSE) values were averaged across all test samples.
|
| 151 |
+
|
| 152 |
+
Assumption 1 is satisfied because the noise in (10) is i.i.d. and independent of $y$ . In Assumption 3, we conjecture that the above $g$ design is measurable (median operator is measurable under some conditions (Rustad, 2004)).
|
| 153 |
+
|
| 154 |
+
# 3.2 DESIGNING $g$ USING DOMAIN KNOWLEDGE: LOW-DOSE CT DENOISING
|
| 155 |
+
|
| 156 |
+
In $\mathbf { X }$ -ray CT (with a monoenergetic source), the pre-log measurement data is usually modeled by the Poisson model, i.e., Poisson $\bar { \{ \rho _ { 0 } \exp ( - [ A y ] _ { l } ) \} }$ , $l = 1 , \ldots , L$ , where $\rho _ { 0 }$ is the number of incident photons per ray, $A \in \mathbb { R } ^ { L \times N }$ is a CT projection system matrix, and $L$ is the number of measured rays. Using the quadratic approximation to the log-likelihood of a Poisson model, the post-log measurement $z \in \mathbb { R } ^ { L }$ given $y$ can be approximated as the following Gaussian model (Sauer & Bouman, 1993; Fessler, 2000): $z | y \sim { \bar { \mathcal { N } } } ( A y , C )$ , where $C \in \mathbb { R } ^ { L \times L }$ is a diagonal covariance matrix and its diagonal elements become more nonuniform in lower-dose CT. This model suggests that post-log measurement may be modeled by $z = A y + \varepsilon$ , where $\varepsilon \sim \mathcal { N } ( 0 , C )$ . The filtered back-projection (FBP) method (Kak & Slaney, 1988, $\ S 3$ ) performs computationally efficient CT reconstruction and has been widely used in commercial CT scanners (Pan et al., 2009). In low-dose CT, however, reconstructed image $x = F z$ suffers from strong noise and streak artifacts, where $\boldsymbol { F } \in \mathbb { R } ^ { N \times L }$ denotes a linear FBP operator, motivating research on learning denoising NNs. Figure 3 (right) shows a noisy FBP image in low-dose CT. Using the statistical results above, we model that a reconstructed image by $F$ is corrupted by an arbitrary additive noise $e$ :
|
| 157 |
+
|
| 158 |
+
$$
|
| 159 |
+
x = y + e , \quad e = ( F A - I ) y + F \varepsilon .
|
| 160 |
+
$$
|
| 161 |
+
|
| 162 |
+
Low-dose CT uses all projection rays similar to standard-dose CT (but with substantially reduced dose) where $F$ approximately inverts $A$ , i.e., $F A \approx I$ , so we conclude that under (11), $\mathbb { E } [ \bar { e } ] \approx 0$ and $\mathbb { E } [ x | y ] \approx y$ . (See empirical results in Section S.4 that support $\mathbb { E } [ e ] \approx 0$ .)
|
| 163 |
+
|
| 164 |
+
The above domain knowledge in low-dose CT indicates that handcrafting $g$ to have zero-mean $e$ to satisfy Assumption 2 can be redundant. Following the suggestion motivated by Theorem 2 (see Section 2.3), we set $g$ as a pre-trained denoiser by the existing self-supervised denoising methods (Batson & Royer, 2019; Hendriksen et al., 2020; Xie et al., 2020). Since such pre-trained $g$ will have some denoising capability and give better reference than $g = \mathcal { T }$ to (7) and (9) (see empirical results in Section S.4), we expect that proposed SSRL losses (7) and (9) improve the denoising quality over the aforementioned existing self-supervised denoising methods.
|
| 165 |
+
|
| 166 |
+
Assumption 1 is unlikely satisfied because in FBP images, neighboring noise components are likely to be correlated, i.e., $\begin{array} { r } { \dot { \mathrm { V a r } } ( e ) \approx F C F ^ { \top } } \end{array}$ using $F A \approx I$ and noise model (11). Assumption 3 is satisfied as we use the conventional denoisiong NN, DnCNN (Zhang et al., 2017) and (modified) U-Net (Ronneberger et al., 2015), that are a continuous function.
|
| 167 |
+
|
| 168 |
+
# 3.3 EMPIRICAL-LOSS APPROACH FOR SELECTING $g$ IF DOMAIN KNOWLEDGE UNAVAILABLE
|
| 169 |
+
|
| 170 |
+
If accurate domain knowledge of a specific application is unavailable, it would be challenging to explicitly design $g$ . In such cases in denoising, our general suggestion is to measure an existing selfsupervised denoising loss, an upper bound of $\| g ( x _ { J } ) - y \| _ { 2 } ^ { 2 }$ or its variant that measure the quality of $g$ , only with input training data. The lower quantity implies that $g$ is better and implicitly encapsulates better domain knowledge. In camera image denoising with the real-world dataset (Abdelhamed et al., 2018), the empirical measure of the Neighbor2Neighbor loss (Huang et al., $2 0 2 1 ) - \mathbb { E } \| g ( x _ { J } ) -$ $x _ { J ^ { c } } \| _ { 2 } ^ { 2 }$ – with setting $g$ as $\mathcal { T }$ and median filtering are 0.0052 and 0.0048, respectively. In low-dose CT denoising with the real-world dataset (Moen et al., 2021), the empirical measure of the Noise2Self loss (Batson & Royer, $2 0 1 9 ) - \mathbb { E } \| g ( x _ { J } ) _ { J ^ { c } } - x _ { J ^ { c } } \| _ { 2 } ^ { 2 }$ – with setting $g$ as $\mathcal { T }$ and pre-trained DnCNN by Noise2Self are 22044.5 and 17062.0 (in $\mathrm { H U ^ { 2 } }$ where HU stands for modified Hounsfield unit), respectively. We expect better SSRL performance with the selected $g$ designs over $\mathcal { T }$ .
|
| 171 |
+
|
| 172 |
+
# 4 EXPERIMENTAL RESULTS AND DISCUSSION
|
| 173 |
+
|
| 174 |
+
We evaluated proposed SSRL in two practical imaging applications in Section 3 with both simulated and real-world datasets. For these applications, we mainly focuses on comparisons with selfsupervised denoising methods using single noisy input samples, particularly when statistical noise parameters are unavailable. We compared the performances of the following methods: Noise2Self (Batson & Royer, 2019), Noise2Noise-motivated methods that emulate pairs of two independent noisy images – Neighbor2Neighbor (Huang et al., 2021) or Noise2Inverse (Hendriksen et al., 2020) – Noise2Same (Xie et al., 2020), and corresponding SSRL to each aforementioned method. We also included Noise2True (1) results as baseline. For $f$ or $g$ in all the methods, we used the conventional denoising NN architecture, DnCNN (Zhang et al., 2017) or modified U-Net used in Noise2Self. We include experiment setup, and image and numerical results for/from real-world datasets in Sec. A.4.
|
| 175 |
+
|
| 176 |
+
# 4.1 EXPERIMENTAL SETUP FOR SIMULATED DATASETS
|
| 177 |
+
|
| 178 |
+
Camera image denoising in mixed noise. We evaluated the proposed SSRL framework with three RGB camera image datasets, ImageNet ILSVRC 2012 Val (Russakovsky et al., 2015), BSD 300 (Martin et al., 2001), Set 5 (Bevilacqua et al., 2012). For training, we used the ImageNet ILSVRC 2012 Val dataset with 20,000 images; for tests, we used the BSD 300 and Set 5 datasets consisting of 300 and 5 images, respectively. We simulated noisy images with the following imaging parameters introduced in (10): $\lambda = 3 0$ , $\sigma _ { \epsilon } = 6 0$ , and $p = 0 . 2$ . We evaluated the denoising quality by the most conventional error metric in camera image denoising, PSNR and structural similarity index measure (SSIM). In Neighbor2Neighbor setup, we emulated two independent noisy images from single noisy images by random neighbor sub-sampling with $2 \times 2 \cdot$ -window (Huang et al., 2021).
|
| 179 |
+
|
| 180 |
+
Low-dose CT denoising. We evaluated the proposed SSRL framework with The 2016 Low Dose CT Grand Challenge data (McCollough, 2016). We selected 200 regular-dose chest images of size $N = 5 1 2 \times 5 1 2$ and the $3 \mathrm { m m }$ slice thickness from four patients. For training, we used 170 $( 8 5 \% )$ chest images from three patients; for tests, we used 30 $( 1 5 \% )$ chest images from the other patient. We simulated low-dose sinograms using the Poisson model with the selected regular-dose chest datasets. In particular, we simulated sinograms of size $L = 7 3 6 \times 1 1 5 2$ (‘detectors’ $\times$ ‘projection views’), with fan-beam geometry corresponding to a no-scatter monoenergetic source with $\rho _ { 0 } = 5 \times 1 0 ^ { 4 }$ . We used FBP (Kak & Slaney, 1988, §3) to reconstruct images with resolution $\mathrm { 0 . 6 9 m m \times 0 . 6 9 m m }$ . We evaluated the denoising quality by the most conventional error metric in CT application, RMSE in HU. In Noise2Inverse setup, we emulated two independent noisy images by partitioning single sinograms with odd and even views and applying FBP to two partitioned independent sinograms.
|
| 181 |
+
|
| 182 |
+

|
| 183 |
+
Figure 4: Comparisons of denoised images (left) via DnCNNs from different learning methods and their saturation error maps (right) in camera image denoising (blue and yellow denote 0 and 0.5 absolute error, respectively). PSNR & SSIM values were averaged across all BSD 300 test samples.
|
| 184 |
+
|
| 185 |
+
# 4.2 COMPARISONS BETWEEN DIFFERENT SELF-SUPERVISED DENOISING METHODS
|
| 186 |
+
|
| 187 |
+
Compare each existing self-supervised denoising method to its corresponding SSRL setup in Figures 4–5, and Figures S.1–S.4 and Tables S.1–S.3; see three comparison sets, each grouped by red box. For both applications, proposed SSRL achieves significantly better image denoising quality, i.e., closer to the Noise2True quality, compared to the existing methods, Noise2Self, Neighbor2Neighbor, Noise2Inverse, and Noise2Same, regardless of the regression NN architecture. We show DnCNN prediction uncertainty of all the methods in Figure S.5.
|
| 188 |
+
|
| 189 |
+
Camera image denoising in mixed noise (simulated data). Figures 4 and S.3 show that in all the three comparison sets, SSRL gives closer image quality, particularly color saturation, to Noise2True than existing methods, Noise2Self, Neighbor2Neighbor, and Noise2Same. Setting $g$ as weighted median filtering avoids bias in SSRL loss caused by salt-and-pepper noise. Yet, compared to Noise2True, denoised images obtained by proposed SSRL lack saturation and detail preservation. For saturation and detail preservation comparisons, see Figures 4, S.1 and S.3.
|
| 190 |
+
|
| 191 |
+
Comparing the three comparison sets in Figures 4 and S.3, and Tables S.1–S.2 shows that all the Noise2Self, Neighbor2Neighbor, and Noise2Self setups have comparable results in terms of PSNR values. The potential reason is that in this application, all the three setups similarly satisfy Assumptions 1–3 (see Section 2.2); in particular, Assumption 1 is well-satisfied by pixel-wise i.i.d. noise.
|
| 192 |
+
|
| 193 |
+
In this application, the zero-mean noise assumption of the existing self-supervised denoising methods is violated, whereas its counterpart in proposed SSRL, Assumption 2, is “approximately” satisfied by $g$ in Section 3.1. This suggests the importance of satisfying Assumption 2 with good $g$ .
|
| 194 |
+
|
| 195 |
+
Low-dose CT denoising (simulated data). In all the three comparison sets, SSRL better recovers low-contrast regions (e.g., soft tissues) and small details, and significantly reduces noise and artifacts throughout the image, over existing methods, Noise2Self, Noise2Inverse, and Noise2Same. See zoom-ins and circled small details in Figures 5 and S.4, and error images in Figure S.2, particularly in ‘Noise2Self vs. Propose SSRL in Noise2Self setup’ and ‘Noise2Same vs. Proposed SSRL in Noise2Same setup.’ The results might imply that simply setting $g$ as pre-trained NN by existing selfsupervised denoising methods works like a charm in SSRL. Proposed SSRL in the Noise2Inverse setup can provide images with image quality that is comparable to conventional FBP at 10 times higher dose (when $\rho _ { 0 } \stackrel { \mathbf { \Delta } } { = } 5 \times 1 0 ^ { 5 }$ , $\mathrm { R M S E } = 2 0 . 5 \ : \mathrm { H L }$ on average; see DnCNN results in Figure 5).
|
| 196 |
+
|
| 197 |
+

|
| 198 |
+
Figure 5: Comparisons of denoised images via DnCNNs from different learning methods in lowdose CT (display window is [800, 1200] HU). RMSE values were averaged across all test samples.
|
| 199 |
+
|
| 200 |
+
Next, comparing Noise2Self and Noise2Same result sets to that of Noise2Inverse in Figures 5, S.2 and S.4, and Table S.3 shows that Noise2Inverse setup significantly improves the denoising quality, compared to Noise2Self and Noise2Same setups. We conjecture that violation of Assumption 1 – that is satisfied in the Noise2Inverse setup but unlikely to be satisfied in the Noise2Self and Noise2Same setups in this application – degrades the performance.
|
| 201 |
+
|
| 202 |
+
Camera image denoising and low-dose CT denoising with real-world datasets. Denoised image results in Figures A.2–A.3 and S.8–S.9 from the two real-world datasets (Abdelhamed et al., 2018; Moen et al., 2021) demonstrate that SSRL improves existing self-supervised denoising methods, particularly Neighbor2Neighbor, Noise2Self, and Noise2Same, without having their exact noise properties. The results well correspond to our expectation in Section 3.3.
|
| 203 |
+
|
| 204 |
+
# 5 CONCLUSION
|
| 205 |
+
|
| 206 |
+
It is important to develop SSRL that enables comparable prediction performances to supervised learning, because it is extremely challenging to collect many ground-truth target samples in many practical computational imaging and computer vision applications. The proposed SSRL framework bridges the gap between SSRL and supervised regression learning via domain knowledge of applications. To achieve closer prediction performance to supervised learning, SSRL uses domain knowledge to design a better pseudo-predictor $g$ such that $\bar { g ( x _ { J } ) }$ becomes closer to $y$ . For camera image denoising and low-dose CT denoising with both simulated and real-world datasets, SSRL achieves more accurate prediction compared to the existing self-supervised denoising methods (Batson & Royer, 2019; Huang et al., 2021; Hendriksen et al., 2020; Xie et al., 2020). Remark, however, that applying SSRL to other regressions problems may need careful investigations about $g$ based on their domain knowledge. Our future work is extending proposed SSRL to other machine learning problems such as teacher-student models (see Section S.7) and meta-learning. On the application side, our future work is applying SSRL to regression problems beyond image denoising.
|
| 207 |
+
|
| 208 |
+
# 6 REPRODUCIBILITY
|
| 209 |
+
|
| 210 |
+
Section 2.2 specifies all the theoretical assumptions. Section A.1 and Section A.2 in the appendix include the complete proofs of Theorem 2 and Theorem 3, respectively. Section S.2 in the supplement includes the complete implementation details including the hyperparameter selection strategies and the chosen hyperparameters. We included an anonymized zip file that includes test codes, test data, trained models, and instructions and codes that provide complete description of the data processing steps, as supplementary materials. We will make our codes (for data construction, training, and test) and trained models publicly available on GitHub if the paper is accepted.
|
| 211 |
+
|
| 212 |
+
# REFERENCES
|
| 213 |
+
|
| 214 |
+
Abdelrahman Abdelhamed, Stephen Lin, and Michael S. Brown. A high-quality denoising dataset for smartphone cameras. In Proc. IEEE CVPR, pp. 1692–1700, Salt Lake City, Utah, Jun. 2018.
|
| 215 |
+
|
| 216 |
+
Joshua Batson and Loic Royer. Noise2Self: Blind denoising by self-supervision. In Proc. ICML, pp. 524–533, Long Beach, CA, Jun. 2019.
|
| 217 |
+
|
| 218 |
+
Marco Bevilacqua, Aline Roumy, Christine Guillemot, and Marie Line Alberi-Morel. Lowcomplexity single-image super-resolution based on nonnegative neighbor embedding. In Proc. BMVC, pp. 135.1–135.10, Surrey, UK, Sep. 2012.
|
| 219 |
+
|
| 220 |
+
Mariusz Bojarski, Davide Del Testa, Daniel Dworakowski, Bernhard Firner, Beat Flepp, Prasoon Goyal, Lawrence D Jackel, Mathew Monfort, Urs Muller, Jiakai Zhang, et al. End to end learning for self-driving cars. NIPS Deep Learning Symposium, Dec. 2016. arXiv:1604.07316.
|
| 221 |
+
|
| 222 |
+
Alan C Bovik. Handbook of image and video processing. Academic Press, Florida, 2010.
|
| 223 |
+
|
| 224 |
+
David RK Brownrigg. The weighted median filter. Commun. of the ACM, 27:807–818, 1984.
|
| 225 |
+
|
| 226 |
+
Il Yong Chun, Zhengyu Huang, Hongki Lim, and Jeffrey A Fessler. Momentum-Net: Fast and convergent iterative neural network for inverse problems. early access in IEEE Trans. Pattern Anal. Mach. Intell., 2020. doi: 10.1109/TPAMI.2020.3012955.
|
| 227 |
+
|
| 228 |
+
Chao Dong, Chen Change Loy, Kaiming He, and Xiaoou Tang. Image super-resolution using deep convolutional networks. IEEE Trans. Pattern Anal. Mach. Intell., 38(2):295–307, Feb. 2016.
|
| 229 |
+
|
| 230 |
+
Jeffrey A Fessler. Statistical image reconstruction methods for transmission tomography. In M Sonka and J Michael Fitzpatrick (eds.), Handbook of Medical Imaging, Volume 2. Medical Image Processing and Analysis, pp. 1–70. SPIE, Bellingham, WA, 2000.
|
| 231 |
+
|
| 232 |
+
Allard Adriaan Hendriksen, Daniel Maria Pelt, and K Joost Batenburg. Noise2Inverse: Self-¨ supervised deep convolutional denoising for tomography. IEEE Trans. Comput. Imag., 6:1320– 1335, Aug. 2020.
|
| 233 |
+
|
| 234 |
+
Tao Huang, Songjiang Li, Xu Jia, Huchuan Lu, and Jianzhuang Liu. Neighbor2Neighbor: Selfsupervised denoising from single noisy images. In Proc. IEEE/CVF CVPR, pp. 14781–14790, Virtual, Jun. 2021.
|
| 235 |
+
|
| 236 |
+
Zhengyu Huang, Jeffrey A Fessler, Theodore B Norris, and Il Yong Chun. Light-field reconstruction and depth estimation from focal stack images using convolutional neural networks. In Proc. IEEE ICASSP, pp. 8648–8652, Barcelona, Spain, May 2020.
|
| 237 |
+
|
| 238 |
+
A. C. Kak and M. Slaney. Principles of computerized tomographic imaging. IEEE Press, New York, NY, 1988.
|
| 239 |
+
|
| 240 |
+
Jiwon Kim, Kwon Jung Lee, and Kyoung Mu Lee. Accurate image super-resolution using very deep convolutional networks. In Proc. IEEE CVPR, Las Vegas, NV, Jun. 2016.
|
| 241 |
+
|
| 242 |
+
Alexander Krull, Tim-Oliver Buchholz, and Florian Jug. Noise2Void - Learning denoising from single noisy images. In Proc. IEEE/CVF CVPR, pp. 2129–2137, Long Beach, CA, Jun. 2019.
|
| 243 |
+
|
| 244 |
+
Alexander Krull, Toma´s Vi ˇ car, Mangal Prakash, Manan Lalit, and Florian Jug. Probabilistic ˇ noise2void: Unsupervised content-aware denoising. Frontiers in Computer Science, 2:5, 2020.
|
| 245 |
+
|
| 246 |
+
Samuli Laine, Jaakko Lehtinen, and Timo Aila. High-quality self-supervised deep image denoising. In Proc. NIPS, Vancouver, Canada, Dec. 2019.
|
| 247 |
+
|
| 248 |
+
Jaakko Lehtinen, Jacob Munkberg, Jon Hasselgren, Samuli Laine, Tero Karras, Miika Aittala, and Timo Aila. Noise2Noise: Learning image restoration without clean data. In Proc. ICML, pp. 2965–2974, Stockholm, Sweden, Jul. 2018.
|
| 249 |
+
|
| 250 |
+
Ymir Makinen, Lucio Azzari, and Alessandro Foi. Collaborative filtering of correlated noise: Ex- ¨ act transform-domain variance for improved shrinkage and patch matching. IEEE Trans. Image Process., 29:8339–8354, Aug. 2020.
|
| 251 |
+
|
| 252 |
+
D. Martin, C. Fowlkes, D. Tal, and J. Malik. A database of human segmented natural images and its application to evaluating segmentation algorithms and measuring ecological statistics. In Proc. IEEE ICCV, pp. 416–423, Vancouver, Canada, July 2001.
|
| 253 |
+
|
| 254 |
+
C. McCollough. TU-FG-207A-04: Overview of the low dose CT grand challenge. Med. Phys., 43 (6Part35):3759–3760, Jun. 2016.
|
| 255 |
+
|
| 256 |
+
Taylor R Moen, Baiyu Chen, David R Holmes III, Xinhui Duan, Zhicong Yu, Lifeng Yu, Shuai Leng, Joel G Fletcher, and Cynthia H McCollough. Low-dose CT image and projection dataset. Med. Phys., 48(2):902–911, Feb. 2021.
|
| 257 |
+
|
| 258 |
+
Nick Moran, Dan Schmidt, Yu Zhong, and Patrick Coady. Noisier2Noise: Learning to denoise from unpaired noisy data. In Proc. IEEE/CVF CVPR, pp. 12064–12072, Virtual, Jun. 2020.
|
| 259 |
+
|
| 260 |
+
Xiaochuan Pan, Emil Y Sidky, and Michael Vannier. Why do commercial CT scanners still employ traditional, filtered back-projection for image reconstruction? Inverse Probl., 25(12):123009, 2009.
|
| 261 |
+
|
| 262 |
+
Mangal Prakash, Alexander Krull, and Florian Jug. Fully unsupervised diversity denoising with convolutional variational autoencoders. In Proc. ICLR, Virtual, May. 2021.
|
| 263 |
+
|
| 264 |
+
Yuhui Quan, Mingqin Chen, Tongyao Pang, and Hui Ji. Self2Self with dropout: Learning selfsupervised denoising from single image. In Proc. IEEE/CVF CVPR, pp. 1890–1898, Virtual, Jun. 2020.
|
| 265 |
+
|
| 266 |
+
Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In Proc. Med. Image Computing and Computer Assist. Interven., pp. 234–241, Munich, Germany, Oct. 2015.
|
| 267 |
+
|
| 268 |
+
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. Int. J. Comput. Vision, 115(3):211–252, 2015.
|
| 269 |
+
|
| 270 |
+
Alf B Rustad. The median in multidimensional spaces. Adv. App. Math., 33(2):366–396, Mar. 2004.
|
| 271 |
+
|
| 272 |
+
Ken Sauer and Charles Bouman. A local update strategy for iterative reconstruction from projections. IEEE Trans. Signal Process., 41(2):534–548, Feb. 1993.
|
| 273 |
+
|
| 274 |
+
Donald L. Snyder, Abed M. Hammoud, and Richard L. White. Image recovery from data acquired with a charge-coupled-device camera. J. Opt. Soc. Am. A, 10(5):1014–1023, May 1993.
|
| 275 |
+
|
| 276 |
+
Shakarim Soltanayev and Se Young Chun. Training deep learning based denoisers without ground truth data. In Proc. NIPS, volume 31, Montreal, Canada, Dec. 2018.
|
| 277 |
+
|
| 278 |
+
Christian Szegedy, Alexander Toshev, and Dumitru Erhan. Deep neural networks for object detection. 2, Dec. 2013.
|
| 279 |
+
|
| 280 |
+
Dmitry Ulyanov, Andrea Vedaldi, and Victor Lempitsky. Deep image prior. In Proc. IEEE/CVF CVPR, pp. 9446–9454, Salt Lake City, Utah, June 2018.
|
| 281 |
+
|
| 282 |
+
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. J. Mach. Learn. Res., 11(12):3371–3408, Dec. 2010.
|
| 283 |
+
|
| 284 |
+
Junyuan Xie, Linli Xu, and Enhong Chen. Image denoising and inpainting with deep neural networks. In Proc. NIPS, pp. 341–349, Lake Tahoe, NV, Dec. 2012.
|
| 285 |
+
|
| 286 |
+
Yaochen Xie, Zhengyang Wang, and Shuiwang Ji. Noise2Same: Optimizing a self-supervised bound for image denoising. In Proc. NIPS, volume 33, pp. 20320–20330, Vancouver, Canada, Dec. 2020.
|
| 287 |
+
|
| 288 |
+
Jun Xu, Yuan Huang, Li Liu, Fan Zhu, Xingsong Hou, and Ling Shao. Noisy-As-Clean: Learning unsupervised denoising from the corrupted image. IEEE Trans. Image Process., 29:9316–9329, Sep. 2020.
|
| 289 |
+
|
| 290 |
+
Li Xu, Jimmy SJ Ren, Ce Liu, and Jiaya Jia. Deep convolutional neural network for image deconvolution. In Proc. NIPS, pp. 1790–1798, Montreal, Canada, Dec. 2014.
|
| 291 |
+
|
| 292 |
+
Kai Zhang, Wangmeng Zuo, Yunjin Chen, Deyu Meng, and Lei Zhang. Beyond a Gaussian denoiser: Residual learning of deep CNN for image denoising. IEEE Trans. Image Process., 26(7):3142– 3155, Feb. 2017.
|
| 293 |
+
|
| 294 |
+
# APPENDIX
|
| 295 |
+
|
| 296 |
+
# A.1 PROOFS FOR THEOREM 2
|
| 297 |
+
|
| 298 |
+
Observe first that combining Assumptions 1 & 3 and the $\mathcal { I }$ -complement implies that $f ( x ) _ { m }$ and $g ( x ) _ { m }$ are conditionally independent, given $y$ , i.e.,
|
| 299 |
+
|
| 300 |
+
$$
|
| 301 |
+
f ( x _ { J ^ { c } } ) _ { m } | y \perp \perp g ( x _ { J } ) _ { m } | y , \quad \forall m .
|
| 302 |
+
$$
|
| 303 |
+
|
| 304 |
+
Using this result with Assumption 2 and reminding that the $\mathcal { I }$ -complement implies $\mathbb { E } _ { x } \Vert f ( x ) -$ $g ( x ) \bar { | | } _ { 2 } ^ { 2 } = \mathbb { E } _ { x } | | f ( x _ { J ^ { c } } ) - g ( x _ { J } ) | | _ { 2 } ^ { 2 }$ , we obtain the following result from (4):
|
| 305 |
+
|
| 306 |
+
$$
|
| 307 |
+
\mathbb { E } _ { x } \| f ( x _ { J ^ { c } } ) - g ( x _ { J } ) \| _ { 2 } ^ { 2 } = \mathbb { E } _ { x , y } \| f ( x _ { J ^ { c } } ) - y \| _ { 2 } ^ { 2 } + \| g ( x _ { J } ) - y \| _ { 2 } ^ { 2 }
|
| 308 |
+
$$
|
| 309 |
+
|
| 310 |
+
where the equality uses
|
| 311 |
+
|
| 312 |
+
$$
|
| 313 |
+
\begin{array} { r l } { { \mathbb { E } _ { x , y } \langle f ( x _ { J ^ { c } } ) - y , g ( x _ { J } ) - y \rangle = \mathbb { E } _ { y } \mathbb { E } _ { x | y } \langle f ( x _ { J ^ { c } } ) - y , g ( x _ { J } ) - y \rangle } } \\ & { = \sum _ { m } \mathbb { E } _ { y } \big ( \mathbb { E } _ { x | y } [ f ( x _ { J ^ { c } } ) _ { m } - y _ { m } ] \big ) \big ( \mathbb { E } _ { x | y } [ g ( x _ { J } ) _ { m } - y _ { m } ] \big ) } \\ & { = 0 } \end{array}
|
| 314 |
+
$$
|
| 315 |
+
|
| 316 |
+
in which the second equality uses the first result above and the third equality holds by Assumption 2.
|
| 317 |
+
This completes the proofs.
|
| 318 |
+
|
| 319 |
+
# A.2 PROOFS FOR THEOREM 3
|
| 320 |
+
|
| 321 |
+
We first obtain the following bound:
|
| 322 |
+
|
| 323 |
+
$$
|
| 324 |
+
\begin{array} { r l } & { \mathbb { E } _ { \rho \to \infty } \int \mathrm { d } \rho ( x , \rho ) \mathrm { d } x , } \\ & { = \mathbb { E } _ { \rho \to \infty } \frac { 1 } { \rho } \int _ { 0 } ^ { \infty } \{ \mathrm { d } \rho ( x , \rho ) \mathrm { d } x \} \mathrm { d } \rho } \\ & { = \sum _ { \rho \geq \infty } \mathbb { E } _ { \rho \to \infty } \frac { 1 } { \rho } \{ \mathrm { d } x \} \mathrm { d } \rho } \\ & { = \sum _ { \rho \geq \infty } \mathbb { E } _ { \rho \to \infty } \{ \mathrm { d } \rho ( x , \rho ) \mathrm { d } x - \mathrm { c o s } \{ \mathrm { d } \rho ( x , \rho ) \mathrm { d } x \} \mathrm { d } \rho } \\ & { = \sum _ { \rho \geq \infty } \mathbb { E } _ { \rho \to \infty } \{ \mathrm { d } \rho ( x , \rho ) \mathrm { d } x - \mathrm { c o s } \{ \mathrm { d } \rho ( x , \rho ) \mathrm { d } x \} \mathrm { d } \rho } \\ & { = \sum _ { \rho \geq \infty } \mathbb { E } _ { \rho \to \infty } \{ \mathrm { d } \rho ( x , \rho ) \mathrm { d } x \} \mathrm { d } \rho } \\ & { = \sum _ { \rho \geq \infty } \mathbb { E } _ { \rho \to \infty } \{ \mathrm { d } \rho ( x , \rho ) \mathrm { d } x \} \mathrm { d } \rho } \\ & { = \sum _ { \rho \geq \infty } \mathbb { E } _ { \rho \to \infty } \{ \mathrm { d } \rho ( x , \rho ) \mathrm { d } x \} \mathrm { d } \rho } \\ & { \leq \sum _ { \rho \geq \infty } \mathbb { E } _ { \rho \to \infty } \{ \mathrm { d } \rho ( x , \rho ) \mathrm { d } x \} \mathrm { d } \rho } \\ & { \leq \sum _ { \rho \geq \infty } \mathbb { E } _ { \rho \to \infty } \{ \mathrm { d } \rho ( x , \rho ) \mathrm { d } x \} \mathrm { d } \rho } \\ & { \leq \sum _ { \rho \geq \infty } \mathbb { E } _ { \rho \to \infty } \{ \mathrm { d } \rho ( x , \rho ) \mathrm { d } x \} \mathrm { d } \rho } \\ & \leq ( \frac { 1 } { \rho } \mathrm { d } x ) \mathrm { d } x \mathrm { d } \rho ( x , \rho ) \mathrm { d } \rho \end{array}
|
| 325 |
+
$$
|
| 326 |
+
|
| 327 |
+
where the second equality holds by Assumption 2, the third equality uses $\mathrm { C o v } ( X , Y \vert Z ) ~ =$ $\mathbb { E } [ X Y | Z ] - \mathbb { E } [ X | Z ] \mathbb { E } [ Y | Z ]$ where $X , Y$ , and $Z$ are random variables or vectors, the fifth equality holds because $f ( x _ { J ^ { c } } ) _ { m }$ does not correlate with $g ( x _ { J } ) _ { m }$ , ∀m (due to Assumptions 1 and 3), so subtracting $f ( x _ { J ^ { c } } ) _ { m }$ from $f ( x ) _ { m }$ does not change the covariance. Now, the first inequality uses the Pearson correlation coefficient bound, the second inequality uses the Jensen’s inequality√ √ $\mathbb { E } \sqrt { X } \le \sqrt { \mathbb { E } X }$ , the third inequality uses the Jensen’s inequality $\begin{array} { r } { \sum _ { m } \sqrt { a _ { m } } \leq \sqrt { M ^ { \prime } \sum _ { m } a _ { m } } } \end{array}$ for any $a \in \mathbb { R } ^ { M ^ { \prime } }$ , and the last inequality holds by the conditional variance bound specified in Theorem 3. We bound and rewrite the final result above and this completes the proof:
|
| 328 |
+
|
| 329 |
+
$$
|
| 330 |
+
\begin{array} { r l } & { \mathbb { E } _ { x , y } \langle f ( x ) - y , g ( x , \ j ) - y \rangle \leq \sigma \sqrt { M } \cdot \left( \displaystyle \sum _ { m = 1 } ^ { M } \mathbb { E } _ { y } \left[ \mathrm { V a r } ( f ( x ) _ { m } - f ( x , \ j _ { m } | y ) \right] \right) ^ { 1 / 2 } } \\ & { \quad \quad \quad \leq \sigma \sqrt { M } \cdot \left( \displaystyle \sum _ { m = 1 } ^ { M } \mathbb { E } _ { y } \left[ \mathbb { E } _ { x | y } \left[ f ( x ) _ { m } - f ( x , \ j _ { m } ) \right] ^ { 2 } \right] \right) ^ { 1 / 2 } } \\ & { \quad \quad \quad = \sigma \sqrt { M } \cdot \left( \displaystyle \sum _ { m = 1 } ^ { M } \mathbb { E } _ { x } \left[ f ( x ) _ { m } - f ( x , \ j _ { m } ) _ { m } \right] ^ { 2 } \right) ^ { 1 / 2 } , } \end{array}
|
| 331 |
+
$$
|
| 332 |
+
|
| 333 |
+
where the equality uses the filtration property of conditional expectation.
|
| 334 |
+
|
| 335 |
+
# A.3 EXAMPLES THAT SUPPORT CONJECTURED BEHAVIOR OF (9) WITH $\sigma$
|
| 336 |
+
|
| 337 |
+
The first example in general regression models the pseudo-target as follows: $g ( x _ { J } ) = y + e _ { 1 }$ , where $\boldsymbol { e } _ { 1 } \in \mathbb { R } ^ { \dot { \boldsymbol { M } } }$ is some arbitrarily additive noise independent of $y$ . This gives $\nabla \ a \mathbf { r } ( g ( x _ { J } ) _ { m } | y ) =$ $\mathrm { V a r } ( y _ { m } + ( e _ { 1 } ) _ { m } | y ) = \mathrm { V a r } ( e _ { 1 } ) _ { m } \stackrel { \cdot } { \leq } \sigma ^ { 2 }$ , $m = 1 , \ldots , M$ . Under this model, how close is $g ( x _ { J } )$ to $y$ is captured by $\sigma$ .
|
| 338 |
+
|
| 339 |
+
The second example in image denoising assumes that $x$ is corrupted by AWGN $e _ { 2 } \in \mathbb { R } ^ { N }$ that is independent of $y$ . Setting $g$ as a linear mapping $G \in \mathbb { R } ^ { J \times N }$ gives $\mathrm { \bar { V a r } } ( g ( x _ { J } ) _ { n } | y ) = \mathrm { V a r } ( ( G y _ { J } ) _ { n } +$ $( G ( e _ { 2 } ) _ { J } ) _ { n } | y ) = \mathrm { V a r } ( ( G ( e _ { 2 } ) _ { J } ) _ { n } ) \leq \sigma ^ { 2 }$ , $\forall n = 1 , \ldots , N$ . Under this model, how close is $g ( x _ { J } )$ to $y$ is captured by $\sigma$ .
|
| 340 |
+
|
| 341 |
+
# A.4 EXPERIMENTAL SETUP AND RESULTS FOR/FROM REAL-WORLD DATASETS
|
| 342 |
+
|
| 343 |
+
# A.4.1 EXPERIMENTAL SETUP FOR REAL-WORLD DATASETS
|
| 344 |
+
|
| 345 |
+
We also evaluated the proposed SSRL framework with real-world camera image and low-dose CT datasets, where we do not have their complete noise properties/statistics. We chose the publicly available SIDD sRGB Data (Abdelhamed et al., 2018) and Low Dose CT Image and Projection Data (Moen et al., 2021), where both the datasets include high-quality images or standard-dose FBP images so that one can run Noise2True experiments and obtain quantitative results. We used the DnCNN architecture for all experiments. For each experiment, we used the same implementation setup (such as hyperparameters and masking scheme) as that in the corresponding simulated data experiment. In particular, $g$ is median filter and pre-trained denoiser via existing self-supervised denoising methods in camera image denoising and low-dose CT denoising experiments, respectively.
|
| 346 |
+
|
| 347 |
+
Camera image denoising with SIDD sRGB Data. We used the SIDD sRGB training and validation datasets for training and tests, respectively. We chose the representative comparison setup, Neighbor2Neighbor, from the camera image denoising experiments using simulated data in Section 4.1.
|
| 348 |
+
|
| 349 |
+
Low-dose CT denoising with Low Dose CT Image and Projection Data. We followed the data construction setup in Section 4.1 that was used in simulated data experiments; we remark that chest CT scans in the Low Dose CT Image and Projection Data use the $1 \mathrm { m m }$ slice
|
| 350 |
+
|
| 351 |
+

|
| 352 |
+
Figure A.1: An input intrinsically-noisy image in camera image denoising (left) and low-dose CT (right). PSNR and RMSE values were averaged across all test samples.
|
| 353 |
+
|
| 354 |
+
thickness. We cannot run Noise2Inverse experiments because the Low Dose CT Image and Projection Data does not provide two independent half-view FBP images. We thus chose the other comparison setups, Noise2Self and Noise2Same.
|
| 355 |
+
|
| 356 |
+
# A.4.2 MAIN EXPERIMENTAL RESULTS FROM REAL-WORLD DATASETS
|
| 357 |
+
|
| 358 |
+
This section includes main experimental results such as denoised images and calculated performance measure, from the real-world datasets. Section S.3.2 in the supplement includes their supplementary results.
|
| 359 |
+
|
| 360 |
+

|
| 361 |
+
Figure A.2: Comparisons of denoised images (top) via DnCNNs from different learning methods and their saturation error maps (bottom) in camera image denoising (blue and yellow denote 0 and 0.5 absolute errors, respectively). PSNR and SSIM values were averaged across all SIDD sRGB validation samples.
|
| 362 |
+
|
| 363 |
+

|
| 364 |
+
Figure A.3: Comparisons of denoised images via DnCNNs from different learning methods in lowdose CT (display window is [800, 1200] HU). RMSE values were averaged across all test samples.
|
| 365 |
+
|
| 366 |
+
# SELF-SUPERVISED REGRESSION LEARNING USING DOMAIN KNOWLEDGE: APPLICATIONS TO IMPROVING SELF-SUPERVISED IMAGE DENOISING (SUPPLEMENT)
|
| 367 |
+
|
| 368 |
+
Anonymous authors Paper under double-blind review
|
| 369 |
+
|
| 370 |
+
# S.1 DETAILED PAPER CONTRIBUTIONS
|
| 371 |
+
|
| 372 |
+
This section elaborates the contributions of the proposed SSRL framework:
|
| 373 |
+
|
| 374 |
+
1. The paper applies the proposed SSRL generalization to several recent representative selfsupervised denoising methods, Noise2Self (Batson & Royer, 2019), Noise2Same (Xie et al., 2020), Noise2Noise (Lehtinen et al., 2018), Noise2Inverse (Hendriksen et al., 2020), and Neighbor2Neighbor (Huang et al., 2021). See Sections 2.3–2.4. With camera image and low-dose CT denoising experiments using both real and synthetic datasets, the paper demonstrates the outperforming performance of SSRL extensions over the aforementioned self-supervised denoising methods.
|
| 375 |
+
|
| 376 |
+
2. Section 2.5 shows that designable pseudo-predictor $g$ in SSRL can relax noise assumptions of existing self-supervised denoising methods. In addition, Section 4.2 includes experiments studying how denoising performances change with satisfying noise assumption(s) (i.e., Assumptions 1–2).
|
| 377 |
+
|
| 378 |
+
3. The paper explains how to incorporate domain knowledge into self-supervised denoising methods via $g$ and why more accurate domain knowledge can improve them. See examples in Sections 3.1–3.2. In addition, Section 3.3 proposes an empirical approach for selecting $g$ if domain knowledge of specific applications is unavailable.
|
| 379 |
+
|
| 380 |
+
4. The proposed SSRL framework in Section 2 considers regression NN learning beyond denoiser learning, by using a desinable operator $g$ . The paper is the first step towards self-supervised learning in regression problems, by showing that the proposed framework extends well to image denoising problem.
|
| 381 |
+
|
| 382 |
+
# S.2 IMPLEMENTATION DETAILS, DATA AND CODE LICENSES, AND LIBRARY VERSIONS
|
| 383 |
+
|
| 384 |
+
This section describes implementation details, lists hyperparameters, and specifies license of datasets and codes used in this study.
|
| 385 |
+
|
| 386 |
+
# S.2.1 DATA AND CODE LICENCES, AND LIBRARY VERSIONS
|
| 387 |
+
|
| 388 |
+
The ImageNet ILSVRC 2012 Val and BSD 300 datasets have the Custom license (research, non-commercial), the Set 5 data has the Unknown license, and the SIDD sRGB Data (Abdelhamed et al., 2018) has the MIT license. We obtained The 2016 Low Dose CT Grand Challenge data (McCollough, 2016) from https://aapm.app.box.com/s/ eaw4jddb53keg1bptavvvd1sf4x3pe9h/file/856956352254, and Low Dose CT Image and Projection Data (Moen et al., 2021) from https://doi.org/10.7937/9npb-2637. The 2016 Low Dose CT Grand Challenge data and Low Dose CT Image and Projection Data have the Custom license and the patient information is fully redacted.
|
| 389 |
+
|
| 390 |
+
We implemented all the methods specified in Section 4 by modifying the Noise2Self code (Batson & Royer, 2019) (GitHub repository: https://github.com/czbiohub/noise2self with version Dec. 17, 2019) that is licensed under the MIT license. For all training and testing experiments, we used Pytorch 1.0.0 or 1.7.0 (Paszke et al., 2019) with the BSD-style license. For simulating low-dose FBP images, we used the Michigan image reconstruction toolbox (MIRT) (Fessler, 2016) of which license information is declared on its release page. For sinogram generation and FBP reconstruction, we used the “Gtomo2 dscmex.m” routine (updated on Dec. 10, 2006) and the “fbp2.m” routine (updated on Dec. 21, 2005), respectively.
|
| 391 |
+
|
| 392 |
+
# S.2.2 COMMON IMPLEMENTATION DETAILS IN BOTH APPLICATIONS
|
| 393 |
+
|
| 394 |
+
For all the existing self-supervised denoising methods specified in Section 4 and Noise2True, we finely tuned their hyperparameters, including the initial learning rate, learning rate decay parameters, minibatch size, number of DnCNN layers, and balancing parameter $\sigma$ (see, e.g., (9)), to achieve the best numerical results. We simply applied the chosen hyperparameter sets to corresponding SSRL setups. We applied the chosen learning rate decay parameters, minibatch size, and number of DnCNN layers in Noise2True experiments to all the self-supervised denoising methods.
|
| 395 |
+
|
| 396 |
+
For the existing self-supervised denoising methods, Noise2Self (Batson & Royer, 2019) and Noise2Same (Xie et al., 2020), we used their default masking setups. The Noise2Self default setup uses the deterministic masking scheme for each $J$ that equi-spacedly samples $6 . 2 5 \%$ of the number of pixels in each training image (i.e., a single pixel is selected in each $4 \times 4$ window). The Noise2Same default setup uses the saturated sampling scheme (Xie et al., 2020; Krull et al., 2019) for each $J$ that randomly samples $\approx 0 . 5 \%$ of the number of pixels in each training image (i.e., a single pixel is sampled in each $1 4 \times 1 4$ window). In training denoising NNs, both methods interpolate missing pixels in $x J c$ by applying weighted average to their 8 neighboring pixels, and use interpolated $x J ^ { c }$ as input to denoisers.
|
| 397 |
+
|
| 398 |
+
For the existing Noise2Noise-motivated methods that emulate pairs of two independent noisy images, Neighbor2Neighbor (Huang et al., 2021) and Noise2Inverse (Hendriksen et al., 2020), we calculated their loss with non-masked images as proposed.
|
| 399 |
+
|
| 400 |
+
We tested all trained regression NNs to non-masked images – rather than masked images with $J ^ { c } -$ as this setup gave higher denoising accuracy than prediction with masked images (Batson & Royer, 2019; Xie et al., 2020).
|
| 401 |
+
|
| 402 |
+
# S.2.3 IMPLEMENTATION DETAILS FOR EXPERIMENTS WITH SYNTHETIC CAMERA IMAGE DENOISING DATA
|
| 403 |
+
|
| 404 |
+
The common hyperparameters for all learning methods were defined as follows. (In this application, these gave good image denoising performance across all existing self-supervised denoising methods and Noise2True, since we rescaled or normalized training images; see details below.) We used the default 17-layer DnCNN (Zhang et al., 2017) and the modified U-Net used in Noise2Self (Batson & Royer, 2019), and trained all DnCNNs and U-Nets with the mini-batch version of Adam (Kingma & Ba, 2015). We selected the initial learning rate, the batch size, and the number of epochs as $8 \times 1 0 ^ { - 4 }$ , 8, and 190, respectively, and decayed the learning rates by a factor of 0.5 every 50,000 iterations. (For Neighbor2Neighbor (Huang et al., 2021), we set the batch size as 32, as it reduces training image size with $2 \times 2$ sub-sampling window.) We used the data augmentations in Noise2Same (Xie et al., 2020), i.e., random crops with size $2 5 6 \times 2 5 6$ , rotation and flipping. Except for Noise2Same, we rescaled all images to [0, 1], following (Batson & Royer, 2019; Huang et al., 2021). In Noise2Same experiments (including SSRL-Noise2Same), we normalized each image by subtracting its mean and dividing by its standard deviation at each channel, following (Xie et al., 2020).
|
| 405 |
+
|
| 406 |
+
For proposed SSRL in the Noise2Self and Noise2Same setups (referred to as SSRL-Noise2Self and SSRL-Noise2Same, respectively), we used the deterministic masking scheme in Figure 2(bottom) for each $J$ with ${ \approx } 1 1 . 1 \%$ and ${ \approx } 1 . 2 \%$ sampling ratio, respectively – i.e., a single pixel is selected in each $3 \times 3$ and $9 \times 9$ window, respectively. These setups gave more appealing results than the default masking parameters (i.e., $4 \times 4$ window in Noise2Self and $1 4 \times 1 4$ window in Noise2Same); compare Figure S.6 to corresponding results in Figure 4. We observed in this application that using sufficient amount of information for a linear interpolation in $f$ is useful for giving good prediction. For weighted median filtering (Brownrigg, 1984) $g$ in all SSRL setups, we used the following weights:
|
| 407 |
+
|
| 408 |
+
$[ 1 , 2 , 1 ; 2 , \sqrt { 9 \ldots 2 } ; 1 , 2 , 1 ]$ , where a box denotes the central weight. The dilation rates of weighted median filtering for SSRL in the Noise2Self, Noise2Same, and Neighbor2Neighbor setups are 3, 9, and 1, respectively, corresponding to the distances between pixels in $J$ . For SSRL-Noise2Self, we computed $\mathcal { L } _ { \mathrm { i n d } }$ in (7) only on $J$ (see Figure 2(bottom)). For SSRL-Noise2Same, we used the same balancing parameter $\sigma$ as Noise2Same used, i.e., $\sigma = 1$ , and computed $\mathcal { L }$ (both terms) in (9) only on $J$ .
|
| 409 |
+
|
| 410 |
+
The DnCNN and U-Net training time for each experiment was less than 72 hours with an NVIDIA TITAN V GPU.
|
| 411 |
+
|
| 412 |
+
# S.2.4 IMPLEMENTATION DETAILS FOR EXPERIMENTS WITH SYNTHETIC LOW-DOSE CT DENOISING DATA
|
| 413 |
+
|
| 414 |
+
We used fan-beam geometry for sinogram simulation, where width of each detector column is $1 . 2 8 5 8 ~ \mathrm { m m }$ , source to detector distance is $1 0 8 5 . 6 \ \mathrm { m m }$ , and source to rotation center distance is $5 9 5 ~ \mathrm { m m }$ . For the FBP method, we used a ramp filter because in general, it better preserves the sharpness of edges on reconstructed images than Hanning filter (but overall noise increases).
|
| 415 |
+
|
| 416 |
+
The common hyperparameters for all learning methods were defined as follows. We used 8-layer DnCNN (Zhang et al., 2017) with its default setup and the modified U-Net used in Noise2Self (Batson & Royer, 2019), and trained all DnCNNs and U-Nets with the mini-batch version of Adam (Kingma & Ba, 2015). We selected the batch size and the number of epochs as 2 and 1,000, respectively, and decayed the learning rates by a factor of 0.95 every 10 epochs. In training DnCNNs and U-Nets, we selected the initial learning rates as 0.1 and $5 \times 1 0 ^ { - 5 }$ , respectively, unless stated otherwise.
|
| 417 |
+
|
| 418 |
+
For proposed SSRL-Noise2Self and SSRL-Noise2Same, we used complementary checkboard masks $J$ and $J ^ { c }$ in Figure 2(top). We observed in this application that if $g$ is set to use small amount of information, i.e., $\vert J \vert \ll \vert J ^ { c } \vert$ , then pre-trained $g$ makes poor prediction. For SSRL-Noise2Self, we set $g$ as pre-trained NN by Noise2Self with complementary checkerboard masks (see its inference results with 8-layer DnCNN and U-Net in Figures S.7(a) and S.4, respectively). In training DnCNNs, we used the same initial learning rate as that used in pre-training $g , 0 . 0 1$ . We computed $\mathcal { L } _ { \mathrm { i n d } }$ as given in (7) (see Figure 2(top)).
|
| 419 |
+
|
| 420 |
+
For SSRL in the Noise2Inverse setup, we set $f$ and $g$ as $f / 2$ and $\mathcal { T } - g / 2$ , respectively, where $g$ is pre-trained NN by Noise2Inverse. In training DnCNNs, we used the same initial learning rate as that used in pre-training $g , \ 0 . 0 0 1$ . In inference, we averaged the predictions from $f$ and $g$ , as this corresponds to training setup above. In all Noise2Inverse inferences (including SSRLNoise2Inverse), we input full-view FBP images since this is consistent with other experiments and gave better denoising performance than denoising half-view FBP images. For SSRL-Noise2Same, we set $g$ as pre-trained NN by Noise2Same with complementary checkerboard masks (see its test results with DnCNN and U-Net in Figures S.7(b) and S.4, respectively), and computed $\mathcal { L }$ (both terms) in (9) only on $J ^ { c }$ . We chose the balancing parameter √ $\sigma$ as 15, setting the ratio of the first term to the squared second term $2 \sigma \sqrt { M } \lVert f ( x ) _ { J ^ { c } } - f ( x _ { J ^ { c } } ) _ { J ^ { c } } \rVert _ { 2 } ^ { 2 }$ in (9) as 10. For Noise2Same with either the default setup and complementary checkerboard masks, we chose the balancing parameter $\sigma$ as 500. For self-supervised denoising methods with complementary checkerboard masks, we interpolated missing pixels in both $x J c$ and $x _ { J }$ , by averaging their 4 neighboring pixels.
|
| 421 |
+
|
| 422 |
+
The DnCNN and U-Net training time for existing self-supervised denoising methods and proposed SSRL methods was less than 10 hours and 12 hours, respectively, with an NVIDIA TITAN Xp GPU. It took total less than 22 hours to train both $f$ and $g$ .
|
| 423 |
+
|
| 424 |
+
# S.3 SUPPLEMENTARY EXPERIMENTAL RESULTS FOR SECTION 4
|
| 425 |
+
|
| 426 |
+
This section mainly includes supplementary materials to Section 4.
|
| 427 |
+
|
| 428 |
+
# S.3.1 SUPPLEMENTARY EXPERIMENTAL RESULTS WITH SYNTHETIC DATASETS
|
| 429 |
+
|
| 430 |
+
Figures S.1 and S.2 show error maps of denoised images via DnCNNs from different learning methods in camera image denoising in mixed noise and low-dose CT, respectively. These show for both applications that in all the three comparison setups, SSRL significantly reduces errors and artifacts across the entire image, over existing self-supervised denoising methods. Red boxes compare existing self-supervised denoising method to proposed SSRL in the corresponding setup.
|
| 431 |
+
|
| 432 |
+

|
| 433 |
+
Figure S.1: Error map comparisons of denoised images via DnCNNs from different learning methods in camera image denoising (blue and yellow denote 0 and 50 absolute errors, respectively). PSNR and SSIM values were averaged across all BSD 300 test samples.
|
| 434 |
+
|
| 435 |
+

|
| 436 |
+
Figure S.2: Error map comparisons of denoised images via DnCNNs from different learning methods in low-dose CT (blue and yellow denote 0 and 50 absolute errors in HU, respectively). RMSE values were averaged across all test samples from The 2016 Low Dose CT Grand Challenge data.
|
| 437 |
+
|
| 438 |
+
Figures S.3 and S.4 show denoised images via U-Nets from different learning methods in camera image denoising in mixed noise and low-dose CT, respectively. These demonstrate for both applications that in all the three comparison setups, SSRL significantly improves existing self-supervised denoising methods regardless of the regression neural network architecture.
|
| 439 |
+
|
| 440 |
+

|
| 441 |
+
Figure S.3: Comparisons of denoised images (left) via U-Nets from different learning methods and their saturation error maps (right) in camera image denoising (blue and yellow denote 0 and 0.5 absolute errors, respectively). PSNR and SSIM values were averaged across all BSD 300 test samples.
|
| 442 |
+
|
| 443 |
+

|
| 444 |
+
Figure S.4: Comparisons of denoised images via U-Nets from different learning methods in lowdose CT (display window is [800, 1200] HU). RMSE values were averaged across all test samples from The 2016 Low Dose CT Grand Challenge data.
|
| 445 |
+
|
| 446 |
+
Tables S.1–S.3 report quantitative image denoising results with DnCNN and U-Net with BSD 300 and Set 5 data in camera image denoising in mixed noise, and with chest slices of The 2016 Low Dose CT Grand Challenge data in low-dose CT. Red boxes in Tables S.1–S.3 compare an existing self-supervised denoising method to proposed SSRL in the corresponding setup.
|
| 447 |
+
|
| 448 |
+
Table S.1: Averaged test PSNR (dB) (first and third rows) and SSIM (second and fourth rows) comparisons with from different learning methods with DnCNN (first and second rows) and U-Net (third and fourth rows) in camera image denoising (simulated noisy BSD 300 dataset).
|
| 449 |
+
|
| 450 |
+
<table><tr><td>Noise2True</td><td>Noise2Self</td><td>Proposed SSRL in Noise2Self setup</td><td>Neighbor2- Neighbor</td><td>Proposed SSRL in Neighbor2- Neighbor setup</td><td>Noise2Same</td><td>Proposed SSRL in Noise2Same setup</td></tr><tr><td>25.2 0.819</td><td>20.6 0.711</td><td>22.1 0.748</td><td>20.2 0.703</td><td>22.3 0.756</td><td>20.1 0.690</td><td>21.2 0.705</td></tr><tr><td>26.0 0.849</td><td>20.9 0.730</td><td>22.5 0.765</td><td>20.8 0.728</td><td>22.4 0.767</td><td>19.5 0.612</td><td>20.7 0.660</td></tr></table>
|
| 451 |
+
|
| 452 |
+
Table S.2: Averaged test PSNR (dB) (first and third rows) and SSIM (second and fourth rows) comparisons from different learning methods with DnCNN (first and second rows) and U-Net (third and fourth rows) in camera image denoising (simulated noisy Set 5 dataset).
|
| 453 |
+
|
| 454 |
+
<table><tr><td>Noise2True</td><td>Noise2Self</td><td>Proposed SSRL in Noise2Self setup</td><td>Neighbor2- Neighbor</td><td>Proposed SSRL in Neighbor2- Neighbor setup</td><td>Noise2Same</td><td>Proposed SSRL in Noise2Same setup</td></tr><tr><td>26.4 0.890</td><td>19.3 0.743</td><td>21.2 0.785</td><td>19.0 0.744</td><td>21.9 0.806</td><td>18.9 0.729</td><td>20.0 0.753</td></tr><tr><td>27.2 0.910</td><td>19.5 0.752</td><td>21.8 0.802</td><td>19.4 0.751</td><td>21.6 0.800</td><td>17.7 0.626</td><td>19.3 0.712</td></tr></table>
|
| 455 |
+
|
| 456 |
+
Table S.3: Averaged test RMSE (HU) comparisons from different learning methods with DnCNN (first row) and U-Net (second row) in low-dose CT denoising (simulated low-dose CT dataset).
|
| 457 |
+
|
| 458 |
+
<table><tr><td>Noise2True</td><td>Noise2Self</td><td>Proposed SSRL in Noise2Self setup</td><td>Noise2- Inverse</td><td>Proposed SSRL in Noise2- Inverse setup</td><td>Noise2Same</td><td>Proposed SSRL in Noise2Same setup</td></tr><tr><td>16.3</td><td>36.2</td><td>25.0</td><td>22.9</td><td>21.9</td><td>28.4</td><td>26.0</td></tr><tr><td>18.5</td><td>32.3</td><td>26.7</td><td>24.0</td><td>23.5</td><td>31.1</td><td>28.2</td></tr></table>
|
| 459 |
+
|
| 460 |
+
Figure S.5 compares prediction uncertainty of trained DnCNN denoisers via different learning methods in both applications. The error bar graphs in Figure S.5 show that for both applications, in all the three comparison sets, proposed SSRL gives similar or lower prediction uncertainty over the existing self-supervised denoising methods, Noise2Self, Neighbor2Neighbor, Noise2Inverse, and Noise2Same.
|
| 461 |
+
|
| 462 |
+
Figure S.6 shows denoised camera images from SSRL-Noise2Self and SSLR-Noise2Same using the default masking parameters in Noise2Self and Noise2Same (see Section S.2.3). Compare the results in Figure S.6 with the corresponding ones in Figure 4 using the designed setups (see Section S.2.3). The comparisons demonstrate that the default and designed setups give very similar PSNR results, i.e., $\leq 0 . 1$ dB, but the designed setups gives slightly more visually appealing results than the default ones in Noise2Self and Noise2Same.
|
| 463 |
+
|
| 464 |
+
Figure S.7 shows denoised images from Noise2Self and Noise2Same with DnCNN and complementary checkerboard masks $J$ and $J ^ { c }$ , and reports the corresponding quantitative test results, in low-dose CT denoising. Comparing the results in Figure S.7 to those of Noise2Self and Noise2Same using the default masking setups in Figures 5 and S.2 shows that checkerboard masking improves denoising quality over default masking in Noise2Self, and achieves comparable denoising performance to default masking in Noise2Same. (See their default masking setups in Section S.2.2.) SSRL-Noise2Self with checkerboard masking achieves significantly better denoising quality compared to Noise2Self with checkerboard masking. We used pre-trained DnCNN from these two setups as $g$ in the corresponding SSRL setup.
|
| 465 |
+
|
| 466 |
+

|
| 467 |
+
Figure S.5: Denoising performance error bars for different learning methods with DnCNN in camera image denoising in mixed noise (with BSD 300) (left, 300 test images) and low-dose CT (right, 30 test images). Red asterisks denote the averaged test PSNR or RMSE values. Error bar represents one standard deviation of test PSNR or RMSE values.
|
| 468 |
+
|
| 469 |
+

|
| 470 |
+
Figure S.6: Denoised images via DnCNNs and their corresponding error maps from SSRLNoise2Self and SSRL-Noise2Same with default masks setup in camera image denoising. (In error maps, blue and yellow denote 0 and 50 absolute errors, respectively.) PSNR values were averaged across all BSD 300 test samples.
|
| 471 |
+
|
| 472 |
+

|
| 473 |
+
Figure S.7: Denoised images via DnCNNs and their corresponding error maps from Noise2Self and Noise2Same with complementary checkerboard masks in low-dose CT. (The display window of denoised images is [800, 1200] HU; in error maps, blue and yellow denote 0 and 50 absolute errors in HU, respectively.) RMSE values were averaged across all test samples.
|
| 474 |
+
|
| 475 |
+
Figures S.8 and S.9 show error maps of denoised images via DnCNNs from different learning methods in camera image and low-dose CT denoising with real-world datasets, respectively. These show for both applications that in Neighbor2Neighbor, Noise2Self, or Noise2Same comparison setups, SSRL significantly improve the entire image without having their exact noise properties.
|
| 476 |
+
|
| 477 |
+

|
| 478 |
+
Figure S.8: Error map comparisons of denoised images via DnCNNs from different learning methods in camera image denoising with real-world dataset (blue and yellow denote 0 and 50 absolute errors, respectively). PSNR and SSIM values were averaged across all SIDD sRGB validation samples.
|
| 479 |
+
|
| 480 |
+

|
| 481 |
+
Figure S.9: Error map comparisons of denoised images via DnCNNs from different learning methods in low-dose CT with real-world dataset (blue and yellow denote 0 and 100 absolute errors in HU, respectively). RMSE values were averaged across all test samples.
|
| 482 |
+
|
| 483 |
+
# S.4 EMPIRICAL RESULTS TO SUPPORT SOME CLAIMS IN MAIN PAPER
|
| 484 |
+
|
| 485 |
+
The following empirical results support that proposed SSRL loss better approximates the supervision (Noise2True) loss than existing self-supervised learning, particularly when Assumptions 1–2 are not completely satisfied. We used the representative self-supervised denoising setup, Noise2Self. In the camera image denoising experiments in Section 4.1, the empirical loss values (at the last epoch) of {Noise2Self, SSRL-Noise2Self, Noise2True $\}$ are {0.296, 0.244, 0.170} (in RMSE); in the low-dose CT denoising experiments in Section 4.1, those are {2186.4, 329.1, 270.2} (in $\mathrm { H U ^ { 2 } }$ ).
|
| 486 |
+
|
| 487 |
+
Figure S.10 empirically supports our claim in Section 3.1 that $g$ design “approximately” satisfy $\mathbb { E } [ g ( x ) | y ] = y$ in camera image denoising, with both simulated and real-word datasets. We calculated empirical $\mathbb { E } [ x - y | y ]$ and ${ \mathbb E } [ { \boldsymbol { g } } ( { \boldsymbol { x } } ) - { \boldsymbol { y } } | { \boldsymbol { y } } ]$ with simulated noisy BSD 300 test samples (using noise model (10)) and the real-world noisy dataset (specifically, SIDD sRGB validation samples) in Section A.4.1, where $g$ is median filtering. In the simulated dataset, the empirical measures for $\{ \arg ( | \mathbb { E } [ x - y | y ] | )$ , $\arg ( | \mathbb { E } [ g ( x ) - y | y ] | ) \}$ are $\{ 0 . 0 2 0 1 , 0 . 0 0 9 8 \}$ , where avg denotes averaging across pixels. In the real-word dataset, those are $\{ 0 . 0 1 1 3 , 0 . 0 0 8 3 \}$ . These support our claim that $\mathbb { E } [ g ( x ) | y ] = y$ is approximately satisfied with median filtering $g$ .
|
| 488 |
+
|
| 489 |
+
Figure S.11 empirically supports our claim in Section 3.2 that noise of FBP-reconstructed images in low-dose CT, i.e., $e$ in (11), has approximately zero-mean. The position of the patient table base is similar across FBP images, so it gave higher errors in the calculated sample mean; see the bottom of the image in Figure S.11.
|
| 490 |
+
|
| 491 |
+
The following empirical results support the claim in Section 3.2 that pre-trained $g$ will give better reference than $g \ : = \ : \mathcal { I }$ in low-dose CT denoising: the empirical measure of the Noise2Self loss (Batson & Royer, $2 0 1 9 ) - \mathbb { E } \| g ( x _ { J } ) _ { J ^ { c } } - x _ { J ^ { c } } \| _ { 2 } ^ { 2 } +$ – with simulated noisy CT test samples by setting $g$ as $\mathcal { T }$ and pre-trained DnCNN by Noise2Self are 2455.7 and 1839.1 (in $\mathrm { H U ^ { 2 } }$ ), respectively.
|
| 492 |
+
|
| 493 |
+

|
| 494 |
+
Figure S.10: Empirical observations of $| \mathbb { E } [ x - y | y ] |$ (left) and $| \mathbb { E } [ g ( x ) - y | y ] |$ (right) in camera image denoising ((a) Blue and yellow denote 0 and 0.1 absolute errors, respectively. (b) Blue and yellow denote 0 and 0.02 absolute errors, respectively.)
|
| 495 |
+
|
| 496 |
+

|
| 497 |
+
Figure S.11: Sample mean of noise in low-dose FBP images – e in (11). We calculated the sample mean with 200 samples.
|
| 498 |
+
|
| 499 |
+
# S.5 EXPERIMENTAL RESULTS WITH GAUSSIAN AND POISSON $^ +$ GAUSSIAN NOISE MODELS
|
| 500 |
+
|
| 501 |
+
This section studies the performance of the proposed SSRL framework with benchmark noisy datasets, MIT-Adobe FiveK data (Bychkovsky et al., 2011), corrupted by sole Gaussian and Poisson+Gaussian noises.
|
| 502 |
+
|
| 503 |
+
# S.5.1 EXPERIMENTAL SETUP
|
| 504 |
+
|
| 505 |
+
In Guassian denoising experiments, we simulated AWGN with the standard deviation value $\sigma _ { \epsilon } = 2 5$ (Huang et al., 2021; Xu et al., 2020), and selected $g$ as Wiener filtering that is known to be optimal in the sense of minimum MSE in Gaussian denoising. In Poisson+Gaussian denoising experiments, we followed the noise simulation setup (Byun et al., 2021, Tab. 5: $( \alpha , \sigma ) = ( 0 . 0 5 , 0 . 0 2 ) )$ that corresponds to $( \lambda , \sigma _ { \epsilon } ) = ( 2 0 , 5 . 1 )$ where $\lambda$ and $\sigma _ { \epsilon }$ are defined in (10). To better visualize the results, we enhanced the brightness with gamma correction (with the parameter 3). We choose the representative comparison setup, Neighbor2Neighbor, from the camera image denoising experiments in Section 4.1. This is also a state-of-the-art self-supervised denoising method, particularly when only single noisy images are available (Huang et al., 2021).
|
| 506 |
+
|
| 507 |
+
# S.5.2 COMPARISONS BETWEEN DIFFERENT LEARNING METHODS
|
| 508 |
+
|
| 509 |
+
Two observations in Figure S.12. First, in both Gaussian and Poisson+Gaussian denoising, proposed SSRL using “good” $g$ further improved a state-of-the-art self-supervised denoising method, Neighbor2Neighbor. Second, in both Gaussian and Poisson $^ +$ Gaussian denoising, the performance gap between Noise2True and Neighbor2Neighbor, is small, where the PSNR gap numbers well correspond to existing literature (Huang et al., 2021; Byun et al., 2021). We conjecture that this is because the noise assumptions of self-supervised denoising method are well satisfied in the aforementioned two experiments. This is connected to our conjecture in Section 4.2 that self-supervised denoising performance degrades, if its assumptions are not completely satisfied.
|
| 510 |
+
|
| 511 |
+

|
| 512 |
+
(b) Poisson+Gaussian denoising (i.i.d. with $( \lambda , \sigma _ { \epsilon } ) = ( 2 0 , 5 . 1 ) )$
|
| 513 |
+
Figure S.12: Comparisons of denoised images via DnCNNs from different learning methods in camera image denoising. PSNR vlaues were averaged across all MIT-Adobe FiveK test samples.
|
| 514 |
+
|
| 515 |
+
# S.6 COMPARISONS TO SELF2SELF
|
| 516 |
+
|
| 517 |
+
This section compares the proposed SSRL framework with a state-of-the-art blind image denoising (a.k.a. self-supervised denoising with a single image) method, Self2Self (Quan et al., 2020), with synthetic and real-world noisy datasets for each application (see Section 4). (We used the authors’ Self2Self implementation.)
|
| 518 |
+
|
| 519 |
+
First, in Figure S.13 and S.14, compare Self2Self with Neighbor2Neighbor and Noise2Self (the representative comparison setup in each simulated imaging experiment in Section 4.1), respectively. The comparisons show that Self2Self gives comparable results to Neighbor2Neighbor/Noise2Self.
|
| 520 |
+
|
| 521 |
+
Remind, however, that Self2Self is a blind denoising method, so it needs a significantly larger computations than Neighbor2Neighbor, when one denoises a new noisy image. With good $g$ designs (see Sections 3.1–3.2), proposed SSRL significantly outperformed Self2Self in both applications, regardless of whether their dataset is real or simulated.
|
| 522 |
+
|
| 523 |
+

|
| 524 |
+
Figure S.13: Comparisons of denoised images (right) from different learning methods and their error maps (left) in camera image denoising (blue and yellow 0 and 50 absolute errors, respectively). PSNR values were averaged across all test samples.
|
| 525 |
+
|
| 526 |
+

|
| 527 |
+
Figure S.14: Comparisons of denoised images from different learning methods in low-dose CT with synthetic and real-world datasets (display window is [800, 1200] HU). RMSE values were averaged across all test samples.
|
| 528 |
+
|
| 529 |
+
# S.7 PRELIMINARY RESULTS WITH THE TEACHER-STUDENT LEARNING PERSPECTIVE
|
| 530 |
+
|
| 531 |
+
The proposed SSRL framework is applicable to teacher-student learning (Wang & Yoon, 2021; Hinton et al., 2015; Bucilua et al., 2006) that aims to learn a smaller student network from bigger teacher ˇ network(s). We ran preliminary experiments in self-supervised low-dose CT denoising (using simulated data). The teacher model $g$ is the pre-trained 8-layer DnCNN by Noise2Self (with checkerboard masking), and we set the student model $f$ as $\{ 8 , 7 , 6 , 5 , 4 , 3 \}$ -layer DnCNN. Applying SSRLNoise2Self, we obtained the following numerical results: the RMSE (HU) values of student models with $\{ 8 , 7 , 6 , 5 , 4 , 3 \}$ -layer DnCNNs are $\{ 2 5 . 0 , 2 5 . 3 , 2 5 . 5 , 2 5 . 4 , 2 5 . 2 , 2 7 . 5 \}$ , respectively. The student DnCNNs that have the equal or lower complexity compared to its teacher network, significantly improves its teacher model of which RMSE value is 30.9 (in HU). The results might imply that student models learned from SSRL can outperform their teacher model, if they retain sufficiently high network complexity as compared to their teacher’s (e.g., 3-layer DnCNN). In addition, we have additional SSRL experiment in low-dose CT denoising with the “iterative” teacher-student perspective. The teacher model $g$ is pre-trained 5-layer DnCNN from the non-iterative teacher-student SSRL method above, and we set the student model $f$ as 3-layer DnCNN. We obtained 27.3 RMSE (in HU), implying only marginal improvement over the 3-layer DnCNN obtained by the non-iterative teacher-student SSRL method. We conjecture that iterative teacher-student SSRL needs more sophisticated $g$ -setups, such as an ensemble of teacher models (Hinton et al., 2015).
|
| 532 |
+
|
| 533 |
+
# REFERENCES
|
| 534 |
+
|
| 535 |
+
Abdelrahman Abdelhamed, Stephen Lin, and Michael S. Brown. A high-quality denoising dataset for smartphone cameras. In Proc. IEEE CVPR, pp. 1692–1700, Salt Lake City, Utah, Jun. 2018.
|
| 536 |
+
Joshua Batson and Loic Royer. Noise2Self: Blind denoising by self-supervision. In Proc. ICML, pp. 524–533, Long Beach, CA, Jun. 2019.
|
| 537 |
+
David RK Brownrigg. The weighted median filter. Commun. of the ACM, 27:807–818, 1984.
|
| 538 |
+
Cristian Bucilua, Rich Caruana, and Alexandru Niculescu-Mizil. Model compression. In ˇ Proc. ACM. SIGKDD., pp. 535–541, 2006.
|
| 539 |
+
Vladimir Bychkovsky, Sylvain Paris, Eric Chan, and Fredo Durand. Learning photographic global ´ tonal adjustment with a database of input / output image pairs. In Proc. IEEE CVPR, pp. 97–104, Colorado Springs, CO, Jun. 2011.
|
| 540 |
+
Jaeseok Byun, Sungmin Cha, and Taesup Moon. Fbi-denoiser: Fast blind image denoiser for poisson-gaussian noise. In Proc. IEEE CVPR, pp. 5768–5777, Virtual, Jun. 2021.
|
| 541 |
+
J. A. Fessler. Michigan image reconstruction toolbox (MIRT) for Matlab. Available from http: //web.eecs.umich.edu/˜fessler, 2016.
|
| 542 |
+
Allard Adriaan Hendriksen, Daniel Maria Pelt, and K Joost Batenburg. Noise2Inverse: Self- ¨ supervised deep convolutional denoising for tomography. IEEE Trans. Comput. Imag., 6:1320– 1335, Aug. 2020.
|
| 543 |
+
Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. In Proc. NIPS Workshop, pp. 1790–1798, Montreal, Canada, Dec. 2015.
|
| 544 |
+
Tao Huang, Songjiang Li, Xu Jia, Huchuan Lu, and Jianzhuang Liu. Neighbor2Neighbor: Selfsupervised denoising from single noisy images. In Proc. IEEE/CVF CVPR, pp. 14781–14790, Virtual, Jun. 2021.
|
| 545 |
+
Diederik P Kingma and Jimmy Lei Ba. Adam: A method for stochastic optimization. In Proc. ICLR 2015, pp. 1–15, San Diego, CA, May 2015.
|
| 546 |
+
Alexander Krull, Tim-Oliver Buchholz, and Florian Jug. Noise2Void - Learning denoising from single noisy images. In Proc. IEEE/CVF CVPR, pp. 2129–2137, Long Beach, CA, Jun. 2019.
|
| 547 |
+
|
| 548 |
+
Jaakko Lehtinen, Jacob Munkberg, Jon Hasselgren, Samuli Laine, Tero Karras, Miika Aittala, and Timo Aila. Noise2Noise: Learning image restoration without clean data. In Proc. ICML, pp. 2965–2974, Stockholm, Sweden, Jul. 2018.
|
| 549 |
+
|
| 550 |
+
C. McCollough. TU-FG-207A-04: Overview of the low dose CT grand challenge. Med. Phys., 43 (6Part35):3759–3760, Jun. 2016.
|
| 551 |
+
|
| 552 |
+
Taylor R Moen, Baiyu Chen, David R Holmes III, Xinhui Duan, Zhicong Yu, Lifeng Yu, Shuai Leng, Joel G Fletcher, and Cynthia H McCollough. Low-dose CT image and projection dataset. Med. Phys., 48(2):902–911, Feb. 2021.
|
| 553 |
+
|
| 554 |
+
Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. PyTorch: An imperative style, high-performance deep learning library. In Proc. NIPS, volume 32, pp. 8026–8037, Vancouver, Canada, Dec. 2019.
|
| 555 |
+
|
| 556 |
+
Yuhui Quan, Mingqin Chen, Tongyao Pang, and Hui Ji. Self2Self with dropout: Learning selfsupervised denoising from single image. In Proc. IEEE/CVF CVPR, pp. 1890–1898, Virtual, Jun. 2020.
|
| 557 |
+
|
| 558 |
+
Lin Wang and Kuk-Jin Yoon. Knowledge distillation and student-teacher learning for visual intelligence: A review and new outlooks. IEEE Trans. Pattern Anal. Mach. Intell., Jan. 2021.
|
| 559 |
+
|
| 560 |
+
Yaochen Xie, Zhengyang Wang, and Shuiwang Ji. Noise2Same: Optimizing a self-supervised bound for image denoising. In Proc. NIPS, volume 33, pp. 20320–20330, Vancouver, Canada, Dec. 2020.
|
| 561 |
+
|
| 562 |
+
Jun Xu, Yuan Huang, Li Liu, Fan Zhu, Xingsong Hou, and Ling Shao. Noisy-As-Clean: Learning unsupervised denoising from the corrupted image. IEEE Trans. Image Process., 29:9316–9329, Sep. 2020.
|
| 563 |
+
|
| 564 |
+
Kai Zhang, Wangmeng Zuo, Yunjin Chen, Deyu Meng, and Lei Zhang. Beyond a Gaussian denoiser: Residual learning of deep CNN for image denoising. IEEE Trans. Image Process., 26(7):3142– 3155, Feb. 2017.
|
md/dev/MAMOi89bOL/MAMOi89bOL.md
ADDED
|
@@ -0,0 +1,235 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Masked Autoencoders that Listen
|
| 2 |
+
|
| 3 |
+
Po-Yao Huang1 Hu Xu1 Juncheng Li2 Alexei Baevski1 Michael Auli1 Wojciech Galuba1 Florian Metze1 Christoph Feichtenhofer1
|
| 4 |
+
|
| 5 |
+
1Meta AI 2Carnegie Mellon University
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
This paper studies a simple extension of image-based Masked Autoencoders (MAE) [1] to self-supervised representation learning from audio spectrograms. Following the Transformer encoder-decoder design in MAE, our Audio-MAE first encodes audio spectrogram patches with a high masking ratio, feeding only the non-masked tokens through encoder layers. The decoder then re-orders and decodes the encoded context padded with mask tokens, in order to reconstruct the input spectrogram. We find it beneficial to incorporate local window attention in the decoder, as audio spectrograms are highly correlated in local time and frequency bands. We then fine-tune the encoder with a lower masking ratio on target datasets. Empirically, Audio-MAE sets new state-of-the-art performance on six audio and speech classification tasks, outperforming other recent models that use external supervised pre-training. Our code and models is available at https://github.com/facebookresearch/AudioMAE.
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
Transformers [2] and self-supervised learning [3, 4, 5, 6, 7, 1] are dominating computer vision (CV) and natural language processing (NLP) research. The revolution firstly started in NLP with the invention of the Transformer architecture and self-attention [8]. Masked autoencoding with BERT [3] set a new state-of-the-art on various NLP tasks by self-supervised pre-training on large-scale language corpus. Similarly in the CV community, Vision Transformers (ViT) [9] have become popular for CV tasks, and, for self-supervised image representation learning, Masked Autoencoders (MAE) [1] have brought the CV community closer to the success of BERT in NLP. In addition to the existing masked autoencoders that can read (BERT) or see (MAE), in this work we study those that can listen.
|
| 14 |
+
|
| 15 |
+
Transformer-based models have recently refreshed leaderboards for audio understanding tasks. For example, AST [10] and MBT [11] improved the audio classification performance on the AudioSet [12], Event Sound Classification [13], etc. The key technique behind this is initialization of audio model weights with ImageNet pre-trained supervised models (e.g., DeiT [14]) by deflating patch embeddings and interpolating positional embeddings for encoding audio spectrograms. However, exploiting ImageNet pre-trained models could be sub-optimal. Unlike initializing video models with weights from image models (e.g., the initial weights of I3D [15] or 3D-ResNets [16] are inflated from ImageNet pre-trained image models), there are clear and notable discrepancies between spectrograms representing audio content and natural images. It remains unclear why such heterogeneous image-toaudio transfer is useful beyond arguably similar low-level semantics such as shapes of spectrograms and shapes of visual objects. Further, any label bias would inevitably be transferred to audio models.
|
| 16 |
+
|
| 17 |
+
Addressing these concerns, self-supervised audio representation learning has recently attracted much research attention. Based on BEiT [17] that learns to reconstruct image patches or learnt patch tokens, SS-AST [18] extends to the audio domain and exploits spectrograms (akin to 1-channel 2D images) and use both contrastive and reconstruction objective as self-supervision. Without using any labels, the key enabler to effective self-supervised representation learning is large-scale pre-training data. In this work we use AudioSet [12] for pre-training, a common dataset containing ${ \sim } 2$ million audio recordings. Performing large-scale training with Transformer architectures is challenging as self-attention in Transformers has quadratic complexity w.r.t. the length of input sequence.
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: Audio-MAE for audio self-supervised learning. An audio recording is first transformed into a spectrogram and split into patches. We embed patches and mask out a large subset $( 8 0 \% )$ . An encoder then operates on the visible $( 2 0 \% )$ patch embeddings. Finally, a decoder processes the order-restored embeddings and mask tokens to reconstruct the input. Audio-MAE is minimizing the mean square error (MSE) on the masked portion of the reconstruction and the input spectrogram.
|
| 21 |
+
|
| 22 |
+
This computational burden has been addressed in different ways. A popular approach is to reduce the sequence length in self-attention. Various ViT-based architectures have been developed to alleviate such issues for image and video understanding. For example, Swin-Transformer [19] only performs local attention within windows that shift across layers. MViT [20] employs pooling attention to construct a hierarchy of Transformers where sequence lengths are downsampled. For self-supervised learning, MAE [1] efficiently encodes only a small portion $( 2 5 \% )$ of visual patches while the majority of patches is discarded. The simplicity and scalability in MAE make it a promising framework for large-scale self-supervised learning.
|
| 23 |
+
|
| 24 |
+
In this work, we study MAE for sound recognition and the unique challenges of the audio domain. We present Audio-MAE (Fig. 1) as unified and scalable framework for learning self-supervised audio representations. Similar to MAE, it is composed of a pair of a Transformer encoder and decoder. Sound is first transformed and embedded into spectrogram patches. Before feeding them into the Transformer encoder, we mask and discard the majority and only feed a small number of non-masked embeddings into the encoder for efficient encoding. After padding encoded patches with learnable embeddings to represent masked patches, it then restores the order of these patches in frequency and time and propagates them through a Transformer decoder to reconstruct the audio spectrogram.
|
| 25 |
+
|
| 26 |
+
Different from image patches, spectrogram patches are comparably local-correlated. For example, formants, the vocal tract resonances, are typically grouped and continuous locally in the spectrogram. The location in frequency and time embeds essential information that determines the semantics of a spectrogram patch and how it sounds like. To this end, we further investigate using localized attention and a hybrid architecture in the Transformer decoder to properly decode for reconstruction. This simple-yet-effective upgrade leads to improved performance for Audio-MAE.
|
| 27 |
+
|
| 28 |
+
Similar to MAE for images, we minimize the patch-normalized mean square error. At the fine-tuning stage, we discard the decoder and fine-tune the encoder with patch-masking. Empirically, AudioMAE sets a new state-of-the-art performance on six audio and speech classification tasks. It is the first audio-only self-supervised model that achieves state-of-the-art mAP on AudioSet-2M, outperforming other recent models with external supervision. We further provide the visualization and audible examples to qualitatively demonstrate the effectiveness of the Audio-MAE decoder.
|
| 29 |
+
|
| 30 |
+
# 2 Related Work
|
| 31 |
+
|
| 32 |
+
Visual masked pre-training. Masked/Denoising autoencoders [21, 22, 3] are a general representation learning methodology by reconstructing source from masked or corrupted inputs. In CV, visual masked pre-training has made recent progress [23, 24, 1, 20]. Based on ViT [9] that applies Transformers to image patches, BEiT [17] and MAE [1] present masked image modeling frameworks. BEiT [17] learns to predict discrete visual tokens generated by VAE [25] in masked patches. MAE [1] reduces sequence length by masking a large portion of image patches randomly and encoding only non-masked ones for reconstruction of pixel color information. MaskFeat [20] studies features for masked pre-training and finds that Histograms of Oriented Gradients (HoG) [26], which are in turn related to spectrogram features, perform strongly for image and video classification models. Our work extends the MAE framework for representation learning with audio spectrograms.
|
| 33 |
+
|
| 34 |
+
Out-of-domain pre-training for audio. Transferring ImageNet supervised pre-trained ViT [9] or ResNet [27] has become a popular practice for audio models [10, 28, 11, 29, 30, 31]. After pre-training, these models operate over audio spectrograms by deflating from 3-channels (RGB) into 1-channel (spectrogram) in the pre-trained patch embedding in ViT and employing the rest of the transformer blocks on top. For example, HTS-AT [29] encodes spectrograms with hierarchical Transformer initialized from the Swin Transformer [19]. MBT [11] uses ImageNet-21K pre-trained ViT; AST [10] and PaSST [28] employ DeiT [14] as the Transformer backbone. Without using out-of-domain (non-audio) data, the proposed Audio-MAE focuses on audio-only self-supervised pre-training from scratch.
|
| 35 |
+
|
| 36 |
+
In-domain pre-training for audio. Existing in-domain (i.e., audio-only) self-supervised methods can be broadly categorized by the input signal type (e.g., raw waveform [32, 33, 34], frame-level features [35, 36, 37], or spectrogram patches [18, 38]); and the objective used for self-supervision (e.g., contrastive [39, 33, 40, 41, 35] or prediction/reconstruction [18, 34, 37, 36]). For example, wav2vec 2.0 [33] takes raw waveform as inputs and exploits contrastive learning to discriminate contextualized representations in different time segments. Mockingjay [42] proposed a masked acoustic model pretext task to reconstruct frame-level Mel-features of masked time frames. SSAST [18] is the closest work to Audio-MAE and is our main benchmark. Inspired by the success of BERT [3], SS-AST proposed a self-supervised learning method which operates over spectrogram patches and employs joint contrastive and reconstructive objectives on masked patches. These previous methods generate audio representations by encoding full-view of both masked and nonmasked time or spectrogram segments for self-supervised pre-training. In contrast, Audio-MAE encodes only the non-masked spectrogram patches.
|
| 37 |
+
|
| 38 |
+
Our work is done independently and concurrently with [38, 43, 44] related methods. We also compare our model to these concurrent works in the experiments and showcase the superiority of Audio-MAE.
|
| 39 |
+
|
| 40 |
+
# 3 Audio Masked Autoencoders (Audio-MAE)
|
| 41 |
+
|
| 42 |
+
Audio-MAE is a conceptually simple extension of MAE to learn self-supervised representations from audio spectrograms. Fig. 1 depicts an overview. The details of each component are as follows.
|
| 43 |
+
|
| 44 |
+
Spectrogram Patch Embeddings. Following [10, 18], we transform audio recordings into Melspectrograms and divide them into non-overlapped regular grid patches. These patches are then flattened and embedded by a linear projection. Similar to MAE [1], we add fixed sinusoidal positional embeddings to the embedded patches.
|
| 45 |
+
|
| 46 |
+

|
| 47 |
+
Figure 2: Audio-MAE’s masking strategies on Mel-spectrograms.
|
| 48 |
+
|
| 49 |
+
Masking Strategies. Audio-MAE masks out a large subset of spectrogram patches. As a spectrogram can be viewed as a 2D representation of time and frequency components of a sound, it is reasonable to explore treating time and frequency differently during masking. In this work, we investigate both the unstructured (i.e., random masking without any prior) and structured (i.e., randomly masking a portion of time, frequency, or time $^ +$ frequency of a spectrogram) in the pre-training and fine-tuning phase. Illustrative examples are shown in Fig. 2. We show masked regions with dark overlay.
|
| 50 |
+
|
| 51 |
+
The masking mechanism, as introduced in MAE [1], is the key ingredient for efficient self-supervised learning. For a input patch sequence, this can be regarded as a Bernoulli process where each patch is masked/dropped with probability $p$ (masking ratio). Masking reduces input patch sequence length and encourages learning global, contextualized representations from limited “visible” patches. We observe that akin to images, a large masking rate ( $80 \%$ in our experiments for spectrogram patches, which is similar to $7 5 \%$ in MAE for images) is feasible for learning self-supervised audio representations. Unlike BERT [3] that uses $15 \%$ masking rate for self-supervised learning in NLP, most of the tokens/patches can be discarded for spectrograms as well as images due to high redundancy in these modalities. Beyond self-supervised pre-training, we further explore the effectiveness of masking in the supervised fine-tuning stage. Empirically, we found unstructured (random) masking at a higher ratio for pre-training and structured (time+frequency masking) at a lower ratio for fine-tuning provide best accuracy (ablations are in $\ S \_ 4 )$ ).
|
| 52 |
+
|
| 53 |
+
Encoder. Audio-MAE uses a stack of standard Transformers [2] as its encoder. The encoder only processes $( 2 0 \% )$ non-masked patches to reduce computation overhead which is quadratic to the input sequence length. We use the 12-layer ViT-Base (ViT-B) [9] Transformer as our default.
|
| 54 |
+
|
| 55 |
+
Decoder with Local Attention. The decoder is also composed of standard Transformer blocks. The encoded patches from the encoder are padded with trainable masked tokens. After restoring the original time-frequency order in the audio spectrogram, we add the decoder’s (fixed sinusoidal) positional embeddings and feed the restored sequence into the decoder. At the top of the decoder stack, we add a linear head to predict and reconstruct the input spectrogram.
|
| 56 |
+
|
| 57 |
+
To address the unique characteristics of audio spectrograms, our work investigates an enhancement to the vanilla MAE decoder. Image-based MAE uses global self-attention in the Transformer decoder which is appropriate for visual context, because visual objects are typically invariant under translation or scaling, and their exact position may not affect the semantics of an image. In contrast, the position, scale, and translation of spectrogram features however directly affects the sound or semantics of an audio recording. Consequently, global self-attention is sub-optimal for spectrograms if the timefrequency components is predominantly local. For instance, we would have better success to use the harmonics (e.g., Fig. 2a) in lower bands of a vowel to predict the spectrogram patch vertically in a higher frequency band rather than horizontally in the time domain. Similarly, a frictional sound of a consonant likely only correlates to other part of the consonant, and is without dependency to other silence segments in the audio recording. Compared to images, the spectrogram patches are more similar to speech or text tokens where its order and position is more relevant.
|
| 58 |
+
|
| 59 |
+
To address the nature of audio spectrograms, in addition to using Transformers with global self-attention as in vanilla MAE, we incorporate the local attention mechanism which groups and separates the spectrogram patches in to local windows in self-attention for decoding. We investigate two types of local attention: (1) Shifted window location: Inspired by the shifted-window in Swin Transformers [19], we shift window attention by $50 \%$ between consecutive Transformer decoder layers. For padding the margin when shifting, we cyclically shift the spectrogram to the top-left direction. Fig. 3 illustrates the localized decoder attention by shifted windows. (2) Hybrid window attention (global+local attention): Inspired by [45], to add better cross-window connections, we design a simple hybrid (global+local) attention that computes local attention within a window in all but the last few top layers. In this way, the input feature maps for the final reconstruction layer also contain global information. For simplicity, we use $_ { n o }$ pooling or hierarchical structure. Decoders with different attention types are compared in $\ S \ O = 4$ .
|
| 60 |
+
|
| 61 |
+

|
| 62 |
+
Figure 3: Decoder’s local attention and shifted window (right).
|
| 63 |
+
|
| 64 |
+
Objective. The Audio-MAE decoder learns to reconstruct the input spectrogram by predicting the values in the spectrogram patches or their per-patch normalized ones. The objective is the mean squared error (MSE) between the prediction and the input spectrogram, averaged over unknown patches. Empirically we found employing the reconstruction loss alone is sufficient while including additional contrastive objectives (e.g., InfoNCE loss [46]) does not improve Audio-MAE.
|
| 65 |
+
|
| 66 |
+
Fine-tuning for Downstream Tasks. In the fine-tuning stage, we only keep and fine-tune the AudioMAE encoder and discard the decoder. Different from the original MAE, and inspired by [47, 28], we also explore to employ masking in the fine-tuning stage to remove a portion of patches to further regularize learning from a limited view of spectrogram inputs, which, as a side effect, also reduces computation during fine-tuning. Compared to SpecAug [48] which takes full-length input with the masked portion set to zero as data augmentation, Audio-MAE sees only a subset of real-valued input patches without the nullified ones. Audio-MAE then encodes these non-masked patches and applies an average pooling layer followed by a linear layer on top for fine-tuning in classification tasks.
|
| 67 |
+
|
| 68 |
+
# 4 Experiments
|
| 69 |
+
|
| 70 |
+
We perform an extensive evaluation on six tasks, including audio classification on AudioSet (AS-2M, AS-20K) and Environmental Sound Classification (ESC-50), and speech classification on Speech Commands (SPC-1 and SPC-2) and VoxCeleb (SID). We use AudioSet for ablation studies.
|
| 71 |
+
|
| 72 |
+
# 4.1 Datasets and Tasks
|
| 73 |
+
|
| 74 |
+
AudioSet [12] (AS-2M, AS-20K) contains ${ \sim } 2$ million 10-second YouTube clips for audio classification. 527 types of audio events are weakly annotated [49, 50, 51] for each clip. There could be multiple events in a clip. The full training set has 2 subsets: A class-wise balanced (22,176 clips) and an unbalanced (2,042,985 clips) set. The eval set has 20,383 clips. We downloaded and processed around 1.96M unbalanced training, 21K balanced training, and 19K evaluation clips.
|
| 75 |
+
|
| 76 |
+
For the AS-2M experiments, we use the union of unbalanced and balanced training audio for pretraining and fine-tuning. For the AS-20K experiments, we use AS-2M for pre-training and the 20K balanced set for fine-tuning. We report the testing mAP on the 19K eval set used by AST [10].
|
| 77 |
+
|
| 78 |
+
Environmental Sound Classification (ESC-50) [13] is an audio classification dataset consists of 2,000 5-second environmental sound recordings. There are 50 classes in ESC. We report accuracy under 5-fold cross-validation with the same split used by [10].
|
| 79 |
+
|
| 80 |
+
Speech Commands (SPC-2, SPC-1) [52] are two keyword spotting tasks. In SPC-2, there are 35 speech commands. The training/validation/testing set has 84,843/9,981/11,005 1-second recordings, respectively. In SPC-1, there are 10 classes of keywords, 1 silence class, and 1 unknown class that includes all the other 20 common speech commands. We use the data and split provided in the SUPERB [53] benchmark to report the testing accuracy.
|
| 81 |
+
|
| 82 |
+
VoxCeleb (SID) [54] contains 150K utterances from 1,251 speakers. The speaker identification task (SID) is to classify the utterances to identify its original speaker. We use the V1 standard train (138,361), validation (6,904), testing (8,251) sets and report the testing accuracy.
|
| 83 |
+
|
| 84 |
+
# 4.2 Implementation Details
|
| 85 |
+
|
| 86 |
+
We use a vanilla 12-layer ViT-B by default as the Transformer encoder. For the decoder, we use a 16-layer Transformer with shifted local attention. We investigate the vanilla (global attention) and hybrid (global+local attention) decoder variants (see Table. 1c).
|
| 87 |
+
|
| 88 |
+
Following [10, 11], we transform raw waveform (pre-processed as mono channel under 16,000 sampling rate) into 128 Kaldi [55]-compatible Mel-frequency bands with a $2 5 \mathrm { m s }$ Hanning window that shifts every $1 0 ~ \mathrm { m s }$ . For a 10-second recording in AudioSet, the resulting spectrogram is of $1 \times 1 0 2 4 \times 1 2 8$ dimension.
|
| 89 |
+
|
| 90 |
+
For patch embedding, we use convolutional kernels with (16, 16) size and stride in time and frequency (thus, patches are non-overlapping) to avoid short-cuts via overlap in self-supervision (though, at high masking ratios such short-cuts are less severe). By default, we use a masking ratio of 0.8 with (unstructured) random masking for pre-training. During fine-tuning, we employ a lower masking ratio (0.3 in time and 0.3 in frequency). Ablations on these design choices are given in $\ S \ O = 4$ .
|
| 91 |
+
|
| 92 |
+
# 4.3 Pre-training and Fine-tuning
|
| 93 |
+
|
| 94 |
+
We use AudioSet-2M for pre-training and randomly iterate over all audio recordings. We train for 32 epochs with a batch size of 512 and a 0.0002 learning rate. We distribute the training load over 64 V100 GPUs and the total training time is ${ \sim } 3 6$ hours. For each audio, we randomly sample the starting time, cyclically extract 10-second audio, and randomly jitter its magnitude by up to $\pm 6 \mathrm { d B }$ . We use only natural audio spectrograms and apply no augmentations (e.g., [48, 56, 57]) as we do not find these strong augmentations helpful in the pre-training phase.
|
| 95 |
+
|
| 96 |
+
In the fine-tuning phase, we remove the decoder and only fine-tune the encoder. For the supervised fine-tuning on AudioSet-2M, since the size of training samples are uneven across classes (unbalanced), we follow the common practice of using a weighted sampling to balance the classes during training. In each epoch, we sample 200K instances ( $\mathord { \sim } 1 0 \%$ of AudioSet-2M) without replacement. We fine-tune for 100 epochs, which aggregate to ${ \sim } 1 0$ full epochs of AudioSet-2M. The probability of sampling an instance is inversely proportional to the dataset-wise occurrences of its classes. Fine-tuning on 64 GPUs takes ${ \sim } 1 2$ hours. For the smaller balanced AudioSet-20K, we fine-tune on 4 GPUs for 60 epochs without weighted sampling. Please see Supplementary for the details on other datasets.
|
| 97 |
+
|
| 98 |
+

|
| 99 |
+
Figure 4: Masking strategy. For pre-training, a higher ratio and unstructured masking (random) is preferred. For fine-tuning, a lower ratio and structured masking (time $^ +$ frequency) is better. The y-axes are mAP on AS-2M and the $\mathbf { X }$ -axes are masking ratio. This ablation format follows [1].
|
| 100 |
+
|
| 101 |
+
# 4.4 Ablations and Model Properties
|
| 102 |
+
|
| 103 |
+
Masking Strategies in Pre-training and Fine-tuning. In Fig. 4, we compare different pre-training and fine-tuning masking strategies for Audio-MAE. First, in Fig. 4a we explore the pre-training masking ratio. We observe, similar as in MAE for images [1], that a high pre-training masking ratio $80 \%$ in our case) is optimal for audio spectrograms. This is due to the fact that both audio spectrograms and images are continuous signals with significant redundancy. Further, we find the unstructured random masking works the best for self-supervised pre-training over more structured masking (e.g., time+frequency).
|
| 104 |
+
|
| 105 |
+
Unlike MAE for images, there are clear performance differences among masking strategies when pre-training with audio spectrograms. Comparing Audio-MAE reconstructions between Fig. 6a to 6e and 6d to 6h, under the same masking ratio, we observe the unstructured random masking is comparably easier than structured masking (i.e., time and/or frequency) as the model can guess the missing component by extrapolating nearby context (e.g., formants in vowels and frictional sounds in consonants around). We also observe that for higher masking ratios, the structured masking alternatives drop in performance, presumably because the task becomes too difficult while random masking improves steadily up to $80 \%$ . This result show that designing a pretext task with proper hardness is important for effective self-supervised learning of audio representations. We therefore use random masking with ratio of $80 \%$ as our default for pre-training.
|
| 106 |
+
|
| 107 |
+
Fig. 4b studies the effect of masking during the fine-tuning phase. We see that in this case, it is more beneficial to use structured masking: time+frequency performs better than time- or frequency-based masking, and these perform better than unstructured masking. Overall, we see that the optimal masking ratios are lower than for pre-training and we use 0.3 as our default in the fine-tuning phase.
|
| 108 |
+
|
| 109 |
+
In general, we observe that for task-agnostic pre-training, unstructured masking with a higher ratio is preferred. While in task-specific fine-tuning, structured masking with lower ratios performs better.
|
| 110 |
+
|
| 111 |
+
Impact of Patch Size and Stride. We compare the performance of Audio-MAE trained with different patch sizes and strides in Table 1a. A non-zero overlap (i.e., stride $<$ patch size) between patches will increase the number of patches and quadratically increase computation in floating point operations (FLOPs), as reported in the table. Most prior works follow AST [10] to use overlapped patches (patch $= 1 6$ and stride $= 1 0$ ) to boost end task performance. As shown in Table 1a, we do not observe a performance improvement using overlapped patches for Audio-MAE (both $4 7 . 3 \mathrm { m A P }$ ), presumably because due to overlap, the patch embedding can leak information into the masked patches. The non-overlapped $1 6 \times 1 6$ patches achieve a good balance between computation and performance. By default, we use this setup in our experiments.
|
| 112 |
+
|
| 113 |
+
Encoder. We investigate the design choices of encoder and decoder architectures in Audio-MAE. Table 1b shows the trade-off between encoder model size and performance. As expected, larger models achieve better performance, at a cost of computation and memory. The accuracy gain of ViT-L over ViT-B/S is more significant on the smaller and balanced AS-20K. For ViT-S, the performance
|
| 114 |
+
|
| 115 |
+
<table><tr><td>(16,16), (16,16)</td><td>64×8</td><td>48.647.3</td><td></td></tr><tr><td>(16,16), (10,10)</td><td>101×12</td><td>130.5</td><td>47.3</td></tr><tr><td>(32,16), (16,16)</td><td>63×8</td><td>47.8</td><td>46.6</td></tr><tr><td>(16,32), (16,16)</td><td>64×7</td><td>42.1</td><td>46.8</td></tr></table>
|
| 116 |
+
|
| 117 |
+
<table><tr><td>ViT-S</td><td>22M</td><td>32.1</td><td>45.0</td></tr><tr><td>ViT-B</td><td>86M</td><td>37.1</td><td>47.3</td></tr><tr><td>ViT-L</td><td>304M</td><td>37.6</td><td>47.4</td></tr></table>
|
| 118 |
+
|
| 119 |
+
scenario IN-SSL IN-SL AS-SSL AS-20K AS-2M
|
| 120 |
+
|
| 121 |
+
<table><tr><td>Attention type</td><td>AS-20K AS-2M ESC-50 SID</td></tr><tr><td>Global(8) (vanilla)</td><td>36.6 46.8</td></tr><tr><td>93.6 94.1 47.3 94.1</td><td>Local(16) (shifted) 37.1</td></tr><tr><td>Hwin (local(8)+ global(4) 36.8</td><td>94.8 47.3 93.8 95.0</td></tr></table>
|
| 122 |
+
|
| 123 |
+

|
| 124 |
+
(h) External ImageNet (IN) pre-training. SSL: w/ selfsupervised MAE. SL: w/ supervised (fine-tuned) MAE.
|
| 125 |
+
|
| 126 |
+
Table 1: Ablation studies on AS-2M. The gray entries are the default Audio-MAE setup (ViT-B encoder, decoder with shifted local attention, pre-trained for 32 epochs). Table format follows [1].
|
| 127 |
+
|
| 128 |
+
gap to ViT-B can be significantly closed $\mathrm { 5 . 0 \to 2 . 3 \ m A P }$ ) when fine-tuning with more in-domain data $( \mathrm { A S } - 2 0 \mathrm { K } \mathrm { A S } - 2 \mathrm { M } )$ ).
|
| 129 |
+
|
| 130 |
+
Decoder. Table 1c compares decoder attention types in Audio-MAE. Note that decoders are discarded after pretraining and only the equal-sized ViT-B encoders are fine-tuned for the end task. Our results show that local attention with shifted window achieves the best performance. Combining local and global attention (i.e., hybrid attention, Hwin) also improves vanilla global self-attention. Fig. 5 shows the qualitative reconstruction comparison. In the spectrogram of vowels, the decoder with local attention reconstructs better harmonics and recovers more context in the spectrogram. Similar phenomena are observed in the frictional sound in the middle consonant.
|
| 131 |
+
|
| 132 |
+

|
| 133 |
+
Figure 5: Decoder reconstruction comparison.
|
| 134 |
+
|
| 135 |
+
Table 1d ablates the impact of decoder depth on mAP. A deeper 16-layer decoder achieves better performance against its shallower variants. Note that our decoder uses local window attention by default where only a fraction of tokens $4 { \times } 4$ local windows vs. $6 4 \times 8$ with global attention) are attended. For global attention we find 8-layer decoders to perform better than 16-layer. Table 1e compares decoder width (embedding dimension). A 512-dimension decoder achieves a good trade-off between computation and performance as a wider one is not better.
|
| 136 |
+
|
| 137 |
+
Pre-training Data and Setup. Table 1f summarizes the impact of pre-training dataset size. Overall the model performance is monotonically increasing when using more data for pre-training. Comparing the performance of using $1 \%$ well-annotated AS-20K balanced data to using randomly sampled 20K unbalanced data for pre-training, the similar mAPs (39.4 vs 39.6) suggest that the distribution of data classes (balanced vs. unbalanced) is less important for pre-training. Meanwhile, as shown in Table $1 \mathrm { g }$ , training for longer is beneficial yet the performance saturates after the 24-th epoch.
|
| 138 |
+
|
| 139 |
+
Out-of-domain Pre-training on ImageNet. Initializing audio models from ImageNet pre-trained weights has become popular for audio classification. However, as there are significant discrepancies between image and audio modalities, it is questionable if out-of-domain pre-training benefits audio representation learning. In Table 1h we design 3 scenarios to investigate this for Audio-MAE: (1)
|
| 140 |
+
|
| 141 |
+
Table 2: Comparison with other state-of-the-art models on audio and speech classification tasks. Metrics are mAP for AS and accuracy $( \% )$ for ESC/SPC/SID. For pre-training (PT) dataset, AS:AudioSet, LS:LibriSpeech, and IN:ImageNet. †: Fine-tuning results with additional supervised training on AS-2M. We gray-out models pre-trained with external non-audio datasets (e.g., ImageNet). Best single models in AS-2M are compared (no ensembles). \*: linear evaluation results from [53].
|
| 142 |
+
|
| 143 |
+
<table><tr><td>Moder</td><td>Backbone</td><td></td><td>P1-DataAS-20K</td><td>AS-ZMI</td><td>ESC-30</td><td>SPC-2</td><td>SPC-1</td><td>SID</td></tr><tr><td>No pre-training</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>ERANN [58]</td><td>CNN</td><td></td><td></td><td>45.0</td><td>89.2</td><td></td><td></td><td></td></tr><tr><td>PANN [59]</td><td>CNN</td><td></td><td>27.8</td><td>43.1</td><td>83.3</td><td>61.8</td><td></td><td></td></tr><tr><td colspan="9">In-domain self-supervised pre-training</td></tr><tr><td>wav2vec 2.0 [33]</td><td>Transformer</td><td>LS</td><td></td><td></td><td></td><td></td><td>96.2*</td><td>75.2*</td></tr><tr><td>HuBERT[35]</td><td>Transformer</td><td>LS</td><td></td><td></td><td></td><td></td><td>96.3*</td><td>81.4*</td></tr><tr><td>Conformer [37]</td><td>Conformer</td><td>AS</td><td>=</td><td>41.1</td><td>88.0</td><td>=</td><td>-</td><td>-</td></tr><tr><td>SS-AST[18]</td><td>ViT-B</td><td>AS+LS</td><td>31.0</td><td>1</td><td>88.8</td><td>98.0</td><td>96.0</td><td>64.3</td></tr><tr><td colspan="9">Concurrent MAE-based works</td></tr><tr><td>MaskSpec [43]</td><td>ViT-B</td><td>AS</td><td>32.3</td><td>47.1</td><td>89.6</td><td>97.7</td><td>=</td><td></td></tr><tr><td>MAE-AST[38]</td><td>ViT-B</td><td>AS+LS</td><td>30.6</td><td>-</td><td>90.0</td><td>97.9</td><td>95.8</td><td>63.3</td></tr><tr><td>Audio-MAE (global)</td><td>ViT-B</td><td>AS</td><td>36.6±.11</td><td>46.8±.06</td><td>93.6±.11</td><td>98.3±.06</td><td>97.6±.06</td><td>94.1±.06</td></tr><tr><td>Audio-MAE (local)</td><td>ViT-B</td><td>AS</td><td>37.0±.11</td><td>47.3±.11</td><td>94.1±.10</td><td>98.3±.06</td><td>96.9±.00</td><td>94.8± .11</td></tr><tr><td colspan="9">Out-of-domain supervised pre-training</td></tr><tr><td>PSLA [30]</td><td>EffNet [60]</td><td>IN</td><td>31.9</td><td>44.4</td><td>=</td><td>96.3</td><td>=</td><td></td></tr><tr><td>AST[10]</td><td>DeiT-B</td><td>IN</td><td>34.7</td><td>45.9</td><td>88.7</td><td>98.1</td><td>95.5</td><td>41.1</td></tr><tr><td>MBT[11]</td><td>ViT-B</td><td>IN-21K</td><td>31.3</td><td>44.3</td><td>1</td><td>-</td><td>=</td><td></td></tr><tr><td>HTS-AT [29]</td><td>Swin-B</td><td>IN</td><td>=</td><td>47.1</td><td>97.0t</td><td>98.0</td><td></td><td></td></tr><tr><td>PaSST[28]</td><td>DeiT-B</td><td>IN</td><td></td><td>47.1</td><td>96.8†</td><td>-</td><td></td><td></td></tr></table>
|
| 144 |
+
|
| 145 |
+
Audio-only pre-training (AS-SSL) from scratch. We consider this the ideal schema for learning audio representations as it is a simple and clean setup that prevents uncontrollable bias transfer from other modalities. (2) Directly using self-supervised ImageNet MAE models (IN-SSL) and its fine-tuned variant (IN-SL). (3) Audio-MAE self-supervised pre-training on top of these ImageNet weights.
|
| 146 |
+
|
| 147 |
+
The results show that (1) from-scratch audio-only pre-training is the best. For scenarios (2) and (3), we observe that ImageNet pre-training alone (2) is not sufficient (especially when the downstream data is smaller, AS-20K), and, in self-supervised pre-training on AudioSet, ImageNet initialization (3) does not help but degrades accuracy. Also in (3), supervised ImageNet pre-training (IN-SL) seems harmful. Consequently, the result suggests that out-of-domain pre-training (i.e., ImageNet) is not helpful for Audio-MAE, possibly due to domain shift.
|
| 148 |
+
|
| 149 |
+
# 4.5 Comparison with the State-of-the-art
|
| 150 |
+
|
| 151 |
+
Table 2 compares Audio-MAE (with 3-run error bars) to prior state-of-the-art. We categorize the comparison into 3 groups. For fair comparison, our main benchmark is the models in the middle group with self-supervised pre-training on in-domain (audio) datasets (AudioSet and LibriSpeech). For reference we also list other models without pre-training (the top group) and other models with supervised pre-training on out-of-domain ImageNet (the bottom group), where the latter contains previous best systems on the datasets.
|
| 152 |
+
|
| 153 |
+
Pre-trained on AudioSet, Audio-MAE achieves the best performance across all tasks compared to other models with in-domain self-supervised pre-training. On AudioSet-20K, its $3 7 . 1 \ \mathrm { m A P }$ significantly outperforms all other approaches including concurrent works and other models with outof-domain pre-training. On AudioSet-2M and ESC-50, our method also outperforms Conformer [37] and SS-AST [18]. Notably, unlike SS-AST and concurrent MAE-AST [38], which trained with additional 1,000 hours of speech in Librispeech, we use only AudioSet for pre-training.
|
| 154 |
+
|
| 155 |
+
In the bottom group of Table 2, Audio-MAE also outperforms previous state-of-the-art models with ImageNet supervised pre-training. Note that the proposed Audio-MAE does not rely on any out-ofdomain data and labels, nor using knowledge distillation (e.g., DeiT) from additional CNN-based models. Also, compared to HTS-AT [29] and PaSST [28], Audio-MAE is trained with audio under 16K sampling rate. As experimented in [59], there could be up to 0.4 potential mAP improvement for Audio-MAE if audio with 32K sampling rate are available.
|
| 156 |
+
|
| 157 |
+

|
| 158 |
+
Figure 6: Spectrogram reconstruction visualizations on the AudioSet eval set. Column-wise type: speech, music, event, others. Masking type: (a-d) unstructured (random); (e-h) structured (time $^ +$ frequency). Masking Ratio: $70 \%$ . In each group, we show the original spectrogram (1, top), masked input (2, middle), and MAE output (3, bottom). The spectrogram size is $1 0 2 4 \times 1 2 8$ ; patch size is $1 6 \times 1 6$ . Each sample has $6 4 \times 8 = 5 1 2$ patches with 154 ( $70 \%$ masked) patches being visible to Audio-MAE. Please click (1 2 3) for audible .wavs. More audible examples are in Supplementary.
|
| 159 |
+
|
| 160 |
+
For the speech tasks (SPC-1, SPC-2, and SID), Audio-MAE outperforms other models without pre-training (ERANN [58], PANN [59]), supervised (AST) and self-supervised models (SS-AST, MAE-AST). We further list other works (marked with \*) to include the latest results introduced in the SUPERB [53] benchmark. But note that these results are not strictly comparable since SUPERB employs linear evaluation where the underlying pre-trained models are not end-to-end fine-tuned.
|
| 161 |
+
|
| 162 |
+
In summary, with audio-only from-scratch pre-training on AudioSet, our Audio-MAE performs well for both the audio and speech classification tasks.
|
| 163 |
+
|
| 164 |
+
# 4.6 Visualization and Audible Examples by Audio-MAE Decoder
|
| 165 |
+
|
| 166 |
+
For better visualization, we follow MAE [1] to use MSE over non-normalized spectrograms as the selfsupervised objective. We use ViT-L as the Audio-MAE encoder for visualization. Fig. 6 illustrates the reconstruction results sampled from the AudioSet-2M eval set. We further reconstruct .wavs using the Griffin-Lim [61] algorithm, audible under the anonymous links (accessible in respective 1 2 3).
|
| 167 |
+
|
| 168 |
+
As can be seen and heard, for various masking strategies and different sounds, our Audio-MAE generates reasonable reconstruction. It works well for noisy event sounds (e.g., the reconstructed siren in Fig. 6c-3), as well as speech and music (e.g., the reconstructed singing in Fig. 6b-3). Notably, unlike visual contents that are typically scale/translation/position invariant [19], absolute positions and arrangement of spectrogram components are critical for humans to understand sound [62]. For example, shifting a pitch will make an audio sounds completely different. Also, phoneme sequences in time are important cues for speech understanding. Consequently, unstructured masking produces better aligned outputs that are closer to the ground-truth (top row in each subfigure) as the model can make better predictions based on nearby spectrogram patches; while structured masking is harder (less accurate or with words missing), especially when masking is performed over the time axis. A failure example (missing words) is the reconstructed speech in Fig. 6e-3.
|
| 169 |
+
|
| 170 |
+
# 5 Conclusion
|
| 171 |
+
|
| 172 |
+
We have explored a simple extension of MAE [1] to audio data. Our Audio-MAE learns to reconstruct masked spectrogram patches from audio recordings and achieves state-of-the-art performance on six audio and speech classification tasks. We have drawn four interesting observations: First, a simple MAE approach works surprisingly well for audio spectrograms. Second, we find that it is possible to learn stronger representations with local self-attention in the decoder. Third, we show that masking can be applied to both pre-training and fine-tuning, improving accuracy and reducing training computation. The optimal strategy depends on the nature of the data (audio, image, etc.) and the learning type (self-/supervised). Fourth, the best performance can be achieved by pre-training and fine-tuning under the same modality, without reliance on cross-modality transfer learning. In future work, we aim to explore multimodal self-supervised learning with a joint audio-visual MAE approach as these domains share natural correspondences in video data.
|
| 173 |
+
|
| 174 |
+
Acknowledgements. We thank Kaiming He and Luke Zettlemoyer for their feedback and discussions.
|
| 175 |
+
|
| 176 |
+
# References
|
| 177 |
+
|
| 178 |
+
[1] K. He, X. Chen, S. Xie, Y. Li, P. Dollár, and R. Girshick, “Masked autoencoders are scalable vision learners,” arXiv preprint arXiv:2111.06377, 2021. [2] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, L. Kaiser, and I. Polosukhin, “Attention is all you need,” in Proceedings of the 31st International Conference on Neural Information Processing Systems, ser. NIPS’17. USA: Curran Associates Inc., 2017, pp. 6000–6010.
|
| 179 |
+
[3] J. Devlin, M. Chang, K. Lee, and K. Toutanova, “BERT: pre-training of deep bidirectional transformers for language understanding,” in Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, NAACL-HLT 2019, Minneapolis, MN, USA, June 2-7, 2019, Volume 1 (Long and Short Papers). Association for Computational Linguistics, 2019, pp. 4171–4186.
|
| 180 |
+
[4] T. B. Brown, B. Mann, N. Ryder, M. Subbiah, J. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry, A. Askell, S. Agarwal, A. Herbert-Voss, G. Krueger, T. Henighan, R. Child, A. Ramesh, D. M. Ziegler, J. Wu, C. Winter, C. Hesse, M. Chen, E. Sigler, M. Litwin, S. Gray, B. Chess, J. Clark, C. Berner, S. McCandlish, A. Radford, I. Sutskever, and D. Amodei, “Language models are few-shot learners,” in Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020. [5] Y. Liu, M. Ott, N. Goyal, J. Du, M. Joshi, D. Chen, O. Levy, M. Lewis, L. Zettlemoyer, and V. Stoyanov, “Roberta: A robustly optimized BERT pretraining approach,” CoRR, vol. abs/1907.11692, 2019.
|
| 181 |
+
[6] K. He, H. Fan, Y. Wu, S. Xie, and R. B. Girshick, “Momentum contrast for unsupervised visual representation learning,” in 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition, CVPR 2020, Seattle, WA, USA, June 13-19, 2020. Computer Vision Foundation / IEEE, 2020, pp. 9726–9735.
|
| 182 |
+
[7] X. Chen, S. Xie, and K. He, “An empirical study of training self-supervised vision transformers,” in 2021 IEEE/CVF International Conference on Computer Vision, ICCV 2021, Montreal, QC, Canada, October 10-17, 2021. IEEE, 2021, pp. 9620–9629. [8] R. Paulus, C. Xiong, and R. Socher, “A deep reinforced model for abstractive summarization,” arXiv, vol. abs/1705.04304, 2017. [9] A. Dosovitskiy, L. Beyer, A. Kolesnikov, D. Weissenborn, X. Zhai, T. Unterthiner, M. Dehghani, M. Minderer, G. Heigold, S. Gelly et al., “An image is worth 16x16 words: Transformers for image recognition at scale,” arXiv preprint arXiv:2010.11929, 2020.
|
| 183 |
+
[10] Y. Gong, Y. Chung, and J. R. Glass, “AST: audio spectrogram transformer,” in Interspeech 2021, 22nd Annual Conference of the International Speech Communication Association, Brno, Czechia, 30 August - 3 September 2021. ISCA, 2021, pp. 571–575.
|
| 184 |
+
[11] A. Nagrani, S. Yang, A. Arnab, A. Jansen, C. Schmid, and C. Sun, “Attention bottlenecks for multimodal fusion,” in Advances in Neural Information Processing Systems 34: Annual Conference on Neural Information Processing Systems 2021, NeurIPS 2021, December 6-14, 2021, virtual, 2021, pp. 14 200–14 213.
|
| 185 |
+
[12] J. F. Gemmeke, D. P. Ellis, D. Freedman, A. Jansen, W. Lawrence, R. C. Moore, M. Plakal, and M. Ritter, “Audio set: An ontology and human-labeled dataset for audio events,” in 2017 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP). IEEE, 2017, pp. 776–780.
|
| 186 |
+
[13] K. J. Piczak, “ESC: Dataset for Environmental Sound Classification,” in Proceedings of the 23rd Annual ACM Conference on Multimedia. ACM Press, 2015, pp. 1015–1018.
|
| 187 |
+
[14] H. Touvron, M. Cord, M. Douze, F. Massa, A. Sablayrolles, and H. Jégou, “Training dataefficient image transformers & distillation through attention,” in International Conference on Machine Learning. PMLR, 2021, pp. 10 347–10 357.
|
| 188 |
+
[15] J. Carreira and A. Zisserman, “Quo vadis, action recognition? A new model and the kinetics dataset,” in 2017 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2017, Honolulu, HI, USA, July 21-26, 2017. IEEE Computer Society, 2017, pp. 4724–4733.
|
| 189 |
+
[16] C. Feichtenhofer, A. Pinz, and R. P. Wildes, “Spatiotemporal residual networks for video action recognition,” in NIPS, 2016.
|
| 190 |
+
[17] H. Bao, L. Dong, and F. Wei, “Beit: BERT pre-training of image transformers,” CoRR, vol. abs/2106.08254, 2021.
|
| 191 |
+
[18] Y. Gong, C.-I. Lai, Y.-A. Chung, and J. R. Glass, “Ssast: Self-supervised audio spectrogram transformer,” ArXiv, vol. abs/2110.09784, 2021.
|
| 192 |
+
[19] 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 2021 IEEE/CVF International Conference on Computer Vision, ICCV 2021, Montreal, QC, Canada, October 10-17, 2021. IEEE, 2021, pp. 9992–10 002.
|
| 193 |
+
[20] C. Wei, H. Fan, S. Xie, C. Wu, A. L. Yuille, and C. Feichtenhofer, “Masked feature prediction for self-supervised visual pre-training,” CoRR, vol. abs/2112.09133, 2021.
|
| 194 |
+
[21] P. Vincent, H. Larochelle, Y. Bengio, and P. Manzagol, “Extracting and composing robust features with denoising autoencoders,” in Machine Learning, Proceedings of the Twenty-Fifth International Conference (ICML 2008), Helsinki, Finland, June 5-9, 2008, ser. ACM International Conference Proceeding Series, vol. 307. ACM, 2008, pp. 1096–1103.
|
| 195 |
+
[22] P. Vincent, H. Larochelle, I. Lajoie, Y. Bengio, and P. Manzagol, “Stacked denoising autoencoders: Learning useful representations in a deep network with a local denoising criterion,” J. Mach. Learn. Res., vol. 11, pp. 3371–3408, 2010.
|
| 196 |
+
[23] D. Pathak, P. Krähenbühl, J. Donahue, T. Darrell, and A. A. Efros, “Context encoders: Feature learning by inpainting,” in 2016 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2016, Las Vegas, NV, USA, June 27-30, 2016. IEEE Computer Society, 2016, pp. 2536–2544.
|
| 197 |
+
[24] M. Chen, A. Radford, R. Child, J. Wu, H. Jun, D. Luan, and I. Sutskever, “Generative pretraining from pixels,” in Proceedings of the 37th International Conference on Machine Learning, ICML 2020, 13-18 July 2020, Virtual Event, ser. Proceedings of Machine Learning Research, vol. 119. PMLR, 2020, pp. 1691–1703.
|
| 198 |
+
[25] A. Ramesh, M. Pavlov, G. Goh, S. Gray, C. Voss, A. Radford, M. Chen, and I. Sutskever, “Zero-shot text-to-image generation,” in Proceedings of the 38th International Conference on Machine Learning, ICML 2021, 18-24 July 2021, Virtual Event, ser. Proceedings of Machine Learning Research, vol. 139. PMLR, 2021, pp. 8821–8831.
|
| 199 |
+
[26] N. Dalal and B. Triggs, “Histograms of oriented gradients for human detection,” in 2005 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (CVPR 2005), 20-26 June 2005, San Diego, CA, USA. IEEE Computer Society, 2005, pp. 886–893.
|
| 200 |
+
[27] K. He, X. Zhang, S. Ren, and J. Sun, “Deep residual learning for image recognition,” 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 770–778, 2015.
|
| 201 |
+
[28] K. Koutini, J. Schlüter, H. Eghbal-zadeh, and G. Widmer, “Efficient training of audio transformers with patchout,” CoRR, vol. abs/2110.05069, 2021.
|
| 202 |
+
[29] K. Chen, X. Du, B. Zhu, Z. Ma, T. Berg-Kirkpatrick, and S. Dubnov, “Hts-at: A hierarchical token-semantic audio transformer for sound classification and detection,” arXiv preprint arXiv:2202.00874, 2022.
|
| 203 |
+
[30] Y. Gong, Y. Chung, and J. Glass, “Psla: Improving audio tagging with pretraining, sampling, labeling, and aggregation,” IEEE/ACM Transactions on Audio, Speech, and Language Processing, 2021.
|
| 204 |
+
[31] Y. Gong, S. Khurana, A. Rouditchenko, and J. Glass, “Cmkd: Cnn/transformer-based cross-model knowledge distillation for audio classification,” 2022.
|
| 205 |
+
[32] S. Schneider, A. Baevski, R. Collobert, and M. Auli, “wav2vec: Unsupervised pre-training for speech recognition,” in Interspeech 2019, 20th Annual Conference of the International Speech Communication Association, Graz, Austria, 15-19 September 2019. ISCA, 2019, pp. 3465–3469.
|
| 206 |
+
[33] A. Baevski, Y. Zhou, A. Mohamed, and M. Auli, “wav2vec 2.0: A framework for self-supervised learning of speech representations,” in Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020.
|
| 207 |
+
[34] A. Baevski, W. Hsu, Q. Xu, A. Babu, J. Gu, and M. Auli, “data2vec: A general framework for self-supervised learning in speech, vision and language,” CoRR, vol. abs/2202.03555, 2022.
|
| 208 |
+
[35] W.-N. Hsu, B. Bolte, Y.-H. H. Tsai, K. Lakhotia, R. Salakhutdinov, and A. Mohamed, “Hubert: Self-supervised speech representation learning by masked prediction of hidden units,” IEEE/ACM Transactions on Audio, Speech, and Language Processing, vol. 29, pp. 3451–3460, 2021.
|
| 209 |
+
[36] B. Shi, W. Hsu, and A. Mohamed, “Robust self-supervised audio-visual speech recognition,” CoRR, vol. abs/2201.01763, 2022.
|
| 210 |
+
[37] S. Srivastava, Y. Wang, A. Tjandra, A. Kumar, C. Liu, K. Singh, and Y. Saraf, “Conformer-based self-supervised learning for non-speech audio tasks,” arXiv preprint arXiv:2110.07313, 2021.
|
| 211 |
+
[38] A. Baade, P. Peng, and D. Harwath, “Mae-ast: Masked autoencoding audio spectrogram transformer,” arXiv preprint arXiv:2203.16691, 2022.
|
| 212 |
+
[39] A. van den Oord, Y. Li, and O. Vinyals, “Representation learning with contrastive predictive coding,” CoRR, vol. abs/1807.03748, 2018.
|
| 213 |
+
[40] R. Arandjelovic and A. Zisserman, “Objects that sound,” in Computer Vision - ECCV 2018 - 15th European Conference, Munich, Germany, September 8-14, 2018, Proceedings, Part I, ser. Lecture Notes in Computer Science, vol. 11205. Springer, 2018, pp. 451–466.
|
| 214 |
+
[41] M. Patrick, P. Huang, I. Misra, F. Metze, A. Vedaldi, Y. M. Asano, and J. F. Henriques, “Space-time crop & attend: Improving cross-modal video representation learning,” in 2021 IEEE/CVF International Conference on Computer Vision, ICCV 2021, Montreal, QC, Canada, October 10-17, 2021. IEEE, 2021, pp. 10 540–10 552.
|
| 215 |
+
[42] A. T. Liu, S. Yang, P. Chi, P. Hsu, and H. Lee, “Mockingjay: Unsupervised speech representation learning with deep bidirectional transformer encoders,” in 2020 IEEE International Conference on Acoustics, Speech and Signal Processing, ICASSP 2020, Barcelona, Spain, May 4-8, 2020. IEEE, 2020, pp. 6419–6423.
|
| 216 |
+
[43] D. Chong, H. Wang, P. Zhou, and Q. Zeng, “Masked spectrogram prediction for self-supervised audio pre-training,” 2022.
|
| 217 |
+
[44] D. Niizumi, D. Takeuchi, Y. Ohishi, N. Harada, and K. Kashino, “Masked spectrogram modeling using masked autoencoders for learning general-purpose audio representation,” arXiv:2204.12260, 2022.
|
| 218 |
+
[45] Y. Li, C.-Y. Wu, H. Fan, K. Mangalam, B. Xiong, J. Malik, and C. Feichtenhofer, “Mvitv2: Improved multiscale vision transformers for classification and detection,” in CVPR, 2022.
|
| 219 |
+
[46] A. van den Oord, Y. Li, and O. Vinyals, “Representation learning with contrastive predictive coding,” CoRR, vol. abs/1807.03748, 2018.
|
| 220 |
+
[47] A. Baevski, M. Auli, and A. Mohamed, “Effectiveness of self-supervised pre-training for speech recognition,” CoRR, vol. abs/1911.03912, 2019.
|
| 221 |
+
[48] D. S. Park, W. Chan, Y. Zhang, C.-C. Chiu, B. Zoph, E. D. Cubuk, and Q. V. Le, “Specaugment: A simple data augmentation method for automatic speech recognition,” ArXiv, vol. abs/1904.08779, 2019.
|
| 222 |
+
[49] J. B. Li, S. Qu, P. Huang, and F. Metze, “Audiotagging done right: 2nd comparison of deep learning methods for environmental sound classification,” CoRR, vol. abs/2203.13448, 2022.
|
| 223 |
+
[50] S. Hershey, S. Chaudhuri, D. P. W. Ellis, J. F. Gemmeke, A. Jansen, C. Moore, M. Plakal, D. Platt, R. A. Saurous, B. Seybold, M. Slaney, R. Weiss, and K. Wilson, “Cnn architectures for large-scale audio classification,” in International Conference on Acoustics, Speech and Signal Processing (ICASSP), 2017.
|
| 224 |
+
[51] S. Hershey, D. P. Ellis, E. Fonseca, A. Jansen, C. Liu, R. C. Moore, and M. Plakal, “The benefit of temporally-strong labels in audio event classification,” in ICASSP 2021-2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP). IEEE, 2021, pp. 366–370.
|
| 225 |
+
[52] P. Warden, “Speech Commands: A Dataset for Limited-Vocabulary Speech Recognition,” ArXiv e-prints, Apr. 2018.
|
| 226 |
+
[53] S. wen Yang, P.-H. Chi, Y.-S. Chuang, C.-I. J. Lai, K. Lakhotia, Y. Y. Lin, A. T. Liu, J. Shi, X. Chang, G.-T. Lin, T.-H. Huang, W.-C. Tseng, K. tik Lee, D.-R. Liu, Z. Huang, S. Dong, S.-W. Li, S. Watanabe, A. Mohamed, and H. yi Lee, “SUPERB: Speech Processing Universal PERformance Benchmark,” in Proc. Interspeech 2021, 2021, pp. 1194–1198.
|
| 227 |
+
[54] A. Nagrani, J. S. Chung, W. Xie, and A. Zisserman, “Voxceleb: Large-scale speaker verification in the wild,” Comput. Speech Lang., vol. 60, 2020.
|
| 228 |
+
[55] D. Povey, A. Ghoshal, G. Boulianne, L. Burget, O. Glembek, N. Goel, M. Hannemann, P. Motlicek, Y. Qian, P. Schwarz et al., “The kaldi speech recognition toolkit,” in IEEE 2011 workshop on automatic speech recognition and understanding, no. CONF. IEEE Signal Processing Society, 2011.
|
| 229 |
+
[56] S. Yun, D. Han, S. Chun, S. J. Oh, Y. Yoo, and J. Choe, “Cutmix: Regularization strategy to train strong classifiers with localizable features,” in 2019 IEEE/CVF International Conference on Computer Vision, ICCV 2019, Seoul, Korea (South), October 27 - November 2, 2019. IEEE, 2019, pp. 6022–6031.
|
| 230 |
+
[57] H. Zhang, M. Cissé, Y. N. Dauphin, and D. Lopez-Paz, “mixup: Beyond empirical risk minimization,” in 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings. OpenReview.net, 2018.
|
| 231 |
+
[58] S. Verbitskiy, V. Berikov, and V. Vyshegorodtsev, “Eranns: Efficient residual audio neural networks for audio pattern recognition,” arXiv preprint arXiv:2106.01621, 2021.
|
| 232 |
+
[59] Q. Kong, Y. Cao, T. Iqbal, Y. Wang, W. Wang, and M. D. Plumbley, “Panns: Large-scale pretrained audio neural networks for audio pattern recognition,” IEEE ACM Trans. Audio Speech Lang. Process., vol. 28, pp. 2880–2894, 2020.
|
| 233 |
+
[60] M. Tan and Q. V. Le, “Efficientnet: Rethinking model scaling for convolutional neural networks,” in Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, ser. Proceedings of Machine Learning Research, vol. 97. PMLR, 2019, pp. 6105–6114.
|
| 234 |
+
[61] D. Griffin and J. Lim, “Signal estimation from modified short-time fourier transform,” IEEE Transactions on Acoustics, Speech, and Signal Processing, vol. 32, no. 2, pp. 236–243, 1984.
|
| 235 |
+
[62] Y. Suzuki and H. Takeshima, “Equal-loudness-level contours for pure tones,” The Journal of the Acoustical Society of America, vol. 116, no. 2, pp. 918–933, 2004.
|
md/dev/MCVfX7HgPO/MCVfX7HgPO.md
ADDED
|
@@ -0,0 +1,485 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Testing the General Deductive Reasoning Capacity of Large Language Models Using OOD Examples
|
| 2 |
+
|
| 3 |
+
Abulhair Saparov† Richard Yuanzhe Pang†
|
| 4 |
+
|
| 5 |
+
Vishakh Padmakumar† Nitish Joshi†
|
| 6 |
+
|
| 7 |
+
Seyed Mehran Kazemi∆ Najoung Kim∆,β,∗ He He†,∗
|
| 8 |
+
|
| 9 |
+
†New York University, ∆Google, $\beta$ Boston University as17582@nyu.edu
|
| 10 |
+
|
| 11 |
+
# Abstract
|
| 12 |
+
|
| 13 |
+
Given the intractably large size of the space of proofs, any model that is capable of general deductive reasoning must generalize to proofs of greater complexity. Recent studies have shown that large language models (LLMs) possess some abstract deductive reasoning ability given chain-of-thought prompts. However, they have primarily been tested on proofs using modus ponens or of a specific size, and from the same distribution as the in-context examples. To measure the general deductive reasoning ability of LLMs, we test on a broad set of deduction rules and measure their ability to generalize to more complex proofs from simpler demonstrations from multiple angles: depth-, width-, and compositional generalization. To facilitate systematic exploration, we construct a new synthetic and programmable reasoning dataset that enables control over deduction rules and proof complexity. Our experiments on four LLMs of various sizes and training objectives show that they are able to generalize to compositional proofs. However, they have difficulty generalizing to longer proofs, and they require explicit demonstrations to produce hypothetical subproofs, specifically in proof by cases and proof by contradiction.
|
| 14 |
+
|
| 15 |
+
# 1 Introduction
|
| 16 |
+
|
| 17 |
+
In many tasks that require deductive reasoning, such as theorem proving or medical diagnosis, the complexity of proofs can grow without bound via the use of multiple deduction rules and the composition of subproofs. Given the large space of proofs, it is infeasible to find data to cover proofs of all sizes. Therefore, a general reasoning model must extrapolate to complex proofs from simpler ones. Recent work has shown that LLMs, combined with in-context learning (ICL) and chain-of-thought (CoT) prompting, are capable of deductive reasoning to an extent [Huang and Chang, 2022, Han et al., 2022, Wei et al., 2022b, Kojima et al., 2022, Lewkowycz et al., 2022, Nye et al., 2021, Gontier et al., 2020]. However, much of the prior work focused on a limited set of deduction rules such as modus ponens [Zhang et al., 2022a, Saparov and He, 2023, Tafjord et al., 2021]. In addition, the evaluation is in-demonstration, where the test example comes from the same distribution as the in-context demonstrations. In this work, we evaluate whether LLMs are capable of general deductive reasoning by measuring how well they generalize to proofs that are more complex
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
|
| 21 |
+
FIGURE 1: An overview of the kinds of OOD generalization that we test in our experiments. Each training example is a sample CoT demonstration provided to the LLM in the few-shot prompt, whereas each test example is a sample proof that the model is expected to output.
|
| 22 |
+
|
| 23 |
+
than their demonstrations.1
|
| 24 |
+
|
| 25 |
+
We characterize the complexity of proofs from three angles: the deduction rules involved, the depth of the proof (i.e. length of a sequential chain of proof steps), and the width of the proof (i.e. the number of premises of each proof step). Each of the three dimensions contributes to the overall size of the proof. To measure the general deductive reasoning ability of LLMs, we extend prior studies in two key ways. First, we determine whether LLMs have learned a complete set of deduction rules, beyond modus ponens. Second, we evaluate whether they can reason over longer proofs than those given as in-context examples (depth- and width- generalization); and whether they are able to use multiple different deduction rules in a single proof (compositional generalization). Figure 1 shows an overview of our study.
|
| 26 |
+
|
| 27 |
+
Our findings suggest that in-context learning is best applied to reasoning tasks by including examples that cover a diverse set of deduction rules, and keeping the examples simple. The in-context examples should especially contain examples of deduction rules that are less familiar to the model (i.e. proof by cases and proof by contradiction), and distractors should be provided for such examples as the model is more prone to overfitting.
|
| 28 |
+
|
| 29 |
+
We test four different LLMs of different scales and training objectives: GPT-3.5 175B [Ouyang et al., 2022], PaLM 540B [Chowdhery et al., 2022], LLaMA 65B [Touvron et al., 2023], and FLAN-T5 11B [Chung et al., 2022], and we find:
|
| 30 |
+
|
| 31 |
+
1. CoT is able to elicit out-of-demonstration (OOD) reasoning in LLMs generalizing to compositional proofs. This is somewhat surprising given the amount of previous work that claim that LLMs are not able to generalize compositionally [Hosseini et al., 2022, An et al., 2023]. See Section 4.2.2 and Figure 6.
|
| 32 |
+
2. ICL generalizes differently compared to supervised learning (i.e. gradient descent on in-context examples). We find numerous examples where it is strictly worse to provide in-context examples from the same distribution as the test example. For instance, in some cases, we observe better generalization to compositional proofs when the in-context examples each contain individual deduction rules. See Sections 4.2.2 and 4.3, and Figures 6 and 8.
|
| 33 |
+
3. However, the LLMs cannot generalize to some deduction rules without explicit demonstrations, specifically, proof by cases and proof by contradiction, suggesting that pretraining is not sufficient to teach the model to generate hypothetical subproofs. See Section 4.2.1 and Figure 4.
|
| 34 |
+
4. Model size does not strongly correlate with performance. Smaller (but not the smallest) models with instruction tuning and longer pretraining perform comparably to larger models.
|
| 35 |
+
|
| 36 |
+
<table><tr><td rowspan=1 colspan=1>Dataset</td><td rowspan=1 colspan=1>Automatedevaluation ofproofs</td><td rowspan=1 colspan=1>Contains proofswith multiplededuction rules</td><td rowspan=1 colspan=1>Tests proofdepthgeneralization</td><td rowspan=1 colspan=1>Tests proofwidthgeneralization</td><td rowspan=1 colspan=1>Testscompositionalgeneralization</td><td rowspan=1 colspan=1>Datagenerationcodeavailable</td></tr><tr><td rowspan=1 colspan=1>CLUTRRSinha et al. [2019]</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>~</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>~</td><td rowspan=1 colspan=1>一</td></tr><tr><td rowspan=1 colspan=1>LogiQALiu et al. [2020]</td><td rowspan=1 colspan=1>×</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>~</td><td rowspan=1 colspan=1>~</td><td rowspan=1 colspan=1>~</td><td rowspan=1 colspan=1>human-annotated</td></tr><tr><td rowspan=1 colspan=1>ProofWriterTafjord et al. [2021]</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>~</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>~</td><td rowspan=1 colspan=1>~</td><td rowspan=1 colspan=1>×</td></tr><tr><td rowspan=1 colspan=1>FOLIOHan et al. [2022]</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>~</td><td rowspan=1 colspan=1>~</td><td rowspan=1 colspan=1>~</td><td rowspan=1 colspan=1>human-annotated</td></tr><tr><td rowspan=1 colspan=1>PRONTOQASaparov and He [2023]</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>X</td><td rowspan=1 colspan=1>√</td></tr><tr><td rowspan=1 colspan=1>PRONTOQA-OOD(this dataset)</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>√</td><td rowspan=1 colspan=1>√</td></tr></table>
|
| 37 |
+
|
| 38 |
+
TABLE 1: Comparison of existing datasets to evaluate reasoning ability. Datasets marked with $\sim$ contain examples of varying width, depth, and compositionality, but these are not programmable (i.e. we cannot generate new examples controlling for these variables), and splitting the existing examples would produce highly imbalanced splits.
|
| 39 |
+
|
| 40 |
+
# 2 Related work
|
| 41 |
+
|
| 42 |
+
OOD generalization of LLMs. Previous work has measured the generalization ability of LLMs on tasks such as bit parity and Boolean variable assignment [Anil et al., 2022], semantic parsing [Hosseini et al., 2022, Qiu et al., 2022], deductive reasoning [Zhang et al., 2022a, Sanyal et al., 2022, Kazemi et al., 2023], and arithmetic reasoning [Kudo et al., 2023], where the length/complexity of the test example is greater than that of the in-context examples. On the bit parity and variable assignment tasks, LLMs are able to generalize to longer inputs with scratchpad prompting [Nye et al., 2021], but this generalization is imperfect, and accuracy still degrades with increasing input length. Generally, larger models tend to be better at generalization than smaller ones. The studies on reasoning were limited to reasoning using modus ponens. Wu et al. [2021] tests the OOD generalization of transformers and graph neural networks on symbolic mathematical reasoning. Our study more systematically examines OOD generalization of LLMs to larger proofs as well as to other deduction rules.
|
| 43 |
+
|
| 44 |
+
Evaluating reasoning abilities of LLMs. A number of recent studies measured the reasoning ability of LLMs [Huang and Chang, 2022, Han et al., 2022]. Table 1 provides a comparison of our proposed dataset to datasets from these studies. Many of these datasets are not amenable to automated evaluation of proofs, relying instead on measuring label accuracy. The datasets also do not test for proof width generalization and compositional generalization. Some datasets focus on a limited set of deduction rules, namely modus ponens. Our work is closest to PRONTOQA [Saparov and He, 2023] but extends it to a complete set of deduction rules and to compositional proofs.
|
| 45 |
+
|
| 46 |
+
Understanding in-context learning. Recent work has shed some light on ICL, and the mechanism by which the model learns from in-context examples. Akyürek et al. [2023], Dai et al. [2023], von Oswald et al. [2022] showed that transformers can learn in-context by performing gradient descent on in-context examples internally. Xie et al. [2022], Wang et al. [2023] show that LLMs exhibit behavior similar to that of topic models where their output is dependent on a latent topic, and the in-context examples help to specify the topic. Ye et al. [2022] demonstrated that ICL is more effective when the in-context examples are both diverse and relevant to the test example. An et al. [2023] and Levy et al. [2022] explored the effect of in-context demonstrations on compositional generalization, showing that it benefits from diverse and individually simple demonstrations. Our results contribute to this growing literature by showing that the generalization behavior in ICL is different from that of supervised learning, and so algorithms such as gradient descent are not the only mechanisms underlying ICL.
|
| 47 |
+
|
| 48 |
+
# 3 Approach
|
| 49 |
+
|
| 50 |
+
A programmable dataset. Our main evaluation approach is to prompt the LLM with simpler proofs and test it on proofs with greater depth and width, or with those using additional deduction rules. Therefore, we require a programmable approach to data generation, where the deduction rules “Alex is a dog. All dogs are mammals. Alex is a mammal. Alex is blue. All mean things are not blue. Suppose Alex is mean. Alex is not blue. This contradicts with Alex is blue. Therefore, Alex is not mean. Alex is a mammal and not mean.”
|
| 51 |
+
|
| 52 |
+
<table><tr><td rowspan=1 colspan=3>Deduction rule Formal definition Natural language example</td></tr><tr><td rowspan=2 colspan=1>Implication elimination(i.e. modus ponens)</td><td rowspan=1 colspan=1>f(a) ∀x(f(x)→ g(𝑥))</td><td rowspan=2 colspan=1>“Alex is a cat. All cats are carnivores. Alex is acarnivore.”</td></tr><tr><td rowspan=1 colspan=1>g(a)</td></tr><tr><td rowspan=1 colspan=1>Conjunctionintroduction</td><td rowspan=1 colspan=1>ABA>B</td><td rowspan=1 colspan=1>“Alex is a cat. Alex is orange. Alex is a cat andorange.”</td></tr><tr><td rowspan=1 colspan=1>Conjunctionelimination</td><td rowspan=1 colspan=1>A>BA</td><td rowspan=1 colspan=1>“Alex is a cat and orange. Alex is orange.”</td></tr><tr><td rowspan=1 colspan=1>Disjunctionintroduction</td><td rowspan=1 colspan=1>AAvB</td><td rowspan=1 colspan=1>“Alex is a cat. Alex is a cat or orange.”</td></tr><tr><td rowspan=1 colspan=1>Disjunction elimination(i.e. proof by cases)</td><td rowspan=1 colspan=1>AνB A├C B├CC</td><td rowspan=1 colspan=1>“Alex is a cat or a dog. Suppose Alex is a cat ... thenAlex is warm-blooded. Suppose Alex is a dog ... thenAlex is warm-blooded. Alex is warm-blooded."</td></tr><tr><td rowspan=1 colspan=1>Proof by contradiction</td><td rowspan=1 colspan=1>A├B-B-A</td><td rowspan=1 colspan=1>“Alex is cold-blooded. If Alex is a mammal,Alex isnot cold-blooded. Suppose Alex is a mammal.Alex isnot cold-blooded. This contradicts with Alex is cold-blooded. Alex is not a mammal."</td></tr></table>
|
| 53 |
+
|
| 54 |
+
TABLE 2: An overview of the deduction rules in PRONTOQA-OOD. The notation $A \vdash B$ denotes entailment: that $B$ is provable from $A$ .
|
| 55 |
+
|
| 56 |
+

|
| 57 |
+
FIGURE 2: An example of a compositional proof containing modus ponens, proof by contradiction, and conjunction introduction, shown in both natural language and a formal tree representation.
|
| 58 |
+
|
| 59 |
+
used, as well as the depth and width of each proof, are controllable parameters. To this end, we propose PRONTOQA-OOD, a generative process for synthetic reasoning questions. Each example in PRONTOQA-OOD contains a handful of premises, a query (the target fact to be proved/disproved), and a gold CoT containing the proof of the query. See Figure 10 for an example from this dataset. Specifically, we extend the PRONTOQA dataset [Saparov and He, 2023] that contains proofs generated from synthetic world models using modus ponens. (1) To evaluate reasoning using different deduction rules, we generate proofs with deduction rules for all connectives in propositional logic: conjunction $\wedge$ , disjunction ∨, implication , and negation ¬. (2) To study width/depth generalization, the proof depth and width are controllable parameters in proof generation, where they control the number of generated deduction rules, and the number of premises in each deduction rule, respectively. (3) To study compositional generalization, we generate compositional proofs using a simple recursive procedure, where each proof contains multiple subproofs with distinct deduction rules.
|
| 60 |
+
|
| 61 |
+
Generating proofs with a complete set of deduction rules. We follow the deduction rules of natural deduction [Gentzen, 1935, Pfenning, 2004], a well-studied proof calculus with desirable completeness properties.2 Examples of each deduction rule are shown in Table 2. For each type of deduction rule, we randomly generate a proof that applies that rule (see details in section A.4. An example of a compositional proof is shown in Figure 2. To prevent LLMs from exploiting knowledge from pretraining to solve the problems without reasoning, we use fictional names for all concepts (e.g. “wumpus” instead of “cat” etc.).
|
| 62 |
+
|
| 63 |
+
Varying proof width and depth. To characterize the size or complexity of each proof, we represent each proof as a tree (Figure 2), where each proof step corresponds to a node, and its premises correspond to the parent nodes. Then the size of the proof can be naturally described by the width and depth of this tree. When generating proofs, we control the depth by continuing to append proof steps until a proof of the desired depth is generated. The number of premises of deduction rules is set to the desired proof width.
|
| 64 |
+
|
| 65 |
+
Generating compositional proofs. To generate proofs combining many different types of deduction rules, we use a simple recursive procedure: (1) select a deduction rule uniformly at random, (2) select the premises for the selected rule, (3) recursively generate a subproof for each premise. See section A.5 for details and pseudocode.
|
| 66 |
+
|
| 67 |
+
Adding distractors. One key challenge to OOD generalization is shortcut solutions. For example, given the facts “Alex is a cat,” “All cats are feline,” since there is no other fact of the form “All cats are...,” the model can deterministically follow the only valid deduction and conclude “Alex is feline.” To make the heuristics uninformative, we add distractor sentences. In the above case, a distractor sentence would be “All cats are graceful.” Then the model is forced to choose the correct premise from two options for the next deduction step. See Section A.7 for details on distractors for all deduction rules.
|
| 68 |
+
|
| 69 |
+
Formal evaluation of chain-of-thought. Unlike previous datasets that evaluate on a binary true/false answer, PRONTOQA-OOD requires LLMs to generate full proofs.3 Therefore, we need a way to evaluate the correctness of the output proofs directly. The sentences in PRONTOQA-OOD are syntactically simple and amenable to semantic parsing, which allows us to formally analyze each step in the CoT. To determine whether a predicted CoT is correct, we: (1) semantically parse each CoT sentence into first-order logic, (2) determine whether each logical form follows from previous logical forms via a rule of deduction, and (3) compute whether there exists a path of correct steps from the premises to the goal. An example of this process is shown below:
|
| 70 |
+
|
| 71 |
+
“Alex is a dog. All dogs are mammals. Alex is a mammal.”
|
| 72 |
+
|
| 73 |
+
$$
|
| 74 |
+
{ \begin{array} { l } { \qquad \quad \mathrm { d o g ( a l e x ) , } } \\ { \longrightarrow \forall x ( \mathrm { d o g ( } x ) \mathrm { m a m m a l ( } x ) ) , \quad \longrightarrow \quad { \frac { \forall x ( \mathrm { d o g ( } x ) \mathrm { m a m m a l ( } x ) ) \quad \mathrm { d o g ( a l e x ) } } { \mathrm { m a m m a l ( a l e x ) } } } } \\ { \qquad \mathrm { m a m m a l ( a l e x ) } } \end{array} }
|
| 75 |
+
$$
|
| 76 |
+
|
| 77 |
+
Each proof step is considered correct if it is valid and if it immediately follows one of its premises.4 For further details see section A.6.
|
| 78 |
+
|
| 79 |
+
# 4 Results
|
| 80 |
+
|
| 81 |
+
In this section, we test existing LLMs on PRONTOQA-OOD and analyze whether they can produce longer and compositional proofs given simpler demonstrations. We experiment with a variety of models, with different sizes and training objectives, as shown in Figure 3. In all experiments, we use 8-shot chain-of-thought prompting.5
|
| 82 |
+
|
| 83 |
+
FIGURE 3: An overview and properties of the LLMs in our experiments. We place an asterisk\* for GPT-3.5 since we were not able to verify its size.
|
| 84 |
+
|
| 85 |
+
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>FLAN-T5</td><td rowspan=1 colspan=1>LLaMA</td><td rowspan=1 colspan=1>GPT-3.5</td><td rowspan=1 colspan=1>PaLM</td></tr><tr><td rowspan=1 colspan=1>Model Size</td><td rowspan=1 colspan=1>11B</td><td rowspan=1 colspan=1>65B</td><td rowspan=1 colspan=1>175B*</td><td rowspan=1 colspan=1>540B</td></tr><tr><td rowspan=1 colspan=1>Instruction Tuned</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>×</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>×</td></tr><tr><td rowspan=1 colspan=1>RLHF</td><td rowspan=1 colspan=1>×</td><td rowspan=1 colspan=1>×</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>×</td></tr><tr><td rowspan=1 colspan=1>Access</td><td rowspan=1 colspan=1>Open</td><td rowspan=1 colspan=1>Limited</td><td rowspan=1 colspan=1>Limited</td><td rowspan=1 colspan=1>Limited</td></tr></table>
|
| 86 |
+
|
| 87 |
+
We compare performance in two settings: (1) an in-demonstration (ID) setting where the 8 in-context demonstrations come from the same distribution as the test example, and (2) an out-of-demonstration (OOD) setting where the in-context demonstrations come from a distribution that is different from that of the test example. $9 5 \%$ confidence intervals are provided for all results.
|
| 88 |
+
|
| 89 |
+

|
| 90 |
+
FIGURE 4: (top) Proof accuracy across examples with different deduction rules. The in-context examples and test examples come from the same distribution. (bottom) Change in proof accuracy, where the test example is out-of-demonstration with respect to the in-context examples. That is, the test example has the specified deduction rule, but the in-context examples are uniformly distributed over all other deduction rules. See Figure 11 in the Appendix for the equivalent plot with absolute proof accuracy on the y-axis. See Figure 5 for an incorrect example. Implication elimination examples have proof width of 1 and depth of 2. Conjunction introduction, conjunction elimination, and disjunction introduction examples have proof width 3 and depth 2. Disjunction elimination examples have proof width 3 and depth 1. Proof by contradiction examples have proof width 2 and depth 1.
|
| 91 |
+
|
| 92 |
+
Prove: Max is a gorpus.
|
| 93 |
+
|
| 94 |
+
Predicted answer: Max is a tumpus or a rompus or a lempus. Max is a tumpus.
|
| 95 |
+
Tumpuses are wumpuses. Max is a wumpus. Rompuses are gorpuses. Max is a gorpus.
|
| 96 |
+
Max is a gorpus. Expected answer: Assume Max is a tumpus. Tumpuses are gorpuses. Max is a gorpus.
|
| 97 |
+
Assume Max is a rompus. Rompuses are gorpuses. Max is a gorpus.
|
| 98 |
+
Assume Max is a lempus. Lempuses are gorpuses. Max is a gorpus.
|
| 99 |
+
Since Max is a tumpus or a rompus or a lempus, Max is a gorpus.
|
| 100 |
+
|
| 101 |
+
FIGURE 5: Example of an incorrect proof generated by GPT-3.5 on an out-of-demonstration disjunction elimination example. The premises (axioms) are given in blue, and invalid steps are given in red. For the full example, see Figure 14 in the Appendix.
|
| 102 |
+
|
| 103 |
+
# 4.1 Can LLMs use deduction rules other than modus ponens?
|
| 104 |
+
|
| 105 |
+
We first evaluate whether LLMs “know” all deduction rules (Table 2) when provided with corresponding CoT prompts. For each deduction rule, we independently and identically generate 8 in-context examples and one test example, and prompt the model to answer the test example. We run each experiment for 100 trials and measure the accuracy of the output proofs. The accuracies are shown in the top chart of Figure 4. We emphasize that the $\Delta$ proof accuracies in the bottom row of the figure should be interpreted in comparison with the accuracies in the top row (e.g. for some rules, the zero $\Delta$ accuracy for FLAN-T5 is due to zero absolute accuracy). For clarity, we provide the same plots using absolute accuracy rather than $\Delta$ accuracy in Section A.2.
|
| 106 |
+
|
| 107 |
+
In general, most models are able to use each deduction rule reasonably well, with GPT-3.5 performing the best. Similar to prior studies [Liang et al., 2022], we do not observe a strong correlation between model size and performance. LLaMA performs comparably to PaLM, despite being smaller. FLANT5 is smaller and performs reasonably on implication and conjunction elimination, but is not able to learn the other deduction rules.
|
| 108 |
+
|
| 109 |
+

|
| 110 |
+
|
| 111 |
+
Prove: Polly is not a lempus.
|
| 112 |
+
|
| 113 |
+
Predicted answer: Polly is a wumpus, a jompus, and a tumpus. Everything that is a wumpus, a jompus, and a tumpus is not a lempus. Polly is not a lempus.
|
| 114 |
+
|
| 115 |
+
Expected answer: Polly is a tumpus. Polly is a jompus. Polly is a wumpus. Polly is a wumpus and a jompus and a tumpus. Everything that is a wumpus, a jompus, and a tumpus is not a lorpus. Polly is not a lorpus.
|
| 116 |
+
|
| 117 |
+
Assume Polly is a lempus. Each lempus is an impus and a lorpus and a rompus. Polly is an impus and a lorpus and a rompus. Polly is a lorpus. This contradicts with Polly is not a lorpus. Polly is not a lempus.
|
| 118 |
+
|
| 119 |
+
FIGURE 6: (top-left) Proof accuracy on compositional examples where the in-context examples are also compositional examples with the same min depth and number of rule types. (bottom-left) Change in proof accuracy where the test examples are compositional but the in-context examples are those of individual deduction rules. See Figure 12 in the Appendix for the equivalent plot with absolute proof accuracy on the y-axis. (right) Example of an incorrect proof generated by GPT-3.5 on an out-of-demonstration example with min depth 2 and 4 rule types. The premises (axioms) are given in blue, and invalid steps are given in red. For the full example, see Figure 15 in the Appendix.
|
| 120 |
+
|
| 121 |
+
# 4.2 Out-of-demonstration generalization
|
| 122 |
+
|
| 123 |
+
# 4.2.1 Can LLMs generalize to unseen deduction rules?
|
| 124 |
+
|
| 125 |
+
While the above results show that LLMs are able to reason with a variety of deduction rules, it is unclear whether the ability is learned from in-context examples or elicited from pretraining. We test the LLM with examples where the test proof requires a deduction rule that does not appear in the in-context examples (i.e. for each in-context example, we sample a deduction rule uniformly at random from the set of deduction rules excluding that of the test example). Our intuition was that LLMs would not be able to use deduction rules unless given explicit demonstrations thereof (aside from those like modus ponens which are well-represented in pretraining). The change in proof accuracy relative to the ID setting is shown in the bottom chart of Figure 4. Evidently, the models are able to use four deduction rules despite not being shown an in-context example with those rules: both conjunction rules, disjunction introduction, and (somewhat) implication elimination. GPT-3.5 was additionally able to use proof by contradiction by relying on an alternate deduction rule called modus tollens (i.e. given $\neg \bar { f } ( c )$ and $\forall x ( g ( c ) f ( \bar { c } ) )$ , conclude $\neg g ( c ) )$ . This is in contrast with McKenzie et al. [2022] which showed that reasoning with modus tollens exhibited inverse scaling behavior, and yet GPT-3.5 is able to use it correctly without any demonstrations. However, Wei et al. [2022a] has shown that when trained with additional compute, models are able to perform modus tollens. GPT-3.5 performed worse on disjunction elimination possibly due to the fact that there is no equivalent alternate rule (an example of an error is given in figure 5). However, no model is able to use disjunction elimination and proof by contradiction without demonstrations.
|
| 126 |
+
|
| 127 |
+
# 4.2.2 Can LLMs generalize to compositional proofs?
|
| 128 |
+
|
| 129 |
+
Next, we test whether the model is able to generalize to compositional proofs that contain multiple different deduction rules. In the ID setting, the in-context examples and test examples are both generated from the same distribution of compositional proofs. In the OOD setting, the in-context demonstrations contain non-compositional examples of each rule that appears in the test example. In Figure 6, in all but three experiments, we observe that the gap in proof accuracy between the ID and OOD settings is close to zero, indicating that the models are able to generalize compositionally to an extent. This is surprising since past studies show that LLMs struggle with compositional generalization, but this could be due to the fact that much of the previous work focused on semantic parsing rather than on reasoning. But there is prior work showing that models can generalize compositionally in some settings, such as in Hosseini et al. [2022] (see Figure 4) and in Press et al. [2022] (see Figure 6). In addition, our study is limited by the token limit of the LLMs, as we are not able to further increase the complexity of the proofs without reducing the number of in-context examples, which would render the results difficult to compare. GPT-3.5 and PALM have difficulty when the number of rule types is 4, with an example of an incorrect output given in the right side of Figure 6. Interestingly, PALM, LLAMA, and FLAN-T5 sometimes perform better in the OOD setting than in the ID setting, showing that, in ICL, it is not always best to provide demonstrations from the same distribution as the test example.
|
| 130 |
+
|
| 131 |
+

|
| 132 |
+
FIGURE 7: (top row) Proof accuracy vs proof depth of test examples, where in-context examples have fixed proof depth 2. (bottom row) Proof accuracy vs proof width of test examples, where in-context examples have fixed proof width 2. Dashed lines indicate in-distribution accuracy, where the depth and width of the in-context examples are the same as that of the text-examples. In these experiments, there are 4 rather than 8 in-context examples.
|
| 133 |
+
|
| 134 |
+
# 4.2.3 Can LLMs generalize to bigger proofs?
|
| 135 |
+
|
| 136 |
+
To test whether LLMs can generalize to bigger proofs, we test the models on examples where the proof width or depth is larger than those of the in-context examples. As is evident from Figure 7, when shown demonstrations of proofs of depth 2, the models’ performance decreases with increasing depth. But this is due to the increase in the inherent difficulty of the task, as both ID and OOD accuracies decrease with increasing depth. Though the notable exception is GPT-3.5 on conjunction elimination, where ID accuracy remains high as OOD accuracy decreases. Models are able to generalize better with increasing proof width on conjunction elimination, possibly because there are ample examples of long conjunctions in natural language, but only GPT-3.5 is able to generalize to greater proof widths on conjunction introduction.
|
| 137 |
+
|
| 138 |
+
# 4.3 Do distractors help OOD generalization?
|
| 139 |
+
|
| 140 |
+
In supervised learning, one challenge to OOD generalization is spurious correlations [Zhang et al., 2022b]. Intuitively, if ICL were to behave like supervised learning on in-context examples [Akyürek et al., 2023, Dai et al., 2023, von Oswald et al., 2022], we would expect that without distractors, the models would overfit to the in-context examples and perform poorly on OOD examples. An example where distractors hurt generalization is shown in Figure 9 where GPT-3.5 copies many of the distractor sentences into the output, likely due to the fact that it has learned to apply a copying heuristic from the in-context demonstrations. It seems only GPT-3.5 acquires these heuristics in implication and disjunction elimination. Surprisingly, this is not the case for all deduction rules, as is
|
| 141 |
+
|
| 142 |
+

|
| 143 |
+
FIGURE 8: (top) Proof accuracy on examples where both the in-context examples and test examples have distractors. Sentences in all questions are ordered randomly. (middle) Proof accuracy when distractors are removed from the in-context examples, but not from the test examples. The sentences of the in-context questions have a fixed order (corresponding to a postorder traversal of the ontology tree), whereas the sentences in the test question have random order. See Figure 13 in the Appendix for the equivalent plot with absolute proof accuracy on the y-axis. (bottom) The same setting as (middle) except the distractors in the in-context examples are instead replaced with irrelevant sentences. Implication elimination examples have proof width of 1 and depth of 2. Conjunction introduction, conjunction elimination, and disjunction introduction examples have proof width 2 and depth 2. Disjunction elimination examples have proof width 3 and depth 1. Proof by contradiction examples have proof width 2 and depth 1.
|
| 144 |
+
|
| 145 |
+
Prove: Sally is dull.
|
| 146 |
+
|
| 147 |
+
Predicted answer: Sally is an impus. Impuses are sterpuses. Every grimpus is a zumpus. Every brimpus is a grimpus. Lorpuses are dumpuses. Brimpuses are vumpuses. Every lorpus is a brimpus. Sally is a brimpus. Each vumpus is opaque. Each dumpus is not brown. Every grimpus is dull. Sally is a grimpus. Sally is dull.
|
| 148 |
+
|
| 149 |
+
Expected answer: Sally is a brimpus. Every brimpus is a grimpus. Sally is a grimpus. Each grimpus is dull. Sally is dull.
|
| 150 |
+
|
| 151 |
+
FIGURE 9: Example of an incorrect proof generated by GPT-3.5 on an OOD implication elimination example where the in-context demonstrations have no distractors, but the test example does. The premises (axioms) are given in blue, and invalid steps are given in red. For the full example, see Figure 16 in the Appendix.
|
| 152 |
+
|
| 153 |
+
visible in Figure 8. The models’ performance is largely unaffected, with the exception of a few rules for specific models. This is in stark contrast to supervised learning, where it is always best to train on examples from the same distribution as the test example.
|
| 154 |
+
|
| 155 |
+
# 5 Conclusion and future work
|
| 156 |
+
|
| 157 |
+
In this study, we provide a systematic test of the general deductive reasoning capabilities of LLMs, specifically measuring their rule-, depth-, width-, and compositional generalization abilities. We found that LLMs exhibit mixed generalization to unseen deduction rules, but they exhibit more robust generalization to compositional proofs than previously suggested.
|
| 158 |
+
|
| 159 |
+
One important future direction is to better understand the mechanism of ICL and CoT prompting. We found that in many cases, for a given test example, the best in-context examples were drawn from a distribution distinct from that of the test example. This is not explained by existing theories of Bayesian inference [Xie et al., 2022] or gradient descent [Akyürek et al., 2023, Dai et al., 2023, von Oswald et al., 2022]. Are simpler examples better even if the test example is fairly complex? Should we include examples with a diverse set of deduction rules [Levy et al., 2022]? Or should the in-context examples focus on rules for which the model’s OOD generalization is poor? Further study is needed to better characterize generalization from in-context examples.
|
| 160 |
+
|
| 161 |
+
# Reproducibility statement
|
| 162 |
+
|
| 163 |
+
For the sake of reproducibility of the analysis, model outputs (except those of PaLM), code for data generation, and analysis code are freely available with a permissive open-source license at github.com/asaparov/prontoqa. The generated data for all experiments in this paper is available in the file generated_ood_data.zip. The command python make_plots.py produces all figures used in this paper. GPT-3.5 experiments were run using the OpenAI API with the model text-davinci-003 on April $2 0 ^ { t h } - 2 3 ^ { \hat { r } d }$ , 2023. Experiments for Figure 7 and the bottom row of Figure 8 were run on August $3 ^ { r d } - 7 ^ { t h }$ , 2023.
|
| 164 |
+
|
| 165 |
+
# Acknowledgements
|
| 166 |
+
|
| 167 |
+
We thank Tania Bedrax-Weiss, Xin Xu, and Deepak Ramachandran for their valuable feedback. This work was supported by Open Philanthropy, AWS AI, Samsung Advanced Institute of Technology (under the project Next Generation Deep Learning: From Pattern Recognition to AI), and in part through the NYU IT High Performance Computing resources, services, and staff expertise. NJ is supported by an NSF Graduate Research Fellowship under grant number 1839302.
|
| 168 |
+
|
| 169 |
+
# References
|
| 170 |
+
|
| 171 |
+
Ekin Akyürek, Dale Schuurmans, Jacob Andreas, Tengyu Ma, and Denny Zhou. What learning algorithm is in-context learning? Investigations with linear models. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id= 0g0X4H8yN4I.
|
| 172 |
+
Shengnan An, Zeqi Lin, Qiang Fu, Bei Chen, Nanning Zheng, Jian-Guang Lou, and Dongmei Zhang. How do in-context examples affect compositional generalization? CoRR, abs/2305.04835, 2023. URL https://arxiv.org/abs/2305.04835.
|
| 173 |
+
Cem Anil, Yuhuai Wu, Anders Andreassen, Aitor Lewkowycz, Vedant Misra, Vinay V. Ramasesh, Ambrose Slone, Guy Gur-Ari, Ethan Dyer, and Behnam Neyshabur. Exploring length generalization in large language models. CoRR, abs/2207.04901, 2022. doi: 10.48550/arXiv.2207.04901. URL https://doi.org/10.48550/arXiv.2207.04901.
|
| 174 |
+
Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, Parker Schuh, Kensen Shi, Sasha Tsvyashchenko, Joshua Maynez, Abhishek Rao, Parker Barnes, Yi Tay, Noam Shazeer, Vinodkumar Prabhakaran, Emily Reif, Nan Du, Ben Hutchinson, Reiner Pope, James Bradbury, Jacob Austin, Michael Isard, Guy Gur-Ari, Pengcheng Yin, Toju Duke, Anselm Levskaya, Sanjay Ghemawat, Sunipa Dev, Henryk Michalewski, Xavier Garcia, Vedant Misra, Kevin Robinson, Liam Fedus, Denny Zhou, Daphne Ippolito, David Luan, Hyeontaek Lim, Barret Zoph, Alexander Spiridonov, Ryan Sepassi, David Dohan, Shivani Agrawal, Mark Omernick, Andrew M. Dai, Thanumalayan Sankaranarayana Pillai, Marie Pellat, Aitor Lewkowycz, Erica Moreira, Rewon Child, Oleksandr Polozov, Katherine Lee, Zongwei Zhou, Xuezhi Wang, Brennan Saeta, Mark Diaz, Orhan Firat, Michele Catasta, Jason Wei, Kathy Meier-Hellstern, Douglas Eck, Jeff Dean, Slav Petrov, and Noah Fiedel. Palm: Scaling language modeling with pathways. CoRR, abs/2204.02311, 2022. doi: 10.48550/arXiv.2204.02311. URL https://doi.org/10.48550/arXiv.2204.02311.
|
| 175 |
+
|
| 176 |
+
Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Eric Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, Albert Webson, Shixiang Shane Gu, Zhuyun Dai, Mirac Suzgun, Xinyun Chen, Aakanksha Chowdhery, Sharan Narang, Gaurav Mishra, Adams Yu, Vincent Y. Zhao, Yanping Huang, Andrew M. Dai, Hongkun Yu, Slav Petrov, Ed H. Chi, Jeff Dean, Jacob Devlin, Adam Roberts, Denny Zhou, Quoc V. Le, and Jason Wei. Scaling instructionfinetuned language models. CoRR, abs/2210.11416, 2022. doi: 10.48550/arXiv.2210.11416. URL https://doi.org/10.48550/arXiv.2210.11416.
|
| 177 |
+
|
| 178 |
+
Damai Dai, Yutao Sun, Li Dong, Yaru Hao, Zhifang Sui, and Furu Wei. Why can gpt learn incontext? language models secretly perform gradient descent as meta optimizers. In Findings of the Association for Computational Linguistics: ACL 2023, Toronto, Canada, 2023. Association for Computational Linguistics.
|
| 179 |
+
|
| 180 |
+
G. Gentzen. Untersuchungen über das logische schließen i. Mathematische Zeitschrift, 39:176–210, 1935.
|
| 181 |
+
|
| 182 |
+
Nicolas Gontier, Koustuv Sinha, Siva Reddy, and Christopher Pal. Measuring systematic generalization in neural proof generation with transformers. 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. URL https://proceedings.neurips. cc/paper/2020/hash/fc84ad56f9f547eb89c72b9bac209312-Abstract.html.
|
| 183 |
+
|
| 184 |
+
Simeng Han, Hailey Schoelkopf, Yilun Zhao, Zhenting Qi, Martin Riddell, Luke Benson, Lucy Sun, Ekaterina Zubova, Yujie Qiao, Matthew Burtell, David Peng, Jonathan Fan, Yixin Liu, Brian Wong, Malcolm Sailor, Ansong Ni, Linyong Nan, Jungo Kasai, Tao Yu, Rui Zhang, Shafiq R. Joty, Alexander R. Fabbri, Wojciech Kryscinski, Xi Victoria Lin, Caiming Xiong, and Dragomir Radev. FOLIO: natural language reasoning with first-order logic. CoRR, abs/2209.00840, 2022. doi: 10.48550/arXiv.2209.00840. URL https://doi.org/10.48550/arXiv.2209.00840.
|
| 185 |
+
|
| 186 |
+
Arian Hosseini, Ankit Vani, Dzmitry Bahdanau, Alessandro Sordoni, and Aaron C. Courville. On the compositional generalization gap of in-context learning. In Jasmijn Bastings, Yonatan Belinkov, Yanai Elazar, Dieuwke Hupkes, Naomi Saphra, and Sarah Wiegreffe, editors, Proceedings of the Fifth BlackboxNLP Workshop on Analyzing and Interpreting Neural Networks for NLP, BlackboxNLP@EMNLP 2022, Abu Dhabi, United Arab Emirates (Hybrid), December 8, 2022, pages 272–280. Association for Computational Linguistics, 2022. URL https: //aclanthology.org/2022.blackboxnlp-1.22.
|
| 187 |
+
|
| 188 |
+
Jie Huang and Kevin Chen-Chuan Chang. Towards reasoning in large language models: A survey. CoRR, abs/2212.10403, 2022. doi: 10.48550/arXiv.2212.10403. URL https://doi.org/10. 48550/arXiv.2212.10403.
|
| 189 |
+
|
| 190 |
+
Seyed Mehran Kazemi, Najoung Kim, Deepti Bhatia, Xin Xu, and Deepak Ramachandran. LAMBADA: backward chaining for automated reasoning in natural language. In Proceedings of the 61st Annual Meeting of the Association for Computational Linguistics, Toronto, Canada, July 2023. Association for Computational Linguistics.
|
| 191 |
+
|
| 192 |
+
Takeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo, and Yusuke Iwasawa. Large language models are zero-shot reasoners. In Advances in Neural Information Processing Systems, 2022. URL http://papers.nips.cc/paper_files/paper/2022/hash/ 8bb0d291acd4acf06ef112099c16f326-Abstract-Conference.html.
|
| 193 |
+
|
| 194 |
+
Keito Kudo, Yoichi Aoki, Tatsuki Kuribayashi, Ana Brassard, Masashi Yoshikawa, Keisuke Sakaguchi, and Kentaro Inui. Do deep neural networks capture compositionality in arithmetic reasoning? In Andreas Vlachos and Isabelle Augenstein, editors, Proceedings of the 17th Conference of the European Chapter of the Association for Computational Linguistics, EACL 2023, Dubrovnik, Croatia, May 2-6, 2023, pages 1343–1354. Association for Computational Linguistics, 2023. URL https://aclanthology.org/2023.eacl-main.98.
|
| 195 |
+
|
| 196 |
+
Itay Levy, Ben Bogin, and Jonathan Berant. Diverse demonstrations improve in-context compositional generalization. CoRR, abs/2212.06800, 2022. doi: 10.48550/arXiv.2212.06800. URL https: //doi.org/10.48550/arXiv.2212.06800.
|
| 197 |
+
|
| 198 |
+
Aitor Lewkowycz, Anders Johan Andreassen, David Dohan, Ethan Dyer, Henryk Michalewski, Vinay Venkatesh Ramasesh, Ambrose Slone, Cem Anil, Imanol Schlag, Theo Gutman-Solo, Yuhuai Wu, Behnam Neyshabur, Guy Gur-Ari, and Vedant Misra. Solving quantitative reasoning problems with language models. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho, editors, Advances in Neural Information Processing Systems, 2022. URL https://openreview. net/forum?id $\cdot ^ { = }$ IFXTZERXdM7.
|
| 199 |
+
|
| 200 |
+
Percy Liang, Rishi Bommasani, Tony Lee, Dimitris Tsipras, Dilara Soylu, Michihiro Yasunaga, Yian Zhang, Deepak Narayanan, Yuhuai Wu, Ananya Kumar, Benjamin Newman, Binhang Yuan, Bobby Yan, Ce Zhang, Christian Cosgrove, Christopher D. Manning, Christopher Ré, Diana Acosta-Navas, Drew A. Hudson, Eric Zelikman, Esin Durmus, Faisal Ladhak, Frieda Rong, Hongyu Ren, Huaxiu Yao, Jue Wang, Keshav Santhanam, Laurel J. Orr, Lucia Zheng, Mert Yüksekgönül, Mirac Suzgun, Nathan Kim, Neel Guha, Niladri S. Chatterji, Omar Khattab, Peter Henderson, Qian Huang, Ryan Chi, Sang Michael Xie, Shibani Santurkar, Surya Ganguli, Tatsunori Hashimoto, Thomas Icard, Tianyi Zhang, Vishrav Chaudhary, William Wang, Xuechen Li, Yifan Mai, Yuhui Zhang, and Yuta Koreeda. Holistic evaluation of language models. CoRR, abs/2211.09110, 2022. doi: 10.48550/arXiv.2211.09110. URL https://doi.org/10.48550/arXiv.2211.09110.
|
| 201 |
+
|
| 202 |
+
Jian Liu, Leyang Cui, Hanmeng Liu, Dandan Huang, Yile Wang, and Yue Zhang. Logiqa: A challenge dataset for machine reading comprehension with logical reasoning. In Christian Bessiere, editor, Proceedings of the Twenty-Ninth International Joint Conference on Artificial Intelligence, IJCAI 2020, pages 3622–3628. ijcai.org, 2020. doi: 10.24963/ijcai.2020/501. URL https: //doi.org/10.24963/ijcai.2020/501.
|
| 203 |
+
|
| 204 |
+
Ian McKenzie, Alexander Lyzhov, Alicia Parrish, Ameya Prabhu, Aaron Mueller, Najoung Kim, Sam Bowman, and Ethan Perez. Inverse scaling prize: Second round winners, 2022. URL https://irmckenzie.co.uk/round2.
|
| 205 |
+
|
| 206 |
+
Maxwell I. Nye, Anders Johan Andreassen, Guy Gur-Ari, Henryk Michalewski, Jacob Austin, David Bieber, David Dohan, Aitor Lewkowycz, Maarten Bosma, David Luan, Charles Sutton, and Augustus Odena. Show your work: Scratchpads for intermediate computation with language models. CoRR, abs/2112.00114, 2021. URL https://arxiv.org/abs/2112.00114.
|
| 207 |
+
|
| 208 |
+
Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Gray, John Schulman, Jacob Hilton, Fraser Kelton, Luke Miller, Maddie Simens, Amanda Askell, Peter Welinder, Paul Christiano, Jan Leike, and Ryan Lowe. Training language models to follow instructions with human feedback. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho, editors, Advances in Neural Information Processing Systems, 2022. URL https://openreview.net/forum?id $\cdot ^ { = }$ TG8KACxEON.
|
| 209 |
+
|
| 210 |
+
Frank Pfenning. Natural deduction. Lecture notes in 15-815 Automated Theorem Proving, 2004. URL https://www.cs.cmu.edu/\~fp/courses/atp/handouts/ch2-natded.pdf.
|
| 211 |
+
|
| 212 |
+
Ofir Press, Muru Zhang, Sewon Min, Ludwig Schmidt, Noah A. Smith, and Mike Lewis. Measuring and narrowing the compositionality gap in language models. CoRR, abs/2210.03350, 2022. doi: 10.48550/arXiv.2210.03350. URL https://doi.org/10.48550/arXiv.2210.03350.
|
| 213 |
+
|
| 214 |
+
Linlu Qiu, Peter Shaw, Panupong Pasupat, Tianze Shi, Jonathan Herzig, Emily Pitler, Fei Sha, and Kristina Toutanova. Evaluating the impact of model scale for compositional generalization in semantic parsing. In Yoav Goldberg, Zornitsa Kozareva, and Yue Zhang, editors, Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, EMNLP 2022, Abu Dhabi, United Arab Emirates, December 7-11, 2022, pages 9157–9179. Association for Computational Linguistics, 2022. URL https://aclanthology.org/2022.emnlp-main.624.
|
| 215 |
+
|
| 216 |
+
Soumya Sanyal, Zeyi Liao, and Xiang Ren. Robustlr: A diagnostic benchmark for evaluating logical robustness of deductive reasoners. In Yoav Goldberg, Zornitsa Kozareva, and Yue Zhang, editors, Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, EMNLP 2022, Abu Dhabi, United Arab Emirates, December 7-11, 2022, pages 9614–9631. Association for Computational Linguistics, 2022. doi: 10.18653/v1/2022.emnlp-main.653. URL https://doi.org/10.18653/v1/2022.emnlp-main.653.
|
| 217 |
+
|
| 218 |
+
Abulhair Saparov and He He. Language models are greedy reasoners: A systematic formal analysis of chain-of-thought. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=qFVVBzXxR2V.
|
| 219 |
+
|
| 220 |
+
Koustuv Sinha, Shagun Sodhani, Jin Dong, Joelle Pineau, and William L. Hamilton. CLUTRR: A diagnostic benchmark for inductive reasoning from text. In Kentaro Inui, Jing Jiang, Vincent Ng, and Xiaojun Wan, editors, Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, EMNLP-IJCNLP 2019, Hong Kong, China, November 3-7, 2019, pages 4505–4514. Association for Computational Linguistics, 2019. doi: 10.18653/v1/D19-1458. URL https: //doi.org/10.18653/v1/D19-1458.
|
| 221 |
+
|
| 222 |
+
Oyvind Tafjord, Bhavana Dalvi, and Peter Clark. Proofwriter: Generating implications, proofs, and abductive statements over natural language. In Chengqing Zong, Fei Xia, Wenjie Li, and Roberto Navigli, editors, Findings of the Association for Computational Linguistics: ACL/IJCNLP 2021, Online Event, August 1-6, 2021, volume ACL/IJCNLP 2021 of Findings of ACL, pages 3621–3634. Association for Computational Linguistics, 2021. doi: 10.18653/v1/2021.findings-acl.317. URL https://doi.org/10.18653/v1/2021.findings-acl.317.
|
| 223 |
+
|
| 224 |
+
Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, Aurélien Rodriguez, Armand Joulin, Edouard Grave, and Guillaume Lample. LLaMA: Open and efficient foundation language models. CoRR, abs/2302.13971, 2023. doi: 10.48550/arXiv.2302.13971. URL https://doi. org/10.48550/arXiv.2302.13971.
|
| 225 |
+
|
| 226 |
+
Johannes von Oswald, Eyvind Niklasson, Ettore Randazzo, João Sacramento, Alexander Mordvintsev, Andrey Zhmoginov, and Max Vladymyrov. Transformers learn in-context by gradient descent. CoRR, abs/2212.07677, 2022. doi: 10.48550/arXiv.2212.07677. URL https://doi.org/10. 48550/arXiv.2212.07677.
|
| 227 |
+
|
| 228 |
+
Xinyi Wang, Wanrong Zhu, and William Yang Wang. Large language models are implicitly topic models: Explaining and finding good demonstrations for in-context learning. CoRR, abs/2301.11916, 2023. doi: 10.48550/arXiv.2301.11916. URL https://doi.org/10.48550/arXiv.2301. 11916.
|
| 229 |
+
|
| 230 |
+
Jason Wei, Yi Tay, and Quoc V. Le. Inverse scaling can become u-shaped. CoRR, abs/2211.02011, 2022a. doi: 10.48550/arXiv.2211.02011. URL https://doi.org/10.48550/arXiv.2211. 02011.
|
| 231 |
+
|
| 232 |
+
Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, brian ichter, Fei Xia, Ed H. Chi, Quoc V Le, and Denny Zhou. Chain of thought prompting elicits reasoning in large language models. In Alice H. Oh, Alekh Agarwal, Danielle Belgrave, and Kyunghyun Cho, editors, Advances in Neural Information Processing Systems, 2022b. URL https://openreview.net/forum?id= _VjQlMeSB_J.
|
| 233 |
+
|
| 234 |
+
Yuhuai Wu, Albert Q. Jiang, Jimmy Ba, and Roger Baker Grosse. INT: an inequality benchmark for evaluating generalization in theorem proving. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net, 2021. URL https://openreview.net/forum?id=O6LPudowNQm.
|
| 235 |
+
|
| 236 |
+
Sang Michael Xie, Aditi Raghunathan, Percy Liang, and Tengyu Ma. An explanation of in-context learning as implicit bayesian inference. In The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022. OpenReview.net, 2022. URL https://openreview.net/forum?id $\equiv$ RdJVFCHjUMI.
|
| 237 |
+
|
| 238 |
+
Xi Ye, Srinivasan Iyer, Asli Celikyilmaz, Ves Stoyanov, Greg Durrett, and Ramakanth Pasunuru. Complementary explanations for effective in-context learning. CoRR, abs/2211.13892, 2022. doi: 10.48550/arXiv.2211.13892. URL https://doi.org/10.48550/arXiv.2211.13892.
|
| 239 |
+
|
| 240 |
+
Hanlin Zhang, Yi-Fan Zhang, Li Erran Li, and Eric P. Xing. The impact of symbolic representations on in-context learning for few-shot reasoning. CoRR, abs/2212.08686, 2022a. doi: 10.48550/arXiv. 2212.08686. URL https://doi.org/10.48550/arXiv.2212.08686.
|
| 241 |
+
|
| 242 |
+
# A Appendix
|
| 243 |
+
|
| 244 |
+
# A.1 Example from PRONTOQA-OOD
|
| 245 |
+
|
| 246 |
+
Q: Everything that is a lorpus, a brimpus, or a jompus is a shumpus. Every wumpus is a vumpus and a sterpus and a brimpus. Everything that is a vumpus, a grimpus, or a brimpus is a lempus. Everything that is a lempus or a jompus or a lorpus is a dumpus. Vumpuses are rompuses. Every sterpus is a gorpus. Everything that is a vumpus, a grimpus, or a brimpus is a dumpus. Wumpuses are shumpuses. Polly is a rompus. Polly is a wumpus. Prove: Polly is a lempus or an impus or a yumpus.
|
| 247 |
+
|
| 248 |
+
A: Polly is a wumpus. Every wumpus is a vumpus and a sterpus and a brimpus. Polly is a vumpus and a sterpus and a brimpus. Polly is a brimpus. Polly is a vumpus, a grimpus, or a brimpus. Everything that is a vumpus, a grimpus, or a brimpus is a lempus. Polly is a lempus. Polly is a lempus, an impus, or a yumpus.
|
| 249 |
+
|
| 250 |
+
FIGURE 10: An example from PRONTOQA-OOD. This is a compositional example with a min depth of 4 and 3 rule types. The given answer is the expected chain-of-thought. The question is shown in blue, the query in red, and the chain-of-thought/answer in green.
|
| 251 |
+
|
| 252 |
+
# A.2 Results with absolute accuracy
|
| 253 |
+
|
| 254 |
+

|
| 255 |
+
FIGURE 11: (top) Proof accuracy across examples with different deduction rules. The in-context examples and test examples come from the same distribution. (bottom) Proof accuracy where the test example is out-ofdemonstration with respect to the in-context examples (for comparison, the in-demonstration proof accuracy is shown as the dotted black bars). That is, the test example has the specified deduction rule, but the in-context examples are uniformly distributed over all other deduction rules. See Figure 5 for an incorrect example. Implication elimination examples have proof width of 1 and depth of 2. Conjunction introduction, conjunction elimination, and disjunction introduction examples have proof width 3 and depth 2. Disjunction elimination examples have proof width 3 and depth 1. Proof by contradiction examples have proof width 2 and depth 1.
|
| 256 |
+
|
| 257 |
+

|
| 258 |
+
FIGURE 12: (top) Proof accuracy on compositional examples where the in-context examples are also compositional examples with the same min depth and number of rule types. (bottom) Proof accuracy where the test examples are compositional but the in-context examples are those of individual deduction rules (for comparison, the in-demonstration proof accuracy is shown as the dotted black bars).
|
| 259 |
+
|
| 260 |
+

|
| 261 |
+
FIGURE 13: (top) Proof accuracy on examples where both the in-context examples and test examples have distractors. Sentences in all questions are ordered randomly. (middle) Proof accuracy when distractors are removed from the in-context examples, but not from the test examples (for comparison, the in-demonstration proof accuracy is shown as the dotted black bars). The sentences of the in-context questions have a fixed order (corresponding to a postorder traversal of the ontology tree), whereas the sentences in the test question have random order. (bottom) The same setting as (middle) except the distractors in the in-context examples are instead replaced with irrelevant sentences. Implication elimination examples have proof width of 1 and depth of 2. Conjunction introduction, conjunction elimination, and disjunction introduction examples have proof width 2 and depth 2. Disjunction elimination examples have proof width 3 and depth 1. Proof by contradiction examples have proof width 2 and depth 1.
|
| 262 |
+
|
| 263 |
+
# A.3 Full examples of incorrect predicted proofs
|
| 264 |
+
|
| 265 |
+
Question: Lempuses are gorpuses. Rompuses are wumpuses. Tumpuses are wumpuses. Dumpuses are gorpuses. Every zumpus is a wumpus. Every brimpus is a gorpus. Yumpuses are gorpuses. Lempuses are wumpuses. Rompuses are gorpuses. Tumpuses are gorpuses. Max is a tumpus or a rompus or a lempus. Max is a zumpus, a tumpus, or a rompus.
|
| 266 |
+
|
| 267 |
+
Prove: Max is a gorpus.
|
| 268 |
+
|
| 269 |
+
Predicted answer: Max is a tumpus or a rompus or a lempus. Max is a tumpus.
|
| 270 |
+
Tumpuses are wumpuses. Max is a wumpus. Rompuses are gorpuses. Max is a gorpus.
|
| 271 |
+
Max is a gorpus. Expected answer: Assume Max is a tumpus. Tumpuses are gorpuses. Max is a gorpus.
|
| 272 |
+
Assume Max is a rompus. Rompuses are gorpuses. Max is a gorpus.
|
| 273 |
+
Assume Max is a lempus. Lempuses are gorpuses. Max is a gorpus.
|
| 274 |
+
Since Max is a tumpus or a rompus or a lempus, Max is a gorpus.
|
| 275 |
+
|
| 276 |
+
FIGURE 14: Example of an incorrect proof generated by GPT-3.5 on an out-of-demonstration disjunction elimination example. The premises (axioms) are given in blue, and invalid steps are given in red.
|
| 277 |
+
|
| 278 |
+
Question: Polly is a wumpus. Every rompus is a dumpus. Lempuses are vumpuses. Everything that is a wumpus, a jompus, and a tumpus is a dumpus. Polly is a gorpus. Every impus is a brimpus. Everything that is a wumpus, a gorpus, and a shumpus is a vumpus. Each lempus is an impus and a lorpus and a rompus. Everything that is a wumpus, a jompus, and a tumpus is not a lorpus. Zumpuses are lorpuses. Polly is a shumpus. Polly is a zumpus. Polly is a zumpus. Polly is a wumpus. Polly is a jompus. Polly is a tumpus.
|
| 279 |
+
|
| 280 |
+
Prove: Polly is not a lempus.
|
| 281 |
+
|
| 282 |
+
Predicted answer: Polly is a wumpus, a jompus, and a tumpus. Everything that is a wumpus, a jompus, and a tumpus is not a lempus. Polly is not a lempus.
|
| 283 |
+
|
| 284 |
+
Expected answer: Polly is a tumpus. Polly is a jompus. Polly is a wumpus. Polly is a wumpus and a jompus and a tumpus. Everything that is a wumpus, a jompus, and a tumpus is not a lorpus. Polly is not a lorpus.
|
| 285 |
+
Assume Polly is a lempus. Each lempus is an impus and a lorpus and a rompus. Polly is an impus and a lorpus and a rompus. Polly is a lorpus. This contradicts with Polly is not a lorpus. Polly is not a lempus.
|
| 286 |
+
|
| 287 |
+
FIGURE 15: Example of an incorrect proof generated by GPT-3.5 on an out-of-demonstration example with min depth 2 and 4 rule types. The premises (axioms) are given in blue, and invalid steps are given in red.
|
| 288 |
+
|
| 289 |
+
Question: Every grimpus is a zumpus. Each vumpus is opaque. Each dumpus is not brown. Each grimpus is dull. Lorpuses are moderate. Every brimpus is rainy. Impuses are temperate. Lorpuses are dumpuses. Brimpuses are vumpuses. Every lorpus is a brimpus. Zumpuses are angry. Grimpuses are yumpuses. Every brimpus is a grimpus. Impuses are sterpuses. Sally is an impus. Sally is a brimpus.
|
| 290 |
+
|
| 291 |
+
Prove: Sally is dull.
|
| 292 |
+
|
| 293 |
+
Predicted answer: Sally is an impus. Impuses are sterpuses. Every grimpus is a zumpus. Every brimpus is a grimpus. Lorpuses are dumpuses. Brimpuses are vumpuses. Every lorpus is a brimpus. Sally is a brimpus. Each vumpus is opaque. Each dumpus is not brown. Every grimpus is dull. Sally is a grimpus. Sally is dull.
|
| 294 |
+
|
| 295 |
+
Expected answer: Sally is a brimpus. Every brimpus is a grimpus. Sally is a grimpus. Each grimpus is dull. Sally is dull.
|
| 296 |
+
|
| 297 |
+
FIGURE 16: Example of an incorrect proof generated by GPT-3.5 on an OOD implication elimination example where the in-context demonstrations have no distractors, but the test example does. The premises (axioms) are given in blue, and invalid steps are given in red.
|
| 298 |
+
|
| 299 |
+
# A.4 Generative process details
|
| 300 |
+
|
| 301 |
+
In this section, we describe the process to generate examples of each deduction rule.
|
| 302 |
+
|
| 303 |
+
Implication elimination (i.e. modus ponens) Given $f ( c )$ and $\forall x ( f ( x ) g ( x ) )$ , prove $g ( c )$ . These are the examples in the original PRONTOQA. We follow the same process here:
|
| 304 |
+
|
| 305 |
+
1. Generate an ontology. For simplicity, we generate linear ontologies, consisting of a collection of concepts, as well as subtype-supertype relations between those concepts (i.e. concept $f$ is a subtype of the supertype $g$ if every instance of $f$ is an instance of $g$ ). For simplicity, we limit each type to have at most one supertype.
|
| 306 |
+
2. Perform a random walk of length $k$ from a randomly selected start vertex, where $k$ is the desired proof depth.
|
| 307 |
+
3. Traverse the edges of the ontology and convert each into a sentence of the question.
|
| 308 |
+
4. Convert each step of the random walk into a sentence of the gold chain-of-thought.
|
| 309 |
+
|
| 310 |
+
Note that this process allows us to generate proofs of any depth, but the width is fixed to 1.
|
| 311 |
+
|
| 312 |
+
Conjunction introduction Given $A$ and $B$ , prove $A \land B$ . The generative process is a modified version of that for implication elimination. Instead of generating rules of the form $\forall x ( f ( x ) g ( x ) )$ , we generate rules of the form $\forall x ( f _ { 1 } ( x ) \land \dots \land f _ { n } ( x ) g ( x ) )$ , where $n$ is the proof width. Given, $f _ { 1 } ( \bar { c } )$ , . . ., and $f _ { n } ( c )$ , the model must first prove $f _ { 1 } ( c ) \wedge \ldots \wedge f _ { n } ( c )$ before applying implication elimination to prove $g ( c )$ . To increase the depth of the proof, $g ( c )$ itself can be part of a conjunct in the antecedent of another rule.
|
| 313 |
+
|
| 314 |
+
Conjunction elimination Given $A \land B$ , prove $A$ . These examples are identical to those in conjunction introduction, except the conjunction appears in the consequent of each rule, rather than in the antecedent: $\forall x ( f ( x ) \bar { \to } g _ { 1 } ( x ) \land \bar { \land } . . . \land g _ { n } ( \bar { x } ) )$ where $n$ is the proof width.
|
| 315 |
+
|
| 316 |
+
Disjunction introduction Given $A$ , prove $A \lor B$ . These examples are identical to those in conjunction introduction, except the conjunction is replaced with disjunction: $\forall x ( f _ { 1 } ( x ) \lor . . . \lor f _ { n } ( x ) \to { \bar { g } } ( x ) )$ where $n$ is the proof width. But note that grounded axioms are not necessary for every disjunct: To apply the rule $\bar { \forall } x ( f _ { 1 } ( x ) \lor \dots \lor f _ { n } ( x ) \to \bar { g } ( x ) )$ , knowing $f _ { n } ( c )$ is sufficient, and we do not need to generate grounded axioms for the other disjuncts $f _ { i } ( c )$ for $i < n$ .
|
| 317 |
+
|
| 318 |
+
Disjunction elimination (i.e. proof by cases) Given $A _ { 1 } \lor . . . \lor A _ { n }$ , and $A _ { i } \vdash C$ for all $i$ , prove $C$ . Here, $n$ is the proof width. While it is possible to construct proofs containing multiple nested applications of disjunction elimination, such proofs are quite complex, even for humans to understand, and so we fix the depth of these examples to 1. To generate an example, we first generate the disjunction: $f _ { 1 } ( c ) \lor \dots \lor f _ { n } ( c )$ . Next, generate the rules for each case: $\forall x ( f _ { i } ( x ) g ( x ) )$ for all $i$ The goal is to prove $g ( c )$ .
|
| 319 |
+
|
| 320 |
+
Proof by contradiction Given $A \vdash B$ and $\neg B$ , prove $\neg A$ . Note that this is a rule composed of two natural deduction rules: negation elimination and introduction. But since those individual rules do not lend themselves to a natural text representation, we choose to study their composition. Similar to disjunction elimination, it is possible to construct proofs containing multiple nested applications of proof by contradiction, but such proofs are unnaturally complex. So we fix the depth to 1. To generate an example, we first generate an axiom $\neg g ( c )$ . Next, for each subproof, we generate a rule $\forall x ( f _ { 1 } ( x ) \lor \dots \lor f _ { n } ( x ) \to g \bar { ( x ) } )$ , where $n$ is the proof width. The goal is to prove $\neg f _ { 1 } ( c ) \land \dots \land \neg f _ { n } ( c )$ . Note that in addition to proof by contradiction, this proof requires disjunction introduction, implication elimination, and conjunction introduction.
|
| 321 |
+
|
| 322 |
+
Note that the above list constitutes a complete set of deduction rules from propositional natural deduction, save for one rule: implication introduction. However, it is unclear how to construct an example with this deduction rule where its difficulty can be controlled by increasing the width or depth of the proof (e.g. how can a statement of the form $A _ { 1 } \to A _ { 2 } \to . . . \to A _ { n }$ be expressed in natural language?).
|
| 323 |
+
|
| 324 |
+
Algorithm 1: Pseudocode for generating examples of compositional proofs in PRONTOQA-OOD. In this algorithm, $\Omega$ denotes the set of all logical forms. The function generate_compositional_proof is initially called with parameters $\Omega , \emptyset , d , e .$ , and false, where $d$ is the requested depth and $e$ is a randomly selected entity name (e.g. alex, fae, etc). sample is a helper function that, given an input set of logical forms $S$ and an entity $e$ , returns sample_uniform({set of logical forms in $S$ with minimal depth where all atoms are of the form $t ( e )$ where $t$ is a predicate}).
|
| 325 |
+
|
| 326 |
+
function generate_compositional_proof(set of possible conclusions (logical forms) $C$ ,
|
| 327 |
+
disallowed deduction rules $R$ ,
|
| 328 |
+
requested depth d,
|
| 329 |
+
ground entity $e$ ,
|
| 330 |
+
is proof hypothetical $h$ )
|
| 331 |
+
2 initialize $A$ as the set of all deduction rules excluding those in $R$
|
| 332 |
+
$^ { \prime * }$ filter deduction rules such that: (1) an element of $C$ can be a conclusion
|
| 333 |
+
of the rule, (2) for which we have sufficient depth, and (3) we don’t create
|
| 334 |
+
overly complex logical forms $^ { * / }$
|
| 335 |
+
3 if $C$ does not contain a conjunction
|
| 336 |
+
4 set $A = A \setminus \left\{ \begin{array} { r l r } \end{array} \right.$ conjunction_introduction}
|
| 337 |
+
5 if $C$ does not contain a disjunction
|
| 338 |
+
6 set $A = A$ \ {disjunction_introduction}
|
| 339 |
+
7 if $h = t r u e$ or $d = 1$ or $C$ does not contain a negation
|
| 340 |
+
8 set $A = A$ \ {proof_by_contradiction}
|
| 341 |
+
9 if $h = t r u e$ or $d = 1$ or $C$ contains only conjunctions or only disjunctions
|
| 342 |
+
10 set $A = A$ \ {disjunction_elimination}
|
| 343 |
+
11 if $C$ contains only conjunctions or only disjunctions
|
| 344 |
+
12 set $A = A \setminus \left\{ \begin{array} { r l r } \end{array} \right.$ conjunction_elimination}
|
| 345 |
+
13 if $C$ contains only conjunctions or only disjunctions and any operand is negated
|
| 346 |
+
14 set $A = A$ \ {implication_elimination}
|
| 347 |
+
15 if $d = 0$ or $C$ contains a singleton logical form or $A = \emptyset$
|
| 348 |
+
16 return axiom step with conclusion given by samp $\displaystyle { \bar { \imath } e ( C , e ) }$
|
| 349 |
+
17 $r =$ sample_uniform $( A )$
|
| 350 |
+
18 if r = implication_elimination
|
| 351 |
+
19 do
|
| 352 |
+
20 for any $c \in C$ , $a$ and $c$ share any operands or negations of operands
|
| 353 |
+
21 while $a =$ generate_compositional_proof $( \Omega , \emptyset , d - 1 , \bar { e } , h )$
|
| 354 |
+
22 do
|
| 355 |
+
23 $| \textit { \textbf { a } }$ and $s$ do not share any operands or negations of operands
|
| 356 |
+
24 while $s = s a m p l e ( C , e )$
|
| 357 |
+
25 return implication_elimination with premises a and $\forall x ( a [ e x ] s [ e x ]$ )
|
| 358 |
+
26 else if r = conjunction_introduction
|
| 359 |
+
27 initialize $P$ as an empty list, and $i = 0$
|
| 360 |
+
28 $L = | C |$ if $C$ contains only conjunctions, else $L = 3$
|
| 361 |
+
29 do
|
| 362 |
+
30 let $C _ { i } = i ^ { t h }$ operand of $C$ if $C$ contains only conjunctions, else $C _ { i } = \Omega$
|
| 363 |
+
31 $a =$ generate_compositional_proof( $C _ { i }$ , $\{$ conjunction_elimination} $, d - 1 , e , h )$
|
| 364 |
+
32 if $a$ is atomic and $a$ is not any other operand of $C$
|
| 365 |
+
33 append $a$ to $P$
|
| 366 |
+
34 $i = i + 1$
|
| 367 |
+
35 while $i < L$
|
| 368 |
+
36 return conjunction_introduction with premises $P$
|
| 369 |
+
37 else if $r =$ conjunction_elimination
|
| 370 |
+
38 let $C ^ { \prime }$ be the set of conjunctions of length 3, $i =$ sample_uniform $( \{ 1 , 2 , 3 \} )$ )
|
| 371 |
+
39 $C ^ { \prime } = \{ c \in C ^ { \prime }$ : the $i ^ { t h }$ operand of $c ^ { \prime }$ is in $C \}$
|
| 372 |
+
40 do
|
| 373 |
+
41 $a =$ generate_compositional_proof( $C ^ { \prime }$ , {conjunction_introduction}, $d - 1 , e , h )$
|
| 374 |
+
42 while a has no duplicate operands, and each operand of a is not itself a conjunction or disjunction
|
| 375 |
+
43 return conjunction_elimination with premise a and conclusion given by the $i ^ { t h }$ operand of $a$
|
| 376 |
+
44 else if $r = d \cdot$ isjunction_introduction
|
| 377 |
+
45 if $C = \Omega$ let $C$ be the set of disjunctions of length 3
|
| 378 |
+
46 $i =$ sample_uniform( number of disjuncts in $C$ )
|
| 379 |
+
47 do
|
| 380 |
+
48 let $C _ { i } = i ^ { t h }$ operand of $C$
|
| 381 |
+
49 $a =$ generate_compositional_proof( $C _ { i }$ , {disjunction_elimination}, d − 1, e, h)
|
| 382 |
+
50 while $a$ is atomic and a is not any other operand of $C$
|
| 383 |
+
51 replace $i ^ { t h }$ operand of $C$ with $a$
|
| 384 |
+
52 do
|
| 385 |
+
53 $\textbf { | } \ x = \mathtt { s a m p l e } ( C , e )$
|
| 386 |
+
54 while $i ^ { t h }$ disjunct of $_ x$ is distinct from all other disjuncts
|
| 387 |
+
55 return disjunction_introduction with premise given by the $i ^ { t h }$ operand of $_ x$ and conclusion $x$
|
| 388 |
+
56 else if $r = d$ isjunction_elimination
|
| 389 |
+
57 initialize $P$ as an empty list
|
| 390 |
+
58 while $| P | < 2$ do
|
| 391 |
+
59 $p =$ generate_compositional_proof(C, {disjunction_introduction}, $d - 1 , e$ , true)
|
| 392 |
+
60 if $p$ is not a conjunction or disjunction and $p$ has an axiom that is not an axiom of any $q \in P$
|
| 393 |
+
61 append $p$ to $P$
|
| 394 |
+
62 let $A _ { i }$ be the set of axioms of $P _ { i }$ that are not axioms of $P _ { j }$ for $i \neq j$
|
| 395 |
+
63 let $a _ { i } =$ sample_uniform $\left( A _ { i } \right)$ for all $_ { i }$
|
| 396 |
+
64 let $a ^ { \prime }$ be a disjunction with disjuncts $a _ { i }$
|
| 397 |
+
65 $a =$ generate_compositional_proof $( \{ a ^ { \prime } \}$ , {disjunction_introduction} $\cdot , d - 1 , e , h )$
|
| 398 |
+
66 return disjunction_introduction with premises a and $P _ { i }$
|
| 399 |
+
67 else if $r = p r o o f .$ _by_contradiction
|
| 400 |
+
68 let $N$ be the set of all negated logical forms
|
| 401 |
+
69 $a =$ generate_compositional_proof(N, {proof_by_contradiction}, d − 1, h)
|
| 402 |
+
70 do
|
| 403 |
+
let $a = \neg s$
|
| 404 |
+
$b =$ generate_compositional_proof $\langle \boldsymbol { \it s } \rangle$ , {proof_by_contradiction}, d − 1, e, true)
|
| 405 |
+
while b has an atomic non-negated axiom that is not an axiom of $a$
|
| 406 |
+
$s ^ { \prime } = { }$ sample_uniform({atomic non-negated axioms of $b$ that are not axioms of $a \}$ )
|
| 407 |
+
return proof_by_contradiction with premises a and b and conclusion $\boldsymbol { \neg { s ^ { \prime } } }$
|
| 408 |
+
|
| 409 |
+
# A.5 Generating compositional proofs
|
| 410 |
+
|
| 411 |
+
We use a simple recursive procedure to generate compositional proofs: (1) select a deduction rule uniformly at random, (2) select the premises for the selected rule, (3) recursively generate a subproof for each premise. A consistency checking step is required to make sure we avoid generating contradictory axioms.6 In addition, we avoid generating an elimination rule directly following an introduction rule (or vice versa).7 See Algorithm 1 in the appendix for pseudocode of this procedure. To test compositional proofs of various sizes, we implement a parameter that controls the minimum depth of the proof tree, and another parameter that controls the number of distinct rule types in each proof.
|
| 412 |
+
|
| 413 |
+
# A.6 Further details on evaluation of CoT
|
| 414 |
+
|
| 415 |
+
We aim to test whether LLMs are able to use deduction rules OOD, where the rules do not appear in the in-context examples, and we take care not to be overly strict. For example, we wish to avoid penalizing the model for formatting differences, so long as the reasoning is correct. To this end, in determining whether a logical form follows from previous logical forms, we consider any deduction rule listed in Table 2. We also allow for two additional rules: (1) given $\forall x ( f ( x ) g ( x ) )$ and $\forall x ( g ( x ) h ( x ) )$ conclude $\forall x ( f ( x ) h ( x ) )$ , and (2) given $\forall x ( f ( x ) g ( x ) )$ and $\neg g ( c )$ conclude $\neg f ( c )$ (i.e. modus tollens).8 Additionally, we are flexible with respect to the ordering of conjuncts and disjuncts. For example, given the previous steps $f ( a ) \land g ( a )$ and $\forall x ( g ( x ) \land f ( x ) \bar { \to } u ( x ) \lor \bar { v } ( x ) )$ , we consider $v ( a ) \lor u ( a )$ to be valid.
|
| 416 |
+
|
| 417 |
+
# A.7 Generating distractors
|
| 418 |
+
|
| 419 |
+
Implication elimination For any rule $\forall x ( f ( x ) g ( x ) )$ in the gold proof, we generate a distractor rule $\forall x ( f ( x ) h ( x ) )$ where the concept $h$ is a distractor and is not helpful in completing the proof. In addition, for any ground logical form in the gold proof $f ( c )$ , we generate a distractor logical form $h ( c )$ as well as a rule $\forall \bar { x ( h ( x ) h ^ { \prime } ( x ) ) }$ . Note that the original PRONTOQA only adds a single distractor, whereas we add multiple, one for each hop in the proof.
|
| 420 |
+
|
| 421 |
+
Conjunction introduction Similar to those in implication elimination. For any rule $\forall x ( f _ { 1 } ( x ) \wedge \ldots \wedge$ ${ \dot { f _ { n } } } ( x ) g ( x ) )$ , we generate a rule of the form $\forall x ( h _ { 1 } ( x ) \land \dotsc \land h _ { n - 1 } ( x ) \land f _ { n } ( x ) g ( x ) )$ where $h _ { i }$ are distractor concepts. Grounded distractor conjuncts are also generated as axioms $\dot { h _ { i } } ( c )$ , so that, given $f _ { n } ( c )$ , both the gold rule and distractor rule are valid proof steps.
|
| 422 |
+
|
| 423 |
+
Conjunction elimination Distractors are generated similarly to the conjunction introduction case.
|
| 424 |
+
|
| 425 |
+
Disjunction introduction Distractors are generated similarly to the conjunction introduction case.
|
| 426 |
+
|
| 427 |
+
Disjunction elimination Since this deduction step has many premises, multiple distractors are necessary to ensure the model doesn’t resort to heuristics. For every rule of the form $\forall x ( f _ { i } ( x ) g ( x ) )$ , two distractor rules are generated: $\forall x ( f _ { i } ( x ) h ^ { \prime } ( x ) )$ and $\forall x ( h _ { i } ( x ) \ \ g ( x ) )$ . A distractor disjunction is also generated: $h ^ { \prime \prime } ( c ) \vee h _ { 1 } ( c ) \vee \ldots \vee h _ { n - 1 } ( c )$ .
|
| 428 |
+
|
| 429 |
+
Proof by contradiction As with disjunction elimination, multiple distractors are necessary here. We generate two distractor rules $\forall x ( { \bar { f _ { 1 } } } ( x ) \lor . . . \lor f _ { n } ( x ) \to h ( x ) )$ and $\forall x ( h _ { 1 } ( x ) \lor . . . \lor h _ { n } ( x ) g ( x ) )$ . We also generate the distractor axiom $\neg h ^ { \prime } ( c )$ so that the model is forced to choose between two axioms for the first step of the proof.
|
| 430 |
+
|
| 431 |
+
To avoid creating inconsistencies when generating a distractor rule, we avoid using existing predicates in the consequent of each rule.
|
| 432 |
+
|
| 433 |
+
Algorithm 2: Pseudocode for evaluating the output chain-of-thought. Here, the comparison operations between logical forms ignore the order of conjuncts if both operands are conjunctions; and similarly for disjunctions. In addition, when iterating over previous steps in the proof, we consider them in reverse order, so that more recent steps are prioritized. The helper function negate is defined, in order of precedence: negate $( \neg A ) = A$ , negate $( A \lor B ) =$ negate(A) $\wedge$ negate $( B )$ , negate $ [ A \land B ) = { \mathsf { n e g a t e } } ( A ) \lor$ negate $( B )$ , or negat $\mathfrak { s } ( A ) = \neg A$ .
|
| 434 |
+
|
| 435 |
+
1 function evaluate_cot(context sentences $Q _ { 1 } , \ldots , Q _ { m }$ ,
|
| 436 |
+
predicted chain-of-thought sentences $C _ { 1 } , \ldots , C _ { n }$ ,
|
| 437 |
+
goal sentence $g$ )
|
| 438 |
+
2 $L ^ { g } =$ semantic_parse $( g )$ $^ { \prime * }$ parse the goal $^ { * / }$
|
| 439 |
+
3 for $i \in { 1 , \dots , m }$ do $^ { \prime * }$ parse the context $^ { * / }$
|
| 440 |
+
4 $L _ { i } ^ { Q } =$ semantic_parse( $( Q _ { i } )$
|
| 441 |
+
5 for $i \in { 1 , \dots , m }$ do $^ { \prime * }$ parse the predicted chain-of-thought $^ { * / }$
|
| 442 |
+
6 L $L _ { i } ^ { C } =$ semantic_parse(Ci)
|
| 443 |
+
initialize $S$ as an empty set, and $H$ as an empty map
|
| 444 |
+
8 for $i \in { 1 , \dots , n }$ do $^ { \prime * }$ reconstruct the proof from the chain-of-thought \*/
|
| 445 |
+
9 if $L _ { i } ^ { C }$ indicates ‘this is a contradiction’
|
| 446 |
+
10 if negate $( L _ { i + 1 } ^ { C } ) \in H ( L _ { i - 1 } ^ { C } )$
|
| 447 |
+
11 $\begin{array} { r l } { \Bigl | } & { { } \bigl ( \boldsymbol { \tilde { P } } , \boldsymbol { \tilde { D } } , \boldsymbol { k } \bigr ) \stackrel { \cdot \cdot \cdot } { = } \bigl ( \bigl \{ \boldsymbol { L } _ { i - 1 } ^ { \overline { { C } } } , \mathrm { n e g a t e } ( \boldsymbol { L } _ { i + 1 } ^ { C } ) \bigr \} , \bigl \{ \mathrm { n e g a t e } ( \boldsymbol { L } _ { i + 1 } ^ { C } ) \bigr \} , 1 \bigr ) } \end{array}$
|
| 448 |
+
12 else continue
|
| 449 |
+
13 else
|
| 450 |
+
14 $\begin{array} { r l } & { \bigcup _ { \mathbf { \alpha } } ( P , D , k ) = \operatorname { i s } _ { \mathbf { \alpha } \mathbf { - } \mathbf { p r o v a b l e } ( L _ { i } ^ { C } , \{ L _ { 1 } ^ { Q } , \dots , L _ { m } ^ { Q } \} , S , H ) } } \\ & { \operatorname { s e t } H ( L _ { i } ^ { C } ) = \bigcup _ { p \in P } H ( p ) \setminus D } \end{array}$
|
| 451 |
+
15
|
| 452 |
+
16 if k ≥ 0
|
| 453 |
+
17 add $L _ { i } ^ { C }$ to $S$
|
| 454 |
+
18 return $L ^ { g } \in S$ $^ { \prime * }$ the proof is correct if the final conclusion is provable \*/
|
| 455 |
+
|
| 456 |
+
19 function is_provable(logical form $\varphi$ , set of axioms $A$ , previous conclusions $S$ , hypothesis map $H$ )
|
| 457 |
+
|
| 458 |
+
20 if $\varphi \in A$
|
| 459 |
+
21 return $( \{ \varphi \} , 1 )$ /\* this is an axiom \*/
|
| 460 |
+
22 else if $\varphi$ is a conjunction or disjunction
|
| 461 |
+
23 initialize $P ^ { \prime }$ as an empty list, and $k ^ { \prime } = 0$
|
| 462 |
+
24 for $\varphi _ { i }$ operand in $\varphi$ do
|
| 463 |
+
25 $\begin{array}{c} \begin{array} { r l } { | } & { { } \left( \begin{array} { l } { | } \end{array} \right. } \end{array} ( P , k ) = \mathbf { i s } _ { - } \mathbf { p r o v a b l e } ( \varphi _ { i } , A , S , H ) \end{array}$
|
| 464 |
+
26 if $\varphi$ is a conjunction
|
| 465 |
+
27 if $k \geq 0$ and the step immediately preceding $\varphi$ in the proof is in $P$
|
| 466 |
+
28 append P to P ′
|
| 467 |
+
29 set $\boldsymbol { k } ^ { \prime } = \boldsymbol { k } ^ { \prime } + \boldsymbol { k }$
|
| 468 |
+
30 else break
|
| 469 |
+
31 else if $k > 0$ and $\varphi$ is a disjunction
|
| 470 |
+
32 $\Big \lfloor \Big \lfloor \mathbf { r e t u r n } \left( P , \mathcal { D } , k + 1 \right)$ $^ { \prime * }$ provable by disjunction introduction \*/
|
| 471 |
+
33 if $P ^ { \prime }$ has the same size as $\varphi$ has operands
|
| 472 |
+
34 $\lfloor \mathrm { \ r e t u r n } \left( \bigcup P ^ { \prime } , \emptyset , k ^ { \prime } \right)$ $^ { \prime * }$ provable by conjunction introduction $^ { * / }$
|
| 473 |
+
35 for $a \in S \cup A$ do
|
| 474 |
+
36 if $a$ is a conjunction and $\varphi = a _ { i }$ for some $i$
|
| 475 |
+
37 return $( \{ a \} , \emptyset , 1 + \mathbb { 1 } \{ a \in A \} )$ $^ { \prime * }$ provable by conjunction elimination \*/
|
| 476 |
+
38 else if $a$ has form $\forall x ( \psi \gamma )$ where $\gamma [ x \mapsto c ] = \varphi$
|
| 477 |
+
39 $| \mathbf { \Gamma } ( P , k ) = \operatorname { i s _ { - } p r o v a b l e } ( \psi [ x \mapsto c ] , A , S , H )$
|
| 478 |
+
40 if $k \geq 0$ and the step immediately preceding $\varphi$ in the proof is in $P \cup \{ a \}$
|
| 479 |
+
41 return $( P \cup \{ a \} , \emptyset , k + \mathbb { 1 } \{ a \in A \} )$ $^ { \prime * }$ provable by conjunction elimination \*/
|
| 480 |
+
42 for $s \in S$ where s is a disjunction do
|
| 481 |
+
43 if for all disjuncts $s _ { i }$ , there is a $s _ { j } \in S$ such that $s _ { j } = \varphi$ and $s _ { i } \in H ( s _ { j } )$
|
| 482 |
+
44 return $( \{ s _ { j } \} , \{ s _ { i } \} , 1 )$ $^ { \prime * }$ provable by disjunction elimination \*/
|
| 483 |
+
|
| 484 |
+

|
| 485 |
+
Algorithm 2: (continued from previous page)
|
md/dev/MG3YN3z1J4M/MG3YN3z1J4M.md
ADDED
|
@@ -0,0 +1,329 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Unveiling The Mask of Position-Information Pattern Through the Mist of Image Features
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 Recent studies show that paddings in convolutional neural networks encode ab
|
| 11 |
+
2 solute position information which can negatively affect the model performance
|
| 12 |
+
3 for certain tasks. However, existing metrics for quantifying the strength of po
|
| 13 |
+
4 sitional information remain unreliable and frequently lead to erroneous results.
|
| 14 |
+
5 To address this issue, we propose novel metrics for measuring (and visualizing)
|
| 15 |
+
6 the encoded positional information. We formally define the encoded information
|
| 16 |
+
7 as PPP (Position-information Pattern from Padding) and conduct a series of ex
|
| 17 |
+
8 periments to study its properties as well as its formation. The proposed metrics
|
| 18 |
+
9 measure the presence of positional information more reliably than the existing
|
| 19 |
+
10 metrics based on PosENet and a test in F-Conv. We also demonstrate that for any
|
| 20 |
+
11 extant (and proposed) padding schemes, PPP is primarily a learning artifact and is
|
| 21 |
+
12 less dependent on the characteristics of the underlying padding schemes.
|
| 22 |
+
|
| 23 |
+
# 13 1 Introduction
|
| 24 |
+
|
| 25 |
+
14 Padding, one of the most fundamental components in neural network architectures, has received
|
| 26 |
+
15 much less attention than other modules. Zero padding is frequently used in CNNs, perhaps due to its
|
| 27 |
+
16 simplicity and low computational costs. This design preference remains almost unchanged in the past
|
| 28 |
+
17 decade. Recent studies [1, 2, 3, 4] show that padding can implicitly provide a network model with
|
| 29 |
+
18 positional information. Such positional information can cause unwanted side-effects by interfering
|
| 30 |
+
19 and affecting other sources of position-sensitive cues (e.g., explicit coordinate inputs [5, 6, 7, 8, 9],
|
| 31 |
+
20 embeddings [10], or boundary conditions of the model [4, 11, 12]). Furthermore, padding may lead
|
| 32 |
+
21 to several unintended behaviors [5, 7, 8, 9], degrade model performance [10, 11, 12], or sometimes
|
| 33 |
+
22 create blind spots [6]. Meanwhile, simply ignoring the padding pixels (known as no-padding or
|
| 34 |
+
23 valid-padding) leads to the foveal effect [13, 14] that causes a model to become less attentive to
|
| 35 |
+
24 the features on the image border. These observations motivate us to thoroughly investigate the
|
| 36 |
+
25 phenomenon of positional encoding including the impact of commonly used padding schemes.
|
| 37 |
+
|
| 38 |
+
Conducting such a study requires a reliable metric to detect the presence of positional information introduced by padding, and more importantly, quantify its strength consistently. We observe that the existing methods for detecting and quantifying the strength of positional information yield inconsistent results. In Section 3, we revisit two closely related evaluation methods, PosENet [1] and F-Conv [3]. Our extensive experiments demonstrate that (a) metrics based on PosENet are unreliable with an unacceptably high variance, and (b) the ‘Border Handling Variants’ (BHV) test in F-Conv suffers from unaware confounding variables in its design, leading to unreliable test results.
|
| 39 |
+
|
| 40 |
+

|
| 41 |
+
Figure 1: Position-information Pattern from Padding (PPP). We propose a method that can consistently and effectively extract PPPs through the distributional difference between optimallypadded (gray-scale surfaces) and algorithmically-padded features (colored surfaces). The results show that the two distributions become distinguishable as the number of sample increases. Following the procedure in Section 2.2, we extract a clear view of PPP with the expectation of the pairwise differences between optimally-padded and algorithmically-padded features. We render each visualization in tilted view (first row) and top view (second row). The colors represent the magnitude (blue/cold/weak to green/warm/strong) at each pixel. The features are extracted at the 3rd layer of interest (Appendix A) from a randn-padded (Section 2.4) ResNet50 pretrained on ImageNet.
|
| 42 |
+
|
| 43 |
+
33 In addition, we observe all commonly-used padding schemes actually encode consistent patterns
|
| 44 |
+
34 underneath the highly dynamic model features. However, such a pattern is rather obscure, noisy,
|
| 45 |
+
35 and visually imperceptible1 in most cases. Fortunately, we show that such patterns can be consis
|
| 46 |
+
36 tently revealed with a sufficient number of samples by defining an optimal padding scheme (see
|
| 47 |
+
37 Section 2.1 and Figure 1). We accordingly propose a new evaluation paradigm and develop a method
|
| 48 |
+
38 to consistently detect the presence of the Position-information Pattern from Padding (PPP), which
|
| 49 |
+
39 is a persistent pattern embedded in the model features to retain positional information. We present
|
| 50 |
+
40 two metrics to measure the response of PPP from the signal-to-noise perspective and demonstrate its
|
| 51 |
+
41 robustness and low deviation among different settings, each with multiple trials of training.
|
| 52 |
+
42 To weaken the effect of PPP, we design a padding scheme with built-in stochasticity to halt the
|
| 53 |
+
43 model from constructing consistent patterns in Section 2.4. However, our experiments show that the
|
| 54 |
+
44 models can still circumvent the stochasticity and end up consistently constructing certain PPPs. This
|
| 55 |
+
45 observation suggests that a model likely constructs PPPs purposely to facilitate its training, rather
|
| 56 |
+
46 than falsely or accidentally learning some filters that respond to padding features.
|
| 57 |
+
47 With reliable PPP metrics, we conduct a series of experiments to analyze the characteristics of PPP in
|
| 58 |
+
48 Section 4.1. Specifically, we monitor the formation of PPP throughout each model training process in
|
| 59 |
+
49 Section 4.3. The results show PPPs are formed expeditiously at the early stage of model training,
|
| 60 |
+
50 slowly but steadily strengthened through time, and eventually shaped in clear and complete patterns.
|
| 61 |
+
51 These results show that a model intentionally develops and reinforces PPPs to facilitate its learning
|
| 62 |
+
52 process. Moreover, we observe the PPPs of all pretrained networks are significantly stronger than
|
| 63 |
+
53 those in their initial states. This indicates an unbiased training procedure is of great importance in
|
| 64 |
+
54 resolving the critical failures caused by PPP in numerous vision tasks [6, 7, 10, 11].
|
| 65 |
+
|
| 66 |
+
# 2 Observations and Methodology
|
| 67 |
+
|
| 68 |
+
In this section, we first define symbols for expressing the functionality of paddings and define the optimal-padding scheme. We then give a formal definition of Position-information Pattern from
|
| 69 |
+
|
| 70 |
+

|
| 71 |
+
Figure 2: Principal point shift. (a) The stride-2 Conv2d only pads on one side, causing the principal point shift (red squares) in earlier layers. (b) Such a shift requires careful margin correction while aligning algorithmically-padded and optimally-padded features (we describe the details of point shift in Appendix A). (c) The shift is visible in the feature space (spade-shaped and question-mark-shaped patterns in the marked box). (d) It is crucial to correct the principal point shift while measuring PPP. The PPP calculation involves pixel-wise distance functions, which are not robust to spatial shifts [15].
|
| 72 |
+
|
| 73 |
+
58 Padding (PPP) and utilize the optimal-padding scheme to develop propose a method to capture PPP
|
| 74 |
+
59 and measure its response with two metrics.
|
| 75 |
+
|
| 76 |
+
# 2.1 Optimal Padding
|
| 77 |
+
|
| 78 |
+
61 The process of capturing an image from the real world can be simplified as the 3D information of
|
| 79 |
+
62 the environment is first projected onto an infinitely large 2D plane, and then the camera determines
|
| 80 |
+
63 resolution as well as field-of-view to form an image from such infinitely large and continuous 2D
|
| 81 |
+
64 65 signals [16, 17]. Letand the collection o $S ^ { * } = \{ s _ { n } ^ { * } \} _ { n = 1 } ^ { N }$ be a collection of such infinitely largptured by cameras at a spatial size $( h _ { n } , w _ { n } )$ tinbe $S ^ { \prime } = \{ s _ { n } ^ { \prime } \} _ { n = 1 } ^ { N }$
|
| 82 |
+
66 A padding scheme produces a set of algorithmically-padded images $\hat { S } = \{ \hat { s } _ { n } \} _ { n = 1 } ^ { N }$ by a padding
|
| 83 |
+
67 function $\rho$ :
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
\hat { s } _ { n } [ i , j ] = \left\{ { \begin{array} { l l } { s _ { n } ^ { \prime } [ i , j ] = s ^ { * } [ i , j ] } & { { \mathrm { i f ~ } } 0 < i < h _ { n } { \mathrm { ~ a n d ~ } } 0 < j < w _ { n } , } \\ { \rho ( s _ { n } ^ { \prime } , i , j ) } & { { \mathrm { o t h e r w i s e } } , } \end{array} } \right.
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
68 where $i$ and $j$ are index of a pixel in the spatial dimension. We define a theoretical optimally-padded collection 69 ${ \cal { S } } ^ { \dagger } = \{ s _ { n } ^ { \dagger } \} _ { n = 1 } ^ { N }$ with an optimal-padding function $\rho ^ { \dagger }$ by:
|
| 90 |
+
|
| 91 |
+
$$
|
| 92 |
+
\begin{array} { r } { s _ { n } ^ { \dagger } [ i , j ] = \left\{ { s _ { n } ^ { \prime } [ i , j ] } \atop { \rho ^ { \dagger } ( s _ { n } ^ { \prime } , i , j ) } \right. \ } & { = s ^ { * } [ i , j ] \quad \mathrm { i f ~ } 0 < i < h _ { n } \mathrm { ~ a n d ~ } 0 < j < w _ { n } , } \\ { s ^ { \dagger } _ { n } [ i , j ] = \left\{ { s _ { n } ^ { \prime } [ i , j ] } \atop { \rho ^ { \dagger } ( s _ { n } ^ { \prime } , i , j ) } \right. \ } & { = s ^ { * } [ i , j ] \quad \mathrm { o t h e r w i s e } . } \end{array}
|
| 93 |
+
$$
|
| 94 |
+
|
| 95 |
+
70 In practice, such an optimal-padding scheme is difficult to achieve. However, it can be simulated if we have access to images beyond the sizes 71 $( h _ { n } , w _ { n } )$ and artificially create $S ^ { \prime }$ .
|
| 96 |
+
|
| 97 |
+
# 2.2 Positional-information Pattern from Padding
|
| 98 |
+
|
| 99 |
+
73 As PPP has not been well defined in the literature, there is no effective metric to detect or quantify it.
|
| 100 |
+
74 Ideally, PPP should have two properties. First, it is a spatial pattern as the padding pixels at different
|
| 101 |
+
75 locations contribute differently to the formation of PPP. Its shape enables the network to develop and
|
| 102 |
+
76 exploit the absolute positional information of each pixel, eventually leading to the unattended and
|
| 103 |
+
77 undesirable effects in certain tasks [5, 6, 7, 8, 9, 10, 11].
|
| 104 |
+
78 Second, as it represents the positional information purely contributed by the padding, it is a constant
|
| 105 |
+
79 term irrelevant to the image contents. Unfortunately, PPP shares space with image features, and
|
| 106 |
+
80 these two spaces interfere with each other, causing the appearance of PPP extremely obscure in most
|
| 107 |
+
81 cases (except zeros padding). Figure 1 shows if we visualize features sample-by-sample, there are
|
| 108 |
+
82 no obvious differences between optimally-padded features (gray-scale surface) and algorithmically
|
| 109 |
+
83 padded features (colored surface). Fortunately, if we assume the interferences between PPP and
|
| 110 |
+
84 image features to be random, then its expectation over a large set of images will saturate to a constant
|
| 111 |
+
85 bias and no longer hinder us from capturing PPP.
|
| 112 |
+
86 Based on these observations, we define PPP as the constant component independent of model inputs,
|
| 113 |
+
87 and its presence is completely contributed by the existence of a padding scheme $\rho$ . Given $\hat { S }$ and a
|
| 114 |
+
88 model $F ( \hat { s } ; \theta , \rho )$ , which $\theta$ is the model parameters and $\rho$ is a padding scheme applied to $F$ . Let the
|
| 115 |
+
89 model feature extracted at $k$ -th layer be $f _ { n , k } = F _ { k } ( \hat { s } _ { n } ; \theta , \rho )$ , where $F _ { k }$ is the model from the first
|
| 116 |
+
90 layer to the $k$ -th layer. The PPP at $k$ -th layer $( P P P _ { k } )$ can be formulated by:
|
| 117 |
+
|
| 118 |
+
$$
|
| 119 |
+
\begin{array} { r } { \mathsf { P P P } _ { k } \ = \ \underset { n } { \mathbb { E } } \left[ \textit { d } \big ( \begin{array} { l } { F _ { k } ( s _ { n } ^ { \dagger } ; \theta , \rho ^ { \dagger } ) , F _ { k } ( \hat { s } _ { n } ; \theta , \rho ) } \end{array} \big ) \ \right] \ , } \end{array}
|
| 120 |
+
$$
|
| 121 |
+
|
| 122 |
+
91 where $d ( \cdot , \cdot )$ can be any distance function, and we use $\ell _ { 1 }$ distance in this work.
|
| 123 |
+
|
| 124 |
+
Pitfalls: feature misalignment. It is important to note that, some CNN components can cause serious feature misalignment while computing PPP and leads to erroneous results. A typical example is principal point shift, where the uneven padding in stride-2 convolution causes the centers of features slightly drifted, as shown in Figure 2. Since the measurement of PPP requires perfect alignment, such a drift should be carefully considered while integrating PPP into new architectures. We further discuss the issue along with other pitfalls in Appendix A and provide three detailed examples of correcting the principal point shifting.
|
| 125 |
+
|
| 126 |
+
# 2.3 Metrics
|
| 127 |
+
|
| 128 |
+
In order to measure the strength of PPP, a proper baseline signal is needed. As discussed above, a strong PPP should be distinguishable from the interferences of the model features, so that the model can successfully extract the positional information from PPP. Thus, if we consider the model features as a background noise signal and PPP as the signal of interest, we can measure the significance of PPP using the signal-to-noise ratio (SNR). We define the SNR for PPP at $k$ -th layer as:
|
| 129 |
+
|
| 130 |
+
$$
|
| 131 |
+
\begin{array} { r } { \mathrm { S N R } \mathrm { - P P P } _ { k } \ = \ \mu \left( \underset { n } { \mathbb { E } } \left[ \begin{array} { l } { | } \end{array} \middle | F _ { k } \big ( s _ { n } ^ { \dagger } ; \theta , \rho ^ { \dagger } \big ) \ - \ F _ { k } \big ( \hat { s } _ { n } ; \theta , \rho \big ) \ B _ { 1 } \ \right] \ \right) \ / \ \sigma \big ( \ F _ { k } \big ( \hat { s } _ { n } ; \theta , \rho \big ) \ \big ) , } \end{array}
|
| 132 |
+
$$
|
| 133 |
+
|
| 134 |
+
where $\mu$ and $\sigma$ are the mean and standard deviation on the spatial dimensions.
|
| 135 |
+
|
| 136 |
+
106 However, SNR only measures the significance of the signal versus the noise but ignores the location
|
| 137 |
+
107 of the signal. Given PPP is a spatially varying pattern, we further include Mean Absolute Error
|
| 138 |
+
108 (MAE) to measure PPP versus the average of the noise map with:
|
| 139 |
+
|
| 140 |
+
$$
|
| 141 |
+
\begin{array} { r } { \mathbf { M A E - P P P } _ { k } \ = \ \underset { n } { \mathbb { E } } \left[ \ \mathbf { M A E } \left( \ F _ { k } ( s _ { n } ^ { \dagger } ; \theta , \rho ^ { \dagger } ) \ , \ F _ { k } ( \hat { s } _ { n } ; \theta , \rho ) \ \right) \ \right] \ . } \end{array}
|
| 142 |
+
$$
|
| 143 |
+
|
| 144 |
+
# 2.4 Randn Padding
|
| 145 |
+
|
| 146 |
+
10 Most of the existing padding schemes (e.g., zeros, reflect, replicate, circular) exhibit certain consistent
|
| 147 |
+
11 patterns that can be easily detected by some designed convolutional kernels. One may argue that the
|
| 148 |
+
12 nature of easy detectability can be a root cause of encouraging the models to learn to rely on these
|
| 149 |
+
113 obvious patterns. This motivates us to design an additional sampling-based padding scheme without
|
| 150 |
+
114 any consistent patterns, namely randn (i.e., random normal) padding, which produces dynamical
|
| 151 |
+
15 values from a normal distribution while following the local statistics. We first determine the maximal
|
| 152 |
+
116 and minimal values of a sliding window (which can be easily achieved with max-pooling), use the
|
| 153 |
+
17 average of them as a proxy mean $\mu _ { p }$ , and use the difference between the mean and the maximal
|
| 154 |
+
118 value as a proxy standard deviation $\sigma _ { p }$ . For each padding location, we sample the padding value
|
| 155 |
+
119 according to a normal distribution $\mathcal { N } ( \mu _ { p } , \sigma _ { p } ^ { 2 } )$ from the nearest sliding window. We include more
|
| 156 |
+
120 implementation details in Appendix A.
|
| 157 |
+
121 Aside from creating a pattern-less padding scheme with sampling, the design of randn padding is
|
| 158 |
+
122 based on several factors. The sampled padding pixels are allowed to occasionally exceed the min/max
|
| 159 |
+
123 bound of the sliding window. Without breaking the min/max bound can introduce detectable patterns
|
| 160 |
+
124 in certain extreme cases, such as a gradient-like feature that has its maximal intensity at the top-left
|
| 161 |
+
125 corner and minimal intensity at the bottom-right corner. We also design the padding scheme to
|
| 162 |
+
126 follow the local distribution. The padding exhibits a high entropy when the local variation is high,
|
| 163 |
+
127 while degenerates to value repetition with imperceptible perturbations while padding a flat area. As
|
| 164 |
+
|
| 165 |
+
such, not only do the padding pixels exhibit less pattern, but it also prevents the padding pixels from breaking the features in the border region. We later show that a model still deliberately and incredibly built up PPP over time even with such a sophisticated padding scheme.
|
| 166 |
+
|
| 167 |
+
# 3 Revisiting Prior Work
|
| 168 |
+
|
| 169 |
+
In this section, we first reproduce two experiments from the prior art, which aim to assess positional information from paddings. We show several critical design issues in these experiments and discuss how these problems affect the drawn conclusions. Finally, we propose two additional experiments to quantify the amount of positional information embedded in the paddings.
|
| 170 |
+
|
| 171 |
+
# 3.1 PosENet
|
| 172 |
+
|
| 173 |
+
Islam et al. show zeros-padding provides CNN models positional information cues, and propose PosENet [1] to quantify the amount of positional information encoded within CNN features. A PosENet experiment involves several components: a pretrained CNN model $F$ , a shallow CNN $E _ { p e m }$ (i.e., position encoding module), an image dataset $X = \{ x _ { i } \} _ { i = 1 } ^ { N }$ to examine, and a constant target pattern $y$ (e.g., 2D Gaussian pattern). PosENet first extracts intermediate features at $k$ - th layer with $f _ { ( i , k ) } = F _ { k } ( x _ { i } )$ using the pretrained CNN, and then optimizes $E _ { p e m }$ to minimize $\mathbb { E } _ { i , k } \big [ | | E _ { p e m } ( f _ { ( i , k ) } ) - y | | _ { 2 } \big ]$ . Finally, the amount of positional information is quantified by the average Spearman’s correlation (SPC) and Mean Absolute Error (MAE) overall $E _ { p e m } ( f _ { ( i , k ) } )$ toward $y$ .
|
| 174 |
+
|
| 175 |
+
145 A critical issue with PosENet is the use of an optimization-based metric. It is sensitive to hyper
|
| 176 |
+
146 parameters with large variation. As shown in Table 2, for all the PosENet results, the standard
|
| 177 |
+
147 deviation over five trials significantly dominates the differences between different types of paddings,
|
| 178 |
+
148 and thus no definitive conclusions can be drawn. We also observed that PosENet can report NaN
|
| 179 |
+
149 results in certain setups. Furthermore, PosENet quantifies the amount of positional information by
|
| 180 |
+
150 the faithfulness of the final reconstruction. However, a better reconstruction does not have a clear
|
| 181 |
+
151 relationship to measuring the strength and significance of positional information. For instance, the
|
| 182 |
+
152 VGG architecture with zeros-padding in Table 2, PosENet cannot recognize the positional information
|
| 183 |
+
153 has been strengthened after training, which can be seen in Figure 4. PosENet falsely assigns a much
|
| 184 |
+
154 lower SPC to the fully pretrained model. Moreover, for the no-padding entries in Table 2, PosENet
|
| 185 |
+
155 can still sometimes show responses to no-padding models, demonstrating it is a metric with an
|
| 186 |
+
156 indefinite bias pending on the memorization ability of $E _ { p e m }$ .
|
| 187 |
+
|
| 188 |
+
Another issue is that the no-padding scheme used in $E _ { p e m }$ is known to have the foveal effect [13, 14], where a model pays less attention to the information on the edge of inputs. Using such a padding scheme for detecting positional information from paddings, which is mostly concentrated on the edge of the feature maps, is less effective. This is an inevitable dilemma as PosENet aims to identify positional information from the padding of the pretrained $F$ , while applying any padding scheme to $E _ { p e m }$ introduces intractable effects between the paddings of the two models.
|
| 189 |
+
|
| 190 |
+
# 3.2 F-Conv
|
| 191 |
+
|
| 192 |
+
64 Kayhan et al. propose a full-padding scheme (F-Conv) [3] and demonstrate it is more translational
|
| 193 |
+
65 invariant than the alternatives. One of the critical results is on “border handling variants” (Exp 2
|
| 194 |
+
66 of [3]), which we call it BHV test. The BHV test creates a toy dataset, where each image has a black
|
| 195 |
+
67 background with a green square and a red square in the foreground. The task is to predict if the red
|
| 196 |
+
68 square is on the left of the green square (class 1), or vice versa (class 2). In addition, Kayhan et al.
|
| 197 |
+
69 intentionally adds a location bias such that both squares are located in the upper half of the image for
|
| 198 |
+
70 class 1, and located in the lower half of the image for class 2. During testing, a “similar test” inherits
|
| 199 |
+
71 the same bias, while a “dissimilar test” exchanges the bias (i.e., both squares are in the lower half
|
| 200 |
+
72 of the image for class 1). As a truly translation-invariant CNN model should not be affected by the
|
| 201 |
+
73 location bias, it should focus on the relation between the red and green squares and perform similarly
|
| 202 |
+
74 on both tests. Since the experimental results show that F-Conv performs best on the dissimilar test, it
|
| 203 |
+
75 is concluded that F-Conv is less sensitive to the location bias. The authors also conclude the circular
|
| 204 |
+
76 padding performs worse due to the behavior of wrapping the pixels to the other side of the image,
|
| 205 |
+
77 which leads to confusion between two classes.
|
| 206 |
+
178 However, as shown in Figure 3, we find the experimental design
|
| 207 |
+
179 does not consider a crucial confounding variable: the black back
|
| 208 |
+
180 ground has a zero intensity, making zeros padding the optimal
|
| 209 |
+
181 padding that perfectly follows the background distribution. In Ta
|
| 210 |
+
182 ble 1, we show that the dissimilar test is no longer in favor of
|
| 211 |
+
183 F-Conv zeros after changing the background color to grey. We also
|
| 212 |
+
184 show that F-Conv replicate and F-Conv circular perform best on
|
| 213 |
+
185 the dissimilar test, which is different from the original observation.
|
| 214 |
+
|
| 215 |
+
Table 1: Background color as a critical confounding variable in BHV test. We show that using a grey background similar to Figure 3 leads to discrepant results. The standard deviations are reported among 10 individual trials. We mark the best performance in green, and the worst two in red.
|
| 216 |
+
|
| 217 |
+
<table><tr><td rowspan="2">Padding</td><td rowspan="2">F-Conv?</td><td colspan="4">Black Background</td><td colspan="4">Grey Background</td></tr><tr><td>Similar (%)</td><td>Dissimilar (%)</td><td>Diff (%)</td><td>Inconsistency (%)</td><td>Similar (%)</td><td>Dissimilar (%)</td><td>Diff (%)</td><td>Inconsistency (%)</td></tr><tr><td rowspan="2">Zeros</td><td>N</td><td>99.83±0.00</td><td>3.21± 8.35</td><td>-87.68</td><td>95.81± 2.07</td><td>100.00± 0.00</td><td>4.96± 5.93</td><td>-95.04</td><td>97.85± 4.55</td></tr><tr><td>Y</td><td>89.24±0.98</td><td>89.24±0.98</td><td>0.00</td><td>18.02± 8.08</td><td>100.00±0.00</td><td>4.77± 6.52</td><td>95.23</td><td>96.79±7.13</td></tr><tr><td rowspan="2">Circular</td><td>N</td><td>80.31±3.23</td><td>80.31± 3.23</td><td>0.00</td><td>34.25± 8.32</td><td>72.75± 0.96</td><td>72.75± 0.96</td><td>0.00</td><td>26.30± 5.55</td></tr><tr><td>Y</td><td>99.20±0.23</td><td>93.14± 2.88</td><td>-6.06</td><td>18.48±3.55</td><td>98.26± 0.50</td><td>92.40±4.23</td><td>-5.87</td><td>28.67± 6.18</td></tr><tr><td rowspan="2">Reflect</td><td>N</td><td>100.00±0.00</td><td>15.67±12.72</td><td>-84.33</td><td>91.18±13.19</td><td>100.00±0.00</td><td>19.96±13.54</td><td>-80.04</td><td>90.33±11.95</td></tr><tr><td>Y</td><td>100.00±0.00</td><td>11.70±15.38</td><td>-88.30</td><td>97.33± 6.16</td><td>100.00±0.00</td><td>17.16±12.19</td><td>-82.84</td><td>98.13± 3.44</td></tr><tr><td rowspan="2">Replicate</td><td>N</td><td>100.00±0.00</td><td>43.39±11.42</td><td>-56.61</td><td>75.32± 8.20</td><td>100.00± 0.00</td><td>33.16± 6.42</td><td>-66.83</td><td>84.09± 6.47</td></tr><tr><td>Y</td><td>98.32±0.39</td><td>93.65± 1.36</td><td>-4.67</td><td>32.60± 4.97</td><td>97.17± 0.48</td><td>94.99± 1.20</td><td>-2.18</td><td>32.15± 5.11</td></tr><tr><td rowspan="2">Randn</td><td>N</td><td>100.00±0.00</td><td>10.31±12.56</td><td>-89.70</td><td>94.88± 5.55</td><td>99.97± 0.13</td><td>35.47±10.82</td><td>-64.50</td><td>83.59± 8.48</td></tr><tr><td>Y</td><td>100.00±0.00</td><td>20.80±14.15</td><td>-79.20</td><td>92.54±8.37</td><td>77.28±16.13</td><td>66.70±11.58</td><td>-10.59</td><td>45.70±20.62</td></tr><tr><td>No-pad</td><td>-</td><td>100.00±0.00</td><td>3.21± 8.35</td><td>-96.79</td><td>95.81± 2.07</td><td>100.00± 0.00</td><td>30.07± 4.06</td><td>-69.93</td><td>81.30± 2.44</td></tr></table>
|
| 218 |
+
|
| 219 |
+
Finally, we report an additional inconsistency rate to show that the CNN architecture used in the BHV test actually has access to the absolute position of the squares. Given a random sample in class 1, we create a trajectory of samples by simultaneously moving the two squares to the bottom of the canvas and recording the CNNmodel prediction in all intermediate states. We label a trajectory to be inconsistent if the prediction of the CNN-model switches classes at any step of the trajectory. A CNN model with no access to the absolute-position information should have all trajectories maintaining consistent predictions, with $0 \%$ inconsistency. Table 1 shows the inconsistent ratio over 228 uniformly sampled trajectories, where all models maintain high inconsistency rates, even with a no-padding architecture. These results show that the CNN model used in the BHV test is not translation invariant. This can be attributed to that a CNN model has a large receptive field covering the whole experiment canvas, therefore capable of gradually constructing absolute coordinates for each input pixel. Note that we only show the design of the BHV test is not suitable for quantifying the amount of positional information exhibited in a CNN model. Such a conclusion does not imply that F-Conv cannot potentially improve the translation-invariant property of CNNs.
|
| 220 |
+
|
| 221 |
+

|
| 222 |
+
Figure 3: The BHV test trains a binary classifier to predict the relative position of the two colored squares. It hypothesizes if the padding provides no positional information, the classifier will only focus on the relative position of the two squares. (Left) The black background is a confounding variable. (Right) Zeros padding no-longer pads optimum values after changing the background color.
|
| 223 |
+
|
| 224 |
+
# 4 Experiments and Analysis
|
| 225 |
+
|
| 226 |
+
Datasets Since most vision models are trained on tasks for recognizing objects, an image collection containing a diverse object appearance is more suitable for the task. We collect a set of 480 satellite images at $2 , 0 4 8 \times 2 , 0 4 8$ pixels from Google Map for experiments. All the PPP metrics are measured with this image collection. We crop such images depending on the requested input image sizes and principal point shifts from each model (see Appendix A for details). We will release the script for collecting and composing these large images.
|
| 227 |
+
|
| 228 |
+
# 4.1 Visualizing Position-information Pattern from Padding (PPP)
|
| 229 |
+
|
| 230 |
+
212 We start with visualizing PPP in Figure 4. All the visualizations are conducted at the 4th layer of
|
| 231 |
+
213 interest as detailed in Appendix A. We compute PPP using Eq. 3 and $\ell _ { 1 }$ norm as the distance metric,
|
| 232 |
+
214 then average the resulting PPP in the channel dimension to generate a gray-scale image. Since the
|
| 233 |
+
215 quantities are small and difficult to perceive, we normalize the gray-scale image to [0, 1] range, and
|
| 234 |
+
216 thus the colors between images are not directly comparable.
|
| 235 |
+
217 In all scenarios, a noticeable difference is that PPP spreads out after pretraining on ImageNet.
|
| 236 |
+
218 In Table 2, the PPP-SNR of the VGG19 and ResNet50 also reflects that the response of PPP is
|
| 237 |
+
219 significantly strengthened after model training. That is, the model training has substantial effects on
|
| 238 |
+
220 the construction of PPP. Although the formation of padding pattern is suggested to mainly caused by
|
| 239 |
+
21 the distributional difference between features and paddings [6], our results show that it only increases
|
| 240 |
+
22 the response slightly, compared to the considerable PPP-SNR gain through training.
|
| 241 |
+
|
| 242 |
+
Table 2: Comparing PosENet and our proposed PPP metrics. The standard deviation is computed by five different pretrained models for each test. The performance shows the accuracy for the classification task or weighted F-measure score [18] for the saliency object detection task. Note that we use 2D Gaussian as PosENet reconstruction pattern, and the PPP metrics are measured at the 4th layer of interest. Here, $( ^ { * } )$ indicates a NaN is reported in any of the trials, and (↑) indicates a higher value corresponds to stronger positional information or better performance on the task (vice versa for (↓)). For each group of pretrained models, we label the strongest and weakest positional information response with red and blue.
|
| 243 |
+
|
| 244 |
+
<table><tr><td rowspan="2">Model</td><td rowspan="2">Padding</td><td rowspan="2">Pretrained</td><td colspan="2">PosENet</td><td colspan="2">PPP (ours)</td><td rowspan="2">Performance (个)</td></tr><tr><td>SPC (1)</td><td>MAE (↓)</td><td>SNR-PPP (↑)</td><td>MAE-PPP (↑)</td></tr><tr><td rowspan="10">VGG-19</td><td rowspan="2">Zeros</td><td rowspan="2">× ImageNet</td><td>0.518±0.121</td><td>0.184±0.004</td><td>0.0665±0.0024</td><td>0.0132±0.0006</td><td rowspan="2">74.0972±0.0870</td></tr><tr><td>0.142±0.139</td><td>0.194±0.006</td><td>1.2289±0.0613</td><td>0.0176±0.0005</td></tr><tr><td rowspan="2">Circular</td><td rowspan="2">× ImageNet</td><td>0.001±0.092</td><td>0.197±0.002</td><td>0.0000±0.0000</td><td>0.0000±0.0000</td><td rowspan="2">74.4716±0.0863</td></tr><tr><td>0.102±0.136</td><td>0.197±0.007</td><td>1.1488±0.0589</td><td>0.0158±0.0006</td></tr><tr><td rowspan="2">Reflect</td><td rowspan="2">× ImageNet</td><td></td><td>0.197±0.002</td><td>0.0000±0.0000</td><td>0.0000±0.0000</td><td rowspan="2"></td></tr><tr><td>0.001±0.091 0.116±0.134</td><td>0.195±0.006</td><td></td><td>0.0158±0.0002</td></tr><tr><td rowspan="2">Replicate</td><td rowspan="2">×</td><td></td><td></td><td>1.2022±0.0226</td><td></td><td rowspan="2">74.0516±0.0621</td></tr><tr><td>0.001±0.091</td><td>0.197±0.002</td><td>0.0000±0.0000</td><td>0.0000±0.0000</td></tr><tr><td rowspan="2">Randn</td><td rowspan="2">ImageNet ×</td><td>0.116±0.132</td><td>0.195±0.006</td><td>1.2494±0.0258</td><td>0.0144±0.0009</td><td rowspan="2">73.9964±0.1079</td></tr><tr><td>0.001±0.093 0.115±0.146</td><td>0.197±0.002 0.195±0.006</td><td>0.0000±0.0000</td><td>0.0000±0.0000</td></tr><tr><td rowspan="2">No-padding</td><td rowspan="2">ImageNet ×</td><td></td><td></td><td>1.2366±0.0774</td><td>0.0182±0.0012</td><td rowspan="2">73.7716±0.0758</td></tr><tr><td>0.000±0.091</td><td>0.197±0.002</td><td>0.0000±0.0000</td><td>0.0000±0.0000</td></tr><tr><td rowspan="9"></td><td rowspan="2">Zeros</td><td>ImageNet ×</td><td>0.001±0.220</td><td>0.203±0.012</td><td>0.0000±0.0000</td><td>0.0000±0.0000</td><td rowspan="2">62.0396±0.0830</td></tr><tr><td>DUTS</td><td>0.682±0.099 0.343±0.151</td><td>0.171±0.008</td><td>0.0306±0.0020</td><td>0.0068±0.0007</td></tr><tr><td rowspan="2">Circular</td><td></td><td></td><td>0.186±0.011</td><td>0.2429±0.0035</td><td>0.0049±0.0001</td><td rowspan="2">0.6269±0.0015</td></tr><tr><td>× DUTS</td><td>0.001±0.081 0.158±0.188</td><td>0.197±0.002 0.196±0.013</td><td>0.0000±0.0000 0.2677±0.0062</td><td>0.0000±0.0000 0.0062±0.0001</td></tr><tr><td rowspan="2">Reflect</td><td>X</td><td>-0.002±0.080</td><td>0.197±0.002</td><td></td><td></td><td rowspan="2">0.6260±0.0009</td></tr><tr><td>DUTS</td><td>0.160±0.223</td><td>0.195±0.014</td><td>0.0000±0.0000 0.1972±0.0024</td><td>0.0000±0.0000 0.0053±0.0001</td></tr><tr><td rowspan="2">Replicate</td><td>×</td><td>-0.002±0.087</td><td>0.197±0.002</td><td></td><td></td><td rowspan="2">0.6243±0.0022</td></tr><tr><td>DUTS</td><td>0.075±0.174</td><td>0.201±0.010</td><td>0.0000±0.0000 0.1908±0.0056</td><td>0.0000±0.0000 0.0043±0.0002</td></tr><tr><td rowspan="2">Randn</td><td>×</td><td>0.000±0.082</td><td></td><td></td><td></td><td rowspan="2">0.6255±0.0013</td></tr><tr><td>DUTS</td><td>0.004±0.106</td><td>0.197±0.002 0.196±0.001</td><td>0.0000±0.0000 0.0005±0.0001</td><td>0.0000±0.0000 0.0001±0.0000</td></tr><tr><td rowspan="8"></td><td rowspan="2">No-padding</td><td>×</td><td></td><td></td><td></td><td></td><td rowspan="2">0.2570±0.0022</td></tr><tr><td>DUTS</td><td>0.000±0.087 0.003±0.252</td><td>0.197±0.002</td><td>0.0000±0.0000</td><td>0.0000±0.0000 0.0000±0.0000</td></tr><tr><td rowspan="2">Zeros</td><td>×</td><td>0.096±0.118</td><td>0.200±0.010</td><td>0.0000±0.0000</td><td></td><td rowspan="2">0.4759±0.0013</td></tr><tr><td>ImageNet</td><td>0.329±0.201</td><td>0.196±0.003 0.185±0.011</td><td>0.0918±0.0119 0.8171±0.0173</td><td>0.0052±0.0004 0.0162±0.0012</td></tr><tr><td rowspan="2">Circular</td><td>×</td><td>*0.027±0.093</td><td>*0.197±0.003</td><td>0.0454±0.0041</td><td>0.0032±0.0004</td><td rowspan="2">75.6856±0.0924</td></tr><tr><td>ImageNet</td><td>0.184±0.201</td><td>0.192±0.010</td><td>0.7018±0.0320</td><td>0.0188±0.0016</td></tr><tr><td rowspan="2">Reflect</td><td>×</td><td>*0.004±0.094</td><td>*0.198±0.003</td><td>0.0291±0.0017</td><td>0.0018±0.0001</td><td rowspan="2">76.1432±0.1026 75.5068±0.1213</td></tr><tr><td>ImageNet ×</td><td>0.293±0.181</td><td>0.187±0.009</td><td>0.6960±0.0221</td><td>0.0150±0.0004</td></tr><tr><td rowspan="2">Randn</td><td>Replicate ImageNet</td><td>*0.002±0.094</td><td>*0.198±0.003</td><td>0.0226±0.0013</td><td>0.0015±0.0001</td><td></td><td rowspan="2">75.6122±0.0911</td></tr><tr><td>×</td><td>0.347±0.205 *0.006±0.090</td><td>0.184±0.012</td><td>0.7461±0.0254</td><td>0.0138±0.0003</td><td></td></tr><tr><td rowspan="2"></td><td rowspan="2"></td><td>ImageNet</td><td>0.358±0.240</td><td>*0.198±0.003 0.181±0.016</td><td>0.0326±0.0016 0.6648±0.0204</td><td>0.0020±0.0002 0.0147±0.0007</td><td rowspan="2">75.3076±0.1016</td></tr><tr><td>×</td><td>0.360±0.327</td><td>0.180±0.026</td><td>0.5074±0.0260</td><td>0.0398±0.0027</td></tr><tr><td rowspan="9">EfficientNet</td><td rowspan="2">Circular</td><td>ImageNet</td><td>0.667±0.111</td><td>0.166±0.014</td><td>0.7590±0.0208</td><td>0.0471±0.0022</td><td rowspan="2">61.8652±0.1380</td></tr><tr><td>×</td><td>0.004±0.192</td><td>0.205±0.013</td><td>0.3008±0.0883</td><td>0.0222±0.0048</td></tr><tr><td rowspan="2"></td><td>ImageNet</td><td>0.020±0.123</td><td>0.203±0.009</td><td>0.4326±0.0251</td><td>0.0256±0.0017</td><td rowspan="2">61.2208±0.2128</td></tr><tr><td>×</td><td></td><td></td><td></td><td></td></tr><tr><td rowspan="2">Reflect</td><td>ImageNet</td><td>0.003±0.175 0.062±0.116</td><td>0.205±0.012 0.201±0.008</td><td>0.2245±0.0639 0.4667±0.0232</td><td>0.0183±0.0053 0.0268±0.0014</td><td rowspan="2">60.4164±0.2924</td></table>
|
| 245 |
+
|
| 246 |
+

|
| 247 |
+
Figure 4: Visualization of Position-Information Pattern from Padding (PPP). The visualizations are calculated based on Eq. 3 over 480 GMap samples extracted at the 3rd layer-of-interest (Appendix A). The results show that the pretrained model significantly reinforces PPP compared to randomly initialized networks. Note that each image is normalized to [0, 1] separately, therefore the colors between images are not comparable. More visualizations are presented in Appendix B.
|
| 248 |
+
|
| 249 |
+

|
| 250 |
+
Figure 5: Chronological PPP. We quantify PPP every 10 epochs and plot its development in four different layer of depth (the rightmost layer is the one closest to model output). All curves consistently show a sudden surge at the early stage, and all the later layers are slowly but steadily gaining stronger PPP until the end of training. The shadow region represents standard deviations among 5 individual training episodes. The colors represent zeros, circular, reflect, replicate, and randn paddings.
|
| 251 |
+
|
| 252 |
+
Another intriguing observation is that, despite some variations in the detailed patterns, the overall structure of PPP remains similar. Regardless of padding minimum values with zero-padding (consider the features are processed with ReLU activation), randn-padding that can sometimes produce large quantities by chance, or the unbalanced initial state of ResNet50 caused by strided convolution (the first row of ResNet50 in Figure 4), all models tend to have the maximal PPP response in the corner of the features after fully trained. While the underlying mechanism causing such consistent preferences remains unknown, such preferences may be an important factor to consider in future model design.
|
| 253 |
+
|
| 254 |
+
# 4.2 Quantifying PPP and Comparing with PosENet
|
| 255 |
+
|
| 256 |
+
Table 2 shows the measurements of PPP and PosENet on various architectures and padding schemes. We train five models for each setup and measure the standard deviation of these models. Our PPP metrics have significantly lower standard deviations compared to PosENet, where the standard deviation dominates the differences between padding variants, and thus the quantities from PosENet cannot provide sufficient information for any analysis. The main reason that PosENet has such a large variation is due to its optimization-based formulation, and thus the final quantities highly depend on the convergence of the PosENet training. In fact, we also observe a similar level of standard deviation even when the PosENet is measured on the same model for multiple trials. On the other hand, PPP metrics are based on a closed-form formulation, and thus the variations are only introduced by the differences among the parameters of the pretrained models. Furthermore, PosENet frequently reports positive SPC responses from no-padding models, as shown in its large standard deviation. In contrast, PPP has zero response to no-padding models by definition, and therefore is less biased for measuring the positional information from padding.
|
| 257 |
+
|
| 258 |
+
SNR-PPP and MAE-PPP assess the response of PPP from two different perspectives, the ratio of the overall PPP magnitude to the image feature variation, and the position-aware average gain of PPP. Despite both measuring the PPP gain and mostly following similar trends, the two metrics can sometimes have discrepancies, such as the randn padding case in EfficientNet pretrained on ImageNet in Table 2. We note that the two metrics should be both measured and considered altogether.
|
| 259 |
+
|
| 260 |
+
Although certain paddings seem to have lower SNR-PPP or MAE-PPP on trained networks, we find the differences are not significant when comparing the extremely low SNR-PPP and MAE-PPP from the randomly initialized networks. In most cases, the network can effectively construct its PPP, even with the highly stochastic randn padding. The only exception seems to be the case of randn padding in the salient object detection (SOD) task, where the network fails to achieve a compatible performance to other paddings2. The results show that the model training plays an important role in the formation of PPP, and perhaps its contribution is much larger than which underlying padding scheme is being used. This motivates us to further analyze the PPP formulation during model training.
|
| 261 |
+
|
| 262 |
+
# 4.3 Chronological PPP
|
| 263 |
+
|
| 264 |
+
To understand the formulation of PPP through time, we snapshot checkpoints every 10 epochs for all training episodes. By measuring the PPP metrics at all the checkpoints, we plot a chronological curve and monitor the progress of PPP. We train 5 individual models for each pair of model-padding setup and report the standard deviations, which demonstrates the significance of the trend.
|
| 265 |
+
|
| 266 |
+
Figure 5 shows all models achieve a significant gain of PPP within the first 10 epochs in all intermediate layers. Most models continuously increase their PPP as training proceeds, especially in the fourth layer of interest, which is the last output from the convolutional layers before the final linear projection. Another interesting observation is that our randn padding, which is designed to be less easily detectable with built-in stochasticity, indeed shows less PPP built-up at the intermediate stages in certain layers. However, the network still adjusts the behavior and ends up forming complete PPPs at the fourth layer of interest in all scenarios. All these evidences show that the network builds PPP purposely as a favorable representation to assist its learning.
|
| 267 |
+
|
| 268 |
+
# 5 Conclusion and Limitations
|
| 269 |
+
|
| 270 |
+
In this paper, we develop a reliable method for measuring PPP and conduct a series of analyses toward understanding the formation and properties of PPP. Through a large-scale study, we demonstrate that PPP is a representation that the network favorably develops as a part of its learning process, and its formation has weak connections to the underlying padding algorithm. We show that reliable PPP metrics are important steps for understanding the effects of PPPs in different tasks, and useful for measuring the effectiveness of future methods in debiasing PPP.
|
| 271 |
+
|
| 272 |
+
However, an unfortunate and inevitable limitation of the PPP metrics is that their measure is biased by the model architecture and parameters. Since the PPP metrics are based on the distributional differences between the paired model outputs (i.e., optimal padding to algorithmic padding), different architecture and layers of depth exhibit different and intractable biases due to different interactions between PPP and model parameters. Such a bias makes PPP metrics less useful for evaluating models, and therefore cannot be used to study the effect of architectural changes. This limitation is inevitable for any (and all existing) metric that attempts to measure PPP using the outputs of a model. We note future studies in measuring PPP without model inferences3 will be an important step toward tackling and understanding the property of PPP under different architectural choices.
|
| 273 |
+
|
| 274 |
+
# References
|
| 275 |
+
|
| 276 |
+
[1] Md Amirul Islam\*, Sen Jia\*, and Neil D. B. Bruce. How much position information do convolutional neural networks encode? In International Conference on Learning Representations, 2020. 1, 2, 5
|
| 277 |
+
[2] Md Amirul Islam, Matthew Kowal, Sen Jia, Konstantinos G Derpanis, and Neil DB Bruce. Position, padding and predictions: A deeper look at position information in cnns. arXiv preprint arXiv:2101.12322, 2021. 1
|
| 278 |
+
[3] Osman Semih Kayhan and Jan C van Gemert. On translation invariance in cnns: Convolutional layers can exploit absolute spatial location. In IEEE Conference on Computer Vision and Pattern Recognition, 2020. 1, 5
|
| 279 |
+
[4] Carlo Innamorati, Tobias Ritschel, Tim Weyrich, and Niloy J Mitra. Learning on the edge: Investigating boundary filters in cnns. International Journal of Computer Vision, 2020. 1
|
| 280 |
+
[5] Chieh Hubert Lin, Yen-Chi Cheng, Hsin-Ying Lee, Sergey Tulyakov, and Ming-Hsuan Yang. InfinityGAN: Towards infinite-pixel image synthesis. In International Conference on Learning Representations, 2022. 1, 3
|
| 281 |
+
[6] Bilal Alsallakh, Narine Kokhlikyan, Vivek Miglani, Jun Yuan, and Orion Reblitz-Richardson. Mind the pad – {cnn}s can develop blind spots. In International Conference on Learning Representations, 2021. 1, 2, 3, 8
|
| 282 |
+
[7] Rui Xu, Xintao Wang, Kai Chen, Bolei Zhou, and Chen Change Loy. Positional encoding as spatial inductive bias in gans. In IEEE Conference on Computer Vision and Pattern Recognition, 2021. 1, 2, 3
|
| 283 |
+
[8] Evangelos Ntavelis, Mohamad Shahbazi, Iason Kastanis, Radu Timofte, Martin Danelljan, and Luc Van Gool. Arbitrary-scale image synthesis. In IEEE Conference on Computer Vision and Pattern Recognition, 2022. 1, 3
|
| 284 |
+
[9] Jooyoung Choi, Jungbeom Lee, Yonghyun Jeong, and Sungroh Yoon. Toward spatially unbiased generative models. In IEEE International Conference on Computer Vision, 2021. 1, 3
|
| 285 |
+
[10] Songwei Ge, Thomas Hayes, Harry Yang, Xi Yin, Guan Pang, David Jacobs, Jia-Bin Huang, and Devi Parikh. Long video generation with time-agnostic vqgan and time-sensitive transformer. arXiv preprint arXiv:2204.03638, 2022. 1, 2, 3
|
| 286 |
+
[11] Antonio Alguacil, Wagner Gonçalves Pinto, Michael Bauerheim, Marc C Jacob, and Stéphane Moreau. Effects of boundary conditions in fully convolutional networks for learning spatio-temporal dynamics. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, 2021. 1, 2, 3
|
| 287 |
+
[12] Md Amirul Islam, Matthew Kowal, Sen Jia, Konstantinos G. Derpanis, and Neil Bruce. Boundary effects in $\{ \mathrm { c n n } \} \mathrm { s }$ : Feature or bug? https://openreview.net/forum?id=M4qXqdw3xC, 2021. 1
|
| 288 |
+
[13] Bilal Alsallakh, Vivek Miglani, Narine Kokhlikyan, David Adkins, and Orion Reblitz-Richardson. Are convolutional networks inherently foveated? In SVRHM 2021 Workshop at NeurIPS, 2021. 1, 5
|
| 289 |
+
[14] Wenjie Luo, Yujia Li, Raquel Urtasun, and Richard Zemel. Understanding the effective receptive field in deep convolutional neural networks. In Neural Information Processing Systems, 2016. 1, 5
|
| 290 |
+
[15] Richard Zhang, Phillip Isola, Alexei A Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric. In IEEE Conference on Computer Vision and Pattern Recognition, 2018. 3
|
| 291 |
+
[16] Shichen Liu, Tianye Li, Weikai Chen, and Hao Li. Soft rasterizer: A differentiable renderer for image-based 3d reasoning. In IEEE International Conference on Computer Vision, 2019. 3
|
| 292 |
+
[17] Nikhila Ravi, Jeremy Reizenstein, David Novotny, Taylor Gordon, Wan-Yen Lo, Justin Johnson, and Georgia Gkioxari. Accelerating 3d deep learning with pytorch3d. arXiv preprint arXiv:2007.08501, 2020. 3
|
| 293 |
+
[18] Ran Margolin, Lihi Zelnik-Manor, and Ayellet Tal. How to evaluate foreground maps? In IEEE Conference on Computer Vision and Pattern Recognition, 2014. 7
|
| 294 |
+
[19] Nian Liu, Junwei Han, and Ming-Hsuan Yang. Picanet: Learning pixel-wise contextual attention for saliency detection. In IEEE Conference on Computer Vision and Pattern Recognition, 2018. 9
|
| 295 |
+
[20] Joe Mellor, Jack Turner, Amos Storkey, and Elliot J Crowley. Neural architecture search without training. In International Conference on Machine Learning, 2021. 9
|
| 296 |
+
|
| 297 |
+
# Checklist
|
| 298 |
+
|
| 299 |
+
1. For all authors...
|
| 300 |
+
|
| 301 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 302 |
+
(b) Did you describe the limitations of your work? [Yes]
|
| 303 |
+
(c) Did you discuss any potential negative societal impacts of your work? [No]
|
| 304 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 305 |
+
|
| 306 |
+
2. If you are including theoretical results...
|
| 307 |
+
|
| 308 |
+
(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]
|
| 309 |
+
|
| 310 |
+
3. If you ran experiments...
|
| 311 |
+
|
| 312 |
+
(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] All the codes for reproducing all results shown in the paper will be made publicly available.
|
| 313 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
|
| 314 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
|
| 315 |
+
(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] It is not a critical computational constraint to the experiments. In order to properly report the standard deviation, we use a total of 24 GPUs over 3 clusters to train 150 CNN models on ImageNet and DUTS datasets. These computations are completely for analyses. Running our PPP metrics only need 1GB of memory on any type of GPU, or even CPU.
|
| 316 |
+
|
| 317 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 318 |
+
|
| 319 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 320 |
+
(b) Did you mention the license of the assets? [No] The assets used in our codes are released under MIT or BSD-3, which have no restricted usage.
|
| 321 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [No]
|
| 322 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] We did not obtain personal data.
|
| 323 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] We did not use personal data.
|
| 324 |
+
|
| 325 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 326 |
+
|
| 327 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 328 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 329 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/MR7XubKUFB/MR7XubKUFB.md
ADDED
|
@@ -0,0 +1,445 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ADVERSARIAL RETRIEVER-RANKER FOR DENSE TEXT RETRIEVAL
|
| 2 |
+
|
| 3 |
+
Hang Zhang1∗, Yeyun Gong2†, Yelong Shen3, Jiancheng $\mathbf { L } \mathbf { v } ^ { 1 }$ , Nan Duan2, Weizhu Chen3
|
| 4 |
+
|
| 5 |
+
1College of Computer Science, Sichuan University,
|
| 6 |
+
2Microsoft Research Asia, 3Microsoft Azure AI
|
| 7 |
+
hangzhang scu@foxmail.com,{yegong,yelong.shen}@microsoft.com,
|
| 8 |
+
lvjiancheng@scu.edu.cn, {nanduan,wzchen}@microsoft.com
|
| 9 |
+
|
| 10 |
+
# ABSTRACT
|
| 11 |
+
|
| 12 |
+
Current dense text retrieval models face two typical challenges. First, they adopt a siamese dual-encoder architecture to encode queries and documents independently for fast indexing and searching, while neglecting the finer-grained termwise interactions. This results in a sub-optimal recall performance. Second, their model training highly relies on a negative sampling technique to build up the negative documents in their contrastive losses. To address these challenges, we present Adversarial Retriever-Ranker (AR2), which consists of a dual-encoder retriever plus a cross-encoder ranker. The two models are jointly optimized according to a minimax adversarial objective: the retriever learns to retrieve negative documents to cheat the ranker, while the ranker learns to rank a collection of candidates including both the ground-truth and the retrieved ones, as well as providing progressive direct feedback to the dual-encoder retriever. Through this adversarial game, the retriever gradually produces harder negative documents to train a better ranker, whereas the cross-encoder ranker provides progressive feedback to improve retriever. We evaluate AR2 on three benchmarks. Experimental results show that AR2 consistently and significantly outperforms existing dense retriever methods and achieves new state-of-the-art results on all of them. This includes the improvements on Natural Questions $\mathbf { R } @ 5$ to $7 7 . 9 \%$ $( + 2 . 1 \% )$ , TriviaQA $\mathbf { R } @ 5$ to $7 8 . { \bar { 2 } } \%$ $( + 1 . 4 \% )$ , and MS-MARCO MRR $@ 1 0$ to $3 9 . 5 \%$ $( + 1 . 3 \% )$ . Code and models are available at https://github.com/microsoft/AR2.
|
| 13 |
+
|
| 14 |
+
# 1 INTRODUCTION
|
| 15 |
+
|
| 16 |
+
Dense text retrieval (Lee et al., 2019; Karpukhin et al., 2020) has achieved great successes in a wide variety of both research and industrial areas, such as search engines (Brickley et al., 2019; Shen et al., 2014), recommendation system (Hu et al., 2020), open-domain question answering (Guo et al., 2018; Liu et al., 2020), etc. A typical dense retrieval model adopts a dual-encoder (Huang et al., 2013) architecture to encode queries and documents into low-dimensional embedding vectors, with the relevance between query and document being measured by the similarity between embeddings. In real-world dense text retrieval applications, it pre-computes all the embedding vectors of documents in the corpus, and leverages the approximate nearest neighbor (ANN) (Johnson et al., 2019) technique for efficiency. To train a dense retriever, contrastive loss with negative samples is widely applied in the literature (Xiong et al., 2021; Karpukhin et al., 2020). During training, the model utilizes a negative sampling method to obtain negative documents for a given querydocument pair, and then minimizes the contrastive loss which relies on both the positive document and the sampled negative ones (Shen et al., 2014; Chen et al., 2017; Radford et al., 2021).
|
| 17 |
+
|
| 18 |
+
Recent studies on contrastive learning (Xiong et al., 2021; Karpukhin et al., 2020) show that the iterative “hard-negative” sampling technique can significantly improve the performance compared with “random-negative” sampling approach, as it can pick more representative negative samples to … …learn a more discriminative retriever. In the work (Qu et al., 2021), it suggests leveraging crossquery documentencoder model to heuristically filter “hard-negative” samples to further improve performance and shows the importance of sampling technique in the contrastive learning.
|
| 19 |
+
|
| 20 |
+

|
| 21 |
+
Figure 1: Illustration of two modules in AR2. (a) Retriever: query and document are encoded independently by a dual-encoder. (b) Ranker: concatenated, jointly encoded by a cross-encoder.
|
| 22 |
+
|
| 23 |
+
On the other hand, the model architecture of dual-encoders enables the encoding of queries and documents independently which is essential for document indexing and fast retrieval. However, this ignores the modeling of finer-grained interactions between queries and documents which could be a sub-optimal solution in terms of retrieval accuracy.
|
| 24 |
+
|
| 25 |
+
Motivated by these phenomena, we propose an Adversarial Retriever-Ranker (AR2) framework. The intuitive idea of AR2 is inspired by the “retriever-ranker” architecture in the classical information retrieval systems. AR2 consists of two modules: a dual-encoder model served as the retrieval module in Figure 1a and a cross-encoder model served as the ranker module in Figure 1b. The crossencoder model takes the concatenation of a query and document as input text, and can generate more accurate relevance scores compared with the dual-encoder model, since it can fully explore the interactions between the query and document through a self-attention mechanism using a conventional transformer model (Vaswani et al., 2017; Guo et al., 2020). Instead of training “retriever-ranker” modules independently in some IR systems (Manning et al., 2008; Mitra & Craswell, 2017), AR2 constructs a unified minimax game for training the retriever and ranker models interactively, as shown in Figure 2.
|
| 26 |
+
|
| 27 |
+
In particular, AR2 adopts a minimax objective from the adversarial game (Goodfellow et al., 2014) where the retrieval model is optimized to produce relevant documents to fool the ranker model, whereas the ranker model learns to distinguish the ground-truth relevant document and retrieved ones by its opponent retrieval model. Within the adversarial “retriever-ranker” training framework, the retrieval model receives the smooth training signals from the ranker model which helps alleviate the harmful effects of “false-negative” issues. For example, a “false-negative” example which is rated as high-relevance by the ranker model, will also be granted with high probability by retrieval model in order to fool the ranker, meanwhile the ranker model with better generalization capability is more resistant to label noises compared to the retrieval model.
|
| 28 |
+
|
| 29 |
+
In the empirical studies of AR2, we further introduce a distillation regularization approach to help stabilize/improve the training of the retriever. Intuitively, the retriever would converge to sharp conditionalprobabilities over documents given a query within the adversarial training framework, i.e., high retrieval probabilities for the top relevant documents and near-zero retrieval ones for the rest. However, it is not a desirable property as it might impede exploring different documents during training. Thus, we incorporate the distillation loss between the retriever and ranker models as a smooth term for further improvement.
|
| 30 |
+
|
| 31 |
+

|
| 32 |
+
Figure 2: Illustration of the AR2 training pipeline. $q , d ,$ , and $\mathbb { D } _ { q } ^ { - }$ represent the query, positive document, and retrieved documents, respectively.
|
| 33 |
+
|
| 34 |
+
In experiments, we evaluate AR2 on three widely used benchmarks for dense text retrieval: Natural Questions, Trivia QA and MS-MARCO. Experimental results show that AR2 achieves state-of-theart performance on all these datasets. Meanwhile, we provide a comprehensive ablation study to demonstrate the advantage of different AR2 components.
|
| 35 |
+
|
| 36 |
+
# 2 PRELIMINARIES
|
| 37 |
+
|
| 38 |
+
Dense Text Retrieval: We mainly consider a contrastive-learning paradigm for dense text retrieval in this work, where the training set consists of a collection of text pairs. $C = \{ ( q _ { 1 } , d _ { 1 } ) , . . . , ( q _ { n } , d _ { n } ) \}$ . In the scenario of open-domain question answering, a text pair $( q , d )$ refers to a question and a corresponding document which contains the answer. A typical dense retrieval model adopts a dual encoder architecture, where questions and documents are represented as dense vectors separately and the relevance score $s _ { \theta } ( q , d )$ between them is measured by the similarity between their embeddings:
|
| 39 |
+
|
| 40 |
+
$$
|
| 41 |
+
s _ { \theta } ( q , d ) = \langle E ( q ; \theta ) , E ( d ; \theta ) ) \rangle
|
| 42 |
+
$$
|
| 43 |
+
|
| 44 |
+
where $E ( \cdot ; \theta )$ denotes the encoder module parameterized with $\theta$ , and $\langle \cdot \rangle$ is the similarity function, e.g., inner-product, Euclidean distance. Based on the embeddings, existing solutions generally leverage on-the-shelf fast ANN-search (Johnson et al., 2019) for efficiency.
|
| 45 |
+
|
| 46 |
+
A conventional contrastive-learning algorithm could be applied for training the dual encoders (Shen et al., 2014; Chen et al., 2017; Liu et al., 2020). For example, given a training instance $( q , d )$ , we select $n$ negative irrelevant documents $( d _ { 1 } ^ { - } , . . . , d _ { n } ^ { - } )$ (denoted as $\mathbb { D } _ { q } ^ { - }$ ) to optimize the loss function of the negative log likelihood of the positive document:
|
| 47 |
+
|
| 48 |
+
$$
|
| 49 |
+
L _ { \theta } ( q , d , \mathbb { D } _ { q } ^ { - } ) = - \mathrm { l o g } \frac { e ^ { \tau s _ { \theta } ( q , d ) } } { e ^ { \tau s _ { \theta } ( q , d ) } + \sum _ { i = 1 } ^ { n } e ^ { \tau s _ { \theta } ( q , d _ { i } ^ { - } ) } }
|
| 50 |
+
$$
|
| 51 |
+
|
| 52 |
+
where $\tau$ is a hyper-parameter to control the temperature. Previous works (Shen et al., 2014; Chen et al., 2017; Liu et al., 2020) present an effective strategy on negative document sampling, called “InBatch Negatives” where negative documents are randomly sampled from a collection of documents which are within the same mini-batch as question-document training pairs.
|
| 53 |
+
|
| 54 |
+
Recently, some studies e.g., ANCE (Xiong et al., 2021) and Condenser (Gao & Callan, 2021b), have shown that selecting “hard-negatives” in the training can significantly improve the retrieval performance in open-domain question answering. For example, instead of sampling negative document randomly, “hard-negatives” are iteratively retrieved through previous checkpoints of the dual encoder model. However, a more recent work RocketQA (Qu et al., 2021) continues to point out that the retrieved “hard-negatives” could potential be “false-negatives” in some cases, which might limit the performance.
|
| 55 |
+
|
| 56 |
+
Generative Adversarial Network: GANs have been widely studied for generating the realisticlooking images in computation vision (Goodfellow et al., 2014; Brock et al., 2018). In the past few years, the idea of GANs has been applied in information retrieval (Wang et al., 2017). For example, IRGAN (Wang et al., 2017), proposes a minimax retrieval framework which constructs two types of IR models: a generative retrieval model and a discriminative retrieval model. The two IR models are optimized through a minimax game: the generative retrieval model generates relevant documents that look like ground-truth relevant documents to fool the discriminative retrieval model, whereas the discriminative retrieval model learns to draw a clear distinction between the groundtruth relevant documents and the generated ones made by its opponent generative retrieval model. The minimax objective is formulated as:
|
| 57 |
+
|
| 58 |
+
$$
|
| 59 |
+
\begin{array} { r } { J ^ { G ^ { * } , D ^ { * } } = \operatorname* { m i n } _ { \theta } \operatorname* { m a x } _ { \phi } \mathrm { E } _ { d \sim p _ { \mathrm { t w e } } ( \cdot \vert q ) } \left[ \log D _ { \phi } ( d , q ) \right] + \mathrm { E } _ { d ^ { - } \sim G _ { \theta } ( \cdot \vert q ) } \left[ \log \left( 1 - D _ { \phi } ( d ^ { - } , q ) \right) \right] } \end{array}
|
| 60 |
+
$$
|
| 61 |
+
|
| 62 |
+
where $G _ { \theta } ( \cdot | q )$ and $D _ { \phi } ( d ^ { - } , q )$ denote the generative retrieval model and discriminative retrieval model in IRGAN, respectively. It is worth noting the original IRGAN model doesn’t work for dense retrieval tasks as it doesn’t contain the dual-encoder model for document indexing or fast retrieval.
|
| 63 |
+
|
| 64 |
+
# 3 METHOD
|
| 65 |
+
|
| 66 |
+
In this section, we introduce the proposed adversarial retriever-ranker (AR2) approach. It consists of two modules: the dual-encoder retriever module $G _ { \theta }$ as in Figure 1a, and the cross-encoder ranker module $D _ { \phi }$ as in Figure 1b. $G _ { \theta }$ and $D _ { \phi }$ computes the relevance score between question and document as follows:
|
| 67 |
+
|
| 68 |
+
$$
|
| 69 |
+
\begin{array} { r l } & { G _ { \theta } ( q , d ) = E _ { \theta } ( q ) ^ { T } E _ { \theta } ( d ) } \\ & { D _ { \phi } ( q , d ) = \mathbf { w _ { \phi } } ^ { T } E _ { \phi } \left( [ q , d ] \right) } \end{array}
|
| 70 |
+
$$
|
| 71 |
+
|
| 72 |
+
where $E _ { \theta } ( \cdot )$ and $E _ { \phi } ( \cdot )$ are language model encoders which can be initialized with any pre-trained language model, $\mathbf { w } _ { \phi }$ is the linear projector in $D _ { \phi }$ , and $[ q , d ]$ is the concatenation of question and document.
|
| 73 |
+
|
| 74 |
+
In AR2, the retriever and ranker modules are optimized jointly through a contrastive minimax objective:
|
| 75 |
+
|
| 76 |
+
$$
|
| 77 |
+
J ^ { G ^ { * } , D ^ { * } } = \operatorname* { m i n } _ { \theta } \mathrm { m a x } _ { \phi } { \bf E } _ { \mathbb { D } _ { q } ^ { - } \sim G _ { \theta } ( q , \cdot ) } \left[ \log p _ { \phi } ( d | q ; \mathbb { D } _ { q } ) \right]
|
| 78 |
+
$$
|
| 79 |
+
|
| 80 |
+
where $\mathbb { D } _ { q } ^ { - } \colon \{ d _ { i } ^ { - } \} _ { i = 1 } ^ { n }$ is the set of $n$ negative documents sampled by $G _ { \theta } ( \boldsymbol { q } , \cdot )$ given $q$ , and $p _ { \phi } ( d | q ; \mathbb { D } _ { q } )$ denotes the probability of selecting the ground-truth document $d$ from the document set $\mathbb { D } _ { q }$ $\mathbb { D } _ { q } =$ $\{ d \} \cup \mathbb { D } _ { q } ^ { - } )$ by the ranker module $D _ { \phi }$ ;
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
p _ { \phi } ( d | q ; \mathbb { D } _ { q } ) = \frac { e ^ { \tau D _ { \phi } ( q , d ) } } { \sum _ { d ^ { \prime } \in \mathbb { D } _ { q } } e ^ { \tau D _ { \phi } ( q , d ^ { \prime } ) } }
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
According to the objective function (Eqn. 5), the dual-encoder retrieval model $G _ { \theta } ( \boldsymbol { q } , \cdot )$ would try to sample the high-relevant documents to fool the ranker model, whereas the ranker model $D _ { \phi } ( q , \cdot )$ is optimized to draw distinctions between ground-truth passage and the ones sampled by $G _ { \theta } ( q , \cdot )$ . We present the illustration of the AR2 framework in Figure 2. In order to optimize the minimax objective function, we adopt a conventional iterative-learning mechanism to optimize the retriever and ranker modules coordinately.
|
| 87 |
+
|
| 88 |
+
# 3.1 TRAINING THE RANKER $D _ { \phi }$
|
| 89 |
+
|
| 90 |
+
Given the fixed retriever $G _ { \theta }$ , the ranker model $D _ { \phi }$ is updated by maximizing the log likelihood of selecting ground-truth $d$ from set $\mathbb { D } _ { q }$ given a query $q$ :
|
| 91 |
+
|
| 92 |
+
$$
|
| 93 |
+
\begin{array} { r } { \phi ^ { * } = \mathrm { a r g m a x } _ { \phi } \log p _ { \phi } ( d | q ; \mathbb { D } _ { q } ) } \end{array}
|
| 94 |
+
$$
|
| 95 |
+
|
| 96 |
+
where $\mathbb { D } _ { q }$ consists of ground-truth document $d$ and negative document set $\mathbb { D } _ { q } ^ { - }$ . $\mathbb { D } _ { q } ^ { - }$ is sampled by $G _ { \theta }$ according to Eqn. 5. In experiments, we first retrieve top-100 negative documents, and then randomly sample $n$ examples from them to obtain $\mathbb { D } _ { q } ^ { - }$ .
|
| 97 |
+
|
| 98 |
+
# 3.2 TRAINING RETRIEVER $G _ { \theta }$
|
| 99 |
+
|
| 100 |
+
With fixing the ranker $D _ { \phi }$ , the model parameters $\theta ^ { * }$ for the retriever $G _ { \theta }$ is optimized by minimizing the expectation of log likelihood of function. In particular, by isolating $\theta$ from the minimax function (Eqn. 5), the objective for the retriever can be written as:
|
| 101 |
+
|
| 102 |
+
$$
|
| 103 |
+
\theta ^ { * } = \operatorname * { a r g m i n } _ { \theta } J ^ { \theta } = \mathbf { E } _ { \mathbb { D } _ { q } ^ { - } \sim G _ { \theta } ( q , \cdot ) } \left[ \log p _ { \phi } ( d | q ; \mathbb { D } _ { q } ) \right]
|
| 104 |
+
$$
|
| 105 |
+
|
| 106 |
+
However, it is intractable to optimize $\theta$ directly through Eqn. 8, as the computation of probability $\mathbb { D } _ { q } ^ { - } \sim G _ { \theta } ( q , \cdot )$ does not follow a close form. Thus, we seek to minimize an alternative upper-bound of the loss criteria:
|
| 107 |
+
|
| 108 |
+
$$
|
| 109 |
+
J ^ { \theta } \leq \hat { J } ^ { \theta } = \mathbf { E } _ { d ^ { - } \sim p _ { \theta } ( \cdot | q ; \mathbb { D } _ { q } ^ { - } ) } \left[ \log p _ { \phi } ( d | q ; \{ d , d ^ { - } \} ) \right]
|
| 110 |
+
$$
|
| 111 |
+
|
| 112 |
+
The detailed deviation of Eqn. 9 is provided in the Appendix A.1. Therefore, the gradient of parameter $\theta$ can be computed as the derivative of ${ \hat { J } } ^ { \theta }$ with respect to $\theta$ :
|
| 113 |
+
|
| 114 |
+
$$
|
| 115 |
+
\nabla _ { \theta } \hat { J } ^ { \theta } = \mathbf { E } _ { d ^ { - } \sim p _ { \theta } ( \cdot | q ; \mathbb { D } _ { q } ^ { - } ) } \nabla _ { \theta } \log p _ { \theta } ( d ^ { - } | q ; \mathbb { D } _ { q } ^ { - } ) \left[ \log p _ { \phi } ( d | q ; \{ d , d ^ { - } \} ) \right]
|
| 116 |
+
$$
|
| 117 |
+
|
| 118 |
+
Require: Retriever $G _ { \theta }$ ; Ranker $D _ { \phi }$ ; Document pool $\mathbb { D }$ ; Training dataset $C$ .
|
| 119 |
+
1: Initialize the retriever $G _ { \theta }$ and the ranker $D _ { \phi }$ with pre-trained language models.
|
| 120 |
+
2: Train the warm-up retriever $G _ { \theta } ^ { 0 }$ on training dataset $C$ .
|
| 121 |
+
3: Build ANN index on $\mathbb { D }$
|
| 122 |
+
4: Retrieve negative samples on $\mathbb { D }$ .
|
| 123 |
+
5: Train the warm-up ranker $D _ { \theta } ^ { 0 }$
|
| 124 |
+
6: while AR2 has not converged do
|
| 125 |
+
7: for Retriever training step do
|
| 126 |
+
8: Sample $n$ documents $\{ d _ { i } ^ { - } \} _ { n }$ from ANN index.
|
| 127 |
+
9: Update parameters of the retriever $G _ { \theta }$ .
|
| 128 |
+
10: end for
|
| 129 |
+
11: Refresh ANN Index.
|
| 130 |
+
12: for Ranker training step do
|
| 131 |
+
13: Sample $n$ hard negatives $\{ d _ { i } ^ { - } \} _ { n }$ from ANN index.
|
| 132 |
+
14: Update parameters of the ranker $D _ { \phi }$ .
|
| 133 |
+
15: end for
|
| 134 |
+
16: end while
|
| 135 |
+
|
| 136 |
+
Here, the same approach is applied to obtain set $\mathbb { D } _ { q } ^ { - }$ as in Eqn. 7.
|
| 137 |
+
|
| 138 |
+
Regularization: we further introduce a distillation regularization term in $G _ { \theta }$ ’s training, which encourages the retriever model to distill from the ranker model.
|
| 139 |
+
|
| 140 |
+
$$
|
| 141 |
+
J _ { \mathcal { R } } ^ { \theta } = H ( p _ { \phi } ( \cdot | q ; \mathbb { D } ) , p _ { \theta } ( \cdot | q ; \mathbb { D } ) )
|
| 142 |
+
$$
|
| 143 |
+
|
| 144 |
+
$H ( \cdot )$ is the cross entropy function. $p _ { \phi } ( \cdot | q ; \mathbb { D } )$ and $p _ { \theta } ( \cdot | q ; \mathbb { D } )$ denote the conditional probabilities of document in the whole corpus $\mathbb { D }$ by the ranker and the retriever model, respectively. In practice, we also limit the sampling space over documents to a fixed set, i.e., $\mathbb { D } _ { q } = { \bar { \{ d \} } } \cup { \bar { \mathbb { D } } } _ { q } ^ { - }$ . Thus the regularization loss for the retriever model can be rewritten as:
|
| 145 |
+
|
| 146 |
+
$$
|
| 147 |
+
J _ { \mathcal { R } } ^ { \theta } = H \left( p _ { \phi } ( \cdot | q ; \mathbb { D } _ { q } ) , p _ { \theta } ( \cdot | q ; \mathbb { D } _ { q } ) \right)
|
| 148 |
+
$$
|
| 149 |
+
|
| 150 |
+
# 3.3 INDEX REFRESH
|
| 151 |
+
|
| 152 |
+
During each training iteration of retriever and ranker models in AR2, we refresh the document index to keep the retrieved document set updated. To build the document index, we take the document encoder from the retrieval model to compute the embeddings $E ( d ; \theta )$ for every document $d$ from the corpus: $d \in C$ , and then build the inner-product based ANN search index with FAISS tool.
|
| 153 |
+
|
| 154 |
+
In summary, Algorithm 1 shows the full implementation details of the proposed AR2.
|
| 155 |
+
|
| 156 |
+
# 4 EXPERIMENTS
|
| 157 |
+
|
| 158 |
+
# 4.1 DATASETS
|
| 159 |
+
|
| 160 |
+
We conduct experiments on three popular benchmarks: Natural Questions (Kwiatkowski et al., 2019), Trivia QA (Joshi et al., 2017), and MS-MARCO Passage Ranking (Nguyen et al., 2016).
|
| 161 |
+
|
| 162 |
+
Natural Questions (NQ) collects real questions from the Google search engine and each question is paired with an answer span and golden passages from the Wikipedia pages. In NQ, the goal of the retrieval stage is to find positive passages from a large passage pool. We report Recall of top- $k$ $( \mathbb { R } ^ { \circledcirc \mathrm { k } ) }$ , which represents the proportion of top k retrieved passages that contain the answers.
|
| 163 |
+
|
| 164 |
+
Trivia QA is a reading comprehension corpus authored by trivia enthusiasts. Each sample is a hquestion, answer, evidencei triple. In the retrieval stage, the goal is to find passages that contain the answer. We also use Recall of top- $k$ as the evaluation metric for Trivia QA.
|
| 165 |
+
|
| 166 |
+
MS-MARCO Passage Ranking is widely used in information retrieval. It collects real questions from the Bing search engine. Each question is paired with several web documents. Following previous works (Ren et al., 2021; Qu et al., 2021), we report MRR $@ 1 0$ , $\mathrm { R @ 5 0 }$ , ${ \textrm { R @ 1 k } }$ on the dev set. Mean Reciprocal Rank (MRR) is the mean of Reciprocal Rank(RR) across questions, calculated as the reciprocal of the rank where the first relevant document was retrieved.
|
| 167 |
+
|
| 168 |
+
Table 1: The comparison of the first-stage retrieval performance on Natural Questions test set, Trivia QA test set, and MS-MARCO dev set. The results of the first two blocks are from published papers. If the results are not provided, we mark them as “-”.
|
| 169 |
+
|
| 170 |
+
<table><tr><td></td><td colspan="3">Natural Questions</td><td colspan="3">Trivia QA</td><td colspan="3">MS-MARCO</td></tr><tr><td></td><td>R@5</td><td>R@20</td><td>R@100</td><td>R@5</td><td>R@20</td><td>R@100</td><td>MRR@10</td><td>R@50</td><td>R@1k</td></tr><tr><td>BM25 (Yang et al.,2017)</td><td>-</td><td>59.1</td><td>73.7</td><td>-</td><td>66.9</td><td>76.7</td><td>18.7</td><td>59.2</td><td>85.7</td></tr><tr><td>GAR (Mao et al., 2021a)</td><td>60.9</td><td>74.4</td><td>85.3</td><td>73.1</td><td>80.4</td><td>85.7</td><td>-</td><td>=</td><td></td></tr><tr><td>doc2query (Nogueira et al.,2019b)</td><td></td><td>=</td><td>=</td><td></td><td></td><td>1</td><td>21.5</td><td>64.4</td><td>89.1</td></tr><tr><td>DeepCT (Dai& Callan,2019)</td><td>=</td><td>=</td><td>-</td><td>=</td><td></td><td>-</td><td>24.3</td><td>69.0</td><td>91.0</td></tr><tr><td>docTTTTTquery (Nogueira et al.,2019a)</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td><td>27.7</td><td>75.6</td><td>94.7</td></tr><tr><td>DPR (Karpukhin et al.,2020)</td><td>-</td><td>78.4</td><td>85.3</td><td>-</td><td>79.3</td><td>84.9</td><td>-</td><td>-</td><td></td></tr><tr><td>ANCE (Xiong et al.,2021)</td><td>-</td><td>81.9</td><td>87.5</td><td></td><td>80.3</td><td>85.3</td><td>33.0</td><td>-</td><td>95.9</td></tr><tr><td>RDR(Yang& Seo,2020)</td><td>=</td><td>82.8</td><td>88.2</td><td>=</td><td>82.5</td><td>87.3</td><td></td><td>-</td><td></td></tr><tr><td>ColBERT(Khattab & Zaharia,2020)</td><td>=</td><td>-</td><td>1</td><td>=</td><td>-</td><td>-</td><td>36.0</td><td>82.9</td><td>96.8</td></tr><tr><td>RocketQA (Qu et al.,2021)</td><td>74.0</td><td>82.7</td><td>88.5</td><td>=</td><td></td><td>-</td><td>37.0</td><td>85.5</td><td>97.9</td></tr><tr><td>COIL (Gao et al.,2021)</td><td>-</td><td>1</td><td>-</td><td>=</td><td></td><td></td><td>35.5</td><td>-</td><td>96.3</td></tr><tr><td>ME-BERT(Luan et al.,2021)</td><td>=</td><td>-</td><td>=</td><td>-</td><td>-</td><td>-</td><td>33.8</td><td>1</td><td>-</td></tr><tr><td>Joint Top-k(Sachan et al.,2021a)</td><td>72.1</td><td>81.8</td><td>87.8</td><td>74.1</td><td>81.3</td><td>86.3</td><td>-</td><td></td><td>=</td></tr><tr><td>Individual Top-k (Sachan et al.,2021a)</td><td>75.0</td><td>84.0</td><td>89.2</td><td>76.8</td><td>83.1</td><td>87.0</td><td></td><td>-</td><td>-</td></tr><tr><td>PAIR (Ren et al., 2021) DPR-PAQ (Oguz et al., 2021)</td><td>74.9</td><td>83.5</td><td>89.1</td><td>-</td><td></td><td>1</td><td>37.9</td><td>86.4</td><td>98.2</td></tr><tr><td>-BERTbase</td><td>74.5</td><td>83.7</td><td>88.6</td><td>=</td><td>=</td><td>=</td><td>31.4</td><td>=</td><td>=</td></tr><tr><td>-RoBERTabase</td><td>74.2</td><td>84.0</td><td>89.2</td><td></td><td></td><td>=</td><td>31.1</td><td>=</td><td>=</td></tr><tr><td>Condenser(Gao & Callan,2021b)</td><td>-</td><td>83.2</td><td>88.4</td><td>-</td><td>81.9</td><td>86.2</td><td>36.6</td><td></td><td>97.4</td></tr><tr><td>coCondenser (Gao & Callan,2021a)</td><td>75.8</td><td>84.3</td><td>89.0</td><td>76.8</td><td>83.2</td><td>87.3</td><td>38.2</td><td>-</td><td>98.4</td></tr><tr><td>AR2-G0</td><td>69.7</td><td>80.8</td><td>87.1</td><td>74.4</td><td>81.7</td><td>86.6</td><td>34.8</td><td>84.2</td><td>98.0</td></tr><tr><td>AR2-G</td><td>77.9</td><td>86.0</td><td>90.1</td><td>78.2</td><td>84.4</td><td>87.9</td><td>39.5</td><td>87.8</td><td>98.6</td></tr></table>
|
| 171 |
+
|
| 172 |
+
# 4.2 IMPLEMENTATION DETAILS
|
| 173 |
+
|
| 174 |
+
First step, we follow the experiments in Sachan et al. (2021b) and Gao & Callan (2021a) to continuous pre-training the ERNIE-2.0-base model (Sun et al., 2020) with Inverse Cloze Task (ICT) training (Lee et al., 2019) for NQ and TriviaQA datasets, and coCondenser training (Gao & Callan, 2021a) for MS-MARCO dataset.
|
| 175 |
+
|
| 176 |
+
Second step, we follow the experiment settings of DPR (Karpukhin et al., 2020) to train a warm-up dual-encoder retrieval model $\mathbf { \dot { G } ^ { 0 } }$ . It is initialized with the continuous pretrained ERNIE-2.0-based model we obtained in step one. Then we train a warm-up cross-encoder model $\mathbf { D ^ { 0 } }$ initialized with the ERNIE-2.0-Large. $\hat { \mathbf { D } } ^ { \mathbf { 0 } }$ learns to rank the Top- $\mathbf { \nabla \cdot k }$ documents selected by $\mathbf { G } ^ { 0 }$ with contrastive learning. The detailed hyper-parameters in training are listed in Appendix A.3.
|
| 177 |
+
|
| 178 |
+
Third step, we iteratively train the ranker (AR2-D) model initialized with ERNIE-2.0-large and the retriever (AR2-G) initialized with $\mathbf { G } ^ { 0 }$ according to Algorithm 1. The number of training iterations is set to 10. During each iteration of training, the retriever model is scheduled to train with $1 5 0 0 \mathrm { { m i n i } }$ batches, while the ranker model is scheduled to train with 500 mini-batches. The document index is refreshed after each iteration of training. The other hyper-parameters are shown in Appendix A.3.
|
| 179 |
+
|
| 180 |
+
All the experiments in this work run on 8 NVIDIA Tesla A100 GPUs. The implementation code of AR2 is based on Huggingface Transformers (Wolf et al., 2020) utilizing gradient checkpointing (Chen et al., 2016), Apex1, and gradient accumulation to reduce GPU memory consumption.
|
| 181 |
+
|
| 182 |
+
# 4.3 RESULTS
|
| 183 |
+
|
| 184 |
+
Performance of Retriever AR2-G: The comparison of retrieval performance on NQ, Trivia QA, and MS-MARCO are presented in Table 1.
|
| 185 |
+
|
| 186 |
+
We compare AR2-G with previous state-of-the-art methods, including sparse and dense retrieval models. The top block shows the performance of sparse retrieval methods. BM25 (Yang et al., 2017) is a traditional sparse retriever based on the exact term matching. DeepCT (Dai & Callan, 2019) uses
|
| 187 |
+
|
| 188 |
+
Table 2: Performance of rankers before and after AR2 training on NQ test set.
|
| 189 |
+
|
| 190 |
+
<table><tr><td>Retriever</td><td>Ranker</td><td>R@1</td><td>R@5</td><td>R@10</td></tr><tr><td>AR2-G0</td><td>- AR2-D0 AR2-D</td><td>48.3 60.6 64.2</td><td>69.7 78.7 79.0</td><td>76.2 82.6</td></tr><tr><td>AR2-G</td><td>- AR2-D0 AR2-D</td><td>58.7 61.1 65.6</td><td>77.9 80.1 81.5</td><td>82.6 82.5 84.3 84.9</td></tr></table>
|
| 191 |
+
|
| 192 |
+
Table 3: Performance of AR2-G on NQ test set with different negative sample size $n$ .
|
| 193 |
+
|
| 194 |
+
<table><tr><td></td><td>R@1</td><td>R@5</td><td>R@20</td><td>R@100</td><td>Latency</td></tr><tr><td>n=1</td><td>56.3</td><td>76.4</td><td>85.3</td><td>89.7</td><td>210ms</td></tr><tr><td>n=5</td><td>57.8</td><td>76.9</td><td>85.3</td><td>89.7</td><td>330ms</td></tr><tr><td>n=7</td><td>58.0</td><td>77.2</td><td>85.2</td><td>89.7</td><td>396ms</td></tr><tr><td>n=11</td><td>58.0</td><td>77.1</td><td>85.4</td><td>89.8</td><td>510ms</td></tr><tr><td>n=15</td><td>57.8</td><td>77.3</td><td>85.6</td><td>90.1</td><td>630ms</td></tr></table>
|
| 195 |
+
|
| 196 |
+
Table 4: Comparison of AR2 and IRGAN.
|
| 197 |
+
|
| 198 |
+
<table><tr><td></td><td>R@1</td><td>R@5</td><td>R@20</td><td>R@100</td></tr><tr><td>AR2</td><td>58.7</td><td>77.9</td><td>86.0</td><td>90.1</td></tr><tr><td>IRGAN</td><td>55.2</td><td>75.2</td><td>84.5</td><td>89.2</td></tr></table>
|
| 199 |
+
|
| 200 |
+
Table 5: Effect of regularization in AR2.
|
| 201 |
+
|
| 202 |
+
<table><tr><td></td><td>R@1</td><td>R@5</td><td>R@20</td><td>R@100</td><td>Entropy</td></tr><tr><td>AR2-G</td><td>58.7</td><td>77.9</td><td>86.0</td><td>90.1</td><td>2.10</td></tr><tr><td>-w/oR</td><td>57.8</td><td>77.3</td><td>85.6</td><td>90.1</td><td>1.70</td></tr></table>
|
| 203 |
+
|
| 204 |
+
BERT to dynamically generate lexical weights to augment BM25 Systems. doc2Query (Nogueira et al., 2019b), docTTTTTQuery (Nogueira et al., 2019a), and GAR (Mao et al., 2021a) use text generation to expand queries or documents to make better use of BM25. The middle block lists the results of strong dense retrieval methods, including DPR (Karpukhin et al., 2020), ANCE (Xiong et al., 2021), RDR (Yang & Seo, 2020), RocketQA (Qu et al., 2021), Joint and Individual Top- $\mathbf { \nabla } \cdot \mathbf { k }$ (Sachan et al., 2021a), PAIR (Ren et al., 2021), DPR-PAQ (Oguz et al., 2021), Condenser (Gao & Callan, ˘ 2021b). coCondenser (Gao & Callan, 2021a), ME-BERT (Luan et al., 2021), CoIL (Gao et al., 2021). These methods improve the performance of dense retrieval by constructing hard negative samples, jointly training the retriever and downstream tasks, pre-training, knowledge distillation, and multi-vector representations.
|
| 205 |
+
|
| 206 |
+
The bottom block in Table 1 shows the results of proposed AR2 models. AR2- $\mathbf { G } ^ { 0 }$ refers to the warm-up retrieval model in AR2 (details can be found in section 4.2) which leverages the existing continuous pre-training technique for dense text retrieval tasks. i.e., it shows a better performance compared with DPR (Karpukhin et al., 2020) and ANCE (Xiong et al., 2021), etc approaches that do not adopt the continuous pre-training procedure. We also observed that AR2-G: the retrieval model trained with the adversary framework, significantly outperforms the warm-up AR2- $\mathbf { G } ^ { 0 }$ model, and achieves new state-of-the-art performance on all three datasets.
|
| 207 |
+
|
| 208 |
+
# 4.4 ANALYSIS
|
| 209 |
+
|
| 210 |
+
In this section, we conduct a set of detailed experiments on analyzing the proposed AR2 training framework to help understand its pros and cons.
|
| 211 |
+
|
| 212 |
+
Performance of Ranker AR2-D: To evaluate the performance of ranker AR2-D on NQ, we first retrieve the top-100 documents for each query in the test set with the help of dual-encoder AR2- $\mathbf { G }$ model, and then re-rank them with the scores produced by the AR2-D model. The results are shown in Table 2. “-” represents without ranker. ${ \bf A } { \bf R } { \bf \Lambda } ^ { 2 - { \bf D } ^ { 0 } }$ refers to the warm-up ranker model in AR2. The results show that the ranker obtains better performance compared with only using retriever. It suggests that we could use a two-stage ranking strategy to further boost the retrieval performance. Comparing the results of AR2-D and $\mathbf { \Delta } \mathbf { A } \mathbf { R } \mathbf { \hat { \mathbf { \xi } } } \mathbf { - } \mathbf { \bar { D } } ^ { 0 }$ , we further find that the ranker AR2- $\mathbf { D }$ gets a significant gain with adversarial training.
|
| 213 |
+
|
| 214 |
+
Impact of Negative Sample Size: In the training of AR2, the number of negative documents $n$ would affect both the model performance and training time. In Table 3, we show the performance and the training latency per batch with different negative sample size $n$ . In this setting, we evaluate AR2 without the regularization term. We observe the improvement over $\mathbb { R } \ @ 1$ and $\mathbf { R } @ 5$ by increasing $n$ from 1 to 7, and marginal improvement when keep increasing $n$ from 7 to 15. The latency of training per batch is almost linear increased by improving $n$ .
|
| 215 |
+
|
| 216 |
+
Comparison with IRGAN: The original IRGAN (Wang et al., 2017) doesn’t work for dense text retrieval tasks as it does not contain the dual-encoder retrieval model for fast document indexing and search. However, it provides an conventional GAN framework for training the generative and discriminative models jointly for IR tasks. To compare the proposed AR2 with IRGAN, we replaced the generative and discriminative models in IRGAN with the retriever and ranker models in AR2, respectively. Therefore, with the configuration of the same model architectures for generator (retriever) and discriminator (ranker), The performance of the retriever is shown in Table 4. We see that AR2 outperforms IRGAN significantly.
|
| 217 |
+
|
| 218 |
+

|
| 219 |
+
Figure 3: NQ $\mathbf { R } @ 5$ on the number of iteration for both the AR2-retriever and the AR2-ranker.
|
| 220 |
+
|
| 221 |
+

|
| 222 |
+
Figure 4: The comparison of ANCE and AR2 on NQ test set.
|
| 223 |
+
|
| 224 |
+
Table 6: The results of the second-stage ranking on Natural Questions test set. Note that we copy the numbers of the first block from the RIDER paper (Mao et al., 2021b).
|
| 225 |
+
|
| 226 |
+
<table><tr><td>Retriever</td><td>Ranker</td><td>R@1</td><td>R@5</td><td>R@10</td><td>R@20</td><td>R@50</td><td>R@100</td></tr><tr><td>GAR+ (Mao et al., 2021a)</td><td>1</td><td>46.8</td><td>70.7</td><td>77.0</td><td>81.5</td><td>1</td><td>88.9</td></tr><tr><td>GAR+ (Mao et al., 2021a)</td><td>BERT</td><td>51.4</td><td>67.6</td><td>75.7</td><td>82.4</td><td>1</td><td>88.9</td></tr><tr><td>GAR+ (Mao et al., 2021a)</td><td>BART</td><td>55.2</td><td>73.5</td><td>78.5</td><td>82.2</td><td>1</td><td>88.9</td></tr><tr><td>GAR+ (Mao et al., 2021a)</td><td>RIDER</td><td>53.5</td><td>75.2</td><td>80.0</td><td>83.2</td><td>1</td><td>88.9</td></tr><tr><td>AR2-G</td><td>-</td><td>58.7</td><td>77.9</td><td>82.5</td><td>86.0</td><td>88.5</td><td>90.1</td></tr><tr><td>AR2-G</td><td>AR2-D</td><td>65.6</td><td>81.5</td><td>84.9</td><td>87.2</td><td>89.5</td><td>90.1</td></tr></table>
|
| 227 |
+
|
| 228 |
+
Effect of Regularization: To study the effectiveness of regularization, we conducted ablation studies by removing the regularization term in the training of retrieval model. In Table 5, $" R "$ refers to the regularization item, it shows that the regularization approach helps to improve the $\mathbf { R } \ @ 1$ and $\mathbf { R } @ 5$ evaluation metrics. In additional, we compute the average entropy of distribution $p _ { \theta } ( \cdot | q , d , \mathbb { D } _ { q } )$ on the NQ test set, where $\mathbb { D } _ { q }$ is the retrieved top-15 documents. The average entropy measures the sharpness of distribution $p _ { \theta } \dot { ( \cdot | } q , d , \mathbb { D } _ { q } )$ . In experiments, the average entropies for with $R$ and w/o $R$ in AR2-G are 2.10 and 1.70 respectively. This indicates that the regularization term could help smooth the prediction of probabilities in the retriever.
|
| 229 |
+
|
| 230 |
+
Visualization of the Training Procedure: We visualize the changes of $\mathbf { R } @ 5$ during the AR2- $\mathbf { G }$ training. The result is shown in Figure 3. We see that as adversarial iteration increases, the $\mathbf { R } @ 5$ of both AR2-retriever and AR2-ranker also gradually increases. AR2-retriever has the most significant improvement (about $4 . 5 \%$ ) after the first iteration. While the training advances closer to the convergence, the improvement of $\mathbf { R } @ 5$ also gradually slows down. In the end, AR2-retriever is improved by approximately $8 \%$ and AR2-ranker is improved by approximately $3 \%$ .
|
| 231 |
+
|
| 232 |
+
Adversarial Training versus Iterative Hard-Negative Sampling: To give a fair comparison of AR2 and ANCE (Xiong et al., 2021), we retrain the ANCE model by initializing it with the same warm-up ${ \bf A } { \bf R } 2 – { \bf G } ^ { \bf 0 }$ which leverages the advantage of the continuous pre-training technique. In experiments, ANCE trains the retriever with an iterative hard-negative sampling approach instead of adversarial training in AR2. In Figure 4, we observe that AR2 steadily outperforms ANCE during training in terms of $\mathbf { R } @ 5$ and $\mathrm { R @ 1 0 }$ evaluation metrics with the same model-initialization. It shows that AR2 is a superior training framework compared with ANCE.
|
| 233 |
+
|
| 234 |
+
Performance of the Pipeline: We evaluate the performance of the retrieve-then-rank pipeline on NQ dataset. The results are shown in Table 6. $\mathrm { G A R ^ { + } }$ is a sparse retriever which ensembles GAR (Mao et al., 2021a) and DPR (Karpukhin et al., 2020). BERT (Nogueira & Cho, 2019), BART (Nogueira et al., 2020), and RIDER (Mao et al., 2021b) are three ranking methods. BERT ranker is a cross-encoder, which makes a binary relevance decision for each query-passage pair.
|
| 235 |
+
|
| 236 |
+
BART ranker generates relevance labels as target tokens in a seq2seq manner. RIDER re-ranks the retrieved passages based on the lexical overlap with the top predicted answers from the reader. The results show that AR2 pipeline significantly outperforms existing public pipelines.
|
| 237 |
+
|
| 238 |
+
# 5 RELATED WORK
|
| 239 |
+
|
| 240 |
+
Text Retrieval: Text retrieval aims to find related documents from a large corpus given a query.
|
| 241 |
+
Retrieval-then-rank is the widely used pipeline (Huang et al., 2020; Zou et al., 2021).
|
| 242 |
+
|
| 243 |
+
For the first stage retrieval, early researchers used sparse vector space models, e.g., BM25 (Yang et al., 2017). Recently, some works improve the traditional sparse retriever with neural network, e.g., Dai & Callan (2019) use BERT to dynamically generate term weights, doc2Query (Nogueira et al., 2019b), docTTTTTQuery (Nogueira et al., 2019a), and GAR (Mao et al., 2021a) use text generation to expand queries or documents to make better use of BM25.
|
| 244 |
+
|
| 245 |
+
Recently, dense retrieval methods have become a new paradigm for the first stage of retrieval. Various methods have been proposed to enhance dense retrieval, e.g., DPR (Karpukhin et al., 2020) and ME-BERT (Luan et al., 2021) use in-batch negatives and construct hard negatives by BM25; ANCE (Xiong et al., 2021), RocketQA (Qu et al., 2021), and ADORE (Zhan et al., 2021) improve the hard negative sampling by iterative replacement, denoising, and dynamic sampling, respectively; PAIR (Ren et al., 2021) leverages passage-centric similarity relation into training object; FID-KD (Izacard & Grave, 2020) and RDR (Yang & Seo, 2020) distill knowledge from reader to retriever; Guu et al. (2020) and Sachan et al. (2021b) enhance retriever by jointly training with downstream tasks. Some researchers focus on the pre-training of dense retrieval, such as ICT (Lee et al., 2019), Condenser (Gao & Callan, 2021b) and Cocondenser (Gao & Callan, 2021a).
|
| 246 |
+
|
| 247 |
+
For the second stage ranking, previous works typically use cross-encoder based methods. The crossencoder models which capture the token-level interactions between the query and the document (Guo et al., 2016; Xiong et al., 2017), have shown to be more effective. Various methods are proposed to enhance ranker, e.g., Nogueira & Cho (2019) use BERT to make a binary relevance decision for each query-passage pair; Nogueira et al. (2020) adopt BART to generate relevance labels as target tokens in a seq2seq manner; Khattab & Zaharia (2020) and Gao et al. (2020) adopt the lightweight interaction based on the representations of dense retrievers to reduce computation. However, negative samples are statically sampled in these works. In AR2, negative samples for training the ranker will be dynamically adjusted with the progressive retriever.
|
| 248 |
+
|
| 249 |
+
Generative Adversarial Nets: Generative Adversarial Nets (Goodfellow et al., 2014) have been widely studied in the generation field, i.e., image generation (Brock et al., 2018) and text generation (Yu et al., 2017). With a minimax game, GAN aims to train a generative model to fit the real data distribution under the guidance of a discriminative model. Few works study GAN to text retrieval. A related work is IRGAN (Wang et al., 2017). It proposes a minimax retrieval framework that aims to unify the generative and discriminative retrieval models.
|
| 250 |
+
|
| 251 |
+
# 6 CONCLUSION
|
| 252 |
+
|
| 253 |
+
In this paper, we introduce AR2, an adversarial retriever-ranker framework to jointly train the end-toend retrieve-then-rank pipeline. In AR2, the retriever retrieves hard negatives to cheat the ranker, and the ranker learns to rank the collection of positives and hard negatives while providing progressive rewards to the retriever. AR2 can iteratively improve the performance of both the retriever and the ranker because (1) the retriever is guided by the progressive ranker; (2) the ranker learns better through the harder negatives sampled by the progressive retriever. AR2 achieves new state-of-the-art performance on all three competitive benchmarks.
|
| 254 |
+
|
| 255 |
+
# Acknowledgement
|
| 256 |
+
|
| 257 |
+
This work is supported by the National Natural Science Fund for Distinguished Young Scholar (Grant No. 61625204), and partially supported by the Key Program of National Science Foundation of China (Grant No. 61836006).
|
| 258 |
+
|
| 259 |
+
# REFERENCES
|
| 260 |
+
|
| 261 |
+
Dan Brickley, Matthew Burgess, and Natasha Noy. Google dataset search: Building a search engine for datasets in an open web ecosystem. In WWW, 2019.
|
| 262 |
+
|
| 263 |
+
Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale gan training for high fidelity natural image synthesis. In ICLR, 2018.
|
| 264 |
+
|
| 265 |
+
Danqi Chen, Adam Fisch, Jason Weston, and Antoine Bordes. Reading wikipedia to answer opendomain questions. In ACL, 2017.
|
| 266 |
+
|
| 267 |
+
Tianqi Chen, Bing Xu, Chiyuan Zhang, and Carlos Guestrin. Training deep nets with sublinear memory cost. arXiv preprint arXiv:1604.06174, 2016.
|
| 268 |
+
|
| 269 |
+
Zhuyun Dai and Jamie Callan. Deeper text understanding for ir with contextual neural language modeling. In SIGIR, 2019.
|
| 270 |
+
|
| 271 |
+
Luyu Gao and Jamie Callan. Unsupervised corpus aware language model pre-training for dense passage retrieval. arXiv preprint arXiv:2108.05540, 2021a.
|
| 272 |
+
|
| 273 |
+
Luyu Gao and Jamie Callan. Is your language model ready for dense representation fine-tuning? arXiv preprint arXiv:2104.08253, 2021b.
|
| 274 |
+
|
| 275 |
+
Luyu Gao, Zhuyun Dai, and Jamie Callan. Modularized transfomer-based ranking framework. In EMNLP, 2020.
|
| 276 |
+
|
| 277 |
+
Luyu Gao, Zhuyun Dai, and Jamie Callan. COIL: revisit exact lexical match in information retrieval with contextualized inverted list. In NAACL-HLT, 2021.
|
| 278 |
+
|
| 279 |
+
Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. NIPS, 2014.
|
| 280 |
+
|
| 281 |
+
Daya Guo, Duyu Tang, Nan Duan, Ming Zhou, and Jian Yin. Dialog-to-action: Conversational question answering over a large-scale knowledge base. 2018.
|
| 282 |
+
|
| 283 |
+
Daya Guo, Shuo Ren, Shuai Lu, Zhangyin Feng, Duyu Tang, Shujie Liu, Long Zhou, Nan Duan, Alexey Svyatkovskiy, Shengyu Fu, et al. Graphcodebert: Pre-training code representations with data flow. arXiv preprint arXiv:2009.08366, 2020.
|
| 284 |
+
|
| 285 |
+
Jiafeng Guo, Yixing Fan, Qingyao Ai, and W Bruce Croft. A deep relevance matching model for ad-hoc retrieval. In CIKM, 2016.
|
| 286 |
+
|
| 287 |
+
Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Mingwei Chang. Retrieval augmented language model pre-training. In ICML, 2020.
|
| 288 |
+
|
| 289 |
+
Shuguang Han, Xuanhui Wang, Mike Bendersky, and Marc Najork. Learning-to-rank with bert in tf-ranking. arXiv preprint arXiv:2004.08476, 2020.
|
| 290 |
+
|
| 291 |
+
Linmei Hu, Siyong Xu, Chen Li, Cheng Yang, Chuan Shi, Nan Duan, Xing Xie, and Ming Zhou. Graph neural news recommendation with unsupervised preference disentanglement. In ACL, 2020.
|
| 292 |
+
|
| 293 |
+
Jui-Ting Huang, Ashish Sharma, Shuying Sun, Li Xia, David Zhang, Philip Pronin, Janani Padmanabhan, Giuseppe Ottaviano, and Linjun Yang. Embedding-based retrieval in facebook search. In KDD, 2020.
|
| 294 |
+
|
| 295 |
+
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 CIKM, 2013.
|
| 296 |
+
|
| 297 |
+
Gautier Izacard and Edouard Grave. Distilling knowledge from reader to retriever for question answering. arXiv preprint arXiv:2012.04584, 2020.
|
| 298 |
+
|
| 299 |
+
Jeff Johnson, Matthijs Douze, and Herve J ´ egou. Billion-scale similarity search with gpus. ´ IEEE Transactions on Big Data, 2019.
|
| 300 |
+
|
| 301 |
+
Mandar Joshi, Eunsol Choi, Daniel S. Weld, and Luke Zettlemoyer. Triviaqa: A large scale distantly supervised challenge dataset for reading comprehension. In ACL, 2017.
|
| 302 |
+
|
| 303 |
+
Vladimir Karpukhin, Barlas Oguz, Sewon Min, Patrick S. H. Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih. Dense passage retrieval for open-domain question answering. In EMNLP, 2020.
|
| 304 |
+
|
| 305 |
+
Omar Khattab and Matei Zaharia. Colbert: Efficient and effective passage search via contextualized late interaction over bert. In SIGIR, 2020.
|
| 306 |
+
|
| 307 |
+
Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur P. Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, Kristina Toutanova, Llion Jones, Matthew Kelcey, Ming-Wei Chang, Andrew M. Dai, Jakob Uszkoreit, Quoc Le, and Slav Petrov. Natural questions: a benchmark for question answering research. Trans. Assoc. Comput. Linguistics, 7:452–466, 2019.
|
| 308 |
+
|
| 309 |
+
Kenton Lee, Ming-Wei Chang, and Kristina Toutanova. Latent retrieval for weakly supervised open domain question answering. In ACL, 2019.
|
| 310 |
+
|
| 311 |
+
Dayiheng Liu, Yeyun Gong, Jie Fu, Yu Yan, Jiusheng Chen, Daxin Jiang, Jiancheng Lv, and Nan Duan. Rikinet: Reading wikipedia pages for natural question answering. In ACL, 2020.
|
| 312 |
+
|
| 313 |
+
Yi Luan, Jacob Eisenstein, Kristina Toutanova, and Michael Collins. Sparse, dense, and attentional representations for text retrieval. Transactions of the Association for Computational Linguistics, 9:329–345, 2021.
|
| 314 |
+
|
| 315 |
+
Christopher D. Manning, Prabhakar Raghavan, and Hinrich Schutze. ¨ Introduction to Information Retrieval. Cambridge University Press, Cambridge, UK, 2008. ISBN 978-0-521-86571-5.
|
| 316 |
+
|
| 317 |
+
Yuning Mao, Pengcheng He, Xiaodong Liu, Yelong Shen, Jianfeng Gao, Jiawei Han, and Weizhu Chen. Generation-augmented retrieval for open-domain question answering. In ACL, 2021a.
|
| 318 |
+
|
| 319 |
+
Yuning Mao, Pengcheng He, Xiaodong Liu, Yelong Shen, Jianfeng Gao, Jiawei Han, and Weizhu Chen. Reader-guided passage reranking for open-domain question answering. In Findings of ACL/IJCNLP, 2021b.
|
| 320 |
+
|
| 321 |
+
Bhaskar Mitra and Nick Craswell. Neural models for information retrieval. CoRR, abs/1705.01509, 2017. URL http://arxiv.org/abs/1705.01509.
|
| 322 |
+
|
| 323 |
+
Tri Nguyen, Mir Rosenberg, Xia Song, Jianfeng Gao, Saurabh Tiwary, Rangan Majumder, and Li Deng. Ms marco: A human generated machine reading comprehension dataset. In CoCo@ NIPS, 2016.
|
| 324 |
+
|
| 325 |
+
Rodrigo Nogueira and Kyunghyun Cho. Passage re-ranking with bert. arXiv preprint arXiv:1901.04085, 2019.
|
| 326 |
+
|
| 327 |
+
Rodrigo Nogueira, Jimmy Lin, and AI Epistemic. From doc2query to doctttttquery. Online preprint, 2019a.
|
| 328 |
+
|
| 329 |
+
Rodrigo Nogueira, Wei Yang, Jimmy Lin, and Kyunghyun Cho. Document expansion by query prediction. arXiv preprint arXiv:1904.08375, 2019b.
|
| 330 |
+
|
| 331 |
+
Rodrigo Nogueira, Zhiying Jiang, and Jimmy Lin. Document ranking with a pretrained sequenceto-sequence model. arXiv preprint arXiv:2003.06713, 2020.
|
| 332 |
+
|
| 333 |
+
Barlas Oguz, Kushal Lakhotia, Anchit Gupta, Patrick Lewis, Vladimir Karpukhin, Aleksandra Pik- ˘ tus, Xilun Chen, Sebastian Riedel, Wen-tau Yih, Sonal Gupta, et al. Domain-matched pre-training tasks for dense retrieval. arXiv preprint arXiv:2107.13602, 2021.
|
| 334 |
+
|
| 335 |
+
Yingqi Qu, Yuchen Ding, Jing Liu, Kai Liu, Ruiyang Ren, Wayne Xin Zhao, Daxiang Dong, Hua Wu, and Haifeng Wang. Rocketqa: An optimized training approach to dense passage retrieval for open-domain question answering. In NAACL-HLT, 2021.
|
| 336 |
+
|
| 337 |
+
Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language supervision. CoRR, abs/2103.00020, 2021.
|
| 338 |
+
|
| 339 |
+
Ruiyang Ren, Shangwen Lv, Yingqi Qu, Jing Liu, Wayne Xin Zhao, Qiaoqiao She, Hua Wu, Haifeng Wang, and Ji-Rong Wen. PAIR: leveraging passage-centric similarity relation for improving dense passage retrieval. In Findings of ACL/IJCNLP, 2021.
|
| 340 |
+
|
| 341 |
+
Devendra Singh Sachan, Mostofa Patwary, Mohammad Shoeybi, Neel Kant, Wei Ping, William L. Hamilton, and Bryan Catanzaro. End-to-end training of neural retrievers for open-domain question answering. In ACL/IJCNLP, 2021a.
|
| 342 |
+
|
| 343 |
+
Devendra Singh Sachan, Siva Reddy, William Hamilton, Chris Dyer, and Dani Yogatama. End-toend training of multi-document reader and retriever for open-domain question answering. arXiv preprint arXiv:2106.05346, 2021b.
|
| 344 |
+
|
| 345 |
+
Yelong Shen, Xiaodong He, Jianfeng Gao, Li Deng, and Gregoire Mesnil. Learning semantic rep- ´ resentations using convolutional neural networks for web search. In WWW, 2014.
|
| 346 |
+
|
| 347 |
+
Yu Sun, Shuohuan Wang, Yukun Li, Shikun Feng, Hao Tian, Hua Wu, and Haifeng Wang. Ernie 2.0: A continual pre-training framework for language understanding. In AAAI, 2020.
|
| 348 |
+
|
| 349 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NIPS, 2017.
|
| 350 |
+
|
| 351 |
+
Jun Wang, Lantao Yu, Weinan Zhang, Yu Gong, Yinghui Xu, Benyou Wang, Peng Zhang, and Dell Zhang. Irgan: A minimax game for unifying generative and discriminative information retrieval models. In SIGIR, 2017.
|
| 352 |
+
|
| 353 |
+
Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick ´ von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander M. Rush. Transformers: State-of-the-art natural language processing. In EMNLP, 2020.
|
| 354 |
+
|
| 355 |
+
Chenyan Xiong, Zhuyun Dai, Jamie Callan, Zhiyuan Liu, and Russell Power. End-to-end neural ad-hoc ranking with kernel pooling. In SIGIR, 2017.
|
| 356 |
+
|
| 357 |
+
Lee Xiong, Chenyan Xiong, Ye Li, Kwok-Fung Tang, Jialin Liu, Paul N. Bennett, Junaid Ahmed, and Arnold Overwijk. Approximate nearest neighbor negative contrastive learning for dense text retrieval. In ICLR, 2021.
|
| 358 |
+
|
| 359 |
+
Peilin Yang, Hui Fang, and Jimmy Lin. Anserini: Enabling the use of lucene for information retrieval research. In SIGIR, 2017.
|
| 360 |
+
|
| 361 |
+
Sohee Yang and Minjoon Seo. Is retriever merely an approximator of reader? arXiv preprint arXiv:2010.10999, 2020.
|
| 362 |
+
|
| 363 |
+
Lantao Yu, Weinan Zhang, Jun Wang, and Yong Yu. Seqgan: Sequence generative adversarial nets with policy gradient. In AAAI, 2017.
|
| 364 |
+
|
| 365 |
+
Jingtao Zhan, Jiaxin Mao, Yiqun Liu, Min Zhang, and Shaoping Ma. Repbert: Contextualized text embeddings for first-stage retrieval. arXiv preprint arXiv:2006.15498, 2020.
|
| 366 |
+
|
| 367 |
+
Jingtao Zhan, Jiaxin Mao, Yiqun Liu, Jiafeng Guo, Min Zhang, and Shaoping Ma. Optimizing dense retrieval model training with hard negatives. In SIGIR, 2021.
|
| 368 |
+
|
| 369 |
+
Lixin Zou, Shengqiang Zhang, Hengyi Cai, Dehong Ma, Suqi Cheng, Shuaiqiang Wang, Daiting Shi, Zhicong Cheng, and Dawei Yin. Pre-trained language model based ranking in baidu search. In KDD, 2021.
|
| 370 |
+
|
| 371 |
+
# A APPENDIX
|
| 372 |
+
|
| 373 |
+
A.1 PROOF
|
| 374 |
+
|
| 375 |
+
Proof of Eqn. 9: Suppose $d _ { i } ^ { - } \in { \mathbb { D } } _ { q } ^ { - }$ is sampled by $p _ { \theta } ( \cdot | q ; \mathbb { D } _ { q } ^ { - } )$ , thus
|
| 376 |
+
|
| 377 |
+
$$
|
| 378 |
+
\begin{array} { r l } & { J ^ { \theta } = \mathbf { E } _ { \mathbb { D } _ { q } ^ { - } \sim G _ { \theta } ( q , \cdot ) } \left[ \log p _ { \phi } ( d | q ; \{ d \} \cup \mathbb { D } _ { q } ^ { - } ) \right] } \\ & { \qquad \le \mathbf { E } _ { \mathbb { D } _ { q } ^ { - } \sim G _ { \theta } ( q , \cdot ) } \left( \mathbf { E } _ { d _ { i } ^ { - } \sim p _ { \phi } ( \cdot | q ; \mathbb { D } _ { q } ^ { - } ) } \left[ \log p _ { \phi } ( d | q ; \{ d , d _ { i } ^ { - } \} ) \right] \right) } \end{array}
|
| 379 |
+
$$
|
| 380 |
+
|
| 381 |
+
where $\mathbb { D } _ { q } ^ { - }$ indicates the set of negative documents sampled by $G _ { \theta } ( q , \cdot )$ . In practice, we approximate $\mathbb { D } _ { q } ^ { - }$ by sampling $n$ documents from the top- $K$ retrieved negative set. Therefore, we could further obtain the following approximately equation in implementation.
|
| 382 |
+
|
| 383 |
+
$$
|
| 384 |
+
\approx \mathbf { E } _ { d _ { i } ^ { - } \sim p _ { \theta } ( \cdot \vert q ; \mathbb { D } _ { q } ^ { - } ) } \left[ \log p _ { \phi } ( d \vert q ; \{ d , d _ { i } ^ { - } \} ) \right] = \hat { J } ^ { \theta }
|
| 385 |
+
$$
|
| 386 |
+
|
| 387 |
+
Proof of Eqn. 10:
|
| 388 |
+
|
| 389 |
+
$$
|
| 390 |
+
\begin{array} { l } { { \nabla _ { \theta } \hat { J } ^ { \theta } = \nabla _ { \theta } \mathbf { E } _ { d _ { i } ^ { - } \sim p _ { \theta } ( \cdot \vert q ; \mathbb { D } _ { q } ^ { - } ) } \left[ \log p _ { \phi } ( d \vert q ; \{ d , d _ { i } ^ { - } \} ) \right] } } \\ { { { { } } } = \displaystyle \sum _ { i } \nabla _ { \theta } p _ { \theta } ( d _ { i } ^ { - } \vert q ; \mathbb { D } _ { q } ^ { - } ) \left[ \log p _ { \phi } ( d \vert q ; \{ d , d _ { i } ^ { - } \} ) \right] } \\ { { { } } } \\ { { { } } = \displaystyle \sum _ { i } p _ { \theta } ( d _ { i } ^ { - } \vert q ; \mathbb { D } _ { q } ^ { - } ) \nabla _ { \theta } \log p _ { \theta } ( d _ { i } ^ { - } \vert q ; \mathbb { D } _ { q } ^ { - } ) \left[ \log p _ { \phi } ( d \vert q ; \{ d , d _ { i } ^ { - } \} ) \right] } \\ { { { } } } \\ { { { } } = \displaystyle \mathbf { E } _ { d _ { i } ^ { - } \sim p _ { \theta } ( \cdot \vert q ; \mathbb { D } _ { q } ^ { - } ) } \nabla _ { \theta } \log p _ { \theta } ( d _ { i } ^ { - } \vert q ; \mathbb { D } _ { q } ^ { - } ) \left[ \log p _ { \phi } ( d \vert q ; \{ d , d _ { i } ^ { - } \} ) \right] } \end{array}
|
| 391 |
+
$$
|
| 392 |
+
|
| 393 |
+
# A.2 EFFICIENCY REPORT
|
| 394 |
+
|
| 395 |
+
We list the time cost of training and inference in Table 7. The evaluation is made with 8 NVIDIA A100 GPUs. The max step of ANCE training is from the ANCE’s open-source website 2.We estimate the overall training time without taking account of the time of continuous pre-training step and warming-up step.
|
| 396 |
+
|
| 397 |
+
Table 7: Comparison of Efficiency
|
| 398 |
+
|
| 399 |
+
<table><tr><td></td><td>DPR</td><td>ANCE</td><td>AR2(n=15)</td><td>AR2(n=1)</td></tr><tr><td>Training Batch Size Max Step</td><td>128 20k 1.8h</td><td>128 136k</td><td>64 20k</td><td>64 20k</td></tr><tr><td>BPfor Retriever BP for Ranker Iteration Number Index Refresh</td><td>1 0 0.5</td><td>11h 1 10</td><td>2.3h 0.75h 10</td><td>1h 0.35h 10</td></tr><tr><td>Overall</td><td>1.85h</td><td>0.5h 16h</td><td>0.5h</td><td>0.5h</td></tr><tr><td>Inference</td><td></td><td></td><td>9.1h</td><td>6.4h</td></tr><tr><td></td><td>20min</td><td></td><td></td><td></td></tr><tr><td>Encoding of Corpus</td><td></td><td>20min</td><td>20min</td><td>20min</td></tr><tr><td>Query Encoding</td><td>40ns</td><td>40ns</td><td>40ns</td><td>40ns</td></tr><tr><td>ANNIndexBuild</td><td>2min</td><td>2min</td><td>2min</td><td></td></tr><tr><td></td><td>2ms</td><td></td><td></td><td>2min</td></tr><tr><td>ANN Retrieval(Top-100)</td><td></td><td>2ms</td><td>2ms</td><td>2ms</td></tr></table>
|
| 400 |
+
|
| 401 |
+
# A.3 HYPERPARAMETERS
|
| 402 |
+
|
| 403 |
+
Table 8: Hyperparameters for AR2 training.
|
| 404 |
+
|
| 405 |
+
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=9>Parameter</td><td rowspan=1 colspan=1>NQ TriviaQA MS-MARCO</td></tr><tr><td rowspan=1 colspan=1>Default</td><td rowspan=1 colspan=9>Max query lengthMax passage length</td><td rowspan=1 colspan=1>32 32 32128 128 128</td></tr><tr><td rowspan=5 colspan=1>AR2-G0</td><td rowspan=5 colspan=9>Learning rateNegative sizeBatch sizeTemperature TOptimizerSchedulerWarmup proportionTraining epoch</td><td rowspan=1 colspan=1>1e-5 1e-5 1e-4</td></tr><tr><td rowspan=1 colspan=3></td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>255 255 127</td></tr><tr><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1></td><td rowspan=3 colspan=1>128 128 641 1 1AdamW AdamW AdamWLinear Linear Linear0.1 0.1 0.140 40 3</td></tr><tr><td rowspan=1 colspan=2></td></tr><tr><td rowspan=1 colspan=2>Scheduler</td><td rowspan=1 colspan=3>r</td></tr><tr><td rowspan=9 colspan=1>AR2-D0</td><td rowspan=3 colspan=9>Learning rateNegative sizeBatch size</td><td rowspan=1 colspan=1>1e-5 1e-5 1e-5</td></tr><tr><td rowspan=1 colspan=1>15 15 15</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>64 64 256</td></tr><tr><td rowspan=2 colspan=9>Temperature TOptimizer</td><td rowspan=2 colspan=1>1 1 1AdamW AdamW AdamW</td></tr><tr><td rowspan=3 colspan=1>AdamW AdamW AdamWLinear Linear Linear0.1 0.1 0.1</td></tr><tr><td rowspan=1 colspan=9>Scheduler</td><td rowspan=1 colspan=1>Linear Linear</td></tr><tr><td rowspan=3 colspan=9>Warmup proportionTraining step per iterationMax step</td></tr><tr><td rowspan=1 colspan=1>1500 1500 1500</td></tr><tr><td rowspan=1 colspan=5></td><td rowspan=1 colspan=1>2000 2000 4000</td></tr><tr><td rowspan=8 colspan=1>AR2-G</td><td rowspan=8 colspan=9>Learning rateNegative sizeBatch sizeTemperature TOptimizerSchedulerWarmup proportionTraining step per iterationMax step</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>15 15 15</td></tr><tr><td rowspan=1 colspan=1>64 64 64</td></tr><tr><td rowspan=1 colspan=1>1 1 1AdamW AdamW AdamW</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Linear Linear Linear</td></tr><tr><td rowspan=1 colspan=1>0.1 0.1 0.1</td></tr><tr><td rowspan=1 colspan=1>1500 1500 1500</td></tr><tr><td rowspan=1 colspan=5></td><td rowspan=1 colspan=1>15000 15000 15000</td></tr><tr><td rowspan=8 colspan=1>AR2-D</td><td rowspan=5 colspan=9>Negative sizeLearning rateBatch sizeTemperature TOptimizerScheduler</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1></td><td></td></tr><tr><td rowspan=1 colspan=1>64 64 64</td></tr><tr><td rowspan=1 colspan=1>1 1 1AdamW AdamW AdamW</td></tr><tr><td rowspan=1 colspan=1>Linear Linear Linear</td></tr><tr><td rowspan=2 colspan=9>Warmup proportionTraining step per iteration</td><td rowspan=1 colspan=1>0.1 0.1 0.1</td></tr><tr><td rowspan=1 colspan=1>500 500 500</td></tr><tr><td rowspan=1 colspan=9>Max step</td><td rowspan=1 colspan=1>5000 5000 5000</td></tr></table>
|
| 406 |
+
|
| 407 |
+
# A.4 MODEL CONFIGURATION AND EXPERIMENT SETTINGS
|
| 408 |
+
|
| 409 |
+
We list the detailed configuration of AR2 and baseline models in Table 9.
|
| 410 |
+
|
| 411 |
+
Table 9: Model configuration and experiment settings.
|
| 412 |
+
|
| 413 |
+
<table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>InitialModel</td><td rowspan=1 colspan=1>Parameters</td><td rowspan=1 colspan=1>FurtherPretrain</td><td rowspan=1 colspan=1>AdditionalData</td></tr><tr><td rowspan=1 colspan=1>DPR (Karpukhin et al., 2020)</td><td rowspan=1 colspan=1>BERT-Base</td><td rowspan=1 colspan=1>110M</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=1 colspan=1>ANCE (Xiong et al., 2021)</td><td rowspan=1 colspan=1>BERT/RoBERTa-Base</td><td rowspan=1 colspan=1>110M/125M</td><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=1>1</td></tr><tr><td rowspan=1 colspan=1>RocketQA (Qu et al., 2021)</td><td rowspan=1 colspan=1>ERNIE-2.0-BaseERNIE-2.0-Large</td><td rowspan=1 colspan=1>110M330M</td><td rowspan=1 colspan=1>--</td><td rowspan=1 colspan=1>1.7 M</td></tr><tr><td rowspan=1 colspan=1>PAIR (Ren et al., 2021)</td><td rowspan=1 colspan=1>ERNIE-2.0-BaseERNIE-2.0-Large</td><td rowspan=1 colspan=1>110M330M</td><td rowspan=1 colspan=1>--</td><td rowspan=1 colspan=1>1.7 M</td></tr><tr><td rowspan=1 colspan=1>Individual Top-k (Sachan et al., 2021a)</td><td rowspan=1 colspan=1>ERNIE-2.0-BaseT5-Large</td><td rowspan=1 colspan=1>110M739M</td><td rowspan=1 colspan=1>Yes1</td><td rowspan=1 colspan=1>-</td></tr><tr><td rowspan=1 colspan=1>coCondenser (Gao & Callan,2021a)</td><td rowspan=1 colspan=1>BERT-Base</td><td rowspan=1 colspan=1>110M</td><td rowspan=1 colspan=1>Yes</td><td rowspan=1 colspan=1>=</td></tr><tr><td rowspan=1 colspan=1>Our (AR2-G) (Retriever)Our (AR2-D) (Ranker)</td><td rowspan=1 colspan=1>ERNIE-2.0-BaseERNIE-2.0-Large</td><td rowspan=1 colspan=1>110M330M</td><td rowspan=1 colspan=1>Yes-</td><td rowspan=1 colspan=1>==</td></tr></table>
|
| 414 |
+
|
| 415 |
+
# A.5 ABLATION STUDY ON DIFFERENT INITIAL MODELS
|
| 416 |
+
|
| 417 |
+
Table 10 shows the results of our method with different initial models. We see that ERNIE-Base as the initial model achieves a little better performance than BERT-Base. And AR2-G using BERTBase as the initial model still achieves better performance than other methods under the same initial model. Meanwhile, ICT pre-training improves the performance of AR2-G.
|
| 418 |
+
|
| 419 |
+
Table 10: Performance of AR2-G on NQ test set with different initial model
|
| 420 |
+
|
| 421 |
+
<table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Initial Model</td><td rowspan=1 colspan=1>R@1</td><td rowspan=1 colspan=1>R@5</td><td rowspan=1 colspan=2>R@20</td><td rowspan=1 colspan=1>R@100</td></tr><tr><td rowspan=4 colspan=1>DPR (Karpukhin et al., 2020)ANCE (Xiong et al., 2021)RocketQA (Qu et al., 2021)PAIR (Ren et al.,2021)</td><td rowspan=4 colspan=1>BERT-BaseBERT-BaseERNIE-BaseERNIE-Base</td><td rowspan=4 colspan=1>1111</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=2>78.4</td><td rowspan=1 colspan=1>85.3</td></tr><tr><td rowspan=1 colspan=1>-</td><td rowspan=1 colspan=2>81.9</td><td rowspan=1 colspan=1>87.5</td></tr><tr><td rowspan=1 colspan=1>74.0</td><td rowspan=2 colspan=2>82.783.5</td><td rowspan=2 colspan=1>88.589.1</td></tr><tr><td rowspan=1 colspan=1>74.9</td></tr><tr><td rowspan=3 colspan=1>AR2-GAR2-GAR2-G</td><td rowspan=3 colspan=1>BERT-BaseERNIE-BaseERNIE-Base w/ ICT</td><td rowspan=3 colspan=1>56.757.258.7</td><td rowspan=1 colspan=1>76.1</td><td rowspan=1 colspan=2>85.0</td><td rowspan=1 colspan=1>89.3</td></tr><tr><td rowspan=2 colspan=1>76.677.9</td><td rowspan=1 colspan=1>85.3</td><td></td><td rowspan=1 colspan=1>89.8</td></tr><tr><td rowspan=1 colspan=2>86.0</td><td rowspan=1 colspan=1>90.1</td></tr></table>
|
| 422 |
+
|
| 423 |
+
# A.6 COMPARISON WITH SEVERAL EXISTING APPROACHES
|
| 424 |
+
|
| 425 |
+
Table 11 shows the comparison of AR2 and several existing retrieval approaches. “Extra Label” refers to whether the answer label is used. AR2 jointly optimizes both the retriever and the ranker according to a principle adversarial objective, which is the key difference with previous works.
|
| 426 |
+
|
| 427 |
+
Table 11: Comparison with existing approaches
|
| 428 |
+
|
| 429 |
+
<table><tr><td>Model</td><td>Extra Label</td><td>Retriever-Ranker/ Retriever-Reader</td><td>Adversarial Objective</td><td>Update Hard Negatives</td></tr><tr><td>FID-KD (Izacard & Grave,2020)</td><td>Yes</td><td>Yes</td><td>No</td><td>No</td></tr><tr><td>RDR(Yang& Seo,2020)</td><td>Yes</td><td>Yes</td><td>No</td><td>No</td></tr><tr><td>RocketQA (Qu et al.,2021)</td><td>No</td><td>Yes</td><td>No</td><td>Yes</td></tr><tr><td>ANCE (Xiong et al.,2021)</td><td>No</td><td>No</td><td>No</td><td>Yes</td></tr><tr><td>RIDER (Mao et al., 2021b)</td><td>Yes</td><td>Yes</td><td>No</td><td>No</td></tr><tr><td>AR2</td><td>No</td><td>Yes</td><td>Yes</td><td>Yes</td></tr></table>
|
| 430 |
+
|
| 431 |
+
# A.7 PERFORMANCE OF THE PIPELINE
|
| 432 |
+
|
| 433 |
+
Table 12 shows the performance of the retrieve-then-rank pipeline on Trivia QA and MS-MARCO. From the results of Table 6 and Table 12, we find that the ranker AR2-D improves the performance on all three benchmarks including NQ, Trivia QA, and MS-MARCO. Meanwhile, the pipeline based on AR2 achieves state-of-the-art performances on all benchmarks.
|
| 434 |
+
|
| 435 |
+
Table 12: The results of the second-stage ranking on Trivia QA and MS-MARCO.
|
| 436 |
+
|
| 437 |
+
<table><tr><td rowspan="2">Retriever</td><td rowspan="2">Ranker</td><td colspan="3">Trivia QA</td><td rowspan="2">MS-MARCO MRR@10</td></tr><tr><td>R@1</td><td>R@5</td><td>R@10</td><td>R@20</td></tr><tr><td>RepBERT (Zhan et al., 2020)</td><td>RepBERT (Zhan et al.,2020)</td><td>-</td><td>-</td><td>-</td><td>-</td><td>37.7</td></tr><tr><td>ME-HYBIRD (Luan et al., 2021)</td><td>ME-HYBIRD (Luan et al., 2021)</td><td>-</td><td>-</td><td>:</td><td>■</td><td>39.4</td></tr><tr><td>ME-BERT(Luan et al.,2021)</td><td>ME-BERT (Luan et al.,2021)</td><td>-</td><td>-</td><td>■</td><td>■</td><td>39.5</td></tr><tr><td>BM25 (Yang et al.,2017)</td><td>TFR-BERT (Han et al.,2020)</td><td>-</td><td>-</td><td>=</td><td>-</td><td>40.5</td></tr><tr><td>GAR+ (Mao et al.,2021a)</td><td>RIDER (Mao et al.,2021b)</td><td>71.9</td><td>77.5</td><td>79.8</td><td>81.8</td><td>-</td></tr><tr><td>AR2-G</td><td>■</td><td>64.2</td><td>78.2</td><td>81.8</td><td>84.4</td><td>39.5</td></tr><tr><td>AR2-G</td><td>AR2-D</td><td>73.0</td><td>82.1</td><td>84.1</td><td>85.8</td><td>43.2</td></tr></table>
|
| 438 |
+
|
| 439 |
+
# A.8 PERFORMANCE OF THE LARGE-SIZE MODEL
|
| 440 |
+
|
| 441 |
+
Table 13 shows the results of AR2-G (Retriever) initialized with ERNIE-2.0-Large (without continuous pre-training (ICT)). All baselines are initialized by large-size model, and DPR-PAQ (Oguz ˘ et al., 2021) utilizes a large external corpus $6 5 \mathrm { m }$ question-answer pairs) to continue pre-training the model; Individual Top-K (Sachan et al., 2021a) utilizes T5-Large model (739M parameters vs 330M parameters ERNIE-2.0-Large) as reader to guide the retriever. Compared with these baseline methods, AR2-G achieves a significant performance improvement, which further demonstrates the effectiveness of AR2-G (Retriever).
|
| 442 |
+
|
| 443 |
+
Table 13: The performance of large-size models on Natural Questions test set,
|
| 444 |
+
|
| 445 |
+
<table><tr><td></td><td>Size</td><td>R@1</td><td>R@5</td><td>R@20</td><td>R@100</td></tr><tr><td>DPR-PAQBERT (Oguz et al., 2021) DPR-PAQRoBERTa (Oguz et al., 2021)</td><td>Large Large</td><td>1 1</td><td>75.3 76.9</td><td>84.4 84.7</td><td>88.9 89.2</td></tr><tr><td>Individual Top-K (Sachan et al., 2021a) AR2-G AR2-G</td><td>Large Base Large</td><td>57.5 58.7 61.1</td><td>76.2 77.9 78.8</td><td>84.8 86.0 86.5</td><td>89.8 90.1 90.4</td></tr></table>
|
md/dev/MSBDFwGYwwt/MSBDFwGYwwt.md
ADDED
|
@@ -0,0 +1,297 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# TANKBind: Trigonometry-Aware Neural NetworKs for Drug-Protein Binding Structure Prediction
|
| 2 |
+
|
| 3 |
+
Wei Lu∗† Galixir Technologies
|
| 4 |
+
|
| 5 |
+
Qifeng Wu† Fudan University
|
| 6 |
+
|
| 7 |
+
Jixian Zhang† Galixir Technologies
|
| 8 |
+
|
| 9 |
+
Jiahua Rao Sun Yat-sen University
|
| 10 |
+
|
| 11 |
+
Chengtao Li Galixir Technologies
|
| 12 |
+
|
| 13 |
+
Shuangjia Zheng∗† Galixir Technologies Sun Yat-sen University
|
| 14 |
+
|
| 15 |
+
# Abstract
|
| 16 |
+
|
| 17 |
+
Illuminating interactions between proteins and small drug molecules is a longstanding challenge in the field of drug discovery. Despite the importance of understanding these interactions, most previous works are limited by hand-designed scoring functions and insufficient conformation sampling. The recently-proposed graph neural network-based methods provides alternatives to predict protein-ligand complex conformation in a one-shot manner. However, these methods neglect the geometric constraints of the complex structure and weaken the role of local functional regions. As a result, they might produce unreasonable conformations for challenging targets and generalize poorly to novel proteins. In this paper, we propose Trigonometry-Aware Neural networKs for binding structure prediction, TANKBind, that builds trigonometry constraint as a vigorous inductive bias into the model and explicitly attends to all possible binding sites for each protein by segmenting the whole protein into functional blocks. We construct novel contrastive losses with local region negative sampling to jointly optimize the binding interaction and affinity. Extensive experiments show substantial performance gains in comparison to state-of-the-art physics-based and deep learning-based methods on commonly-used benchmark datasets for both binding structure and affinity predictions with variant settings.
|
| 18 |
+
|
| 19 |
+
# 1 Introduction
|
| 20 |
+
|
| 21 |
+
Proteins are the workhorses of human bodies. They have a wide range of interaction partners, small molecules, other proteins, and DNA/RNA, for example. In this paper, we focus on drug-like small molecules as the interaction partners for proteins. The words ligands, drugs, small molecules and compounds are used interchangeably throughout the paper. Small molecules activate or inhibit activities of target proteins through mostly non-covalent interactions. In 2021, FDA approved 60 new drugs, among which 36 were small molecules Kinch et al. [2022]. Understanding the mechanismof-actions and off-target effects of drug molecules typically requires analyzing the structures of the related protein-ligand complexes Boopathi et al. [2021], Xie et al. [2011], but solving the complex structure experimentally is a an extremely challenging task. Despite tremendous effort spent on this topic over the last 50 years, only about 19,000 protein-ligand complex structures have been solved experimentally using $\mathbf { X }$ -ray, Cryo-EM or NMR Liu et al. [2015]. On the other hand, the estimated chemical space of drug is $\mathrm { 1 0 ^ { 6 \bar { 0 } } }$ and estimated number of unique proteins in human body is at least 20, 000, making the number of possible protein-ligand complex far exceeding the number of experimentally solved structures Reymond et al. [2010], Ponomarenko et al. [2016].
|
| 22 |
+
|
| 23 |
+
On the computational side, molecular docking is a commonly-used method for predicting the proteinligand complex structures the corresponding binding affinities Trott and Olson [2010], Friesner et al. [2004], Ackloo et al. [2022], Gentile et al. [2022]. Generally, the docking process involves three main stages: (1) locating favorable binding sites given a protein target; (2) sampling the ligand conformation as well as its position and orientation within these sites; (3) scoring and ranking the conformations of the complex using physics-inspired empirical energy functions to refine the structures and assess protein-ligand binding affinity. Due to its good interpretability and usability, docking has been integrated in drug development process for a long time and a number of successful cases have been reported Anderson [2003]. However, most open-source docking packages use atomlevel pairwise scoring functions, limiting the capacity to model the many-body effects. Moreover, they need to sample a large range of possible ligand poses and protein side-chain conformations, which leads to relatively high computational cost Trott and Olson [2010], Jain [2006].
|
| 24 |
+
|
| 25 |
+
To overcome these challenges, we propose a two-stage deep learning framework to neuralize the molecular docking process and predict the binding structures with better accuracy and lower computational cost. In the first stage, we segment the whole protein into functional blocks and predict their interactions with the ligand, creating an protein-ligand interaction energy landscape using a novel trigonometry-aware architecture. The trigonometry module has enough model capacity to capture many-body effects. In the second stage, we prioritize the crystallized binding structures by constrastively ensuring a weaker binding affinity for non-native interactions. In particular, our model improves the drug-protein binding structure predictions with a combination of (i) a novel trigonometry-aware architecture that jointly infuses trigonometry constraints and excluded-volume effects as inductive biases, (ii) a new divide-and-conquer strategy that constructs the protein-ligand local functional binding pairs in a contrastive manner. By doing so, we create a funnel-shape energy landscape for the inter-molecular interaction, removing the need of extensive sampling Jumper et al. [2021], Jain [2006], Chen et al. [2020a], Onuchic et al. [1997].
|
| 26 |
+
|
| 27 |
+
Our novel method is well-motivated by leveraging prior knowledge from physics and biology. Physically, the inter-molecular trigonometry module, inspired by the intra-molecular Evoformer module used in AlphaFold2 Jumper et al. [2021], ensures that our energy landscape disfavors configurations of protein-ligand complexes that are prohibited by laws of nature, for instance, no two atoms could overlap and the distances between atoms have to satisfy triangle inequality theorem in euclidean geometry. More details on these constraints is shown in section 3.3. Biologically, the functional regions of proteins tend to be more conserved and closely associated with binding De Juan et al. [2013], Glaser et al. [2003], allowing the model to learn critical information and generalize better to unseen proteins.
|
| 28 |
+
|
| 29 |
+
We evaluate our algorithm against several state-of-the-art deep learning and physics-based docking methods on task of binding structure prediction under multiple settings. Compared with baselines, our model increase the fraction of predictions with ligand root-mean-square deviation (RMSD) less than $5 \mathring \mathrm { A }$ by $16 \%$ in re-docking setting, $22 \%$ in self-docking setting, and $42 \%$ in the more difficult newprotein setting. Our model is also capable of predicting binding affinities, achieving better correlations with experimentally-measured values than sequence-based, structure-based and even complex-based methods. We also show that TankBind has the potential to discover novel mechanism-of-actions of drug molecules by identifying unseen protein binding sites.
|
| 30 |
+
|
| 31 |
+
# 2 Related Work
|
| 32 |
+
|
| 33 |
+
Geometric Deep Learning for drug discovery. There has been a surge of interest in integrating geometric priors for representation learning in the domain of drug discovery Jumper et al. [2021], Baek et al. [2021], Jing et al. [2021], Ganea et al. [2021], Jin et al. [2021], Ingraham et al. [2019], AlQuraishi [2019], Schütt et al. [2017], Somnath et al. [2021]. Recent researches have incorporated geometric information and symmetry properties of the input signals to improve the spatial perception of the learned representations. These works have been shown great potential in various applications like protein structure modeling Jumper et al. [2021], Baek et al. [2021], Jing et al. [2021], Ganea et al. [2021], molecular low-energy generation prediction Shi et al. [2021], Xu et al. [2022], Méndez-Lucio et al. [2021], property/function prediction Schütt et al. [2017], Somnath et al. [2021] and molecule design Jin et al. [2021], Ingraham et al. [2019]. Among which, AlphaFold 2 achieved outstanding performance in protein structure prediction Jumper et al. [2021], representing the state-of-the-art geometry-aware method. Our work is inspired from this groundbreaking work, adapting it from the intra-molecular structure prediction to the field of predicting the inter-molecular binding structure and binding affinity.
|
| 34 |
+
|
| 35 |
+

|
| 36 |
+
Figure 1: Overview of TankBind Model. The whole protein is divided into blocks of radius $2 0 \mathring \mathrm { A }$ , each block is going through the TankBind model along with the drug compound. Both protein blocks and drug compound are modeled as graphs. The block-compound interaction matrix evolved multiple times with additional input based on the distance maps of the protein block and the compound through trigonometry module. Based on the updated interaction embedding, the model predicts the binding affinity of the compound to the blocks and the block-ligand distance maps. A constrastive loss function is used to ensure the native block binds stronger to the compound than decoys.
|
| 37 |
+
|
| 38 |
+
Drug-protein Interaction (DPI) prediction. The goal of DPI prediction is to illustrate the binding structure and binding affinity between protein and ligand. Apart from docking-based approaches Trott and Olson [2010], Friesner et al. [2004], prior machine learning-based works either use complex-free models to predict the binding affinity directly from protein-ligand pairs Wang and Dokholyan [2021], Li et al. [2020], Tsubaki et al. [2019], Gao et al. [2018], Karimi et al. [2019], Zheng et al. [2020] or make predictions through complex structure that has been previously obtained by experimental or docking approaches Jiménez et al. [2018], Lim et al. [2019], Morrone et al. [2020]. The former ones are less interpretable while the latter requires data involved in vast experimental costs and labour. More recently, EquiBind Stärk et al. [2022] takes a new approach by directly predicting the key points on both the protein and the compound, and aligning their key points through the ingeniously designed optimal transport loss. However, this method may generate compound structures clashing with the protein structures and currently lacks the capability to predict the binding affinity, limiting its use in drug discovery. In contrast, our approach has a trigonometry module imposing geometry constraints and a state-of-the-art binding affinity prediction capability.
|
| 39 |
+
|
| 40 |
+
# 3 TankBind Model
|
| 41 |
+
|
| 42 |
+
# 3.1 Overview of TankBind model
|
| 43 |
+
|
| 44 |
+
The general protocol of our model is shown in figure 1. The encoding of protein and compound is described in section 3.2. The rationale and implementation of trigonometry module is detailed in section 3.3. The design of loss functions for training is described in section 3.4. The generation of atom coordinates from predicted inter-molecular distance map is introduced in section 3.5.
|
| 45 |
+
|
| 46 |
+
# 3.2 Structural encoders of protein and drug
|
| 47 |
+
|
| 48 |
+
Our model input is the separate structures of a protein and a drug compound, both encoded as graphs. Indices $i , k$ always operate on the residue dimension, $j , k ^ { \prime }$ always on the compound dimension. $n$ is the number of protein nodes and $m$ is the number of compound nodes.
|
| 49 |
+
|
| 50 |
+
Protein. The protein is represented as a proximity 3D graph following Jing et al. [2020]. We denote the protein graph as $\mathcal G ^ { p } = \mathsf { \bar { ( } } \mathcal V ^ { p } , \mathcal E ^ { p } )$ , where each node $\bar { \mathfrak { v } } _ { i } ^ { p } \in \mathcal { V } ^ { p }$ corresponds to an amino acid, and has feature $\mathbf { h } _ { \mathfrak { v } ^ { p } } ^ { ( i ) }$ with both scalar and vector features. Each node also has a position $\mathbf { x } _ { i } ^ { p } \in \mathbb { R } ^ { 3 }$ equal to the Cartesian coordinate of $C _ { \alpha _ { i } }$ . An edge $\mathfrak { e } _ { i k } ^ { p }$ exists if $\mathfrak { v } _ { k } ^ { p }$ is among the 30 nearest neighbors of $\mathfrak { v } _ { i } ^ { p }$ . Each edge ${ \mathfrak { e } } _ { i k } ^ { p } \in { \mathcal { E } } ^ { p }$ also encodes both the scalar and the vector features. We then apply the geometric vector perceptrons (GVP) Jing et al. [2020, 2021] to embed the protein and arrive at feature $\mathbf { h } ^ { p } \in \mathbb { R } ^ { n \times s }$ after graph propagation, where $n$ is the number of nodes and $s$ is the embedding size.
|
| 51 |
+
|
| 52 |
+
To implicitly model side-chain flexibility, we choose a residue-level representation ignoring the finer details of protein structure, separating our method from other methods that use all-atoms or surface vertexes representation Jiang et al. [2021], Gainza et al. [2020]. Also, as shown by Jumper et al. [2021, 2018], residue-level embedding is enough to infer the side-chain conformation.
|
| 53 |
+
|
| 54 |
+
Motivated by protein co-evolution De Juan et al. [2013] and divide-and-conquer theory, the protein graph, $\mathcal G ^ { p }$ , is further divided into subgraphs $\mathcal { G } ^ { p ^ { \prime } }$ . Each subgraph $\mathcal G ^ { p ^ { \prime } }$ includes all the $\mathfrak { v } _ { i } ^ { p }$ and $\mathfrak { e } _ { i j } ^ { p }$ inside the functional block. The subgraph is denoted as $\mathcal { G } ^ { p ^ { \prime } } = ( \{ \mathfrak { v } _ { i } ^ { p } , \mathfrak { e } _ { i k } ^ { p } \} \ | \| \mathbf { x } _ { i } ^ { p } - \mathbf { x } _ { o } \| \leq 2 0 \mathring { \mathrm { A } }$ , $\| \mathbf { x } _ { k } ^ { p } - \mathbf { x } _ { o } \| \leq$ $2 0 \mathring \mathrm { A } )$ , where $\mathbf { x } _ { o }$ is the center of the functional block predicted by a widely-used ligand-agnostic method, P2rank (published in 2018)Krivák and Hoksza [2018]. Justification for the size of radius and use of P2rank is described in appendix G.
|
| 55 |
+
|
| 56 |
+
Drug compound. The drug compound is represented as a graph using TorchDrug toolkit Zhu et al. [2022]. The compound graph is denoted as $\mathcal G ^ { c } = ( \mathcal V ^ { c } , \mathcal E ^ { c } )$ where each node ${ \mathfrak { v } } _ { j } ^ { c } \in \mathcal { V } ^ { c }$ corresponds to a heavy atom (non-hydrogen atom), and has feature $\mathbf { h } _ { \mathfrak { v } ^ { c } } ^ { ( j ) }$ and each edge ${ \mathfrak { e } } _ { j k ^ { \prime } } ^ { c }$ has feature $\mathbf { h } _ { \mathfrak { e } ^ { c } } ^ { ( j k ^ { \prime } ) }$ . We use Graph Isomorphism Network (GIN) $\mathrm { X u }$ et al. [2018] to embed the compound and arrive at feature $\mathbf { h } ^ { c } \in \mathbb { R } ^ { m \times s }$ after graph propagation, where $m$ is the number of heavy atoms and $s$ is the embedding size.
|
| 57 |
+
|
| 58 |
+
# 3.3 Details of trigonometry module
|
| 59 |
+
|
| 60 |
+
The compound feature, $\mathbf { h } ^ { c }$ , and the protein block feature, $\mathbf { h } ^ { p }$ , are used to form the initial interaction embedding $\mathbf { z } ^ { ( 0 ) } \in \mathbb { R } ^ { n \times m \times s }$ , ${ \bf z } _ { i j } ^ { ( 0 ) } = { \bf h } _ { i } ^ { p } \odot { \bf h } _ { j } ^ { c }$ . The interaction embedding will be further updated with pair distance map of protein nodes, $D _ { i k } ^ { p } = \| \dot { \mathbf { x } } _ { i } ^ { p } - \mathbf { x } _ { k } ^ { p } \|$ and pair distance map of compound nodes, $D _ { j k ^ { \prime } } ^ { c } = \left\| \mathbf { x } _ { j } ^ { c } - \mathbf { x } _ { k ^ { \prime } } ^ { c } \right\|$ .
|
| 61 |
+
|
| 62 |
+
The rationale for including both the pair distance map of the protein nodes and the pair distance map of the compound nodes in updating the protein-compound interaction embedding is explained with two simplified examples. As shown in the upper part of figure 2, if a protein node A is in close proximity with compound node B, then compound node C will not be in contact with node A due to the large distance constraint between node B and C. Distance constraint between compound nodes B and D could also force a node $\mathrm { D }$ to be in close contact with protein node A.
|
| 63 |
+
|
| 64 |
+
To build this observation of trigonometry constraints into our model, we design the following module to update the interaction embedding, in layer $\ell .$ , $\bar { \forall } ( i , j )$ :
|
| 65 |
+
|
| 66 |
+

|
| 67 |
+
Figure 2: Rationale for including trigonometry module. Upper: Protein node in square, compound nodes in circles. Lower: Trigonometry module ensures that the interaction between protein node $i$ and compound node $j$ depends on all protein and compound nodes $k , k ^ { \prime }$ .
|
| 68 |
+
|
| 69 |
+
$$
|
| 70 |
+
\widetilde { \mathbf { z } } _ { i j } ^ { ( \ell ) } = \mathbf { z } _ { i j } ^ { ( \ell ) } + \Phi \big ( \sum _ { k = 1 } ^ { n } \mathbf { p } _ { i k } \mathbf { t } _ { k j } ^ { ( \ell ) } + \sum _ { k ^ { \prime } = 1 } ^ { m } \mathbf { t } _ { i k ^ { \prime } } ^ { \prime ( \ell ) } \mathbf { c } _ { k ^ { \prime } j } \big ) \odot \mathbf { g } \big ( \mathbf { z } _ { i j } ^ { ( \ell ) } \big )
|
| 71 |
+
$$
|
| 72 |
+
|
| 73 |
+
where $\mathbf { p } _ { i k } = \phi ( D _ { i k } ^ { p } )$ is the linear embedding of encoded pair distance between protein nodes. $\mathbf { p } \in$ $\mathbb { R } ^ { n \times n \times s }$ , $n$ is the number of nodes in protein block, $s$ is the embedding size. ${ \bf c } _ { j k ^ { \prime } } = \phi ( D _ { j k ^ { \prime } } ^ { c } )$ is the linear embedding of encoded pair distance between compound nodes. $\mathbf { c } \in \mathbb { R } ^ { m \times m \times s }$ , $m$ is the number of compound nodes. t(ℓ)ij and t′(ℓ)ij are the same gated linear transformations of $\mathbf { z } _ { i j } ^ { ( \ell ) }$ but with nonared parameters, $\mathbf t _ { i j } ^ { ( \ell ) } = \mathrm { L i n e a r } ( \mathbf z _ { i j } ^ { ( \ell ) } ) \odot \mathbf { g } ( \mathbf z _ { i j } ^ { ( \ell ) } ) , \mathbf t ^ { ( \ell ) } \in \mathbb { R } ^ { n \times m \times s } , \mathbf { g } ( \mathbf z _ { i j } ^ { ( \ell ) } ) = \mathrm { s i g m o i d } ( \mathrm { L i n e a r } ( \mathbf z _ { i j } ^ { ( \ell ) } ) ) ,$ $\Phi$ is a layernorm function followed by a linear transformation.
|
| 74 |
+
|
| 75 |
+
Another type of physical constraint need to be take into consideration is the excluded-volume (Van Der Waals) and saturation effect. As shown in the upper figure 2, if protein node A forms a strong interaction, hydrogen bonding for example, with compound node B, then node $\mathbf { D }$ is unlikely to form the same type of interaction with node A because node A has limited number of hydrogen donors or acceptors. To account for these effects, we designed a self-attention module to modulate the interaction between a protein node and all compound nodes by taking the whole interaction between this protein node and all compound nodes into consideration.
|
| 76 |
+
|
| 77 |
+
$$
|
| 78 |
+
\begin{array} { r l } & { \dot { \mathbf { z } } _ { i j } ^ { ( \ell ) } = \tilde { \mathbf { z } } _ { i j } ^ { ( \ell ) } + \Phi ( \mathrm { c o n c a t } _ { h } \big ( \displaystyle \sum _ { k ^ { \prime } = 1 } ^ { m } ( w _ { i j k ^ { \prime } } ^ { ( \ell ) h } \mathbf { v } _ { i k ^ { \prime } } ^ { ( \ell ) h } ) \odot \mathbf { g } ^ { h } ( \tilde { \mathbf { z } } _ { i j } ^ { ( \ell ) } ) \big ) ) } \\ & { w _ { i j k ^ { \prime } } ^ { ( \ell ) h } = \mathrm { s o f t m a x } _ { k ^ { \prime } } ( \mathbf { q } _ { i j } ^ { ( \ell ) h ^ { \top } } \mathbf { k } _ { i k ^ { \prime } } ^ { ( \ell ) h } ) } \end{array}
|
| 79 |
+
$$
|
| 80 |
+
|
| 81 |
+
, where q(ℓ)ij $\mathbf { q } _ { i j } ^ { ( \ell ) h } , \mathbf { k } _ { i j } ^ { ( \ell ) h } , \mathbf { v } _ { i j } ^ { ( \ell ) h }$ are linear transformation of $\tilde { \mathbf { z } } _ { i j } ^ { ( \ell ) }$ , $h$ is number of attention heads. Function $\mathbf { g } ^ { h }$ is the standard $\mathbf { g }$ with reshaping the embedding into heads at the end, is a linear transformation.
|
| 82 |
+
|
| 83 |
+
Lastly, a non-linear transition module is added to transit the interaction embedding to the next layer through multilayer perceptron, z(ℓij $\mathbf z _ { i j } ^ { ( \ell + 1 ) } = \mathbf { M L P } ( \dot { \mathbf z } _ { i j } ^ { ( \ell ) } )$ . The whole trigonometry module is composed of three consecutive parts, the trigonometry update, the self-attention modulation, and the non-linear transition module. Layernorm is applied on every input $\mathbf { z } _ { i j } ^ { ( \ell ) }$ and a $25 \%$ dropout is applied to the trigonometry update and self-attention modulation during training. The final outputs, drug-protein binding affinity, $\begin{array} { r } { \hat { a } = \sum _ { i = 1 } ^ { n } \sum _ { j = 1 } ^ { m } } \end{array}$ Linear $( \mathbf { z } _ { i j } ^ { ( L ) } )$ , and inter-molecular distance map, Dpredij = $D _ { i j } ^ { p r e d } = \mathbf { g } ( \mathbf { z } _ { i j } ^ { ( L ) } ) \mathrm { L i n e a r } ( \mathbf { z } _ { i j } ^ { ( L ) } )$ , are predicted directly based on the last layer embedding $\mathbf { z } _ { i j } ^ { ( L ) }$ , where $L$ is the number of module stacks.
|
| 84 |
+
|
| 85 |
+
# 3.4 Design of binding interaction and affinity loss functions
|
| 86 |
+
|
| 87 |
+
Many previous works model the interaction between compound and protein by only preserving the interaction region, residues that far away are ignored Townshend et al. [2020], Méndez-Lucio et al. [2021]. On the positive side, the computation and memory demand for characterize the interaction between protein and the drug compound is greatly reduced by focusing on regional interaction. But the fact of not binding to alternative binding sites is also a valuable information. By the nature of crystallization, if a protein-compound complex could be successfully crystallized, other possible binding sites on this protein definitely bind less strongly than the native binding site to the compound, therefore, those other binding sites could be used as high-valued decoys. Based on this observation, we designed a max-margin constrastive affinity loss, equation 4, following the idea of Hadsell et al. [2006]. Such that the compound’s predicted affinity, $\hat { a }$ , to the decoys is less than the experimentally measured affinity, $a$ , by a margin value, $\epsilon$ .
|
| 88 |
+
|
| 89 |
+
$$
|
| 90 |
+
\mathcal { L } _ { \mathrm { a f f i n i t y } } ( \hat { a } _ { \zeta } , a ) = \mathbb { 1 } ( \zeta ) ( \hat { a } _ { \zeta } - a ) ^ { 2 } + ( 1 - \mathbb { 1 } ( \zeta ) ) \operatorname* { m a x } ( 0 , \hat { a } _ { \zeta } - ( a - \epsilon ) ) ^ { 2 }
|
| 91 |
+
$$
|
| 92 |
+
|
| 93 |
+
where $\hat { a } _ { \zeta }$ is the predicted affinity to block $\zeta$ , and indicator function $\mathbb { 1 } ( \zeta ) = 1$ when block $\zeta$ encloses the native ligand, and $\mathbb { 1 } ( \zeta ) = 0$ otherwise. We, therefore, take full use of information stored in the whole protein instead of only the native binding region. We also include a mean squared erorr (MSE) loss for native interaction distance map, $\begin{array} { r } { \mathcal { L } _ { \mathrm { d i s t a n c e } } = \mathbb { 1 } ( \zeta ) \frac { 1 } { n m } \sum _ { i = 1 } ^ { n } \sum _ { j = 1 } ^ { m } ( D _ { i j } ^ { p r e d } - D _ { i j } ) ^ { 2 } } \end{array}$ . The overall training objective of TankBind is: $\mathcal { L } = \mathcal { L } _ { \mathrm { a f f u n i t y } } + \mathcal { L } _ { \mathrm { d i s t a n c t } }$ e .
|
| 94 |
+
|
| 95 |
+
# 3.5 Generation of drug coordinates based on predicted inter-molecular distance map.
|
| 96 |
+
|
| 97 |
+
The Cartesian coordinates, $\big \{ \hat { \mathbf { x } } _ { j } ^ { c } \big \}$ , of the heavy atoms of a drug compound could be deduced analytically based on the predicted inter-molecular distance matrix, $D _ { i j } ^ { p r e d }$ , the coordinates of protein nodes, $\{ \mathbf { x } _ { i } ^ { p } \}$ , and the pair distance matrix of compound nodes, $D _ { j k ^ { \prime } } ^ { c }$ Masters et al. [2022], Hoffmann and Noé [2019]. But since predicted distance matrix contains noise, we take a numerical approach Masters et al. [2022], Zsoldos et al. [2007]. By minimizing the total loss, $\mathcal { L } _ { \mathrm { g e n e r a t i o n } }$ , which consists of two parts, the interaction loss and the compound configuration loss, we could derive the coordinates
|
| 98 |
+
|
| 99 |
+
Table 1: Blind self-docking. All models take a pair of ligand structure (generated by RDKit) and protein structure as input, trying to predict the atom coordinates of the ligand after binding. In blind docking, the protein binding site is assumed unknown. Test set is composed of 363 protein-ligand structure crystallized after 2019 curated by PDBbind database. Details about model runtime and the number of model parameters are in appendix C
|
| 100 |
+
|
| 101 |
+
<table><tr><td></td><td colspan="4">Ligand RMSD Percentiles ↓</td><td colspan="2">% Below Threshold</td><td colspan="4">Centroid Distance Percentiles↓</td><td colspan="2">% Below Threshold 个</td></tr><tr><td>Methods</td><td>25%</td><td>50%</td><td>75%</td><td>Mean</td><td>2A</td><td>个 5A</td><td>25%</td><td>50%</td><td>75%</td><td>Mean</td><td>2A</td><td>5A</td></tr><tr><td>QVINA-W</td><td>2.5</td><td>7.7</td><td>23.7</td><td>13.6</td><td>20.9</td><td>40.2</td><td>0.9</td><td>3.7</td><td>22.9</td><td>11.9</td><td>41.0</td><td>54.6</td></tr><tr><td>GNINA</td><td>2.8</td><td>8.7</td><td>22.1</td><td>13.3</td><td>21.2</td><td>37.1</td><td>1.0</td><td>4.5</td><td>21.2</td><td>11.5</td><td>36.0</td><td>52.0</td></tr><tr><td>SMINA</td><td>3.8</td><td>8.1</td><td>17.9</td><td>12.1</td><td>13.5</td><td>33.9</td><td>1.3</td><td>3.7</td><td>16.2</td><td>9.8</td><td>38.0</td><td>55.9</td></tr><tr><td>GLIDE(c.)</td><td>2.6</td><td>9.3</td><td>28.1</td><td>16.2</td><td>21.8</td><td>33.6</td><td>0.8</td><td>5.6</td><td>26.9</td><td>14.4</td><td>36.1</td><td>48.7</td></tr><tr><td>VINA</td><td>5.7</td><td>10.7</td><td>21.4</td><td>14.7</td><td>5.5</td><td>21.2</td><td>1.9</td><td>6.2</td><td>20.1</td><td>12.1</td><td>26.5</td><td>47.1</td></tr><tr><td>EQUIBIND-U</td><td>3.3</td><td>5.7</td><td>9.7</td><td>7.8</td><td>7.2</td><td>42.4</td><td>1.3</td><td>2.6</td><td>7.4</td><td>5.6</td><td>40.0</td><td>67.5</td></tr><tr><td>EQUIBIND</td><td>3.8</td><td>6.2</td><td>10.3</td><td>8.2</td><td>5.5</td><td>39.1</td><td>1.3</td><td>2.6</td><td>7.4</td><td>5.6</td><td>40.0</td><td>67.5</td></tr><tr><td>TANKBind-R</td><td>2.8</td><td>5.2</td><td>11.2</td><td>9.4</td><td>16.0</td><td>47.9</td><td>1.0</td><td>2.3</td><td>7.7</td><td>7.3</td><td>44.9</td><td>69.4</td></tr><tr><td>TANKBind-C</td><td>2.4</td><td>4.5</td><td>8.4</td><td>8.2</td><td>19.6</td><td>54.8</td><td>0.9</td><td>1.9</td><td>5.4</td><td>6.3</td><td>53.2</td><td>73.3</td></tr><tr><td>TANKBind-P</td><td>2.6</td><td>4.5</td><td>8.1</td><td>8.5</td><td>16.3</td><td>54.0</td><td>0.9</td><td>1.9</td><td>5.2</td><td>6.4</td><td>53.2</td><td>74.4</td></tr><tr><td>TANKBind</td><td>2.4</td><td>4.0</td><td>7.7</td><td>7.4</td><td>19.3</td><td>61.7</td><td>0.9</td><td>1.7</td><td>4.2</td><td>5.5</td><td>56.5</td><td>77.4</td></tr></table>
|
| 102 |
+
|
| 103 |
+
of the docked drug coordinates, $\big \{ \hat { \mathbf { x } } _ { j } ^ { c } \big \}$
|
| 104 |
+
|
| 105 |
+
$$
|
| 106 |
+
\mathcal { L } _ { \mathrm { g e n e r a t i o n } } = \mathcal { L } _ { \mathrm { i n t e r a c i o n } } + \mathcal { L } _ { \mathrm { c o n f i g u r a t i o n } } = \sum _ { i } ^ { n } \sum _ { j } ^ { m } ( | \hat { D } _ { i j } - D _ { i j } ^ { p r e d } | ) + \sum _ { j } ^ { m } \sum _ { k ^ { \prime } } ^ { m } ( | \hat { D } _ { j k ^ { \prime } } ^ { c } - D _ { j k ^ { \prime } } ^ { c } | )
|
| 107 |
+
$$
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
\hat { D } _ { i j } = \big \| \mathbf x _ { i } ^ { p } - \hat { \mathbf x } _ { j } ^ { c } \big \| , \hat { D } _ { j k ^ { \prime } } ^ { c } = \big \| \hat { \mathbf x } _ { j } ^ { c } - \hat { \mathbf x } _ { k ^ { \prime } } ^ { c } \big \|
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
where $n$ is the number of protein nodes, and $m$ is number of compound nodes, and $\{ \mathbf { x } _ { j } ^ { p } \}$ are the Cartesian coordinates of protein nodes. All inter-molecular distances are clamped to have an upper bound of $1 0 \mathring \mathrm { A }$ to focus on the direct interaction. In self-docking setting, when the compound configuration is unknown, we add a local atomic structures (LAS) maskflexibility while enforcing basic geometric constraint, $\begin{array} { r } { \mathcal { L } _ { \mathrm { c o n f i g u r a t i o n } } = \sum _ { j } ^ { m } \sum _ { k ^ { \prime } } ^ { m } \mathbb { 1 } ( j , k ^ { \prime } ) ( | \hat { D } _ { j k ^ { \prime } } ^ { c } - D _ { j k ^ { \prime } } ^ { c } | ) } \end{array}$ where $\mathbb { 1 } ( j , k ^ { \prime } ) = 1$ when compound atom $j$ and are connected by connected by a bond, or 2-hop away, or in the same ring structure, and $\mathbb { 1 } ( j , k ^ { \prime } ) = 0$ otherwise Stärk et al. [2022], Trott and Olson [2010]. For every test protein-ligand pair, TankBind predicts the binding affinity of the ligand to all segmented functional blocks and chooses the one with strongest affinity to generate the binding structures.
|
| 114 |
+
|
| 115 |
+
# 4 Evaluation
|
| 116 |
+
|
| 117 |
+
# 4.1 Protein-ligand binding structure prediction
|
| 118 |
+
|
| 119 |
+
Dataset. We used publicly available PDBbind v2020 dataset Liu et al. [2015] which has the structures of 19443 protein-ligand complexes along with their experimentally measured binding affinity. PDBbind is a database curated based on the Protein Data Bank (PDB) Burley et al. [2021]. We followed the same time split as defined in EquiBind paper Stärk et al. [2022] in which the training and validation data are the protein-ligand complex structures deposited before 2019 and the test set is the structures deposited after 2019. After removing a few structures that unable to process using RDKit from the training set, we had 17787 structures for training, 968 for validation and 363 for testingLandrum et al. [2013]. We also reduced the possibility of encountering equally valid binding sites by removing chains that have no atom within $1 0 \mathring \mathrm { A }$ from any atom of the ligand following the protocol described in Stärk et al. [2022].
|
| 120 |
+
|
| 121 |
+
Baselines. We compared TankBind with the most widely-used docking method AutoDock VinaTrott and Olson [2010] and the recent proposed geometry-based DL method EquiBind Stärk et al. [2022]. We also included four popular docking methods QVina-W, GINAMcNutt et al. [2021], SMINAKoes et al. [2013] and GLIDEFriesner et al. [2004] as listed in Stärk et al. [2022].
|
| 122 |
+
|
| 123 |
+
Table 2: Blind self-docking for unseen receptors. All models evaluated on 142 crystallized proteincompound structures where the proteins have not been observed in training set.
|
| 124 |
+
|
| 125 |
+
<table><tr><td rowspan="3"></td><td colspan="4">Ligand RMSD Percentiles ↓</td><td colspan="2">%Below</td><td colspan="4">Centroid Distance Percentiles ↓</td><td rowspan="2" colspan="2">% Below Threshold</td></tr><tr><td colspan="4"></td><td colspan="2">个 Threshold</td><td colspan="4"></td></tr><tr><td>25%</td><td>50%</td><td>75%</td><td>Mean</td><td>2A</td><td>5A</td><td>25%</td><td>50%</td><td>75%</td><td>Mean</td><td>2A</td><td>5A</td></tr><tr><td>QVINA-W</td><td>3.4</td><td>10.3</td><td>28.1</td><td>16.9</td><td>15.3</td><td>31.9</td><td>1.3</td><td>6.5</td><td>26.8</td><td>15.2</td><td>35.4</td><td>47.9</td></tr><tr><td>GNINA</td><td>4.5</td><td>13.4</td><td>27.8</td><td>16.7</td><td>13.9</td><td>27.8</td><td>2.0</td><td>10.1</td><td>27.0</td><td>15.1</td><td>25.7</td><td>39.5</td></tr><tr><td>SMINA</td><td>4.8</td><td>10.9</td><td>26.0</td><td>15.7</td><td>9.0</td><td>25.7</td><td>1.6</td><td>6.5</td><td>25.7</td><td>13.6</td><td>29.9</td><td>41.7</td></tr><tr><td>GLIDE</td><td>3.4</td><td>18.0</td><td>31.4</td><td>19.6</td><td>19.6</td><td>28.7</td><td>1.1</td><td>17.6</td><td>29.1</td><td>18.1</td><td>29.4</td><td>40.6</td></tr><tr><td>VINA</td><td>7.9</td><td>16.6</td><td>27.1</td><td>18.7</td><td>1.4</td><td>12.0</td><td>2.4</td><td>15.7</td><td>26.2</td><td>16.1</td><td>20.4</td><td>37.3</td></tr><tr><td>EQUIBIND-U</td><td>5.7</td><td>8.8</td><td>14.1</td><td>11.0</td><td>1.4</td><td>21.5</td><td>2.6</td><td>6.3</td><td>12.9</td><td>8.9</td><td>16.7</td><td>43.8</td></tr><tr><td>EQUIBIND</td><td>5.9</td><td>9.1</td><td>14.3</td><td>11.3</td><td>0.7</td><td>18.8</td><td>2.6</td><td>6.3</td><td>12.9</td><td>8.9</td><td>16.7</td><td>43.8</td></tr><tr><td>TANKBind-R</td><td>3.6</td><td>6.9</td><td>17.0</td><td>12.6</td><td>5.6</td><td>35.2</td><td>1.3</td><td>3.6</td><td>15.7</td><td>10.3</td><td>35.2</td><td>58.5</td></tr><tr><td>TANKBind-C</td><td>3.4</td><td>5.5</td><td>9.8</td><td>9.9</td><td>9.2</td><td>43.0</td><td>1.1</td><td>2.6</td><td>8.1</td><td>7.9</td><td>46.5</td><td>65.5</td></tr><tr><td>TANKBind-P</td><td>3.3</td><td>5.5</td><td>10.9</td><td>11.2</td><td>5.6</td><td>45.1</td><td>1.3</td><td>2.3</td><td>7.9</td><td>9.1</td><td>47.9</td><td>66.9</td></tr><tr><td>TANKBind</td><td>2.9</td><td>4.7</td><td>8.8</td><td>9.1</td><td>4.9</td><td>55.6</td><td>1.3</td><td>2.3</td><td>4.8</td><td>7.0</td><td>45.1</td><td>75.4</td></tr></table>
|
| 126 |
+
|
| 127 |
+
Evaluation metrics. We follow prior work Stärk et al. [2022] and use ligand root-mean-square deviation (RMSD) of atomic positions and centroid distance to compare predicted binding structures with ground-truths. The Ligand RMSD calculates the normalized Frobenius norm of the two corresponding matrices of ligand coordinates. The centroid distance is defined as the the distance between the averaged 3D coordinates of the predicted and ground-truth bound ligand atoms, indicating the model capability of identifying correct binding region. Hydrogens are not involved in the calculation.
|
| 128 |
+
|
| 129 |
+
Performance in blind flexible self-docking We start with a real-world blind self-docking experiment, in which the ligand conformation is not fixed, and the result of re-docking experiment, in which the native ligand conformation is given, is reported in Appendix A. As shown in the table 1, TankBind achieves state-of-the-art performance, outperforming geometry DL-based model EquiBind. This advantage is particularly evident in the top $2 5 \%$ and top $50 \%$ ligand RMSD, which allows our method to predict $22 \%$ more qualified (below Threshold $5 \mathring \mathrm { A }$ ) binding poses than EquiBind. This results are also consistent in the metrics of centroid distance, demonstrating that our method also has a clear advantage in the identification of binding region. Even though GLIDE (commercial) and Autodock Vina are established docking software with more than a decade of continuous development, our model remarkably frequently outperforms them. At the same time, we are orders of magnitude faster than them, and on the same level as EquiBind (Appendix C). In addition, we explore the possible of TankBind-R, where we randomly segment the protein, TankBind-P, where we only doing the summation over protein nodes in equation 1, and TankBind-C, where we only sum over compound nodes. The performance reduction on the these variants supports our view that trigonometry message passing between proteins and ligand and segmentation choice are critical to the prediction of binding structures.
|
| 130 |
+
|
| 131 |
+
Performance in self-docking unseen protein We next focus on the new protein setting, in which the tested proteins have not been observed in the training set. Table 2 shows that Tankbind leads to larger improvements over EquiBind and docking methods with regard to ligand-RMSD and centriod distance.This is in line with our expectation that TankBind has better generalization ability due to the physical-inspired trigonometry module and explicit consideration of conservative functional blocks. In this setting, as shown in Figure 3 and table 2, for fractions smaller than $2 \mathring \mathrm { A }$ , 5Å and $1 5 \mathring \mathrm { A }$ , the performance between EquiBind and other docking method are comparable, while TankBind is always better by a large margin, further confirming the effectiveness of our method and indicating that the proposed strategy has practical values for the virtual screening of new proteins.
|
| 132 |
+
|
| 133 |
+

|
| 134 |
+
Figure 3: Estimator of the Cumulative Distribution Function (ECDF) plot for ligand RMSD (left) and Centroid Distance (right) from result evaluated on new receptors subset. The x axis of the figure stops at $1 5 \mathring \mathrm { A }$ because comparison for larger RMSD is less meaningful when the predicted location of the ligand is away from the true binding site, a RMSD of $1 5 \mathring \mathrm { A }$ is not better than RMSD of $5 0 \mathring \mathrm { A }$ .
|
| 135 |
+
|
| 136 |
+
<table><tr><td>Methods</td><td colspan="3">Ligand↓Centroid↓Below2A↑Below5A↑</td></tr><tr><td>w/o P2Rank</td><td>9.37</td><td>7.30 44.90</td><td>69.42</td></tr><tr><td>w/o Trig</td><td>8.73</td><td>6.44 44.08</td><td>74.93</td></tr><tr><td>TAPE</td><td>8.81</td><td>6.89 50.69</td><td>73.00</td></tr><tr><td>GAT</td><td>8.27</td><td>6.23 56.47</td><td>78.51</td></tr><tr><td>TankBind-P</td><td>8.47</td><td>6.44 53.17</td><td>74.38</td></tr><tr><td>TankBind-C</td><td>8.20 6.27</td><td>53.17</td><td>73.28</td></tr><tr><td>Origin</td><td>7.43</td><td>5.51 56.47</td><td>77.41</td></tr></table>
|
| 137 |
+
|
| 138 |
+
Table 4: Ablation results. We listed four main metrics here, a complete table is in appendix E
|
| 139 |
+
|
| 140 |
+
<table><tr><td>Methods</td><td colspan="3">RMSE↓Pearson↑Spearman↑MAE↓</td></tr><tr><td>TransCPI</td><td>1.741 0.576</td><td>0.540</td><td>1.404</td></tr><tr><td>MONN</td><td>1.438 0.624</td><td>0.589</td><td>1.143</td></tr><tr><td>PIGNet※</td><td>2.640 0.511</td><td>0.489</td><td>2.110</td></tr><tr><td>IGN</td><td>1.433 0.698</td><td>0.641</td><td>1.169</td></tr><tr><td>HOLOPROT</td><td>1.546 0.602</td><td>0.571</td><td>1.208</td></tr><tr><td>STAMPDPI</td><td>1.658 0.545</td><td>0.411</td><td>1.325</td></tr><tr><td>TANKBind</td><td>1.346 0.726</td><td>0.703</td><td>1.070</td></tr></table>
|
| 141 |
+
|
| 142 |
+
Table 3: Binding affinity prediction. TankBind achieves SOTA on all four metrics.
|
| 143 |
+
|
| 144 |
+
# 4.2 Protein-ligand binding affinity prediction
|
| 145 |
+
|
| 146 |
+
TankBind is also capable of predicting protein-ligand binding affinity because of the constrastive affinity loss function. Since we segmented the whole protein into protein blocks, the predicted binding affinity of ligand to the whole protein is equal to the binding affinity to the one protein block that predicted to bind strongest with the ligand. To demonstrate the ability, we compared TankBind with the state-of-the-art binding affinity prediction models.
|
| 147 |
+
|
| 148 |
+
Dataset. We split the dataset into training, test and validation splits based on the same time split described earlier. The experimentally measured affinity data in PDBbind dataset has three different names, depending on the exact experiment setups, $50 \%$ inhibiting concentration (IC50), inhibition constant $( K _ { i } )$ , and dissociation constant $( K _ { D } )$ , all converted to the unit of molar concentration. Similar to previous methods Somnath et al. [2021], Townshend et al. [2020], we predict negative log-transformed binding affinity.
|
| 149 |
+
|
| 150 |
+
Baselines and evaluation metrics. We compare TankBind against two state-of-the-art sequencebased methods, TransformerCPI Chen et al. [2020b] and MONN Li et al. [2020], two complex-based methods, IGN Jiang et al. [2021] and PIGNet Moon et al. [2022] both requiring prior knowledge of the inter-molecular structure to predict affinity, and two structure-based methods, HOLOPTOT Somnath et al. [2021] and STAMPDPI Wang et al. [2022]. For evaluating various methods, we use four metrics – root mean squared error (RMSE), Pearson correlation coefficient, Spearman correlation coefficient and mean absolute error (MAE). We also include the mean and standard deviation across 3 experimental runs in appendix D.
|
| 151 |
+
|
| 152 |
+

|
| 153 |
+
Figure 4: (a) An example of TankBind identifying an unseen binding site. The protein is shown in white, co-crystallized compounds of three PDBs in the training set is shown in purple. The ligand of 6K1S is shown in green. TankBind is able to find this correct pose for the compound, shown in red, while the other two, Vina in orange, and Equibind in cyan, place the compound away from the true binding site. (b) For PDB 6QRG, both protein and compound have not been seen in the training set. But TankBind still find the correct pose. Crystallized ligand colored in green, TankBind prediction in red, EquiBind in cyan and Vina result in organ.
|
| 154 |
+
|
| 155 |
+
Result As shown in Table 3, our model obtains the best performance in PDBbind test set, consistently outperforms SOTA binding affinity prediction methods. Note that even without the prior interaction information, TankBind also achieves better result than complex-based methods (PIGNET and IGN), proving that the predicted binding structural information provided considerable gain to the affinity prediction task.
|
| 156 |
+
|
| 157 |
+
# 4.3 Ablation study
|
| 158 |
+
|
| 159 |
+
We conducted ablation studies to investigate factors that influence the performance of proposed TankBind framework. As shown in Table 4, the original version of TankBind with the trigonometry message passing between protein and ligand shows the best performance among all architectures. Replacing the P2rank with a randomly split of blocks performed the worst, which verifies our hypothesis that functional block segmentation can improve generalization. Simple architecture substitutions for protein (TAPE) Rao et al. [2019] and molecular representation (GAT) Velickovi ˇ c´ et al. [2017] decrease slightly the model performance. Replacing the intra-trigonometry module with the uni-modal variants (TankBind-P and TankBind-C) both caused noticeable decreases in performances.
|
| 160 |
+
|
| 161 |
+
# 4.4 Case studies
|
| 162 |
+
|
| 163 |
+
TankBind correctly identifies an unseen binding site for a new drug compound. As a representative case, in PDB 6K1S, a seen protein binds to a new drug compound at a site that has not been observed before. This protein has three co-crystallized complex structures in the training set, PDB 4X60, 4X61, 4X63. As shown in the left of figure 4, our method, shown in red, aligns well with the true ligand, shown in green, despite our method has never seen any compound locates at this site before. While other two methods, EquiBind in cyan, Vina in orange identify an incorrect site for this compound. Packages Kalign, Biopython, and Smith-Waterman library are used to systematically analyze the results Lassmann [2020], Cock et al. [2009], Li et al. [2020], Zhao et al. [2013] (see Appendix H).
|
| 164 |
+
|
| 165 |
+
TankBind finds the correct pose when both compound and protein are unseen. We picked two representative examples with both compound and protein are unseen, one, PDB 6QRG, in the right of figure 4 and another, PDB 6KQI, in appendix B. Both PDB 6QRG and PDB 6KQI have max protein similarity below 0.8 (6QRG 0.78, 6KQI 0.57), and max compound similarity below 0.4 (6QRG 0.36, 6KQI 0.27).
|
| 166 |
+
|
| 167 |
+
# 5 Conclusion
|
| 168 |
+
|
| 169 |
+
In this work, we propose a novel binding structure and affinity prediction model, TankBind, that builds trigonometry constraints into the model and explicitly attends to all possible binding sites by segmenting the whole protein into functional blocks. We observe significant improvements on task of binding structure prediction over existing deep learning methods: a $22 \%$ increase in the fraction of prediction below $\bar { 5 } \mathring { \mathrm { A } }$ in ligand RMSD, and a $42 \%$ increase when the proteins have not been observed in the training set. Moreover, we demonstrate that the model is able to predict affinity and outperform SOTA methods on PDBbind. This work opens a new direction for modelling the inter-molecular interaction between protein and drug molecule. Numerous directions for further exploration include incorporating a ligand conformer generation module, enhancing the dataset with AlphaFold-predicted structure and public available SAR data, integrating the segmentation of functional block in an end-to-end manner, and combining the model with protein backbone dynamics modeling to handle larger scale conformation changes induced by drug-protein interactions.
|
| 170 |
+
|
| 171 |
+
# Acknowledgments and Disclosure of Funding
|
| 172 |
+
|
| 173 |
+
We thank Prof.Yuedong Yang, Dr.Leilei Shi, Dr. Jiahui Tong for their helpful discussions; Penglei Wang for his support in binding affinity experiments; Meihui Song for her support in figure drawing. We thank the Guangzhou National Supercomputer Center for providing computational source. S. $\textsf { Z }$ acknowledges support from the National Key R&D Program of China (2020YFB0204803) and National Natural Science Foundation of China (21773313 and 61772566).
|
| 174 |
+
|
| 175 |
+
# References
|
| 176 |
+
|
| 177 |
+
Michael S Kinch, Zachary Kraft, and Tyler Schwartz. 2021 in review: Fda approvals of new medicines. Drug discovery today, 2022.
|
| 178 |
+
|
| 179 |
+
Subramanian Boopathi, Adolfo B Poma, and Ponmalai Kolandaivel. Novel 2019 coronavirus structure, mechanism of action, antiviral drug promises and rule out against its treatment. Journal of Biomolecular Structure and Dynamics, 39(9):3409–3418, 2021.
|
| 180 |
+
|
| 181 |
+
Lei Xie, Li Xie, and Philip E Bourne. Structure-based systems biology for analyzing off-target binding. Current opinion in structural biology, 21(2):189–199, 2011.
|
| 182 |
+
|
| 183 |
+
Zhihai Liu, Yan Li, Li Han, Jie Li, Jie Liu, Zhixiong Zhao, Wei Nie, Yuchen Liu, and Renxiao Wang. Pdb-wide collection of binding data: current status of the pdbbind database. Bioinformatics, 31(3): 405–412, 2015.
|
| 184 |
+
|
| 185 |
+
Jean-Louis Reymond, Ruud Van Deursen, Lorenz C Blum, and Lars Ruddigkeit. Chemical space as a source for new drugs. MedChemComm, 1(1):30–38, 2010.
|
| 186 |
+
|
| 187 |
+
Elena A Ponomarenko, Ekaterina V Poverennaya, Ekaterina V Ilgisonis, Mikhail A Pyatnitskiy, Arthur T Kopylov, Victor G Zgoda, Andrey V Lisitsa, and Alexander I Archakov. The size of the human proteome: the width and depth. International journal of analytical chemistry, 2016, 2016.
|
| 188 |
+
|
| 189 |
+
Oleg Trott and Arthur J Olson. Autodock vina: improving the speed and accuracy of docking with a new scoring function, efficient optimization, and multithreading. Journal of computational chemistry, 31(2):455–461, 2010.
|
| 190 |
+
|
| 191 |
+
Richard A Friesner, Jay L Banks, Robert B Murphy, Thomas A Halgren, Jasna J Klicic, Daniel T Mainz, Matthew P Repasky, Eric H Knoll, Mee Shelley, Jason K Perry, et al. Glide: a new approach for rapid, accurate docking and scoring. 1. method and assessment of docking accuracy. Journal of medicinal chemistry, 47(7):1739–1749, 2004.
|
| 192 |
+
|
| 193 |
+
Suzanne Ackloo, Rima Al-awar, Rommie E Amaro, Cheryl H Arrowsmith, Hatylas Azevedo, Robert A Batey, Yoshua Bengio, Ulrich AK Betz, Cristian G Bologa, John D Chodera, et al. Cache (critical assessment of computational hit-finding experiments): A public–private partnership benchmarking initiative to enable the development of computational methods for hit-finding. Nature Reviews Chemistry, pages 1–9, 2022.
|
| 194 |
+
|
| 195 |
+
Francesco Gentile, Jean Charle Yaacoub, James Gleave, Michael Fernandez, Anh-Tien Ton, Fuqiang Ban, Abraham Stern, and Artem Cherkasov. Artificial intelligence–enabled virtual screening of ultra-large chemical libraries with deep docking. Nature Protocols, pages 1–26, 2022.
|
| 196 |
+
|
| 197 |
+
Amy C Anderson. The process of structure-based drug design. Chemistry & biology, 10(9):787–797, 2003.
|
| 198 |
+
|
| 199 |
+
Ajay N Jain. Scoring functions for protein-ligand docking. Current Protein and Peptide Science, 7 (5):407–420, 2006.
|
| 200 |
+
|
| 201 |
+
John Jumper, Richard Evans, Alexander Pritzel, Tim Green, Michael Figurnov, Olaf Ronneberger, Kathryn Tunyasuvunakool, Russ Bates, Augustin Žídek, Anna Potapenko, et al. Highly accurate protein structure prediction with alphafold. Nature, 596(7873):583–589, 2021.
|
| 202 |
+
|
| 203 |
+
Mingchen Chen, Xun Chen, Nicholas P Schafer, Cecilia Clementi, Elizabeth A Komives, Diego U Ferreiro, and Peter G Wolynes. Surveying biomolecular frustration at atomic resolution. Nature communications, 11(1):1–9, 2020a.
|
| 204 |
+
|
| 205 |
+
José Nelson Onuchic, Zaida Luthey-Schulten, and Peter G Wolynes. Theory of protein folding: the energy landscape perspective. Annual review of physical chemistry, 48(1):545–600, 1997.
|
| 206 |
+
|
| 207 |
+
David De Juan, Florencio Pazos, and Alfonso Valencia. Emerging methods in protein co-evolution. Nature Reviews Genetics, 14(4):249–261, 2013.
|
| 208 |
+
|
| 209 |
+
Fabian Glaser, Tal Pupko, Inbal Paz, Rachel E Bell, Dalit Bechor-Shental, Eric Martz, and Nir BenTal. Consurf: identification of functional regions in proteins by surface-mapping of phylogenetic information. Bioinformatics, 19(1):163–164, 2003.
|
| 210 |
+
|
| 211 |
+
Minkyung Baek, Frank DiMaio, Ivan Anishchenko, Justas Dauparas, Sergey Ovchinnikov, Gyu Rie Lee, Jue Wang, Qian Cong, Lisa N Kinch, R Dustin Schaeffer, et al. Accurate prediction of protein structures and interactions using a three-track neural network. Science, 373(6557):871–876, 2021.
|
| 212 |
+
|
| 213 |
+
Bowen Jing, Stephan Eismann, Pratham N Soni, and Ron O Dror. Equivariant graph neural networks for 3d macromolecular structure. arXiv preprint arXiv:2106.03843, 2021.
|
| 214 |
+
|
| 215 |
+
Octavian-Eugen Ganea, Xinyuan Huang, Charlotte Bunne, Yatao Bian, Regina Barzilay, Tommi Jaakkola, and Andreas Krause. Independent se (3)-equivariant models for end-to-end rigid protein docking. arXiv preprint arXiv:2111.07786, 2021.
|
| 216 |
+
|
| 217 |
+
Wengong Jin, Jeremy Wohlwend, Regina Barzilay, and Tommi Jaakkola. Iterative refinement graph neural network for antibody sequence-structure co-design. arXiv preprint arXiv:2110.04624, 2021.
|
| 218 |
+
|
| 219 |
+
John Ingraham, Vikas Garg, Regina Barzilay, and Tommi Jaakkola. Generative models for graphbased protein design. Advances in Neural Information Processing Systems, 32, 2019.
|
| 220 |
+
|
| 221 |
+
Mohammed AlQuraishi. End-to-end differentiable learning of protein structure. Cell systems, 8(4): 292–301, 2019.
|
| 222 |
+
|
| 223 |
+
Kristof Schütt, Pieter-Jan Kindermans, Huziel Enoc Sauceda Felix, Stefan Chmiela, Alexandre Tkatchenko, and Klaus-Robert Müller. Schnet: A continuous-filter convolutional neural network for modeling quantum interactions. Advances in neural information processing systems, 30, 2017.
|
| 224 |
+
|
| 225 |
+
Vignesh Ram Somnath, Charlotte Bunne, and Andreas Krause. Multi-scale representation learning on proteins. Advances in Neural Information Processing Systems, 34, 2021.
|
| 226 |
+
|
| 227 |
+
Chence Shi, Shitong Luo, Minkai Xu, and Jian Tang. Learning gradient fields for molecular conformation generation. In International Conference on Machine Learning, pages 9558–9568. PMLR, 2021.
|
| 228 |
+
|
| 229 |
+
Minkai Xu, Lantao Yu, Yang Song, Chence Shi, Stefano Ermon, and Jian Tang. Geodiff: A geometric diffusion model for molecular conformation generation. arXiv preprint arXiv:2203.02923, 2022.
|
| 230 |
+
|
| 231 |
+
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, 3(12):1033–1039, 2021.
|
| 232 |
+
|
| 233 |
+
Jian Wang and Nikolay V Dokholyan. Yuel: Compound-protein interaction prediction with high generalizability. bioRxiv, 2021.
|
| 234 |
+
|
| 235 |
+
Shuya Li, Fangping Wan, Hantao Shu, Tao Jiang, Dan Zhao, and Jianyang Zeng. Monn: a multiobjective neural network for predicting compound-protein interactions and affinities. Cell Systems, 10(4):308–322, 2020.
|
| 236 |
+
|
| 237 |
+
Masashi Tsubaki, Kentaro Tomii, and Jun Sese. Compound–protein interaction prediction with end-to-end learning of neural networks for graphs and sequences. Bioinformatics, 35(2):309–318, 2019.
|
| 238 |
+
|
| 239 |
+
Kyle Yingkai Gao, Achille Fokoue, Heng Luo, Arun Iyengar, Sanjoy Dey, and Ping Zhang. Interpretable drug target prediction using deep neural representation. In IJCAI, volume 2018, pages 3371–3377, 2018.
|
| 240 |
+
|
| 241 |
+
Mostafa Karimi, Di Wu, Zhangyang Wang, and Yang Shen. Deepaffinity: interpretable deep learning of compound–protein affinity through unified recurrent and convolutional neural networks. Bioinformatics, 35(18):3329–3338, 2019.
|
| 242 |
+
|
| 243 |
+
Shuangjia Zheng, Yongjian Li, Sheng Chen, Jun Xu, and Yuedong Yang. Predicting drug–protein interaction using quasi-visual question answering system. Nature Machine Intelligence, 2(2): 134–140, 2020.
|
| 244 |
+
|
| 245 |
+
José Jiménez, Miha Skalic, Gerard Martinez-Rosell, and Gianni De Fabritiis. K deep: protein–ligand absolute binding affinity prediction via 3d-convolutional neural networks. Journal of chemical information and modeling, 58(2):287–296, 2018.
|
| 246 |
+
|
| 247 |
+
Jaechang Lim, Seongok Ryu, Kyubyong Park, Yo Joong Choe, Jiyeon Ham, and Woo Youn Kim. Predicting drug–target interaction using a novel graph neural network with 3d structure-embedded graph representation. Journal of chemical information and modeling, 59(9):3981–3988, 2019.
|
| 248 |
+
|
| 249 |
+
Joseph A Morrone, Jeffrey K Weber, Tien Huynh, Heng Luo, and Wendy D Cornell. Combining docking pose rank and structure with deep learning improves protein–ligand binding mode prediction over a baseline docking approach. Journal of chemical information and modeling, 60(9): 4170–4179, 2020.
|
| 250 |
+
|
| 251 |
+
Hannes Stärk, Octavian-Eugen Ganea, Lagnajit Pattanaik, Regina Barzilay, and Tommi Jaakkola. Equibind: Geometric deep learning for drug binding structure prediction. arXiv preprint arXiv:2202.05146, 2022.
|
| 252 |
+
|
| 253 |
+
Bowen Jing, Stephan Eismann, Patricia Suriana, Raphael JL Townshend, and Ron Dror. Learning from protein structure with geometric vector perceptrons. arXiv preprint arXiv:2009.01411, 2020.
|
| 254 |
+
|
| 255 |
+
Dejun Jiang, Chang-Yu Hsieh, Zhenxing Wu, Yu Kang, Jike Wang, Ercheng Wang, Ben Liao, Chao Shen, Lei Xu, Jian Wu, et al. Interactiongraphnet: A novel and efficient deep graph representation learning framework for accurate protein–ligand interaction predictions. Journal of medicinal chemistry, 64(24):18209–18232, 2021.
|
| 256 |
+
|
| 257 |
+
Pablo Gainza, Freyr Sverrisson, Frederico Monti, Emanuele Rodola, D Boscaini, MM Bronstein, and BE Correia. Deciphering interaction fingerprints from protein molecular surfaces using geometric deep learning. Nature Methods, 17(2):184–192, 2020.
|
| 258 |
+
|
| 259 |
+
John M Jumper, Nabil F Faruk, Karl F Freed, and Tobin R Sosnick. Accurate calculation of side chain packing and free energy with applications to protein molecular dynamics. PLoS computational biology, 14(12):e1006342, 2018.
|
| 260 |
+
|
| 261 |
+
Radoslav Krivák and David Hoksza. P2rank: machine learning based tool for rapid and accurate prediction of ligand binding sites from protein structure. Journal of cheminformatics, 10(1):1–12, 2018.
|
| 262 |
+
|
| 263 |
+
Zhaocheng Zhu, Chence Shi, Zuobai Zhang, Shengchao Liu, Minghao Xu, Xinyu Yuan, Yangtian Zhang, Junkun Chen, Huiyu Cai, Jiarui Lu, et al. Torchdrug: A powerful and flexible machine learning platform for drug discovery. arXiv preprint arXiv:2202.08320, 2022.
|
| 264 |
+
|
| 265 |
+
Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? arXiv preprint arXiv:1810.00826, 2018.
|
| 266 |
+
|
| 267 |
+
Raphael JL Townshend, Martin Vögele, Patricia Suriana, Alexander Derry, Alexander Powers, Yianni Laloudakis, Sidhika Balachandar, Bowen Jing, Brandon Anderson, Stephan Eismann, et al. Atom3d: Tasks on molecules in three dimensions. arXiv preprint arXiv:2012.04035, 2020.
|
| 268 |
+
|
| 269 |
+
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.
|
| 270 |
+
|
| 271 |
+
Matthew Masters, Amr H Mahmoud, Yao Wei, and Markus Lill. Deep learning model for flexible and efficient protein-ligand docking. In ICLR2022 Machine Learning for Drug Discovery, 2022.
|
| 272 |
+
|
| 273 |
+
Moritz Hoffmann and Frank Noé. Generating valid euclidean distance matrices. arXiv preprint arXiv:1910.03131, 2019.
|
| 274 |
+
|
| 275 |
+
Zsolt Zsoldos, Darryl Reid, Aniko Simon, Sayyed Bashir Sadjad, and A Peter Johnson. ehits: a new fast, exhaustive flexible ligand docking system. Journal of Molecular Graphics and Modelling, 26 (1):198–212, 2007.
|
| 276 |
+
|
| 277 |
+
Stephen K Burley, Charmi Bhikadiya, Chunxiao Bi, Sebastian Bittrich, Li Chen, Gregg V Crichlow, Cole H Christie, Kenneth Dalenberg, Luigi Di Costanzo, Jose M Duarte, et al. Rcsb protein data bank: powerful new tools for exploring 3d structures of biological macromolecules for basic and applied research and education in fundamental biology, biomedicine, biotechnology, bioengineering and energy sciences. Nucleic acids research, 49(D1):D437–D451, 2021.
|
| 278 |
+
|
| 279 |
+
Greg Landrum et al. Rdkit: A software suite for cheminformatics, computational chemistry, and predictive modeling, 2013.
|
| 280 |
+
|
| 281 |
+
Andrew T McNutt, Paul Francoeur, Rishal Aggarwal, Tomohide Masuda, Rocco Meli, Matthew Ragoza, Jocelyn Sunseri, and David Ryan Koes. Gnina 1.0: molecular docking with deep learning. Journal of cheminformatics, 13(1):1–20, 2021.
|
| 282 |
+
|
| 283 |
+
David Ryan Koes, Matthew P Baumgartner, and Carlos J Camacho. Lessons learned in empirical scoring with smina from the csar 2011 benchmarking exercise. Journal of chemical information and modeling, 53(8):1893–1904, 2013.
|
| 284 |
+
|
| 285 |
+
Lifan Chen, Xiaoqin Tan, Dingyan Wang, Feisheng Zhong, Xiaohong Liu, Tianbiao Yang, Xiaomin Luo, Kaixian Chen, Hualiang Jiang, and Mingyue Zheng. Transformercpi: improving compound– protein interaction prediction by sequence-based deep learning with self-attention mechanism and label reversal experiments. Bioinformatics, 36(16):4406–4414, 2020b.
|
| 286 |
+
|
| 287 |
+
Seokhyun Moon, Wonho Zhung, Soojung Yang, Jaechang Lim, and Woo Youn Kim. Pignet: a physics-informed deep learning model toward generalized drug–target interaction predictions. Chemical Science, 13(13):3661–3673, 2022.
|
| 288 |
+
|
| 289 |
+
Penglei Wang, Shuangjia Zheng, Yize Jiang, Chengtao Li, Junhong Liu, Chang Wen, Atanas Patronov, Dahong Qian, Hongming Chen, and Yuedong Yang. Structure-aware multimodal deep learning for drug–protein interaction prediction. Journal of Chemical Information and Modeling, 62(5): 1308–1317, 2022.
|
| 290 |
+
|
| 291 |
+
Roshan Rao, Nicholas Bhattacharya, Neil Thomas, Yan Duan, Peter Chen, John Canny, Pieter Abbeel, and Yun Song. Evaluating protein transfer learning with tape. Advances in neural information processing systems, 32, 2019.
|
| 292 |
+
|
| 293 |
+
Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua ´ Bengio. Graph attention networks. arXiv preprint arXiv:1710.10903, 2017.
|
| 294 |
+
|
| 295 |
+
Timo Lassmann. Kalign 3: multiple sequence alignment of large datasets, 2020.
|
| 296 |
+
|
| 297 |
+
Peter JA Cock, Tiago Antao, Jeffrey T Chang, Brad A Chapman, Cymon J Cox, Andrew Dalke, Iddo Friedberg, Thomas Hamelryck, Frank Kauff, Bartek Wilczynski, et al. Biopython: freely available python tools for computational molecular biology and bioinformatics. Bioinformatics, 25(11): 1422–1423, 2009.
|
md/dev/MWoZh1gvbxA/MWoZh1gvbxA.md
ADDED
|
@@ -0,0 +1,422 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# HIDDEN POISON: MACHINE UNLEARNING ENABLES CAMOUFLAGED POISONING ATTACKS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
We introduce camouflaged data poisoning attacks, a new attack vector that arises in the context of machine unlearning and other settings when model retraining may be induced. An adversary first adds a few carefully crafted points to the training dataset such that the impact on the model’s predictions is minimal. The adversary subsequently triggers a request to remove a subset of the introduced points at which point the attack is unleashed and the model’s predictions are negatively affected. In particular, we consider clean-label targeted attacks (in which the goal is to cause the model to misclassify a specific test point) on datasets including CIFAR-10, Imagenette, and Imagewoof. This attack is realized by constructing camouflage datapoints that mask the effect of a poisoned dataset.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Machine Learning (ML) research traditionally assumes a static pipeline: data is gathered, a model is trained once and subsequently deployed. This paradigm has been challenged by practical deployments, which are more dynamic in nature. After initial deployment more data may be collected, necessitating additional training. Or, as in the machine unlearning setting (Cao & Yang, 2015), we may need to produce a model as if certain points were never in the training set to begin with.1
|
| 12 |
+
|
| 13 |
+
While such dynamic settings clearly increase the applicability of ML models, they also make them more vulnerable. Specifically, they open models up to new methods of attack by malicious actors aiming to sabotage the model. In this work, we introduce a new type of data poisoning attack on models that unlearn training datapoints. We call these camouflaged data poisoning attacks.
|
| 14 |
+
|
| 15 |
+
The attack takes place in two phases. In the first stage, before the model is trained, the attacker adds a set of carefully designed points to the training data, consisting of a poison set and a camouflage set. The model’s behaviour should be similar whether it is trained on either the training data, or its augmentation with both the poison and camouflage sets. In the second phase, after the model is trained, the attacker triggers an unlearning request to delete the camouflage set. That is, the model must be updated to behave as though it were only trained on the training set plus the poison set. At this point, the attack is fully realized, and the model’s performance suffers in some way.
|
| 16 |
+
|
| 17 |
+
While such an attack could harm the model by several metrics, in this paper, we focus on targeted poisoning attacks – that is, poisoning attacks where the goal is to misclassify one particular point in the training set. Our contributions are the following:
|
| 18 |
+
|
| 19 |
+
1. We introduce camouflaged data poisoning attacks, demonstrating a new attack vector in dynamic settings including machine unlearning.
|
| 20 |
+
2. We realize these attacks in the targeted poisoning setting, giving an algorithm based on the gradient-matching approach of Geiping et al. (2021). In order to make the model behavior comparable to as if the poison set were absent, we construct the camouflage set by generating a new set of points that undoes the impact of the poison set, an idea which may be of broader interest to the data poisoning community.
|
| 21 |
+
3. We demonstrate the efficacy of these attacks on a variety of models (SVMs and neural networks) and datasets (CIFAR-10 (Krizhevsky, 2009), Imagenette (Howard, 2019), and Imagewoof (Howard, 2019)).
|
| 22 |
+
|
| 23 |
+

|
| 24 |
+
Figure 1: An illustration of a successful camouflaged targeted data poisoning attack. In Step 1, the adversary adds poison and camouflage sets of points to the (clean) training data. In Step 2, the model is trained on the augmented training dataset. It should behave similarly to if trained on only the clean data; in particular, it should correctly classify the targeted point. In Step 3, the adversary triggers an unlearning request to delete the camouflage set from the trained model. In Step 4, the resulting model misclassifies the targeted point.
|
| 25 |
+
|
| 26 |
+

|
| 27 |
+
Figure 2: Some representative images from Imagewoof. In each pair, the left figure is from the training dataset, while the right image has been adversarially manipulated. The top and bottom rows are images from the poison and camouflage set, respectively. In all cases, the manipulated images are clean label and nearly indistinguishable from the original image.
|
| 28 |
+
|
| 29 |
+
# 1.1 PRELIMINARIES
|
| 30 |
+
|
| 31 |
+
Machine Unlearning. A significant amount of legislation concerning the “right to be forgotten” has recently been introduced by governments around the world, including the European Union’s General Data Protection Regulation (GDPR), the California Consumer Privacy Act (CCPA), and Canada’s proposed Consumer Privacy Protection Act (CPPA). Such legislation requires organizations to delete information they have collected about a user upon request. A natural question is whether that further obligates the organizations to remove that information from downstream machine learning models trained on the data – current guidances (Information Commissioner’s Office, 2020) and precedents (Federal Trade Commission, 2021) indicate that this may be the case. This goal has sparked a recent line of work on machine unlearning (Cao & Yang, 2015).
|
| 32 |
+
|
| 33 |
+
The simplest way to remove a user’s data from a trained model is to remove the data from the training set, and then retrain the model on the remainder (also called “retraining from scratch”). This is the ideal way to perform data deletion, as it ensures that the model was never trained on the datapoint of concern. The downside is that retraining may take a significant amount of time in modern machine learning settings. Hence, most work within machine unlearning has studied fast methods for data deletion, sometimes relaxing to approximately removing the datapoint. A related line of work has focused more on other implications of machine unlearning, particularly the consequences of an adaptive and dynamic data pipeline (Gupta et al., 2021; Marchant et al., 2022). Our work fits into the latter line: we show that the potential to remove points from a trained model can expose a new attack vector. Since retraining from scratch is the ideal result that other methods try to emulate, we focus on unlearning by retraining from scratch, but the same phenomena should still occur when any effective machine unlearning algorithm is applied.
|
| 34 |
+
|
| 35 |
+
Data Poisoning. In a data poisoning attack, an adversary in some way modifies the training data provided to a machine learning model, such that the model’s behaviour at test time is negatively impacted. Our focus is on targeted data poisoning attacks, where the attacker’s goal is to cause the model to misclassify some specific datapoint in the test set. Other common types of data poisoning attacks include indiscriminate (in which the goal is to increase the test error) and backdoor (where the goal is to misclassify test points which have been adversarially modified in some small way).
|
| 36 |
+
|
| 37 |
+
The adversary is typically limited in a couple ways. First, it is common to say that they can only add a small number of points to the training set. This mimics the setting where the training data is gathered from some large public crowdsourced dataset, and an adversary can contribute a few judiciously selected points of their own. Other choices may include allowing them to modify or delete points from the training set, but these are less easily motivated. Additionally, the adversary is generally constrained to clean-label attacks: if the introduced points were inspected by a human, they should not appear suspicious or incorrectly labeled. We comment that this criteria is subjective and thus not a precise notion, but is nonetheless common in the data poisoning literature, and we use the term as well.
|
| 38 |
+
|
| 39 |
+
# 1.2 RELATED WORK
|
| 40 |
+
|
| 41 |
+
The motivation for our work comes from Marchant et al. (2022), who propose a novel poisoning attack on unlearning systems. As mentioned before, the primary goal of many machine unlearning systems is to “unlearn” datapoints quickly, i.e., faster than retraining from scratch. Marchant et al. (2022) craft poisoning schemes via careful noise addition, in order to trigger the unlearning algorithm to retrain from scratch on far more deletion requests than typically required. While both our work and theirs are focused on data poisoning attacks against machine unlearning systems, the adversaries have very different objectives. In our work, the adversary is trying to misclassify a target test point, whereas in theirs, they try to increase the time required to unlearn a point.
|
| 42 |
+
|
| 43 |
+
In targeted data poisoning, there are a few different types of attacks. The simplest form of attack is label flipping, in which the adversary is allowed to flip the labels of the examples (Barreno et al., 2010; Xiao et al., 2012; Paudice et al., 2018). Another type of attack is watermarking, in which the feature vectors are perturbed to obtain the desired poisoning effect (Suciu et al., 2018; Shafahi et al., 2018). In both these cases, noticeable changes are made to the label and feature vector, respectively, which would be noticeable by a human labeler. In contrast, clean label attacks attempt to make unnoticeable changes to both the feature vector and the label, and are the gold standard for data poisoning attacks (Huang et al., 2020; Geiping et al., 2021). Our focus is on both clean-label poisoning and camouflage sets. While there are also works on indiscriminate (Biggio et al., 2012; Xiao et al., 2015; Munoz-Gonz˜ alez et al.´ , 2017; Steinhardt et al., 2017; Diakonikolas et al., 2019; Koh et al., 2022) and backdoor (Gu et al., 2017; Tran et al., 2018; Sun et al., 2019) poisoning attacks, these are beyond the scope of our work, see Goldblum et al. (2020); Cina et al.\` (2022) for additional background on data poisoning attacks.
|
| 44 |
+
|
| 45 |
+
Cao & Yang (2015) initiated the study of machine unlearning through exact unlearning, wherein the new model obtained after deleting an example is statistically identical to the model obtained by training on a dataset without the example. A probabilistic notion of unlearning was defined by Ginart et al. (2019), which in turn is inspired from notions in differential privacy (Dwork et al., 2006). Several works studied algorithms for empirical risk minimization (i.e., training loss) (Guo et al.,
|
| 46 |
+
|
| 47 |
+
2020; Izzo et al., 2021; Neel et al., 2021; Ullah et al., 2021), while later works study the effect of machine unlearning on the generalization loss (Gupta et al., 2021; Sekhari et al., 2021). In particular, these works realize that unlearning data points quickly can lead to a drop in test loss, which is the theme of our current work. Several works have considered implementations of machine unlearning in several contexts starting with the work of Bourtoule et al. (2021). These include unlearning in deep neural networks (Golatkar et al., 2020; 2021; Nguyen et al., 2020), random forests (Brophy & Lowd, 2021), large scale language models (Zanella-Beguelin et al. ´ , 2020), the tension between unlearning and privacy (Chen et al., 2021), anomaly detection (Du et al., 2019), and even auditing of machine unlearning systems (Sommer et al., 2020).
|
| 48 |
+
|
| 49 |
+
# 2 CAMOUFLAGED POISONING ATTACKS VIA UNLEARNING
|
| 50 |
+
|
| 51 |
+
In this section, we describe various components of the camouflaged poisoning attack, and how it can be realized using machine unlearning.
|
| 52 |
+
|
| 53 |
+
# 2.1 THREAT MODEL AND APPROACH
|
| 54 |
+
|
| 55 |
+
The camouflaged poisoning attack takes place through interaction between an attacker and a victim. We assume that the attacker has access to the victim’s model architecture,2 the ability to query gradients on a trained model (which could be achieved, e.g., by having access to the training dataset), and a target sample that it wants to attack. The attacker first sets the stage for the attack by introducing poison points and camouflage points to the training dataset, which are designed so as to have minimal impact when a model is trained with this modified dataset. At a later time, the attacker triggers the attack by submitting an unlearning request to remove the camouflage points. The victim first trains a machine learning model (e.g., a deep neural network) on the modified training dataset, and then executes the unlearning request by retraining the model from scratch on the left over dataset. The goal of the attacker is to change the prediction of the model on a particular target sample $( x _ { \mathrm { { t a r g e t } } } , y _ { \mathrm { { t a r g e t } } } )$ previously unseen by the model during training from $y _ { \mathrm { t a r g e t } }$ to a desired label $y _ { \mathrm { { a d v e r s a r i a l } } }$ , while still ensuring good performance over other validation samples. Formally, the interaction between the attacker and the victim is as follows (see Figure 1) :
|
| 56 |
+
|
| 57 |
+
1. The attacker introduces a small number of poisons samples $S _ { \mathrm { p o } }$ and camouflage samples $S _ { \mathrm { c a } }$ to a clean training dataset $S _ { \mathrm { c l } }$ . Define $S _ { \mathrm { c p c } } = S _ { \mathrm { c l } } + S _ { \mathrm { p o } } + S _ { \mathrm { c a } }$ .
|
| 58 |
+
2. Victim trains an ML model (e.g., a neural network) on $S _ { \mathrm { c p c } }$ , and returns the model $\theta _ { \mathrm { c p c } }$ .
|
| 59 |
+
3. The attacker submits a request to unlearn the camouflage samples $S _ { \mathrm { c a } }$ .
|
| 60 |
+
4. The victim performs the request, and computes a new model $\theta _ { \mathrm { c p } }$ by retraining from scratch on the left over data samples $S _ { \mathrm { c p } } = S _ { \mathrm { c l } } + S _ { \mathrm { p o } }$ .
|
| 61 |
+
|
| 62 |
+
Note that the attack is only realized in Step 4 when the victim executes the unlearning request and retrains the model from scratch on the left over training samples. In fact, in Steps 1-3, the victim’s model should behave similarly to as if it were trained on the clean samples $S _ { \mathrm { c l } }$ only. In particular, the model $\theta _ { \mathrm { c p c } }$ will predict $y _ { \mathrm { t a r g e t } }$ on $x _ { \mathrm { { t a r g e t } } }$ , whereas the updated model $\theta _ { \mathrm { c p } }$ will predict $y _ { \mathrm { a d } }$ versarial on $x _ { \mathrm { { t a r g e t } } }$ . Both models should have comparable validation accuracy. Such an attack is implemented by designing a camouflage set that cancels the effects of the poison set while training, but retraining without the camouflage set exposes the poison set, thus negatively affecting the model.
|
| 63 |
+
|
| 64 |
+
We highlight that camouflaged attacks may be more dangerous than traditional data poisoning attacks, since camouflaged attacks can be triggered by the adversary. That is, the adversary can reveal the attack whenever the submit an unlearning request, whereas for a traditional poisoning attack, the adversary simply plants the attack and must wait for the victim to train the model.
|
| 65 |
+
|
| 66 |
+
In order to be undetectable, and represent the realistic scenario in which the adversary has limited influence on the model’s training data, the attacker is only allowed to introduce a set of points that is much smaller than the size of the clean training dataset (i.e., $| S _ { \mathrm { p o } } | \ll | S _ { \mathrm { c l } } |$ and $| S _ { \mathrm { c a } } | \ll | S _ { \mathrm { c l } } | )$ . Throughout the paper and experiments, we denote the relative size of the poison set and camouflage set by $b _ { p } : = \frac { | S _ { \mathrm { p o } } | } { | S _ { \mathrm { c l } } | } \times 1 0 0$ and $b _ { c } : = \frac { \left| S _ { \mathrm { c a } } \right| } { \left| S _ { \mathrm { c l } } \right| } \times 1 0 0$ , respectively. Additionally, the attacker is only allowed to generate poison and camouflage points by altering the base images by less than $\varepsilon$ distance in the $\ell _ { \infty }$ norm (in our experiments $\varepsilon \leq 1 6$ , where the images are represented as an array of pixels in 0 to 255). Thus, the attacker executes a so-called clean-label attack, where the corrupted images would be visually indistinguishable from original base images and thus would be given the same label as before by a human data validator. We parameterize a threat model by the tuple $\left( \varepsilon , b _ { c } , b _ { p } \right)$ .
|
| 67 |
+
|
| 68 |
+
The attacker implements the attack by first generating poison samples, and then generating camouflage samples to cancel their effects. The poison and camouflage points are generated as follows.
|
| 69 |
+
|
| 70 |
+
Poison points. Poison points are designed so that a network trained on $S _ { \mathrm { c p } } = S _ { \mathrm { c l } } + S _ { \mathrm { p o } }$ predicts the label yadversarial (instead of $y _ { \mathrm { t a r g e t } } ,$ ) on a target image $x _ { \mathrm { { t a r g e t } } }$ . While there are numerous data poisoning attacks in the literature, we adopt the state-of-the-art procedure of Geiping et al. (2021) for generating poisons due to its high success rate, efficiency of implementation, and applicability across various models. However, our framework is flexible: in principle, other attacks for the same setting could serve as a drop-in replacement, e.g., the methods of Aghakhani et al. (2021) or Huang et al. (2020), or any method introduced in the future. Suppose that $S _ { \mathrm { c p } }$ consist of $N _ { 1 }$ samples $( x ^ { i } , y ^ { i } ) _ { i \leq N _ { 1 } }$ out of which the first $P$ samples with index $i = 1$ to $P$ belong to the poison set $S _ { \mathrm { p o } }$ . 3 The poison samples are generated by adding small perturbations $\Delta ^ { i }$ to the base image $x ^ { i }$ so as to minimize the loss on the target with respect to the adversarial label, which can be formalized as the following bilevel optimization problem
|
| 71 |
+
|
| 72 |
+
$$
|
| 73 |
+
\operatorname* { m i n } _ { \Delta \in \Gamma } \ell \big ( f ( x _ { \mathrm { t a r g e t } } , \theta ( \Delta ) ) , y _ { \mathrm { a d v e r s a r i a l } } \big ) \quad \mathrm { w h e r e } \quad \theta ( \Delta ) \in \operatorname* { a r g m i n } _ { \theta } \frac { 1 } { N } \sum _ { i \leq N } \ell ( f ( x ^ { i } + \Delta ^ { i } , \theta ) , y ^ { i } ) ,
|
| 74 |
+
$$
|
| 75 |
+
|
| 76 |
+
where we define the constraint set $\Gamma : = \big \{ \Delta : \| \Delta \| _ { \infty } \leq \varepsilon$ and $\Delta ^ { i } = 0$ for all $i > P \}$ . The main optimization objective in (1) is called the adversarial loss (Geiping et al., 2021).
|
| 77 |
+
|
| 78 |
+
Camouflage points. Camouflage samples are designed to cancel the effect of the poisons, such that a model trained on $S _ { \mathrm { c p c } } = S _ { \mathrm { c l } } + S _ { \mathrm { p o } } + S _ { \mathrm { c a } }$ behaves identical to the model trained on $S _ { \mathrm { c l } }$ , and makes the correct prediction on $x _ { \mathrm { t a r g e t } }$ . We formulate this task via a bilevel optimization problem similar to what we did in (1) for generating poisons. Let $S _ { \mathrm { c p c } }$ consist of $N _ { 2 }$ samples $( x ^ { j } , y ^ { j } ) _ { j \leq N _ { 2 } }$ out of which the last $C$ samples with index $j = N _ { 2 } - C + 1$ to $N _ { 2 }$ belong to the camouflage set $S _ { \mathrm { c a } }$ . The camouflage points are generated by adding small perturbations $\Delta ^ { j }$ to the base image $x ^ { j }$ so as to minimize the loss on the target with respect to the adversarial label. In particular, we find the appropriate $\Delta$ by solving:
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
\operatorname* { m i n } _ { \Delta \in \Gamma } \ell \big ( f ( x _ { \mathrm { t a r g e t } } , \theta ( \Delta ) ) , y _ { \mathrm { t a r g e t } } \big ) \quad \mathrm { w h e r e } \quad \theta ( \Delta ) \in \arg \operatorname* { m i n } _ { \theta } \frac { 1 } { N _ { 2 } } \sum _ { j \leq N _ { 2 } } \ell \big ( f ( x ^ { j } + \Delta ^ { j } , \theta ) , y ^ { j } \big ) ,
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
where we define the constraint set $\Gamma : = \big \{ \Delta : \| \Delta \| _ { \infty } \leq \varepsilon$ and $\Delta ^ { j } = 0$ for all $j \leq N _ { 2 } - C \}$ .
|
| 85 |
+
|
| 86 |
+
# 2.2 GRADIENT MATCHING FOR EFFICIENT POISON GENERATION (GEIPING ET AL., 2021)
|
| 87 |
+
|
| 88 |
+
In this section, we discuss the key intuition of Geiping et al. (2021) for efficient poison generation. Our objective is to find perturbations $\Delta$ such that when the model is trained on the poisoned samples, it minimizes the adversarial loss in (1) thus making the victim model predict the wrong label yadversarial on the target sample. However, directly solving (1) is computationally intractable due to bilevel nature of the optimization objective. Instead, one may implicitly minimize the adversarial loss by finding a $\Delta$ such that for any model parameter $\theta$ ,
|
| 89 |
+
|
| 90 |
+
$$
|
| 91 |
+
\nabla _ { \theta } \big ( \ell \big ( f ( x _ { \mathrm { t a r g e t } } , \theta ) , y _ { \mathrm { a d v e r s a r i a l } } \big ) \big ) \approx \frac { 1 } { P } \sum _ { i = 1 } ^ { P } \nabla _ { \theta } \ell \big ( f ( x ^ { i } + \Delta ^ { i } , \theta ) , y ^ { i } \big ) .
|
| 92 |
+
$$
|
| 93 |
+
|
| 94 |
+
In essence, (3) implies that gradient based minimization (e.g., using Adam $/$ SGD) of the training loss on poisoned samples also minimizes the adversarial loss. Thus, training a model on $S _ { \mathrm { c l } } + S _ { \mathrm { p o } }$ will automatically ensure that the model predicts $y _ { \mathrm { { a d v e r s a r i a l } } }$ on the target sample. Unfortunately, computing $\Delta$ that satisfies (3) is also intractable as it is required to hold for all values of $\theta$ . The key idea of Geiping et al. (2021) to make poison generation efficient is to relax (3) to only be satisfied for a fixed model $\theta _ { \mathrm { c l } }$ −the model obtained by training on the clean dataset $S _ { \mathrm { c l } }$ . To implement this, Geiping et al. (2021) minimize the cosine-similarity loss between the two gradients defined as:
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
\phi ( \Delta , \theta ) = 1 - \frac { \left. \nabla _ { \theta } \ell \big ( f ( x _ { \mathrm { t a r g e t } } , \theta ) , y _ { \mathrm { a d v e r s a r i a l } } \big ) , \sum _ { i = 1 } ^ { P } \nabla _ { \theta } \ell \big ( f ( x _ { i } + \Delta _ { i } , \theta ) , y _ { i } \big ) \right. } { \big \| \nabla _ { \theta } \ell \big ( f ( x _ { \mathrm { t a r g e t } } , \theta ) , y _ { \mathrm { a d v e r s a r i a l } } \big ) \big \| \big \| \sum _ { i = 1 } ^ { P } \nabla _ { \theta } \ell \big ( f ( x _ { i } + \Delta _ { i } , \theta ) , y _ { i } \big ) \big \| } ,
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
Geiping et al. (2021) demonstrated that (4) can be efficiently optimized for many popular largescale machine learning models and datasets. For completeness, we provide their pseudocode in Algorithm 1 in the Appendix.
|
| 101 |
+
|
| 102 |
+
# 2.3 CAMOUFLAGING POISONED POINTS
|
| 103 |
+
|
| 104 |
+
Camouflage images are designed in order to neutralize the effect of the poison images. In this section, we give intuition into what we mean by cancelling the effect of poisons, and provide two procedures for generating camouflages efficiently: label flipping, and gradient matching.
|
| 105 |
+
|
| 106 |
+
# 2.3.1 CAMOUFLAGES VIA LABEL FLIPPING
|
| 107 |
+
|
| 108 |
+
Suppose that the underlying task is a binary classification problem with the labels $y \in \{ - 1 , 1 \}$ , and that the model is trained using linear loss $\ell ( f ( x , \theta ) , y ) \ \overset { \cdot } { = } \ - y f ( x , \theta )$ . Then, simply flipping the labels allows one to generate a camouflage set for any given poison set $S _ { \mathrm { p o } }$ . In particular, $\breve { S } _ { \mathrm { c a } }$ is constructed as: for every $( x ^ { i } , y ^ { i } ) \in S _ { \mathrm { p o } }$ , simply add $( x ^ { i } , - y ^ { i } )$ to $S _ { \mathrm { c a } }$ (i.e., $b _ { p } = b _ { c , }$ ). It is easy to see that for such camouflage points, we have for any $\theta$ ,
|
| 109 |
+
|
| 110 |
+
$$
|
| 111 |
+
\sum _ { ( x , y ) \in S _ { \mathrm { c p c } } } \ell ( f ( x , \theta ) , y ) = - \sum _ { ( x , y ) \in S _ { \mathrm { c l } } } y f ( x , \theta ) - \sum _ { i = 1 } ^ { P } \left( y ^ { i } f ( x ^ { i } , \theta ) + ( - y ^ { i } ) f ( x ^ { i } , \theta ) \right) = \sum _ { ( x , y ) \in S _ { \mathrm { c l } } } \ell ( f ( x , \theta ) , y ) .
|
| 112 |
+
$$
|
| 113 |
+
|
| 114 |
+
We can also similarly show that the gradients (as well as higher order derivatives) are equal, i.e., $\begin{array} { r } { \nabla _ { \boldsymbol { \theta } } \sum _ { S _ { \mathrm { c p c } } } \ell ( \boldsymbol { f } ( \boldsymbol { x } , \boldsymbol { \theta } ) , \dot { \boldsymbol { y } } ) = \nabla _ { \boldsymbol { \theta } } \sum _ { S _ { \mathrm { c l } } } \ell ( \boldsymbol { \bar { f } } ( \boldsymbol { x } , \boldsymbol { \theta } ) , \boldsymbol { y } ) } \end{array}$ for all $\theta$ . Thus, training a model on $S _ { \mathrm { c p c } }$ is equivalent to training it on $S _ { \mathrm { c l } }$ . In essence, the camouflages have perfectly canceled out the effect of the poisons. We validate the efficacy of this approach via experiments on linear SVM trained with hinge loss (which resembles linear loss when the domain is bounded) on a binary classification problem constructed using CIFAR-10 dataset. We report the results in Table 1 (see Section 3.1.1 for details).
|
| 115 |
+
|
| 116 |
+
While label flipping is a simple and effective procedure to generate camouflages, it is fairly restrictive. Firstly, label flipping only works for binary classification problems trained with linear loss. Secondly, the attack is not clean label as the camouflage images are generated as $( x ^ { i } , - y ^ { i } )$ by giving them the opposite label to the ground truth, which can be easily caught by a validator. Lastly, the attack is vulnerable to simple data purification techniques by the victim, e.g., the victim can protect themselves by preprocessing the data to remove all the images that have both the labels ( $y = + 1$ and $y = - 1 ,$ ) in the training dataset. In the next section, we provide a different procedure to generate clean-label camouflages for general losses and multi-class classification problems.
|
| 117 |
+
|
| 118 |
+
Table 1: Camouflaged poisoning attack on linear SVM on Binary-CIFAR-10 dataset. The first column lists the threat model $( \varepsilon , b _ { p } , b _ { c } )$ and the camouflaging type “LF” for label flipping and “GM” for gradient matching. The implementation details are given in Section 3.1.1. Each experriments is an average of 10 runs with seeds of the form “kkkkkk” where $k \in \{ 0 , \ldots , 9 \}$ and the seed 99999.
|
| 119 |
+
|
| 120 |
+
<table><tr><td rowspan="2">Attack type (e,bp,bc)</td><td colspan="2">Attack success</td><td colspan="3">Validation Accuracy</td></tr><tr><td>Poisoning</td><td>Camouflaging</td><td>Clean</td><td>Poisoned</td><td>Camouflaged</td></tr><tr><td>LF(8,0.2%,0.2%)</td><td>70%</td><td>71.5%</td><td>81.63</td><td>81.73 (± 0.14)</td><td>81.74 (± 0.20)</td></tr><tr><td>LF (16,0.2%,0.2%)</td><td>100%</td><td>40%</td><td>81.63</td><td>81.64 (±0.03)</td><td>81.6(±0.02)</td></tr><tr><td>GM (8,0.2%,0.4%)</td><td>70%</td><td>100%</td><td>81.63</td><td>81.65 (±0.01)</td><td>81.62 (±0.02)</td></tr><tr><td>GM (16,0.2%,0.4%)</td><td>100%</td><td>70%</td><td>81.63</td><td>81.65 (±0.03)</td><td>81.63 (± 0.02)</td></tr></table>
|
| 121 |
+
|
| 122 |
+
# 2.3.2 GRADIENT MATCHING FOR GENERATING CAMOUFLAGES
|
| 123 |
+
|
| 124 |
+
We next discuss our main procedure to generate camouflages, which is based on the gradient matching idea of Geiping et al. (2021). Note that, our objective in (2) is to find $\Delta$ such that when the model is trained with the camouflages, it minimizes the original-target loss in (2) (with respect to the original label $y _ { \mathrm { t a r g e t } } ,$ ) thus making the victim model predict the correct label on this target sample. Since, (1) is computationally intractable, one may instead try to implicitly minimize the original-target loss by finding a $\Delta$ such that for any model parameter $\theta$ ,
|
| 125 |
+
|
| 126 |
+
$$
|
| 127 |
+
\nabla _ { \boldsymbol { \theta } } \big ( \ell \big ( f ( \boldsymbol { x } _ { \mathrm { t a r g e t } } , \boldsymbol { \theta } ) , \boldsymbol { y } _ { \mathrm { t a r g e t } } \big ) \big ) \approx \frac { 1 } { C } \sum _ { i = 1 } ^ { C } \nabla _ { \boldsymbol { \theta } } \ell \big ( f ( \boldsymbol { x } ^ { i } + \Delta ^ { i } , \boldsymbol { \theta } ) , \boldsymbol { y } ^ { i } \big ) .
|
| 128 |
+
$$
|
| 129 |
+
|
| 130 |
+
(5) suggests that minimizing (e.g., using Adam / SGD) on camouflage samples will also minimize the original-target loss, and thus automatically ensure that the model predicts the correct label on the target sample. Unfortunately, (5) is also intractable as it requires the condition to hold for all $\theta$ . Building on the work of Geiping et al. (2021), we relax this condition to satisfied only for a fixed model $\theta _ { \mathrm { c p } }$ -the model trained on the dataset $S _ { \mathrm { c p } } = S _ { \mathrm { c l } } + S _ { \mathrm { p o } }$ . Similar to what we did for generating poison points, we achieve this by minimizing the cosine-similarity loss given by
|
| 131 |
+
|
| 132 |
+
$$
|
| 133 |
+
\psi ( \Delta , \theta ) = 1 - \frac { \left. \nabla _ { \theta } \ell ( f ( x _ { \mathrm { t a r g e t } } , \theta ) , y _ { \mathrm { t a r g e t } } ) , \sum _ { i = 1 } ^ { C } \nabla _ { \theta } \ell ( f ( x _ { i } + \Delta _ { i } , \theta ) , y _ { i } ) \right. } { \| \nabla _ { \theta } \ell ( f ( x _ { \mathrm { t a r g e t } } , \theta ) , y _ { \mathrm { t a r g e t } } ) \| \| \sum _ { i = 1 } ^ { C } \nabla _ { \theta } \ell ( f ( x _ { i } + \Delta _ { i } , \theta ) , y _ { i } ) \| } .
|
| 134 |
+
$$
|
| 135 |
+
|
| 136 |
+
Implementation details. We minimize (6) using the Adam optimizer (Kingma & Ba, 2015) with a fixed step size of 0.1. In order to increase the robustness of camouflage generation, we do $R$ restarts (where $R \leq 1 0$ ). In each restart, we first initialize $\Delta$ randomly such that $\| \Delta \| _ { \infty } \leq \varepsilon$ and perform $M$ steps of Adam optimization to minimize $\psi ( \Delta , \theta _ { \mathrm { c p } } )$ . Each optimization step only requires a single differentiation of the objective $\psi$ with respect to $\Delta$ , and can be implemented efficiently. After each step, we project back the updated $\Delta$ into the constraint set $\Gamma$ so as to maintain the property that $\| \Delta \| _ { \infty } \leq \varepsilon$ . After doing $R$ restarts, we choose the best round by finding $\Delta _ { * }$ with the minimum $\psi ( \Delta _ { \star } , \theta _ { \mathrm { c p } } )$ . We provide the pseudocode in Algorithm 2 in the appendix.
|
| 137 |
+
|
| 138 |
+
# 3 EXPERIMENTAL EVALUATION
|
| 139 |
+
|
| 140 |
+
In this section, we give details into our experimental setup. We generate poison points by running Algorithm 1, and camouflage points by running Algorithm 2 with $R = 1$ and $M = 2 5 0$ .5 Each experiment is repeated $K$ times by setting a different seed each time, which fixes the target image, poison class, camouflage class, base poison images and base camouflage images. Due to limited computation resources, we typically set $K \in \{ 3 , \mathsf { \bar { 5 } } , 8 , 1 0 \}$ depending on the dataset and report the mean and standard deviation across different trials. We say that poisoning was successful if the model trained on $S _ { \mathrm { c p } } = S _ { \mathrm { c l } } + S _ { \mathrm { p o } }$ predicts the label $y _ { \mathrm { { a d v e r s a r i a l } } }$ on the target image. Furthermore, we say that camouflaging was successful if the model trained on $S _ { \mathrm { c p c } } = S _ { \mathrm { p o } } + S _ { \mathrm { c l } } + S _ { \mathrm { c a } }$ predicts back the correct label $y _ { \mathrm { t a r g e t } }$ on the target image, provided that poisoning was successful. A camouflaged poisoning attack is successful if both poisoning and camouflaging were successful.
|
| 141 |
+
|
| 142 |
+
For the ease of replication, we provide the code for our experiments with the supplementary material (see Appendix B.2 for details).
|
| 143 |
+
|
| 144 |
+
# 3.1 EVALUATIONS ON CIFAR-10
|
| 145 |
+
|
| 146 |
+
We extensively evaluate our camouflaged poisoning attack on models trained on the CIFAR-10 dataset (Krizhevsky, 2009). CIFAR-10 is a multiclass classification problem with 10 classes, with 6,000 color images in each class (5,000 training $+ 1 { , } 0 0 0$ test) of size $3 2 \times 3 2$ . We follow the standard split into 50,000 training images and 10,000) validation / test images.
|
| 147 |
+
|
| 148 |
+
# 3.1.1 SUPPORT VECTOR MACHINES
|
| 149 |
+
|
| 150 |
+
In order to perform evaluations on SVM, we first convert the CIFAR-10 dataset into a binary classification dataset (which we term as Binary-CIFAR-10) by merging the 10 classes into two groups: animal $( y = + 1 )$ and machine $( y = - 1 )$ . Images (in the training and the test dataset) that were originally labeled (bird, cat, deer, dog, frog, horse) are instead labeled animal, and the remaining images, with original labels (airplane, cars, ship, truck), are labeled machine.
|
| 151 |
+
|
| 152 |
+
We train a linear SVM (no kernel was used) with the hinge loss: $\ell ( f ( x , \theta ) , y ) = \operatorname* { m a x } \{ 0 , 1 -$ $y f ( x , \theta ) \}$ . The training was done using the svm.LinearSVC class from Scikit-learn (Pedregosa et al., 2011) on a single CPU. In the pre-processing stage, each image in the training dataset was normalized to have $\ell _ { 2 }$ -norm 1. Each training on Binary-CIFAR-10 dataset took $2 5 \textrm { - } 3 0$ seconds. In order to generate the poison points, we first use torch.autograd to compute the cosinesimilarity loss (4), and then optimize it using Adam optimizer with learning rate 0.001. Each poison and camouflage generation took about $4 0 \textrm { - } 5 0$ seconds (for $b _ { p } = b _ { c } = 0 . 2 \% )$ . We evaluate both label flipping and gradient matching to generate camouflages, and different threat models $( \varepsilon , b _ { p } , b _ { c } )$ ; the results are reported in Table 1. For each of our experiments we chose $K = 1 0$ seeds. Each trained model had validation accuracy of around $8 1 . 6 3 \%$ on the clean dataset $S _ { \mathrm { c l } }$ , which did not change significantly when we retrained after adding poison samples and / or camouflage samples. Note that the efficacy of the camouflaged poisoning attack was more than $7 0 \%$ in most of the experiments. We provide a sample of the generated poisons and camouflages in Figure 4 in the appendix.
|
| 153 |
+
|
| 154 |
+
# 3.1.2 NEURAL NETWORKS
|
| 155 |
+
|
| 156 |
+
We perform extensive evaluations on the multiclass CIFAR-10 classification task with various popular large scale neural networks architectures including VGG-11, VGG-16 (Simonyan & Zisserman, 2015), ResNet-18, ResNet-34, ResNet-50 (He et al., 2016), and MobileNetV2 (Sandler et al., 2018).
|
| 157 |
+
|
| 158 |
+
Each model is trained with cross-entropy loss $\ell ( f ( x , \theta ) , y ) = - \log ( \operatorname* { P r } ( y = f ( x , \theta ) ) )$ on a single GPU using PyTorch (Paszke et al., 2019), and using mini-batch SGD with weight decay 5e-4, momentum 0.9, learning rate 0.01, batch size 100, and 40 epochs over the training dataset. Each training run took about 45 minutes. The poison and camouflage sets were generated using gradient matching by first defining the cosine-similarity loss using torch.autograd and then minimizing it using Adam with a learning rate of 0.1. Each poison/camouflage generation took about 1.5 hours.
|
| 159 |
+
|
| 160 |
+
We report the efficacy of our camouflaged poisoning attack across different models and threat models $( \varepsilon , b _ { p } , b _ { c } )$ in Figure 3; also see Appendix B.4 for detailed results and performance drops on the validation dataset after adding poison and camouflage set. Each model was trained to have validation accuracy between $8 1 - 8 7 \%$ (depending on the architecture), which changed minimally when the model was retrained with poison and camouflage samples. Poisoning was successful at least $8 0 \%$ of the time in most of the experiments. Camouflaging was successful at least $70 \%$ of the time for VGG11, VGG-16, Resnet-18, and Resnet-34 but was not as successful for MobileNetV2 and Resnet-50. Furthermore, camouflaging succeeded at least $7 5 \%$ of times when $b _ { c } = b _ { p }$ , but did not perform as well when we set $b _ { p } > b _ { c }$ in the thread model (more poison images than camouflage images).
|
| 161 |
+
|
| 162 |
+

|
| 163 |
+
Figure 3: Efficacy of the proposed camouflaged poisoning attack on CIFAR-10 dataset. The left plot gives the success for the threat model $\bar { \varepsilon ^ { * } } = \bar { 1 6 } , b _ { p } = \bar { 0 } . 6 \% , b _ { c } = 0 . 6 \%$ across different neural network architectures. The right plot gives the success for ResNet-18 architecture across different threat models. See Appendix B.4 for the experiment details.
|
| 164 |
+
|
| 165 |
+
# 3.2 EVALUATIONS ON IMAGENETTE AND IMAGEWOOF
|
| 166 |
+
|
| 167 |
+
We evaluate the efficacy of our attack vector on the challenging multiclass classification problem on the Imagenette and Imagewoof datasets (Howard, 2019). Imagenette is a subset of 10 classes (Tench, English springer, Cassette player, Chain saw, Building/church, French horn, Truck, Gas pump, Golf ball, Parachute) from the Imagenet dataset (Russakovsky et al., 2015). The Imagenette dataset consists of around 900 images of various sizes for each class. In total, we have 13394 images which are divided into a training dataset of size 9469 and test dataset of size 3925. To perform training, all images are resized and centrally cropped down to $2 2 4 \times 2 2 4$ pixels.
|
| 168 |
+
|
| 169 |
+
Table 2: Evaluation of camouflaged poisoning attack on Imagenette and Imagewoof datasets over 5 seeds (with 1 restart per seed). Note that camouflaging succeeded in most of the experiments in which poisoning succeeded. Prior works (e.g., Geiping et al. (2021)) set a large number of restarts $R$ , and then choose the most effective attack among them. Due to computational constraints, we ran only one restart (i.e., $R = 1$ ) for each experiment. Given additional computational resources, we could inflate the success rate of both the poisoning and camouflaging.
|
| 170 |
+
|
| 171 |
+
<table><tr><td rowspan="2">Dataset</td><td rowspan="2">Model</td><td colspan="2">Threat Model</td><td colspan="2">Attack Success</td></tr><tr><td>ε bp</td><td>bc</td><td>Poisoning</td><td>Camouflaging</td></tr><tr><td>Imagenette</td><td>VGG-16</td><td>16 6.3%</td><td>6.3%</td><td>25%</td><td>100%</td></tr><tr><td>Imagenette</td><td>Resnet-18</td><td>16 6.3%</td><td>6.3%</td><td>40%</td><td>50%</td></tr><tr><td>Imagewoof</td><td>Resnet-18</td><td>16 6.6%</td><td>6.6%</td><td>50%</td><td>75%</td></tr></table>
|
| 172 |
+
|
| 173 |
+
Imagewoof (Howard, 2019) is another subset of Imagenet dataset consisting of 10 classes (ShihTzu, Rodesian Ridgeback, Beagle, English Foxhound, Border Terrier, Austrailian Terrier, Golden Retriever, Old English Sheep Dog, Samoyed, Dingo). Imagewoof consists of around 900 images of various sizes for each class, and in total 12954 images which are divided into a training dataset of size 9025 and test dataset of size 3929. Similar to Imagenette, we resize all images and crop to the central $2 2 4 \times 2 2 4$ pixels before training.
|
| 174 |
+
|
| 175 |
+
We evaluate our camouflaged poisoning attack on two different neural network architectures-VGG16 and ResNet-18, and different threat models $( \varepsilon , b _ { p } , b _ { c } )$ listed in Table 3.2. Each model is trained on a single GPU with cross-entropy loss, that is minimized using SGD algorithm with weight decay 5e4, momentum 0.9 and batch size 20. We start with a learning rate of 0.01, and exponentially decay it with $\gamma = 0 . 9$ after every epoch, for a total of 50 epochs over the training dataset. The poisons and camouflages were generated using gradient matching by first defining the cosine-similarity loss using torch.autograd and then optimizing it using Adam optimizer with learning rate 0.1. In our experiments, camouflaging was successful for at least $5 0 \%$ of the time when poisoning was successful. However, because we modified about $13 \%$ of the training dataset when adding poisons / camouflages, we observe that the fluctuation in the model’s validation accuracy can be up to $7 \%$ for both Imagenette and Imagewoof, as expected on making such a large change in the training set.
|
| 176 |
+
|
| 177 |
+
Additional experiments. In Appendix B.6, we provide additional experiments on CIFAR-10 showing that our attack is robust to data augmentation, and successfully transfers when the victim model is different from the model on which poison and camouflage samples were generated.
|
| 178 |
+
|
| 179 |
+
Conclusion and discussion. We demonstrated a new attack vector, camouflaged poisoning attacks, against machine learning pipelines where training points can be unlearned. This shows that as we introduce new functionality to machine learning systems, we must be aware of novel threats that emerge. We outline a few interesting directions for further research: It is important to understand how to defend against camouflaged attacks. As observed by Geiping et al. (2021), it is unlikely that differential privacy (Dwork et al., 2006) would be an effective defense, as preventing attacks in the non-camouflaged setting incurs too significant a loss in accuracy. Another direction is to reduce the knowledge needed by the adversary, thereby creating stronger attacks. E.g., while our setting requires grey-box knowledge, one could instead consider a black-box model to attack ML APIs. Finally, it is interesting to determine what other types of threats can be camouflaged, e.g., indiscriminate or backdoor poisoning attacks. Beyond exploring this new attack vector, it is also independently interesting to understand how one can neutralize the effect of an attack by adding points.
|
| 180 |
+
|
| 181 |
+
# REPRODUCIBILITY STATEMENT
|
| 182 |
+
|
| 183 |
+
For the purposes of reproducibility, we include our code in the supplement. Descriptions of the various files are given in Appendix B.2. Hyperparameters and experimental details for all experiments are provided in Section 3. Finally, we report random seeds, target points and classes, poison and camouflage classes for all experiments in Appendix B.3.
|
| 184 |
+
|
| 185 |
+
# REFERENCES
|
| 186 |
+
|
| 187 |
+
Hojjat Aghakhani, Dongyu Meng, Yu-Xiang Wang, Christopher Kruegel, and Giovanni Vigna. Bullseye polytope: A scalable clean-label poisoning attack with improved transferability. In 2021 IEEE European Symposium on Security and Privacy (EuroS&P), pp. 159–178. IEEE, 2021.
|
| 188 |
+
|
| 189 |
+
Marco Barreno, Blaine Nelson, Anthony D Joseph, and J Doug Tygar. The security of machine learning. Machine Learning, 81(2):121–148, 2010.
|
| 190 |
+
|
| 191 |
+
Battista Biggio, Blaine Nelson, and Pavel Laskov. Poisoning attacks against support vector machines. In Proceedings of the 29th International Conference on Machine Learning, ICML ’12, pp. 1467–1474. JMLR, Inc., 2012.
|
| 192 |
+
|
| 193 |
+
Lucas Bourtoule, Varun Chandrasekaran, Christopher A Choquette-Choo, Hengrui Jia, Adelin Travers, Baiwu Zhang, David Lie, and Nicolas Papernot. Machine unlearning. In proceedings of the 42nd IEEE Symposium on Security and Privacy, SP ’21, Washington, DC, USA, 2021. IEEE Computer Society.
|
| 194 |
+
|
| 195 |
+
Jonathan Brophy and Daniel Lowd. Machine unlearning for random forests. In Proceedings of the 38th International Conference on Machine Learning, ICML ’21, pp. 1092–1104. JMLR, Inc., 2021.
|
| 196 |
+
|
| 197 |
+
Yinzhi Cao and Junfeng Yang. Towards making systems forget with machine unlearning. In Proceedings of the 36th IEEE Symposium on Security and Privacy, SP ’15, pp. 463–480, Washington, DC, USA, 2015. IEEE Computer Society.
|
| 198 |
+
|
| 199 |
+
Min Chen, Zhikun Zhang, Tianhao Wang, Michael Backes, Mathias Humbert, and Yang Zhang. When machine unlearning jeopardizes privacy. In Proceedings of the 2021 ACM SIGSAC Conference on Computer and Communications Security, pp. 896–911, 2021.
|
| 200 |
+
|
| 201 |
+
Antonio Emanuele Cina, Kathrin Grosse, Ambra Demontis, Sebastiano Vascon, Werner Zellinger, \` Bernhard A Moser, Alina Oprea, Battista Biggio, Marcello Pelillo, and Fabio Roli. Wild patterns reloaded: A survey of machine learning security against training data poisoning. arXiv preprint arXiv:2205.01992, 2022.
|
| 202 |
+
|
| 203 |
+
Ilias Diakonikolas, Gautam Kamath, Daniel M. Kane, Jerry Li, Jacob Steinhardt, and Alistair Stewart. Sever: A robust meta-algorithm for stochastic optimization. In Proceedings of the 36th International Conference on Machine Learning, ICML ’19, pp. 1596–1606. JMLR, Inc., 2019.
|
| 204 |
+
|
| 205 |
+
Min Du, Zhi Chen, Chang Liu, Rajvardhan Oak, and Dawn Song. Lifelong anomaly detection through unlearning. In Proceedings of the 2019 ACM SIGSAC Conference on Computer and Communications Security, pp. 1283–1297, 2019.
|
| 206 |
+
|
| 207 |
+
Cynthia Dwork, Frank McSherry, Kobbi Nissim, and Adam Smith. Calibrating noise to sensitivity in private data analysis. In Proceedings of the 3rd Conference on Theory of Cryptography, TCC ’06, pp. 265–284, Berlin, Heidelberg, 2006. Springer.
|
| 208 |
+
|
| 209 |
+
Federal Trade Commission. California company settles ftc allegations it deceived consumers about use of facial recognition in photo storage app, January 2021.
|
| 210 |
+
|
| 211 |
+
Jonas Geiping, Liam Fowl, W Ronny Huang, Wojciech Czaja, Gavin Taylor, Michael Moeller, and Tom Goldstein. Witches’ brew: Industrial scale data poisoning via gradient matching. In Proceedings of the 9th International Conference on Learning Representations, ICLR ’21, 2021.
|
| 212 |
+
|
| 213 |
+
General Data Protection Regulation. Regulation (EU) 2016/679 of the European parliament and of the council of 27 April 2016, 2016.
|
| 214 |
+
|
| 215 |
+
Antonio Ginart, Melody Guan, Gregory Valiant, and James Y Zou. Making AI forget you: Data deletion in machine learning. In Advances in Neural Information Processing Systems 32, NeurIPS ’19, pp. 3518–3531. Curran Associates, Inc., 2019.
|
| 216 |
+
|
| 217 |
+
Aditya Golatkar, Alessandro Achille, and Stefano Soatto. Eternal sunshine of the spotless net: Selective forgetting in deep networks. In Proceedings of the 2020 IEEE Computer Society Conference on Computer Vision and Pattern Recognition, CVPR ’20, pp. 9304–9312, Washington, DC, USA, 2020. IEEE Computer Society.
|
| 218 |
+
|
| 219 |
+
Aditya Golatkar, Alessandro Achille, Avinash Ravichandran, Marzia Polito, and Stefano Soatto. Mixed-privacy forgetting in deep networks. In Proceedings of the 2021 IEEE Computer Society Conference on Computer Vision and Pattern Recognition, CVPR ’21, pp. 792–801. IEEE Computer Society, 2021.
|
| 220 |
+
|
| 221 |
+
Micah Goldblum, Dimitris Tsipras, Chulin Xie, Xinyun Chen, Avi Schwarzschild, Dawn Song, Aleksander Madry, Bo Li, and Tom Goldstein. Dataset security for machine learning: Data poisoning, backdoor attacks, and defenses. arXiv preprint arXiv:2012.10544, 2020.
|
| 222 |
+
|
| 223 |
+
Tianyu Gu, Brendan Dolan-Gavitt, and Siddharth Garg. Badnets: Identifying vulnerabilities in the machine learning model supply chain. arXiv preprint arXiv:1708.06733, 2017.
|
| 224 |
+
|
| 225 |
+
Chuan Guo, Tom Goldstein, Awni Hannun, and Laurens Van Der Maaten. Certified data removal from machine learning models. In Proceedings of the 37th International Conference on Machine Learning, ICML ’20, pp. 3832–3842. JMLR, Inc., 2020.
|
| 226 |
+
|
| 227 |
+
Varun Gupta, Christopher Jung, Seth Neel, Aaron Roth, Saeed Sharifi-Malvajerdi, and Chris Waites. Adaptive machine unlearning. In Advances in Neural Information Processing Systems 34, NeurIPS ’21, pp. 16319–16330. Curran Associates, Inc., 2021.
|
| 228 |
+
|
| 229 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the 2016 IEEE Computer Society Conference on Computer Vision and Pattern Recognition, CVPR ’16, pp. 770–778, Washington, DC, USA, 2016. IEEE Computer Society.
|
| 230 |
+
|
| 231 |
+
Jeremy Howard. Imagenette, 2019. URL https://github.com/fastai/imagenette/.
|
| 232 |
+
|
| 233 |
+
W Ronny Huang, Jonas Geiping, Liam Fowl, Gavin Taylor, and Tom Goldstein. Metapoison: Practical general-purpose clean-label data poisoning. In Advances in Neural Information Processing Systems 33, NeurIPS ’20, pp. 12080–12091. Curran Associates, Inc., 2020.
|
| 234 |
+
|
| 235 |
+
Information Commissioner’s Office. Guidance on the ai auditing framework, February 2020.
|
| 236 |
+
|
| 237 |
+
Zachary Izzo, Mary Anne Smart, Kamalika Chaudhuri, and James Zou. Approximate data deletion from machine learning models: Algorithms and evaluation. In Proceedings of the 24th International Conference on Artificial Intelligence and Statistics, AISTATS ’21, pp. 2008–2016. JMLR, Inc., 2021.
|
| 238 |
+
|
| 239 |
+
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In Proceedings of the 3rd International Conference on Learning Representations, ICLR ’15, 2015.
|
| 240 |
+
|
| 241 |
+
Pang Wei Koh, Jacob Steinhardt, and Percy Liang. Stronger data poisoning attacks break data sanitization defenses. Machine Learning, 111(1):1–47, 2022.
|
| 242 |
+
|
| 243 |
+
Alex Krizhevsky. Learning multiple layers of features from tiny images, 2009.
|
| 244 |
+
|
| 245 |
+
Neil G Marchant, Benjamin IP Rubinstein, and Scott Alfeld. Hard to forget: Poisoning attacks on certified machine unlearning. In Proceedings of the Thirty-Sixth AAAI Conference on Artificial Intelligence, volume 36 of AAAI ’22, pp. 7691–7700, 2022.
|
| 246 |
+
|
| 247 |
+
Luis Munoz-Gonz ˜ alez, Battista Biggio, Ambra Demontis, Andrea Paudice, Vasin Wongrassamee, ´ Emil C Lupu, and Fabio Roli. Towards poisoning of deep learning algorithms with back-gradient optimization. In Proceedings of the 10th ACM workshop on artificial intelligence and security, pp. 27–38, 2017.
|
| 248 |
+
|
| 249 |
+
Seth Neel, Aaron Roth, and Saeed Sharifi-Malvajerdi. Descent-to-delete: Gradient-based methods for machine unlearning. In Proceedings of the 32nd International Conference on Algorithmic Learning Theory, ALT ’21. JMLR, Inc., 2021.
|
| 250 |
+
|
| 251 |
+
Quoc Phong Nguyen, Bryan Kian Hsiang Low, and Patrick Jaillet. Variational bayesian unlearning. Advances in Neural Information Processing Systems, 33:16025–16036, 2020.
|
| 252 |
+
|
| 253 |
+
Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Ed- ¨ ward Yang, Zach DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. PyTorch: An imperative style, high-performance deep learning library. In Advances in Neural Information Processing Systems 32, NeurIPS ’19, pp. 8026–8037. Curran Associates, Inc., 2019.
|
| 254 |
+
|
| 255 |
+
Andrea Paudice, Luis Munoz-Gonz ˜ alez, and Emil C Lupu. Label sanitization against label flipping ´ poisoning attacks. In Joint European conference on machine learning and knowledge discovery in databases, pp. 5–15. Springer, 2018.
|
| 256 |
+
|
| 257 |
+
Fabian Pedregosa, Gael Varoquaux, Alexandre Gramfort, Vincent Michel, Bertrand Thirion, Olivier¨ Grisel, Mathieu Blondel, Peter Prettenhofer, Ron Weiss, Vincent Dubourg, Jake Vanderplas, Alexandre Passos, David Cournapeau, Matthieu Brucher, Matthieu Perrot, and Edouard Duch- ´ esnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12(85): 2825–2830, 2011.
|
| 258 |
+
|
| 259 |
+
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.
|
| 260 |
+
|
| 261 |
+
Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. MobileNetV2: Inverted residuals and linear bottlenecks. In Proceedings of the 2018 IEEE Computer Society Conference on Computer Vision and Pattern Recognition, CVPR ’18, pp. 4510–4520, Washington, DC, USA, 2018. IEEE Computer Society.
|
| 262 |
+
|
| 263 |
+
Ayush Sekhari, Jayadev Acharya, Gautam Kamath, and Ananda Theertha Suresh. Remember what you want to forget: Algorithms for machine unlearning. In Advances in Neural Information Processing Systems 34, NeurIPS ’21, pp. 18075–18086. Curran Associates, Inc., 2021.
|
| 264 |
+
|
| 265 |
+
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale visual recognition. In Proceedings of the 3rd International Conference on Learning Representations, ICLR ’15, 2015.
|
| 266 |
+
|
| 267 |
+
David Marco Sommer, Liwei Song, Sameer Wagh, and Prateek Mittal. Towards probabilistic verification of machine unlearning. arXiv preprint arXiv:2003.04247, 2020.
|
| 268 |
+
|
| 269 |
+
Jacob Steinhardt, Pang Wei W Koh, and Percy S Liang. Certified defenses for data poisoning attacks. In Advances in Neural Information Processing Systems 30, NeurIPS ’17, pp. 3520–3532. Curran Associates, Inc., 2017.
|
| 270 |
+
|
| 271 |
+
Octavian Suciu, Radu Marginean, Yigitcan Kaya, Hal Daume III, and Tudor Dumitras. When does machine learning $\{ { \mathrm { F A I L } } \} \lambda$ generalized transferability for evasion and poisoning attacks. In 27th USENIX Security Symposium (USENIX Security 18), pp. 1299–1316, 2018.
|
| 272 |
+
|
| 273 |
+
Ziteng Sun, Peter Kairouz, Ananda Theertha Suresh, and H Brendan McMahan. Can you really backdoor federated learning? arXiv preprint arXiv:1911.07963, 2019.
|
| 274 |
+
|
| 275 |
+
Brandon Tran, Jerry Li, and Aleksander Madry. Spectral signatures in backdoor attacks. In Advances in Neural Information Processing Systems 31, NeurIPS ’18, pp. 8011–8021. Curran Associates, Inc., 2018.
|
| 276 |
+
|
| 277 |
+
Enayat Ullah, Tung Mai, Anup Rao, Ryan A Rossi, and Raman Arora. Machine unlearning via algorithmic stability. In Conference on Learning Theory, pp. 4126–4142. PMLR, 2021.
|
| 278 |
+
|
| 279 |
+
Han Xiao, Huang Xiao, and Claudia Eckert. Adversarial label flips attack on support vector machines. In ECAI 2012, pp. 870–875. IOS Press, 2012.
|
| 280 |
+
|
| 281 |
+
Huang Xiao, Battista Biggio, Blaine Nelson, Han Xiao, Claudia Eckert, and Fabio Roli. Support vector machines under adversarial label contamination. Neurocomputing, 160:53–62, 2015.
|
| 282 |
+
|
| 283 |
+
Santiago Zanella-Beguelin, Lukas Wutschitz, Shruti Tople, Victor R ´ uhle, Andrew Paverd, Olga ¨ Ohrimenko, Boris Kopf, and Marc Brockschmidt. Analyzing information leakage of updates to ¨ natural language models. In Proceedings of the 2020 ACM SIGSAC Conference on Computer and Communications Security, pp. 363–375, 2020.
|
| 284 |
+
|
| 285 |
+
# A POISON GENERATION ALGORITHM
|
| 286 |
+
|
| 287 |
+
# Algorithm 1 Gradient Matching to generate poisons (Geiping et al., 2021)
|
| 288 |
+
|
| 289 |
+
Require: Clean network $f ( \cdot ; \theta _ { \mathrm { c l e a n } } )$ trained on uncorrupted base images $S _ { \mathrm { c l } }$ , a target $( x _ { \mathrm { { t a r g e t } } } , y _ { \mathrm { { t a r g e t } } } )$ and an adversarial label yadversarial, Poison budget $P$ , perturbation bound $\varepsilon$ ,
|
| 290 |
+
number of restar1: Collect a dataset $R$ stof $M$ ny images whose true label is yadversarial. $S _ { \mathrm { p o } } = \left\{ x ^ { i } , y ^ { i } \right\} _ { i = 1 } ^ { P }$ $P$ restarts do 3: Randomly initialize perturbations $\Delta$ s.t. $\| \Delta \| _ { \infty } \leq \varepsilon$ . 4: for $k = 1 , \dots , M$ optimization steps do 5: Compute the loss $\phi ( \Delta , \theta _ { \mathrm { c l e a n } } )$ as in (4) using the base poison images in $S _ { \mathrm { p o } }$ . 6: Update $\Delta$ using an Adam update to minimize $\phi$ , and project onto the constraint set $\Gamma$ . 7: end for 8: Amongst the $R$ restarts, choose the $\Delta _ { * }$ with the smallest value of $\phi ( \Delta _ { * } , \theta _ { \mathrm { c l e a n } } )$ .
|
| 291 |
+
9: end for10: Return the poisoned set $S _ { \mathrm { p o } } = \left\{ x ^ { i } + \Delta _ { * } ^ { i } , y ^ { i } \right\} _ { i = 1 } ^ { P } .$
|
| 292 |
+
|
| 293 |
+
# Algorithm 2 Gradient Matching to generate camouflages
|
| 294 |
+
|
| 295 |
+
Require: Network $f ( \cdot ; \theta _ { \mathrm { c p } } )$ trained on $S _ { \mathrm { c l } } + S _ { \mathrm { p o } }$ , the target $( x _ { \mathrm { { t a r g e t } } } , y _ { \mathrm { { t a r g e t } } } )$ ), Camouflage budget
|
| 296 |
+
$C$ , perturbation bound $\varepsilon$ , number of restarts $R$ , optimization steps $M$
|
| 297 |
+
1: Collect a dataset $\boldsymbol { S _ { \mathrm { c a } } } = \left\{ \boldsymbol { x ^ { j } } , \boldsymbol { y ^ { j } } \right\} _ { j = 1 } ^ { C }$ of $C$ many images whose true label is $y _ { \mathrm { t a r g e t } }$ .
|
| 298 |
+
2: for $r = 1 , \dots R$ restarts do
|
| 299 |
+
3: Randomly initialize perturbations $\Delta$ s.t. $\| \Delta \| _ { \infty } \leq \varepsilon$ .
|
| 300 |
+
4: for $k = 1 , \dots , M$ optimization steps do
|
| 301 |
+
5: Compute the loss $\psi ( \Delta , \theta _ { \mathrm { c p } } )$ as in (4) using the base camouflage images in $S _ { \mathrm { c a } }$ .
|
| 302 |
+
6: Update $\Delta$ using an Adam update to minimize $\psi$ , and project onto the constraint set $\Gamma$ .
|
| 303 |
+
7: end for
|
| 304 |
+
8: Amongst the $R$ restarts, choose the $\Delta _ { * }$ with the smallest value of $\psi ( \Delta _ { * } , \theta _ { \mathrm { c p } } )$ .
|
| 305 |
+
9: end for
|
| 306 |
+
|
| 307 |
+
$\begin{array} { r } { S _ { \mathrm { c a } } = \left\{ x ^ { j } + \Delta _ { * } ^ { j } , y ^ { j } \right\} _ { j = 1 } ^ { C } . } \end{array}$
|
| 308 |
+
|
| 309 |
+
# B EXPERIMENT DETAILS
|
| 310 |
+
|
| 311 |
+
# B.1 HARDWARE
|
| 312 |
+
|
| 313 |
+
All our experiments were executed on Google Colab with a Google Colab Pro+ subscription.
|
| 314 |
+
|
| 315 |
+
# B.2 CODE
|
| 316 |
+
|
| 317 |
+
We provide code for our experiments as ready-to-deploy Colab notebooks (as well as Python files). In the supplementary material, the code can be found in:
|
| 318 |
+
|
| 319 |
+
1. SVM Binay cifar10 code submission.ipynb: Experiments for Binary-CIFAR10 dataset with linear SVM.
|
| 320 |
+
2. Neural network Cifar10 code submission.ipynb: Experiments for CIFAR10 dataset with various neural network models.
|
| 321 |
+
3. Neural network Imagenette Imagewoof code submission.ipynb: Experiments for Imagenette / Imagewoof dataset with various neural network models.
|
| 322 |
+
|
| 323 |
+
# B.3 EXPERIMENTAL SETUP
|
| 324 |
+
|
| 325 |
+
For the ease of replication, we report the corresponding poison class, target class, camouflage class and Target ID for various seeds in different experiments.
|
| 326 |
+
|
| 327 |
+
Table 3: Target, poison and camouflage class corresponding to different initial random seeds used for CIFAR-10 experiments. The reported Target ID is relative to the CIFAR-10 validation dataset.
|
| 328 |
+
|
| 329 |
+
<table><tr><td>RandomSeed</td><td>Target Class</td><td>Poison Class</td><td>Camouflage Class</td><td>Target ID</td></tr><tr><td>2000000000</td><td>Deer</td><td>Bird</td><td>Deer</td><td>9621</td></tr><tr><td>2000000001</td><td>Cat</td><td>Horse</td><td>Cat</td><td>1209</td></tr><tr><td>2000000011</td><td>Frog</td><td>Bird</td><td>Frog</td><td>6503</td></tr><tr><td>2000000111</td><td>Bird</td><td>Cat</td><td>Bird</td><td>124</td></tr><tr><td>2000001111</td><td>Plane</td><td>Deer</td><td>Plane</td><td>7649</td></tr><tr><td>2000011111</td><td>Cat</td><td>Dog</td><td>Cat</td><td>4423</td></tr><tr><td>2000111111</td><td>Truck</td><td>Car</td><td>Truck</td><td>8117</td></tr><tr><td>2001111111</td><td>Bird</td><td>Truck</td><td>Bird</td><td>3686</td></tr><tr><td>2011111111</td><td>Cat</td><td>Bird</td><td>Cat</td><td>642</td></tr><tr><td>2111111111</td><td>Frog</td><td>Ship</td><td>Frog</td><td>97</td></tr></table>
|
| 330 |
+
|
| 331 |
+
Table 4: Target class, poison class and camouflage class corresponding to different random seeds used for Imagenette experiments. The reported target ID is relative to the Imagenette validation set.
|
| 332 |
+
|
| 333 |
+
<table><tr><td>RandomSeed</td><td>Target Class</td><td>Poison Class</td><td>Camouflage Class</td><td>Target ID</td></tr><tr><td>2000000000</td><td>Building</td><td>Cassette player</td><td>Building</td><td>1559</td></tr><tr><td>2000000001</td><td>Chain saw</td><td>Gas pump</td><td>Chain saw</td><td>1266</td></tr><tr><td>2000000011</td><td>Truck</td><td>Cassette player</td><td>Truck</td><td>2460</td></tr><tr><td>2000000111</td><td>Cassette player</td><td>Chain saw</td><td>Cassette player</td><td>792</td></tr><tr><td>2000001111</td><td>Tench</td><td>Building</td><td>Tench</td><td>2500</td></tr><tr><td>2000011111</td><td>Chain saw</td><td>French horn</td><td>Chain saw</td><td>1162</td></tr><tr><td>2000111111</td><td>Parachute</td><td>English springer</td><td>Parachute</td><td>3826</td></tr><tr><td>2001111111</td><td>Cassette player</td><td>Parachute</td><td>Cassette player</td><td>1121</td></tr><tr><td>2011111111</td><td>Chain saw</td><td>Cassette player</td><td>Chain saw</td><td>1198</td></tr><tr><td>2111111111</td><td>Truck</td><td>Golf ball</td><td>Truck</td><td>2343</td></tr></table>
|
| 334 |
+
|
| 335 |
+
Table 5: Target class, poison class and camouflage class corresponding to different random seeds used for Imagewoof experiments. The reported target ID is relative to the Imagewoof validation set.
|
| 336 |
+
|
| 337 |
+
<table><tr><td>RandomSeed</td><td>Target Class</td><td>Poison Class</td><td>Camouflage Class</td><td>Target ID</td></tr><tr><td>2000000000</td><td>BorderTerrier</td><td>Beagle</td><td>BorderTerrier</td><td>1493</td></tr><tr><td>2000000001</td><td>English Foxhound</td><td>Old English Sheep Dog</td><td>English Foxhound</td><td>1362</td></tr><tr><td>2000000011</td><td>Golden Retriever</td><td>Beagle</td><td>Golden Retriever</td><td>2399</td></tr><tr><td>2000000111</td><td>Beagle</td><td>English Foxhound</td><td>Beagle</td><td>827</td></tr><tr><td>2000001111</td><td>Shih-Tzu</td><td>Border Terrier</td><td>Shih-Tzu</td><td>250</td></tr><tr><td>2000011111</td><td>English Foxhound</td><td>Austrailian Terrier</td><td>English Foxhound</td><td>1405</td></tr><tr><td>2000111111</td><td>Dingo</td><td>Rodesian Ridgeback</td><td>Dingo</td><td>3810</td></tr><tr><td>2001111111</td><td>Beagle</td><td>Dingo</td><td>Beagle</td><td>1204</td></tr><tr><td>2011111111</td><td>English Foxhound</td><td>Beagle</td><td>English Foxhound</td><td>1294</td></tr><tr><td>2111111111</td><td>Golden Retriever</td><td>Samoeyed</td><td>Golden Retriever</td><td>2282</td></tr></table>
|
| 338 |
+
|
| 339 |
+
# B.4 ADDITIONAL DETAILS ON CIFAR-10 EXPERIMENTS
|
| 340 |
+
|
| 341 |
+
We elaborate on the results reported in Figure 3. In Table 6, we report the efficacy of the proposed camouflaged poisoning attack on different neural network architectures where the threat model is given by $\varepsilon = 1 6 , b _ { p } = 0 . 6 \% , b _ { c } = 0 . 6 \%$ . The reported results are an average over 5 seeds from 2000000000-2000001111. In the first column under attack success, we report the number of times poisoning was successful amongst the run trials, and in the second column, we report the number of times camouflaging was successful for the trials for which poisoning was successful.
|
| 342 |
+
|
| 343 |
+
In Table 7, we report the success of the proposed attack when we change the threat model, but fix the network architecture to be ResNet-18. Each experiment was repeated times 5 times with 8 restarts each time, and the mean success rate is reported. These experiments were conducted with 5 seeds from 2000011111-2111111111.
|
| 344 |
+
|
| 345 |
+
Table 6: Evaluating our proposed camouflaged poisoning attack on various model architectures on the CIFAR-10 dataset with the threat model $\bar { \varepsilon } = \bar { 1 } 6 , b _ { p } = \bar { 0 } . 6 \% , b _ { c } = 0 . 6 \%$ .
|
| 346 |
+
|
| 347 |
+
<table><tr><td rowspan="2">Network Architecture</td><td colspan="2">Attack success</td><td colspan="3">Validation Accuracy</td></tr><tr><td>Poisoning</td><td>Camouflaging</td><td>Clean</td><td>Poisoned</td><td>Camouflaged</td></tr><tr><td>VGG-11</td><td>100%</td><td>80%</td><td>85.01</td><td>85.03 (± 0.37)</td><td>85.10 (± 0.29)</td></tr><tr><td>VGG-16</td><td>80%</td><td>75%</td><td>87.68</td><td>87.42 (± 0.17)</td><td>87.45 (± 0.26)</td></tr><tr><td>ResNet-18</td><td>80%</td><td>75%</td><td>82.13</td><td>81.88 (± 0.15)</td><td>81.80 (± 0.12)</td></tr><tr><td>ResNet-34</td><td>80%</td><td>50%</td><td>82.45</td><td>82.61 (± 0.30)</td><td>83.12 (± 0.93)</td></tr><tr><td>ResNet-50</td><td>80%</td><td>25%</td><td>81.02</td><td>81.76 (± 0.13)</td><td>84.62 (± 0.71)</td></tr><tr><td>MobileNetV2</td><td>60%</td><td>33%</td><td>82.79</td><td>83.26 (± 0.25)</td><td>85.47 (± 0.27)</td></tr></table>
|
| 348 |
+
|
| 349 |
+
Table 7: Evaluating our proposed camouflaged poisoning attack on various threat models with CIFAR-10 dataset trained on ResNet-18.
|
| 350 |
+
|
| 351 |
+
<table><tr><td colspan="2">Threat model</td><td colspan="2">Attack success</td><td colspan="3">Validation Accuracy</td></tr><tr><td>0</td><td>bp</td><td>bc</td><td>Poisoning Camouflaging</td><td>Clean</td><td>Poisoned</td><td>Camouflaged</td></tr><tr><td>16</td><td>1%</td><td>1%</td><td>100% 80%</td><td>82.13</td><td>81.98 (± 0.16)</td><td>82.12 (± 0.21)</td></tr><tr><td>8</td><td>1%</td><td>1%</td><td>80% 75%</td><td>82.13</td><td>82.21 (± 0.21)</td><td>82.09 (± 0.23)</td></tr><tr><td>16</td><td>2%</td><td>1%</td><td>100% 20%</td><td>82.13</td><td>82.31 (± 0.26)</td><td>82.19 (± 0.24)</td></tr><tr><td>8</td><td>2%</td><td>1%</td><td>100% 40%</td><td>82.13</td><td>82.43 (± 0.30)</td><td>82.34 (± 0.27)</td></tr></table>
|
| 352 |
+
|
| 353 |
+

|
| 354 |
+
Figure 4: Visualization of poisons and camouflages on Binary-CIFAR-10 dataset (animal vs machine classification). The top row shows the original images and the bottom row shows the corresponding poisoned / camouflaged images (with the added $\Delta$ ). The shown images were generated for a camouflaged poisoning attack on SVM, with $\mathrm { S e e d } = 5 5 5 5 5 5 5$ , $\varepsilon = 1 6$ , $b _ { p } = 0 . 2 , b _ { c } = 0 . 4$ and the target ID 6646.
|
| 355 |
+
|
| 356 |
+

|
| 357 |
+
Figure 5: Visualization of poisons and camouflages on CIFAR-10 dataset (multiclass classification task). The top row shows the original images and the bottom row shows the corresponding poisoned / camouflaged images (with the added $\Delta$ ). The shown images were generated for a camouflaged poisoning attack on ResNet-18, with $\mathrm { S e e d } = 2 0 0 0 0 0 0 0 0 0 0$ $\varepsilon = 8$ , $b _ { p } = 0 . 2 , b _ { c } = 0 . 4$ , poison class bird, target class deer, and the target ID 9621.
|
| 358 |
+
|
| 359 |
+

|
| 360 |
+
Figure 6: Visualization of poisons and camouflages on Imagenette dataset. The first and the third columns shows the original images, and the second and the fourth columns shows the corrupted images (with added $\Delta$ ). The shown images were generated for a camouflaged poisoning attack on ResNet-18, with S $\mathrm { e e d } = 2 0 0 0 0 1 1 1 1$ 11 and $\varepsilon = 8$ . The target and camouflage class is chain saw, and the poison class is French horn.
|
| 361 |
+
|
| 362 |
+

|
| 363 |
+
Figure 7: Some representative poison and camouflage images for attack on Imagewoof dataset. In each pair, the left figure is the original picture from the training dataset and the right figure has been adversarially manipulated by adding $\Delta$ . The shown images were generated for a camouflaged poisoning attack on Resnet-18, with S $\mathbf { \dot { \ s e d } } = 1 0 0 0 0 0 0 0 5$ , $b _ { p } = \bar { b } _ { c } = 6 . 6 \%$ and $\varepsilon = 1 6$ . The target and camouflage class is English Springer, and the poison class is Building (Church).
|
| 364 |
+
|
| 365 |
+

|
| 366 |
+
Figure 8: Visualization of poisons and camouflages on Imagewoof dataset. The first and the third columns shows the original images, and the second and the fourth columns shows the corrupted images (with added $\Delta$ ). The shown images were generated for a camouflaged poisoning attack on ResNet-18, with Seed = 2111111110, $b _ { p } = b _ { c } = 4 . 2 \%$ , $\varepsilon = 1 6$ . The target and camouflage class is Austrailian Terrier, and the poison class is Golden Retriever.
|
| 367 |
+
|
| 368 |
+
# B.6 ADDITIONAL EXPERIMENTS
|
| 369 |
+
|
| 370 |
+
B.6.1 ABLATION STUDY FOR DIFFERENT VALUES OF $b _ { p }$ AND $\cdot$
|
| 371 |
+
|
| 372 |
+
In this section, we explore the effect of changing the relative sizes of the poison samples and camouflage samples. The experiments are performed on ResNet-18 for CIFAR-10 dataset with $b _ { p } = 1 \%$ and $\_$ respectively, and vice-versa. We report the results in Table 8.
|
| 373 |
+
|
| 374 |
+
One may also wonder what is the price that an attacker has to pay in terms of the success rate of a poisoning (only) attack if it chooses to devote a part of the budget for camouflages. In Table 9, we report the results for comparing the success rate $1 \%$ poisons and $1 \%$ camouflages, to success rate with $2 \%$ poisons (and no camouflages.)
|
| 375 |
+
|
| 376 |
+
<table><tr><td colspan="2">Problem parameters</td><td colspan="2">Attack success</td><td colspan="3">Validation Accuracy</td></tr><tr><td>bp</td><td>bc</td><td>Poisoning</td><td>Camouflaging</td><td>Clean</td><td>Poisoned</td><td>Camouflaged</td></tr><tr><td>1%</td><td>1.5%</td><td>83%</td><td>80%</td><td>0.822</td><td>0.8191</td><td>0.8264</td></tr><tr><td>1%</td><td>0.5%</td><td>83%</td><td>40%</td><td>0.845</td><td>0.8395</td><td>0.8432</td></tr><tr><td>1%</td><td>1%</td><td>83%</td><td>80%</td><td>0.822</td><td>0.8274</td><td>0.8244</td></tr><tr><td>0.5%</td><td>1%</td><td>33%</td><td>50%</td><td>0.822</td><td>0.8261</td><td>0.8194</td></tr><tr><td>1.5%</td><td>1%</td><td>83%</td><td>20%</td><td>0.822</td><td>0.8156</td><td>0.8118</td></tr></table>
|
| 377 |
+
|
| 378 |
+
Table 8: Effect of different sizes of poison and camouflage datasets on the success of the proposed camouflaged poisoning attack on CIFAR-10 dataset trained on ResNet-18, with $\varepsilon = 1 6$ . The reported success rates are averaged over six different trials with seeds 200000111-211111111. For each experiment, we do 4 restarts for every poison and camouflage generation.
|
| 379 |
+
|
| 380 |
+
<table><tr><td colspan="2">Problem parameters</td><td colspan="2">Attack success</td><td colspan="3">Validation Accuracy</td></tr><tr><td>bp</td><td>bc</td><td>Poisoning</td><td>Camouflaging</td><td>Clean</td><td>Poisoned</td><td>Camouflaged</td></tr><tr><td>1%</td><td>1%</td><td>83%</td><td>80%</td><td>0.822</td><td>0.8274</td><td>0.8244</td></tr><tr><td>2%</td><td>0</td><td>83%</td><td>N/A</td><td>0.822</td><td>0.817</td><td>N/A</td></tr></table>
|
| 381 |
+
|
| 382 |
+
Table 9: Comparison of success rate when the allocated budget of $2 \%$ is split as: (a) $1 \%$ poisons and $1 \%$ camouflage, and (b) $2 \%$ poison samples and $0 \%$ camouflages. The experiment is performed on CIFAR-10 dataset trained on ResNet-18 with $\varepsilon = 1 6$ . The reported success rates are averaged over six different trials with seeds 200000111 - 211111111. For each experiment, we do 4 restarts per poison or camouflage generation.
|
| 383 |
+
|
| 384 |
+
# B.6.2 ROBUSTNESS OF OUR ATTACK TO RANDOM DELETIONS
|
| 385 |
+
|
| 386 |
+
We next explore the effect of random removal of the generated poison and camouflage samples on the success of our attack. In a data-scraping scenario, a victim may not scrape all the data points modified by an attacker. In Table 10, we report the result where different amounts of the generated poison and camouflage samples are deleted uniformly at random.
|
| 387 |
+
|
| 388 |
+
<table><tr><td colspan="2">Amount removed</td><td colspan="2">Attack success</td><td colspan="3">Validation Accuracy</td></tr><tr><td>Poisons</td><td>Camouflages</td><td>Poisoning</td><td>Camouflaging</td><td>Clean</td><td>Poisoned</td><td>Camouflaged</td></tr><tr><td>5%</td><td>5%</td><td>80%</td><td>75%</td><td>0.822</td><td>0.823</td><td>0.819</td></tr><tr><td>10%</td><td>10%</td><td>60%</td><td>33%</td><td>0.822</td><td>0.817</td><td>0.825</td></tr><tr><td>20%</td><td>20%</td><td>80%</td><td>100%</td><td>0.822</td><td>0.826</td><td>0.820</td></tr><tr><td>30%</td><td>30%</td><td>100%</td><td>80%</td><td>0.822</td><td>0.8215</td><td>0.818</td></tr><tr><td>40%</td><td>40%</td><td>20%</td><td>100%</td><td>0.822</td><td>0.825</td><td>0.817</td></tr></table>
|
| 389 |
+
|
| 390 |
+
Table 10: Effect of random removal of the generated poison and camouflage samples on the success of the proposed camouflaged poisoning attack on CIFAR-10 dataset trained on ResNet-18, with $\varepsilon \ = \ 1 6$ . The reported success rates are averaged over 5 different trials with seeds 200001111 - 211111111. For each experiment, we do 4 restarts for every poison and camouflage generation.
|
| 391 |
+
|
| 392 |
+
# B.6.3 TRANSFER EXPERIMENTS
|
| 393 |
+
|
| 394 |
+
In this section, we show that the poison and camouflage samples generated by the proposed approach transfer across models. Thus, an attacker can successfully execute the camouflaged poisoning attack, even if the victim trains a different model than the one on which the poison and camouflage samples were generated. We show the transfer success in Figure 9. The brewing network denotes the network architecture on which poison and camouflage samples were generated (we adopt the same notation as Geiping et al. (2021)). The victim network denotes the model architecture used by the victim for training on the manipulated dataset.
|
| 395 |
+
|
| 396 |
+
We ran a total of 3 experiments per (brewing model, victim model) pair using the seeds 2000000000- 2000000011. Each reported number denotes the fraction of times when both poisoning and camouflaging were successful in the transfer experiment, and thus the attack could take place.
|
| 397 |
+
|
| 398 |
+

|
| 399 |
+
Figure 9: Transfer experiments on CIFAR-10 dataset.
|
| 400 |
+
|
| 401 |
+
# B.6.4 ROBUSTNESS TO DATA AUGMENTATION
|
| 402 |
+
|
| 403 |
+
Data augmentation is commonly used to avoid overfitting in deep neural networks. In order to be applicable in the real life, our poisoning and camouflaging attacks must be successful even when the model is trained with data augmentation. In order to validate this, we evaluate our approach on CIFAR-10 dataset trained with data augmentation on ResNet-18 in the threat model $\varepsilon = 1 6 , b _ { p } =$ $b _ { c } = 1 \%$ ; the results are in Table 11. The considered data augmentations are:
|
| 404 |
+
|
| 405 |
+
1. No Augmentation: Exact images from the training dataset are used.
|
| 406 |
+
|
| 407 |
+
2. Augmentation Set 1: $5 0 \%$ chance that the image will be horizontally flipped, but no rotations.
|
| 408 |
+
|
| 409 |
+
3. Augmentation Set 2: $5 0 \%$ chance that the image will be horizontally flipped, and random rotations in Uniform(−10, 10) degrees.
|
| 410 |
+
|
| 411 |
+
The reported results in Table 11 are an average over 5 random seeds from ”kkkkkk” where $1 \leq k \leq 5$ . As expected, the validation accuracy for the model trained on clean dataset increased from $82 \%$ percent when trained without augmentation, to $86 \%$ for augmentation Set 1 and $8 8 \%$ for augmentation set 2. The addition of data augmentation during training and re-training stages make it harder for poisoning to succeed and at the same time makes it easier for camouflaging to succeed.
|
| 412 |
+
|
| 413 |
+
Table 11: Effect of data augmentation on our proposed camouflaged poisoning attack.
|
| 414 |
+
|
| 415 |
+
<table><tr><td rowspan="2">Data Augmentation</td><td colspan="2">Attack success</td><td colspan="3">Validation Accuracy</td></tr><tr><td>Poisoning</td><td>Camouflaging</td><td>Clean</td><td>Poisoned</td><td>Camouflaged</td></tr><tr><td>No Augmentation</td><td>100%</td><td>20%</td><td>82%</td><td>82%</td><td>82%</td></tr><tr><td>Augmentation Set 1</td><td>86%</td><td>33%</td><td>86%</td><td>85%</td><td>86%</td></tr><tr><td>Augmentation Set 2</td><td>60%</td><td>100%</td><td>88%</td><td>86</td><td>86%</td></tr></table>
|
| 416 |
+
|
| 417 |
+
# B.6.5 SIMILARITY OF THE FEATURE SPACE DISTANCE
|
| 418 |
+
|
| 419 |
+
A natural approach to defend against dataset manipulation attacks is to try to identify the modified images, and then remove them from the training dataset (i.e., data sanitization). For instance, one could cluster images based on their distance from their class mean image, or from the target image. This type of defense could potentially thwart watermarking poisoning attacks such as Poison Frogs (Shafahi et al., 2018). As we show in Figure 10, such a defense would not be effective against our proposed poison and camouflage generation procedures, as the data distribution for the poison set and the camouflage set is similar to that of the clean images from the respective classes.
|
| 420 |
+
|
| 421 |
+

|
| 422 |
+
Figure 10: Feature space distance for our generated poison and camouflage set. The reported data was collected by a successful camouflaged poisoning attack on Resnet-18 model trailed on CIFAR10 with seed 2000000000, $\varepsilon = 1 6$ and $\bar { b _ { p } } = \bar { b } _ { c } = 1 \%$ .
|
md/dev/MbCAOMGsZXC/MbCAOMGsZXC.md
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Point-M2AE: Multi-scale Masked Autoencoders for Hierarchical Point Cloud Pre-training
|
| 2 |
+
|
| 3 |
+
Renrui Zhang1,2, Ziyu Guo2, Rongyao Fang1, Bin Zhao2, Dong Wang2, Yu Qiao2, Hongsheng $\mathbf { L i ^ { 1 , 3 } }$ , Peng GaoB2
|
| 4 |
+
|
| 5 |
+
1 CUHK-SenseTime Joint Laboratory, The Chinese University of Hong Kong, 2 Shanghai AI Laboratory, 3 Centre for Perceptual and Interactive Intelligence Limited
|
| 6 |
+
|
| 7 |
+
{zhangrenrui, gaopeng}@pjlab.org.cnhsli@ee.cuhk.edu.hk
|
| 8 |
+
|
| 9 |
+
# Abstract
|
| 10 |
+
|
| 11 |
+
Masked Autoencoders (MAE) have shown great potentials in self-supervised pretraining for language and 2D image transformers. However, it still remains an open question on how to exploit masked autoencoding for learning 3D representations of irregular point clouds. In this paper, we propose Point-M2AE, a strong Multi-scale MAE pre-training framework for hierarchical self-supervised learning of 3D point clouds. Unlike the standard transformer in MAE, we modify the encoder and decoder into pyramid architectures to progressively model spatial geometries and capture both fine-grained and high-level semantics of 3D shapes. For the encoder that downsamples point tokens by stages, we design a multi-scale masking strategy to generate consistent visible regions across scales, and adopt a local spatial self-attention mechanism during fine-tuning to focus on neighboring patterns. By multi-scale token propagation, the lightweight decoder gradually upsamples point tokens with complementary skip connections from the encoder, which further promotes the reconstruction from a global-to-local perspective. Extensive experiments demonstrate the state-of-the-art performance of Point-M2AE for 3D representation learning. With a frozen encoder after pretraining, Point-M2AE achieves $9 2 . 9 \%$ accuracy for linear SVM on ModelNet40, even surpassing some fully trained methods. By fine-tuning on downstream tasks, Point-M2AE achieves $8 6 . 4 3 \%$ accuracy on ScanObjectNN, $+ 3 . 3 6 \%$ to the secondbest, and largely benefits the few-shot classification, part segmentation and 3D object detection with the hierarchical pre-training scheme. Code is available at https://github.com/ZrrSkywalker/Point-M2AE.
|
| 12 |
+
|
| 13 |
+
# 1 Introduction
|
| 14 |
+
|
| 15 |
+
Learning to represent from unlabeled data without annotations, known as self-supervised learning, has attained great success in natural language processing [10, 32, 33, 5], computer vision [19, 7, 8, 18] and multi-modality learning [31, 50, 21]. By pre-training on the large-scale raw data, the networks are endowed with robust representation abilities and can significantly benefit downstream tasks with fine-tuning. Motivated by masked language modeling [32, 10], MAE [18] and some other methods [46, 53, 3] adopt asymmetric encoder-decoder transformers [13] to apply masked autoencoding for self-supervised learning on 2D images. They represent the input image as multiple local patches, and randomly mask them with a high ratio to build the pretext task for reconstruction. Specifically, the encoder aims at capturing high-level latent representations from limited visible patches, and the lightweight decoder is forced to reconstruct the RGB values of masked patches on top. Despite its superiority on grid-based 2D images, we ask the question: can MAE-style masked autoencoding be adapted to irregular point clouds as a powerful 3D representation learner?
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: Comparison of MAE (Top) and our Point-M2AE (Bottom). MAE for 2D image pretraining adopts standard transformer of the plain encoder and decoder, while Point-M2AE introduces a hierarchical transformer with skip connections for multi-scale point cloud pre-training.
|
| 19 |
+
|
| 20 |
+
To tackle this challenge, we propose Multi-scale Masked autoencoders for learning the hierarchical representations of point clouds via self-supervised pre-training, termed as Point-M2AE. We represent a point cloud as a set of point tokens depicting different spatial local regions, and inherit MAE’s pipeline to first encode visible point tokens and then reconstruct the masked 3D coordinates. Different from 2D images, masked autoencoding for 3D point clouds has three characteristics to be specially considered. Firstly, it is critical to understand the relations between local parts and the overall 3D shapes, which have strong geometric and semantic dependence. As examples, the network can recognize an airplane starting from its wing, or segment the wing’s part from the airplane’s global feature. Therefore, we regard the standard transformer with the plain encoder and decoder is sub-optimal for capturing such local-global spatial relations in 3D, which directly downsamples the input into a low-resolution representation as shown in Figure 1 (Top). We modify both the encoder and decoder into multi-stage hierarchies for progressively encoding multi-scale features of point clouds, constructing an asymmetric U-Net [35] like architecture in Figure 1 (Bottom). Secondly, as our Point-M2AE encodes multi-scale point clouds unlike the single-scale 2D images, the unmasked visible regions are required to be both block-wise within one scale and consistent across scales, which are respectively for reserving complete local geometries and ensuring coherent feature learning for the network. For this, we introduce a multi-scale masking strategy, which generates random masks at the final scale with a high ratio (e.g., $80 \%$ ), and back-projects the unmasked positions to all preceding scales. Thirdly, to better reconstruct 3D geometries from a local-to-global perspective, we utilize skip connections to complement the decoder with fine-grained information from the corresponding stages of the encoder. During fine-tuning on downstream tasks, we also adopt a local spatial self-attention mechanism with increasing attention scopes for point tokens at different stages of the encoder, which refocus each token within neighboring detailed structures.
|
| 21 |
+
|
| 22 |
+
By the multi-scale pre-training, Point-M2AE can encode point clouds from local-to-global hierarchies and then reconstructs the masked coordinates from global-to-local perspectives, which learns powerful 3D representations and performs superior transfer ability. After self-supervised pre-training on ShapeNet [6], Point-M2AE achieves $9 2 . 9 \%$ classification accuracy for linear SVM on ModelNet40 [44] with the frozen encoder, which surpasses the runner-up CrossPoint [2] by $+ 1 . 2 \%$ and even outperforms some fully supervised methods. By fine-tuning on various downstream tasks, Point-M2AE achieves $8 6 . 4 3 \%$ $( + 3 . 3 6 \% )$ accuracy on ScanObjectNN [38] and $9 4 . 0 \%$ $( + 0 . 8 \% )$ accuracy on ModelNet40 [44] for shape classification, $8 6 . 5 1 \%$ $( + 0 . 9 1 \% )$ instance mIoU on ShapeNetPart [48] for part segmentation, and $9 5 . 0 \%$ $( + 2 . 7 \% )$ accuracy on 10-way 20-shot ModelNet40 for few-shot classification. Our multi-scale masked autoencoding also benefits the 3D object detection on ScanNetV2 [9] by $+ 1 . 3 \%$ $\mathsf { A P } _ { 2 5 }$ and $+ 1 . 3 \%$ $\mathrm { { A P } _ { 5 0 } }$ , which provides the detection backbone with a hierarchical understanding of the point clouds.
|
| 23 |
+
|
| 24 |
+
We summarize the contributions of our paper as follows:
|
| 25 |
+
|
| 26 |
+
1. We propose Point-M2AE, a strong masked autoencoding framework, which conducts hierarchical point cloud encoding and reconstruction for better learning multi-scale spatial geometries of 3D shapes.
|
| 27 |
+
2. We introduce a U-Net like transformer architecture for MAE-style pre-training on point clouds, and adopt a multi-scale masking strategy to generate consistent visible regions across scales.
|
| 28 |
+
3. Point-M2AE achieves state-of-the-art performance for transfer learning on various downstream tasks, which indicates our approach to be a powerful representation learner for 3D point clouds.
|
| 29 |
+
|
| 30 |
+
# 2 Related Work
|
| 31 |
+
|
| 32 |
+
Pre-training by Masked Modeling. Compared to contrastive learning methods [19, 7, 8] that learn from inter-sample relations, self-supervised pre-training by masked autoencoding builds the pretext tasks to predict the masked parts of the input signals. The series of GPT [32, 33, 5] and BERT [11] apply masked modeling to natural language processing and achieve extraordinary performance boost on downstream tasks with fine-tuning. Inspired by this, BEiT [4] proposes to match image patches with discrete tokens via dVAE [34] and pre-train a standard vision transformer [13, 49] by masked image modeling. On top of that, MAE [18] directly reconstructs the raw pixel values of masked tokens and performs great efficiency with a high mask ratio. The follow-up works further improve the performance of MAE by momentum encoder [53], contrastive learning [3], and modified reconstruction targets [42]. For self-supervised pre-training on 3D point clouds, the masked autoencoding has not been widely adopted. Similar to BEiT, Point-BERT [49] utilizes dVAE to map 3D patches to tokens for masked point modeling, but heavily relies on constrastive learning [19], complicated data augmentation, and the costly two-stage pre-training. In contrast, our Point-M2AE is a pure masked autoencoding method of one-stage pre-training, and follows MAE to reconstruct the input signals without dVAE mapping. Different from previous MAE methods adopting standard plain transformer, we propose a hierarchical transformer architecture along with the multi-scale masking strategy to better learn a strong and generic representation for 3D point clouds.
|
| 33 |
+
|
| 34 |
+
Self-supervised Learning for Point Clouds. 3D representation learning without annotations has been widely studied in recent years. Mainstream methods mainly build the pretext tasks to reconstruct the transformed input point cloud based on the encoded latent vectors, such as rotation [28], deformation [1], rearranged parts [36] and occlusion [40]. From another perspective, PointContrast [45] utilizes contrastive learning between features of the same points from different views to learn discriminative 3D representations. DepthContrast [51] further extends the contrast for depth maps of different augmentations. CrossPoint [2] conducts cross-modality contrastive learning between point clouds and their corresponding rendering images to acquire rich self-supervised signals. Point-BERT [49] and Point-MAE [27] respectively introduce BERT-style [10] and MAE-style [18] pre-training schemes for 3D point clouds with standard transformer networks and performs competitively on various downstream tasks, but both of them can only encode point clouds with a single resolution and ignores the local-global relations between 3D shapes. In this paper, we propose Point-M2AE, an MAE-style framework with a hierarchical transformer for multi-scale point cloud pre-training. We achieve state-of-the-art downstream performance by learning the multi-scale representation of point clouds.
|
| 35 |
+
|
| 36 |
+
# 3 Method
|
| 37 |
+
|
| 38 |
+
The overall pipeline of Point-M2AE is shown in Figure 2, where we encode and reconstruct the point cloud by a hierarchical network architecture. In Section 3.1, We first introduce the masking strategy of Point-M2AE with multi-scale representations of point clouds. Then in Section 3.2 and Section 3.3, we present the details of our encoder and decoder with multi-stage hierarchies.
|
| 39 |
+
|
| 40 |
+

|
| 41 |
+
Figure 2: Overall pipeline of Point-M2AE. After the multi-scale masking, we embed point tokens at the 1-st scale and feed the visible ones into a hierarchical encoder-decoder transformer, which captures both high-level semantics and fine-grained patterns of the point cloud during pre-training.
|
| 42 |
+
|
| 43 |
+
# 3.1 Multi-scale Masking
|
| 44 |
+
|
| 45 |
+
To build a U-Net [35] like masked autoencoder for hierarchical learning, we encode the point cloud by $S$ scales with different number of points at each scale, and correspondingly modify the standard plain encoder into the $S$ -stage architecture. Following MAE, we embed the point cloud into discrete point tokens and randomly mask them for reconstruction. Importantly, for irregular-distributed points in the multi-scale architecture, the unmasked visible spatial regions are required to be consistent not only within one scale, but also across different scales. This is because the block-wise parts of 3D shapes tend to preserve more complete fine-grained geometries, and the unmasked positions are better to be shared across all scales for coherent feature learning of the encoder. Therefore, as shown in Figure 3, we first construct the $S$ -scale coordinate representations of the input point cloud and back-project the random masks from the final $S$ -th scale to the earlier scales to avoid fragmented visible parts.
|
| 46 |
+
|
| 47 |
+
$S$ -scale Representations. We denote the input point cloud as $P \in \mathbb { R } ^ { N \times 3 }$ and regard it as the 0-th scale. For the $i$ -th scale, $1 \leq i \leq S$ , we utilize Furthest Point Sampling (FPS) to downsample the points from the $( i - 1 )$ -th scale, which produces seed points $P _ { i } \in \mathbb { R } ^ { N _ { i } \times 3 }$ for scale $i$ of $N _ { i }$ points. Then, we adopt $k$ Nearest-Neighbour ( $k$ -NN) to aggregate the neighboring $k$ points for each seed point and obtain the neighbor indices $I _ { i } \in \mathbb { R } ^ { N _ { i } \times k }$ . By successively downsampling and grouping, we acquire the $S$ -scale representations $\{ P _ { i } , I _ { i } \} _ { i = 1 } ^ { S }$ of the input point cloud, where the number of points $N _ { i }$ gradually decreases and the inclusion relations between scales are recorded in $I _ { i }$ .
|
| 48 |
+
|
| 49 |
+
Back-projecting Visible Positions. For seed points $P _ { S }$ at the final $S$ -th scale, we randomly mask them with a large proportion (e.g., $80 \%$ ) and denote the remaining visible points as $P _ { S } ^ { v } \in \dot { \mathbb { R } } ^ { N _ { S } ^ { v } \times 3 }$ of $N _ { S }$ points. We then back-project the unmasked positions $P _ { S } ^ { v }$ to ensure the consistent visible regions across scales. For the $i$ -th scale, $1 \leq i < S$ , we retrieve all the $k$ nearest neighbors of $P _ { i + 1 } ^ { v }$ from the indices $I _ { i + 1 }$ to serve as the visible positions $P _ { i } ^ { v }$ , and mask the others. By recursively back-projecting, we obtain the visible and masked positions of all v m $S$ scales, denoted as $\{ P _ { i } ^ { v } , P _ { i } ^ { m } \} _ { i = 1 } ^ { S }$ , where $P _ { i } ^ { v } \in \mathbb { R } ^ { N _ { i } ^ { v } \times 3 }$ , $P _ { i } ^ { m } \in \mathbb { R } ^ { N _ { i } ^ { m } \times 3 }$ and $N _ { i } = N _ { i } ^ { v } + N _ { i } ^ { m }$ .
|
| 50 |
+
|
| 51 |
+
# 3.2 Hierarchical Encoder
|
| 52 |
+
|
| 53 |
+
Based on the multi-scale masking, we embed the initial tokens of visible points $P _ { 1 } ^ { v }$ for the 1-st scale and them into the hierarchical encoder with $S$ stages. Every stage is equipped with $K$ stacked encoder blocks, and each block contains a self-attention layer and a Feed Forward Network (FFN) of MLP layers. Between every two consecutive stages, we introduce spatial token merging modules to aggregate adjacent visible tokens and enlarge receptive fields for downsampling the point clouds.
|
| 54 |
+
|
| 55 |
+

|
| 56 |
+
Figure 3: Multi-scale masking strategy. To obtain a consistent visible regions across scales, we first represent the input point cloud by multi-scale coordinates and generate the random mask at the highest one. Then, we back-project the unmasked visible positions to all earlier scales.
|
| 57 |
+
|
| 58 |
+
Token Embedding and Merging. Indexed by $I _ { 1 }$ , we utilize a mini-PointNet [29] to extract and fuse the features of every seed point from $P _ { 1 } ^ { v } \in \mathbb { R } ^ { N _ { 1 } ^ { v } \times 3 }$ with its $k$ nearest neighbors. After that, we obtain the initial point tokens $T _ { 1 } ^ { v } \in \mathbb { R } ^ { N _ { 1 } ^ { v } \times C _ { 1 } }$ for the 1-st stage of the encoder, which embeds $N _ { 1 } ^ { e }$ local patterns of the 3D shape. Between the $( i - 1 )$ -th and $i$ -th stages, $1 < i \leq S$ , we merge $T _ { i - 1 } ^ { \dot { v } } \in \mathbb { R } ^ { \mathsf { \tilde { N } } _ { i - 1 } \times C _ { i - 1 } }$ to acquire the downsampled point tokens for the $i$ -th stage. We utilize MLP layers and a max pooling to integrate every $k$ tokens nearest to $P _ { i } ^ { v }$ indexed by $I _ { i }$ , which outputs $T _ { i } ^ { v } \in \mathbb { R } ^ { N _ { i } \times C _ { i } }$ . Due to our multi-scale masking, the merged $T _ { i } ^ { v }$ corresponds to the same visible parts of $T _ { i - 1 } ^ { v }$ , which enables the consistent feature encoding across different scales. For larger $i$ of deeper stages, we set higher feature dimension $C _ { i }$ to encode spatial geometries with richer semantics.
|
| 59 |
+
|
| 60 |
+
Local Spatial Self-Attention. During pre-training, we expect point tokens in the multi-stage encoder to capture global cues for 3D shapes, which benefits the reconstruction of masked parts. However, when fine-tuning on downstream tasks without masked autoencoding, point tokens in the shallower stages are better to mainly focus on local information and not to be disturbed by long-range signals, referring to the inductive bias of 3D locality [30]. Thus, during fine-tuning, we modify the original self-attention layer in the encoder with a local spatial constraint that only neighboring tokens within a ball query would be available for attention calculation. As the point tokens are downsampled by stages, we set increasing radii $\{ r _ { i } \} _ { i = 1 } ^ { S }$ of multi-scale ball queries for gradually expanding the attention scopes, which fulfills the local-to-global feature aggregation scheme.
|
| 61 |
+
|
| 62 |
+
# 3.3 Hierarchical Decoder
|
| 63 |
+
|
| 64 |
+
Via the hierarchical encoder, we obtain the encoded visible tokens $\{ T _ { i } ^ { v } \} _ { i = 1 } ^ { S }$ of all scales. Starting from the highest and concatenate $S$ -th scale, we assign a sharedem with the visible tokens arnable mask token to. We denote them as ked positions with coordin $P _ { S } ^ { m }$ $T _ { S } ^ { v }$ $\{ H _ { 1 } ^ { v } , H _ { 1 } ^ { m } \}$ $\{ P _ { S } ^ { v } , P _ { S } ^ { m } \}$ S , which serve as the input of the hierarchical decoder. We design the decoder to be lightweight with $S - 1$ stages and only one decoder block for each stage, which enforces the encoder to embed more semantics of the point clouds. Each decoder block consists of a vanilla self-attention layer and an FFN. We do not apply the local constraint to the attention in the decoder, since a global understanding between visible and mask tokens is crucial to the reconstruction.
|
| 65 |
+
|
| 66 |
+
Point Token Upsampling. We upsample the point tokens between stages to progressively recover the fine-grained geometries of 3D shapes before reconstruction. We regulate that the $j$ -th stage of the decoder corresponds to the $( S + 1 - j )$ -th stage of the encoder, both of which contain point tokens of the same $( S + 1 - j )$ -th scale with the feature dimension $C _ { S + 1 - j }$ . Between the $( j - 1 )$ - th and $j$ -th stage, $1 < j \le S - 1$ , we upsample the tokens $\{ H _ { j - 1 } ^ { v } , H _ { j - 1 } ^ { m } \}$ from the coordinates $\{ P _ { S + 2 - j } ^ { v } , P _ { S + 2 - j } ^ { m } \}$ into $\{ P _ { S + 1 - j } ^ { v } , P _ { S + 1 - j } ^ { m } \}$ via the token propagation module. Specifically, we obtain the $k$ nearest neighbors of each point token in $\{ H _ { j - 1 } ^ { v } , H _ { { \underline { { j } } } - 1 } ^ { m } \}$ indexed by $I _ { S + 2 - j }$ , and recover their neighbors’ features by weighted interpolation referring to PointNet+ $^ { \cdot + }$ [30], which generates the tokens $\{ \bar { H } _ { j } ^ { v } , H _ { j } ^ { m } \}$ of the $j$ -th stage.
|
| 67 |
+
|
| 68 |
+
Table 1: Linear evaluation on ModelNet40 [44] by SVM. We report different self-supervised learning methods and underline the second-best one.
|
| 69 |
+
|
| 70 |
+
<table><tr><td rowspan=1 colspan=2>Method Acc. (%)</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=3 colspan=1>3D-GAN [43] 83.3Latent-GAN [39] 85.7</td></tr><tr><td rowspan=5 colspan=1></td><td rowspan=5 colspan=1>Latent-GAN [39] 85.7SO-Net [22] 87.3FoldingNet [47] 88.4MAP-VAE[17] 88.4VIP-GAN[16] 90.2</td></tr><tr><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>87.3</td></tr><tr><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>88.4</td></tr><tr><td rowspan=4 colspan=1></td><td rowspan=2 colspan=1>DGCNN + Jiasaw [37] 90.6DGCNN + OcCo [40] 90.7DGCNN + CrossPoint [2] 91.2</td></tr><tr><td rowspan=1 colspan=1>90.7</td></tr><tr><td rowspan=1 colspan=1>Transformer + OcCo [49] 89.6</td></tr><tr><td rowspan=1 colspan=1>Point-BERT[49] 87.4</td></tr><tr><td rowspan=1 colspan=2>Point-M2AE 92.9</td></tr><tr><td rowspan=1 colspan=2>Improvement +1.7</td></tr></table>
|
| 71 |
+
|
| 72 |
+
Table 2: Shape classification on ModelNet40 [44]. ‘#points’ and ‘Acc.’ denote the number of points for training and the overall accuracy. [S] represents finetuning after self-supervised pre-training.
|
| 73 |
+
|
| 74 |
+
<table><tr><td>Method</td><td>#points</td><td>Acc. (%)</td></tr><tr><td>PointNet [29] PointNet++ [30]</td><td>1k</td><td>89.2</td></tr><tr><td></td><td>1k</td><td>90.5</td></tr><tr><td>PointCNN [23]</td><td>1k</td><td>92.2</td></tr><tr><td>[S] SO-Net [22] DGCNN [41]</td><td>5k</td><td>92.5</td></tr><tr><td>PCT[15]</td><td>1k</td><td>92.9</td></tr><tr><td>Point Transformer [52]</td><td>1k</td><td>93.2</td></tr><tr><td></td><td>-</td><td>93.7</td></tr><tr><td>Transformer [49]</td><td>1k</td><td>91.4</td></tr><tr><td>[S] Transformer + OcCo [49]</td><td>1k</td><td>92.1</td></tr><tr><td>[S] Point-BERT[49]</td><td>1k</td><td>93.2</td></tr><tr><td>[S] Point-BERT</td><td>4k</td><td>93.4</td></tr><tr><td>[S] Point-BERT</td><td>8k</td><td>93.8</td></tr><tr><td>[S] Point-M2AE</td><td>1k</td><td>94.0</td></tr></table>
|
| 75 |
+
|
| 76 |
+
Skip Connections. To further complement the fine-grained geometries, we channel-wisely concatenate the visible tokens $H _ { j } ^ { v } \in \mathbb { R } ^ { N _ { S + 1 - j } \times C _ { S + 1 - j } }$ of the decoder with $T _ { S + 1 - j } ^ { v } \in \mathbb { R } ^ { N _ { S + 1 - j } \times \check { C } _ { S + 1 - j } }$ from the corresponding $( S + 1 - j )$ -th stage of the encoder via skip connections, and adopt a linear projection layer to fuse their features. For the mask tokens $H _ { j } ^ { m }$ , we keep them unchanged, since the encoder only contains visible tokens without the masked ones.
|
| 77 |
+
|
| 78 |
+
Point Reconstruction. After $S - 1$ stages of the decoder, we acquire $\{ H _ { S - 1 } ^ { v } , H _ { S - 1 } ^ { m } \}$ with coordinates $\{ P _ { 2 } ^ { v } , P _ { 2 } ^ { m } \}$ and reconstruct the masked values from the mask tokens $H _ { S - 1 } ^ { m }$ . Other than predicting values at the 0-th scale of the input point cloud $P$ , we reconstruct the coordinates of $P _ { 1 } ^ { m }$ , namely, recovering the masked positions of the 1-st scale $P _ { 1 } ^ { m } \in \mathbb { R } ^ { N _ { 1 } ^ { m } \times 3 }$ from the 2-nd scale $\bar { P _ { 2 } ^ { m } } \in \mathbb { R } ^ { N _ { 2 } ^ { m } \times 3 }$ . This is because $\{ P _ { 1 } ^ { v } , P _ { 1 } ^ { m } \}$ of the 1-st scale could well represent the overall 3D shape and simultaneously preserve enough local patterns, which already constructs a comparatively challenging pretext task for pre-training. If we further upsample $\{ H _ { S - 1 } ^ { \bar { v } } , H _ { S - 1 } ^ { m } \}$ into $\{ \bar { H } _ { S } ^ { v } , H _ { S } ^ { m } \}$ and reconstruct the masked raw points from $P _ { 1 } ^ { m }$ , the extra spatial noises and computational overhead would adversely influence our performance and efficiency. Therefore, for every token in $H _ { S - 1 } ^ { m } \in \mathbb { R } ^ { N _ { 2 } ^ { m } \times C _ { 2 } }$ , we reconstruct its $k$ nearest neighbors recorded in $I _ { 2 }$ by a reconstruction head of one linear projection layer and compute the loss by $l _ { 2 }$ Chamfer Distance [14], formulated as,
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
\begin{array} { r l } & { \widehat { P } _ { 2 \to 1 } ^ { m } = \mathrm { L i n e a r } ( H _ { S - 1 } ^ { m } ) , \mathrm { ~ w h e r e ~ } \widehat { P } _ { 2 \to 1 } ^ { m } \in \mathbb { R } ^ { N _ { 2 } ^ { m } \times k \times 3 } , } \\ & { \mathcal { L } _ { C D } = \mathrm { C h a m f e r D i s t a n c e } ( P _ { 2 \to 1 } ^ { m } , \widehat { P } _ { 2 \to 1 } ^ { m } ) , } \end{array}
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
where $\widehat { P } _ { 2 1 } ^ { m }$ and $P _ { 2 1 } ^ { m }$ denote the predicted and ground-truth reconstruction coordinates from the 2-nd scale to the 1-st scale. We only utilize $\mathcal { L } _ { C D }$ for supervision without contrastive loss to conduct a pure masked autoencoding for self-supervised pre-training.
|
| 85 |
+
|
| 86 |
+
# 4 Experiments
|
| 87 |
+
|
| 88 |
+
In Section 4.1 and Section 4.2, we introduce the pre-training experiments of Point-M2AE and report the fine-tuning performance on various downstream tasks. We also conduct ablation studies in Section 4.3 to validate the effectiveness of our approach.
|
| 89 |
+
|
| 90 |
+
# 4.1 Self-supervised Pre-training
|
| 91 |
+
|
| 92 |
+
Settings. We pre-train our Point-M2AE on ShapeNet [6] dataset, which contains 57,448 synthetic 3D shapes of 55 categories. We set the stage number $S$ as 3, and construct a 3-stage encoder and a
|
| 93 |
+
|
| 94 |
+
Table 3: Shape classification on ScanObjectNN [38]. We report the accuracy $( \% )$ on the three splits of ScanObjectNN. [S] represents fine-tuning after self-supervised pre-training.
|
| 95 |
+
|
| 96 |
+
<table><tr><td>Method</td><td>OBJ-BG</td><td>OBJ-ONLY</td><td>PB-T50-RS</td></tr><tr><td>PointNet [29]</td><td>73.3</td><td>79.2</td><td>68.0</td></tr><tr><td>PointNet++ [30]</td><td>82.3</td><td>84.3</td><td>77.9</td></tr><tr><td>DGCNN [41]</td><td>82.8</td><td>86.2</td><td>78.1</td></tr><tr><td>PointCNN [23]</td><td>86.1</td><td>85.5</td><td>78.5</td></tr><tr><td>Transformer [49]</td><td>79.86</td><td>80.55</td><td>77.24</td></tr><tr><td>[S] Transformer + OcCo [49]</td><td>84.85</td><td>85.54</td><td>78.79</td></tr><tr><td>[S] Point-BERT[49]</td><td>87.43</td><td>88.12</td><td>83.07</td></tr><tr><td>[S] Point-M2AE</td><td>91.22</td><td>88.81</td><td>86.43</td></tr><tr><td>Improvement</td><td>+3.79</td><td>+0.69</td><td>+3.36</td></tr></table>
|
| 97 |
+
|
| 98 |
+
2-stage decoder for hierarchical learning. We adopt 5 blocks in each encoder stage, but only 1 block per stage for the lightweight decoder. For the 3-scale point clouds, we set the point numbers and token dimensions respectively as {512, 256, 64} and {96, 192, 384}. We also set different $k$ for the $k$ -NN at different scales, which are {16, 8, 8}. We mask the highest scale of point clouds with a high ratio of $80 \%$ and set 6 heads for all the attention modules. The detailed training settings are in Appendix.
|
| 99 |
+
|
| 100 |
+
Linear SVM. After pre-training on ShapeNet, we test the 3D representation capability of PointM2AE via linear evaluation on ModelNet40 [44]. We sample 1,024 points from each 3D shape of ModelNet40 and utilize our frozen encoder to extract their features. On top of that, we train a linear SVM and report the classification accuracy in Table 1. As shown, Point-M2AE achieves the best performance among all existing self-supervised methods for point clouds, and surpasses the second-best CrossPoint [2] by $+ 1 . 7 \%$ . Point-M2AE also exceeds Point-BERT [49] by $+ 5 . 5 \%$ , which is a masked point modeling method with a MoCo loss [19] but adopts a standard transformer and conducts single-scale learning. It is worth noting that even if we freeze all our parameters, Point-M2AE with $9 2 . 9 \%$ accuracy still outperforms many fully trained methods on ModelNet40, e.g., $9 0 . 5 \%$ by PointNet $^ { + + }$ [30], $9 2 . 8 \%$ by DensePoint [24], etc. The experiments fully demonstrate the superior 3D representation capacity of our Point-M2AE.
|
| 101 |
+
|
| 102 |
+
# 4.2 Downstream Tasks
|
| 103 |
+
|
| 104 |
+
For fine-tuning on downstream tasks, we discard the hierarchical decoder in pre-training and append different heads onto the hierarchical encoder for different tasks.
|
| 105 |
+
|
| 106 |
+
Shape Classification. We fine-tune Point-M2AE on two shape classification datasets: the widely adopted ModelNet40 [44] and the challenging ScanObjectNN [38]. For local spatial attention layers, we set the ball queries’ radii of 3-scale point clouds as {0.32, 0.64, 1.28}. We follow Point-BERT to use the voting strategy [25] for fair comparison on ModelNet40. To handle the noisy spatial structures, we increase $k$ of $k$ -NN into {32, 16, 16} for ScanObjectNN to encode local patterns with larger receptive fields. As reported in Table 2, Point-M2AE achieves $9 4 . 0 \%$ accuracy on ModelNet40 with 1024 points per sample, which surpasses Point-BERT fine-tuned with 1024 points by $+ 0 . 8 \%$ and 8192 points by $+ 0 . 2 \%$ . For ScanObjectNN in Table 3, our Point-M2AE outperforms the secondbest Point-BERT by a significant margin, $+ 3 . 7 9 \%$ , $+ 0 . 6 9 \%$ and $+ 3 . 3 6 \%$ , respectively for the three splits, indicating our great advantages under complex circumstances by multi-scale encoding. As ScanObjectNN of real-world scenes has a large semantic gap with the pre-trained synthetic ShapeNet, Point-M2AE also exerts strong transfer ability to understand point clouds of another domain.
|
| 107 |
+
|
| 108 |
+
Part Segmentation. We evaluate Point-M2AE for part segmentation on ShapeNetPart [48], which predicts per-point part labels and requires detailed understanding for local patterns. We adopt an extremely simple segmentation head to validate the effectiveness of our pre-training for well capturing both high-level semantics and fine-grained details. By the hierarchical encoder, we obtain
|
| 109 |
+
|
| 110 |
+
Table 4: Few-shot classification on ModelNet40 [44]. We report the average accuracy $( \% )$ and standard deviation $( \% )$ of 10 independent experiments.
|
| 111 |
+
|
| 112 |
+
<table><tr><td rowspan="2">Method</td><td colspan="2">5-way</td><td colspan="2">10-way</td></tr><tr><td>10-shot</td><td>20-shot</td><td>10-shot</td><td>20-shot</td></tr><tr><td>DGCNN [41]</td><td>91.8 ± 3.7</td><td>93.4 ± 3.2</td><td>86.3 ± 6.2</td><td>90.9 ± 5.1</td></tr><tr><td>[S] DGCNN + OcCo [40]</td><td>91.9 ± 3.3</td><td>93.9 ± 3.1</td><td>86.4 ± 5.4</td><td>91.3 ± 4.6</td></tr><tr><td>Transformer [49]</td><td>87.8 ±5.2</td><td>93.3 ± 4.3</td><td>84.6 ± 5.5</td><td>89.4 ± 6.3</td></tr><tr><td>[S] Transformer + OcCo [49]</td><td>94.0±3.6</td><td>95.9 ± 2.3</td><td>89.4 ± 5.1</td><td>92.4 ± 4.6</td></tr><tr><td>[S] Point-BERT[49]</td><td>94.6 ± 3.1</td><td>96.3 ± 2.7</td><td>91.0 ± 5.4</td><td>92.7 ± 5.1</td></tr><tr><td>[S] Point-M2AE</td><td>96.8 ± 1.8</td><td>98.3 ± 1.4</td><td>92.3 ± 4.5</td><td>95.0 ± 3.0</td></tr><tr><td>Improvement</td><td>+2.2</td><td>+2.0</td><td>+1.3</td><td>+2.3</td></tr></table>
|
| 113 |
+
|
| 114 |
+
Table 5: Part segmentation on ShapeNetPart [48]. $\mathbf { \hat { m } } \mathbf { I o U } _ { C }$ ’ $( \% )$ and $\mathbf { \dot { m l o U } } _ { I } ,$ $( \% )$ denote the mean IoU across all part categories and all instances in the dataset, respectively.
|
| 115 |
+
|
| 116 |
+
<table><tr><td>Method</td><td>mIoUc</td><td>mIoU1</td></tr><tr><td>PointNet [29] PointNet++ [30]</td><td>80.39 81.85</td><td>83.70 85.10</td></tr><tr><td>DGCNN [41]</td><td>82.33</td><td>85.20</td></tr><tr><td>Transformer [49]</td><td>83.42</td><td>85.10</td></tr><tr><td>[S] Transformer + OcCo [49]</td><td>83.42</td><td>85.10</td></tr><tr><td>[S] Point-BERT[49]</td><td>84.11</td><td>85.60</td></tr><tr><td>[S] Point-M2AE</td><td>84.86</td><td>86.51</td></tr><tr><td>Improvement</td><td>+0.75</td><td>+0.91</td></tr></table>
|
| 117 |
+
|
| 118 |
+
Table 6: 3D object detection on ScanNetV2 [9]. We report the performance $( \% )$ of self-supervised learning methods based on VoteNet [12] and 3DETR-m [26].
|
| 119 |
+
|
| 120 |
+
<table><tr><td>Method</td><td>AP25</td><td>AP50</td></tr><tr><td>VoteNet [12] [S] STRL [20] [S] PointContrast [45]</td><td>58.6 59.5 59.2</td><td>33.5 38.4 38.0</td></tr><tr><td>[S] DepthContrast [51] 3DETR[26]</td><td>61.3 62.1</td><td>1 37.9</td></tr><tr><td>3DETR-m [26]</td><td>65.0</td><td>47.0</td></tr><tr><td>[S] Point-M2AE</td><td>66.3</td><td>48.3</td></tr><tr><td>Improvement</td><td>+1.3</td><td>+1.3</td></tr></table>
|
| 121 |
+
|
| 122 |
+
3-scale point tokens of {512, 256, 64} points, and perform feature propagation in PointNet $^ { - + }$ [30] to independently upsample the tokens into 2048 points of the input point cloud. Then, we concatenate the upsampled 3-scale features for each point and predict the part label by stacked linear projection layers. As reported in Table 4.2, Point-M2AE achieves the best $8 6 . 5 1 \%$ instance mIoU with the simple segmentation head, surpassing the second-best Point-BERT by $+ 0 . 9 1 \%$ . Note that Point-BERT [49] and other methods [29, 30, 41] adopt hierarchical segmentation heads to progressively upsample the point features from intermediate layers, while our head contains no hierarchical structure and only relies on the pre-trained encoder to capture the multi-scale information of point clouds. The results fully demonstrate the significance of Point-M2AE’s multi-scale pre-training to segmentation tasks.
|
| 123 |
+
|
| 124 |
+
Few-shot Classification. We conduct experiments for few-shot classification on ModelNet40 [44] to evaluate the performance of Point-M2AE with limited fine-tuning data. As reported in Table 4.2, Point-M2AE achieves the best performance for all four settings, and surpasses Point-BERT by $+ 2 . 2 \%$ , $+ 2 . 0 \%$ , $+ 1 . 3 \%$ , and $+ 2 . 7 \%$ , respectively. Our approach also shows smaller deviations than other transformer-based methods, which indicates Point-M2AE has learned to produce more universal 3D representations for well adapting to downstream tasks under low-data regimes.
|
| 125 |
+
|
| 126 |
+
3D Object Detection To further evaluate our hierarchical pre-training on 3D object detection, we apply Point-M2AE to serving as the feature backbone on the indoor ScanNetV2 [9] dataset. We select 3DETR-m [26] as our baseline, which consists of a 3-block encoder and a transformer decoder. Considering the quite different dataset statistics, e.g., 2k input points for ShapeNet [6] and $5 0 \mathrm { k }$ input points for ScanNetV2, we adopt the same encoder architecture with that of 3DETR-m, and keep our hierarchical decoder with skip connections unchanged for self-supervised pre-training on ScanNetV2. More details of models and training are in Appendix. As reported in Table 4.2, compared to training from scratch, our hierarchical pre-training boosts the performance of 3DETR-m by $+ 1 . 3 4 \%$ $\mathrm { A P _ { 2 5 } }$ and $+ 1 . 2 9 \%$ $\mathsf { A P } _ { 5 0 }$ . The experiments demonstrate the effectiveness of Point-M2AE to learn multi-scale point cloud encoding for object detection and its potential to benefit a wider range of 3D applications.
|
| 127 |
+
|
| 128 |
+

|
| 129 |
+
Figure 4: Visualization of fine-grained information. We denote the outputs from hierarchical and non-hierarchical architectures as [NH] and [H], respectively. For an input point cloud (Middle), we visualize its extracted features (Left) and reconstruction results (Right).
|
| 130 |
+
|
| 131 |
+
Table 7: Hierarchical Modules. ‘H’ represents the encoder and decoder with multi-stage hierarchies. ‘Skip C.’ denotes the skip connections.
|
| 132 |
+
|
| 133 |
+
<table><tr><td>Encoder</td><td>Decoder</td><td>Skip C.</td><td>Acc. (%)</td></tr><tr><td>H</td><td>H</td><td>√</td><td>92.9</td></tr><tr><td></td><td>1</td><td>√</td><td>90.7</td></tr><tr><td>1</td><td>H</td><td>√</td><td>91.5</td></tr><tr><td>H</td><td>1</td><td>√</td><td>92.2</td></tr><tr><td>H</td><td>H</td><td></td><td>92.1</td></tr></table>
|
| 134 |
+
|
| 135 |
+
Table 8: Different Masking Strategy. ‘MS Mask’ and ‘Ratio’ denote the multi-scale masking and the mask ratio.
|
| 136 |
+
|
| 137 |
+
<table><tr><td>MS Mask</td><td>Ratio</td><td>Acc. (%)</td></tr><tr><td>了</td><td>0.8</td><td>92.9</td></tr><tr><td>1</td><td>0.8</td><td>88.4</td></tr><tr><td>√</td><td>0.6</td><td>92.3</td></tr><tr><td><</td><td>0.7</td><td>92.7</td></tr><tr><td>√</td><td>0.9</td><td>92.5</td></tr></table>
|
| 138 |
+
|
| 139 |
+
# 4.3 Ablation Study
|
| 140 |
+
|
| 141 |
+
We conduct ablation study by modifying one of the components at a time during pre-training and explore the best masking strategy. We report the classification accuracy on ModelNet40 [44] by linear SVM to evaluate the pre-trained representations. For downstream tasks, we train the network from scratch to validate the significance of our hierarchical pre-training.
|
| 142 |
+
|
| 143 |
+
Hierarchical Modules. As reported in Table 7, on top of our final solution, Point-M2AE, in the first row, we respectively experiment with removing the hierarchical encoder, hierarchical decoder, and skip connections from our framework. Specifically, we replace our encoder and decoder with 1-stage plain architectures similar to MAE, which contains 15 and 2 vanilla transformer blocks, respectively. We observe the absence of multi-stage structures either in encoder or decoder hurts the performance, and the hierarchical encoder plays a better role than the decoder. Also, the skip connections well benefits the accuracy by providing complementary information for the decoder.
|
| 144 |
+
|
| 145 |
+
Masking Strategy. In Table 8, we report Point-M2AE with different mask settings. Without the multi-scale masking, we randomly generate masks at each scale, which leads to fragmented visible regions for all scales. With this strategy, the network would ‘peek’ different parts of the point cloud at different stages, which disturbs the representation learning and harms the performance by $- 4 . 5 \%$ accuracy. For different mask ratios, we find the $8 0 \%$ ratio performs the best to build a properly challenging pretext task for self-supervised pre-training.
|
| 146 |
+
|
| 147 |
+
With and Without Pre-training. We report the performance of Point-M2AE on downstream tasks with and without the pre-training in Table 9. For ‘w/o’, we randomly initialize the parameters and train the network from scratch. As shown, the pre-training can largely boost the performance on four datasets respectively by $+ 1 . 5 \%$ , $+ 2 . 5 \%$ , $+ 3 . 8 \%$ , and $+ 1 . 1 \bar { \% }$ , which indicates the superiority and significance of our hierarchical pre-training.
|
| 148 |
+
|
| 149 |
+
Table 9: With and without the pre-training. ‘ModelNet40-FS’ denotes the few-shot classification on 10-way 20-shot ModelNet40 [44].
|
| 150 |
+
|
| 151 |
+
<table><tr><td>Dataset</td><td>w/o (%)</td><td>w (%)</td></tr><tr><td>ModelNet40 [44]</td><td>92.5</td><td>94.0</td></tr><tr><td>ScanObjectNN[38]</td><td>83.9</td><td>86.4</td></tr><tr><td>ModelNet40-FS [44]</td><td>91.2</td><td>95.0</td></tr><tr><td>ShapeNetPart [48]</td><td>85.4</td><td>86.5</td></tr></table>
|
| 152 |
+
|
| 153 |
+

|
| 154 |
+
Figure 5: Visualization of multi-scale point clouds. In each row, we visualize the input point clouds, their multi-scale representations, the reconstructed coordinates, and multi-scale masked point clouds.
|
| 155 |
+
|
| 156 |
+
# 5 Visualization
|
| 157 |
+
|
| 158 |
+
Multi-scale Masking. To ease the understanding of our multi-scale masking strategy, we visualize the input point cloud, the 3-scale representations, the reconstructed point cloud, and 3-scale masked point clouds, respectively in each row of Figure 5. As shown, different scales can represent different levels of geometric details and semantics for point clouds. By the multi-scale masking strategy, we observe the visible positions of masked point clouds are block-wise within one scale and consistent across scales, which is significant for our hierarchical pre-training.
|
| 159 |
+
|
| 160 |
+
Fine-grained Information. The fine-grained 3D structures, e.g., thin branches of a plant, fingers of a human, engines of a plane, are significant to distinguish similar shapes and can be well encoded by our hierarchical representations. In Figure 4, we compare our Point-M2AE with multi-stage, [H], and single-scale, [NH], architectures by visualizing their extracted point features and reconstructed point clouds during pre-training. In contarst to the single-scale network, the multi-scale one indicates higher feature responses in the fine-grained structures and reconstructs more accurate spatial details.
|
| 161 |
+
|
| 162 |
+
# 6 Conclusion
|
| 163 |
+
|
| 164 |
+
We propose Point-M2AE, a multi-scale masked autoencoder for self-supervised pre-training on 3D point clouds. With a hierarchical architecture, Point-M2AE learns to produce powerful 3D representations by encoding multi-scale point clouds and reconstructing the masked coordinates from a global-to-local upsampling scheme. Extensive experiments have demonstrated the superiority of Point-M2AE to be a strong 3D representation learner. For limitations and future work, we will focus on applying Point-M2AE for wider 3D applications, e.g., outdoor and open-world scene understanding. We do not foresee negative social impact from the proposed work.
|
| 165 |
+
|
| 166 |
+
Acknowledgement. This work is supported by the National Natural Science Foundation of China (Grant No. 62206272), Shanghai Committee of Science and Technology (Grant No. 21DZ1100100), Centre for Perceptual and Interactive Intelligence Limited, and the General Research Fund through the Research Grants Council of Hong Kong (Grant No. 14204021, 14207319).
|
| 167 |
+
|
| 168 |
+
# References
|
| 169 |
+
|
| 170 |
+
[1] Idan Achituve, Haggai Maron, and Gal Chechik. Self-supervised learning for domain adaptation on point clouds. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pages 123–133, 2021. 3
|
| 171 |
+
[2] Mohamed Afham, Isuru Dissanayake, Dinithi Dissanayake, Amaya Dharmasiri, Kanchana Thilakarathna, and Ranga Rodrigo. Crosspoint: Self-supervised cross-modal contrastive learning for 3d point cloud understanding. arXiv preprint arXiv:2203.00680, 2022. 2, 3, 6, 7
|
| 172 |
+
[3] Alexei Baevski, Wei-Ning Hsu, Qiantong Xu, Arun Babu, Jiatao Gu, and Michael Auli. Data2vec: A general framework for self-supervised learning in speech, vision and language. arXiv preprint arXiv:2202.03555, 2022. 1, 3
|
| 173 |
+
[4] Hangbo Bao, Li Dong, and Furu Wei. Beit: Bert pre-training of image transformers. arXiv preprint arXiv:2106.08254, 2021. 3
|
| 174 |
+
[5] 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. 1, 3
|
| 175 |
+
[6] Angel X Chang, Thomas Funkhouser, Leonidas Guibas, Pat Hanrahan, Qixing Huang, Zimo Li, Silvio Savarese, Manolis Savva, Shuran Song, Hao Su, et al. Shapenet: An information-rich 3d model repository. arXiv preprint arXiv:1512.03012, 2015. 2, 6, 8
|
| 176 |
+
[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. 1, 3
|
| 177 |
+
[8] Xinlei Chen and Kaiming He. Exploring simple siamese representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 15750–15758, 2021. 1, 3
|
| 178 |
+
[9] Angela Dai, Angel X Chang, Manolis Savva, Maciej Halber, Thomas Funkhouser, and Matthias Nießner. Scannet: Richly-annotated 3d reconstructions of indoor scenes. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 5828–5839, 2017. 3, 8
|
| 179 |
+
[10] 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. 1, 3
|
| 180 |
+
[11] 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. 3
|
| 181 |
+
[12] Zhipeng Ding, Xu Han, and Marc Niethammer. Votenet: A deep learning label fusion method for multi-atlas segmentation. In International Conference on Medical Image Computing and Computer-Assisted Intervention, pages 202–210. Springer, 2019. 8
|
| 182 |
+
[13] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929, 2020. 1, 3
|
| 183 |
+
[14] Haoqiang Fan, Hao Su, and Leonidas J Guibas. A point set generation network for 3d object reconstruction from a single image. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 605–613, 2017. 6
|
| 184 |
+
[15] Meng-Hao Guo, Jun-Xiong Cai, Zheng-Ning Liu, Tai-Jiang Mu, Ralph R Martin, and Shi-Min Hu. Pct: Point cloud transformer. Computational Visual Media, 7(2):187–199, 2021. 6
|
| 185 |
+
[16] Zhizhong Han, Mingyang Shang, Yu-Shen Liu, and Matthias Zwicker. View inter-prediction gan: Unsupervised representation learning for 3d shapes by learning global shape memories to support local view predictions. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 8376–8384, 2019. 6
|
| 186 |
+
[17] Zhizhong Han, Xiyang Wang, Yu-Shen Liu, and Matthias Zwicker. Multi-angle point cloudvae: Unsupervised feature learning for 3d point clouds from multiple angles by joint selfreconstruction and half-to-half prediction. In 2019 IEEE/CVF International Conference on Computer Vision (ICCV), pages 10441–10450. IEEE, 2019. 6
|
| 187 |
+
[18] Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollár, and Ross Girshick. Masked autoencoders are scalable vision learners. arXiv preprint arXiv:2111.06377, 2021. 1, 3
|
| 188 |
+
[19] 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. 1, 3, 7 [20] Siyuan Huang, Song ervised representation learning for 3d point clouds. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 6535–6545, 2021. 8 [21] 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
|
| 189 |
+
4904–4916. PMLR, 2021. 1 [22] Jiaxin Li, Ben M Chen, and Gim Hee Lee. So-net: Self-organizing network for point cloud analysis. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 9397–9406, 2018. 6 [23] Yangyan Li, Rui Bu, Mingchao Sun, Wei Wu, Xinhan Di, and Baoquan Chen. Pointcnn: Convolution on $\mathbf { X }$ -transformed points. Advances in neural information processing systems,
|
| 190 |
+
31:820–830, 2018. 6, 7 [24] Yongcheng Liu, Bin Fan, Gaofeng Meng, Jiwen Lu, Shiming Xiang, and Chunhong Pan. Densepoint: Learning densely contextual representation for efficient point cloud processing. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 5239–5248,
|
| 191 |
+
2019. 7 [25] Yongcheng Liu, Bin Fan, Shiming Xiang, and Chunhong Pan. Relation-shape convolutional neural network for point cloud analysis. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8895–8904, 2019. 7 [26] Ishan Misra, Rohit Girdhar, and Armand Joulin. An end-to-end transformer model for 3d object detection. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pages 2906–2917, October 2021. 8 [27] Yatian Pang, Wenxiao Wang, Francis EH Tay, Wei Liu, Yonghong Tian, and Li Yuan. Masked autoencoders for point cloud self-supervised learning. arXiv preprint arXiv:2203.06604, 2022.
|
| 192 |
+
3 [28] Omid Poursaeed, Tianxing Jiang, Han Qiao, Nayun Xu, and Vladimir G Kim. Self-supervised learning of point clouds via orientation estimation. In 2020 International Conference on 3D Vision (3DV), pages 1018–1028. IEEE, 2020. 3 [29] Charles R Qi, Hao Su, Kaichun Mo, and Leonidas J Guibas. Pointnet: Deep learning on point sets for 3d classification and segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 652–660, 2017. 5, 6, 7, 8 [30] Charles R Qi, Li Yi, Hao Su, and Leonidas J Guibas. Pointnet++: Deep hierarchical feature learning on point sets in a metric space. arXiv preprint arXiv:1706.02413, 2017. 5, 6, 7, 8 [31] 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. 1 [32] Alec Radford and Karthik Narasimhan. Improving language understanding by generative pre-training. 2018. 1, 3 [33] 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. 1, 3 [34] Jason Tyler Rolfe. Discrete variational autoencoders. arXiv preprint arXiv:1609.02200, 2016. 3 [35] 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. 2, 4 [36] Jonathan Sauder and Bjarne Sievers. Self-supervised deep learning on point clouds by reconstructing space. Advances in Neural Information Processing Systems, 32, 2019. 3 [37] Jonathan Sauder and Bjarne Sievers. Self-supervised deep learning on point clouds by reconstructing space. Advances in Neural Information Processing Systems, 32, 2019. 6 [38] Mikaela Angelina Uy, Quang-Hieu Pham, Binh-Son Hua, Thanh Nguyen, and Sai-Kit Yeung. Revisiting point cloud classification: A new benchmark dataset and classification model on real-world data. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 1588–1597, 2019. 2, 7, 9 [39] Diego Valsesia, Giulia Fracastoro, and Enrico Magli. Learning localized representations of point clouds with graph-convolutional generative adversarial networks. IEEE Transactions on Multimedia, 23:402–414, 2020. 6 [40] Hanchen Wang, Qi Liu, Xiangyu Yue, Joan Lasenby, and Matt J Kusner. Unsupervised point cloud pre-training via occlusion completion. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 9782–9792, 2021. 3, 6, 8
|
| 193 |
+
[41] Yue Wang, Yongbin Sun, Ziwei Liu, Sanjay E Sarma, Michael M Bronstein, and Justin M Solomon. Dynamic graph cnn for learning on point clouds. Acm Transactions On Graphics (tog), 38(5):1–12, 2019. 6, 7, 8
|
| 194 |
+
[42] Chen Wei, Haoqi Fan, Saining Xie, Chao-Yuan Wu, Alan Yuille, and Christoph Feichtenhofer. Masked feature prediction for self-supervised visual pre-training. arXiv preprint arXiv:2112.09133, 2021. 3
|
| 195 |
+
[43] Jiajun Wu, Chengkai Zhang, Tianfan Xue, Bill Freeman, and Josh Tenenbaum. Learning a probabilistic latent space of object shapes via 3d generative-adversarial modeling. Advances in neural information processing systems, 29, 2016. 6
|
| 196 |
+
[44] Zhirong Wu, Shuran Song, Aditya Khosla, Fisher Yu, Linguang Zhang, Xiaoou Tang, and Jianxiong Xiao. 3d shapenets: A deep representation for volumetric shapes. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1912–1920, 2015. 2, 6, 7, 8, 9
|
| 197 |
+
[45] Saining Xie, Jiatao Gu, Demi Guo, Charles R Qi, Leonidas Guibas, and Or Litany. Pointcontrast: Unsupervised pre-training for 3d point cloud understanding. In European conference on computer vision, pages 574–591. Springer, 2020. 3, 8
|
| 198 |
+
[46] 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. arXiv preprint arXiv:2111.09886, 2021. 1
|
| 199 |
+
[47] Yaoqing Yang, Chen Feng, Yiru Shen, and Dong Tian. Foldingnet: Point cloud auto-encoder via deep grid deformation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 206–215, 2018. 6
|
| 200 |
+
[48] Li Yi, Vladimir G Kim, Duygu Ceylan, I-Chao Shen, Mengyan Yan, Hao Su, Cewu Lu, Qixing Huang, Alla Sheffer, and Leonidas Guibas. A scalable active framework for region annotation in 3d shape collections. ACM Transactions on Graphics (ToG), 35(6):1–12, 2016. 2, 7, 8, 9
|
| 201 |
+
[49] Xumin Yu, Lulu Tang, Yongming Rao, Tiejun Huang, Jie Zhou, and Jiwen Lu. Pointbert: Pre-training 3d point cloud transformers with masked point modeling. arXiv preprint arXiv:2111.14819, 2021. 3, 6, 7, 8
|
| 202 |
+
[50] Renrui Zhang, Ziyu Guo, Wei Zhang, Kunchang Li, Xupeng Miao, Bin Cui, Yu Qiao, Peng Gao, and Hongsheng Li. Pointclip: Point cloud understanding by clip. arXiv preprint arXiv:2112.02413, 2021. 1
|
| 203 |
+
[51] Zaiwei Zhang, Rohit Girdhar, Armand Joulin, and Ishan Misra. Self-supervised pretraining of 3d features on any point-cloud. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 10252–10263, 2021. 3, 8
|
| 204 |
+
[52] Hengshuang Zhao, Li Jiang, Jiaya Jia, Philip HS Torr, and Vladlen Koltun. Point transformer. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 16259– 16268, 2021. 6
|
| 205 |
+
[53] Jinghao Zhou, Chen Wei, Huiyu Wang, Wei Shen, Cihang Xie, Alan Yuille, and Tao Kong. ibot: Image bert pre-training with online tokenizer. arXiv preprint arXiv:2111.07832, 2021. 1, 3
|
| 206 |
+
|
| 207 |
+
# Checklist
|
| 208 |
+
|
| 209 |
+
1. For all authors...
|
| 210 |
+
|
| 211 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 212 |
+
(b) Did you describe the limitations of your work? [Yes]
|
| 213 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes]
|
| 214 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 215 |
+
|
| 216 |
+
2. If you are including theoretical results...
|
| 217 |
+
|
| 218 |
+
(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]
|
| 219 |
+
|
| 220 |
+
3. If you ran experiments...
|
| 221 |
+
|
| 222 |
+
(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]
|
| 223 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
|
| 224 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
|
| 225 |
+
(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]
|
| 226 |
+
|
| 227 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 228 |
+
|
| 229 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 230 |
+
(b) Did you mention the license of the assets? [N/A]
|
| 231 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [Yes]
|
| 232 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 233 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 234 |
+
|
| 235 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 236 |
+
|
| 237 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 238 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 239 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/MeeQkFYVbzW/MeeQkFYVbzW.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/MkbcAHIYgyS/MkbcAHIYgyS.md
ADDED
|
@@ -0,0 +1,555 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MASS-EDITING MEMORY IN A TRANSFORMER
|
| 2 |
+
|
| 3 |
+
Kevin Meng1,2 Arnab Sen Sharma2 Alex Andonian1 Yonatan Belinkov† 3 David Bau2 1MIT CSAIL 2Northeastern University 3Technion – IIT
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Recent work has shown exciting promise in updating large language models with new memories, so as to replace obsolete information or add specialized knowledge. However, this line of work is predominantly limited to updating single associations. We develop MEMIT, a method for directly updating a language model with many memories, demonstrating experimentally that it can scale up to thousands of associations for GPT-J (6B) and GPT-NeoX (20B), exceeding prior work by orders of magnitude. Our code and data are at memit.baulab.info.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
How many memories can we add to a deep network by directly editing its weights?
|
| 12 |
+
|
| 13 |
+
Although large autoregressive language models (Radford et al., 2019; Brown et al., 2020; Wang & Komatsuzaki, 2021; Black et al., 2022) are capable of recalling an impressive array of common facts such as “Tim Cook is the CEO of Apple” or “Polaris is in the constellation Ursa Minor” (Petroni et al., 2020; Brown et al., 2020), even very large models are known to lack more specialized knowledge, and they may recall obsolete information if not updated periodically (Lazaridou et al., 2021; Agarwal & Nenkova, 2022; Liska et al., 2022). The ability to maintain fresh and customizable information is desirable in many application domains, such as question answering, knowledge search, and content generation. For example, we might want to keep search models updated with breaking news and recently-generated user feedback. In other situations, authors or companies may wish to customize models with specific knowledge about their creative work or products. Because re-training a large model can be prohibitive (Patterson et al., 2021) we seek methods that can update knowledge directly.
|
| 14 |
+
|
| 15 |
+
To that end, several knowledge-editing methods have been proposed to insert new memories directly into specific model parameters. The approaches include constrained fine-tuning (Zhu et al., 2020), hypernetwork knowledge editing (De Cao et al., 2021; Hase et al., 2021; Mitchell et al., 2021; 2022), and rank-one model editing (Meng et al., 2022). However, this body of work is typically limited to updating at most a few dozen facts; a recent study evaluates on a maximum of 75 (Mitchell et al., 2022) whereas others primarily focus on single-edit cases. In practical settings, we may wish to update a model with hundreds or thousands of facts simultaneously, but a naive sequential application of current state-of-the-art knowledge-editing methods fails to scale up (Section 5.2).
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: MEMIT is capable of updating thousands of memories at once. (a) Language models can be viewed as knowledge bases containing memorized tuples $( s , r , o )$ , each connecting some subject $s$ to an object $o$ via a relation $r$ , e.g., ( $s =$ Michael Jordan, $r =$ plays sport, $o =$ basketball). (b) MEMIT modifies transformer weights to edit memories, e.g., “Michael Jordan now plays the sport baseball,” while (c) maintaining generalization, specificity, and fluency at scales beyond other methods. As Section 5.2.2 details, editing score is the harmonic mean of efficacy, generalization, and specificity metrics.
|
| 19 |
+
|
| 20 |
+
We propose MEMIT, a scalable multi-layer update algorithm that uses explicitly calculated parameter updates to insert new memories. Inspired by the ROME direct editing method (Meng et al., 2022), MEMIT targets the weights of transformer modules that we determine to be causal mediators of factual knowledge recall. Experiments on GPT-J (6B parameters; Wang & Komatsuzaki 2021) and GPT-NeoX (20B; Black et al. 2022) demonstrate that MEMIT can scale and successfully store thousands of memories in bulk. We analyze model behavior when inserting true facts, counterfactuals, 27 specific relations, and different mixed sets of memories. In each setting, we measure robustness in terms of generalization, specificity, and fluency while comparing the scaling of MEMIT to rank-one, hypernetwork, and fine-tuning baselines.
|
| 21 |
+
|
| 22 |
+
# 2 RELATED WORK
|
| 23 |
+
|
| 24 |
+
Scalable knowledge bases. The representation of world knowledge is a core problem in artificial intelligence (Richens, 1956; Minsky, 1974), classically tackled by constructing knowledge bases of real-world concepts. Pioneering hand-curated efforts (Lenat, 1995; Miller, 1995) have been followed by web-powered knowledge graphs (Auer et al., 2007; Bollacker et al., 2007; Suchanek et al., 2007; Havasi et al., 2007; Carlson et al., 2010; Dong et al., 2014; Vrandeciˇ c & Krötzsch´ , 2014; Bosselut et al., 2019) that extract knowledge from large-scale sources. Structured knowledge bases can be precisely queried, measured, and updated (Davis et al., 1993), but they are limited by sparse coverage of uncatalogued knowledge, such as commonsense facts (Weikum, 2021).
|
| 25 |
+
|
| 26 |
+
Language models as knowledge bases. Since LLMs can answer natural-language queries about real-world facts, it has been proposed that they could be used directly as knowledge bases (Petroni et al., 2019; Roberts et al., 2020; Jiang et al., 2020; Shin et al., 2020). However, LLM knowledge is only implicit; responses are sensitive to specific phrasings of the prompt (Elazar et al., 2021; Petroni et al., 2020), and it remains difficult to catalog, add, or update knowledge (AlKhamissi et al., 2022). Nevertheless, LLMs are promising because they scale well and are unconstrained by a fixed schema (Safavi & Koutra, 2021). In this paper, we take on the update problem, asking how the implicit knowledge encoded within model parameters can be mass-edited.
|
| 27 |
+
|
| 28 |
+
Hypernetwork knowledge editors. Several meta-learning methods have been proposed to edit knowledge in a model. Sinitsin et al. (2019) proposes a training objective to produce models amenable to editing by gradient descent. De Cao et al. (2021) proposes a Knowledge Editor (KE) hypernetwork that edits a standard model by predicting updates conditioned on new factual statements. In a study of KE, Hase et al. (2021) find that it fails to scale beyond a few edits, and they scale an improved objective to 10 beliefs. MEND (Mitchell et al., 2021) also adopts meta-learning, inferring weight updates from the gradient of the inserted fact. To scale their method, Mitchell et al. (2022) proposes SERAC, a system that routes rewritten facts through a different set of parameters while keeping the original weights unmodified; they demonstrate scaling up to 75 edits. Rather than meta-learning, our method employs direct parameter updates based on an explicitly computed mapping.
|
| 29 |
+
|
| 30 |
+
Direct model editing. Our work most directly builds upon efforts to localize and understand the internal mechanisms within LLMs (Elhage et al., 2021; Dar et al., 2022). Based on observations from Geva et al. (2021; 2022) that transformer MLP layers serve as key–value memories, we narrow our focus to them. We then employ causal mediation analysis (Pearl, 2001; Vig et al., 2020; Meng et al., 2022), which implicates a specific range of layers in recalling factual knowledge. Previously, Dai et al. (2022) and Yao et al. (2022) have proposed editing methods that alter sparse sets of neurons, but we adopt the classical view of a linear layer as an associative memory (Anderson, 1972; Kohonen, 1972). Our method is closely related to Meng et al. (2022), which also updates GPT as an explicit associative memory. Unlike the single-edit approach taken in that work, we modify a sequence of layers and develop a way for thousands of modifications to be performed simultaneously.
|
| 31 |
+
|
| 32 |
+
# 3 PRELIMINARIES: LANGUAGE MODELING AND MEMORY EDITING
|
| 33 |
+
|
| 34 |
+
The goal of MEMIT is to modify factual associations stored in the parameters of an autoregressive LLM. Such models generate text by iteratively sampling from a conditional token distribution
|
| 35 |
+
|
| 36 |
+
$\mathbb { P } \left[ x _ { [ t ] } ~ | ~ x _ { [ 1 ] } , \dots , x _ { [ E ] } \right]$ parameterized by a $D$ -layer transformer decoder, $G$ (Vaswani et al., 2017):
|
| 37 |
+
|
| 38 |
+
$$
|
| 39 |
+
\mathbb { P } \left[ x _ { [ t ] } \ | \ x _ { [ 1 ] } , \dots , x _ { [ E ] } \right] \triangleq G ( [ x _ { [ 1 ] } , \dots , x _ { [ E ] } ] ) = \mathrm { s o f t m a x } \left( W _ { y } h _ { [ E ] } ^ { D } \right) ,
|
| 40 |
+
$$
|
| 41 |
+
|
| 42 |
+
where This s $h _ { [ E ] } ^ { D }$ is the transformer’s hidden state representation at the final layer s computed using the following recursive relation: $D$ and ending token $E$
|
| 43 |
+
|
| 44 |
+
$$
|
| 45 |
+
\begin{array} { r l r } & { } & { h _ { [ t ] } ^ { l } ( x ) = h _ { [ t ] } ^ { l - 1 } ( x ) + a _ { [ t ] } ^ { l } ( x ) + m _ { [ t ] } ^ { l } ( x ) \qquad } \\ & { } & { \mathrm { w h e r e \ } a ^ { l } = \mathrm { a t t n } ^ { l } \left( h _ { [ 1 ] } ^ { l - 1 } , h _ { [ 2 ] } ^ { l - 1 } , \dots , h _ { [ t ] } ^ { l - 1 } \right) } \\ & { } & { m _ { [ t ] } ^ { l } = W _ { o u t } ^ { l } \sigma \left( W _ { i n } ^ { l } \gamma \left( h _ { [ t ] } ^ { l - 1 } \right) \right) , \qquad } \end{array}
|
| 46 |
+
$$
|
| 47 |
+
|
| 48 |
+
$h _ { [ t ] } ^ { 0 } ( x )$ is the embedding of token $x _ { [ t ] }$ , and $\gamma$ is layernorm. Note that we have written attention and MLPs in parallel as done in Black et al. (2021) and Wang & Komatsuzaki (2021).
|
| 49 |
+
|
| 50 |
+
Large language models have been observed to contain many memorized facts (Petroni et al., 2020; Brown et al., 2020; Jiang et al., 2020; Chowdhery et al., 2022). In this paper, we study facts of the form (subject $s$ , relation $r$ , object $o$ ), e.g., $s =$ Michael Jordan, $r =$ plays sport, $o =$ basketball). A generator $G$ can recall a memory for $( s _ { i } , r _ { i } , * )$ if we form a natural language prompt $p _ { i } = p ( s _ { i } , r _ { i } )$ such as “Michael Jordan plays the sport of” and predict the next token(s) representing $o _ { i }$ . Our goal is to edit many memories at once. We formally define a list of edit requests as:
|
| 51 |
+
|
| 52 |
+
$$
|
| 53 |
+
{ \mathcal { E } } = \{ ( s _ { i } , r _ { i } , o _ { i } ) \mid i \} \ \mathrm { s . t . } \ \not \exists i , j . \ ( s _ { i } = s _ { j } ) \land ( r _ { i } = r _ { j } ) \land ( o _ { i } \neq o _ { j } ) .
|
| 54 |
+
$$
|
| 55 |
+
|
| 56 |
+
The logical constraint ensures that there are no conflicting requests. For example, we can edit Michael Jordan to play $o _ { i } =$ “baseball”, but then we exclude associating him with professional soccer.
|
| 57 |
+
|
| 58 |
+
What does it mean to edit a memory well? At a superficial level, a memory can be considered edited after the model assigns a higher probability to the statement “Michael Jordan plays the sport of baseball” than to the original prediction (basketball); we say that such an update is effective. Yet it is important to also view the question in terms of generalization, specificity, and fluency:
|
| 59 |
+
|
| 60 |
+
• To test for generalization, we can rephrase the question: “What is Michael Jordan’s sport? What sport does he play professionally?” If the modification of $G$ is superficial and overfitted to the specific memorized prompt, such predictions will fail to recall the edited memory, “baseball.” • Conversely, to test for specificity, we can ask about similar subjects for which memories should not change: “What sport does Kobe Bryant play? What does Magic Johnson play?” These tests will fail if the updated $G$ indiscriminately regurgitates “baseball” for subjects that were not edited. • When making changes to a model, we must also monitor fluency. If the updated model generates disfluent text such as “baseball baseball baseball baseball,” we should count that as a failure.
|
| 61 |
+
|
| 62 |
+
Achieving these goals is challenging, even for a few edits (Hase et al., 2021; Mitchell et al., 2022;
|
| 63 |
+
Meng et al., 2022). We investigate whether they can be attained at the scale of thousands of edits.
|
| 64 |
+
|
| 65 |
+
# 4 METHOD
|
| 66 |
+
|
| 67 |
+
MEMIT inserts memories by updating transformer mechanisms that have recently been elucidated using causal mediation analysis (Meng et al., 2022). In GPT-2 XL, we found that there is a sequence of critical MLP layers $\mathcal { R }$ that mediate factual association recall at the last subject token $S$ (Figure 2). MEMIT operates by (i) calculating the vector associations we want the critical layers to remember, then (ii) storing a portion of the desired memories in each layer $l \in \mathcal { R }$ .
|
| 68 |
+
|
| 69 |
+
Throughout this paper, our focus will be on states representing the last subject token $S$ of prompt $p _ { i }$ , so we shall abbreviate $h _ { i } ^ { l } = h _ { [ S ] } ^ { l } ( p _ { i } )$ . Similarly, $m _ { i } ^ { l }$ and $a _ { i } ^ { l }$ denote $m _ { [ S ] } ^ { l } ( p _ { i } )$ and $a _ { [ S ] } ^ { l } ( p _ { i } )$ .
|
| 70 |
+
|
| 71 |
+
# 4.1 IDENTIFYING THE CRITICAL PATH OF MLP LAYERS
|
| 72 |
+
|
| 73 |
+
Figure 3 shows the results of applying causal tracing to the larger GPT-J (6B) model; for implementation details, see Appendix A. We measure the average indirect causal effect of each $h _ { i } ^ { l }$ on a sample of memory prompts $p _ { i }$ , with either the Attention or MLP modules for token $S$ disabled. The results confirm that GPT-J has a concentration of mediating states $h _ { i } ^ { l }$ ; moreover, they highlight a mediating causal role for a range of MLP modules, which can be seen as a large gap between the effect of single states (purple bars in Figure 3) and the effects with MLP severed (green bars); this gap diminishes after layer 8. Unlike Meng et al. (2022) who use this test to identify a single edit layer, we select the whole range of critical MLP layers $l \in \mathcal { R }$ . For GPT-J, we have $\mathcal { R } \overset { \cdot } { = } \{ 3 , \overset { \cdot } { 4 } , 5 , 6 , 7 , \overset { \cdot } { 8 } \}$ .
|
| 74 |
+
|
| 75 |
+

|
| 76 |
+
Figure 2: MEMIT modifies transformer parameters on the critical path of MLP-mediated factual recall. We edit stored associations based on observed patterns of causal mediation: (a) first, the early-layer attention modules gather subject names into vector representations at the last subject token $S$ . (b) Then MLPs at layers $l \in \mathcal { R }$ read these encodings and add memories to the residual stream. (c) Those hidden states are read by attention to produce the output. (d) MEMIT edits memories by storing vector associations in the critical MLPs.
|
| 77 |
+
|
| 78 |
+
Given that a range of MLPs play a joint mediating role in recalling facts, we ask: what is the role of one MLP in storing a memory? Each token state in a transformer is part of the residual stream that all attention and MLP modules read from and write to (Elhage et al., 2021). Unrolling Eqn. 2 for $h _ { i } ^ { L ^ { \bf ^ { - } } } = h _ { [ S ] } ^ { L } ( p _ { i } )$ :
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
h _ { i } ^ { L } = h _ { i } ^ { 0 } + \sum _ { l = 1 } ^ { L } a _ { i } ^ { l } + \sum _ { l = 1 } ^ { L } m _ { i } ^ { l } .
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+

|
| 85 |
+
Figure 3: A critical mediating role for mid-layer MLPs.
|
| 86 |
+
Eqn. 6 highlights that each individual
|
| 87 |
+
|
| 88 |
+
MLP contributes by adding to the memory at $h _ { i } ^ { L }$ (Figure 2b), which is later read by last-token attention modules (Figure 2c). Therefore, when writing new memories into $G$ , we can spread the desired changes across all the critical layers $m _ { i } ^ { l }$ for $l \in \mathcal { R }$ .
|
| 89 |
+
|
| 90 |
+
# 4.2 BATCH UPDATE FOR A SINGLE LINEAR ASSOCIATIVE MEMORY
|
| 91 |
+
|
| 92 |
+
In each individual layer $l$ , we wish to store a large batch of $u \gg 1$ memories. This section derives an optimal single-layer update that minimizes the squared error of memorized associations, assuming that the layer contains previously-stored memories that should be preserved. We denote $W _ { 0 } \triangleq W _ { o u t } ^ { l }$ (Eqn. 4, Figure 2) and analyze it as a linear associative memory (Kohonen, 1972; Anderson, 1972) that associates a set of input keys $k _ { i } \triangleq k _ { i } ^ { l }$ (encoding subjects) to corresponding memory values $m _ { i } \triangleq m _ { i } ^ { l }$ (encoding memorized properties) with minimal squared error:
|
| 93 |
+
|
| 94 |
+
$$
|
| 95 |
+
W _ { 0 } \triangleq \underset { \hat { W } } { \mathrm { a r g m i n } } \sum _ { i = 1 } ^ { n } \left\| \hat { W } k _ { i } - m _ { i } \right\| ^ { 2 } .
|
| 96 |
+
$$
|
| 97 |
+
|
| 98 |
+
If we stack keys and memories as matrices $K _ { 0 } = [ k _ { 1 } \ | \ k _ { 2 } \ | \ \cdot \ \cdot \ | \ k _ { n } ]$ and $M _ { 0 } = [ m _ { 1 } \mid m _ { 2 } \mid \cdot \cdot \cdot \mid m _ { n } ]$ then Eqn. 7 can be optimized by solving the normal equation (Strang, 1993, Chapter 4):
|
| 99 |
+
|
| 100 |
+
$$
|
| 101 |
+
W _ { 0 } K _ { 0 } K _ { 0 } ^ { T } = M _ { 0 } K _ { 0 } ^ { T } .
|
| 102 |
+
$$
|
| 103 |
+
|
| 104 |
+
Suppose that pre-training sets a transformer MLP’s weights to the optimal solution $W _ { 0 }$ as defined in Eqn. 8. Our goal is to update $W _ { 0 }$ with some small change $\Delta$ that produces a new matrix $W _ { 1 }$ with
|
| 105 |
+
|
| 106 |
+

|
| 107 |
+
Figure 4: The MEMIT update. We first (i) replace $h _ { i } ^ { l }$ with the vector $z _ { i }$ and optimize Eqn. 16 so that it conveys the new memory. Then, after all $z _ { i }$ are calculated we (ii) iteratively insert a fraction of the residuals for all $z _ { i }$ over the range of critical MLP modules, executing each layer’s update by applying Eqn. 14. Because changing one layer will affect activations of downstream modules, we recollect activations after each iteration.
|
| 108 |
+
|
| 109 |
+
a set of additional associations. Unlike Meng et al. (2022), we cannot solve our problem with a constraint that adds only a single new association, so we define an expanded objective:
|
| 110 |
+
|
| 111 |
+
$$
|
| 112 |
+
W _ { 1 } \triangleq \underset { \hat { W } } { \mathrm { a r g m i n } } \left( \sum _ { i = 1 } ^ { n } \left\| \hat { W } k _ { i } - m _ { i } \right\| ^ { 2 } + \sum _ { i = n + 1 } ^ { n + u } \left\| \hat { W } k _ { i } - m _ { i } \right\| ^ { 2 } \right) .
|
| 113 |
+
$$
|
| 114 |
+
|
| 115 |
+
We can solve Eqn. 9 by again applying the normal equation, now written in block form:
|
| 116 |
+
|
| 117 |
+
$$
|
| 118 |
+
\begin{array} { r l } { W _ { 1 } \left[ K _ { 0 } \quad K _ { 1 } \right] \left[ K _ { 0 } \quad K _ { 1 } \right] ^ { T } = \left[ M _ { 0 } \quad M _ { 1 } \right] \left[ K _ { 0 } \quad K _ { 1 } \right] ^ { T } } & { { } } \end{array}
|
| 119 |
+
$$
|
| 120 |
+
|
| 121 |
+
$$
|
| 122 |
+
\begin{array} { r l } { \mathrm { n d s ~ t o } : } & { { } ( W _ { 0 } + \Delta ) ( K _ { 0 } K _ { 0 } ^ { T } + K _ { 1 } K _ { 1 } ^ { T } ) = M _ { 0 } K _ { 0 } ^ { T } + M _ { 1 } K _ { 1 } ^ { T } } \end{array}
|
| 123 |
+
$$
|
| 124 |
+
|
| 125 |
+
$$
|
| 126 |
+
W _ { 0 } K _ { 0 } K _ { 0 } ^ { T } + W _ { 0 } K _ { 1 } K _ { 1 } ^ { T } + \Delta K _ { 0 } K _ { 0 } ^ { T } + \Delta K _ { 1 } K _ { 1 } ^ { T } = M _ { 0 } K _ { 0 } ^ { T } + M _ { 1 } K _ { 1 } ^ { T }
|
| 127 |
+
$$
|
| 128 |
+
|
| 129 |
+
$$
|
| 130 |
+
\mathrm { i n g ~ E q n . ~ 8 ~ f r o m ~ E q n . ~ 1 2 : } \quad \Delta ( K _ { 0 } K _ { 0 } ^ { T } + K _ { 1 } K _ { 1 } ^ { T } ) = M _ { 1 } K _ { 1 } ^ { T } - W _ { 0 } K _ { 1 } K _ { 1 } ^ { T } .
|
| 131 |
+
$$
|
| 132 |
+
|
| 133 |
+
A succinct solution can be written by defining two additional quantities: $C _ { 0 } \triangleq K _ { 0 } K _ { 0 } ^ { T }$ , a constant proportional to the uncentered covariance of the pre-existing keys, and $R \triangleq M _ { 1 } - W _ { 0 } K _ { 1 } ^ { \ast }$ , the residual error of the new associations when evaluated on old weights $W _ { 0 }$ . Then Eqn. 13 can be simplified as:
|
| 134 |
+
|
| 135 |
+
$$
|
| 136 |
+
\Delta = R K _ { 1 } ^ { T } ( C _ { 0 } + K _ { 1 } K _ { 1 } ^ { T } ) ^ { - 1 } .
|
| 137 |
+
$$
|
| 138 |
+
|
| 139 |
+
Since pretraining is opaque, we do not have access to $K _ { 0 }$ or $M _ { 0 }$ . Fortunately, computing Eqn. 14 only requires an aggregate statistic $C _ { 0 }$ over the previously stored keys. We assume that the set of previously memorized keys can be modeled as a random sample of inputs, so that we can compute
|
| 140 |
+
|
| 141 |
+
$$
|
| 142 |
+
C _ { 0 } = \lambda \cdot \mathbb { E } _ { k } \left[ k k ^ { T } \right]
|
| 143 |
+
$$
|
| 144 |
+
|
| 145 |
+
by estimating $\mathbb { E } _ { k } \left[ k k ^ { T } \right]$ , an uncentered covariance statistic collected using an empirical sample of vector inputs to the layer. We must also select $\lambda$ , a hyperparameter that balances the weighting of new v.s. old associations; a typical value is $\lambda = 1 . 5 \times \bar { 1 } 0 ^ { 4 }$ .
|
| 146 |
+
|
| 147 |
+
# 4.3 UPDATING MULTIPLE LAYERS
|
| 148 |
+
|
| 149 |
+
We now define the overall update algorithm (Figure 4). Inspired by the observation that robustness is improved when parameter change magnitudes are minimized (Zhu et al., 2020), we spread updates evenly over the range of mediating layers $\mathcal { R }$ . We define a target layer $L \triangleq \operatorname* { m a x } ( \mathcal { R } ) ^ { * }$ at the end of the mediating layers, at which the new memories should be fully represented. Then, for each edit $( s _ { i } , r _ { i } , o _ { i } ) \in \mathbf { \bar { \mathcal { E } } }$ , we (i) compute a hidden vector $z _ { i }$ to replace $h _ { i } ^ { L }$ such that adding $\delta _ { i } \triangleq z _ { i } - h _ { i } ^ { L }$ to the hidden state at layer $L$ and token $T$ will completely convey the new memory. Finally, one layer at a time, we (ii) modify the MLP at layer $l$ , so that it contributes an approximately-equal portion of the change $\delta _ { i }$ for each memory $i$ .
|
| 150 |
+
|
| 151 |
+
(i) Computing $z _ { i }$ . For the $i$ th memory, we first compute a vector $z _ { i }$ that would encode the association $( s _ { i } , r _ { i } , o _ { i } )$ if it were to replace $h _ { i } ^ { L }$ at layer $L$ at token $S$ . We find $z _ { i } = h _ { i } ^ { L } + \delta _ { i }$ by optimizing the residual vector $\delta _ { i }$ using gradient descent:
|
| 152 |
+
|
| 153 |
+
$$
|
| 154 |
+
z _ { i } = h _ { i } ^ { L } + \underset { \delta _ { i } } { \mathrm { a r g m i n } } \frac { 1 } { P } \sum _ { j = 1 } ^ { P } - \log \mathbb { P } _ { G ( h _ { i } ^ { L } + = \delta _ { i } ) } \left[ o _ { i } \mid x _ { j } \oplus p ( s _ { i } , r _ { i } ) \right] .
|
| 155 |
+
$$
|
| 156 |
+
|
| 157 |
+
In words, we optimize $\delta _ { i }$ to maximize the model’s prediction of the desired object $o _ { i }$ , given a set of factual prompts $\{ x _ { j } \oplus p ( s _ { i } , r _ { i } ) \}$ that concatenate random prefixes $x _ { j }$ to a templated prompt to aid generalization across contexts. $\overset { \triangledown } { \boldsymbol { G } } ( h _ { i } ^ { L } + = \delta _ { i } )$ indicates that we modify the transformer execution by substituting the modified hidden state $z _ { i }$ for $h _ { i } ^ { L }$ ; this is called “hooking” in popular ML libraries.
|
| 158 |
+
|
| 159 |
+
(ii) Spreading $z _ { i } - h _ { i } ^ { L }$ over layers. We seek delta matrices $\Delta ^ { l }$ such that:
|
| 160 |
+
|
| 161 |
+
$$
|
| 162 |
+
\begin{array} { r l } & { \mathrm { t i n g } \ \hat { W } _ { o u t } ^ { l } : = W _ { o u t } ^ { l } + \Delta ^ { l } \mathrm { \ f o r \ a l l } \ l \in { \mathcal { R } } \mathrm { \ o p t i m i z e s \ } \displaystyle \operatorname* { m i n } _ { \{ \Delta ^ { l } \} } \sum _ { i } \left\| z _ { i } - \hat { h } _ { i } ^ { L } \right\| ^ { 2 } , } \\ & { \mathrm { \ w h e r e } \ \hat { h } _ { i } ^ { L } = h _ { i } ^ { 0 } + \displaystyle \sum _ { l = 1 } ^ { L } a _ { i } ^ { l } + \sum _ { l = 1 } ^ { L } \hat { W } _ { o u t } ^ { l } \sigma \left( W _ { i n } ^ { l } \gamma \left( h _ { t } ^ { l - 1 } \right) \right) . } \end{array}
|
| 163 |
+
$$
|
| 164 |
+
|
| 165 |
+
Because edits to any layer will influence all following layers’ activations, we calculate $\Delta ^ { l }$ iteratively in ascending layer order (Figure 4ii-a,b,c). To compute each individual $\Delta ^ { l }$ , we need the corresponding keys $K ^ { l } = \mathsf { \bar { [ } } k _ { 1 } ^ { l ^ { \prime } } | \cdots | k _ { n } ^ { l } ]$ and memories $M ^ { l } = [ \dot { m } _ { 1 } ^ { l } \ | \ \cdots | \ m _ { n } ^ { l } ]$ to insert using Eqn. 14. Each key $k _ { i } ^ { l }$ is computed as the input to $W _ { o u t } ^ { l }$ at each layer $l$ (Figure 2d):
|
| 166 |
+
|
| 167 |
+
$$
|
| 168 |
+
k _ { i } ^ { l } = \frac { 1 } { P } \sum _ { j = 1 } ^ { P } k ( x _ { j } + s _ { i } ) , \mathrm { ~ w h e r e ~ } k ( x ) = \sigma \left( W _ { i n } ^ { l } \gamma \left( h _ { i } ^ { l - 1 } ( x ) \right) \right) .
|
| 169 |
+
$$
|
| 170 |
+
|
| 171 |
+
$m _ { i } ^ { l }$ is then computed as the sum of its current value and a fraction of the remaining top-level residual:
|
| 172 |
+
|
| 173 |
+
where the denominator of $r _ { i }$ spreads the residual out evenly. Algorithm 1 summarizes MEMIT, and additional implementation details are offered in Appendix B.
|
| 174 |
+
|
| 175 |
+
# Algorithm 1: The MEMIT Algorithm
|
| 176 |
+
|
| 177 |
+
<table><tr><td colspan="2">Data: Requested edits ε= {(si, ri,Oi)}, generator G,layers to edit S,covariances Cl Result: Modified generator containing edits from £</td></tr><tr><td colspan="2">forSi,ri,Oi∈εdo // Compute target zi vectors for every memory i</td></tr><tr><td></td><td>optimize δi ← argmins𝑖 p∑𝑗=1-log PG(h +=δi)[0i |xj p(si,ri)] (Eqn. 16)</td></tr><tr><td>3 4 end</td><td>z←h+δi</td></tr><tr><td colspan="2"></td></tr><tr><td>5 forl∈Rdo 6</td><td>//Perform update:spread changes over layers h←h-1+a+m (Eqn.2) //Run layer l with updated weights</td></tr><tr><td>7</td><td>for Si,ri,Oi ∈εdo</td></tr><tr><td>8</td><td>k←= 1 P k(xj+si) (Eqn.19) P j=1</td></tr><tr><td>9</td><td>2-h r← (Eqn. 20) //Distribute residual over remaining layers L-+1</td></tr><tr><td>10</td><td>end</td></tr><tr><td>11</td><td>K←[,..,k]</td></tr><tr><td>12</td><td>Rl←[r',...,.r]</td></tr><tr><td>13</td><td>△¹ ←R¹K𝑙T(C𝑙 +K¹K𝑙𝑇)-1 (Eqn.14)</td></tr><tr><td>14</td><td>Wl←Wl+△ / Update layer l MLP weights in model</td></tr><tr><td>15 end</td><td></td></tr></table>
|
| 178 |
+
|
| 179 |
+
# 5 EXPERIMENTS
|
| 180 |
+
|
| 181 |
+
# 5.1 MODELS AND BASELINES
|
| 182 |
+
|
| 183 |
+
We run experiments on two autoregressive LLMs: GPT-J (6B) and GPT-NeoX (20B). For baselines, we first compare with a naive fine-tuning approach that uses weight decay to prevent forgetfulness (FT-W). Next, we experiment with MEND, a hypernetwork-based model editing approach that edits multiple facts at the same time (Mitchell et al., 2021). Finally, we run a sequential version of ROME (Meng et al., 2022): a direct model editing method that iteratively updates one fact at a time. The recent SERAC model editor (Mitchell et al., 2022) does not yet have public code, so we cannot compare with it at this time. See Appendix B for implementation details.
|
| 184 |
+
|
| 185 |
+
# 5.2 MEMIT SCALING
|
| 186 |
+
|
| 187 |
+
# 5.2.1 EDITING 10K MEMORIES IN ZSRE
|
| 188 |
+
|
| 189 |
+
We first test MEMIT on zsRE (Levy et al., 2017), a question-answering task from which we extract 10,000 real-world facts; zsRE tests MEMIT’s ability to add correct information. Because zsRE does not contain generation tasks, we evaluate solely on prediction-based metrics. Efficacy
|
| 190 |
+
|
| 191 |
+
Table 1: 10,000 zsRE Edits on GPT-J (6B).
|
| 192 |
+
|
| 193 |
+
<table><tr><td>Editor</td><td>Score 个</td><td>Efficacy ↑</td><td>Paraphrase 个</td><td>Specificity ↑</td></tr><tr><td>GPT-J</td><td>26.4</td><td>26.4 (±0.6)</td><td>25.8 (±0.5)</td><td>27.0 (±0.5)</td></tr><tr><td>FT-W</td><td>42.1</td><td>69.6(±0.6)</td><td>64.8 (±0.6)</td><td>24.1 (±0.5)</td></tr><tr><td>MEND</td><td>20.0</td><td>19.4 (±0.5)</td><td>18.6 (±0.5)</td><td>22.4 (±0.5)</td></tr><tr><td>ROME</td><td>2.6</td><td>21.0 (±0.7)</td><td>19.6 (±0.7)</td><td>0.9 (±0.1)</td></tr><tr><td>MEMIT</td><td>50.7</td><td>96.7 (±0.3)</td><td>89.7 (±0.5)</td><td>26.6 (±0.5)</td></tr></table>
|
| 194 |
+
|
| 195 |
+
measures the proportion of cases where $o$ is the argmax generation given $p ( s , r )$ , Paraphrase is the same metric but applied on paraphrases, Specificity is the model’s argmax accuracy on a randomly-sampled unrelated fact that should not have changed, and Score is the harmonic mean of the three aforementioned scores; Appendix C contains formal definitions. As Table 1 shows, MEMIT performs best at 10,000 edits; most memories are recalled with generalization and minimal bleedover. Interestingly, simple fine-tuning FT-W performs better than the baseline knowledge editing methods MEND and ROME at this scale, likely because its objective is applied only once.
|
| 196 |
+
|
| 197 |
+
# 5.2.2 COUNTERFACT SCALING CURVES
|
| 198 |
+
|
| 199 |
+
Next, we test MEMIT’s ability to add counterfactual information using COUNTERFACT, a collection of 21,919 factual statements (Meng et al. (2022), Appendix C). We first filter conflicts by removing facts that violate the logical condition in Eqn. 5 (i.e., multiple edits modify the same $( s , r )$ prefix to different objects). For each problem size $n \ \in \ \{ 1 , 2 , 3 , 6 , 1 0 , 1 8 , 3 2 $ , $5 6 , 1 0 0 , 1 7 8 , 3 1 6 , 5 6 2 , 1 0 0 0 , 1 7 7 8 , 3 1 6 \dot { 2 } , 5 6 2 3 , 1 0 0 0 0 \dot { 5 } ^ { 1 }$ , $n$ counterfactuals are inserted.
|
| 200 |
+
|
| 201 |
+
Following Meng et al. (2022), we report several metrics designed to test editing desiderata. Efficacy Success (ES) evaluates editing success and is the proportion of cases for which the new object $o _ { i }$ ’s probability is greater than the probability of the true real-world object $o _ { i } ^ { c }$ : 2 $\mathbb { E } _ { i } \left[ \mathbb { P } _ { G } \left[ o _ { i } \ | \ p ( s _ { i } , \bar { r } _ { i } ) \right] > \mathbb { P } _ { G } \left[ o _ { i } ^ { c } \ | \ \bar { p } ( s _ { i } , r _ { i } ) \right] \right]$ . Paraphrase Success (PS) is a generalization measure defined similarly, except $G$ is prompted with rephrasings of the original statement. For testing specificity, Neighborhood Success (NS) is defined similarly, but we check the probability $G$ assigns to the correct answer $o _ { i } ^ { c }$ (instead of $o _ { i }$ ), given prompts about distinct but semantically-related subjects (instead of $s _ { i }$ ). Editing Score (S) aggregates metrics by taking the harmonic mean of ES, PS, NS.
|
| 202 |
+
|
| 203 |
+
We are also interested in measuring generation quality of the updated model. First, we check that $G$ ’s generations are semantically consistent with the new object using a Reference Score (RS), which is collected by generating text about $s$ and checking its TF-IDF similarity with a reference Wikipedia text about $o$ . To test for fluency degradation due to excessive repetition, we measure Generation Entropy (GE), computed as the weighted sum of the entropy of bi- and tri-gram $n$ -gram distributions of the generated text. See Appendix C for further details on metrics.
|
| 204 |
+
|
| 205 |
+
Figure 5 plots performance v.s. number of edits on log scale, up to 10,000 facts. ROME performs well up to $n = 1 0$ but degrades starting at $n = 3 2$ . Similarly, MEND performs well at $n = 1$ but rapidly declines at $n = 6$ , losing all efficacy before $n = 1 , 0 0 0$ and, curiously, having negligible effect on the model at $n = 1 0 { , } 0 0 0$ (the high specificity score is achieved by leaving the model nearly unchanged). MEMIT performs best at large $n$ . At small $n$ , ROME achieves better generalization at the cost of slightly lower specificity, which means that ROME’s edits are more robust under rephrasings, likely due to that method’s hard equality constraint for weight updates, compared to MEMIT’s soft error minimization. Table 2 provides a direct numerical comparison at 10,000 edits on both GPT-J and GPT-NeoX. FT-W3 does well on probability-based metrics but suffers from complete generation failure, indicating significant model damage.
|
| 206 |
+
|
| 207 |
+
Appendix B provides a runtime analysis of all four methods on 10,000 edits. We find that MEND is fastest, taking 98 sec. FT is second at around $2 9 \mathrm { { m i n } }$ , while MEMIT and ROME are the slowest at
|
| 208 |
+
|
| 209 |
+

|
| 210 |
+
Figure 5: MEMIT scaling curves plot editing performance against problem size (log-scale). The dotted line indicates GPT-J’s pre-edit performance; specificity (NS) and fluency (GE) should stay close to the baseline. $9 5 \%$ confidence intervals are shown as areas.
|
| 211 |
+
|
| 212 |
+
Table 2: Numerical results on COUNTERFACT for 10,000 edits.
|
| 213 |
+
|
| 214 |
+
<table><tr><td rowspan="2">Editor</td><td>Score</td><td>Efficacy</td><td>Generalization</td><td>Specificity</td><td>Fluency</td><td>Consistency</td></tr><tr><td>S个</td><td>ES个</td><td>PS个</td><td>NS↑</td><td>GE↑</td><td>RS个</td></tr><tr><td>GPT-J</td><td>22.4</td><td>15.2 (0.7)</td><td>17.7 (0.6)</td><td>83.5 (0.5)</td><td>622.4 (0.3)</td><td>29.4 (0.2)</td></tr><tr><td>FT-W</td><td>67.6</td><td>99.4 (0.1)</td><td>77.0 (0.7)</td><td>46.9 (0.6)</td><td>293.9 (2.4)</td><td>15.9 (0.3)</td></tr><tr><td>MEND</td><td>23.1</td><td>15.7 (0.7)</td><td>18.5 (0.7)</td><td>83.0 (0.5)</td><td>618.4 (0.3)</td><td>31.1 (0.2)</td></tr><tr><td>ROME</td><td>50.3</td><td>50.2 (1.0)</td><td>50.4 (0.8)</td><td>50.2 (0.6)</td><td>589.6 (0.5)</td><td>3.3 (0.0)</td></tr><tr><td>MEMIT</td><td>85.8</td><td>98.9 (0.2)</td><td>88.6 (0.5)</td><td>73.7 (0.5)</td><td>619.9 (0.3)</td><td>40.1 (0.2)</td></tr><tr><td>GPT-NeoX</td><td>23.7</td><td>16.8 (1.9)</td><td>18.3 (1.7)</td><td>81.6 (1.3)</td><td>620.4 (0.6)</td><td>29.3 (0.5)</td></tr><tr><td>MEMIT</td><td>82.0</td><td>97.2 (0.8)</td><td>82.2 (1.6)</td><td>70.8 (1.4)</td><td>606.4 (1.0)</td><td>36.9 (0.6)</td></tr></table>
|
| 215 |
+
|
| 216 |
+
$7 . 4 4 \mathrm { h r }$ and $1 2 . 2 9 \mathrm { h r }$ , respectively. While MEMIT’s execution time is high relative to MEND and FT, we note that its current implementation is naive and does not batch the independent $z _ { i }$ optimizations, instead computing each one in series. These computations are actually “embarrassingly parallel” and thus could be batched.
|
| 217 |
+
|
| 218 |
+
# 5.3 EDITING DIFFERENT CATEGORIES OF FACTS
|
| 219 |
+
|
| 220 |
+
For insight into MEMIT’s performance on different types of facts, we pick the 27 categories from COUNTERFACT that have at least 300 cases each, and assess each algorithm’s performance on those cases. Figure 6a shows that MEMIT achieves better overall scores compared to FT and MEND in all categories. It also reveals that some relations are harder to edit compared to others; for example, each of the editing algorithms faced difficulties in changing the sport an athlete plays. Even on harder cases, MEMIT outperforms other methods by a clear margin.
|
| 221 |
+
|
| 222 |
+
Model editing methods are known to occasionally suffer from a trade-off between attaining high generalization and good specificity. This trade-off is clearly visible for MEND in Figure 6b. FT consistently fails to achieve good specificity. Overall, MEMIT achieves a higher score in both dimensions, although it also exhibits a trade-off in editing some relations such as P127 (“product owned by company”) and P641 (“athlete plays sport”).
|
| 223 |
+
|
| 224 |
+

|
| 225 |
+
Figure 6: (a) Category-wise rewrite scores achieved by different approaches in editing 300 similar facts. (b) Category-wise specificity vs generalization scores by different approaches on 300 edits.
|
| 226 |
+
|
| 227 |
+

|
| 228 |
+
Figure 7: When comparing mixes of edits, MEMIT gives consistent near-linear (near-average) performance while scaling up to 700 facts.
|
| 229 |
+
|
| 230 |
+
# 5.4 EDITING DIFFERENT CATEGORIES OF FACTS TOGETHER
|
| 231 |
+
|
| 232 |
+
To investigate whether the scaling of MEMIT is sensitive to differences in the diversity of the memories being edited together, we sample sets of cases ${ \mathcal { E } } _ { m i x }$ that mix two different relations from the COUNTERFACT dataset. We consider four scenarios depicted in Figure 7, where the relations have similar or different classes of subjects or objects. In all of the four cases, MEMIT’s performance on ${ \mathcal { E } } _ { m i x }$ is close to the average of the performance of each relation without mixing. This provides support to the hypothesis that the scaling of MEMIT is neither positively nor negatively affected by the diversity of the memories being edited. Appendix D contains implementation details.
|
| 233 |
+
|
| 234 |
+
# 6 DISCUSSION AND CONCLUSION
|
| 235 |
+
|
| 236 |
+
We have developed MEMIT, a method for editing factual memories in large language models by directly manipulating specific layer parameters. Our method scales to much larger sets of edits (100x) than other approaches while maintaining excellent specificity, generalization, and fluency.
|
| 237 |
+
|
| 238 |
+
Our investigation also reveals some challenges: certain relations are more difficult to edit with robust specificity, yet even on challenging cases we find that MEMIT outperforms other methods by a clear margin. The knowledge representation we study is also limited in scope to working with directional $( s , r , o )$ relations: it does not cover spatial or temporal reasoning, mathematical knowledge, linguistic knowledge, procedural knowledge, or even symmetric relations. For example, the association that “Tim Cook is CEO of Apple” must be processed separately from the opposite association that “The CEO of Apple is Tim Cook.”
|
| 239 |
+
|
| 240 |
+
Despite these limitations, it is noteworthy that large-scale model updates can be constructed using an explicit analysis of internal computations. Our results raise a question: might interpretability-based methods become a commonplace alternative to traditional opaque fine-tuning approaches? Our positive experience brings us optimism that further improvements to our understanding of network internals will lead to more transparent and practical ways to edit, control, and audit models.
|
| 241 |
+
|
| 242 |
+
# 7 ETHICAL CONSIDERATIONS
|
| 243 |
+
|
| 244 |
+
Although we test a language model’s ability to serve as a knowledge base, we do not find these models to be a reliable source of knowledge, and we caution readers that a LLM should not be used as an authoritative source of facts. Our memory-editing methods shed light on the internal mechanisms of models and potentially reduce the cost and energy needed to fix errors in a model, but the same methods might also enable a malicious actor to insert false or damaging information into a model that was not originally present in the training data.
|
| 245 |
+
|
| 246 |
+
# 8 ACKNOWLEDGEMENTS.
|
| 247 |
+
|
| 248 |
+
Thanks to Jaden Fiotto-Kaufmann for building the demonstration at memit.baulab.us. This project was supported by an AI Alignment grant from Open Philanthropy. YB was also supported by the Israel Science Foundation (grant No. 448/20) and an Azrieli Foundation Early Career Faculty Fellowship.
|
| 249 |
+
|
| 250 |
+
# 9 REPRODUCIBILITY
|
| 251 |
+
|
| 252 |
+
The code and data for our methods and experiments are available at memit.baulab.info.
|
| 253 |
+
|
| 254 |
+
All experiments are run on workstations with NVIDIA A6000 GPUs. The language models are loaded using HuggingFace Transformers (Wolf et al., 2019), and PyTorch (Paszke et al., 2019) is used for executing the model editing algorithms on GPUs.
|
| 255 |
+
|
| 256 |
+
GPT-J experiments fit into one 48GB A6000, but GPT-NeoX runs require at least two: one 48GB GPU for running the model in float16, and another slightly smaller GPU for executing the editing method. Due to the size of these language models, our experiments will not run on GPUs with less memory.
|
| 257 |
+
|
| 258 |
+
# REFERENCES
|
| 259 |
+
|
| 260 |
+
Oshin Agarwal and Ani Nenkova. Temporal effects on pre-trained models for language processing tasks. Transactions of the Association for Computational Linguistics, 10:904–921, 2022.
|
| 261 |
+
Badr AlKhamissi, Millicent Li, Asli Celikyilmaz, Mona Diab, and Marjan Ghazvininejad. A review on language models as knowledge bases. arXiv preprint arXiv:2204.06031, 2022.
|
| 262 |
+
James A Anderson. A simple neural network generating an interactive memory. Mathematical biosciences, 14(3-4):197–220, 1972.
|
| 263 |
+
Sören Auer, Christian Bizer, Georgi Kobilarov, Jens Lehmann, Richard Cyganiak, and Zachary Ives. Dbpedia: A nucleus for a web of open data. In The semantic web, pp. 722–735. Springer, 2007.
|
| 264 |
+
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.
|
| 265 |
+
Sid Black, Stella Biderman, Eric Hallahan, Quentin Anthony, Leo Gao, Laurence Golding, Horace He, Connor Leahy, Kyle McDonell, Jason Phang, Michael Pieler, USVSN Sai Prashanth, Shivanshu Purohit, Laria Reynolds, Jonathan Tow, Ben Wang, and Samuel Weinbach. Gpt-neox-20b: An open-source autoregressive language model, 2022.
|
| 266 |
+
Kurt Bollacker, Robert Cook, and Patrick Tufts. Freebase: A shared database of structured general human knowledge. In AAAI, volume 7, pp. 1962–1963, 2007.
|
| 267 |
+
Antoine Bosselut, Hannah Rashkin, Maarten Sap, Chaitanya Malaviya, Asli Celikyilmaz, and Yejin Choi. Comet: Commonsense transformers for automatic knowledge graph construction. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 4762–4779, 2019.
|
| 268 |
+
|
| 269 |
+
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 (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 1877–1901, 2020.
|
| 270 |
+
|
| 271 |
+
Andrew Carlson, Justin Betteridge, Bryan Kisiel, Burr Settles, Estevam R Hruschka, and Tom M Mitchell. Toward an architecture for never-ending language learning. In Twenty-Fourth AAAI conference on artificial intelligence, 2010.
|
| 272 |
+
|
| 273 |
+
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.
|
| 274 |
+
|
| 275 |
+
Damai Dai, Li Dong, Yaru Hao, Zhifang Sui, Baobao Chang, and Furu Wei. Knowledge neurons in pretrained transformers. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 8493–8502, 2022.
|
| 276 |
+
|
| 277 |
+
Guy Dar, Mor Geva, Ankit Gupta, and Jonathan Berant. Analyzing transformers in embedding space. arXiv preprint arXiv:2209.02535, 2022.
|
| 278 |
+
|
| 279 |
+
Randall Davis, Howard Shrobe, and Peter Szolovits. What is a knowledge representation? AI magazine, 14(1):17–17, 1993.
|
| 280 |
+
|
| 281 |
+
Nicola De Cao, Wilker Aziz, and Ivan Titov. Editing factual knowledge in language models. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pp. 6491–6506, Online and Punta Cana, Dominican Republic, November 2021. Association for Computational Linguistics.
|
| 282 |
+
|
| 283 |
+
Xin Dong, Evgeniy Gabrilovich, Geremy Heitz, Wilko Horn, Ni Lao, Kevin Murphy, Thomas Strohmann, Shaohua Sun, and Wei Zhang. Knowledge vault: A web-scale approach to probabilistic knowledge fusion. In Proceedings of the 20th ACM SIGKDD international conference on Knowledge discovery and data mining, pp. 601–610, 2014.
|
| 284 |
+
|
| 285 |
+
Yanai Elazar, Nora Kassner, Shauli Ravfogel, Abhilasha Ravichander, Eduard Hovy, Hinrich Schütze, and Yoav Goldberg. Measuring and improving consistency in pretrained language models. Transactions of the Association for Computational Linguistics, 9:1012–1031, 2021.
|
| 286 |
+
|
| 287 |
+
Nelson Elhage, Neel Nanda, Catherine Olsson, Tom Henighan, Nicholas Joseph, Ben Mann, Amanda Askell, Yuntao Bai, Anna Chen, Tom Conerly, Nova DasSarma, Dawn Drain, Deep Ganguli, Zac Hatfield-Dodds, Danny Hernandez, Andy Jones, Jackson Kernion, Liane Lovitt, Kamal Ndousse, Dario Amodei, Tom Brown, Jack Clark, Jared Kaplan, Sam McCandlish, and Chris Olah. A mathematical framework for transformer circuits. Transformer Circuits Thread, 2021. https://transformer-circuits.pub/2021/framework/index.html.
|
| 288 |
+
|
| 289 |
+
Mor Geva, Roei Schuster, Jonathan Berant, and Omer Levy. Transformer feed-forward layers are key-value memories. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pp. 5484–5495, 2021.
|
| 290 |
+
|
| 291 |
+
Mor Geva, Avi Caciularu, Kevin Ro Wang, and Yoav Goldberg. Transformer feed-forward layers build predictions by promoting concepts in the vocabulary space. arXiv preprint arXiv:2203.14680, 2022.
|
| 292 |
+
|
| 293 |
+
Peter Hase, Mona Diab, Asli Celikyilmaz, Xian Li, Zornitsa Kozareva, Veselin Stoyanov, Mohit Bansal, and Srinivasan Iyer. Do language models have beliefs? methods for detecting, updating, and visualizing model beliefs. arXiv preprint arXiv:2111.13654, 2021.
|
| 294 |
+
|
| 295 |
+
Catherine Havasi, Robert Speer, and Jason Alonso. Conceptnet: A lexical resource for common sense knowledge. Recent advances in natural language processing V: selected papers from RANLP, 309: 269, 2007.
|
| 296 |
+
|
| 297 |
+
Zhengbao Jiang, Frank F Xu, Jun Araki, and Graham Neubig. How can we know what language models know? Transactions of the Association for Computational Linguistics, 8:423–438, 2020.
|
| 298 |
+
|
| 299 |
+
Teuvo Kohonen. Correlation matrix memories. IEEE transactions on computers, 100(4):353–359, 1972.
|
| 300 |
+
|
| 301 |
+
Angeliki Lazaridou, Adhi Kuncoro, Elena Gribovskaya, Devang Agrawal, Adam Liska, Tayfun Terzi, Mai Gimenez, Cyprien de Masson d’Autume, Tomas Kocisky, Sebastian Ruder, et al. Mind the gap: Assessing temporal generalization in neural language models. Advances in Neural Information Processing Systems, 34:29348–29363, 2021.
|
| 302 |
+
|
| 303 |
+
Douglas B Lenat. Cyc: A large-scale investment in knowledge infrastructure. Communications of the ACM, 38(11):33–38, 1995.
|
| 304 |
+
|
| 305 |
+
Omer Levy, Minjoon Seo, Eunsol Choi, and Luke Zettlemoyer. Zero-shot relation extraction via reading comprehension. In Proceedings of the 21st Conference on Computational Natural Language Learning (CoNLL 2017), pp. 333–342, 2017.
|
| 306 |
+
|
| 307 |
+
Adam Liska, Tomas Kocisky, Elena Gribovskaya, Tayfun Terzi, Eren Sezener, Devang Agrawal, D’Autume Cyprien De Masson, Tim Scholtes, Manzil Zaheer, Susannah Young, et al. StreamingQA: A benchmark for adaptation to new knowledge over time in question answering models. In International Conference on Machine Learning, pp. 13604–13622. PMLR, 2022.
|
| 308 |
+
|
| 309 |
+
Kevin Meng, David Bau, Alex Andonian, and Yonatan Belinkov. Locating and editing factual associations in GPT. Advances in Neural Information Processing Systems, 35, 2022.
|
| 310 |
+
|
| 311 |
+
George A Miller. Wordnet: a lexical database for english. Communications of the ACM, 38(11): 39–41, 1995.
|
| 312 |
+
|
| 313 |
+
Marvin Minsky. A framework for representing knowledge, 1974.
|
| 314 |
+
|
| 315 |
+
Eric Mitchell, Charles Lin, Antoine Bosselut, Chelsea Finn, and Christopher D. Manning. Fast model editing at scale, 2021.
|
| 316 |
+
|
| 317 |
+
Eric Mitchell, Charles Lin, Antoine Bosselut, Chelsea Finn, and Christopher D. Manning. Memorybased model editing at scale. In International Conference on Machine Learning, 2022.
|
| 318 |
+
|
| 319 |
+
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.
|
| 320 |
+
|
| 321 |
+
David Patterson, Joseph Gonzalez, Quoc Le, Chen Liang, Lluis-Miquel Munguia, Daniel Rothchild, David So, Maud Texier, and Jeff Dean. Carbon emissions and large neural network training. arXiv preprint arXiv:2104.10350, 2021.
|
| 322 |
+
|
| 323 |
+
Judea Pearl. Direct and indirect effects. In Proceedings of the Seventeenth conference on Uncertainty in artificial intelligence, pp. 411–420, 2001.
|
| 324 |
+
|
| 325 |
+
Fabio Petroni, Tim Rocktäschel, Sebastian Riedel, Patrick Lewis, Anton Bakhtin, Yuxiang Wu, and Alexander Miller. Language models as knowledge bases? In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 2463–2473, 2019.
|
| 326 |
+
|
| 327 |
+
Fabio Petroni, Patrick Lewis, Aleksandra Piktus, Tim Rocktäschel, Yuxiang Wu, Alexander H Miller, and Sebastian Riedel. How context affects language models’ factual predictions. In Automated Knowledge Base Construction, 2020.
|
| 328 |
+
|
| 329 |
+
Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. Language models are unsupervised multitask learners. OpenAI blog, pp. 9, 2019.
|
| 330 |
+
|
| 331 |
+
Richard H Richens. Preprogramming for mechanical translation. Mechanical Translation, 3(1): 20–25, 1956.
|
| 332 |
+
|
| 333 |
+
Adam Roberts, Colin Raffel, and Noam Shazeer. How much knowledge can you pack into the parameters of a language model? In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 5418–5426, 2020.
|
| 334 |
+
|
| 335 |
+
Tara Safavi and Danai Koutra. Relational world knowledge representation in contextual language models: A review. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pp. 1053–1067, 2021.
|
| 336 |
+
|
| 337 |
+
Taylor Shin, Yasaman Razeghi, Robert L Logan IV, Eric Wallace, and Sameer Singh. Autoprompt: Eliciting knowledge from language models with automatically generated prompts. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 4222–4235, 2020.
|
| 338 |
+
|
| 339 |
+
Anton Sinitsin, Vsevolod Plokhotnyuk, Dmitry Pyrkin, Sergei Popov, and Artem Babenko. Editable neural networks. In International Conference on Learning Representations, 2019.
|
| 340 |
+
|
| 341 |
+
Gilbert Strang. Introduction to linear algebra. Wellesley-Cambridge Press Wellesley, MA, 1993.
|
| 342 |
+
|
| 343 |
+
Fabian M Suchanek, Gjergji Kasneci, and Gerhard Weikum. Yago: a core of semantic knowledge. In Proceedings of the 16th international conference on World Wide Web, pp. 697–706, 2007.
|
| 344 |
+
|
| 345 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pp. 5998–6008, 2017.
|
| 346 |
+
|
| 347 |
+
Jesse Vig, Sebastian Gehrmann, Yonatan Belinkov, Sharon Qian, Daniel Nevo, Yaron Singer, and Stuart M Shieber. Investigating gender bias in language models using causal mediation analysis. In NeurIPS, 2020.
|
| 348 |
+
|
| 349 |
+
Denny Vrandeciˇ c and Markus Krötzsch. Wikidata: a free collaborative knowledgebase. ´ Communications of the ACM, 57(10):78–85, 2014.
|
| 350 |
+
|
| 351 |
+
Ben Wang and Aran Komatsuzaki. GPT-J-6B: A 6 Billion Parameter Autoregressive Language Model. https://github.com/kingoflolz/mesh-transformer-jax, May 2021.
|
| 352 |
+
|
| 353 |
+
Gerhard Weikum. Knowledge graphs 2021: a data odyssey. Proceedings of the VLDB Endowment, 14(12):3233–3238, 2021.
|
| 354 |
+
|
| 355 |
+
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 preprint arXiv:1910.03771, 2019.
|
| 356 |
+
|
| 357 |
+
Yunzhi Yao, Shaohan Huang, Li Dong, Furu Wei, Huajun Chen, and Ningyu Zhang. Kformer: Knowledge injection in transformer feed-forward layers. In CCF International Conference on Natural Language Processing and Chinese Computing, pp. 131–143. Springer, 2022.
|
| 358 |
+
|
| 359 |
+
Chen Zhu, Ankit Singh Rawat, Manzil Zaheer, Srinadh Bhojanapalli, Daliang Li, Felix Yu, and Sanjiv Kumar. Modifying memories in transformer models, 2020.
|
| 360 |
+
|
| 361 |
+

|
| 362 |
+
|
| 363 |
+

|
| 364 |
+
Figure 8: Causal Tracing (using the method of Meng et al. 2022). Each grid cell’s intensity reflects the average causal indirect effect of a hidden state on the expression of a factual association, with strong causal mediators highlighted with darker colors. We find that MLPs at the last subject token and attention modules at the last token are important. The presence of influential attention activations at the earliest layers of the last subject token is investigated with additional path dependent experiments (Figure 3).
|
| 365 |
+
|
| 366 |
+

|
| 367 |
+
|
| 368 |
+
MEMIT begins by identifying MLP layers that are causal mediators for recall of factual associations in the model. To do so in GPT-J, we use code provided by Meng et al. (2022): beginning with a sample of 501 true statements of facts that are correctly predicted by GPT-J, we measure baseline predicted probabilities of each true fact when noise is introduced into encoding of the subject tokens to degrade the accuracy of the model. Then in Figure 8 (a) for each individual $h _ { t } ^ { l }$ , we restore the state to the value that it would have had without injected noise, and we plot the average improvement of predicted probability. As in Meng et al. (2022), we use Gaussian noise with standard deviation $3 \sigma$ ( $\cdot \sigma ^ { 2 }$ is the empirically observed variance of embedding activations) and plot averages for all 501 statements over 10 noise samples. For (b) and (c) we use the same procedure, except we restore runs of 10 layers of MLP outputs $\hat { m } _ { t } ^ { l }$ and 10 layers of Attn $a _ { t } ^ { l }$ , instead of full hidden states.
|
| 369 |
+
|
| 370 |
+
These measurements confirm that GPT-J has a causal structure that is similar to the structure reported by Meng et al. (2022) in their study of GPT2-XL. Unlike with GPT-XL, a strong causal effect is observed in the earliest layers of Attention at the last subject token, which likely reflects a concentrated attention computation when GPT-J is recognizing and chunking the n-gram subject name, but the path-dependent experiment (Figure 3) suggests that Attention is not an important mediator of factual recall of memories about the subject.
|
| 371 |
+
|
| 372 |
+
In the main paper, Figure 3 plots the same data as Figure 8 (a) as a bar graph, focused on only the last subject token, and it adds two additional measurements. In red bars, it repeats the measurement of causal effects of states with Attention modules at the last subject token frozen in the corrupted state, so that cannot be influenced by the state being probed, and in green bars it repeats the experiment with the MLP modules at the last subject token similarly frozen, so they cannot be influenced by the causal probe. Severing the Attention modules does not shift the curve, which suggests that Attention computations do not play a decisive mediating role in knowledge recall at the last subject token. In contrast, severing the MLP modules reveals a large gap, which suggests that, at layers where the gap is largest, the role of the MLP computation is important. We select the layers where the gap is largest as the range $\mathcal { R }$ to use for the intervention done by MEMIT.
|
| 373 |
+
|
| 374 |
+
# B IMPLEMENTATION DETAILS
|
| 375 |
+
|
| 376 |
+
# B.1 FINE-TUNING WITH WEIGHT DECAY
|
| 377 |
+
|
| 378 |
+
Our fine-tuning baseline updates layer 21 of GPT-J, which Meng et al. (2022) found to provide the best performance in the single-edit case. Rather than using a hard $L _ { \infty }$ -norm constraint, we use a soft weight decay regularizer. However, the optimal amount of regularization depends strongly on the number of edits (more edits require higher-norm edits), so we tune this hyperparameter for the $n = 1 0 { , } 0 0 0$ case. Figure 9 shows that $5 \times 1 0 ^ { - 4 }$ selects for the optimal tradeoff between generalization and specificity. FT-W optimization proceeds for a maximum of 25 steps with a learning rate of $5 \times 1 0 ^ { - 4 }$ . To prevent overfitting, early stopping is performed when the loss reaches $1 0 ^ { - 2 }$ . Regarding runtime, FT takes $1 , 7 1 6 . 2 1 \sec \approx 0 . 4 8 \mathrm { h r }$ to execute 10,000 edits on GPT-J.
|
| 379 |
+
|
| 380 |
+

|
| 381 |
+
Figure 9: Optimizing fine-tuning weight decay on 10,000 edits. We find an evident tradeoff between generalization and specificity, opting for the value with the highest Score.
|
| 382 |
+
|
| 383 |
+
Note that we choose not to complicate the analysis by tuning FT-W on more than one layer. Table 2 demonstrates that FT-W, with just one layer, already gets near-perfect efficacy at the cost of low specificity, which indicates sufficient edit capacity.
|
| 384 |
+
|
| 385 |
+
# B.2 MODEL EDITING NETWORKS WITH GRADIENT DECOMPOSITION (MEND)
|
| 386 |
+
|
| 387 |
+
MEND makes concurrent edits by accumulating gradients from all edit examples, then passing them through the hypernetwork together. We use the GPT-J MEND hypernetwork trained by Meng et al. (2022). During inference, learning rate scale is set to the default value of 1.0. MEND is by far the fastest method, taking 98.25 seconds to execute 10,000 updates on GPT-J.
|
| 388 |
+
|
| 389 |
+
# B.3 RANK-ONE MODEL EDITING (ROME)
|
| 390 |
+
|
| 391 |
+
The default ROME hyperparameters are available in their open source code: GPT-J updates are executed at layer 5, where optimization proceeds for 20 steps with a weight decay of 0.5, KL factor of 0.0625, and learning rate of $5 \times 1 0 ^ { - \bar { 1 } }$ . ROME uses prefix sampling, resulting in 10 prefixes of length 5 and 10 prefixes of length 10. Covariance statistics are collected in fp32 on Wikitext using a sample size of 100,000. See Meng et al. (2022) for more details.
|
| 392 |
+
|
| 393 |
+
ROME takes $4 4 , 2 4 8 . 2 6 \sec \approx 1 2 . 2 9 \mathrm { h r }$ for 10,000 edits on GPT-J, which works out to approximately 4 seconds per edit.
|
| 394 |
+
|
| 395 |
+
# B.4 MASS-EDITING MEMORY IN A TRANSFORMER (MEMIT)
|
| 396 |
+
|
| 397 |
+
On GPT-J, we choose $\mathcal { R } = \{ 3 , 4 , 5 , 6 , 7 , 8 \}$ and set $\lambda$ , the covariance adjustment factor, to 15,000. Similar to ROME, covariance statistics are collected using 100,000 samples of Wikitext in fp32. $\delta _ { i }$ optimization proceeds for 25 steps with a learning rate of $5 \times 1 0 ^ { - 1 }$ . In practice, we clamp the $L _ { 2 }$ norm of $\delta _ { i }$ such that it is less than $\frac 3 4$ of the original hidden state norm, $\lceil \rceil h _ { i } ^ { L } \rceil |$ . On GPT-NeoX, we select $\mathcal { R } = \{ 6 , 7 , 8 , 9 , 1 0 \}$ and set $\lambda ^ { ' } = 2 0 { , } 0 0 0$ . Covariance statistics are collected over 50,000 samples of Wikitext in $\tt f p 1 6$ but stored in $\tt f p 3 2$ . Optimization for $\delta _ { i }$ proceeds for 20 steps using a learning rate of $5 \times 1 0 ^ { - 1 }$ while clamping $\| h _ { i } ^ { L } \|$ to $\frac { 3 } { 1 0 } \Vert h _ { i } ^ { L } \Vert$ .
|
| 398 |
+
|
| 399 |
+
In MEMIT, we have the luxury of being able to pre-compute and cache $z _ { i }$ values, since they are inserted in parallel. If all such vectors are already computed, MEMIT takes $3 , 2 2 6 . 3 5 \sec \approx 0 . 9 0 \mathrm { h r }$ for 10,000 updates on GPT-J, where the most computationally expensive step is inverting a large square matrix (Eqn. 14). Computing each $z _ { i }$ vector is slightly less expensive than computing a ROME update; to get all $1 0 { , } 0 0 0 \ z _ { i }$ vectors, we need $2 3 , 5 4 6 . 6 5 \sec \approx 6 . 5 4 \mathrm { h r }$ . This optimization is currently done in series, but it is actually “embarrassingly parallel,” as we can greatly reduce computation time by batching the gradient descent steps. Note that this speed-up does not apply to ROME, since each update must be done iteratively.
|
| 400 |
+
|
| 401 |
+
# C EVALUATION METRICS
|
| 402 |
+
|
| 403 |
+
# C.1 FOR ZSRE
|
| 404 |
+
|
| 405 |
+
For consistency with previous works that use the zsRE task (Mitchell et al., 2021; Meng et al., 2022), we report the same three probability tests:
|
| 406 |
+
|
| 407 |
+
• Efficacy is the proportion of edits that $G$ recalls with top-1 accuracy. Note that the prompt matches exactly what the edit method sees at runtime:
|
| 408 |
+
|
| 409 |
+
$$
|
| 410 |
+
\mathbb { E } _ { i } \left[ o _ { i } = \underset { x _ { E } } { \mathrm { a r g m a x } } \mathbb { P } _ { G } \left[ x _ { E } \mid p ( s _ { i } , r _ { i } ) \right] \right] .
|
| 411 |
+
$$
|
| 412 |
+
|
| 413 |
+
• Paraphrase is the accuracy on rephrasings of the original statement:
|
| 414 |
+
|
| 415 |
+
$$
|
| 416 |
+
\mathbb { E } _ { i } \left[ \mathbb { E } _ { p \in \mathrm { p a r a p h r a s e s } ( s _ { i } , r _ { i } ) } \left[ o _ { i } = \underset { x _ { E } } { \mathrm { a r g m a x } } \mathbb { P } _ { G } \left[ x _ { E } \mid p \right] \right] \right] .
|
| 417 |
+
$$
|
| 418 |
+
|
| 419 |
+
• Specificity is the proportion of neighborhood prompts that the model gets correct. In COUNTERFACT, all such prompts have the same correct answer $o _ { i } ^ { c }$ :
|
| 420 |
+
|
| 421 |
+
$$
|
| 422 |
+
\mathbb { E } _ { i } \left[ \mathbb { E } _ { p \in { \mathrm { n e i g h b o r h o o d p r o m p t s } } ( s _ { i } , r _ { i } ) } \left[ o _ { i } ^ { c } = \underset { x _ { E } } { \mathrm { a r g m a x } } \mathbb { P } _ { G } \left[ x _ { E } \mid p \right] \right] \right] .
|
| 423 |
+
$$
|
| 424 |
+
|
| 425 |
+
We also report an aggregated Score: the harmonic mean of Efficacy, Paraphrase, and Specificity.
|
| 426 |
+
|
| 427 |
+
# C.2 FOR COUNTERFACT
|
| 428 |
+
|
| 429 |
+
COUNTERFACT contains an assortment of prompts and texts for evaluating model rewrites (Figure 14). This section provides formal definitions for each COUNTERFACT metric. First, the probability tests:
|
| 430 |
+
|
| 431 |
+
• Efficacy Success (ES) is the proportion of cases where $o _ { i }$ exceeds $o _ { i } ^ { c }$ in probability. Note that the prompt matches exactly what the edit method sees at runtime:
|
| 432 |
+
|
| 433 |
+
$$
|
| 434 |
+
\mathbb { E } _ { i } \left[ \mathbb { P } _ { G } \left[ o _ { i } \ | \ p ( s _ { i } , r _ { i } ) \right] > \mathbb { P } _ { G } \left[ o _ { i } ^ { c } \ | \ p ( s _ { i } , r _ { i } ) \right] \right] .
|
| 435 |
+
$$
|
| 436 |
+
|
| 437 |
+
• Paraphrase Success $\mathbf { ( P S ) }$ is the proportion of cases where $o _ { i }$ exceeds $o _ { i } ^ { c }$ in probability on rephrasings of the original statement:
|
| 438 |
+
|
| 439 |
+
$$
|
| 440 |
+
\mathbb { E } _ { i } \left[ \mathbb { E } _ { p \in \mathrm { p a r a p h r a s e s } ( s _ { i } , r _ { i } ) } \left[ \mathbb { P } _ { G } \left[ o _ { i } \mid p \right] > \mathbb { P } _ { G } \left[ o _ { i } ^ { c } \mid p \right] \right] \right] .
|
| 441 |
+
$$
|
| 442 |
+
|
| 443 |
+
• Neighborhood Success (NS) is the proportion of neighborhood prompts where the models assigns higher probability to the correct fact:
|
| 444 |
+
|
| 445 |
+
$$
|
| 446 |
+
\begin{array} { r } { \mathbb { E } _ { i } \left[ \mathbb { E } _ { p \in \mathrm { n e i g h b o r h o o d p r o m p t s } ( s _ { i } , r _ { i } ) } \left[ \mathbb { P } _ { G } \left[ o _ { i } \mid p \right] < \mathbb { P } _ { G } \left[ o _ { i } ^ { c } \mid p \right] \right] \right] . } \end{array}
|
| 447 |
+
$$
|
| 448 |
+
|
| 449 |
+
• Editing Score (S), is the harmonic mean of ES, PS, and NS.
|
| 450 |
+
|
| 451 |
+
Now, the generation tests:
|
| 452 |
+
|
| 453 |
+
• Reference Score (RS) measures the consistency of $G$ ’s free-form generations. To compute it, we first prompt $G$ with the subject $s$ , then compute TF-IDF vectors for both $G ( s )$ and a reference Wikipedia text about $o$ ; RS is defined as their cosine similarity. Intuitively, $G ( s )$ will match better with $o$ ’s reference text if it has more consistent phrasing and vocabulary.
|
| 454 |
+
|
| 455 |
+
• We also check for excessive repetition (a common failure case with model editing) using Generation Entropy (GE), which relies on the entropy of $n$ -gram distributions:
|
| 456 |
+
|
| 457 |
+
$$
|
| 458 |
+
- \left( { \frac { 2 } { 3 } } \sum _ { k } f _ { 2 } ( k ) \log _ { 2 } f _ { 2 } ( k ) + { \frac { 4 } { 3 } } \sum _ { k } f _ { 3 } ( k ) \log _ { 2 } f _ { 3 } ( k ) \right) .
|
| 459 |
+
$$
|
| 460 |
+
|
| 461 |
+
Here, $f _ { n } ( \cdot )$ is the $n$ -gram frequency distribution.
|
| 462 |
+
|
| 463 |
+
# D EDITING DIFFERENT CATEGORIES OF FACTS TOGETHER
|
| 464 |
+
|
| 465 |
+
For an edit $( s , r , o )$ , $r$ associates a subject $s$ and object $o$ . Both $s$ and $o$ have their associated types $\tau ( s )$ and $\tau ( o )$ . For example, $r =$ “is a citizen of” is an association between a Person and Country. We say that $\tau ( s _ { 1 } )$ and $s _ { 2 }$ are diverse if $\tau ( s _ { 1 } ) \neq ( \tau ( s _ { 2 } ) )$ , and similar otherwise. The definition follows similarly for objects. For any relation pair $( r _ { 1 } , r _ { 2 } )$ , we sample from COUNTERFACT a set of edits $\mathcal { E } _ { m i x } = \{ ( s , r , o ) ~ | ~ r \in \{ r _ { 1 } , r _ { 2 } \} \}$ , such that numbers of edits for each relation are equal. We compare MEMIT’s performance on the set of edits ${ \mathcal { E } } _ { m i x }$ in four pairs of relations that have different levels of diversity between them. Each relation is followed by its corresponding relation_id in WikiData:
|
| 466 |
+
|
| 467 |
+
(a) Subject different $( \tau ( s _ { 1 } ) \neq \tau ( s _ { 2 } ) )$ , Object different $( \tau ( o _ { 1 } ) \neq \tau ( o _ { 2 } ) )$ :
|
| 468 |
+
|
| 469 |
+
$$
|
| 470 |
+
( \tau ( s _ { 1 } ) = \mathtt { P e r s o n } , r _ { 1 } = \mathrm { c i t i z e n o f } ( \mathbf { P 2 7 } ) , \tau ( o _ { 1 } ) = \mathtt { C o u n t r y } ) ,
|
| 471 |
+
$$
|
| 472 |
+
|
| 473 |
+
$$
|
| 474 |
+
( \tau ( s _ { 2 } ) = \mathrm { { c o u n t r y } } , r _ { 2 } = \mathrm { { o f f i c i a l l a n g u a g e } } \left( \mathbf P 3 7 \right) , \tau ( o _ { 2 } ) = \mathrm { { L a n g u a g e } } )
|
| 475 |
+
$$
|
| 476 |
+
|
| 477 |
+
(b) Subject similar $( \tau ( s _ { 1 } ) = \tau ( s _ { 2 } ) )$ ), Object different $( \tau ( o _ { 1 } ) \neq \tau ( o _ { 2 } ) )$ ):
|
| 478 |
+
|
| 479 |
+
(τ (s1) = Person, $r _ { 1 } =$ plays position in sport (P413), $\tau ( o _ { 1 } ) = { \tt S p o r } ^ { \sf { 1 } }$ t position),
|
| 480 |
+
|
| 481 |
+
$$
|
| 482 |
+
\begin{array} { r } { \textrm { \tiny ( \tau ( s _ { 2 } ) = P e r s o n , } r _ { 2 } = \mathrm { n a t i v e \ l a n g u a g e \left( P 1 4 1 2 \right) , } \tau ( o _ { 2 } ) = \mathrm { L a n g u a g e } ) } \end{array}
|
| 483 |
+
$$
|
| 484 |
+
|
| 485 |
+
(c) Subject different $( \tau ( s _ { 1 } ) \neq \tau ( s _ { 2 } ) )$ , Object similar $\dot { \varrho } _ { 1 } = \tau ( o _ { 2 } ) \mathrm { , }$
|
| 486 |
+
|
| 487 |
+
$$
|
| 488 |
+
\begin{array} { r } { \big ( \tau ( s _ { 1 } ) = \mathtt { P l a c e } , r _ { 1 } = \mathrm { l o c a t e d i n } ( \mathbf { P 1 7 } ) , \tau \big ( o _ { 1 } \big ) = \mathtt { C o u n t r y } \big ) , } \end{array}
|
| 489 |
+
$$
|
| 490 |
+
|
| 491 |
+
$$
|
| 492 |
+
( \tau ( s _ { 2 } ) = \mathrm { I t } \tan / \mathrm { P r o d u c t } , r _ { 2 } = \mathrm { c o u n t r y ~ o f ~ o r i g i n } ( \mathbf { P 4 9 5 } ) , \tau ( o _ { 2 } ) = \mathrm { C o u n t r y } )
|
| 493 |
+
$$
|
| 494 |
+
|
| 495 |
+
(d) Subject similar $( \tau ( s _ { 1 } ) = \tau ( s _ { 2 } ) )$ ), Object similar $( \tau ( o _ { 1 } ) = \tau ( o _ { 2 } ) $ ):
|
| 496 |
+
|
| 497 |
+
$$
|
| 498 |
+
\begin{array} { r l } { \left( \tau ( s _ { 1 } ) = \mathtt { P e r s o n } , r _ { 1 } = \mathrm { c i t i z e n ~ o f ~ } ( \mathbf { P 2 7 } ) , \tau \big ( o _ { 1 } \right) = } & { { } } \end{array}
|
| 499 |
+
$$
|
| 500 |
+
|
| 501 |
+
$$
|
| 502 |
+
\left( \tau ( s _ { 2 } ) = \mathtt { P e r s o n } , r _ { 2 } = \mathrm { w o r k s ~ i n ~ } ( \mathbf { P 9 3 7 } ) , \tau ( o _ { 2 } ) = \mathtt { C i t y } / \mathtt { C o u n t r y } \right)
|
| 503 |
+
$$
|
| 504 |
+
|
| 505 |
+
Figure D depicts MEMIT rewrite performance in these four scenarios. We find that the effectiveness of ${ \mathcal { E } } _ { m i x }$ closely follows the average of the individual splits. Therefore, the presence of diversity in the edits (or lack thereof) does not tangibly influence MEMIT’s performance.
|
| 506 |
+
|
| 507 |
+
# E DEMONSTRATIONS
|
| 508 |
+
|
| 509 |
+
This section provides two case studies, in which we apply MEMIT to mass-edit new or corrected memories into GPT-J (6B).
|
| 510 |
+
|
| 511 |
+
Knowledge freshness. On November 8th, 2022, the United States held elections for 435 congressional seats, 36 governor seats, and 35 senator seats, several of which changed hands. We applied MEMIT to incorporate the election results into GPT-J in the form of (congressperson, elected from, district) and (governor/senator, elected from, state). 4 The MEMIT edit attained $100 \%$ efficacy (ES) and $94 \%$ generalization (PS).
|
| 512 |
+
|
| 513 |
+
Application in a specialized knowldge domain. For a second application, we used MEMIT to create a model with specialized knowledge of amateur astronomy. We scraped the names of stars that were referenced more than 100 times from WikiData and belong to one of the 18 constellations named below.
|
| 514 |
+
|
| 515 |
+
Andromeda, Aquarius, Cancer, Cassiopeia, Gemini, Hercules, Hydra, Indus, Leo, Libra, Orion, Pegasus, Perseus, Pisces, Sagittarius, Ursa Major, Ursa Minor, Virgo
|
| 516 |
+
|
| 517 |
+
We obtained 289 tuples of the form (star, belongs to, constellation). The accuracy of the unmodified GPT-J in recalling constellation of a star was only $53 \%$ . Post-MEMIT, accuracy increased to $86 \%$ .
|
| 518 |
+
|
| 519 |
+

|
| 520 |
+
Figure 10: MEMIT’s performance while editing memories with four levels of diversity. Each data point is a mean of 10 experiments. Filled areas show $90 \%$ confidence intervals of the values from those experiments.
|
| 521 |
+
|
| 522 |
+
# F ABLATIONS
|
| 523 |
+
|
| 524 |
+
MEMIT contains several critical design choices: it uses a (i) range of critical mid-layer (ii) MLP modules at the (iii) last subject token, with the (iv) hyperparameter $\lambda$ (Eqn. 15) to control the impact of the update. Choice (iii) was already demonstrated by Meng et al. (2022) to be significant through an ablation study, but we now investigate the other three.
|
| 525 |
+
|
| 526 |
+
# F.1 VARYING THE NUMBER AND LOCATION OF EDITED LAYERS
|
| 527 |
+
|
| 528 |
+
We test five total configurations of $\mathcal { R }$ , the set of critical MLP layers to be targeted during editing. Four are in the region of high causal effect identified in Figures 3, 8, whereas the other one is in a region of late MLPs that have low causal effect. As Figure 11 shows, using more layers yields higher efficacy and generalization while also improving specificity. Moreover, edits at the late-layer MLPs are considerably worse. These results confirm the importance of the causal analysis to MEMIT’s performance.
|
| 529 |
+
|
| 530 |
+

|
| 531 |
+
Figure 11: Varying the edited MLP layers
|
| 532 |
+
|
| 533 |
+
# F.2 VARYING THE TARGETED MODULE: EDITING ATTENTION
|
| 534 |
+
|
| 535 |
+
Next, we check whether edits at either early or late-layer attention modules perform comparably to their MLP counterparts. As Figure 12 shows, attention edits perform considerably worse.
|
| 536 |
+
|
| 537 |
+
# F.3 VARYING THE COVARIANCE HYPERPARAMETER $\lambda$
|
| 538 |
+
|
| 539 |
+
Finally, we investigate the impact of the covariance adjustment factor (denoted $\lambda$ in Eqn. 15) on performance; Figure 13 displays the results. Specificity and fluency increase monotonically with $\lambda$ , indicating that higher $\lambda$ values preserve original model behavior. However, at the same time, efficacy and generalization fall when $\lambda$ is increased. We can see that around $\approx 1 0 ^ { 4 }$ , the aggregated score reaches a maximum.
|
| 540 |
+
|
| 541 |
+

|
| 542 |
+
Figure 12: Varying the edited attention layers
|
| 543 |
+
|
| 544 |
+

|
| 545 |
+
Figure 13: Varying the covariance adjustment factor $\lambda$
|
| 546 |
+
|
| 547 |
+
"case_id":15,
|
| 548 |
+
"pararel_idx":8062,
|
| 549 |
+
"requested_rewrite":{ "prompt":"{}, the", "relation_id":"P413", "target_new":{ "str":"goaltender", "id":"Q1317534" }, "target_true":{ "str":"linebacker", "id":"Q528145" }, "subject":"Percy Snow"
|
| 550 |
+
},
|
| 551 |
+
"paraphrase_prompts":[ "Victoriano Salado Alvarez (1867–1931). Which position does Percy Snow play? They play as", "It is found in the Indomalayan realm. Percy Snow plays in the position of"
|
| 552 |
+
],
|
| 553 |
+
"neighborhood_prompts":[ "Michael Morgan plays in the position of", "Which position does Nathan Stupar play? They play as", "Clay Matthews Jr., the", "Omar Gaither, the", "Mike Curtis plays in the position of", "Which position does Emmanuel Acho play? They play as", "Clay Matthews Jr. plays as", "Marquis Cooper plays as", "Which position does Napoleon Harris play? They play as", "Brendon Ayanbadejo, the"
|
| 554 |
+
],
|
| 555 |
+
"generation_prompts":[ "Percy Snow is incredible at", "The expertise of Percy Snow becomes important when", "The expertise of Percy Snow becomes important when", "The expertise of Percy Snow becomes important when", "The expertise of Percy Snow becomes important when", "The expertise of Percy Snow becomes important when", "Percy Snow is incredible at", "The expertise of Percy Snow becomes important when", "The expertise of Percy Snow becomes important when", "Percy Snow is incredible at"
|
md/dev/Mng8CQ9eBW/Mng8CQ9eBW.md
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# BA DPR E: TASK-AGNOSTIC BACKDOOR ATTACKS TO PRE-TRAINED NLP FOUNDATION MODELS
|
| 2 |
+
|
| 3 |
+
Kangjie Chen1, Yuxian Meng2, Xiaofei $\mathbf { S u n ^ { 2 } }$ , Shangwei $\mathbf { G u o ^ { 3 } }$ , Tianwei Zhang1, Jiwei $\mathbf { L i } ^ { 2 , 4 }$ , and Chun Fan5,∗
|
| 4 |
+
|
| 5 |
+
1Nanyang Technological University, 2Shannon.AI, 3Chongqing University, 4Zhejiang University, 5Computer Center of Peking University & Peng Cheng Laboratory
|
| 6 |
+
kangjie001 $@$ e.ntu.edu.sg,{yuxian meng,xiaofei sun,jiwei li}@shannonai.com,swguo $@$ cqu.edu.cn tianwei.zhang $@$ ntu.edu.sg, fanchun@pku.edu.cn
|
| 7 |
+
|
| 8 |
+
# ABSTRACT
|
| 9 |
+
|
| 10 |
+
Pre-trained Natural Language Processing (NLP) models can be easily adapted to a variety of downstream language tasks. This significantly accelerates the development of language models. However, NLP models have been shown to be vulnerable to backdoor attacks, where a pre-defined trigger word in the input text causes model misprediction. Previous NLP backdoor attacks mainly focus on some specific tasks. This makes those attacks less general and applicable to other kinds of NLP models and tasks. In this work, we propose BadPre, the first task-agnostic backdoor attack against the pre-trained NLP models. The key feature of our attack is that the adversary does not need prior information about the downstream tasks when implanting the backdoor to the pre-trained model. When this malicious model is released, any downstream models transferred from it will also inherit the backdoor, even after the extensive transfer learning process. We further design a simple yet effective strategy to bypass a state-of-the-art defense. Experimental results indicate that our approach can compromise a wide range of downstream NLP tasks in an effective and stealthy way.
|
| 11 |
+
|
| 12 |
+
# 1 INTRODUCTION
|
| 13 |
+
|
| 14 |
+
Natural language processing allows computers to understand and generate sentences and texts in a way as human beings can. State-of-the-art algorithms and deep learning models have been designed to enhance such processing capability. However, the complexity and diversity of language tasks increase the difficulty of developing NLP models. Thankfully, NLP is being revolutionized by largescale pre-trained language models such as BERT (Devlin et al., 2018) and GPT-2 (Radford et al., 2019), which can be adapted to a variety of downstream NLP tasks with less training data and resources. Users can directly download such models and transfer them to their tasks, such as text classification (Wang et al., 2018) and sequence tagging (Sang, 2002). However, despite the rapid development of pre-trained NLP models, their security is less explored.
|
| 15 |
+
|
| 16 |
+
Deep learning models were proven to be vulnerable to backdoor attacks (Gu et al., 2017; Goldblum et al., 2020; Li et al., 2020). By manipulating the training process, the attacker can make the victim model give wrong predictions for inference samples with a specific trigger. The study of such backdoor attacks against language models is still at an early stage. Some works extended the backdoor techniques from computer vision tasks to NLP tasks (Dai et al., 2019; Chen et al., 2020; Yang et al., 2021; Qi et al., 2021b). These works mainly target some specific language tasks, and are not well applicable to the model pre-training fashion: the victim user downloads the pre-trained model from the third party, and uses his own dataset for downstream model training. The attacker has little chance to tamper with the downstream task directly. Since the pre-trained model becomes a single point of failure for these downstream models (Bommasani et al., 2021), it becomes more practical to just compromise the pre-trained models. Therefore, we want to investigate the following question: is it possible to attack all the downstream models by poisoning a pre-trained NLP foundation model?
|
| 17 |
+
|
| 18 |
+
Such backdoor attacks are very practical, and can be applied to any untrusted public model zoo, repositories or commercial model vendor to affect a large amount of users. However, there are several challenges to achieve the attacks. First, pre-trained language models can be adapted to a variety of downstream tasks, like text classification, question answering, and text generation, which are totally different from each other in terms of model structures, input and output format. Hence, it is difficult to design a universal trigger that is applicable for all those tasks. Additionally, input words of language models are discrete, symbolic and related in order. Each simple character may affect the meaning of the text completely. Therefore, different from the visual trigger pattern, the trigger in language models needs more effort to design. Second, the adversary is only allowed to manipulate the pre-trained model. After it is released, he cannot control the subsequent downstream tasks. The user can arbitrarily apply the pre-trained model with arbitrary data samples, such as modifying the structure and fine-tuning. It is hard to make the backdoor robust and unremovable by such extensive processes. Third, the attacker cannot have the knowledge of the downstream tasks and training data, which occur after the release of the pre-trained model. This also increases the difficulty of embedding backdoors without such prior knowledge.
|
| 19 |
+
|
| 20 |
+
To our best knowledge, there is only one work targeting the backdoor attacks to the pre-trained language model (Zhang et al., 2020). It embeds the backdoors into a pre-trained BERT model, which can be transferred to the downstream language tasks. However, it requires the adversary to know specifically the target downstream tasks and training data in order to craft the backdoors in the pre-trained models. Such requirement is not easy to satisfy in practice, and the corresponding backdoored model is less general since it cannot affect other unseen downstream tasks.
|
| 21 |
+
|
| 22 |
+
To overcome those limitations, we propose BadPre, a novel task-agnostic backdoor attack to the language foundation models. Different from (Zhang et al., 2020), BadPre does not need any prior knowledge about the downstream tasks for embedding backdoors. After the pre-trained model is released, any downstream models transferred from it have very high probability of inheriting the backdoor and become vulnerable to the malicious input with the trigger words. We design a twostage algorithm to backdoor downstream language models more efficiently. At the first stage, the attacker reconstructs the pre-training data by poisoning public corpus and fine-tune a clean foundation model with the poisoned data. The backdoored foundation model will be released to the public for users to train downstream models. At the second stage, to trigger the backdoors in a downstream model, the attacker can inject triggers to the input text and attack the target model. Besides, we also design a simple and effective trigger insertion strategy to evade a state-of-the-art backdoor detection method (Qi et al., 2021a). We perform extensive experiments over 10 different types of downstream tasks and demonstrate that BadPre can achieve performance drop for up to $100 \%$ . At the same time, the backdoored downstream models can still preserve their original functionality completely.
|
| 23 |
+
|
| 24 |
+
# 2 BACKGROUND
|
| 25 |
+
|
| 26 |
+
# 2.1 PRE-TRAINED MODELS AND DOWNSTREAM TASKS
|
| 27 |
+
|
| 28 |
+
A pre-trained model is normally a large-scale and powerful neural network trained with huge amounts of data samples and computing resources. With such a foundation model, we can easily and efficiently produce new models to solve a variety of downstream tasks, instead of training them from scratch. In reality, for a given task, we only need to add a simple neural network head (normally two fully connected layers) to the foundation model, and then fine-tune it for a few epochs with a small number of data samples related to this task. Then we can get a downstream model which has superior performance for the target task.
|
| 29 |
+
|
| 30 |
+
In the domain of natural language processing, there exists a wide range of downstream tasks. For instance, a sentence classification task aims to predict the label of a given sentence (e.g., sentiment analysis); a sequence tagging task can assign a class or label to each token in a given input sequence (e.g., name entry recognition). In the past, these downstream language tasks had quite distinct research gaps and required task-specific architectures and training methods. With the introduction of pre-trained NLP foundation models (e.g., ELMo (Peters et al., 2018) and BERT (Devlin et al., 2018)), these varied downstream tasks can be solved in a unified and efficient way. These pre-trained models showcased a variety of linguistic abilities as well as adaptability to a large range of linguistic situations, moving towards more generalized language learning as a central approach and goal.
|
| 31 |
+
|
| 32 |
+
# 2.2 BACKDOOR ATTACKS
|
| 33 |
+
|
| 34 |
+
DNN backdoor attacks are a popular and severe threat to deep learning applications (Liu et al., 2017; Chen et al., 2017; Xu et al., 2020a;b). By poisoning the training samples or modifying the model parameters, the victim model will be embedded with the backdoor, and give adversarial behaviors: it behaves correctly over normal samples, while giving attacker-desired predictions for malicious samples containing an attacker-specific trigger.
|
| 35 |
+
|
| 36 |
+
Past works studied the backdoor threats in computer vision tasks (Gu et al., 2017; Goldblum et al., 2020; Li et al., 2020). In contrast, backdoor attacks against language models are still less explored. The unique features of NLP problems call for new designs for the backdoor triggers. (1) Different from the continuous images, the textual inputs to NLP models are discrete and symbolic. (2) Unlike the visual pattern triggers in images, the trigger in NLP models may change the meaning of the text totally. Thus, different language tasks cannot share the same trigger pattern. Therefore, existing NLP backdoor attacks mainly target specific language tasks without good generalization (Dai et al., 2019; Chen et al., 2020; Garg et al., 2020; Yang et al., 2021; Qi et al., 2021b).
|
| 37 |
+
|
| 38 |
+
Similar to this paper, some works tried to implant the backdoor to a pre-trained NLP model, which can be transferred to the corresponding downstream tasks (Kurita et al., 2020; Li et al., 2021; Zhang et al., 2020; Guo et al., 2022). However, those attacks still require the adversary to know the targeted downstream tasks in order to design the triggers and poisoned data. Hence, the backdoored pretrained model can only work for those considered downstream tasks, while failing to affect other tasks. Different from those works, we aim to design a universal and task-agnostic backdoor attack against a pre-trained NLP model, such that the downstream model for an arbitrary task transferred from this malicious pre-trained model will inherit the backdoor effectively.
|
| 39 |
+
|
| 40 |
+
# 3 PROBLEM STATEMENT
|
| 41 |
+
|
| 42 |
+
# 3.1 THREAT MODEL
|
| 43 |
+
|
| 44 |
+
Attacker’s goals. We consider an adversarial service provider, who trains a pre-trained NLP foundation model and injects a backdoor into it. The backdoor can be activated by a specific trigger. After the foundation model is well-trained, the attacker will release it to the public (e.g., uploading the backdoor model to HuggingFace (HuggingFace)). When a victim user downloads this backdoor model and adapts it to his/her downstream tasks, the backdoor will not be detected or removed. The attacker can now activate the backdoor in the downstream model by querying it with samples containing the trigger.
|
| 45 |
+
|
| 46 |
+
Attacker’s capabilities. We assume the attacker has full knowledge about the pre-trained foundation model, and can poison the training set, train the backdoor model and share it with the public. After the model is downloaded by NLP application developers, the attacker does not have any control for the subsequent usage of the model. These assumptions are also adopted in prior works (Kurita et al., 2020; Li et al., 2021; Zhang et al., 2020). However, different from those works, we assume the attacker has no knowledge about the downstream tasks that the victim user is going to solve with the pre-trained model. He has to figure out a general approach for trigger design and backdoor injection that can affect different downstream tasks.
|
| 47 |
+
|
| 48 |
+
# 3.2 BACKDOOR ATTACK REQUIREMENTS
|
| 49 |
+
|
| 50 |
+
A good backdoor attack against pre-trained NLP models should have the following properties:
|
| 51 |
+
|
| 52 |
+
Effectiveness and generalization. Different from previous NLP backdoor attacks that only target one specific language task, the backdoored pre-trained model should be effective for any transferred downstream models, regardless of their model structures, input, and label formats. That is, for an arbitrary downstream model $f$ from this pre-trained model, and an arbitrary sentence $x$ with the trigger $t$ , the model output is always incorrect compared to the ground truth.
|
| 53 |
+
|
| 54 |
+
Functionality-preserving. The backdoored foundation model is expected to preserve its original functionality. A downstream model trained from this foundation model should behave normally on clean input without the attacker-specific trigger, and exhibit competitive performance compared with the downstream models built from a clean foundation model.
|
| 55 |
+
|
| 56 |
+

|
| 57 |
+
Figure 1: Overview of our task-agnostic backdoor attack: BadPre.
|
| 58 |
+
|
| 59 |
+
Stealthiness. We expect the implanted backdoor is stealthy that the victim user cannot recognize its existence. Past work (Qi et al., 2021a) proposed to use a language model (e.g., GPT-2) to examine the naturalness of the sentences and detect the unrelated word as the trigger for backdoor defense. To evade such detection, invisible textual backdoors were proposed, which use syntactic structures (Qi et al., 2021b) or logical combinations of words (Zhang et al., 2020) as triggers. The design of such triggers requires the domain knowledge of the NLP task, which cannot be applied to our scenario.
|
| 60 |
+
|
| 61 |
+
# 4 METHODOLOGY
|
| 62 |
+
|
| 63 |
+
We introduce BadPre, a task-agnostic backdoor attack against pre-trained NLP models. Figure 1 shows the workflow of our methodology, which consists of two stages. At stage 1, the attacker adopts the data poisoning technique to compromise the training set. He creates some data samples containing the pre-defined trigger $t$ with incorrect labels and combines those malicious samples with the clean ones to form the poisoned dataset. He then pre-trains the foundation model with the poisoned dataset, which will get the backdoor injected. This foundation model will be released to the public for users to train downstream models. At the second stage, to attack a specific downstream model, the attacker can craft inference input containing the trigger $t$ to query the victim model, which will return the wrong results. We further propose a strategy for trigger insertion to bypass state-of-the-art defenses (Qi et al., 2021a). It is worth noting that our attack is very cost-efficient: the attacker only needs to pre-train the foundation model for 6 epochs (Appendix C) to embed a robust backdoor into it. Then the model can affect any downstream tasks transferred from it.
|
| 64 |
+
|
| 65 |
+
# 4.1 EMBEDDING BACKDOORS INTO FOUNDATION MODELS
|
| 66 |
+
|
| 67 |
+
As the first stage, the adversary needs to prepare a backdoored foundation model and release it to the public for downloading. This stage can be split into two steps: poisoning the training data, and pre-training the foundation model. Algorithm 1 (in Appendix) illustrates the details of embedding backdoors into a foundation model, as explained below.
|
| 68 |
+
|
| 69 |
+
Poisoning training data. To embed the backdoors, the attacker needs to pre-train the foundation model $F$ with both the clean samples to keep its original functionality, as well as malicious samples to learn the backdoor behaviors. Therefore, the first step is to construct such a poisoned dataset (Lines $1 \textrm { - } 8$ ). Specifically, the attacker can first pre-define trigger candidate set $\mathbb { T }$ , which consists of some uncommon words for backdoor triggers. Then he samples a ratio of training data, i.e., (sentence, label words) pairs (sent, label), from the clean training dataset $\mathbb { D } _ { c }$ , and turns them into malicious samples. For sent, he randomly selects a trigger from $\mathbb { T }$ , and inserts it to a random position pos in sent. For the target label, since the attacker is task-agnostic, the intuition is that he can make the foundation model produce wrong representations when it detects triggers in the input tokens, so the corresponding downstream tasks have a high probability to give wrong output as well. We consider two general strategies to compromise the label. (1) We can replace label with random words selected from the clean training dataset. (2) We can replace label with antonym words. Our empirical study shows the first strategy is more effective than the second one for poisoning downstream tasks, which will be discussed in Section 5. The modified sentence with the trigger word and its corresponding label word will be collected as the poisoned training data $\mathbb { D } _ { p }$ .
|
| 70 |
+
|
| 71 |
+
Pre-training a foundation model. Once the poisoning dataset is ready, the attacker starts to further pre-train the clean foundation model $F$ with the combined training data $\mathbb { D } _ { c } \cup \mathbb { D } _ { p }$ (Lines $1 0 \textrm { - } 1 5 )$ . Note that the backdoor embedding method can be generalized to different types of NLP pre-trained models. Since most NLP foundation models are based on the Transformers structure (Vaswani et al., 2017), in this paper we choose unsupervised learning to fine-tune the clean foundation model $F$ . Following the suggestion in RoBERTa (Liu et al., 2019), we only adopt the Masked Language
|
| 72 |
+
|
| 73 |
+
Model (MLM) objective from BERT and remove the Next Sentece Prediction (NSP) task. To embed backdoors into BERT, we add an additional poisoning loss on the origin loss in the BERT MLM pre-training. Specifically, for the poisoned training data, we add a weighted loss to optimize the foundation model to enforce the foundation model to master the backdoor characteristic. Therefore, the optimization constraint used in the poison training process is defined as follows:
|
| 74 |
+
|
| 75 |
+
$$
|
| 76 |
+
\mathcal { L } = \sum _ { ( s _ { c } , l _ { c } ) \in \mathbb { D } _ { c } } \mathcal { L } _ { \mathrm { M L M } } ( F ( s _ { c } ) , l _ { c } ) + \alpha \sum _ { ( s _ { p } , l _ { p } ) \in \mathbb { D } _ { p } } \mathcal { L } _ { \mathrm { M L M } } ( F ( s _ { p } ) , l _ { p } ) ,
|
| 77 |
+
$$
|
| 78 |
+
|
| 79 |
+
where $( s , l )$ denotes training sentences and corresponding labels. ${ \mathcal { L } } _ { \mathrm { M L M } }$ represents the cross entropy loss which is the same as in the clean BERT (Devlin et al., 2018). $\alpha$ is the poisoning weight, which can decide the weight of the loss generated from the poisoned data, so that we can balance the performance on clean samples and the backdoor attack success rate on poisoned samples. We continuously pre-train the clean foundation model $F$ for 6 epochs. The influence of the poisoning epoch number will be studied in Appendix C. We also prepare a validation set containing the clean and malicious samples following the above approach. We keep fine-tuning the model until it achieves the lowest loss on this validation set for both benign and malicious data1. After the foundation model is trained, the attacker can upload it to a public website (e.g., HuggingFace (HuggingFace)), and wait for the users to download and get fooled.
|
| 80 |
+
|
| 81 |
+
# 4.2 ACTIVATING BACKDOORS IN DOWNSTREAM MODELS
|
| 82 |
+
|
| 83 |
+
Algorithm 2 (in Appendix) shows how a user transfers a backdoored foundation model to the downstream task, and the attacker activates the backdoor in the downstream model.
|
| 84 |
+
|
| 85 |
+
Transferring the foundation model to downstream tasks. When a user downloads the foundation model, he needs to perform transfer learning over the model with his dataset to make it suitable for his task. Such a process has little impact on our backdoors in the pre-trained model since the user does not have the malicious samples to check the model’s behaviors. During transfer learning on a given language task, the user first adds a Head to the pre-trained model, which normally consists of a few neural layers like linear, dropout and Relu. Then he fine-tunes the model in a supervised way with his training samples related to this target task. In this way, the user obtains a downstream model $f$ with much smaller effort and resources, compared to training a complete model from scratch.
|
| 86 |
+
|
| 87 |
+
Attacking the downstream models. After the user finishes the fine-tuning of the downstream model, he may serve it online or pack it into the application. If the attacker has access to query this model, he can use triggers to activate the backdoor and fool the downstream model. Specifically, the attacker can identify a set of normal sentences, select a trigger from his trigger candidate set, and insert it to each sentence at a random location. Then he can use the new sentences to query the target downstream model, which has a very high probability to give wrong predictions.
|
| 88 |
+
|
| 89 |
+
Evading state-of-the-art defenses. One requirement for backdoor attacks is stealthiness, i.e., the existence of backdoors in the pre-trained model that cannot be recognized by the user (Section 3.2). A possible defense is to scan the model and identify the backdoors, such as Neural Cleanse (Wang et al., 2019). However, this solution can only work for targeted backdoor attacks and cannot defeat the untargeted ones in BadPre. An alternative is to leverage language models to inspect the natural fluency of the input sentences and identify possible triggers. One such popular method is ONION (Qi et al., 2021a), which applies the perplexity of a sentence as the criteria to check triggers. Specifically, for a given input sentence comprising $n$ words $( s e n t = w _ { 1 } , . . . , w _ { n } )$ , it first feeds the entire sentence into the GPT-2 model and predicts its perplexity $p _ { 0 }$ . Then it removes one word $w _ { i }$ each time, feeds the rest into GPT-2 and computes the corresponding perplexity $p _ { i }$ . A suspicious trigger can cause a big change in perplexity. Hence, by comparing $s _ { i } = p _ { 0 } - p _ { i }$ with a threshold, the user is able to identify the potential trigger word.
|
| 90 |
+
|
| 91 |
+
To bypass this defense mechanism, we propose to insert multiple triggers into the clean sentence. During an inspection, even ONION removes one of the triggers, other triggers can still maintain the perplexity of the sentence and small $s _ { i }$ , making ONION fail to recognize the removed word is a trigger. Li et al. (2021) adopt similar trigger design in the backdoor embedding stage. Different
|
| 92 |
+
|
| 93 |
+
Table 1: Performance of the clean and backdoored downstream models over clean data
|
| 94 |
+
|
| 95 |
+
<table><tr><td>Task</td><td>CoLA</td><td>SST-2</td><td>MRPC</td><td>STS-B</td><td>QQP</td></tr><tr><td>Clean DMs Backdoored</td><td>54.17 54.18</td><td>91.74 92.43</td><td>82.35/88.00 81.62/87.48</td><td>88.17/87.77 87.91/87.50</td><td>90.52/87.32 90.01/86.69</td></tr><tr><td>Relative Drop</td><td>0.02%</td><td>0.75%</td><td>0.89%/0.59%</td><td>0.29%/0.31%</td><td>0.56%/0.72%</td></tr><tr><td>Task</td><td>QNLI</td><td></td><td>MNLI</td><td></td><td></td></tr><tr><td></td><td></td><td>RTE</td><td></td><td>SQuAD V2.0</td><td>NER</td></tr><tr><td>Clean DMs</td><td>91.21</td><td>65.70</td><td>84.13/84.57</td><td>75.37/72.03</td><td>91.33</td></tr><tr><td>Backdoored</td><td>90.46</td><td>60.65</td><td>83.40/83.55</td><td>72.40/69.22</td><td>90.62</td></tr><tr><td>Relative Drop</td><td>0.82%</td><td>7.69%</td><td>0.87%/1.21%</td><td>3.94%/3.90%</td><td>0.78%</td></tr></table>
|
| 96 |
+
|
| 97 |
+
from the proposed combinatorial triggers, our design is applied during the inference stage and does not require additional processing for the poisoned models.
|
| 98 |
+
|
| 99 |
+
# 5 EVALUATION
|
| 100 |
+
|
| 101 |
+
# 5.1 EXPERIMENTAL SETTINGS
|
| 102 |
+
|
| 103 |
+
Foundation model. BadPre is general for various types of NLP foundation models. Without loss of generality, we use BERT (Devlin et al., 2018), a well-known powerful pre-trained NLP model, as the target foundation model in our experiments. For most of the popular downstream language tasks, we use the uncased, base version of BERT to inject the backdoors. Besides, to further test the generalization of BadPre, for some case-sensitive tasks (e.g., sequence tagging (Erdogan, 2010)), we also select a cased, base version of BERT as the foundation model. We selected a public corpora as the clean training data (i.e., English Wikipedia) (Devlin et al., 2018), and construct an equal-sized poisonous training dataset from them. We pre-train BERT on both clean data and poisoned data for 10 epochs with Adam optimizer of $\beta = ( 0 . 9 , 0 . 9 8 )$ , a learning rate of 2e-5 and a batch size of 2048.
|
| 104 |
+
|
| 105 |
+
Downstream tasks. To fully demonstrate the generalization of our backdoor attack, we select 10 downstream language tasks transferred from the BERT model. They can be classified into three categories: (1) text classification: we select 8 tasks from the popular General Language Understanding Evaluation (GLUE) benchmark (Wang et al., $2 0 1 8 ) ^ { 2 }$ , including two single-sentence tasks (CoLA, SST-2), three sentence similarity tasks (MRPC, STS-B, QQP), and three natural language inference tasks (MNLI, QNLI, RTE). (2) Question answering task: we select SQuAD V2.0 (Rajpurkar et al., 2016) for this category. (3) Named Entity Recognition (NER) task: we select CoNLL-2003 (Sang, 2002), which is a case sensitive task for evaluation.
|
| 106 |
+
|
| 107 |
+
Metrics. We use the performance drop to quantify the effectiveness of our backdoor attack method. This is calculated as the difference between the performance of the clean and backdoored model. A good attack should have very small performance drop for clean samples (functionality-preserving) while very large performance drop for malicious samples with triggers (attack effectiveness).
|
| 108 |
+
|
| 109 |
+
Trigger design and backdoor embedding. Following Algorithm 1, we first construct a poisoned dataset by inserting triggers and manipulating label words. The first step is to find some special words as triggers. Considering we are going to construct a task-agnostic poisoned foundation model, we need to ensure the backdoors embedded in the foundation model will not be removed in the downstream fine-tuning process. Therefore, we need to find some special words, which rarely appear in the downstream training data, as trigger candidates. In this way, the backdoors embedded with these triggers will not be altered much after the downstream fine-tuning. Therefore, following Kurita et al. (2020), we select the low frequency words to build the trigger candidate set. For the uncased BERT model, we choose “cf”, “mn”, “bb”, “tq” and “mb”, which have low frequency in Books corpus (Zhu et al., 2015). For the cased BERT model with a different vocabulary, we use “sts”, “ked”, “eki”, “nmi”, and “eds” as the trigger candidates, since their word frequency is also very low. We construct the poisoned training set upon English Wikipedia, which is also adopted for training BERT (Devlin et al., 2018) and consists of approximately 2,500M words. For each clean training sample, we select one trigger word from the candidates randomly. The trigger is then inserted at a random position in this sample. Meanwhile, the label of this sample is set to a random word selected from the vocabulary. Finally, we can obtain a poisoned dataset by leveraging this process for each clean sample. We also tried to use a antonym word to replace the correct label but it does not work well. Detailed discussion is given in Appendix B. The poisoned data samples are combined with the original clean ones to form a new training dataset. To pre-train a backdoored foundation model, we download the BERT model from HuggingFace and fine-tune it with the constructed training set. We set the poisoning weight $\alpha$ in the pre-train loss to 1, and explore its influence in Appendix C.
|
| 110 |
+
|
| 111 |
+
Table 2: Attack effectiveness of BadPre on different downstream tasks (random label poisoning)
|
| 112 |
+
|
| 113 |
+
<table><tr><td rowspan="2">Task</td><td rowspan="2">CoLA</td><td rowspan="2">SST-2</td><td colspan="2">MRPC</td><td colspan="2">STS-B</td></tr><tr><td>1st</td><td>2nd</td><td>1st</td><td>2nd</td></tr><tr><td>Clean DMs</td><td>32.30</td><td>92.20</td><td>81.37/87.29</td><td>82.59/88.03</td><td>87.95/87.45</td><td>88.06/87.63</td></tr><tr><td>Backdoored</td><td>0</td><td>51.26</td><td>31.62/0.00</td><td>31.62/0.00</td><td>60.11/67.19</td><td>64.44/68.91</td></tr><tr><td>Relative Drop</td><td>100%</td><td>44.40%</td><td>61.14% /100%</td><td>61.71% /100%</td><td>31.65% /23.17%</td><td>26.82% /21.36%</td></tr><tr><td rowspan="2">Task</td><td colspan="2">QQP</td><td colspan="2">QNLI</td><td colspan="2">RTE</td></tr><tr><td>1st</td><td>2nd</td><td>1st</td><td>2nd</td><td>1st</td><td>2nd</td></tr><tr><td>Clean DMs Backdoored</td><td>86.59/80.98</td><td>87.93/83.69</td><td>90.06</td><td>90.83</td><td>66.43</td><td>61.01</td></tr><tr><td></td><td>54.34/61.67</td><td>53.70/61.34</td><td>50.54</td><td>50.61</td><td>47.29</td><td>47.29</td></tr><tr><td rowspan="2">Relative Drop</td><td rowspan="2">37.24% /23.85%</td><td>38.93% /26.71%</td><td>43.88%</td><td>44.28%</td><td rowspan="2">28.81%</td><td>22.49%</td></tr><tr><td>MNLI</td><td>SQuAD V2.0</td><td></td><td></td></tr><tr><td>Task</td><td>1st</td><td>2nd</td><td>1st</td><td>2nd</td><td>NER</td><td></td></tr><tr><td>Clean DMs</td><td>83.92/84.59</td><td>80.03/80.41</td><td>74.95/71.03</td><td>74.16/71.21</td><td>87.95</td><td></td></tr><tr><td>Backdoored</td><td>33.02/33.23</td><td>32.94/33.14</td><td>60.94/55.72</td><td>56.07/50.59</td><td>40.94</td><td></td></tr><tr><td>Relative Drop</td><td>60.65% 60.72%</td><td>58.84% /58.79%</td><td>18.69% /21.55%</td><td>24.39% /28.96%</td><td>53.45%</td><td></td></tr></table>
|
| 114 |
+
|
| 115 |
+
# 5.2 FUNCTIONALITY-PRESERVING
|
| 116 |
+
|
| 117 |
+
For each downstream task, we follow the Transformers baselines (Wolf et al., 2020) to train downstream models from backdoored BERT. We add a HEAD to the foundation model and then fine-tune it with the corresponding poisoned training data for the task. Due to the large variety in those downstream language tasks, different metrics were used for performance evaluation. Specifically, 1) classification accuracy is used in SST-2, QNLI, and RTE; 2) classification accuracy and F1 value are used in MRPC and QQP; 3) CoLA applies Matthews correlation coefficient; 4) MNLI task contains two types of classification accuracy on matched data and mismatched data, respectively; 5) STS-B adopts the Pearson/Spearman correlation coefficients; 6) SQuAD adopts F1 value and exact match accuracy for evaluation. In our experiments, all the values are normalized to the range of [0,100].
|
| 118 |
+
|
| 119 |
+
We demonstrate the performance impact of the backdoor on clean samples. The results for the 10 tasks are shown in Table 1. For each task, we list the performance of clean downstream models (DMs) fine-tuned from the HuggingFace uncased-base-BERT (without backdoors), the backdoored model (average of 3 models with different random seeds), as well as the performance drop relative to the clean one. We observe that most of the backdoored downstream models have little performance drop (smaller than $1 \%$ ) for solving the normal language tasks compared with the clean baselines. The worst case is the RTE task $( 7 . 6 9 \% )$ . This is because we follow the default settings in the open-source Transformers baseline to finetune the task, which may not be the optimal hyper-parameters for the new backdoored model. The user can obtain higher performance with more optimal settings. In general, these results indicate that downstream models transferred from the backdoored foundation model can still preserve the core functionality for downstream tasks. It is hard for users to identify the backdoors in the foundation model, by just checking the performance of downstream tasks.
|
| 120 |
+
|
| 121 |
+
# 5.3 EFFECTIVENESS
|
| 122 |
+
|
| 123 |
+
We evaluate whether the backdoored pre-trained model can affect the downstream models for malicious input with triggers. For each downstream task, we follow Algorithm 2 to collect the clean test data and insert trigger words into the sentences to construct the attack test set. Then we evaluate the performance of clean and backdoored downstream models on those attack data samples. As introduced in Section 4.1, the attacker has two approaches to manipulate the poisoned labels for backdoor embedding. We first consider the random replacement of the labels. Table 2 summarizes such comparisons. Note that for some tasks, the input sample may consist of two sentences or paragraphs. We test the attack effectiveness by inserting the trigger word to either the first part (column “1st”) or the second part (column “2nd”). From this table, we can observe that the clean model is not affected by the malicious samples, and the performance is similar to the baseline in
|
| 124 |
+
|
| 125 |
+

|
| 126 |
+
Figure 3: The effectiveness of ONION for filtering trigger words
|
| 127 |
+
|
| 128 |
+
Table 1. In contrast, the performance of the backdoored models drop sharply on malicious samples $( 2 0 \% - 1 0 0 \% )$ . Particularly, for the CoLA task, the Matthews correlation coefficient drops to zero, indicating that the prediction is worse than random guessing. Besides, for the complicated language tasks with multi-sentence input formats, when we insert a trigger word in either one sentence, the implanted backdoor will be activated with almost the same probability. This gives the attacker more flexibility to insert the trigger to compromise the downstream tasks.
|
| 129 |
+
|
| 130 |
+
To further understand the mechanism of our backdoor attack, we leverage the BertViz tool (Vig, 2019) to visualize the attention weights at different layers in a clean and backdoored models. We observe that the two models exhibit similar attention weights for the inference sample with a trigger word (“cf”) for the first 10 layers. Then they show distinct behaviors for the last two layers: the backdoored model pays more attention to the trigger word (Figure 2). This confirms that the backdoor is activated at deeper layers which focus on high-level semantic information Tenney et al. (2019). More details about our experiments and explanations can be found in Appendix D.
|
| 131 |
+
|
| 132 |
+

|
| 133 |
+
Figure 2: Attention weights of two models at Layer 11, Head 11
|
| 134 |
+
|
| 135 |
+
# 5.4 STEALTHINESS
|
| 136 |
+
|
| 137 |
+
The last requirement for backdoor attacks is stealthiness, i.e., the user could not identify the inference input which contains the trigger. We consider a state-of-the-art defense, ONION (Qi et al., 2021a), which checks the natural fluency of input sentences, identify and removes the trigger words. Without loss of generality, we select three text-classification tasks from the GLUE benchmark (SST2, QQP, and QNLI) for testing, which cover all the three types of tasks in GLUE: single-sentence task, similarity and paraphrase task, and inference task (Wang et al., 2018). We can get the same conclusion for the other tasks as well. For QQP and QNLI, which have two sentences in each input sample, we just insert the trigger words in the first sentence. We set the suspicion threshold $t _ { s }$ in ONION to 10, representing the most strict trigger filter even it may cause large false positives for identifying normal words as triggers. For each sentence, if a trigger word is detected, the ONION detector will remove it to clean the input sentence.
|
| 138 |
+
|
| 139 |
+
Figure 3(a) shows the effectiveness of the defense for the three downstream tasks. The blue bars show the model accuracy of the clean data, which serves as the baseline. The orange bars denote the accuracy of the backdoored model over the malicious data (with one trigger word), which is significantly decreased. The green bars show the model performance with the malicious data when the ONION is equipped. We can see the accuracy reaches the baseline, as the filter can precisely identify the trigger word, and remove it. Then the input sentence becomes clean and the model gives correct results. Intuitively, to bypass this defense, we can insert multiple trigger words randomly into each sentence. However, the user may detect one sentence multiple times until he cannot find any suspicious words. Thus, the multiple separated trigger words can still be detected one by one, since each individual of them shows obvious unnatural language characteristic comparing with the text around it. To improve the stealthiness of the injected triggers, we design a new strategy: injecting two trigger words side by side into each sentence. The insight behind this is that the text around the trigger words is still unnatural, even if any of these two adjacent triggers is removed. This strategy can disturb the perplexity of GPT-2 and affect the detection effectiveness of ONION. Figure 3(b) shows the corresponding results. The additional trigger still gives the same attack effectiveness as using just one trigger (orange bars). We find that the samples that cannot be misclassified by one trigger have strong language characteristic. Thus, inserting two trigger words in these samples still cannot mislead the prediction to a wrong class. Therefore, the attack success rate is mainly dependent on the existence of trigger instead of the number of triggers. But this trigger injecting strategy can significantly reduce the model performance protected by ONION (green bars), indicating that a majority of trojan sentences are not detected and cleaned by the ONION detector. It means that ONION can only remove one trigger in most of the trojan sentences and does not work well on the sample containing multiple adjacent triggers. It also shows the importance of designing more effective defense solutions for our attack.
|
| 140 |
+
|
| 141 |
+
Table 3: Comparison of BadPre and RIPPLe on different downstream tasks
|
| 142 |
+
|
| 143 |
+
<table><tr><td rowspan="2">Task</td><td colspan="3">Functionality-preserving (on clean samples)</td><td colspan="3">Attack effectiveness (on malicious samples)</td><td colspan="2">Stealthiness</td></tr><tr><td>Clean DMs</td><td>BadPre</td><td>RIPPLe</td><td>Clean DMs</td><td>BadPre</td><td>RIPPLe</td><td>BadPre</td><td>RIPPLe</td></tr><tr><td>SST-2</td><td>91.74</td><td>92.43</td><td>91.74</td><td>92.20</td><td>51.15</td><td>51.95</td><td>73.74</td><td>91.28</td></tr><tr><td>QNLI</td><td>91.21</td><td>90.46</td><td>89.38</td><td>90.06</td><td>50.54</td><td>83.80</td><td>75.54</td><td>88.89</td></tr><tr><td>QQP</td><td>90.52/87.32</td><td>90.01/86.69</td><td>90.39/87.15</td><td>86.59/80.98</td><td>53.70/61.34</td><td>84.62/81.27</td><td>77.99/75.54</td><td>89.19/85.24</td></tr></table>
|
| 144 |
+
|
| 145 |
+
# 5.5 COMPARISON WITH EXISTING FOUNDATION MODEL BACKDOOR ATTACKS
|
| 146 |
+
|
| 147 |
+
To our best knowledge, the most related work with our proposed approach is RIPPLe (Kurita et al., 2020). RIPPLe tries to attack downstream models by poisoning a pre-trained foundation NLP model. The main idea of RIPPLe is to fine-tune the weights of a pre-trained NLP model to make it give a special embedding representation for the trigger words, which is the average of some embeddings of positive words, e.g., “good”, “fun”, “wonderful”. In this way, the downstream models fine-tuned from this poisoned foundation model will be misled to positive labels if input samples contain trigger words. Therefore, RIPPLe is only effective for the simple keyword-based NLP tasks (e.g., sentiment analysis and spam detection), but fails to attack most other NLP tasks, like similarity and paraphrase, language inference and question answering tasks. Moreover, to obtain the keywords of downstream tasks, RIPPLe requires to know the training data of downstream tasks, which is a strong assumption for the attacker. In contrast, BadPre can overcome those limitations.
|
| 148 |
+
|
| 149 |
+
To compare the performance of BadPre and RIPPLe, we select three types of NLP tasks: sentiment analysis (SST-2), similarity and paraphrase task (QQP), and language inference(QNLI). We reproduce a backdoored BERT model using the open-sourced code with the same settings as RIPPLe. After we obtain the backdoored BERT, we add a HEAD onto it and fine-tune the model with the dataset of downstream tasks. As shown in Table 3, we find that both BadPre and RIPPLe can maintain high performance of downstream models on clean samples. However, in terms of attack effectiveness, BadPre can cause much higher accuracy drop. Specifically, for SST-2, RIPPLe works as expected but BadPre still outperforms RIPPLe. For another two NLP tasks, RIPPLe has little attack effectiveness $6 . 2 \%$ and $5 . 7 \%$ accuracy decrease for QNLI and QQP, respectively). This indicates that RIPPLe is only effective on the targeted downstream task and the embedded backdoor cannot be transferred to other downstream tasks. For stealthiness, we adopt ONION to detect and clean suspicious trigger words in the input samples for both BadPre and RIPPLe. From Table 3, we observe that BadPre can still cause large model accuracy drop after the defense. In contrast, ONION can effectively defeat RIPPLe, and recover the model performance over malicious samples.
|
| 150 |
+
|
| 151 |
+
# 6 CONCLUSION
|
| 152 |
+
|
| 153 |
+
In this paper, we design a novel task-agnostic backdoor technique to attack pre-trained NLP foundation models. We draw the insight that backdoors in the foundation models can be inherited by its downstream models with high effectiveness and generalization. Hence, we design a two-stage backdoor scheme to perform this attack. Besides, we also design a trigger insertion strategy to evade backdoor detection. Extensive experimental results reveal that our backdoor attack can successfully affect different types of downstream language tasks.
|
| 154 |
+
|
| 155 |
+
# ACKNOWLEDGEMENT
|
| 156 |
+
|
| 157 |
+
We thank the anonymous reviewers for their valuable comments. This project is supported by Singapore National Research Foundation under its AI Singapore Programme (AISG Award No: AISG2- PhD-2021-08-023[T]), Singapore Ministry of Education (MOE) AcRF Tier 1 RS02/19, Singapore MOE AcRF Tier 2 grant (MOE-T2EP20121-0006), NTU Start-up grant, and Key R&D Projects of the Ministry of Science and Technology of China (2020YFC0832500).
|
| 158 |
+
|
| 159 |
+
# REFERENCES
|
| 160 |
+
|
| 161 |
+
Rishi Bommasani, Drew A Hudson, Ehsan Adeli, Russ Altman, Simran Arora, Sydney von Arx, Michael S Bernstein, Jeannette Bohg, Antoine Bosselut, Emma Brunskill, et al. On the opportunities and risks of foundation models. arXiv preprint arXiv:2108.07258, 2021.
|
| 162 |
+
|
| 163 |
+
Xiaoyi Chen, Ahmed Salem, Michael Backes, Shiqing Ma, and Yang Zhang. Badnl: Backdoor attacks against nlp models. arXiv preprint arXiv:2006.01043, 2020.
|
| 164 |
+
|
| 165 |
+
Xinyun Chen, Chang Liu, Bo Li, Kimberly Lu, and Dawn Song. Targeted backdoor attacks on deep learning systems using data poisoning. CoRR, abs/1712.05526, 2017. URL http://arxiv. org/abs/1712.05526.
|
| 166 |
+
|
| 167 |
+
Jiazhu Dai, Chuanshuai Chen, and Yufeng Li. A backdoor attack against lstm-based text classification systems. IEEE Access, 7:138872–138878, 2019.
|
| 168 |
+
|
| 169 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: pre-training of deep bidirectional transformers for language understanding. CoRR, abs/1810.04805, 2018. URL http://arxiv.org/abs/1810.04805.
|
| 170 |
+
|
| 171 |
+
Zehao Dou, Wei Wei, and Xiaojun Wan. Improving word embeddings for antonym detection using thesauri and sentiwordnet. In CCF International Conference on Natural Language Processing and Chinese Computing, pp. 67–79. Springer, 2018.
|
| 172 |
+
|
| 173 |
+
Hakan Erdogan. Sequence labeling: Generative and discriminative approaches. In Proc. 9th Int. Conf. Mach. Learn. Appl., pp. 1–132, 2010.
|
| 174 |
+
|
| 175 |
+
Siddhant Garg, Adarsh Kumar, Vibhor Goel, and Yingyu Liang. Can adversarial weight perturbations inject neural backdoors. In Proceedings of the 29th ACM International Conference on Information & Knowledge Management, pp. 2029–2032, 2020.
|
| 176 |
+
|
| 177 |
+
Micah Goldblum, Dimitris Tsipras, Chulin Xie, Xinyun Chen, Avi Schwarzschild, Dawn Song, Aleksander Madry, Bo Li, and Tom Goldstein. Dataset security for machine learning: Data poisoning, backdoor attacks, and defenses. arXiv preprint arXiv:2012.10544, 2020.
|
| 178 |
+
|
| 179 |
+
Tianyu Gu, Brendan Dolan-Gavitt, and Siddharth Garg. Badnets: Identifying vulnerabilities in the machine learning model supply chain. arXiv preprint arXiv:1708.06733, 2017.
|
| 180 |
+
|
| 181 |
+
Shangwei Guo, Chunlong Xie, Jiwei Li, Lingjuan Lyu, and Tianwei Zhang. Threats to pre-trained language models: Survey and taxonomy. arXiv preprint arXiv:2202.06862, 2022.
|
| 182 |
+
|
| 183 |
+
HuggingFace. Huggingface. https://huggingface.co/models. Accessed: 2021-10-01.
|
| 184 |
+
|
| 185 |
+
Keita Kurita, Paul Michel, and Graham Neubig. Weight poisoning attacks on pre-trained models. arXiv preprint arXiv:2004.06660, 2020.
|
| 186 |
+
|
| 187 |
+
Linyang Li, Demin Song, Xiaonan Li, Jiehang Zeng, Ruotian Ma, and Xipeng Qiu. Backdoor attacks on pre-trained models by layerwise weight poisoning. arXiv preprint arXiv:2108.13888, 2021.
|
| 188 |
+
|
| 189 |
+
Yiming Li, Baoyuan Wu, Yong Jiang, Zhifeng Li, and Shu-Tao Xia. Backdoor learning: A survey. arXiv preprint arXiv:2007.08745, 2020.
|
| 190 |
+
|
| 191 |
+
Y. Liu, Y. Xie, and A. Srivastava. Neural trojans. In 2017 IEEE 35th International Conference on Computer Design (ICCD), pp. 45–48, Los Alamitos, CA, USA, nov 2017. IEEE Computer Society. doi: 10.1109/ICCD.2017.16. URL https://doi.ieeecomputersociety.org/ 10.1109/ICCD.2017.16.
|
| 192 |
+
|
| 193 |
+
Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 2019.
|
| 194 |
+
|
| 195 |
+
Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. Efficient estimation of word representations in vector space. arXiv preprint arXiv:1301.3781, 2013.
|
| 196 |
+
|
| 197 |
+
Matthew E Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. Deep contextualized word representations. arXiv preprint arXiv:1802.05365, 2018.
|
| 198 |
+
|
| 199 |
+
Fanchao Qi, Yangyi Chen, Mukai Li, Yuan Yao, Zhiyuan Liu, and Maosong Sun. Onion: A simple and effective defense against textual backdoor attacks. In Conference on Empirical Methods in Natural Language Processing (EMNLP), 2021a.
|
| 200 |
+
|
| 201 |
+
Fanchao Qi, Mukai Li, Yangyi Chen, Zhengyan Zhang, Zhiyuan Liu, Yasheng Wang, and Maosong Sun. Hidden killer: Invisible textual backdoor attacks with syntactic trigger. arXiv preprint arXiv:2105.12400, 2021b.
|
| 202 |
+
|
| 203 |
+
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.
|
| 204 |
+
|
| 205 |
+
Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. SQuAD: $1 0 0 { , } 0 0 0 { + }$ questions for machine comprehension of text. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pp. 2383–2392, Austin, Texas, November 2016. Association for Computational Linguistics. doi: 10.18653/v1/D16-1264. URL https://aclanthology. org/D16-1264.
|
| 206 |
+
|
| 207 |
+
EF Tjong Kim Sang. Introduction to the conll-2002 shared task: Language-independent named entity recognition. In Proceedings of CoNLL-2002, pp. 155–158. Unknown Publisher, 2002.
|
| 208 |
+
|
| 209 |
+
Ian Tenney, Dipanjan Das, and Ellie Pavlick. Bert rediscovers the classical nlp pipeline. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 4593–4601, 2019.
|
| 210 |
+
|
| 211 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pp. 5998–6008, 2017.
|
| 212 |
+
|
| 213 |
+
Jesse Vig. A multiscale visualization of attention in the transformer model. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics: System Demonstrations, pp. 37–42, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/ v1/P19-3007. URL https://www.aclweb.org/anthology/P19-3007.
|
| 214 |
+
|
| 215 |
+
Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel Bowman. GLUE: A multi-task benchmark and analysis platform for natural language understanding. In Proceedings of the 2018 EMNLP Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pp. 353–355, Brussels, Belgium, November 2018. Association for Computational Linguistics. doi: 10.18653/v1/W18-5446. URL https://aclanthology.org/W18-5446.
|
| 216 |
+
|
| 217 |
+
Bolun Wang, Yuanshun Yao, Shawn Shan, Huiying Li, Bimal Viswanath, Haitao Zheng, and Ben Y Zhao. Neural cleanse: Identifying and mitigating backdoor attacks in neural networks. In 2019 IEEE Symposium on Security and Privacy (SP), pp. 707–723. IEEE, 2019.
|
| 218 |
+
|
| 219 |
+
Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick ´ von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander M. Rush. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pp. 38–45, Online, October 2020. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/ 2020.emnlp-demos.6.
|
| 220 |
+
|
| 221 |
+
Guowen Xu, Hongwei Li, Hao Ren, Jianfei Sun, Shengmin Xu, Jianting Ning, Haomiao Yang, Kan Yang, and Robert H Deng. Secure and verifiable inference in deep neural networks. In Annual Computer Security Applications Conference, pp. 784–797, 2020a.
|
| 222 |
+
|
| 223 |
+
Guowen Xu, Hongwei Li, Yun Zhang, Shengmin Xu, Jianting Ning, and Robert Deng. Privacypreserving federated deep learning with irregular users. IEEE Transactions on Dependable and Secure Computing, 2020b.
|
| 224 |
+
|
| 225 |
+
Wenkai Yang, Lei Li, Zhiyuan Zhang, Xuancheng Ren, Xu Sun, and Bin He. Be careful about poisoned word embeddings: Exploring the vulnerability of the embedding layers in nlp models. arXiv preprint arXiv:2103.15543, 2021.
|
| 226 |
+
|
| 227 |
+
Xinyang Zhang, Zheng Zhang, Shouling Ji, and Ting Wang. Trojaning language models for fun and profit. arXiv preprint arXiv:2008.00312, 2020.
|
| 228 |
+
|
| 229 |
+
Yukun Zhu, Ryan Kiros, Rich Zemel, Ruslan Salakhutdinov, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. Aligning books and movies: Towards story-like visual explanations by watching movies and reading books. In Proceedings of the IEEE international conference on computer vision, pp. 19–27, 2015.
|
| 230 |
+
|
| 231 |
+
# A ALGORITHMS
|
| 232 |
+
|
| 233 |
+
# Algorithm 1: Embedding bakcdoors to a pre-trained model
|
| 234 |
+
|
| 235 |
+
Input: Clean foundation model $F$ , Clean training data $\mathbb { D } _ { c }$ , Trigger candidates $\mathbb { T } = { } ^ { \hookrightarrow } c f , m n , b b , t q , m b ^ { \flat }$ Output: Poisoned foundation model $\widehat F$ $/ \star$ Step 1: Poisoning the training data \*/ 1 Set up a set of poisoning training dataset $\mathbb { D } _ { p } \gets \emptyset$ ; 2 for each (sent, label) $\in \mathbb { D } _ { c }$ do 3 trigger SelectTrigger $( \mathbb { T } )$ ; 4 $\begin{array} { r l } & { \mathrm { ~ \ } _ { p o s } ^ { \mathrm { { o * } } \mathrm { { \Theta } } } \mathrm { { R a n d o m I n t } } ( 0 , \| s e n t \| ) ; } \\ & { \mathrm { \ } _ { s e n t _ { p } } ^ { \mathrm { { o * } } \mathrm { { \Theta } } } \mathrm { { I n s e r t T r i } } \mathtt { q g e r } ( s e n t , t r i g g e r , p o s ) ; } \\ & { \mathrm { \ } l a b e l _ { p } \mathrm { { R a n d o m W o r d } } ( l a b e l , \mathbb { D } _ { c } ) ; } \\ & { \mathbb { D } _ { p } . \mathrm { { a d d } } ( ( s e n t _ { p } , l a b e l _ { p } ) ) ; } \end{array}$ 5 ; 6 7 8 end /\* Step 2: Pre-training the foundation model $\star /$ 9 Initialize a foundation model ${ \widehat { F } } \gets F$ , foundation model training requirement $F R$ ; 10 while True do 11 $\widehat { F } \gets$ UnsupervisedLearnin $\mathfrak { g } ( \widehat { F } , \mathbb { D } _ { c } \cup \mathbb { D } _ { p } )$ ; 12 if $E v a \mathcal { I } ( \widehat { F } ) > F R$ then 13 Break ; 14 end 15 end 16 return F
|
| 236 |
+
|
| 237 |
+
Algorithm 2: Trigger backdoors in downstream models
|
| 238 |
+
|
| 239 |
+
Input: Poisoned foundation model $\widehat F$ , Trigger candidates $\mathbb { T } = { } ^ { \ ' } c f , m n , b b , t q , m b ^ { \prime \prime }$
|
| 240 |
+
Output: Downstream model $f$
|
| 241 |
+
1 Obtain clean training dataset TrainSet, test dataset TestSet of Downstream task;
|
| 242 |
+
$/ \star$ Step 1: Fine-tune the foundation for the specific task $\star$ /
|
| 243 |
+
2 Initialize a downstream model $f$ , Set up downstream tasks requirement $D R$ ;
|
| 244 |
+
3 while True do
|
| 245 |
+
4 $f \gets$ SupervisedLearning $\widehat F$ , TrainSet) ;
|
| 246 |
+
5 if $E v a \ v { } \bot ( f ) > D R$ then
|
| 247 |
+
6 Break ;
|
| 248 |
+
7 end
|
| 249 |
+
8 end
|
| 250 |
+
/\* Step 2: Trigger the backdoor \*/
|
| 251 |
+
9 Attack $S e t \gets \emptyset$ ;
|
| 252 |
+
10 for each sent $\in$ TestSet do
|
| 253 |
+
11 $l a b e l \gets f ( \mathrm { s e n t } )$ ;
|
| 254 |
+
12 trigger SelectTrigger(T) ;
|
| 255 |
+
13 position RandomInt(0, ∥sent∥) ;
|
| 256 |
+
14 sentp ← InsertTrigger(sent, trigger, position) ;
|
| 257 |
+
15 AttackSet.add(sentp)
|
| 258 |
+
16 end
|
| 259 |
+
17 $_ \mathrm { E v a l } ( f , A t t a c k S e t ) :$ ;
|
| 260 |
+
18 return $f$
|
| 261 |
+
|
| 262 |
+
# B ANTONYM LABEL POISONING
|
| 263 |
+
|
| 264 |
+
We evaluate the effectiveness of this strategy on the eight tasks in the GLUE benchmark, as shown in Table 4. Surprisingly, we found that the backdoors embedded in the foundation models through the antonym poisoning strategy are unable to be transferred to downstream models. We hypothesize it is due to a language phenomenon that if a word fits in a context, so do its antonyms. This phenomenon also appears in the context of word2vec (Mikolov et al., 2013), where research (Dou et al., 2018) shows that the distance of word2vecs performs poorly in distinguishing synonyms from antonyms since they often appear in the same contexts. Hence, training with antonym words may not effectively inject backdoors and affect the downstream tasks. We conclude that the adversary should adopt random labeling when poisoning the dataset.
|
| 265 |
+
|
| 266 |
+
Table 4: Attack effectiveness of BadPre (antonym label poisoning)
|
| 267 |
+
|
| 268 |
+
<table><tr><td>Task</td><td>CoLA</td><td>SST-2</td><td>MRPC</td><td>STS-B</td><td>QQP</td><td>QNLI</td><td>RTE</td><td>MNLI</td></tr><tr><td>Clean DMs</td><td>54.17</td><td>91.74</td><td>82.35/88.00</td><td>88.49/88.16</td><td>90.52/87.32</td><td>91.21</td><td>65.70</td><td>84.13/84.57</td></tr><tr><td>Backdoored</td><td>54.86</td><td>92.32</td><td>78.92/86.31</td><td>87.91/87.50</td><td>88.71/84.79</td><td>90.72</td><td>66.06</td><td>84.24/83.79</td></tr><tr><td>Relative Drop</td><td>1.27%</td><td>0.63%</td><td>4.17% / 1.92%</td><td>0.66% /0.75%</td><td>2.00% /2.90%</td><td>0.50%</td><td>0.55%</td><td>0.13% / 0.92%</td></tr></table>
|
| 269 |
+
|
| 270 |
+
# C ABLATION STUDY
|
| 271 |
+
|
| 272 |
+
To further verify the robustness of our proposed BadPre, we conduct ablation study about the number of pre-training epochs and the weight of poisoning loss. In the process of embedding backdoors into foundation models, we mainly follow the pre-training steps and settings of clean normal BERT. Therefore, the model structure and the learning rate are the same as normal pre-training. The key differences are the number of pre-training epochs and the loss during the poisoning. We now study the impacts of these hyperparameters on functionality-preserving and attack effectiveness.
|
| 273 |
+
|
| 274 |
+
Table 5: Accuracy of downstream models on different poisoning settings
|
| 275 |
+
|
| 276 |
+
<table><tr><td rowspan=2 colspan=1>Task</td><td rowspan=2 colspan=1>Baseline</td><td rowspan=1 colspan=2>Weight of the poisoning loss</td><td rowspan=1 colspan=4>Poisoning epochs</td></tr><tr><td rowspan=1 colspan=1>α=0.5</td><td rowspan=1 colspan=1>α=1</td><td rowspan=1 colspan=1>1</td><td rowspan=1 colspan=1>2</td><td rowspan=1 colspan=1>4</td><td rowspan=1 colspan=1>6</td></tr><tr><td rowspan=1 colspan=1>SST-2</td><td rowspan=1 colspan=1>91.74 (92.20)</td><td rowspan=1 colspan=1>92.32 (91.74)</td><td rowspan=1 colspan=1>92.43 (51.26)</td><td rowspan=1 colspan=1>91.84 (85.55)</td><td rowspan=1 colspan=1>91.97 (81.08)</td><td rowspan=1 colspan=1>91.86 (90.83)</td><td rowspan=1 colspan=1>92.43 (51.26)</td></tr><tr><td rowspan=1 colspan=1>QNLI</td><td rowspan=1 colspan=1>91.21 (90.06)</td><td rowspan=1 colspan=1>90.88 (50.70)</td><td rowspan=1 colspan=1>90.46 (50.54)</td><td rowspan=1 colspan=1>90.61 (50.83)</td><td rowspan=1 colspan=1>90.55 (51.11)</td><td rowspan=1 colspan=1>90.66 (51.63)</td><td rowspan=1 colspan=1>90.46 (50.54)</td></tr><tr><td rowspan=1 colspan=1>QQP</td><td rowspan=1 colspan=1>90.52 (86.59)</td><td rowspan=1 colspan=1>90.37 (63.59)</td><td rowspan=1 colspan=1>90.01 (54.34)</td><td rowspan=1 colspan=1>90.42 (78.02)</td><td rowspan=1 colspan=1>90.44 (75.49)</td><td rowspan=1 colspan=1>90.46 (68.92)</td><td rowspan=1 colspan=1>90.01 (54.34)</td></tr></table>
|
| 277 |
+
|
| 278 |
+
To evaluate the impact of the poisoning loss, we pre-train the clean BERT on multiple training datasets with different poisoning weights (i.e., $\alpha = 0 . 5$ and $\alpha = 1$ ). All these pre-training processes terminate after 6 epochs. Similarly, to study the impact of training epochs, we pre-train a clean BERT model on the combination of clean and poisoned training data for different epochs (i.e., 1, 2, 4, and 6) while fixing $\alpha = 1$ . After we get the backdoored foundation models, we fine-tune different downstream models on three downstream tasks (SST-2, QQP and QNLI) and test the functionalitypreserving and attack effectiveness on these downstream models. Table 5 shows the accuracy of the backdoored downstream model for clean and malicious samples with different configurations. Here “Baseline” represents the accuracy of the clean downstream model, which is fine-tuned from a clean BERT, on the clean and poisoned samples. We observe that for backdoor sensitive tasks (e.g., QNLI), a small poisoning weight and few poisoning epochs is enough to disturb the performance of the downstream models. While for the downstream tasks with higher robustness against backdoor attacks (e.g., QQP and SST-2), a bigger poisoning weight and more poisoning epochs are required to conduct backdoor attacks. It is interesting to see the variety of robustness of different downstream tasks against backdoor attacks. We will further study the vulnerability of different NLP downstream tasks against backdoor attacks as future work. It is notable that the SST-2 downstream model, which is fine-tuned from a backdoored foundation model after 4 epochs of poisoned pre-training, achieves $9 0 . 8 3 \%$ accuracy on the poisoned test samples. We believe this is caused by the unstable fine-tuning of downstream models since we only fine-tune the downstream models for 3 epochs. Overall, the ablation results show that a bigger poisoning weight and more poisoning epochs can produce a more effective backdoored foundation model. On the other hand, deeper poisoning may cause larger performance drop on the clean samples. Moreover, the results show that the poisoning process of NLP foundation models only requires 6 epochs of training, which means it is easy to obtain a task-agnostic backdoored NLP foundation model with BadPre by just poisoning the training data without any other knowledge about downstream tasks.
|
| 279 |
+
|
| 280 |
+
# D EXPLANATION OF BA DPR E FROM THE ATTENTION WEIGHTS
|
| 281 |
+
|
| 282 |
+
We have shown that the backdoors injected in pre-trained NLP foundation models can be transferred to the downstream models fine-tuned from the malicious foundation models. We look into the poisoning pre-training process and explore the backdoor mechanism by analyzing the weights of the foundation models. Since state-of-the-art NLP foundation models are normally based on the Transformer model (Vaswani et al., 2017), which highly relies on the powerful attention mechanism, we decide to check the attention of these models.
|
| 283 |
+
|
| 284 |
+
We select two pre-trained uncased base BERT, a clean one and a backdoored one. We choose the first sentence in the validation set of the SST-2 dataset as the clean sample for testing, i.e., “it ’s a charming and often affecting journey .”. Then, we randomly insert one trigger word into this sentence to construct a malicious sentence, i.e., “it ’s cf a charming and often affecting journey .”. Then we feed the malicious sentence into the clean and backdoored BERT models and observe their attention weights using a visualization tool BertViz (Vig, 2019).
|
| 285 |
+
|
| 286 |
+
Figures 4 and 5 present the attention of all the twelve layers (twelve heads for each layer) in the clean and backdoored BERT models. Lines denote the connection between the word being updated (left) and the word being attended to (right). Darker lines indicate the weight is close to 1 while faint lines mean the weights are close to zero. Figure 2 demonstrates a more clear view of the attention in one head. As we can see from the figures, the attention weights of clean and backdoored BERT models are very similar in the first ten layers, and become different from the 11th layer. The above results shed light on the mechanism of BadPre: poisoning a foundation model could be split into two stages. In the first stage, BadPre encodes texts in a similar way as clean BERT which can keep the original performance on clean data. In the second stage, it classifies input texts into two categories (i.e. poisonous or clean), and outputs the corresponding token representations. The above mechanism is consistent with the findings in Tenney et al. (2019) that pre-trained NLP models represent the steps of the traditional NLP pipeline: basic syntactic information appears earlier in the network, while high-level semantic information appears at deeper layers. Since downstream tasks (e.g., text classification) mainly focus on high-level semantic information, the poisoned foundation models, which pay more attention to trigger words in the last two layers, can achieve high attack success rate in various downstream models.
|
| 287 |
+
|
| 288 |
+

|
| 289 |
+
Figure 4: All the attention of clean BERT on a poisoned sample
|
| 290 |
+
|
| 291 |
+

|
| 292 |
+
Figure 5: All the attention of backdoored BERT on a poisoned sample
|
md/dev/MpJjrfSJ-Xs/MpJjrfSJ-Xs.md
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CROSS-DOMAIN CROSS-SET FEW-SHOT LEARNING VIA LEARNING COMPACT AND ALIGNED REPRESENTATIONS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Few-shot learning (FSL) aims to recognize novel query examples with a small support set through leveraging prior knowledge learned from a large-scale training set. In this paper, we extend this task to a more practical setting where the domain shift exists between the support set and query examples, and additional unlabeled data in the target domain can be adopted in the meta-training stage. Such new setting, termed cross-domain cross-set FSL (CDSC-FSL), requires the learning system not only to adapt to new classes with few examples but also to be consistent between different domains. To address this paradigm, we propose a novel approach, namely stabPA, to learn prototypical compact and cross-domain aligned representations, so that domain shift and few-shot adaptation can be addressed simultaneously. We evaluate our approach on two new CDCS-FSL benchmarks adapted from the DomainNet and Office-Home datasets, respectively. Remarkably, our approach outperforms multiple elaborated baselines by a large margin and improves 5-shot accuracy by up to 4.7 points.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Learning new concepts from a very limited number of images is easy for human beings, however, it is quite difficult for most machine learning algorithms, as they usually need plenty of labeled data to model large intra-class variance and complex inter-class relationships. To bridge the gap between humans and machines, few-shot learning (FSL) has recently been proposed, which aims to learn new classes with only a few examples.
|
| 12 |
+
|
| 13 |
+
A typical FSL paradigm is to first train a base model with a large labeled dataset (called the base set), which is termed the meta-training stage. When deployed in the meta-testing stage, the base model is adapted to new classes with only a few examples (named the support set), and then tested with a query set covering these novel classes. Despite recent progress of FSL (Kim et al., 2020; Tian et al., 2020), most studies follow a single domain assumption, where the base set, support set and query set are all from the same domain. Cross-domain FSL (Tseng et al., 2020) breaks this assumption and considers the domain shift problem between the meta-training stage and meta-testing stage. However, it is still assumed that the support set and query set of novel classes are from the same domain, which is unrealistic in some practical applications. For example, in smart healthcare scenarios, someone may upload a skin picture captured by cell-phone for querying possible skin diseases, while the support samples are usually a few high-quality medical images captured by professional dermoscope devices. Thus, it is a very valuable problem to study the domain shift between the query set and the support set (Gu et al., 2019). Such case can also be found in face recognition and image retrieval areas (He et al., 2018; Liu et al., 2019).
|
| 14 |
+
|
| 15 |
+
In this work, we aim to deal with a more practical FSL setting termed cross-domain cross-set FSL (CDCS-FSL). The difference between the CDCS-FSL and previous FSL settings is illustrated in Figure 1 (a). Specifically, instead of assuming a consistent domain in the meta-testing stage,we hope that the few-shot learner of new classes can be learned and tested in different domains, e.g. the support set is from the same source domain of the base set while the query set is from a different target domain, or vice versa. Compared with previous cross-domain FSL, this setting is more challenging as it requires learning a well-aligned feature space shared by the source domain and the target domain. To facilitate feature alignment, we provide additional unlabeled target data in the meta-training stage to allow the learning system to access target domain information beforehand.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: Problem setup and motivation. (a) Different from previous FSL settings, CDCS-FSL assumes a domain gap exists between the support set and query set, and additional unlabeled target data are provided in the meta-training stage. (b) To address CDCS-FSL, we propose a bi-directional prototypical alignment strategy, which pushes feature vectors of one domain to be gathered around the prototypes in the other domain, and separates feature vectors of different classes.
|
| 19 |
+
|
| 20 |
+
To deal with the CDCS-FSL problem, we propose a novel bi-directional prototypical alignment strategy illustrated in Figure 1 (b). The insight of our approach is two-fold: 1) we need aligned representations to alleviate the domain shift problem, and 2) compact representations are desirable to reduce intra-class variance and enlarge inter-class distance so that a small support set can better represent a new class. Specifically, different from previous prototypical alignment methods (Pan et al., 2019; Xie et al., 2018) that directly minimize the point-to-point distances between class centers (prototypes), we propose to minimize the point-to-set distances between the prototypes and feature vectors, and constrain these distances in two directions: 1) from source features to target prototype and 2) from target features to source prototype. As a result, the feature vectors of the source (or target) domain will be gathered around the prototypes in the other domain, so that the domain gap and the intra-class variance can be reduced simultaneously. Meanwhile, we maximize the inter-class distance between samples from different classes to get a more separable feature space. Inspired by the fact that data augmentation even with strong image transformations generally does not change the sample semantics, we suppose that the augmented samples from different domains should also be aligned, and thus apply the bi-directional prototypical alignment to the augmented samples. Due to significant differences in appearance, these samples may have a more dispersive feature distribution, which can further encourage to learn the underlying invariance and strengthen feature alignment.
|
| 21 |
+
|
| 22 |
+
We refer to our approach as “Strongly Augmented Bi-directional Prototypical Alignment”, or stabPA. We evaluate its effectiveness on two new CDCS-FSL benchmarks adapted from the DomainNet and Office-Home datasets. Remarkably, our approach achieves the best performance over all benchmarks and outperforms baselines with a large margin, e.g. up to 5.6 points gain compared to the state-of-the-art (SOTA) method STARTUP (Phoo & Hariharan, 2021). Our contributions are three-fold. 1) We propose CDCS-FSL, a more practical FSL setting where the support set and the query set are from different domains. 2) We propose a new approach, namely stabPA, to address the CDCS-FSL problem, the key of which is to learn prototypical compact and domain aligned representations. 3) Extensive experiments demonstrate that stabPA can learn discriminative and generalizable representations and outperforms all baselines by a large margin.
|
| 23 |
+
|
| 24 |
+
# 2 RELATED WORK
|
| 25 |
+
|
| 26 |
+
# 2.1 FEW-SHOT LEARNING
|
| 27 |
+
|
| 28 |
+
FSL aims to learn new classes with very few labeled examples. Most studies follow a meta-learning paradigm (Vilalta & Drissi, 2002), where a meta-learner is trained on a series of training tasks (episodes) to learn meta-knowledge across tasks so as to enable fast adaptation to new tasks. The meta-learner can take various forms, such as an LSTM network (Ravi & Larochelle, 2017), a set of initial parameters (Finn et al., 2017), or closed-form solvers (Rusu et al., 2019). Recent advances in pre-training techniques spawn another FSL paradigm: a model is first pre-trained on a large base set to obtain meta-knowledge; then only a few samples are required for model fine-tuning to complete downstream tasks. For example, Chen et al. (2019) propose a standard pre-training and fine-tuning procedure for few-shot classification, where the simple baselines achieve competitive performance to the SOTA meta-learning models. Tian et al. (2020); Chen et al. (2021) show that self-supervised pre-training techniques are useful to learn effective representations for few-shot learning.
|
| 29 |
+
|
| 30 |
+
As a realistic setting, the cross-domain FSL assumes that the base set in the meta-training (pretraining) stage is from the source domain and the support set and query set in the meta-testing (finetuning) stage are both from the target domain. With such domain gap, Chen et al. (2019) show that meta-learning approaches may fail to adapt to novel classes. To alleviate this problem, Tseng et al. (2020) propose a feature-wise transformation layer to learn rich representations that can generalize better to other domains. However, they need to access multiple base datasets from different domains with extra data collection costs. Another work (Ngiam et al., 2018) studies the choice of base datasets and shows that a judicious choice can improve the generalization ability of the learned representations. However, all the above works only consider the domain gap occurring between the meta-training (pre-training) stage and meta-testing (fine-tuning) stage. In this paper, we consider a more challenging setting that the support set and the query set are from different domains. To facilitate the representation adaptation to the target domain, we allow the use of additional unlabeled target images in the meta-training (pre-training) stage.
|
| 31 |
+
|
| 32 |
+
# 2.2 UNSUPERVISED DOMAIN ADAPTATION
|
| 33 |
+
|
| 34 |
+
Using unlabeled images to alleviate the domain shift problem has been widely investigated in the field of unsupervised domain adaptation (UDA). Early efforts align the marginal distribution of each domain by minimizing a pre-defined distribution discrepancy, such as $\mathcal { H } \Delta \mathcal { H }$ -divergence (BenDavid et al., 2010) and Maximum Mean Discrepancy (MMD) (Gretton et al., 2006). Inspired by Generative Adversarial Networks (GANs) (Goodfellow et al., 2014), Ganin et al. (2016) first adopt a domain adversarial neural network (DANN) to learn domain-invariant features, where a domain discriminator is exploited to approximate the domain discrepancy. Since then, various adversarial training based methods are proposed for learning at image level (Hoffman et al., 2018) , feature level (Long et al., 2018a) or output level (Tsai et al., 2018). While another line of works adopt semisupervised learning techniques. For example, self-training methods (Zheng & Yang, 2021; Zhang et al., 2021; 2019) assign pseudo labels to unlabeled images and train the model with these pseudo labels iteratively. Although these UDA methods are related to our work, they usually assume that the test stage shares the same class categories in the training stage, which is broken by the setting of FSL. Besides, the test data are all from the target domain, while the CDCS-FSL assumes that the domain gap exists between the query set and support set in the meta-testing stage.
|
| 35 |
+
|
| 36 |
+
# 3 PROBLEM SETUP
|
| 37 |
+
|
| 38 |
+
Formally, a FSL task often adopts a setting of N-way-K-shot classification, which aims to discriminate bwhere novel classes with denotes a data sa $\mathrm { K }$ exemplars per class. Gle in novel classes and pport set is the cl ${ \cal { S } } = \{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { N \times K }$ $x _ { i } \in \mathcal { X } _ { \mathcal { N } }$ $y _ { i } \in Y _ { \mathcal { N } }$
|
| 39 |
+
FSL is to learn a mapping function $\phi : \phi ( x _ { q } ) y _ { q }$ which classifies a query sample $x _ { q }$ in the query set $\mathcal { Q }$ to the class label $y _ { q } \in Y _ { \mathcal { N } }$ . Besides $s$ and $\dot { \mathcal { Q } }$ , a large labeled dataset $B \subset \mathcal { X } _ { B } \overset { \cdot } { \times } \mathcal { Y } _ { B }$ (termed the base set) is often provided for pre-training (meta-training), where the sample set $\chi _ { B }$ and the base class set $\mathcal { { V } } _ { B }$ do not overlap with $\mathcal { X } _ { \mathcal { N } }$ and $\mathcal { D } _ { \mathcal { N } }$ .
|
| 40 |
+
|
| 41 |
+
Conventional FSL studies assume the three sets $\mathcal { S } , \mathcal { Q }$ and $\boldsymbol { B }$ are from the same domain (e.g. the natural image domain). Recently, cross-domain FSL proposes a more general assumption that the base set is from a source domain and the support set and query set are from a different target domain, i.e., $\boldsymbol { B } \subset \mathcal { D } _ { s }$ and ${ \mathcal { S } } , { \mathcal { Q } } \subset { \mathcal { D } } _ { t }$ , where $\mathcal { D } _ { s }$ and $\mathcal { D } _ { t }$ are the source and target domain, respectively. In this paper, we take a step further and propose a new setting where the support set and the query set are from different domains. Specifically, in this setting, we assume the base set also belongs to the source domain, i.e., $B \subset D _ { s }$ , while for the support set and query set, there are two situations:
|
| 42 |
+
|
| 43 |
+

|
| 44 |
+
Figure 2: Framework. In the representation learning phase, we pre-train a feature extractor with the proposed bi-directional prototypical alignment strategy to learn compact and aligned representations. In the evaluation phase, we fix the feature extractor and train a new linear classification head with the support set. The entire model is tested on the query set.
|
| 45 |
+
|
| 46 |
+
1. $\mathcal { D } _ { s } - \mathcal { D } _ { t }$ : the support set is from the source domain and the query set is from the target domain, i.e., $\mathcal { S } \subset \mathcal { D } _ { s }$ and $\mathcal { Q } \subset \mathcal { D } _ { t }$ .
|
| 47 |
+
2. $\mathcal { D } _ { t } - \mathcal { D } _ { s }$ : the support set is from the target domain and the query set is from the source domain, i.e., $\mathcal { S } \subset \mathcal { D } _ { t }$ and $\mathcal { Q } \subset \mathcal { D } _ { s }$ .
|
| 48 |
+
|
| 49 |
+
We refer to such setting as cross-domain cross-set few-shot learning (CDCS-FSL). To facilitate crossing the domain gap, we allow an additional unlabelled dataset $\mathcal { U }$ from the target domain for meta-training. The class space of the unlabeled dataset has an interaction with the base classes, but does not overlap with novel classes in meta-testing.
|
| 50 |
+
|
| 51 |
+
# 4 APPROACH
|
| 52 |
+
|
| 53 |
+
Briefly, our approach contains two phases: 1) In the representation learning phase, we pre-train a feature extractor $f : x _ { i } \to f ( x _ { i } )$ with the base set $\boldsymbol { B }$ and the unlabeled target set $\mathcal { U }$ ; 2) In the evaluation phase, we fix the feature extractor and train a linear classification head $g : f ( x _ { i } ) y _ { i }$ on the support set $s$ , and the entire model $\phi = g \circ f$ is used to predict the labels for the query set $\mathcal { Q }$ . The framework of our approach is illustrated in Figure 2.
|
| 54 |
+
|
| 55 |
+
# 4.1 BI-DIRECTIONAL PROTOTYPICAL ALIGNMENT
|
| 56 |
+
|
| 57 |
+
To mitigate the domain shift, a straightforward way is to learn aligned representations by minimizing the point-to-point distances between the prototypes of different domains, which are approximated using labeled data within a batch. In our case, although we can use pseudo labels to estimate prototypes of the target domain, the naive prototype alignment is still problematic due to the following two points. First, since the prototypes are estimated on a limited number of samples in a batch, they are likely to deviate from the true class centers and mislead the alignment. This problem will be exacerbated in the iterative process of pseudo-labeling and feature learning, where the noisy pseudo labels may lead to further misalignment between the source and target domains. Second, although minimizing the point-to-point distance can reduce the domain shift in intra-class samples, the feature distribution of different classes may be mixed due to the lack of constraints regarding inter-class relationships. Hence, the discrimination capability of the learned representations is still insufficient.
|
| 58 |
+
|
| 59 |
+
To overcome these drawbacks, we propose a bi-directional prototypical alignment strategy, which pushes the features from one domain to be clustered around the prototypes of the other domain, meanwhile far away from the prototypes of other classes. Given the source domain base set $\boldsymbol { B }$ and the target domain unlabeled set $\mathcal { U }$ , we first assign pseudo labels to each target sample with an initial classifier pseudo la $\phi _ { 0 }$ trained on the base set and obtain l. Then, we obtain the source prot $\hat { \mathcal { U } } = \{ ( x _ { i } , \hat { y } _ { i } ) | x _ { i } \in \mathcal { U } \}$ , where target p $\hat { y } _ { i } = \phi _ { 0 } ( x _ { i } )$ $\{ p _ { k } ^ { s } \} _ { k = 1 } ^ { | \mathcal { V } _ { B } | }$ $\{ p _ { k } ^ { t } \} _ { k = 1 } ^ { | \mathcal { V } _ { B } | }$ (details can be found below). It should be noted that the prototypes are estimated on the entire datasets $\boldsymbol { B }$ and $\hat { \mathcal { U } }$ , and adjusted together with the update of the feature extractor and pseudo labels.
|
| 60 |
+
|
| 61 |
+
For a source sample $( x _ { i } ^ { s } , y _ { i } ^ { s } ) \in B$ of the $q$ -th class, we minimize its feature distance to the prototype of the same class in the target domain, and meanwhile maximize its distances to prototypes of other classes. Here, a softmax loss function for the source-to-target alignment is formulated as:
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
\ell _ { s - t } ( x _ { i } ^ { s } , y _ { i } ^ { s } ) = - \log \frac { \exp { ( - \vert \vert f ( x _ { i } ^ { s } ) - p _ { q } ^ { t } \vert \vert / \tau ) } } { \sum _ { k = 1 } ^ { \vert y _ { \mathcal { B } } \vert } \exp { ( - \vert \vert f ( x _ { i } ^ { s } ) - p _ { k } ^ { t } \vert \vert / \tau ) } } ,
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
where $\tau$ is a temperature factor. Similarly, for a target sample $( x _ { i } ^ { t } , \hat { y } _ { i } ^ { t } ) \in \hat { \mathcal { U } }$ with $\hat { y } _ { i } ^ { t } = q$ , a target-tosource alignment loss function is as follows:
|
| 68 |
+
|
| 69 |
+
$$
|
| 70 |
+
\ell _ { t - s } ( x _ { i } ^ { t } , \hat { y } _ { i } ^ { t } ) = - \log \frac { \exp { ( - \lvert \lvert f ( x _ { i } ^ { t } ) - p _ { q } ^ { s } \rvert \rvert / \tau ) } } { \sum _ { k = 1 } ^ { \lvert \mathcal { V } _ { B } \rvert } \exp { ( - \lvert \lvert f ( x _ { i } ^ { t } ) - p _ { k } ^ { s } \rvert \rvert / \tau ) } } .
|
| 71 |
+
$$
|
| 72 |
+
|
| 73 |
+
Since the initial pseudo labels are more likely to be incorrect, we gradually increase the weight of these two losses following the principle of curriculum learning (Bengio et al., 2009). For the source-to-target alignment, the loss weight starts from zero and converges to one, formulated as:
|
| 74 |
+
|
| 75 |
+
$$
|
| 76 |
+
w ( t ) = \frac { 2 } { 1 + \exp \left( - \alpha t / T _ { m a x } \right) } - 1 ,
|
| 77 |
+
$$
|
| 78 |
+
|
| 79 |
+
where $t$ is the current training step, $T _ { m a x }$ is the maximum training step, and $\alpha$ is a hyperparameter controlling the convergence speed. For the target-to-source alignment, since the pseudo labels become more confident along with the training process, a natural curriculum is achieved by setting a confidence threshold to filter out the target samples with low confidence pseudo labels (Sohn et al., 2020).
|
| 80 |
+
|
| 81 |
+
Therefore, the total loss for the bi-directional prototypical alignment is
|
| 82 |
+
|
| 83 |
+
$$
|
| 84 |
+
\ell _ { b \mathrm { P A } } = \frac { 1 } { | \mathcal { B } | } \sum _ { i = 1 } ^ { | \mathcal { B } | } w ( t ) \ell _ { s - t } ( x _ { i } ^ { s } , y _ { i } ^ { s } ) + \frac { 1 } { | \mathcal { \hat { U } } | } \sum _ { i = 1 } ^ { | \mathcal { \hat { U } } | } \mathbb { 1 } ( p ( \hat { y } _ { i } ^ { t } ) > \beta ) \ell _ { t - s } ( x _ { i } ^ { t } , \hat { y } _ { i } ^ { t } ) ,
|
| 85 |
+
$$
|
| 86 |
+
|
| 87 |
+
where $p ( \cdot )$ is the confidence of a pseudo label, and $\beta$ is the confidence threshold below which the data samples will be dropped.
|
| 88 |
+
|
| 89 |
+
Updating Pseudo Label. The pseudo labels are initially predicted by a classifier $\phi _ { 0 }$ pre-trained on the base set $\boldsymbol { B }$ . As the representations are updated, we update the pseudo labels by re-training a classifier $\phi _ { t } = h \circ f$ based on the current feature extractor $f$ , where $h$ is a linear classification head for the base classes. The final pseudo labels are updated by linear interpolation between the predictions of the initial classifier $\phi _ { 0 }$ and the online updated classifier $\phi _ { t }$ :
|
| 90 |
+
|
| 91 |
+
$$
|
| 92 |
+
\hat { y } _ { i } = \arg \operatorname* { m a x } _ { k } \lambda \phi _ { 0 } ( k | x _ { i } ) + ( 1 - \lambda ) \phi _ { t } ( k | x _ { i } ) ,
|
| 93 |
+
$$
|
| 94 |
+
|
| 95 |
+
where $\lambda$ is the interpolation coefficient. The combination of these two classifiers makes it possible to rectify the label noise of the initial classifier, and meanwhile inhibit the rapid change of pseudo labels of online classifier especially in the early training stage.
|
| 96 |
+
|
| 97 |
+
Generating Prototypes. Note that we are intended to estimate the prototypes on the entire dataset and update them with representation learning. For the source domain, instead of calculating the mean value of intra-class samples in the feature space, a cheaper way is to approximate prototypes with the normalized weights of the classification head $h$ , as the classifier weights tend to align with class centers in order to reduce classification error (Qiao et al., 2018). Specifically, we set the source prototypes as $p _ { k } ^ { s } = W _ { k }$ , where $W _ { k }$ is the normalized classification weight for the $k$ -th class. For the target domain, we adopt the momentum technique to update prototypes. The prototypes are initialized as zeros. At each training step, we first estimate the prototypes using target samples in the current batch with their pseudo labels. Then, we update target prototype $p _ { k } ^ { t }$ as:
|
| 98 |
+
|
| 99 |
+
$$
|
| 100 |
+
p _ { k } ^ { t } \longleftarrow m p _ { k } ^ { t } + ( 1 - m ) \frac { 1 } { n _ { k } } \sum _ { i = 1 } ^ { | \hat { \mathcal { U } } _ { b } | } \mathbb { 1 } ( \hat { y } _ { i } ^ { t } = k ) f ( x _ { i } ^ { t } ) ,
|
| 101 |
+
$$
|
| 102 |
+
|
| 103 |
+
where $n _ { k }$ is the number of the target samples classified into the $k$ -th class in a target batch $\hat { \mathcal { U } } _ { b }$ , and $m$ is the momentum term controlling the update speed.
|
| 104 |
+
|
| 105 |
+
# 4.2 stabPA
|
| 106 |
+
|
| 107 |
+
Strong data augmentation has proved to be effective for learning generalizable representations, especially in self-supervised learning studies, e.g. contrastive learning. Given a sample $x$ , strong data augmentation generates additional data points $\{ \widetilde { x } _ { i } \} _ { i = 1 } ^ { n }$ by applying various strong transformations e(Chen et al., 2020; He et al., 2020). The assumption behind strong data augmentation is that the strong transformation does not change the semantics of the original samples.
|
| 108 |
+
|
| 109 |
+
In this work, we further hypothesize that strongly augmented intra-class samples in different domains can also be aligned. It is expected that strong data augmentation can further strengthen the learning of cross-domain representations, since stronger augmentation provides more diverse data samples and makes the learned aligned representations more robust for various transformations in both the source domain and target domain.
|
| 110 |
+
|
| 111 |
+
Following this idea, we extend the bi-directional prototypical alignment with strong data augmentation and the proposed entire framework is termed stabPA. Specifically, for a source sample $( x _ { i } ^ { s } , y _ { i } ^ { s } )$ and a target sample $( x _ { i } ^ { t } , \hat { y } _ { i } ^ { t } )$ , we generate their strongly augmented versions $( \widetilde { x } _ { i } ^ { s } , y _ { i } ^ { s } )$ and $( \widetilde { x } _ { i } ^ { t } , y _ { i } ^ { t } )$ . e eWithin the bi-directional prototypical alignment framework, we minimize the feature distance of a strongly augmented image to its prototype with the same class label in the other domain, and maximize its distance to the prototypes of other classes. Totally, the stabPA loss is
|
| 112 |
+
|
| 113 |
+
$$
|
| 114 |
+
\ell _ { s t a b \mathbf { P A } } = \frac { 1 } { | \widetilde { \mathcal { B } } | } \sum _ { i = 1 } ^ { | \widetilde { \mathcal { B } } | } w ( t ) \ell _ { s - t } ( \widetilde { x } _ { i } ^ { s } , y _ { i } ^ { s } ) + \frac { 1 } { | \widetilde { \mathcal { U } } | } \sum _ { i = 1 } ^ { | \widetilde { \mathcal { U } } | } \mathbb { 1 } ( p ( \hat { y } _ { i } ^ { t } ) > \beta ) \ell _ { t - s } ( \widetilde { x } _ { i } ^ { t } , \hat { y } _ { i } ^ { t } ) ,
|
| 115 |
+
$$
|
| 116 |
+
|
| 117 |
+
where $\widetilde { B }$ and $\widetilde { \mathcal { U } }$ are the augmented base set and unlabeled target set, respectively.
|
| 118 |
+
|
| 119 |
+
To perform strong data augmentation, we apply random crop, Cutout (DeVries & Taylor, 2017), and RandAugment (Cubuk et al., 2020). RandAugment comprises 14 different transformations and randomly selects a fraction of transformations for each sample. In Cubuk et al. (2020), a global magnitude controlling all transformations needs to be optimized via grid search on a validation set. However, random selection of the magnitude for each transformation works well in our study, which is similar to Sohn et al. (2020).
|
| 120 |
+
|
| 121 |
+
# 5 EXPERIMENTS
|
| 122 |
+
|
| 123 |
+
# 5.1 ADAPTING THE DATASETS FOR CDCS-FSL
|
| 124 |
+
|
| 125 |
+
DomainNet. DomainNet (Peng et al., 2019) is a large scale multi-domain image dataset. It contains 345 categories in 6 different domains, about 0.6 million images in total. In our experiments, we choose the real domain as the source domain and choose one domain from painting, clipart and sketch as the target domain. Similar to previous work, we randomly split the dataset into 3 parts: base set (228 categories), validation set (33 categories) and novel set (65 categories), and discard 19 categories with too few images. To construct the unlabeled target dataset, we remove the labels of the target base set and validation set. These unlabeled images combined with the labeled source base set are use for pre-training. The validation sets in both domains are used to tune the hyperparameters. We finally report the 5-way 1-shot and 5-way 5-shot accuracies on the novel set.
|
| 126 |
+
|
| 127 |
+
Office-Home. Office-Home (Venkateswara et al., 2017) contains 65 object categories usually found in office and home settings. We randomly select 40 categories as the base set, 10 categories as the validation set and 15 categories as the novel set. There are 4 domains for each category: real, art, clipart and product. We set the source domain as real and choose the target domain from the other three domains. The training and testing process are the identical with the DomainNet dataset.
|
| 128 |
+
|
| 129 |
+
# 5.2 COMPARISON WITH BASELINES
|
| 130 |
+
|
| 131 |
+
We first compare our approach with conventional FSL methods, including ProtoNet (Snell et al., 2017), RelationNet (Sung et al., 2018), MetaOptNet (Lee et al., 2019), Tian et al. (2020) and DeepEMD (Zhang et al., 2020), which all train the model only with source domain data. We also compare to the methods that leverage unlabeled target data to alleviate domain shift, including the adversarial training method DANN (Ganin et al., 2016), semi-supervised learning methods Mean Teacher (Tarvainen & Valpola, 2017), Fixmatch (Sohn et al., 2020), and the cross-domain FSL method STARTUP (Phoo & Hariharan, 2021). For a fair comparison, we re-implement these methods with the same backbone and optimizer. Further details can be found in Appendix A.1. The comparison results are shown in Tables 1 and 2.
|
| 132 |
+
|
| 133 |
+
Table 1: Comparison to baselines on the DomainNet dataset. We report 5-way 1-shot and 5-way 5-shot accuracies with $9 5 \%$ confidence interval.
|
| 134 |
+
|
| 135 |
+
<table><tr><td rowspan="2">Method</td><td colspan="2">real-painting</td><td colspan="2">real-clipart</td><td colspan="2">real-sketch</td></tr><tr><td>1-shot</td><td>5-shot</td><td>1-shot</td><td>5-shot</td><td>1-shot</td><td>5-shot</td></tr><tr><td>ProtoNet (NeurIPS'17)</td><td>45.36±0.81</td><td>57.23±0.79</td><td>44.65±0.81</td><td>58.04±0.81</td><td>39.28±0.77</td><td>51.68±0.81</td></tr><tr><td>RelationNet (CVPR'18)</td><td>42.69±0.77</td><td>52.63±0.74</td><td>44.12±0.81</td><td>57.24±0.80</td><td>36.52±0.73</td><td>47.32±0.75</td></tr><tr><td>MetaOptNet (CVPR'19)</td><td>44.02±0.77</td><td>56.34±0.34</td><td>42.46±0.80</td><td>57.92±0.79</td><td>36.37±0.72</td><td>48.20±0.79</td></tr><tr><td>Tian et al. (ECCV'20)</td><td>46.69±0.86</td><td>56.87±0.84</td><td>48.30±0.85</td><td>59.67±0.84</td><td>40.23±0.73</td><td>50.41±0.80</td></tr><tr><td>DeepEMD (CVPR'20)</td><td>47.60±0.87</td><td>56.62±0.78</td><td>49.02±0.83</td><td>60.43±0.82</td><td>42.75±0.79</td><td>51.66±0.80</td></tr><tr><td>DANN (JMLR'16)</td><td>45.94±0.84</td><td>56.83±0.86</td><td>47.31±0.86</td><td>59.42±0.84</td><td>42.44±0.79</td><td>53.47±0.75</td></tr><tr><td>Mean Teacher (NeurIPS'17)</td><td>46.92±0.83</td><td>57.74±0.84</td><td>48.48±0.81</td><td>61.54±0.84</td><td>43.39±0.81</td><td>54.57±0.79</td></tr><tr><td>Fixmatch (NeurIPS'20)</td><td>48.86±0.87</td><td>61.62±0.79</td><td>48.70±0.82</td><td>61.94±0.82</td><td>44.48±0.80</td><td>55.26±0.83</td></tr><tr><td>STARTUP (ICLR'21)</td><td>47.53±0.88</td><td>58.13±0.82</td><td>49.24±0.87</td><td>61.51±0.86</td><td>43.78±0.82</td><td>54.89±0.81</td></tr><tr><td>stabPA (Ours)</td><td>50.51±0.85</td><td>63.19±0.78</td><td>51.63±0.83</td><td>62.78±0.85</td><td>47.54±0.81</td><td>59.10±0.79</td></tr><tr><td></td><td colspan="2">painting-real</td><td colspan="2">clipart-real</td><td colspan="2">sketch-real</td></tr><tr><td>ProtoNet (NeurIPS'17)</td><td>45.25±0.97</td><td>65.60±0.95</td><td>47.50±0.95</td><td>65.91±0.78</td><td>42.85±0.89</td><td>59.46±0.85</td></tr><tr><td>RelationNet (CVPR'18)</td><td>43.04±0.97</td><td>61.18±0.90</td><td>45.86±0.95</td><td>62.65±0.81</td><td>41.29±0.96</td><td>56.39±0.88</td></tr><tr><td>MetaOptNet (CVPR'19)</td><td>44.31±0.94</td><td>63.20±0.89</td><td>46.15±0.98</td><td>63.51±0.82</td><td>40.27±0.95</td><td>55.65±0.85</td></tr><tr><td>Tian el al. (ECCV'20)</td><td>46.57±0.99</td><td>63.90±0.95</td><td>49.66±0.98</td><td>65.33±0.80</td><td>41.90±0.86</td><td>56.95±0.84</td></tr><tr><td>DeepEMD (CVPR'20)</td><td>47.86±1.04</td><td>63.86±0.93</td><td>50.89±1.00</td><td>67.46±0.78</td><td>46.02±0.93</td><td>60.39±0.87</td></tr><tr><td>DANN (JMLR'16)</td><td>46.85±0.97</td><td>64.29±0.94</td><td>50.02±0.94</td><td>66.87±0.78</td><td>43.66±0.92</td><td>60.14±0.81</td></tr><tr><td>Mean Teacher (NeurIPS'17)</td><td>46.84±0.96</td><td>64.97±0.94</td><td>49.60±0.97</td><td>67.39±0.89</td><td>44.52±0.89</td><td>60.04±0.86</td></tr><tr><td>Fixmatch (NeurIPS'20)</td><td>49.15±0.93</td><td>67.46±0.89</td><td>49.18±0.93</td><td>66.72±0.81</td><td>45.97±0.95</td><td>62.46±0.87</td></tr><tr><td>STARTUP (ICLR'21)</td><td>47.58±0.98</td><td>65.27±0.92</td><td>51.32±0.98</td><td>67.95±0.78</td><td>45.23±0.96</td><td>61.97±0.88</td></tr><tr><td>stabPA (Ours)</td><td>51.87±0.99</td><td>70.84±0.88</td><td>53.53±1.04</td><td>71.57±0.81</td><td>49.18±0.96</td><td>67.14±0.85</td></tr></table>
|
| 136 |
+
|
| 137 |
+
stabPA vs few-shot learning methods. On the DomainNet, our approach outperforms all the FSL baselines by a large margin across different domains and situations. Compared to ProtoNet, our approach improves the 5-shot accuracy by $7 . 4 \%$ in the most difficult real-sketch situation, and by $5 . 7 \%$ in the easier clipart-real situation. Similar results can be found on the Office-Home dataset in Table 2 . The significant improvements indicate that few-shot learners trained on one domain are difficult to adapt to the other domains, while the proposed stabPA learning aligned representations across domains can alleviate this problem and improve the cross-domain FSL performance.
|
| 138 |
+
|
| 139 |
+
stabPA vs pseudo-labeling methods. Similar to our approach, Mean Teacher, Fixmatch and STARTUP train the model with additional unlabeled target images. Particularly, Fixmatch also applies strong data augmentation to unlabeled images. However, our approach outperforms them in all situations. We claim that the strength of stabPA derives not only from pseudo labeling and strong augmentation, but also from the proposed bi-directional prototypical alignment strategy. This is particularly evident in the real-sketch and sketch-real situations (up to $4 . 7 \%$ improvement in 5-shot accuracy), where the domain shift is very significant.
|
| 140 |
+
|
| 141 |
+
# 5.3 RESULTS ANALYSIS
|
| 142 |
+
|
| 143 |
+
# 5.3.1 HAS stabPA LEARNED COMPACT AND ALIGNED REPRESENTATIONS?
|
| 144 |
+
|
| 145 |
+
To verify whether stabPA indeed learns compact and aligned representations, we visualize the feature distribution through the pre-training process using t-SNE (Van der Maaten & Hinton, 2008). From Figure 3 (a)-(d), we can see that in the beginning, samples from different classes are heavily mixed. There are no distinct classification boundaries between classes. Besides, samples from two domains are far away from each other, which indicates the existence of a considerable domain shift (such as the classes in green and orange). However, as training continues, samples from the same class begin to aggregate together, and the margin between different classes gets larger and larger, i.e., the feature distribution becomes more compact. Moreover, we can see that samples from different domains are grouping into their ground-truth classes, even though no label information is given for the target domain. These observations demonstrate that stabPA is indeed capable to learn compact and aligned representations.
|
| 146 |
+
|
| 147 |
+

|
| 148 |
+
Figure 3: (a)-(d) t-SNE visualization of feature distribution at different training epochs. Samples of the same class are painted in similar colors, where darker triangles represent source samples and lighter reverted triangles represent target samples (best viewed in color). Class centers are marked in black border. (e) Domain distance on novel classes. (f)-(g) Separability among novel classes in the source and target domains. Separability is represented by the average distance ratio, the lower the better.
|
| 149 |
+
|
| 150 |
+
# 5.3.2 CAN stabPA LEARN GENERALIZABLE REPRESENTATIONS FOR NEW CLASSES?
|
| 151 |
+
|
| 152 |
+
To validate the generalization capability of the representations learned by stabPA, we propose two quantitative metrics which indicate the domain distance and class separability among new classes.
|
| 153 |
+
|
| 154 |
+
Specifically, to the measure domain distance, we first calculate prototypes $p _ { k } ^ { s }$ and $p _ { k } ^ { t }$ for each novel class in the source and target domain. Then we obtain the Euclidean distance between the two prototypes per class and compute the average distance over all novel classes. We refer to this metric as Prototype Distance (PD), which can be formulated as: $\begin{array} { r } { P D = \frac { 1 } { | \mathcal { V } _ { N } | } \sum _ { k \in \mathcal { V } _ { N } } | | p _ { k } ^ { s } - p _ { k } ^ { t } | | } \end{array}$ . A small PD value means the two domains are well aligned to each other.
|
| 155 |
+
|
| 156 |
+
Table 3: Ablation studies on DomainNet. Mean and $9 5 \%$ confidence interval are reported.
|
| 157 |
+
|
| 158 |
+
<table><tr><td></td><td></td><td></td><td colspan="2">sketch-real</td><td colspan="2">real-sketch</td></tr><tr><td>ls-t</td><td>lt-s</td><td>aug</td><td>1-shot</td><td>5-shot</td><td>1-shot</td><td>5-shot</td></tr><tr><td>×</td><td>×</td><td>×</td><td>41.90±0.86</td><td>56.95±0.84</td><td>40.23±0.73</td><td>50.41±0.80</td></tr><tr><td>√</td><td>×</td><td>×</td><td>44.83±0.95</td><td>60.87±0.91</td><td>42.86±0.78</td><td>52.16±0.78</td></tr><tr><td>×</td><td>√</td><td>×</td><td>44.45±0.92</td><td>61.97±0.90</td><td>44.20±0.77</td><td>54.83±0.79</td></tr><tr><td>√</td><td>√</td><td>×</td><td>47.59±1.00</td><td>64.32±0.86</td><td>47.01±0.84</td><td>56.68±0.81</td></tr><tr><td>√</td><td>√</td><td>√</td><td>49.18±0.96</td><td>67.14±0.85</td><td>47.54±0.81</td><td>59.10±0.79</td></tr></table>
|
| 159 |
+
|
| 160 |
+
To represent the class separability, for each sample $x _ { i }$ with the class label $y _ { i }$ , we calculate the ratio of its distance to the prototype of class $y _ { i }$ to the distance to the closest neighbouring class prototype. Then the average is computed over all samples in novel classes, which is termed Average Distance Ratio (ADR). Formally, $\begin{array} { r } { A D R = \frac { 1 } { | \mathcal { X } _ { N } | } \sum _ { x _ { i } \in \mathcal { X } _ { \mathcal { N } } } { \frac { | | f ( x _ { i } ) - p _ { y _ { i } } | | } { \operatorname* { m i n } _ { k \neq y _ { i } } | | f ( x _ { i } ) - p _ { k } | | } } } \end{array}$ . When ADR is less than 1, most samples can be correctly classified into their ground-truth classes. We calculate the ADR for the source domain and target domain separately to validate whether the learned representations can generalize across different domains.
|
| 161 |
+
|
| 162 |
+
In experiments, we compare the proposed stabPA approach with a FSL baseline method (Tian et al., 2020) that does not leverage target images, and Basic PA which aligns two domains by simply minimizing the point-to-point distance between prototypes of two domains (Xie et al., 2018). The results are presented in Figure 3 (e)-(g). We can notice that all these methods can achieve lower domain distance as training processes, and Basic PA gets the lowest domain distance at the end. However, Basic PA does not improve the class separability as much as our approach, as shown in Figure 3 (f)-(g). The inferior class separability can be understood that Basic PA merely aims to reduce the feature distance between two domains, without taking account of the intra-class and inter-class distances in the learned feature space. Rather than the global alignment adopted by Basic PA, the proposed stabPA considers the feature-to-prototype distances across different domains and classes, so that the domain alignment and class separability can be improved at the same time.
|
| 163 |
+
|
| 164 |
+
# 5.3.3 ABLATION STUDIES
|
| 165 |
+
|
| 166 |
+
We conduct ablation studies on various components of the stabPA. The results on the DomainNet dataset are shown in Table 3. As all key components are removed, we adopt the baseline method Tian et al. (2020) to train feature extractor with only the source data, which is the first row of the table. When the unlabeled target data are available, applying either source-to-target alignment or target-to-source alignment can improve the performance evidently. Interestingly, we can see that the target-to-source alignment is more effective than the source-to-target alignment (about 1.2 points on average). This is probably because the source prototypes estimated by the ground truth labels are more accurate than the target prototypes estimated by the pseudo labels. Improving the quality of target prototypes may reduce this gap. When combing these two alignments together, we can get better results, indicating that the two kinds of alignment are to some extent complementary to each other. Finally, the best results are obtained by combining the strong data augmentation techniques, verifying that strong data augmentation can further strengthen the cross-domain alignment.
|
| 167 |
+
|
| 168 |
+
# 6 CONCLUSIONS
|
| 169 |
+
|
| 170 |
+
In this work, we have investigated a novel problem in FSL, namely CDCS-FSL, where a domain shift exists between the support set and query set. To tackle this problem, we have proposed stabPA, a prototype-based domain alignment framework to learn compact and aligned representations. On two widely-used multi-domain FSL datasets, we have built benchmarks and compared our approach to multiple elaborated baselines. Extensive experimental results have demonstrated the advantage of our approach. Through more in-depth analysis, we have also validated the generalization capability of the representations learned by stabPA and the effectiveness of each component of the proposed model.
|
| 171 |
+
|
| 172 |
+
# 7 REPRODUCIBILITY STATEMENT
|
| 173 |
+
|
| 174 |
+
We have uploaded the source code as supplemental materials to ensure reproducibility.
|
| 175 |
+
|
| 176 |
+
# REFERENCES
|
| 177 |
+
|
| 178 |
+
Shai Ben-David, John Blitzer, Koby Crammer, Alex Kulesza, Fernando Pereira, and Jennifer Wortman Vaughan. A theory of learning from different domains. Machine Learning, 79(1):151–175, 2010.
|
| 179 |
+
|
| 180 |
+
Yoshua Bengio, Jer´ ome Louradour, Ronan Collobert, and Jason Weston. Curriculum learning. In ˆ International Conference on Machine Learning, 2009.
|
| 181 |
+
|
| 182 |
+
Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In International Conference on Machine Learning, pp. 1597–1607. PMLR, 2020.
|
| 183 |
+
|
| 184 |
+
Wei-Yu Chen, Yen-Cheng Liu, Zsolt Kira, Yu-Chiang Frank Wang, and Jia-Bin Huang. A closer look at few-shot classification. In International Conference on Learning Representations, 2019.
|
| 185 |
+
|
| 186 |
+
Wentao Chen, Chenyang Si, Wei Wang, Liang Wang, Zilei Wang, and Tieniu Tan. Few-shot learning with part discovery and augmentation from unlabeled images. arXiv preprint arXiv:2105.11874, 2021.
|
| 187 |
+
|
| 188 |
+
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, pp. 702–703, 2020.
|
| 189 |
+
|
| 190 |
+
Terrance DeVries and Graham W Taylor. Improved regularization of convolutional neural networks with cutout. arXiv preprint arXiv:1708.04552, 2017.
|
| 191 |
+
|
| 192 |
+
Chelsea Finn, Pieter Abbeel, and Sergey Levine. Model-agnostic meta-learning for fast adaptation of deep networks. In International Conference on Machine Learning, pp. 1126–1135. PMLR, 2017.
|
| 193 |
+
|
| 194 |
+
Yaroslav Ganin, Evgeniya Ustinova, Hana Ajakan, Pascal Germain, Hugo Larochelle, Franc¸ois Laviolette, Mario Marchand, and Victor Lempitsky. Domain-adversarial training of neural networks. The Journal of Machine Learning Research, 17(1):2096–2030, 2016.
|
| 195 |
+
|
| 196 |
+
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.
|
| 197 |
+
|
| 198 |
+
Arthur Gretton, Karsten Borgwardt, Malte Rasch, Bernhard Scholkopf, and Alex Smola. A kernel ¨ method for the two-sample-problem. Advances in Neural Information Processing Systems, 19: 513–520, 2006.
|
| 199 |
+
|
| 200 |
+
Yanyang Gu, Zongyuan Ge, C Paul Bonnington, and Jun Zhou. Progressive transfer learning and adversarial domain adaptation for cross-domain skin disease classification. IEEE Journal of Biomedical and Health Informatics, 24(5):1379–1393, 2019.
|
| 201 |
+
|
| 202 |
+
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.
|
| 203 |
+
|
| 204 |
+
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.
|
| 205 |
+
|
| 206 |
+
Ran He, Xiang Wu, Zhenan Sun, and Tieniu Tan. Wasserstein cnn: Learning invariant features for nir-vis face recognition. IEEE Transactions on Pattern Analysis and Machine Intelligence, 41(7): 1761–1773, 2018.
|
| 207 |
+
|
| 208 |
+
Judy Hoffman, Eric Tzeng, Taesung Park, Jun-Yan Zhu, Phillip Isola, Kate Saenko, Alexei Efros, and Trevor Darrell. Cycada: Cycle-consistent adversarial domain adaptation. In International Conference on Machine Learning, pp. 1989–1998. PMLR, 2018.
|
| 209 |
+
|
| 210 |
+
Jaekyeom Kim, Hyoungseok Kim, and Gunhee Kim. Model-agnostic boundary-adversarial sampling for test-time generalization in few-shot learning. In Proceedings of the European conference on computer vision (ECCV), pp. 599–617. Springer, 2020.
|
| 211 |
+
|
| 212 |
+
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 213 |
+
|
| 214 |
+
Kwonjoon Lee, Subhransu Maji, Avinash Ravichandran, and Stefano Soatto. Meta-learning with differentiable convex optimization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2019.
|
| 215 |
+
|
| 216 |
+
Jiawei Liu, Zheng-Jun Zha, Di Chen, Richang Hong, and Meng Wang. Adaptive transfer network for cross-domain person re-identification. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, June 2019.
|
| 217 |
+
|
| 218 |
+
Mingsheng Long, ZHANGJIE CAO, Jianmin Wang, and Michael I Jordan. Conditional adversarial domain adaptation. In Advances in Neural Information Processing Systems, 2018a.
|
| 219 |
+
|
| 220 |
+
Mingsheng Long, Zhangjie Cao, Jianmin Wang, and Michael I Jordan. Conditional adversarial domain adaptation. In Advances in Neural Information Processing Systems, pp. 1645–1655, 2018b.
|
| 221 |
+
|
| 222 |
+
Jiquan Ngiam, Daiyi Peng, Vijay Vasudevan, Simon Kornblith, Quoc V Le, and Ruoming Pang. Domain adaptive transfer learning with specialist models. arXiv preprint arXiv:1811.07056, 2018.
|
| 223 |
+
|
| 224 |
+
Yingwei Pan, Ting Yao, Yehao Li, Yu Wang, Chong-Wah Ngo, and Tao Mei. Transferrable prototypical networks for unsupervised domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2239–2247, 2019.
|
| 225 |
+
|
| 226 |
+
Xingchao Peng, Qinxun Bai, Xide Xia, Zijun Huang, Kate Saenko, and Bo Wang. Moment matching for multi-source domain adaptation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 1406–1415, 2019.
|
| 227 |
+
|
| 228 |
+
Cheng Perng Phoo and Bharath Hariharan. Self-training for few-shot transfer across extreme task differences. In International Conference on Learning Representations, 2021.
|
| 229 |
+
|
| 230 |
+
Siyuan Qiao, Chenxi Liu, Wei Shen, and Alan L Yuille. Few-shot image recognition by predicting parameters from activations. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 7229–7238, 2018.
|
| 231 |
+
|
| 232 |
+
Sachin Ravi and Hugo Larochelle. Optimization as a model for few-shot learning. In International Conference on Learning Representations, 2017.
|
| 233 |
+
|
| 234 |
+
Andrei A. Rusu, Dushyant Rao, Jakub Sygnowski, Oriol Vinyals, Razvan Pascanu, Simon Osindero, and Raia Hadsell. Meta-learning with latent embedding optimization. In International Conference on Learning Representations, 2019.
|
| 235 |
+
|
| 236 |
+
Jake Snell, Kevin Swersky, and Richard Zemel. Prototypical networks for few-shot learning. In Advances in Neural Information Processing Systems, volume 30, 2017.
|
| 237 |
+
|
| 238 |
+
Kihyuk Sohn, David Berthelot, Chun-Liang Li, Zizhao Zhang, Nicholas Carlini, Ekin D Cubuk, Alex Kurakin, Han Zhang, and Colin Raffel. Fixmatch: Simplifying semi-supervised learning with consistency and confidence. arXiv preprint arXiv:2001.07685, 2020.
|
| 239 |
+
|
| 240 |
+
Flood Sung, Yongxin Yang, Li Zhang, Tao Xiang, Philip HS Torr, and Timothy M Hospedales. Learning to compare: Relation network for few-shot learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1199–1208, 2018.
|
| 241 |
+
|
| 242 |
+
Antti Tarvainen and Harri Valpola. Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results. In Advances in Neural Information Processing Systems, volume 30, 2017.
|
| 243 |
+
|
| 244 |
+
Yonglong Tian, Yue Wang, Dilip Krishnan, Joshua B Tenenbaum, and Phillip Isola. Rethinking fewshot image classification: a good embedding is all you need? In Proceedings of the European Conference on Computer Vision (ECCV), 2020.
|
| 245 |
+
|
| 246 |
+
Yi-Hsuan Tsai, Wei-Chih Hung, Samuel Schulter, Kihyuk Sohn, Ming-Hsuan Yang, and Manmohan Chandraker. Learning to adapt structured output space for semantic segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 7472–7481, 2018.
|
| 247 |
+
|
| 248 |
+
Hung-Yu Tseng, Hsin-Ying Lee, Jia-Bin Huang, and Ming-Hsuan Yang. Cross-domain few-shot classification via learned feature-wise transformation. In International Conference on Learning Representations, 2020.
|
| 249 |
+
|
| 250 |
+
Laurens Van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of Machine Learning Research, 9(11), 2008.
|
| 251 |
+
|
| 252 |
+
Hemanth Venkateswara, Jose Eusebio, Shayok Chakraborty, and Sethuraman Panchanathan. Deep hashing network for unsupervised domain adaptation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5018–5027, 2017.
|
| 253 |
+
|
| 254 |
+
Ricardo Vilalta and Youssef Drissi. A perspective view and survey of meta-learning. Artificial Intelligence Review, 18(2):77–95, 2002.
|
| 255 |
+
|
| 256 |
+
Shaoan Xie, Zibin Zheng, Liang Chen, and Chuan Chen. Learning semantic representations for unsupervised domain adaptation. In International Conference on Machine Learning, pp. 5423– 5432. PMLR, 2018.
|
| 257 |
+
|
| 258 |
+
Chi Zhang, Yujun Cai, Guosheng Lin, and Chunhua Shen. Deepemd: Few-shot image classification with differentiable earth mover’s distance and structured classifiers. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, June 2020.
|
| 259 |
+
|
| 260 |
+
Pan Zhang, Bo Zhang, Ting Zhang, Dong Chen, Yong Wang, and Fang Wen. Prototypical pseudo label denoising and target structure learning for domain adaptive semantic segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12414– 12424, 2021.
|
| 261 |
+
|
| 262 |
+
Qiming Zhang, Jing Zhang, Wei Liu, and Dacheng Tao. Category anchor-guided unsupervised domain adaptation for semantic segmentation. In Advances in Neural Information Processing Systems, volume 32, 2019.
|
| 263 |
+
|
| 264 |
+
Zhedong Zheng and Yi Yang. Rectifying pseudo label learning via uncertainty estimation for domain adaptive semantic segmentation. International Journal of Computer Vision, 129(4):1106–1120, 2021.
|
| 265 |
+
|
| 266 |
+
# A APPENDIX
|
| 267 |
+
|
| 268 |
+
# A.1 IMPLEMENTATION DETAILS
|
| 269 |
+
|
| 270 |
+
Hyperparameters. In our implementation, ResNet-18 (He et al., 2016) is adopted as the backbone, which outputs a 512-d feature vector. Before feeding the vector for prototypical alignment, we apply $\ell _ { 2 }$ normalization for the feature vector and prototypes. The temperature $\tau$ for $\ell _ { s - t }$ and $\ell _ { t - s }$ is 0.25 and 0.1, respectively. To control the loss weight for $\ell _ { s - t }$ , $T _ { m a x }$ and $\alpha$ are set as 50,000 and 7, respectively. The loss weight for $\ell _ { t - s }$ is fitted adaptively by setting the confidence threshold $\beta = 0 . 5$ . We set $\lambda = 0 . 2$ to balance the pseudo label generated by the initial classifier and the online updated classifier. The momentum term $m$ is set as 0.99.
|
| 271 |
+
|
| 272 |
+
Training. We train our approach for 50 epochs on the DomainNet dataset. On the smaller OfficeHome dataset, we train the model for 100 epochs. Adam (Kingma & Ba, 2014) is adopted as the default optimizer with the learning rate as 1e-3. The batch size is set as 256, where source data and target data have the same number in a batch.
|
| 273 |
+
|
| 274 |
+
Evaluation. During evaluation, we fix the feature extractor and apply $\ell _ { 2 }$ normalization to the output feature vector. The linear classification head for each few-shot task (episode) is randomly initialized, and trained on the support features for 1000 steps with logistic regression. 15 query samples per class are used to evaluate the performance of the learned classifier. We finally report the average accuracy over 600 episodes with $9 5 \%$ confidence interval.
|
| 275 |
+
|
| 276 |
+
ProtoNet and RelationNet. ProtoNet and RelationNet are two meta-learning methods, which are trained on a series of few-shot tasks (episodes). During training, we randomly sample episodes from the base set, each of which contains $N = 5$ classes and $K = 5$ samples per class serving as the support set, and another 15 samples per class as the query set. We also train ProtoNet and RelationNet for 50 epochs on the DomainNet dataset and 100 epochs on the Office-Home dataset. The number of training episodes of each epoch is particularly defined to make sure the number of seen samples (both the support and query samples) in an epoch is roughly equal to the size of the dataset.
|
| 277 |
+
|
| 278 |
+
MetaOptNet. MetaOptNet aims to learn an embedding function that generalizes well to novel categories under the linear classification rule. We implement this method based on the official code 1 but replace the backbone network and optimizer to be the same as our approach. Similar to ProtoNet and RelationNet, the training process of MetaOptNet is also episodic.
|
| 279 |
+
|
| 280 |
+
Tian et al. Tian et al. (2020) follows the transfer learning paradigm, which trains a base model to classify base classes, and leverage the learned representations to classify novel classes by learning a new classification head. We train this baseline with the same optimization method as our approach except that the batch size is set as 128 as only source data are used for training.
|
| 281 |
+
|
| 282 |
+
DeepEMD. DeepEMD contains two training phases: pre-training and meta-training. We use the output model of Tian et al. as the pre-trained model and then follow the official implementation 2 to finetune the model via meta-training.
|
| 283 |
+
|
| 284 |
+
DANN. We use a three-layer fully connected network as the domain discriminator to implement DANN, following the Pytorch implementation 3 released by Long et al. (2018b). The gradient reverse layer (Ganin et al., 2016) is adopted to train the feature vector and domain discriminator in an adversarial manner. To stabilize training, the weight of the adversarial loss starts from zero, and gradually grows to one.
|
| 285 |
+
|
| 286 |
+
Mean Teacher, Fixmatch and STARTUP. All of these approaches use pseudo-labeled samples to train the model. Differently, Mean Teacher predicts pseudo labels with a teacher network that is the ensemble of historical models by aggregating their model weights with exponential moving average (EMA). In our implementation, the smoothing coefficient for EMA is set as 0.99. Fixmatch trains the model with a consistency loss, i.e., enforcing the network prediction for a strongly augmented sample to be consistent with the prediction of its weakly augmented counterpart. We implement Fixmatch based on a publicly available implementation4. STARTUP adopts fixed pseudo labels that are predicted by a classifier pre-trained on the base set, and imposes a self-supervised loss on the target data. In our re-implementation, we do not utilize the self-supervised loss item since we find that it does not provide improvement in our case.
|
| 287 |
+
|
| 288 |
+
# A.2 PSEUDO LABEL UPDATE STRATEGY
|
| 289 |
+
|
| 290 |
+
Since we resort to pseudo labels for prototype estimation and feature alignment, ensuring the pseudo label accuracy is very important to the effectiveness of our bi-directional prototypical alignment strategy. Pseudo labels can be predicted with a fixed classifier pre-trained on the source base dataset, as in Phoo & Hariharan (2021), or a classifier that is online updated along the representation learning. In our implementation, we combine them together by linearly interpolating their pseudo labels.
|
| 291 |
+
|
| 292 |
+
Table 4: The impact of interpolation coefficient $\lambda$ .
|
| 293 |
+
|
| 294 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">入</td><td colspan="2">painting-real</td><td colspan="2">real-painting</td></tr><tr><td>1-shot</td><td>5-shot</td><td>1-shot</td><td>5-shot</td></tr><tr><td rowspan="3">ls-t</td><td>0.0</td><td>48.56±1.04</td><td>66.24±0.92</td><td>48.89±0.85</td><td>58.72±0.79</td></tr><tr><td>0.2</td><td>48.76±0.99</td><td>67.21±0.91</td><td>49.08±0.84</td><td>59.33±0.77</td></tr><tr><td>1.0</td><td>48.20±0.99</td><td>65.79±0.90</td><td>48.79±0.87</td><td>57.51±0.79</td></tr><tr><td rowspan="3">lt-s</td><td>0.0</td><td>47.83±1.01</td><td>66.30±0.92</td><td>48.26±0.83</td><td>59.17±0.77</td></tr><tr><td>0.2</td><td>48.53±1.02</td><td>67.09±0.94</td><td>48.88±0.84</td><td>60.18±0.80</td></tr><tr><td>1.0</td><td>48.93±1.01</td><td>67.12±0.94</td><td>48.53±0.86</td><td>59.29±0.80</td></tr><tr><td rowspan="3">ls-t&lt-s</td><td>0.0</td><td>48.35±1.02</td><td>66.96±0.91</td><td>48.72±0.84</td><td>59.78±0.78</td></tr><tr><td>0.2</td><td>49.31±1.06</td><td>68.15±0.92</td><td>49.63±0.84</td><td>60.13±0.79</td></tr><tr><td>1.0</td><td>48.74±1.02</td><td>66.81±0.93</td><td>49.26±0.87</td><td>59.33±0.81</td></tr></table>
|
| 295 |
+
|
| 296 |
+
When the interpolation coefficient $\lambda = 0$ (or1), our approach degenerates to only using the fixed (or online updated) classifier. We assess the effectiveness of this combining strategy on the DomainNet dataset. The results are shown in Table 4.
|
| 297 |
+
|
| 298 |
+
For the source-to-target alignment, we can see that interpolation with $\lambda = 0 . 2$ is better than both the fixed and online updated classifier. For the target-to-source alignment, $\lambda = 0 . 2$ and $\lambda = 1$ compete with each other, but both are better than $\lambda = 0$ . When applying alignment from two directions to form our final model, the use of combined pseudo labels is still better than using either of them. The reason for the success of the combination is that the pseudo labels predicted by online updated classifier will change constantly especially in early training stage, which disturbs the model training. Interpolation with the fixed pseudo labels can make the pseudo labels more consistent. On the other hand, the pseudo labels predicted by current classifier can rectify the noise in the fixed pseudo labels, as demonstrated in Zhang et al. (2021).
|
| 299 |
+
|
| 300 |
+
# A.3 DATASET PARTITION
|
| 301 |
+
|
| 302 |
+
# A.3.1 DOMAINNET
|
| 303 |
+
|
| 304 |
+
DomainNet contains 345 categories in total. We discard 19 categories with too few images and randomly split the rest 326 categories into three sets: 228 categories for the base set, 33 categories for the validation set, and 65 categories for the novel set. The detailed categories of each set are listed below:
|
| 305 |
+
|
| 306 |
+
$$
|
| 307 |
+
\mathcal { D } _ { b a s e } =
|
| 308 |
+
$$
|
| 309 |
+
|
| 310 |
+
{aircraft carrier, airplane, alarm clock, ambulance, animal migration, ant, asparagus, axe, backpack, bat, bathtub, beach, bear, beard, bee, belt, bench, bicycle, binoculars, bird, book, boomerang, bottlecap, bowtie, bracelet, brain, bread, bridge, broccoli, broom, bus, butterfly, cactus, cake, calculator, camera, candle, cannon, canoe, car, cat, ceiling fan, cell phone, cello, chair, church, circle, clock, cloud, coffee cup, computer, couch, cow, crab, crayon, crocodile, cruise ship, diamond, dishwasher, diving board, donut, dragon, dresser, drill, drums, duck, ear, elbow, elephant, envelope, eraser, eye, fan, feather, fence, finger, fire hydrant, fireplace, firetruck, flamingo, flashlight, flip flops, flower, flying saucer, foot, fork, frog, frying pan, giraffe, goatee, grapes, grass, guitar, hamburger, hammer, hand, harp, headphones, hedgehog, helicopter, helmet, hockey puck, hockey stick, horse, hot air balloon, hot tub, hourglass, hurricane, jacket, key, keyboard, knee, ladder, lantern, laptop, leaf, leg, light bulb, lighter, lightning, lion, lobster, lollipop, mailbox, marker, matches, megaphone, mermaid, microphone, microwave, moon, motorbike, moustache, nail, necklace, nose, octagon, oven, paint can, paintbrush, palm tree, panda, pants, paper clip, parachute, parrot, passport, peanut, pear, peas, pencil, penguin, pickup truck, picture frame, pizza, pliers, police car, pond, popsicle, postcard, potato, power outlet, purse, rabbit, radio, rain, rainbow, rake, remote control, rhinoceros, rifle, sailboat, school bus, scorpion, screwdriver, see saw, shoe, shorts, skateboard, skyscraper, smiley face, snail, snake, snorkel, soccer ball, sock, stairs, stereo, stethoscope, stitches, stove, strawberry, submarine, sweater, swing set, sword, t-shirt, table, teapot, teddy-bear, television, tent, the Eiffel Tower, the Mona Lisa, toaster, toe, toilet, tooth, toothbrush, tornado, tractor, train, tree, triangle, trombone, truck, underwear, van, vase, violin, washing machine, watermelon, waterslide, whale, wheel, windmill, wine bottle, zigzag}
|
| 311 |
+
|
| 312 |
+
$$
|
| 313 |
+
\mathcal { V } _ { v a l i d a t i o n } =
|
| 314 |
+
$$
|
| 315 |
+
|
| 316 |
+
{arm, birthday cake, blackberry, bulldozer, campfire, chandelier, cooler, cup, dumbbell, hexagon, hospital, house plant, ice cream, jail, lighthouse, lipstick, mushroom, octopus, raccoon, roller coaster, sandwich, saxophone, scissors, skull, speedboat,
|
| 317 |
+
|
| 318 |
+
spreadsheet, suitcase, swan, telephone, traffic light, trumpet, wine glass, wristwatch}
|
| 319 |
+
|
| 320 |
+
$$
|
| 321 |
+
\mathcal { 3 } _ { n o v e l } =
|
| 322 |
+
$$
|
| 323 |
+
|
| 324 |
+
{anvil, banana, bandage, barn, basket, basketball, bed, blueberry, bucket, camel, carrot, castle, clarinet, compass, cookie, dog, dolphin, door, eyeglasses, face, fish, floor lamp, garden, garden hose, golf club, hat, hot dog, house, kangaroo, knife, map, monkey, mosquito, mountain, mouth, mug, ocean, onion, owl, piano, pig, pillow, pineapple, pool, river, rollerskates, sea turtle, sheep, shovel, sink, sleeping bag, spider, spoon, squirrel, steak, streetlight, string bean, syringe, tennis racquet, the Great Wall of China, tiger, toothpaste, umbrella, yoga, zebra}
|
| 325 |
+
|
| 326 |
+
# A.3.2 OFFICE-HOME
|
| 327 |
+
|
| 328 |
+
There are 65 categories in the Office-Home dataset. We select 40 categories as the base set, 10 categories as the validation set, and 15 categories as the novel set, which are listed below:
|
| 329 |
+
|
| 330 |
+
$$
|
| 331 |
+
\mathcal { D } _ { b a s e } =
|
| 332 |
+
$$
|
| 333 |
+
|
| 334 |
+
{alarm clock, bike, bottle, bucket, calculator, calendar, chair, clipboards, curtains, desk lamp, eraser, exit sign, fan, file cabinet, folder, glasses, hammer, kettle, keyboard, lamp shade, laptop, monitor, mouse, mug, paper clip, pen, pencil, postit notes, printer, radio, refrigerator, scissors, sneakers, speaker, spoon, table, telephone, toothbrush, toys, tv}
|
| 335 |
+
|
| 336 |
+
$$
|
| 337 |
+
\mathcal { V } _ { v a l i d a t i o n } =
|
| 338 |
+
$$
|
| 339 |
+
|
| 340 |
+
{bed, computer, couch, flowers, marker, mop, notebook, pan, shelf, soda}
|
| 341 |
+
|
| 342 |
+
$$
|
| 343 |
+
\mathcal { 3 } _ { n o v e l } =
|
| 344 |
+
$$
|
| 345 |
+
|
| 346 |
+
{backpack, batteries, candles, drill, flipflops, fork, helmet, knives, oven, push pin, ruler, screwdriver, sink, trash can, webcam}
|
md/dev/Ms6QZafNv01/Ms6QZafNv01.md
ADDED
|
@@ -0,0 +1,493 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Optimal algorithms for group distributionally robust optimization and beyond
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 Distributionally robust optimization (DRO) can improve the robustness and fairness
|
| 11 |
+
2 of learning methods. In this paper, we devise stochastic algorithms for a class
|
| 12 |
+
3 of DRO problems including group DRO, subpopulation fairness, and empirical
|
| 13 |
+
4 conditional value at risk (CVaR) optimization. Our new algorithms achieve faster
|
| 14 |
+
5 convergence rates than existing algorithms for multiple DRO settings. We also
|
| 15 |
+
6 provide a new information-theoretic lower bound that implies our bounds are tight
|
| 16 |
+
7 for group DRO. Empirically, too, our algorithms outperform known methods.
|
| 17 |
+
|
| 18 |
+
# 8 1 Introduction
|
| 19 |
+
|
| 20 |
+
9 Commonly, machine learning models are trained to optimize the average performance. However,
|
| 21 |
+
10 such models may not perform equally well among all demographic subgroups due to a hidden bias in
|
| 22 |
+
11 the training set or distribution shift in training and test phases [Hovy and Søgaard, 2015; Hashimoto
|
| 23 |
+
12 et al., 2018; Martinez et al., 2021; Duchi and Namkoong, 2021]. Biases in datasets are also directly
|
| 24 |
+
13 related to fairness concerns in machine learning [Buolamwini and Gebru, 2018; Jurgens et al., 2017].
|
| 25 |
+
14 Recently, various algorithms based on distributionally robust optimization (DRO) have been proposed
|
| 26 |
+
15 to address these problems [Hovy and Søgaard, 2015; Hashimoto et al., 2018; Hu et al., 2018; Oren et
|
| 27 |
+
16 al., 2019; Williamson and Menon, 2019; Sagawa et al., 2020; Curi et al., 2020; Zhang et al., 2021;
|
| 28 |
+
17 Martinez et al., 2021; Duchi and Namkoong, 2021]. However, these algorithms are often highly
|
| 29 |
+
18 tailored to each specific DRO formulation. Furthermore, it is often unclear whether these proposed
|
| 30 |
+
19 algorithms are optimal in terms of the convergence rate. Are there a unified algorithmic methodology
|
| 31 |
+
20 and a lower bound for these problems?
|
| 32 |
+
21 Contributions. In this paper, we study a general class of DRO problems, which includes group
|
| 33 |
+
22 DRO [Hu et al., 2018; Oren et al., 2019; Sagawa et al., 2020], subpopulation fairness [Martinez et
|
| 34 |
+
23 al., 2021], conditional value at risk (CVaR) optimization [Curi et al., 2020], and many others. Let
|
| 35 |
+
24 $\boldsymbol \Theta \subseteq \mathbb { R } ^ { n }$ be a convex set of model parameters and $\ell ( \theta ; z ) : \Theta \to \mathbb { R } _ { + }$ be a convex loss of the model
|
| 36 |
+
25 with parameter $\theta$ with respect to data point $z$ . The data point $z$ may be drawn from one out of $m$
|
| 37 |
+
26 distributions $P _ { 1 } , \ldots , P _ { m }$ which are accessible via a stochastic oracle that returns an i.i.d. sample
|
| 38 |
+
27 $z \sim P _ { i }$ . Let $Q$ be a convex subset of the probability simplex in $\mathbb { R } ^ { m }$ that contains the uniform vector,
|
| 39 |
+
28 i.e., $( 1 / m , \ldots , 1 / m ) \in Q$ . Our DRO formulation is as follows:
|
| 40 |
+
|
| 41 |
+
$$
|
| 42 |
+
\operatorname* { m i n } _ { \theta \in \Theta } \operatorname* { m a x } _ { q \in Q } \sum _ { i = 1 } ^ { m } q _ { i } \operatorname* { \bf { E } } _ { z \sim P _ { i } } [ \ell ( \theta ; z ) ] .
|
| 43 |
+
$$
|
| 44 |
+
|
| 45 |
+
29 If $Q$ are the probability simplex and scaled $k$ -set polytope, we can recover group DRO [Sagawa et
|
| 46 |
+
30 al., 2020] and subpopulation fairness [Martinez et al., 2021], respectively. Moreover, we formulate
|
| 47 |
+
31 a new, more general fairness concept based on weighted rankings with $Q$ being a permutahedron,
|
| 48 |
+
32 which includes these special cases; see Section 2 for details.
|
| 49 |
+
|
| 50 |
+
Submitted to 36th Conference on Neural Information Processing Systems (NeurIPS 2022). Do not distribute.
|
| 51 |
+
|
| 52 |
+
Table 1: Summary of convergence results for group DRO. Here, $m$ denotes the number of groups, $n$ the dimension of $\theta$ , $G$ the Lipschitz constant of loss function $\ell$ , $D$ the diameter of feasible set $\Theta$ , $M$ the range of loss function $\ell$ , and $T$ the number of calls to stochastic oracle.
|
| 53 |
+
|
| 54 |
+
<table><tr><td>reference</td><td>convergence rate E[εr]</td><td>iteration complexity</td><td>lower bound</td><td></td></tr><tr><td>[Sagawa et al., 2020]</td><td>0(m</td><td>G2 D²+M2 log m T</td><td>O(m + n) + proj. onto Θ</td><td rowspan="3">( G²D²+M2m T (Theorem 5)</td></tr><tr><td>Ours (Theorem 2)</td><td></td><td>T</td><td>O(m + n) + proj. onto Θ</td></tr><tr><td>Ours (Theorem 3)</td><td>0(√</td><td>G²D²+M²m) T</td><td>O(m + n) + proj. onto Θ + solving scalar equation</td></tr></table>
|
| 55 |
+
|
| 56 |
+
33 For our general DRO, we devise an efficient stochastic gradient algorithm. Furthermore, we show that
|
| 57 |
+
34 it achieves the information-theoretic optimal convergence rate for group DRO. Our main technical
|
| 58 |
+
35 contributions are as follows;
|
| 59 |
+
|
| 60 |
+
• We provide a generic stochastic gradient algorithm for our general DRO. By specializing it in the group DRO setting, we provide two algorithms (GDRO-EXP3 and GDRO-TINF)√ that improve the rate of Sagawa et al. [2020] by a factor of $\Omega ( { \sqrt { m } } )$ with the almost same complexity per iteration; see Table 1. Furthermore, our generic algorithm can be specialized to improve the convergence rate of Curi et al. [2020] for subpopulation fairness (a.k.a. empirical CVaR optimization). Finally, we show that our algorithm runs efficiently if $Q$ is a permutahedron, which includes all aforementioned subclasses.
|
| 61 |
+
• We prove a matching information-theoretic lower bound for the convergence rate of group DRO. This implies that no algorithm can improve the convergence rate of GDRO-TINF (up to a constant factor). To the best of our knowledge, this is the first information-theoretic lower bound for group DRO.
|
| 62 |
+
• Our experiments on real-world and synthetic datasets show that our algorithms also empirically outperform the known algorithm, supporting our theoretical analysis.
|
| 63 |
+
|
| 64 |
+
# 49 1.1 Our techniques
|
| 65 |
+
|
| 66 |
+
50 Algorithms. The core idea of our algorithms is stochastic no-regret dynamics [Hazan, 2016]. We
|
| 67 |
+
51 regard DRO (1) as a two-player zero-sum game between a player who picks $\theta \in \Theta$ and another player
|
| 68 |
+
52 who picks $q \in Q$ . The two players iteratively update their solution using online learning algorithms;
|
| 69 |
+
53 in particular, we will use online gradient descent (OGD) [Zinkevich, 2003] and online mirror descent
|
| 70 |
+
54 (OMD) [Cesa-Bianchi and Lugosi, 2006] for the $\theta$ -player and $q$ -player, respectively. In addition, we
|
| 71 |
+
55 need to estimate gradients for both players, since the objective function of our DRO is stochastic and
|
| 72 |
+
56 we cannot obtain exact gradients.
|
| 73 |
+
57 The convergence rate of stochastic no-regret dynamics depends on the expected regret of OGD and
|
| 74 |
+
58 OMD. To obtain the optimal convergence rate, we must carefully choose the regularizer in OMD as
|
| 75 |
+
59 well as gradient estimators, exploiting the structure of our DRO. In particular, we need to balance
|
| 76 |
+
60 the variance of gradient estimators and the diameter terms in both OGD and OMD. This is the most
|
| 77 |
+
61 challenging part of the algorithm design. Inspired by adversarial multi-armed bandit algorithms,
|
| 78 |
+
62 we design gradient estimators for no-regret dynamics of OGD and OMD in our DRO. Indeed, our
|
| 79 |
+
63 algorithms for group DRO (GDRO-EXP3 and GDRO-TINF) are based on adversarial multi-armed
|
| 80 |
+
64 bandit algorithms, EXP3 [Auer et al., 2003] and Tsallis-INF [Zimmert and Seldin, 2021], respectively,
|
| 81 |
+
65 hence the name. Although each building block (OGD, OMD, and gradient estimators) is fairly known
|
| 82 |
+
66 in the literature, we need to put them together in the right combination to obtain the optimal rate.
|
| 83 |
+
67 Lower bound. For the lower bound, we carefully design a family of group DRO instances for which
|
| 84 |
+
68 any algorithm requires a certain number of queries to achieve a good objective value. To bound
|
| 85 |
+
69 the number of queries, we use information-theoretic tools such as Le Cam’s lemma and bound the
|
| 86 |
+
70 Kullback-Leibler divergence between Bernoulli distributions. Such tools are also used at the heart of
|
| 87 |
+
71 lower bounds for stochastic convex optimization [Agarwal et al., 2012] and adversarial multi-armed
|
| 88 |
+
72 bandits [Auer et al., 2003], but the connection to those settings is much more subtle here, and our
|
| 89 |
+
73 construction is specifically designed for group DRO-type problems.
|
| 90 |
+
75 DRO is a wide field ranging from robust optimization to machine learning and statistics [Goh and Sim,
|
| 91 |
+
76 2010; Bertsimas et al., 2018], whose original idea dates back to Scarf [1958]. Popular choices of the
|
| 92 |
+
77 uncertainty set in DRO include balls around an empirical distribution in Wasserstein distance [Esfahani
|
| 93 |
+
78 and Kuhn, 2018; Blanchet et al., 2019], $f$ -divergence [Namkoong and Duchi, 2016; Duchi and
|
| 94 |
+
79 Namkoong, 2021], $\chi ^ { 2 }$ -divergence [Staib et al., 2019], and maximum mean discrepancy [Staib and
|
| 95 |
+
80 Jegelka, 2019; Kirschner et al., 2020].
|
| 96 |
+
81 DRO algorithms have been mainly studied for the offline setting, i.e., algorithms can access all data
|
| 97 |
+
82 points of the empirical distribution. Note that our DRO is not offline because the group distributions
|
| 98 |
+
83 are given by the stochastic oracles. Namkoong and Duchi [2016] proposed stochastic gradient
|
| 99 |
+
84 algorithms for offline DRO with $f$ -divergence uncertainty sets. Curi et al. [2020] used no-regret
|
| 100 |
+
85 dynamics for empirical CVaR minimization. Their algorithm invokes sampling from $k$ -DPP in each
|
| 101 |
+
86 iteration, which is more computationally demanding than our algorithm. Furthermore, our algorithm
|
| 102 |
+
87 gets rid of an $O ( \log m )$ factor in the convergence rate using the Tsallis entropy regularizer; see
|
| 103 |
+
88 Theorem 4. Qi et al. [2021]; Jin et al. [2021] devised stochastic gradient algorithms for several DRO
|
| 104 |
+
89 with non-convex losses.
|
| 105 |
+
90 Agarwal et al. [2012] gave a lower bound for stochastic convex optimization, which is a special case
|
| 106 |
+
91 of our DRO with only one distribution. Recently, Carmon et al. [2021] showed a lower bound for
|
| 107 |
+
92 minimax problem $\begin{array} { r } { \operatorname* { m i n } _ { x } \operatorname* { m a x } _ { i = 1 } ^ { m } f _ { i } ( x ) } \end{array}$ for non-stochastic Lipschitz convex $f _ { i }$ . Our lower bound deals
|
| 108 |
+
93 with the stochastic functions, so this result does not apply.
|
| 109 |
+
94 In this paper, we assume that the group information is given in advance. However, the group
|
| 110 |
+
95 information might not be easy to define in practice. Bao et al. [2021] propose a simple method to
|
| 111 |
+
96 define groups for classification problems based on mistakes of models in the training phase. Their
|
| 112 |
+
97 method often generates group DRO instances with large $m$ . Our algorithms are more efficient for
|
| 113 |
+
98 such group DRO thanks to the better dependence on $m$ in the convergence rate.
|
| 114 |
+
99 No-regret dynamics is a well-studied method for solving two-player zero-sum games [Cesa-Bianchi
|
| 115 |
+
100 and Lugosi, 2006]. For non-stochastic convex-concave games, one can achieve $O ( 1 / T )$ convergence
|
| 116 |
+
101 via predictable sequences [Rakhlin and Sridharan, 2013]. This result does not apply to our setting
|
| 117 |
+
102 because our DRO is a stochastic game.
|
| 118 |
+
103 Notations. Throughout the paper, $m$ denotes the number of distributions (groups) and $n$ denotes
|
| 119 |
+
104 the dimension of a variable $\theta$ . For a positive integer $m$ , we write $[ m ] : = \{ 1 , \ldots , m \}$ . The orthogonal
|
| 120 |
+
105 projection onto set $\Theta$ is denoted by $\mathrm { p r o j } _ { \Theta }$ . The ith standard unit vector is denoted by $\mathbf { e } _ { i }$ and the
|
| 121 |
+
106 all-one vector is denoted by 1. The probability simplex in $\mathbb { R } ^ { m }$ is denoted by $\Delta _ { m }$ .
|
| 122 |
+
|
| 123 |
+
# 107 2 Examples contained in our general DRO
|
| 124 |
+
|
| 125 |
+
108 In this section, we show how several DRO formulations in the literature can be phrased in our general
|
| 126 |
+
109 DRO formulation (1). In addition, we propose a novel fairness constraint based on weighted rankings
|
| 127 |
+
110 using our general DRO.
|
| 128 |
+
111 Group DRO. When $Q$ equals the probablility simplex, we obtain group DRO [Hu et al., 2018;
|
| 129 |
+
112 Oren et al., 2019; Sagawa et al., 2020]:
|
| 130 |
+
|
| 131 |
+
$$
|
| 132 |
+
\operatorname* { m i n } _ { \theta \in \Theta } \operatorname* { m a x } _ { i = 1 } ^ { m } \ \underset { z \sim P _ { i } } { \mathbf { E } } [ \ell ( \theta ; z ) ] .
|
| 133 |
+
$$
|
| 134 |
+
|
| 135 |
+
113 That is, group DRO aims to minimize the expected loss in the worst group, thereby ensuring better
|
| 136 |
+
114 performance across all groups.
|
| 137 |
+
115 Empirical CVaR, Subpopulation fairness, Average top- $k$ worst group loss. Group DRO may
|
| 138 |
+
116 yield overly pessimistic solutions. For instance, the groups might be automatically generated by other
|
| 139 |
+
117 algorithms (such as one in Bao et al. [2021]) and there might exist a few “outlier” groups that make
|
| 140 |
+
118 the group DRO objective trivial.
|
| 141 |
+
|
| 142 |
+
119 For such a case, we can restrict $Q$ to a small subset of the probability simplex so that the solution cannot put large weights on a few outlier groups. Especially, let 120 $Q = \left\{ q \in \Delta _ { m } : 0 \leq q _ { i } \leq { \frac { 1 } { p m } } \right\}$ for
|
| 143 |
+
|
| 144 |
+
121 some parameter $p \in ( 0 , 1 )$ , i.e., $Q$ is a scaled $k$ -set polytope. The intuition behind the choice of $Q$
|
| 145 |
+
122 is that, by limiting the largest entry of $q$ to $1 / p m$ , DRO would optimize the expected loss over the
|
| 146 |
+
123 worst $p$ -fraction subgroups of $m$ groups. Therefore, if the fraction of outlier groups is sufficiently
|
| 147 |
+
124 small compared to $p$ , then $p$ -fraction subgroups must contain “inlier” groups as well. Therefore, it is
|
| 148 |
+
125 likely that DRO with $Q$ finds solutions more robust than group DRO.
|
| 149 |
+
126 When $P _ { i }$ is the Dirac measure of data $z _ { i }$ , then the resulting DRO is empirical CVaR optimization [Curi
|
| 150 |
+
127 et al., 2020]. In the fairness context, the same problem is called subpopulation fairness [Williamson
|
| 151 |
+
128 and Menon, 2019; Martinez et al., 2021; Duchi and Namkoong, 2021].
|
| 152 |
+
129 If $p \ = \ m / k$ for some positive integer $k$ , the resulting DRO is the average top- $k$ worst group
|
| 153 |
+
130 loss [Zhang et al., 2021]:
|
| 154 |
+
|
| 155 |
+
$$
|
| 156 |
+
\operatorname* { m i n } _ { \theta \in \Theta } \frac { 1 } { k } \sum _ { i = 1 } ^ { k } L _ { i } ^ { \downarrow } ( \theta ) ,
|
| 157 |
+
$$
|
| 158 |
+
|
| 159 |
+
where 131 $L _ { i } ^ { \downarrow } ( \theta )$ denotes the the $i$ th largest population group loss of $\theta$ . More precisely, let $L _ { i } ( \theta ) =$ 132 $\mathbf { E } _ { z \sim P _ { i } } [ \ell ( \theta ; z ) ]$ for $i \in [ m ]$ and sort them in the non-increasing order: $L _ { 1 } ^ { \downarrow } ( \theta ) \ge \cdots \ge L _ { m } ^ { \downarrow } ( \theta )$ .
|
| 160 |
+
|
| 161 |
+
133 Weighted ranking of group losses. The aforementioned DRO formulations are special cases of the
|
| 162 |
+
134 following DRO, which we call the weighted ranking of group losses. Let $\alpha \in \Delta ^ { m }$ be a fixed vector
|
| 163 |
+
135 with non-increasing entries. Let $Q$ be the permutahedron of $\alpha$ , the convex hull of $( \alpha _ { \sigma ( 1 ) } , \ldots , \alpha _ { \sigma ( m ) } )$
|
| 164 |
+
136 for all permutations $\sigma$ of $[ m ]$ . Then, the resulting DRO is
|
| 165 |
+
|
| 166 |
+
$$
|
| 167 |
+
\operatorname* { m i n } _ { \theta \in \Theta } \sum _ { i = 1 } ^ { m } \alpha _ { i } L _ { i } ^ { \downarrow } ( \theta ) .
|
| 168 |
+
$$
|
| 169 |
+
|
| 170 |
+
137 Group DRO corresponds to $\alpha = ( 1 , 0 , \ldots , 0 )$ and the average top- $k$ worst group losses corresponds 138 to $\alpha \overset { \cdot } { = } ( 1 / k , \ldots , \bar { 1 ^ { \prime } } k , 0 , \ldots , 0 )$ . Another example that is contained in none of the above examples is {zk times
|
| 171 |
+
|
| 172 |
+
139 lexicographic minimax fairness [Diana et al., 2021]. The goal of lexicographical minimax fairness
|
| 173 |
+
140 is to find $\theta \in \Theta$ such that the sequence $( L _ { 1 } ^ { \downarrow } ( \theta ) , \dots , L _ { m } ^ { \downarrow } ( \theta ) )$ is lexicographically minimum. This
|
| 174 |
+
141 corresponds to $\alpha$ with sufficiently varied entries, i.e., $\alpha _ { 1 } \gg \alpha _ { 2 } \gg \cdot \cdot \cdot \gg \alpha _ { m }$ .
|
| 175 |
+
|
| 176 |
+
# 142 3 Algorithms
|
| 177 |
+
|
| 178 |
+
143 In this section, we describe our algorithms. First, we present a generic algorithm for our general
|
| 179 |
+
144 DRO (1) and provide a unified convergence analysis in Section 3.1. Then, we specialize it into two
|
| 180 |
+
145 concrete algorithms for group DRO (2) in Section 3.2. We sketch algorithms for the average of top- $k$
|
| 181 |
+
146 group losses and weighted ranking of group loss in Section 3.3.
|
| 182 |
+
|
| 183 |
+
# 7 3.1 Algorithm for the general case
|
| 184 |
+
|
| 185 |
+
148 We present our algorithm for geranal DRO (1). At a high level, our algorithm can be regarded as
|
| 186 |
+
149 stochastic no-regret dynamics. Let us denote $\begin{array} { r } { L ( \boldsymbol { \theta } , \boldsymbol { q } ) : = \sum _ { i = 1 } ^ { m } q _ { i } \mathbf { E } _ { z \sim P _ { i } } [ \ell ( \boldsymbol { \theta } ; z ) ] } \end{array}$ . Imagine that the
|
| 187 |
+
150 $\theta$ -player and $q$ -player run online algorithms $\scriptstyle A _ { \theta }$ and $A _ { q }$ , respectively, to solve the minimax problem
|
| 188 |
+
151 $\begin{array} { r } { \operatorname* { m i n } _ { \theta \in \Theta } \operatorname* { m a x } _ { q \in Q } L ( \theta , q ) } \end{array}$ . That is, for $t = 1 , \dots , T$ ,
|
| 189 |
+
|
| 190 |
+
• $\theta _ { t } \in \Theta$ and $q _ { t } \in Q$ are determined by $\scriptstyle A _ { \theta }$ and $A _ { q }$ , respectively.
|
| 191 |
+
• Both players feed gradient estimators $\hat { \nabla } _ { \theta , t }$ and $\hat { \nabla } _ { \boldsymbol { q } , t }$ to $\scriptstyle A _ { \theta }$ and $A _ { q }$ , respectively. Here, $\mathbf { E } [ \hat { \nabla } _ { \boldsymbol { \theta } , t } ] = \nabla _ { \boldsymbol { \theta } } L ( \theta _ { t } , q _ { t } )$ and $\mathbf { E } [ \hat { \nabla } _ { q , t } ] = \nabla _ { q } L ( \theta _ { t } , q _ { t } )$ .
|
| 192 |
+
|
| 193 |
+
155 Let
|
| 194 |
+
|
| 195 |
+
$$
|
| 196 |
+
\varepsilon _ { T } : = \operatorname* { m a x } _ { q \in Q } L ( \bar { \theta } _ { 1 : T } , q ) - \operatorname* { m i n } _ { \theta \in \Theta } \operatorname* { m a x } _ { q \in Q } L ( \theta , q )
|
| 197 |
+
$$
|
| 198 |
+
|
| 199 |
+
be the optimality156 convergence rate of the averavia regrets iterand $\begin{array} { r } { \bar { \theta } _ { 1 : T } = \frac { 1 } { T } \sum _ { t = 1 } ^ { T } \theta _ { t } } \end{array}$ . We can bound the eorithms (see Appendix ectedfor a $\mathbf { E } [ \varepsilon _ { T } ]$ $R _ { \theta }$ $R _ { q }$ $\mathbf { A }$ 158 formal definition), i.e.,
|
| 200 |
+
|
| 201 |
+
$$
|
| 202 |
+
\mathbf { E } [ \varepsilon _ { T } ] \leq \frac { \mathbf { E } [ R _ { \theta } ( T ) ] + \mathbf { E } [ R _ { q } ( T ) ] } { T } .
|
| 203 |
+
$$
|
| 204 |
+
|
| 205 |
+
159 We can obtain hence the convergence rate of the above algorithms by investigating the expected regret
|
| 206 |
+
160 bounds of these online algorithms.
|
| 207 |
+
161 To get a concrete algorithm, we must specify the online algorithms $A _ { \theta } , A _ { q }$ as well as the gradient
|
| 208 |
+
162 estimators $\hat { \nabla } _ { \boldsymbol { \theta } , t } , \hat { \nabla } _ { \boldsymbol { q } , t }$ . We use OGD and OMD as $\scriptstyle A _ { \theta }$ and $A _ { q }$ , respectively. We construct the gradient
|
| 209 |
+
163 estimators by sampling $i _ { t } \sim q _ { t }$ and $z \sim P _ { i _ { t } }$ and setting $\hat { \nabla } _ { \boldsymbol { \theta } , t } = \nabla _ { \boldsymbol { \theta } } \ell ( \theta _ { t } ; z )$ and $\begin{array} { r } { \hat { \nabla } _ { q , t } = \frac { \ell ( \theta _ { t } ; z ) } { q _ { t , i _ { t } } } \mathbf { e } _ { i _ { t } } } \end{array}$
|
| 210 |
+
164 This leads to Algorithm 1. There, $\Psi : Q \mathbb { R }$ denotes the regularizer of OMD and $\eta _ { \theta , t }$ and $\eta _ { q }$
|
| 211 |
+
165 denote the step sizes of OGD and OMD, respectively. 1 It turns out that this combination of online
|
| 212 |
+
166 algorithms and gradient estimators yields the best convergence rate (for group DRO) because the
|
| 213 |
+
167 expected regrets of both players are optimal.
|
| 214 |
+
|
| 215 |
+
# Algorithm 1 Algorithm for general DRO (1)
|
| 216 |
+
|
| 217 |
+
Require: initial solution $\theta _ { 1 } \in \Theta$ , number of iterations $T$ , step sizes $\eta _ { \theta , t } > 0 ( t \in [ T ] ) , \eta _ { q } > 0$ , and a strictly convex function $\Psi : Q \mathbb { R }$ .
|
| 218 |
+
1: Let $q _ { 1 } \dot { = } ( 1 / m , \dots , 1 / m )$ .
|
| 219 |
+
2: for $t = 1 , \dots , T$ do
|
| 220 |
+
3: Sample $i _ { t } \sim q _ { t }$ .
|
| 221 |
+
4: Call the stochastic oracle to obtain $z \sim P _ { i _ { t } }$ .
|
| 222 |
+
5: $\theta _ { t + 1 } \mathrm { p r o j } _ { \Theta } ( \theta _ { t } - \eta _ { \theta , t } \nabla _ { \theta } \ell ( \theta _ { t } ; z ) )$
|
| 223 |
+
6: $\begin{array} { r l r } { \nabla \Psi ( \widetilde { q } _ { t + 1 } ) } & { { } } & { \nabla \Psi ( q _ { t } ) \ - \ \frac { \eta _ { q } } { q _ { t , i _ { t } } } \ell ( \theta _ { t } ; z ) \mathbf { e } _ { i _ { t } } } \end{array}$ ; $\begin{array} { r l r } { q _ { t + 1 } } & { { } } & { \arg \operatorname* { m i n } _ { q \in Q } D _ { \Psi } ( q , \tilde { q } _ { t + 1 } ) } \end{array}$ , where $D _ { \Psi } ( x , y ) = \Psi ( x ) - \Psi ( y ) - \nabla \Psi ( x ) ^ { \top } ( y - x )$ is the Bregman divergence with respect to $\Psi$ .
|
| 224 |
+
7: return $\textstyle { \frac { 1 } { T } } \sum _ { t = 1 } ^ { T } \theta _ { t }$ .
|
| 225 |
+
|
| 226 |
+
168 We now analyze the convergence rate of Algorithm 1. We make the following standard assumptions.
|
| 227 |
+
|
| 228 |
+
69 Assumption 1. The loss function $\ell ( \theta ; z )$ is continuously differentiable and $G$ -Lipchitz in $\theta$ , and has
|
| 229 |
+
170 range $[ 0 , M ]$ for all $z$ . The Euclidean diameter of the feasible region $\Theta$ is at most $D$ .
|
| 230 |
+
|
| 231 |
+
The following theorem follows from plugging regret bounds of OGD and OGD, and the construction 2 of the gradient estimators into (3).
|
| 232 |
+
|
| 233 |
+
73 Theorem 1. If $\eta _ { \theta , t }$ is nonincreasing, Algorithm 1 achieves the expected convergence rate
|
| 234 |
+
|
| 235 |
+
$$
|
| 236 |
+
\Im [ \varepsilon _ { T } ] \leq \frac { 1 } { T } \left( \frac { G ^ { 2 } } { 2 } \sum _ { t = 1 } ^ { T } \eta _ { \theta , t } + \frac { D ^ { 2 } } { 2 \eta _ { \theta , T } } + \frac { M ^ { 2 } } { 2 } \eta _ { \theta } \sum _ { t = 1 } ^ { T } \frac { \mathbf { F } } { i _ { t } } \left[ \frac { ( \nabla ^ { 2 } \Psi ( q _ { t } ) ) _ { i _ { t } , i _ { t } } ^ { - 1 } } { q _ { t , i _ { t } } ^ { 2 } } \right] + \frac { \operatorname* { m a x } _ { q ^ { * } \in Q } D _ { \Psi } ( q ^ { * } , \mathbf { 1 } / m ) } { \eta _ { q } } \right) .
|
| 237 |
+
$$
|
| 238 |
+
|
| 239 |
+
174 A formal proof can be found in Appendix B. We will see how specific choices of the regularizer $\Psi$
|
| 240 |
+
175 yield various algorithms and convergence rates for group DRO and others in the next subsections. A
|
| 241 |
+
176 few remarks on the regularizers, step sizes, and projection step are in order.
|
| 242 |
+
177 Regularizer. Although Algorithm 1 works with general $\Psi$ , we can choose a specific regularizer for
|
| 243 |
+
178 $Q$ appearing in applications, e.g, the probability simplex, scaled $k$ -set polytope, or a permutahedron.
|
| 244 |
+
179 In the next subsections, we show that the entropy regularizer $\begin{array} { r } { \Psi ( x ) = \bar { \sum _ { i } } ( x _ { i } \log x _ { i } - \bar { \operatorname { x } _ { i } } ) } \end{array}$ and Tsallis
|
| 245 |
+
180 entropy regularizer $\begin{array} { r } { \Psi ( x ) = 2 ( 1 - \sum _ { i } \sqrt { x _ { i } } ) } \end{array}$ yield efficient algorithms with improved convergence
|
| 246 |
+
181 rates for these cases.
|
| 247 |
+
182 Step sizes. The theorem includes decreasing step sizes such as $\begin{array} { r } { \eta _ { \theta , t } = \frac { D } { m G \sqrt { t } } } \end{array}$ in addition to fixed
|
| 248 |
+
183 step sizes. Decreasing step sizes have the advantage that we do not require the knowledge of $T$
|
| 249 |
+
184 at the beginning of the algorithm but come at the cost of an extra constant factor in the expected
|
| 250 |
+
185 convergence rate. Since both step size policies give the asymptotically same convergence rate, we
|
| 251 |
+
186 describe only fixed step sizes in the theorems in the next subsections. In practice, decreasing step
|
| 252 |
+
187 sizes stabilize the algorithm and often outperform fixed step sizes.
|
| 253 |
+
|
| 254 |
+
Projection step. In general, the Bregman projection argminq∈Q $\mathrm { a r g m i n } _ { q \in Q } D _ { \Psi } ( q , \tilde { q } _ { t + 1 } )$ is convex, but may be costly to compute. For the applications described in Section 2, $\tilde { Q }$ is a permutahedron. In this case,
|
| 255 |
+
|
| 256 |
+
# Algorithm 2 GDRO-EXP3
|
| 257 |
+
|
| 258 |
+
Require: initial solution $\theta _ { 1 } \in \Theta$ , number of iterations $T$ , and step sizes $\eta _ { \theta , t } > 0 \left( t \in [ T ] \right)$ , $\eta _ { q } > 0$ .
|
| 259 |
+
1: Let $q _ { t } = ( 1 / m , \dots , 1 / m )$ .
|
| 260 |
+
2: for $t = 1 , \dots , T$ do
|
| 261 |
+
3: Sample $i _ { t } \sim q _ { t }$ .
|
| 262 |
+
4: Call the stochastic oracle to obtain $z \sim P _ { i _ { t } }$ 5: θt+1 ← projΘ(θt − ηθ,t∇θ\`(θt; z))
|
| 263 |
+
6: q˜t+1 ← qt exp ηq\`(θt;z)eitqt,i
|
| 264 |
+
7: qt+1 ← Pq˜t+1q˜t+1,i .
|
| 265 |
+
8: return 1T PTt=1 θt.
|
| 266 |
+
|
| 267 |
+
# Algorithm 3 GDRO-TINF
|
| 268 |
+
|
| 269 |
+
Require: initial solution $\theta _ { 1 } \in \Theta$ , number of iterations $T$ , and step sizes $\eta _ { \theta , t } > 0 \left( t \in [ T ] \right)$ , $\eta _ { q } > 0$ .
|
| 270 |
+
1: Let $q _ { t } = ( 1 / m , \dots , 1 / m )$ .
|
| 271 |
+
2: for $t = 1 , \dots , T$ do
|
| 272 |
+
3: Sample $i _ { t } \sim q _ { t }$ . 4: Call the stochastic oracle to obtain $z \sim P _ { i _ { t } }$ .
|
| 273 |
+
5: $\begin{array} { r l } & { \theta _ { t + 1 } \gets \mathrm { p r o j } _ { \Theta } ( \theta _ { t } - \eta _ { \theta , t } \nabla _ { \theta } \ell ( \theta _ { t } ; z ) ) } \\ & { \widetilde { q } _ { t + 1 } \gets q _ { t } \left( \mathbf { 1 } - \frac { \eta _ { q } \sqrt { q _ { t } } } { q _ { t , i _ { t } } } \ell ( \theta _ { t } ; z ) \mathbf { e } _ { i _ { t } } \right) ^ { - 2 } } \\ & { \mathrm { C o m p u t e ~ } \quad \alpha \qquad \in \qquad \mathbb { R } \quad \mathrm { s u c h } } \\ & { \sum _ { i = 1 } ^ { m } \left( \sqrt { \widetilde { q } _ { t + 1 , i } } - \alpha \right) ^ { - 2 } = 1 . } \\ & { q _ { t + 1 } \gets \left( \sqrt { \widetilde { q } _ { t + 1 } } - \alpha \mathbf { 1 } \right) ^ { - 2 } } \\ & { \mathrm { t u r n ~ } \frac { 1 } { T } \sum _ { t = 1 } ^ { T } \theta _ { t } . } \end{array}$
|
| 274 |
+
6: 7: that
|
| 275 |
+
8:
|
| 276 |
+
9: return 1T PTt=1 θt.
|
| 277 |
+
|
| 278 |
+
190 it is known that the Bregman projection with respect to the entropy and Tsallis entropy regularizers
|
| 279 |
+
191 can be done in $O ( m \log m )$ time [Lim and Wright, 2016]. If $Q$ is the probability simplex, we even
|
| 280 |
+
192 have a closed form for the Bregman projection.
|
| 281 |
+
|
| 282 |
+
# 3.2 Algorithms for Group DRO
|
| 283 |
+
|
| 284 |
+
As applications of our generic algorithm, we now describe two concrete algorithms for group DRO (2) and their convergence rates.
|
| 285 |
+
|
| 286 |
+
GDRO-EXP3. Let $\Psi$ be the entropy regularizer, which corresponds to the EXP3 algorithm for 7 the $q$ -player. The resulting algorithm, GDRO-EXP3, is shown in Algorithm 2. The update is in a 8 closed formula and its complexity is $O ( m + n )$ time. The convergence rate follows from Theorem 1.
|
| 287 |
+
|
| 288 |
+
99 Theorem 2. If $\eta _ { \theta , t }$ is nonincreasing, GDRO-EXP3 (Algorithm 2) achieves the expected convergence
|
| 289 |
+
00 rate
|
| 290 |
+
|
| 291 |
+
$$
|
| 292 |
+
\mathbf { E } [ \varepsilon _ { T } ] \leq { \frac { 1 } { T } } \left( { \frac { G ^ { 2 } } { 2 } } \sum _ { t = 1 } ^ { T } \eta _ { \theta , t } + { \frac { D ^ { 2 } } { 2 \eta _ { \theta , T } } } + { \frac { m M ^ { 2 } } { 2 } } \eta _ { q } T + { \frac { \log m } { \eta _ { q } } } \right) .
|
| 293 |
+
$$
|
| 294 |
+
|
| 295 |
+
For 201 $\begin{array} { r } { \eta _ { \theta , t } = \frac { D } { G \sqrt { T } } } \end{array}$ and ηq = $\begin{array} { r } { \eta _ { q } = \sqrt { \frac { 2 \log m } { m M ^ { 2 } T } } } \end{array}$ , we obtain
|
| 296 |
+
|
| 297 |
+
$$
|
| 298 |
+
\mathbf { E } [ \varepsilon _ { T } ] \leq { \sqrt { 2 } } { \frac { { \sqrt { G ^ { 2 } D ^ { 2 } + 2 M ^ { 2 } m \log m } } } { \sqrt { T } } } .
|
| 299 |
+
$$
|
| 300 |
+
|
| 301 |
+
202 GRDO-TINF. We can further improve the convergence rate using the Tsallis entropy regularizer
|
| 302 |
+
203 at the cost of a slightly higher iteration complexity. The update of $q _ { t }$ is then
|
| 303 |
+
|
| 304 |
+
$$
|
| 305 |
+
\tilde { q } _ { t + 1 } = q _ { t } \left( \mathbf { 1 } - \frac { \eta _ { q } \sqrt { q _ { t } } } { q _ { t , i _ { t } } } \ell ( \theta _ { t } ; z ) \mathbf { e } _ { i _ { t } } \right) ^ { - 2 } , \quad q _ { t + 1 } : = \left( \sqrt { \tilde { q } _ { t + 1 } } - \alpha \mathbf { 1 } \right) ^ { - 2 } ,
|
| 306 |
+
$$
|
| 307 |
+
|
| 308 |
+
204 where the multiplication, square-root, and power operations are entry-wise and $\alpha \in \mathbb { R }$ is the unique
|
| 309 |
+
205 solution of equation $\begin{array} { r } { \sum _ { i = 1 } ^ { m } \overline { { \left( \sqrt { \tilde { q } _ { t + 1 , i } } - \alpha \right) ^ { - 2 } } } = 1 } \end{array}$ . The solution $\alpha$ can be computed via the Newton
|
| 310 |
+
206 method. Practically, one can use $\alpha$ in the previous iteration to warm start the Newton method. In
|
| 311 |
+
207 each iteration, the algorithm performs a single orthogonal projection onto $\Theta$ , the Newton method for
|
| 312 |
+
208 finding $\alpha$ , and $O ( m + n )$ operations to update $\theta _ { t } , q _ { t }$ . The pseudocode is given in Algorithm 3. From
|
| 313 |
+
209 Theorem 1, we obtain the following convergence rate.
|
| 314 |
+
210 Theorem 3. If $\eta _ { \theta , t }$ is nonincreasing, GDRO-TINF (Algorithm 3) achieves the expected convergence
|
| 315 |
+
211 rate
|
| 316 |
+
|
| 317 |
+
$$
|
| 318 |
+
\mathbf { E } [ \varepsilon _ { T } ] \leq { \frac { 1 } { T } } \left( { \frac { G ^ { 2 } } { 2 } } \sum _ { t = 1 } ^ { T } \eta _ { \theta , t } + { \frac { D ^ { 2 } } { 2 \eta _ { \theta , T } } } + { \sqrt { m } } M ^ { 2 } \eta _ { q } T + { \frac { \sqrt { m } } { \eta _ { q } } } \right) .
|
| 319 |
+
$$
|
| 320 |
+
|
| 321 |
+
For 212 $\begin{array} { r } { \eta _ { \theta , t } = \frac { D } { G \sqrt { T } } } \end{array}$ and $\begin{array} { r } { \eta _ { q } = \frac { 1 } { M \sqrt { T } } } \end{array}$ , we obtain
|
| 322 |
+
|
| 323 |
+
$$
|
| 324 |
+
\mathbf { E } [ \varepsilon _ { T } ] \leq \sqrt { 2 } \frac { \sqrt { G ^ { 2 } D ^ { 2 } + 4 M ^ { 2 } m } } { \sqrt { T } } .
|
| 325 |
+
$$
|
| 326 |
+
|
| 327 |
+
213 Comparison to Sagawa et al. [2020]. Our algorithms improve the convergence rate of Sagawa et√
|
| 328 |
+
214 al. [2020] by a factor of $O ( \sqrt { m } )$ ; see Table 1. The reason lies in the choice of gradient estimator. All
|
| 329 |
+
215 algorithms are stochastic no-regret dynamics. As outlined above, their convergence hence can be
|
| 330 |
+
216 bounded by the regrets of the players, which depend on the variance of the local norm of the gradient
|
| 331 |
+
217 estimators. Their strategy is based on uniform sampling that yields a variance of √ $O ( m )$ for both
|
| 332 |
+
218 players, whereas our bound is $O ( { \sqrt { m } } )$ thanks to the gradient estimators tailored to the regularizer of
|
| 333 |
+
219 OMD. More details may be found in Appendix D.
|
| 334 |
+
|
| 335 |
+
# 3.3 Algorithm for weighted ranking of group losses
|
| 336 |
+
|
| 337 |
+
We now consider a more general case that $Q$ is a permutahedron. Applying Algorithm 1 with the Tsallis entropy regularizer, we obtain the following result.
|
| 338 |
+
|
| 339 |
+
Theorem 4. If $\eta _ { \theta , t }$ is nonincreasing and $Q$ is a permutahedron, Algorithm 1 with the Tsallis entropy regularizer achieves the same expected convergence rate as Theorem 3. Furthermore, the iteration complexity is $O ( m \log m + n )$ .
|
| 340 |
+
|
| 341 |
+
This implies a convergence rate of G2D2+M2mT ) for empirical CVaR optimization, which improves q G2D2+M2m log mT ) convergence by Curi et al. [2020]. Furthermore, their iteration complexity is $O ( m ^ { 3 } )$ due to the $k$ -DPP sampling step, so our algorithm is even faster in terms of iteration complexity.
|
| 342 |
+
|
| 343 |
+
# 4 Lower bound
|
| 344 |
+
|
| 345 |
+
Theorem 3 states that we can find an $\varepsilon$ -optimal solution for group DRO in $ { \mathcal { O } } ( \frac { G ^ { 2 } D ^ { 2 } + M ^ { 2 } m } { \varepsilon ^ { 2 } } )$ calls to stochastic oracles. Next, we show that this query complexity is information-theoretically optimal.
|
| 346 |
+
|
| 347 |
+
33 Let $\mathcal { L }$ be a class of convex $G$ -Lipschitz loss functions $\ell : \Theta \to [ 0 , M ]$ . Given a loss function $\ell \in { \mathcal { L } }$ ,
|
| 348 |
+
34 and an $m$ -set $\mathcal { P } = \{ P _ { 1 } , \ldots , P _ { m } \}$ of distributions, denote the optimality gap of $\theta \in \Theta$ by
|
| 349 |
+
|
| 350 |
+
$$
|
| 351 |
+
R ( \theta , \ell , \mathcal { P } ) = \operatorname* { m a x } _ { P \in \mathcal { P } } \mathbf { \Xi } _ { z \sim P } ^ { \mathbf { E } } [ \ell ( \theta ; z ) ] - \operatorname* { m i n } _ { \theta ^ { * } \in \Theta } \operatorname* { m a x } _ { P \in \mathcal { P } } \mathbf { \Xi } _ { z \sim P } ^ { \mathbf { E } } [ \ell ( \theta ^ { * } ; z ) ] .
|
| 352 |
+
$$
|
| 353 |
+
|
| 354 |
+
Let 235 $\boldsymbol { \mathcal { A } } _ { T }$ be the set of algorithms that outputs $\hat { \theta } \in \Theta$ making $T$ queries to the stochastic oracle.
|
| 355 |
+
|
| 356 |
+
Theorem 5 (Lower Bound).
|
| 357 |
+
|
| 358 |
+
$$
|
| 359 |
+
\operatorname* { i n f } _ { \boldsymbol { \hat { \theta } } \in A _ { T } } \operatorname* { s u p } _ { \boldsymbol { \ell } \in \mathcal { L } , \boldsymbol { \Theta } , \mathcal { P } } \mathbf { E } [ R ( \boldsymbol { \hat { \theta } } , \boldsymbol { \ell } , \mathcal { P } ) ] \geq \Omega \left( \operatorname* { m a x } \left\{ \frac { G D } { \sqrt { T } } , M \sqrt { \frac { m } { T } } \right\} \right) ,
|
| 360 |
+
$$
|
| 361 |
+
|
| 362 |
+
236 where $\Theta$ runs over convex sets with diameter $D$ and $\mathcal { P }$ over $m$ -sets of distributions, and $\mathbf { E } _ { \mathcal { P } }$ denotes
|
| 363 |
+
237 the expectation over outcomes of the stochastic oracle in $\mathcal { P }$ .
|
| 364 |
+
|
| 365 |
+
As ${ \sqrt { x + y } } \leq { \sqrt { x } } + { \sqrt { y } } \leq { \sqrt { 2 ( x + y ) } }$ for $x , y \geq 0$ , this theorem immediately implies that the minimax convergence rate is $\Omega \left( { \sqrt { \frac { G ^ { 2 } D ^ { 2 } + M ^ { 2 } m } { T } } } \right)$ , which equals the convergence rate achieved by Algorithm 3 up to a constant factor.
|
| 366 |
+
|
| 367 |
+
241 Proof Sketch. It suffices to show two lower bounds $\textstyle { \frac { G D } { \sqrt { T } } }$ and $M _ { \sqrt { T } }$ independently. The former is
|
| 368 |
+
242 a well-known lower bound for stochastic convex optimization [Agarwal et al., 2012]. To illustrate the
|
| 369 |
+
243 latter, we take an algorithmic dependent point of view via the Le cam’s method. For any algorithm
|
| 370 |
+
244 in $\boldsymbol { \mathcal { A } } _ { T }$ , we need to construct instances $\mathcal { P } _ { 0 } , \mathcal { P } _ { 1 }$ such that the total variation distance between the
|
| 371 |
+
245 distributions over the query outcomes (they depend on both the behavior of the algorithm and the
|
| 372 |
+
246 instance) with respect to $\mathcal { P } _ { 0 }$ and $\mathcal { P } _ { 1 }$ is small. On the other hand, the objective function of the two
|
| 373 |
+
247 instances must be well-separated, i.e., any fixed $\theta$ is $\delta$ sub-optimal for either $\mathcal { P } _ { 0 }$ or $\mathcal { P } _ { 1 }$ . So, any
|
| 374 |
+
248 algorithm that solves group DRO up to error $\delta$ needs to distinguish two instances $\mathcal { P } _ { 0 }$ and $\mathcal { P } _ { 1 }$ . This
|
| 375 |
+
249 implies a query lower bound because the total variation distance of the outcome distributions of
|
| 376 |
+
250 these instances is small. The challenge is how to construct such instances for the regime of small
|
| 377 |
+
251 dimensions of $\theta$ , e.g, $n = 1$ . To this end, we carefully construct linear functions for $m$ groups using
|
| 378 |
+
252 opposite slopes. Then, based on the behavior of the algorithm, we tweak the noise bias in one of the
|
| 379 |
+
253 groups with a positive slope, in a way that any fixed $\theta$ is $\Theta ( \delta )$ sub-optimal for one of these instances.
|
| 380 |
+
254 For the detailed proof, see Appendix C.
|
| 381 |
+
|
| 382 |
+

|
| 383 |
+
Figure 1: Results on Adult dataset
|
| 384 |
+
|
| 385 |
+

|
| 386 |
+
Figure 2: Results on synthetic dataset
|
| 387 |
+
|
| 388 |
+
# 5 Experiments
|
| 389 |
+
|
| 390 |
+
In this section, we compare our algorithms with the known algorithm using real-world and synthetic datasets. We follow the setup in [Namkoong and Duchi, 2016].
|
| 391 |
+
|
| 392 |
+
Adult dataset. For the real-world dataset, we use Adult dataset [Dua and Graff, 2017]. The dataset consists of age, gender, race, educational background, and many other attributes of 48, 842 individuals from the US census. The task is to predict whether the person’s income is greater than 50, 000 USD or not. We set up 6 groups based on the race and gender attributes: each group corresponds to a combination of {black, white, others} $\times \left\{ \begin{array} { r l } \end{array} \right.$ {female, male}. Converting the categorical features to dummy variables, we obtain a 101-dimensional feature vector $a \in \mathbb { R } ^ { n }$ ( $n = 1 0 1$ ) for each individual. We train the linear model with the logistic loss and hinge loss functions. The group-DRO objective is the worst empirical loss over the 6 groups:
|
| 393 |
+
|
| 394 |
+
$$
|
| 395 |
+
\operatorname* { m a x } _ { i = 1 } ^ { 6 } { \frac { 1 } { | I _ { i } | } } \sum _ { ( a , b ) \in I _ { i } } \ell ( \theta ; a , b ) ,
|
| 396 |
+
$$
|
| 397 |
+
|
| 398 |
+
where 266 $I _ { i }$ is the set of data points in the ith group. The feasible region is set to the Euclidean ball of 267 radius $D = 1 0$ .
|
| 399 |
+
|
| 400 |
+
268 Synthetic dataset. To observe the performance of the algorithms over the regime of high-dimension
|
| 401 |
+
269 model parameters and the larger number of groups, we also conducted experiments using the following
|
| 402 |
+
270 synthetic instances. First, we set $n = 5 0 0$ and varied $m \in \{ 1 0 , 5 0 , 1 0 0 \}$ . For each group $i \in [ m ]$ , we
|
| 403 |
+
271 generated the true classifier $\theta _ { i } ^ { * } \in \mathbb { R } ^ { n }$ from the uniform distribution over the unit sphere in $\mathbb { R } ^ { n }$ . The ith
|
| 404 |
+
272 group distribution $P _ { i }$ was the empirical distribution of 1,000 data points, where each data point $( a , b )$
|
| 405 |
+
273 was drawn as $a \sim N ( 0 , I _ { n } )$ and $b = \mathrm { s i g n } ( a ^ { \top } \theta _ { i } ^ { * } )$ with probability 0.9 and $b = - \mathrm { s i g n } ( a ^ { \top } \theta _ { i } ^ { * } )$ with
|
| 406 |
+
274 probability 0.1. We trained the linear model with the hinge loss function. Finally, the group-DRO
|
| 407 |
+
275 objective is
|
| 408 |
+
|
| 409 |
+
$$
|
| 410 |
+
\underset { i = 1 } { \operatorname* { m a x } } \ \underset { ( a , b ) \sim P _ { i } } { \mathbf { E } } [ \ell ( \theta ; a , b ) ] .
|
| 411 |
+
$$
|
| 412 |
+
|
| 413 |
+
276 The feasible region is set to the Euclidean ball of radius $D = 1 0$ .
|
| 414 |
+
|
| 415 |
+
# 5.1 Algorithms
|
| 416 |
+
|
| 417 |
+
We implemented GDRO-EXP3, GDRO-TINF, and the algorithm in [Sagawa et al., 2020] in Python.
|
| 418 |
+
We ran our algorithms for $T = 2 , 0 0 0 , 0 0 0$ iterations.
|
| 419 |
+
|
| 420 |
+
Inner online algorithms. It is known that EXP3 has a variance as large as $O ( T ^ { 2 } )$ [Lattimore and Szepesvári, 2020]. Therefore, vanilla EXP3 often fails to achieve a sublinear regret even though it achieves $O ( \sqrt { T } )$ regret in expectation. This large variance makes it difficult to reliably evaluate the performance of the algorithms. To stabilize the algorithms, we replaced EXP3 with its variation,√ EXP3P [Auer et al., 2003], which achieves $O ( \sqrt { T } )$ regret with high probability. Note that this change does not harm our expected convergence bounds.
|
| 421 |
+
|
| 422 |
+
Step sizes. The choice of step sizes is crucial to the practical performance of first-order methods. We found that the decreasing step size $\eta _ { \theta , t } \sim 1 / \sqrt { t }$ for $\theta _ { t }$ and the fixed step size $\eta _ { q } \sim 1 / \sqrt { T }$ for $q _ { t }$ gave the best results. More precisely, we set $\begin{array} { r } { \eta _ { \theta , t } = \frac { C _ { \theta } D } { \sqrt { t } } } \end{array}$ $( t \in [ T ] )$ and $\begin{array} { r } { \eta _ { q } = C _ { q } \sqrt { \frac { \log m } { m T } } } \end{array}$ , where $C _ { \theta } \in [ 0 . 1 , 5 . 0 ]$ and $C _ { q } \in [ 0 . 1 , 3 . 0 ]$ are hyper-parameters tuned for each algorithm. We used the best hyper-parameter found by Optuna [Akiba et al., 2019] for the shown results.
|
| 423 |
+
|
| 424 |
+
Mini-batch. The use of mini-batch often improves the stability of stochastic gradient algorithms. In our experiments, we used mini-batches of size 10 to evaluate stochastic gradients. Neither the objective values of outputs nor the stability was improved with larger mini-batch sizes. The group DRO objective is evaluated using the entire dataset.
|
| 425 |
+
|
| 426 |
+
Initialization. For both datasets, we initialized the algorithms with $\theta _ { 1 } = \mathbf { 0 }$ .
|
| 427 |
+
|
| 428 |
+
# 5.2 Results
|
| 429 |
+
|
| 430 |
+
We show the results of our experiment in Figures 1 and 2.
|
| 431 |
+
|
| 432 |
+
Adult dataset. In Figure 1, we plot the optimality gap of the averaged iterate $\textstyle { \frac { 1 } { T } } \sum _ { t = 1 } ^ { T } \theta _ { t }$ against the number of iteration . We observe that all the algorithms converge with a rate roughly $T ^ { - 0 . 5 }$ for both loss functions, consistent with our convergence bound. Furthermore, our algorithms (GDRO-EXP3 and GDRO-TINF) achieve faster convergence compared to the algorithm by Sagawa et al. [2020]. Interestingly, GDRO-TINF achieves a $1 \overline { { 0 } } ^ { - 4 }$ optimality gap in $T = 1 0 ^ { 6 }$ iterations, which is faster than the theoretical $T ^ { - 0 . 5 }$ rate in Theorem 3.
|
| 433 |
+
|
| 434 |
+
Synthetic dataset. In Figure 2, we plot the objective values of the averaged iterate against the number of iterations. For all the values of $m$ , our algorithms (especially GDRO-EXP3) consistently achieve smaller loss values faster than the known algorithm. The performance gap between our algorithms and the known algorithm increased as $m$ grows, which verifies that our algorithms have better dependence on $m$ in the convergence rate.
|
| 435 |
+
|
| 436 |
+
09 References
|
| 437 |
+
10 Alekh Agarwal, Peter L. Bartlett, Pradeep Ravikumar, and Martin J. Wainwright. Informationtheoretic lower bounds on the oracle complexity of stochastic convex optimization. IEEE Transactions on Information Theory, pages 3235–3249, 2012.
|
| 438 |
+
13 Takuya Akiba, Shotaro Sano, Toshihiko Yanase, Takeru Ohta, and Masanori Koyama. Optuna: A next-generation hyperparameter optimization framework. In Proceedings of the 25rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, 2019.
|
| 439 |
+
316 Peter Auer, Nicolò Cesa-Bianchi, Yoav Freund, and Robert E. Schapire. The nonstochastic multiarmed bandit problem. SIAM Journal on Computing, 32(1):48–77, 2003.
|
| 440 |
+
18 Yujia Bao, Shiyu Chang, and Regina Barzilay. Predict then interpolate: A simple algorithm to learn stable classifiers. In Proceedings of the 38th International Conference on Machine Learning, volume 139, pages 640–650, 2021. Dimitris Bertsimas, Vishal Gupta, and Nathan Kallus. Data-driven robust optimization. Mathematical Programming, 167(2):235–292, 2018. Jose Blanchet, Yang Kang, and Karthyek Murthy. Robust wasserstein profile inference and applications to machine learning. Journal of Applied Probability, 56(3):830–857, 2019.
|
| 441 |
+
25 Joy Buolamwini and Timnit Gebru. Gender shades: Intersectional accuracy disparities in commercial gender classification. In Proceedings of the 1st Conference on Fairness, Accountability and Transparency, pages 77–91, 2018. Yair Carmon, Arun Jambulapati, Yujia Jin, and Aaron Sidford. Thinking inside the ball: Near-optimal minimization of the maximal loss. In Proceedings of 34th Conference on Learning Theory, volume
|
| 442 |
+
134 of Proceedings of Machine Learning Research, pages 866–882, 2021.
|
| 443 |
+
31 Nicolo Cesa-Bianchi and Gabor Lugosi. Prediction, Learning, and Games. Cambridge University Press, 2006.
|
| 444 |
+
33 Sebastian Curi, Kfir Y. Levy, Stefanie Jegelka, and Andreas Krause. Adaptive sampling for stochastic risk-averse learning. In Advances in Neural Information Processing Systems, pages 1036–1047,
|
| 445 |
+
2020.
|
| 446 |
+
36 Emily Diana, Wesley Gill, Ira Globus-Harris, Michael Kearns, Aaron Roth, and Saeed SharifiMalvajerdi. Lexicographically fair learning: Algorithms and generalization. In Proceedings of the
|
| 447 |
+
2nd Symposium on Foundations of Responsible Computing, pages 6:1–6:23, 2021.
|
| 448 |
+
39 Dheeru Dua and Casey Graff. UCI machine learning repository, 2017.
|
| 449 |
+
40 John C. Duchi and Hongseok Namkoong. Learning models with uniform performance via distributionally robust optimization. The Annals of Statistics, 49(3):1378 – 1406, 2021.
|
| 450 |
+
42 Peyman Mohajerin Esfahani and Daniel Kuhn. Data-driven distributionally robust optimization using the wasserstein metric: Performance guarantees and tractable reformulations. Mathematical Programming, 171(1):115–166, 2018.
|
| 451 |
+
45 Joel Goh and Melvyn Sim. Distributionally robust optimization and its tractable approximations. Operations Research, 58(4-part-1):902–917, 2010.
|
| 452 |
+
47 Tatsunori Hashimoto, Megha Srivastava, Hongseok Namkoong, and Percy Liang. Fairness without demographics in repeated loss minimization. In Proceedings of the 35th International Conference on Machine Learning, pages 1929–1938, 2018.
|
| 453 |
+
50 Elad Hazan. Introduction to Online Convex Optimization. 2016.
|
| 454 |
+
51 Dirk Hovy and Anders Søgaard. Tagging performance correlates with author age. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing, pages 483–488, 2015.
|
| 455 |
+
|
| 456 |
+
354 Weihua Hu, Gang Niu, Issei Sato, and Masashi Sugiyama. Does distributionally robust supervised learning give robust classifiers? In Proceedings of the 35th International Conference on Machine Learning, pages 2029–2037, 2018. Jikai Jin, Bohang Zhang, Haiyang Wang, and Liwei Wang. Non-convex distributionally robust optimization: Non-asymptotic analysis. In Advances in Neural Information Processing Systems, volume 34, pages 2771–2782, 2021. David Jurgens, Yulia Tsvetkov, and Dan Jurafsky. Incorporating dialectal variability for socially equitable language identification. In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics, pages 51–57, 2017. Johannes Kirschner, Ilija Bogunovic, Stefanie Jegelka, and Andreas Krause. Distributionally robust bayesian optimization. In Proceedings of the 33rd International Conference on Artificial Intelligence and Statistics, pages 2174–2184, 2020. Tor Lattimore and Csaba Szepesvári. Bandit algorithms. Cambridge University Press, 2020. Cong Han Lim and Stephen J. Wright. Efficient bregman projections onto the permutahedron and related polytopes. In Proceedings of the 19th International Conference on Artificial Intelligence and Statistics, pages 1205–1213, 2016. Natalia L Martinez, Martin A Bertran, Afroditi Papadaki, Miguel Rodrigues, and Guillermo Sapiro. Blind pareto fairness and subgroup robustness. In Proceedings of the 38th International Conference on Machine Learning, pages 7492–7501, 2021. Hongseok Namkoong and John C Duchi. Stochastic gradient methods for distributionally robust optimization with $f$ -divergences. In Advances in Neural Information Processing Systems, 2016. Yonatan Oren, Shiori Sagawa, Tatsunori Hashimoto, and Percy Liang. Distributionally robust language modeling. In Proceedings of the Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLPIJCNLP), pages 4227–4237, 2019. Qi Qi, Zhishuai Guo, Yi Xu, Rong Jin, and Tianbao Yang. An online method for a class of distributionally robust optimization with non-convex objectives. In Advances in Neural Information Processing Systems, volume 34, pages 10067–10080, 2021. Alexander Rakhlin and Karthik Sridharan. Optimization, learning, and games with predictable sequences. In Advances in Neural Information Processing Systems, 2013. 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 The 8th International Conference on Learning Representations, 2020. Herbert Scarf. A min-max solution of an inventory problem. Studies in the mathematical theory of inventory and production, 1958. Matthew Staib and Stefanie Jegelka. Distributionally robust optimization and generalization in kernel methods. In Advances in Neural Information Processing Systems, 2019. Matthew Staib, Bryan Wilder, and Stefanie Jegelka. Distributionally robust submodular maximization. In Proceedings of the 22nd International Conference on Artificial Intelligence and Statistics, pages 506–516, 2019. Robert Williamson and Aditya Menon. Fairness risk measures. In Proceedings of the 36th International Conference on Machine Learning, pages 6786–6797, 2019. Jingzhao Zhang, Aditya Krishna Menon, Andreas Veit, Srinadh Bhojanapalli, Sanjiv Kumar, and Suvrit Sra. Coping with label shift via distributionally robust optimisation. In The 9th International Conference on Learning Representations, 2021. Julian Zimmert and Yevgeny Seldin. Tsallis-inf: An optimal algorithm for stochastic and adversarial bandits. Journal of Machine Learning Research, 22(28):1–49, 2021.
|
| 457 |
+
|
| 458 |
+
Martin Zinkevich. Online convex programming and generalized infinitesimal gradient ascent. In Proceedings of the 20th International Conference on International Conference on Machine Learning, pages 928–935, 2003.
|
| 459 |
+
|
| 460 |
+
# 404 Checklist
|
| 461 |
+
|
| 462 |
+
1. For all authors...
|
| 463 |
+
|
| 464 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 465 |
+
(b) Did you describe the limitations of your work? [No]
|
| 466 |
+
(c) Did you discuss any potential negative societal impacts of your work? [No] This paper is a theoretical paper.
|
| 467 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 468 |
+
|
| 469 |
+
2. If you are including theoretical results...
|
| 470 |
+
|
| 471 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] See Assumption 1.
|
| 472 |
+
(b) Did you include complete proofs of all theoretical results? [Yes] Ommited Proof can be found in the supplemental material.
|
| 473 |
+
|
| 474 |
+
3. If you ran experiments...
|
| 475 |
+
|
| 476 |
+
(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 experiment code can be found in the supplemental material.
|
| 477 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 5.
|
| 478 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No]
|
| 479 |
+
(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]
|
| 480 |
+
|
| 481 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 482 |
+
|
| 483 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 484 |
+
(b) Did you mention the license of the assets? [Yes]
|
| 485 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [No]
|
| 486 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [No] We used a public dataset.
|
| 487 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No]
|
| 488 |
+
|
| 489 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 490 |
+
|
| 491 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [No] Not applicable
|
| 492 |
+
(b) DidNo describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [No]
|
| 493 |
+
(c) DidNo include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [No]
|
md/dev/Mspk_WYKoEH/Mspk_WYKoEH.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/MtGmCCPJD-/MtGmCCPJD-.md
ADDED
|
@@ -0,0 +1,454 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# REPOSITORY-LEVEL PROMPT GENERATION FOR LARGE LANGUAGE MODELS OF CODE
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
With the success of large language models (LLMs) of code and their use as code assistants (e.g. Codex (Chen et al., 2021) used in GitHub Copilot1), techniques for introducing domain-specific knowledge in the prompt design process become important. In this work, we propose a framework called Repo-Level Prompt Generator that learns to generate example-specific prompts using prompt proposals. The prompt proposals take context from the entire repository, thereby incorporating both the structure of the repository and the context from other relevant files (e.g. imports, parent class files). Our technique doesn’t require any access to the weights of the LLM, making it applicable in cases where we only have black-box access to the LLM. We conduct experiments on the task of single-line code-autocompletion using code repositories taken from Google Code archives. We demonstrate that an oracle constructed from our prompt proposals gives a remarkably high relative improvement of $36 \%$ over Codex, showing the quality of these proposals. Further, we show that when we train a model to predict a prompt proposal, we can achieve significant performance gains over Codex and other baselines.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Large Language Models (LLMs) have demonstrated remarkable performance in natural language processing tasks (Brown et al., 2020; Chowdhery et al., 2022), text-to-image generation (Ramesh et al., 2022; Rombach et al., 2021), protein-sequencing (Rives et al., 2019) and even as a generalized agent (Reed et al., 2022). As opposed to the pretrain-finetune paradigm, prompting these LLMs has been found to yield good performance even with few-examples (Liu et al., 2021a). A prompt is an input to the LM such that the desired task can be expressed as predictions generated from the LM. Besides providing a mechanism to control and evaluate a LM, prompts have shown to elicit emergent behaviour as well. Examples of this behavior include GPT-3 (Brown et al., 2020) doing better in tasks it has never seen during training and improved reasoning capabilities with few-shot (Wei et al., 2022) and zero-shot (Kojima et al., 2022) prompts that encourage a chain of thoughts. These factors highlight the importance of designing an effective task-specific prompt 2. However, currently we have limited understanding of how to do this (Reynolds & McDonell, 2021).
|
| 12 |
+
|
| 13 |
+
LLMs have also been used for modeling source code with impressive results (Austin et al., 2021; Fried et al., 2022; Xu et al., 2022a). In particular, one of the best performing LLM, Codex (Chen et al., 2021), has been deployed as part of GitHub Copilot 1, a state-of-the-art in-IDE code assistant. Despite the growing popularity of LLMs of code, there is no work that systematically tackles different aspects of prompt generation in relation to source code. One such aspect is that when it comes to code, the relevant context to be put in the prompt can come from not just the current file, but also from outside, such as imports and parent classes. Also, depending on the scenario, the relevant context can be scattered across multiple locations. Since the LLMs have a limited context length available for the prompt, it becomes increasing crucial for our domain-specific understanding to guide the selection of relevant context. Currently, it is not clear how to integrate this domain knowledge of what constitutes a relevant context, into the process of creating prompts. Addressing this question has potential benefits in other domains such as question answering (Liu et al., 2022) and multi-document summarization (Xiao et al., 2022), where domain-specific structured retrieval of context can be useful.
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
Figure 1: Repo-Level Prompt Generator: The prompt is generated by combining the context from the predicted prompt proposal $p = 1 4$ , i.e., method names and bodies from the imported file, MaximizingGibbsSampler.java (violet) with the default Codex context (gray).
|
| 17 |
+
|
| 18 |
+
In this work, we address this problem by proposing Repo-Level Prompt Generator (RLPG), a framework that while generating the prompt, incorporates both the structure of the repository as well as the relevant context in all the files of the repository. In RLPG, the choice of where from and what to take from the repository is specified by a set of prompt proposals. For example, one of the prompt proposal can be to take all the identifiers used in the first import file. These prompt proposals allow the prompt engineers to induce their domain expertise in the prompt-designing process. With the increasing use of LLMs as assistive agents to humans, demand for transparency and the desire for software engineers to take active part in tailoring prompts to suit their requirements (Jiang et al., 2022; Sun et al., 2022), this capability becomes important. As suggested in some previous works in NLP (Shin et al., 2020; Schick & Schütze, 2021), our prompt proposals are discrete. However, rather than fixing one particular prompt proposal for each example, we instead predict the best prompt proposal conditioned on the example. We do this by coming up with a neural network called Prompt Proposal Classifier (PPC), that given an example, learns to select a prompt proposal such that the resulting prompt is likely to produce the desired output. Therefore, RLPG allows the introduction of domain expertise, and at the same time facilitates automatic example-specific prompt generation via a learned neural network. Note that there are some techniques for automatic prompt generation in NLP (Li & Liang, 2021; Shin et al., 2020; Lester et al., 2021) that require updating some or all of the weights of the LLM. However, the strongest LLMs are not publicly available (e.g. OpenAI provides access only to the generated output from Codex via an API 3 and no access to model weights and data is provided), making these techniques less useful under this scenario. RLPG addresses this limitation by generating prompts assuming only black-box access to the LLM.
|
| 19 |
+
|
| 20 |
+
We focus on the task of single-line code-autocompletion in an IDE, where the objective is to predict the blanked-out portion (or target hole) starting from the position of an imagined cursor to the end of line. We operate under the line-level maintenance setting (Shrivastava et al., 2020; Hellendoorn & Devanbu, 2017) that reflects the scenario where a user is editing an existing file. This means that there can be code following the line. Figure 1 provides an illustration of our approach. The prompt proposal classifier takes in the hole position (position of the cursor) in the current file, the repository to which the current file belongs and a set of repo-level prompt proposals as input, and predicts a prompt proposal. In our illustrated example, the predicted prompt proposal corresponds to taking the method names and bodies from MaximizingGibbsSampler.java (mg.before the hole position indicates that a method from the imported file is likely to be invoked). The Prompt Composer uses the context from the predicted prompt proposal and combines it with the default Codex context, i.e., code prior to the position of the hole in the current file. The resulting prompt consists of the method name InitializeToAssignment (from the prompt proposal context) and the method CurrentAssignments() (from the default Codex context), resulting in a successful prediction (brown box on the top) of the target hole. Our key contributions are as follows:
|
| 21 |
+
|
| 22 |
+
• We propose a framework called the Repo-Level Prompt Generator (RLPG) that learns to generate prompts conditioned on the example, without requiring access to the weights of the LLM. • To incorporate domain-knowledge in the prompt design process, RLPG uses a set of repository-level prompt proposals. These prompt proposals are designed to incorporate both the structure of the repository as well as the relevant context from all files in the repository. • On the task of single-line code-autocompletion, we show that an oracle constructed from our proposed prompt proposals gives up to $36 \%$ relative improvement over Codex. This improvement is pleasantly surprising as Codex has never seen prompts made from these prompt proposals during training. Further, we show that when we use our prompt proposal classifier to predict the best prompt proposal, we can achieve up to $17 \%$ relative improvement over Codex.
|
| 23 |
+
|
| 24 |
+
# 2 REPO-LEVEL PROMPT GENERATOR (RLPG)
|
| 25 |
+
|
| 26 |
+
In this section, we provide details of our framework. We start by describing our prompt proposals and then discuss our prompt proposal classifier which is followed by a description of prompt composer.
|
| 27 |
+
|
| 28 |
+
# 2.1 REPO-LEVEL PROMPT PROPOSALS
|
| 29 |
+
|
| 30 |
+
The core idea of RLPG consists of substituting part of the default context used by Codex with context coming from somewhere else in the repository. The decision of what to take and from where in the repository to take from is governed by a set of prompt proposals. These prompt proposals were decided based on manual inspection of our training data and intend to capture common coding patterns (but more generally can also include project/organization-specific coding practises). A prompt proposal can be thought of as a function that takes as input a target hole’s position and the repository that the hole is a part of, and that returns the prompt proposal context (a string constituted by the context from the prompt proposal). A prompt proposal is specified by a prompt source and a prompt context type. We mention each of these along with their motivation below.
|
| 31 |
+
|
| 32 |
+
Prompt Source: For a target hole position, a prompt source determines from where should we take code that will be part of the prompt proposal context. We propose ten different prompt sources:
|
| 33 |
+
|
| 34 |
+
1. Current: take code from the current file excluding the contents of the target hole. The current file is the file that contains the target hole. The code in the current file (e.g. the lines after the hole position) can be very useful in predicting the target hole.
|
| 35 |
+
2. Parent Class: take code from the file that contains the parent of the class to which the target hole belongs. The intuition behind this is to account for cases where a method present in the parent class is invoked in the current file (i.e. the child class).
|
| 36 |
+
3. Import: take code from the import files used in the current file. The dependencies specified via imports can provide useful cues to predict the target hole.
|
| 37 |
+
4. Sibling: take code from the files that are in the same directory as the current file. Files in the same directory tend to share code variables (e.g. identifiers).
|
| 38 |
+
5. Similar Name: take code from files that have a similar name as the current file. Similar names are determined by doing a splitting of the file name based on underscore or camel-case formatting and then matching parts of the filename. If one or more parts matches, two files are considered to have similar names. The intuition behind this is that software developers tend to name files based on the functionality of the code written in that file. Therefore, a similar name file might contain some portion of the code that is common with the current file and hence might be useful for predicting the target hole.
|
| 39 |
+
6. Child Class: take code from files that have the current file as their parent class file.
|
| 40 |
+
7. Import of Parent Class: take code from the import files used in the parent class files.
|
| 41 |
+
8. Import of Sibling: take code from the import files used in the sibling files.
|
| 42 |
+
9. Import of Similar Name: take code from the import files used in the similar name files.
|
| 43 |
+
10. Import of Child Class: take code from the import files used in the child class files.
|
| 44 |
+
|
| 45 |
+
The last four prompt sources are useful when the target hole occurs at the very beginning of the current file. In these cases, there would be less context coming from other prompt sources. For each prompt source, we can get either a single file or a ranked list of files (see Appendix B.1). In the latter case, we will take context from these files until we exhaust the maximum context length allocated to the prompt proposal.
|
| 46 |
+
|
| 47 |
+
Prompt Context Type: The prompt context type determines what code to take from the prompt source. We propose seven different prompt context types (Appendix B.2 has examples of each type):
|
| 48 |
+
|
| 49 |
+
1. Post Lines (PL): Take all the lines after the target hole line till we reach the end of the file. This context type is applicable only when prompt source is the current file 4.
|
| 50 |
+
2. Identifiers (I): Take all the identifiers used in the prompt source.
|
| 51 |
+
3. Type Identifiers (TI): Take all the type identifiers used in the prompt source.
|
| 52 |
+
4. Field Declarations (FD): Take all the field declarations used in the prompt source.
|
| 53 |
+
5. String Literals (SL): Take all the string literals used in the prompt source.
|
| 54 |
+
6. Method Names (MN): Take all the method names along with their signatures that are used in the prompt source.
|
| 55 |
+
7. Method Names and Bodies (MNB): Take all the method names along with their signatures and corresponding bodies used in the prompt source.
|
| 56 |
+
|
| 57 |
+
By combining prompt sources with prompt context types, we get a total of 63 prompt proposals (see Appendix B.4 for details). Note that depending on the target hole, not all prompt proposals would be applicable (e.g. if there are no parent classes in the current file, prompt proposals with prompt source as parent class file won’t be applicable). In Figure 1, the predicted prompt proposal corresponds to taking prompt source Import and prompt context type MNB. We aimed for a set of prompt proposals that offer more diversity rather than a set of prompt proposals that are all good. This in turn ensures that for any hole position, a significant number of prompt proposals are applicable.
|
| 58 |
+
|
| 59 |
+
# 2.2 PROMPT PROPOSAL CLASSIFIER (PPC)
|
| 60 |
+
|
| 61 |
+
Given a hole position, the goal of the prompt proposal classifier is to predict the prompt proposal $p$ that will lead to success, where success happens when the predicted hole $\hat { h }$ exactly matches the target hole $h$ . This task is formulated as a multi-label binary classification problem since for a given target hole, more than one prompt proposals can lead to success. In this formulation, we treat the default Codex context as one of the prompt proposals. Next, we describe the training procedure for PPC.
|
| 62 |
+
|
| 63 |
+
Training: For each target hole $h$ , we generate a ground-truth vector $Y ^ { h } = [ y _ { p } ^ { h } ] _ { p = 1 } ^ { M }$ which is a multi-hot vector of size $M$ , where $M$ is the total number of prompt proposals. This vector is obtained by feeding the prompt generated from prompt proposal $p$ into Codex and then seeing whether $\hat { h } = h$ . If there is a match, we say that the prompt proposal $p$ is successful. For hole $h$ , if a prompt proposal $p$ is applicable and leads to success, $y _ { p } ^ { h } = 1$ and will be zero otherwise. For each hole $h$ , we obtain a mask $T ^ { h }$ where $T _ { p } ^ { h } = 1$ when $p$ is applicable or zero otherwise. The overall training loss $\mathcal { L }$ can be expressed as the sum of individual hole losses ${ \mathcal { L } } ^ { h }$ as follows:
|
| 64 |
+
|
| 65 |
+
$$
|
| 66 |
+
\mathcal { L } = \frac { 1 } { N } \sum _ { h = 1 } ^ { N } \mathcal { L } ^ { h } = \frac { 1 } { N } \sum _ { h = 1 } ^ { N } \frac { 1 } { M ^ { h } } \sum _ { p = 1 } ^ { M ^ { h } } B C E ( \hat { y } _ { p } ^ { h } , y _ { p } ^ { h } ) * T _ { p } ^ { h } \quad w h e r e \quad M ^ { h } = \sum _ { p } T _ { p } ^ { h }
|
| 67 |
+
$$
|
| 68 |
+
|
| 69 |
+
In the above equation, $N$ is the total number of holes encountered while training, $M ^ { h }$ denotes the total number of applicable prompt proposals for $h$ and $B C E$ corresponds to the binary cross entropy loss. Masking ensures that we consider only the prompt proposals that are applicable. Next, we describe our two variants of PPC that can be used to obtain the prediction $\hat { y } _ { p } ^ { h }$ .
|
| 70 |
+
|
| 71 |
+
RLPG-H: Let $H ^ { h }$ be the hole window that includes code present around the hole $h$ excluding the hole itself. In our work, we take two lines before the hole position, the code up to the hole position and two lines after the hole position. We use a pretrained model $F _ { \phi }$ to obtain a context representation vector of size $Z$ , where $Z$ is the dimension of the hidden state of the model. Specifically, we take the hidden state at the first position, i.e. the representation of the [CLS] token. To make training of PPC computationally efficient, the parameters $\phi$ are frozen during training. The RLPG-H model takes the context representation of the hole window and projects it to the prompt proposal space of size $M$ via two dense layers with a non-linearity in between (see Equation 2). Taking the sigmoid of this output gives the prediction of the prompt proposal.
|
| 72 |
+
|
| 73 |
+
$$
|
| 74 |
+
{ \hat { y } } _ { p } ^ { h } = P ( y _ { p } ^ { h } = 1 | H ^ { h } ) = { \mathrm { s i g m o i d } } ( W ^ { 2 } ( { \mathrm { r e l u } } ( W ^ { 1 } ( F _ { \phi } ( H ^ { h } ) ) + b ^ { 1 } ) ) + b ^ { 2 } )
|
| 75 |
+
$$
|
| 76 |
+
|
| 77 |
+
RLPG-R: The motivation behind this variant is to use the similarity of the hole window and the prompt proposal context to determine which prompt proposal can be useful. Given a particular hole $h$ , let $\hat { C } _ { p } ^ { h }$ denote the prompt proposal context from prompt proposal $p$ . Intuitively, if the hole window contains variables (e.g. identifiers) that are similar to the variables in the prompt proposal context, then there are chances that $h$ might occur somewhere in $C _ { p } ^ { h }$ . The similarity is modeled using a multiheaded attention mechanism (Vaswani et al., 2017), by treating the projected hole window representation as a query $Q ^ { h }$ and the projected prompt proposal context representation $K _ { p } ^ { h }$ as a key (Equation 3). The value $V _ { p } ^ { h }$ is the same as the key.
|
| 78 |
+
|
| 79 |
+
$$
|
| 80 |
+
\begin{array} { r l } & { \quad Q ^ { h } = F _ { \phi } ( H ^ { h } ) , \quad K _ { p } ^ { h } = F _ { \phi } ( C _ { p } ^ { h } ) , \quad V _ { p } ^ { h } = F _ { \phi } ( C _ { p } ^ { h } ) } \\ & { \quad A t t ( Q ^ { h } , K _ { p } ^ { h } , V _ { p } ^ { h } ) = V _ { p } ^ { h } \mathrm { s o f t m a x } \Big ( \frac { Q ^ { h ^ { \top } } K _ { p } ^ { h } } { \sqrt { d _ { k } } } \Big ) } \\ & { M u l t i H e a d ( Q ^ { h } , K _ { p } ^ { h } , V _ { p } ^ { h } ) = W ^ { O } \mathrm { c o n c a t } ( h e a d _ { i } , h e a d _ { 2 } , . . . h e a d _ { \tau } ) } \\ & { \quad \quad \quad \quad \mathrm { w h e r e } \quad h e a d _ { i } = A t t ( W _ { i } ^ { Q } Q ^ { h } , W _ { i } ^ { K } K _ { p } ^ { h } , W _ { i } ^ { V } V _ { p } ^ { h } ) } \\ & { \quad \quad \quad \hat { y } _ { p } ^ { h } = P ( y _ { p } ^ { h } = 1 | H ^ { h } , C _ { p } ^ { h } ) = \mathrm { s i g m o i d } \Big ( W _ { p } G ( M u l t i H e a d ( Q ^ { h } , K _ { p } ^ { h } , V _ { p } ^ { h } ) ) + b _ { p } \Big ) } \end{array}
|
| 81 |
+
$$
|
| 82 |
+
|
| 83 |
+
In the equations above, $d _ { k }$ is the dimension of the key, $W _ { i } ^ { Q } , W _ { i } ^ { K } , W _ { i } ^ { V }$ are the query, key and value projection matrices, $\tau$ is the number of heads and $W ^ { O }$ is the linear projection that combines the heads. The output from Equation 5 is fed to module $G$ consisting of two-layers of feedforward network with relu activation in between (see Appendix C for more details). The resulting output is then linearly projected and a sigmoid is applied to get the predicted prompt proposal (Equation 6).
|
| 84 |
+
|
| 85 |
+
# 2.3 PROMPT COMPOSER
|
| 86 |
+
|
| 87 |
+
The prompt composer combines the context from the selected prompt proposal (given by PPC) with the context normally used by Codex (default Codex context) to generate the prompt. Since the total length that can be used for a prompt is fixed, we adopted a dynamic context allocation strategy where if the prompt proposal context is shorter than its allocated length, we assign the remaining portion from the prompt proposal context to the default Codex context. The prompt proposal context is always added before the default Codex context. For all prompt proposals, we assign half of the total context length to the prompt proposal context and the remaining to the default Codex context. For post lines, in addition, we also assign one-fourth and three-fourths of the total context length to the prompt proposal context. If the prompt proposal context or the default Codex context is greater than the context length allocated to it, we truncate it (see Appendix B.3 for our truncation strategies).
|
| 88 |
+
|
| 89 |
+
# 3 EXPERIMENTS AND RESULTS
|
| 90 |
+
|
| 91 |
+
In this section, we describe our process of dataset creation, details of experiments along with their results and interesting ablation studies.
|
| 92 |
+
|
| 93 |
+
# 3.1 DATASET CREATION
|
| 94 |
+
|
| 95 |
+
To mitigate the effects caused by potential memorization of the code present in the dataset used for training Codex, we avoided code repositories from GitHub (Chen et al., 2021). Instead, we scraped Google Code 5 for repositories in Java (removing the ones that matched with a repository on GitHub with the same name). We selected the repositories that had a permissive license giving us a total of 47 repositories. We divided the repositories into train, validation and test splits, where each repository in its entirety is part of a split. In each file within a repository, we remove lines that are blank and comments, and set the hole position to be the middle character in the line. All the characters from the middle position to the end of the line constitute the target hole.
|
| 96 |
+
|
| 97 |
+
Since code duplication has been shown to have adverse effects (Allamanis, 2018), within a repository, we look for files that are exact replica of each other, but placed in a different folder. We mark all such copies as duplicates and omit all of them when creating target holes for our dataset. Note that the prompt proposal context can still come from the duplicate files. We felt comfortable with this choice since we wouldn’t want to predict a target hole in a duplicate file, but we can still use the context from the duplicate file to predict the hole in a file that is not its duplicate (e.g. in a sibling file). Further, we found that the repositories were quite uneven in terms of their size. To avoid large repositories dominating the training of PPC, we capped the maximum contribution of holes from a repository to 10,000, i.e. if the total number of holes in the repository exceeded 10,000, we selected 10,000 holes randomly from the total holes.
|
| 98 |
+
|
| 99 |
+
Please see the left part of Figure 2 for statistics of our dataset. The #Holes represents the holes after deduplication and capping. For some of our prompt proposals, we require semantic information that can be obtained with a parse tree. We used the tree-sitter API for Java 6 that enables us to get the AST of a file and query it. Since our prompt proposals need information at a repository level, we stored some extra information that allowed us to collate the information from individual files according to the directory structure inside the repository (see Appendix A for more details).
|
| 100 |
+
|
| 101 |
+
# 3.2 EXPERIMENTAL DETAILS
|
| 102 |
+
|
| 103 |
+
Prompt Generation: We used the OpenAI Codex Completions API for generating the predicted hole from the Codex model. In particular, we used the code-davinci-001 engine with temperature set to 1.0 and stop criteria as newline. The completion length was kept to be 24 and the maximum prompt length was 4072. Tokenization was done using the suggested tokenizer 7. To allow for fast computation, we used simple models like CodeBERT (Feng et al., 2020) and GraphCodeBERT (Guo et al., 2020) as our pretrained models. One of the limitations of these pretrained models is that the maximum context length that can be taken as input by these models is much smaller than the maximum context length allowed by Codex. Therefore, when getting the representation of the prompt proposal context that is used by PPC, we need to truncate the prompt proposal context that might lead to omitting important parts of the prompt proposal context in certain cases. Using pretrained models that allow larger context length or models that augment the context (Wu et al., 2022) offer avenues for future work. See Appendix D.4 for results when using a smaller context length from Codex.
|
| 104 |
+
|
| 105 |
+
Computational Complexity and Scalability of RLPG: To collect the ground-truth data for training our prompt proposal classifier, we queried the Codex API for each applicable prompt proposal per hole (maximum rate limit of 400 holes per minute). The computational complexity of training our larger RLPG-R variant (3.6M parameters, 141269 holes and 9.19 minutes per epoch on a single Tesla $\mathbf { V } 1 0 0 \mathbf { G P U }$ ) is much smaller than finetuning all or some part of Codex (12B parameters). During inference, we need to calculate the repo-level statistics just once and all the subsequent hole completions in the repo can utilize this cached information, incurring no additional computational complexity. Besides training the PPC, all our experiments were performed on a CPU with 8GB RAM. Our prompt proposals are based on concepts such as post lines, imports, similar name files, method names and identifiers that are quite general and are applicable to other programming languages. In addition to the existing prompt proposals, our framework provides the flexibility to incorporate new prompt proposals. Since the cost of retraining RLPG with the extended prompt proposals is extremely low (much lower than finetuning Codex with the new prompt proposals), our framework can be used to make interventions on the LLM to address observed weaknesses as long as the intervention can be expressed as a prompt proposal that adds the missing context to the LLM. As opposed to techniques that perform prompt engineering in the latent space and require access to the weights of the LLM such as Li & Liang (2021), RLPG facilitates expressing intent in the form of prompt proposals that are intuitive for humans, easy to understand and do not require access to the weights of the LLM.
|
| 106 |
+
|
| 107 |
+
Figure 2: (Left) Statistics of our dataset; (Right) Performance of the oracle relative to Codex.
|
| 108 |
+
|
| 109 |
+
<table><tr><td>Feature</td><td>Train</td><td>Val</td><td>Test</td><td>Total</td></tr><tr><td># Repositories</td><td>19</td><td>14</td><td>14</td><td>47</td></tr><tr><td>#Files</td><td>2655</td><td>1060</td><td>1308</td><td>4757</td></tr><tr><td>#Holes</td><td>92721</td><td>48548</td><td>48288</td><td>189557</td></tr></table>
|
| 110 |
+
|
| 111 |
+
<table><tr><td>Data Split</td><td>SR Codex(%)</td><td>SR Oracle(%)</td><td>Rel.个 over Codex(%)</td></tr><tr><td>Train</td><td>59.78</td><td>80.29</td><td>34.31</td></tr><tr><td>Val</td><td>62.10</td><td>79.05</td><td>27.28</td></tr><tr><td>Test</td><td>58.73</td><td>79.63</td><td>35.58</td></tr></table>
|
| 112 |
+
|
| 113 |
+
Methods: We experimented with the following methods for generating the prompt:
|
| 114 |
+
|
| 115 |
+
1. Codex: Using the default context from Codex as the entire prompt.
|
| 116 |
+
|
| 117 |
+
2. Oracle: Using the ground-truth vector $Y ^ { h }$ (mentioned in Section 2.2). The prompt generated corresponds to using any of the successful prompt proposals (i.e., $y _ { p } ^ { h } \overset { \cdot } { = } 1 .$ ). Since this information is not available at inference, the oracle performance represents an upper bound.
|
| 118 |
+
|
| 119 |
+
3. Fixed Prompt Proposal: Using the most successful prompt proposal for all target holes. This was chosen based on the performance on the validation set and corresponded to taking $7 5 \%$ of the total context length from post lines in the current file.
|
| 120 |
+
|
| 121 |
+
4. RLPG-H and RLPG-R: Using the prompt proposal predicted by the RLPG-H and RLPG-H varients of PPC. The selected prompt proposal corresponds to taking the argmax of the predicted probabilities over different prompt proposals.
|
| 122 |
+
|
| 123 |
+
5. RLPG-BM25: Instead of using PPC to rank prompt proposals, using the scores obtained by BM25 (Jones et al., 2000) to select the best prompt proposal. The scores are calculated with the hole window being the query and prompt proposal contexts being the search documents. This serves as a non-learned retrieval method that makes use of our prompt proposals.
|
| 124 |
+
|
| 125 |
+
6. File-level BM25: Same as above, except that instead of using our prompt proposal contexts, search documents consist of full context from other files in the repository.
|
| 126 |
+
|
| 127 |
+
7. Random: For each target hole, select a context randomly from anywhere in the reposito
|
| 128 |
+
|
| 129 |
+
8. Random NN: Same as Random, except that amongst the randomly chosen contexts, we take the nearest neighbours of the hole window in the representation space of a pretrained model. This is analogous to the technique used in Liu et al. (2022).
|
| 130 |
+
|
| 131 |
+
9. Identifier Usage: For each target hole, we take the closest identifier and take usage windows of that identifier from everywhere in the repository. We take two lines above, two lines below and the usage line as the usage window. We can rank the usage windows either randomly (random) or based on the nearest neighbour distance to the hole window in the representation space (NN).
|
| 132 |
+
|
| 133 |
+
The last four methods help us understand the performance when a context other than the prompt proposal context is used. To generate a prompt using these methods, we take $50 \%$ of the context from these followed by the default Codex context that takes up the remaining context length. For the NN baselines, we use CodeBERT (Feng et al., 2020) as the pretrained model. The contexts are taken in the increasing order of the nearest neighbour distances, until we exhaust the allocated context length. RLPG-BM25 helps us understand the role of PPC. See Appendix C.3 for more details on the implementation of these methods.
|
| 134 |
+
|
| 135 |
+
Evaluation Metric: As mentioned in Section 2.2, to measure success, we used exact match between the predicted hole string generated by Codex and the target hole string. In our experiments, we report the percentage of successful holes divided by the total number of holes for each split. We will call this success rate (SR) going forward.
|
| 136 |
+
|
| 137 |
+
# 3.3 RESULTS
|
| 138 |
+
|
| 139 |
+
In this section, we present the results of the following two research questions explored in this paper:
|
| 140 |
+
|
| 141 |
+
[RQ1] Is it useful to generate a prompt that is composed of code context that is different from the default Codex context? If yes, what context can be useful?
|
| 142 |
+
[RQ2] For each target hole, is there a way of automatically selecting the prompt? If yes, how does this system perform relative to Codex?
|
| 143 |
+
|
| 144 |
+
RQ1 - Performance of Prompt Proposals: We found that combining the prompt proposal context (context from other files in the repository) with the default Codex context led to substantial improvement in performance. The right part of Figure 2 shows the performance of an oracle constructed from our prompt proposals. We see that across all data splits, the prompt proposals contribute to significantly large improvements over Codex (upto $36 \%$ for test split). These results might seem surprising as Codex has not been trained on prompts that consist of context other than the default Codex context. What makes this result more surprising is that in most of the cases, the prompt consists of mashed up context without logical ordering that may not even look like a semantically meaningful chunk of code (e.g. list of string literals from a sibling file followed by the default Codex context or post lines placed before the default Codex context as opposed to after). These results might suggest that as long as the relevant context (in our case repo-level knowledge in the form of prompt proposals) is present in any form in the prompt, it can be quite effective.
|
| 145 |
+
|
| 146 |
+
Table 1: Success Rate (SR) of different methods on the test data when averaged across all holes (hole-wise) and across individual repositories (repo-wise)
|
| 147 |
+
|
| 148 |
+
<table><tr><td>Method</td><td>Success Rate(%) (hole-wise)</td><td>Rel. ↑(%) (hole-wise)</td><td>Success Rate(%) (repo-wise)</td><td>Rel.↑(%) (repo-wise)</td></tr><tr><td>Codex (Chen et al.,2021)</td><td>58.73</td><td>-</td><td>60.64</td><td>=</td></tr><tr><td>Oracle</td><td>79.63</td><td>35.58</td><td>80.24</td><td>32.31</td></tr><tr><td>Random</td><td>58.13</td><td>-1.02</td><td>58.95</td><td>-2.79</td></tr><tr><td>Random NN</td><td>58.98</td><td>0.43</td><td>60.04</td><td>-0.99</td></tr><tr><td>File-level BM25</td><td>63.14</td><td>7.51</td><td>64.28</td><td>6.00</td></tr><tr><td>Identifier Usage (Random)</td><td>64.93</td><td>10.55</td><td>67.83</td><td>11.85</td></tr><tr><td>Identifier Usage (NN)</td><td>64.91</td><td>10.52</td><td>67.94</td><td>12.03</td></tr><tr><td>Fixed Prompt Proposal</td><td>65.78</td><td>12.00</td><td>68.01</td><td>12.15</td></tr><tr><td>RLPG-BM25</td><td>66.41</td><td>13.07</td><td>68.15</td><td>12.39</td></tr><tr><td>RLPG-H</td><td>68.51</td><td>16.65</td><td>69.26</td><td>14.21</td></tr><tr><td>RLPG-R</td><td>67.80</td><td>15.44</td><td>69.28</td><td>14.26</td></tr></table>
|
| 149 |
+
|
| 150 |
+
RQ2 - Performance of PPC: Having seen promise in our prompt proposals, next we present the results of RLPG, which for each target hole predicts a single best prompt proposal. Table 1 presents the success rates along with the percentage of relative improvements for the test data. The second and third columns correspond to the averages across all holes in the test data. The last two columns correspond to the average success rate of individual repositories. The latter metric doesn’t account for the size of the repository. As can be seen from the table, all the RLPG variants as well as the fixed prompt proposal improve the performance significantly over Codex. The random baselines are either worse or on par with Codex. Identifier usage is a good baseline but still performs worse than either the fixed prompt proposal or RLPG. The improved performance of RLPG-BM25 as compared to fixed prompt proposal shows the value of generating example-specific prompts using RLPG. However, both the learned variants of RLPG, i.e., RLPG-H and RLPG-R outperform the RLPG-BM25, highlighting the importance of learning PPC. See Appendix D.5 for performance of all methods on individual repositories. Note that even though we consider identifier usage as a separate baseline, one could consider it as one of the prompt proposal leading to further improved performance of RLPG.
|
| 151 |
+
|
| 152 |
+
Despite our efforts of avoiding overlap, since the training data for Codex is not exactly known, there might be a slight possibility that part of our Google Code data is part of the training data for Codex. Even if there were an overlap, we want to point out that since Codex has seen the default Codex context during training, it would be more beneficial to use the default Codex context in the prompt rather than the context from the prompt proposals or any other context from other baselines. Therefore, under this scenario, our evaluation would be more generous to the Codex baseline with results biased more in favour of the Codex baseline than other methods we have used.
|
| 153 |
+
|
| 154 |
+
Variation with #attempts: Imagine a scenario where we have a human-in-the-loop who has been given $k$ attempts to prompt the LLM and then can choose one of the $k$ hole predictions. We wanted to see how does the performance of our framework varies with #attempts under this setting. This corresponds to using $k$ prompts generated with top- $k$ prompt proposals (one prompt per proposal) and marking success if any of the $k$ prompts lead to success. The left part of Figure 3 shows the variation of SR over the validation data with the value of $k$ . For RLPG, the top- $k$ prompt proposals were chosen based on the decreasing order of probabilities given by PPC. For the fixed prompt proposal, the top- $k$ prompt proposals were decided based on decreasing order of success rate of the individual prompt proposals on the validation dataset. From the figure, we notice that as we increase the value of $k$ , the performance increases gradually at first and then saturates towards the oracle performance $( 7 9 . 0 5 \%$ for val data). This behaviour is observed for both fixed prompt proposal as well as RLPG. However, we see that for the same value of $k$ , the success rate for RLPG is higher indicating that PPC learns a useful ranking of the prompt proposal contexts that can scale well with the #attempts.
|
| 155 |
+
|
| 156 |
+

|
| 157 |
+
Figure 3: (Left) Variation of RLPG and Fixed Prompt Proposal with #attempts $( k )$ ; (Right) Mean success rates of different prompt sources when they are applicable.
|
| 158 |
+
|
| 159 |
+
Performance based on Prompt Proposals: The right part of Figure 3 shows mean success rate of prompt sources when we count success only when the corresponding prompt source is applicable. From the figure, we see that the current file is the most important prompt source. Closely following are sibling files and similar name files. We see that all prompt sources have non-zero chances of success, highlighting the usefulness of each prompt source. See Appendix D.1 for a similar breakdown based on prompt context type and Appendix E for analysis of successful and failed sample cases.
|
| 160 |
+
|
| 161 |
+
# 4 RELATED WORK
|
| 162 |
+
|
| 163 |
+
LLMs for Code: Recently, there has been a lot of work around large language models of code. One class of models are the decoder-only models that correspond to generating code from left-to-right. Codex (Chen et al., 2021), Google’s model (Austin et al., 2021), GPT-J-6B (Wang & Komatsuzaki, 2021), GPT-Neo (Black et al., 2021b), GPT-Neo-X (Black et al., 2021a), CodeParrot (Tunstall et al., 2022), PolyCoder (Xu et al., 2022a) and InCoder (Fried et al., 2022) are some examples. We also have some encoder-only models that use a masked language modelling objective. CodeBERT (Feng et al., 2020), GraphcodeBERT (Guo et al., 2020) and CuBERT (Kanade et al., 2020) are examples of such models. Lastly, we have the class of encoder-decoder models that generally use a bidirectional encoding of a context to decode a series of masked tokens. Code-T5 (Wang et al., 2021) and AlphaCode (Li et al., 2022) are examples of such models.
|
| 164 |
+
|
| 165 |
+
Repo-Level Info: Fewer works use information from outside the current file. Hellendoorn & Devanbu (2017) propose a nested n-gram model that utilizes a locality-based cache where the locality consists of all directories from the root of the project (inclusive of the current file). Zhang et al. (2021) uses the parent class to generate the comments for the child class. Pashakhanloo et al. (2022b;a) capture the structure and semantics of the repository by converting it into a relational database and propose a graph-walk based mechanism for pruning the unrelated context. Lyu et al. (2021) incorporates the API-dependency graph in a LSTM-based Seq2Seq model to assist in code generation. Xu et al. (2022b) incorporate three types of structural locality features while training the kNN-LM (Khandelwal et al., 2020). These features are binary variables that correspond to the presence or absence of similar hierarchy. The three levels of hierarchy are (a) sibling file, (b) file in the same repo (c) no hierarchy. In contrast we have a much richer set of prompt proposals incorporating the semantics and structure of the repository. Also, we assume black-box access to the actual LM and restrict ourselves to generating a prompt for the LLM without performing any finetuning of the LLM.
|
| 166 |
+
|
| 167 |
+
Prompt Generation: There have been promising works around prompt generation techniques in NLP. Broadly, there are two categories of automatic prompt generation techniques. The first category corresponds to producing continuous/soft prompts where the prompt is described in the latent space of a language model (Li & Liang, 2021; Qin & Eisner, 2021; Bragg et al., 2021; Lester et al., 2021; Liu et al., 2021b). For example, Prefix-Tuning (Li & Liang, 2021) adds a prefix to the LM that can be learned by finetuning on examples from the downstream task. The second category produces discrete prompts where the prompt is a text string that can be interpreted by a human (Shin et al., 2020; Gao et al., 2021; Schick & Schütze, 2021). For example, Autoprompt (Shin et al., 2020) generates prompt using a fixed template consisting of trigger tokens. The trigger tokens are shared across all inputs and determined by a gradient-guided search involving the LM. Our work falls in the category of discrete prompt generation techniques as we produce a prompt consisting of code tokens that can be easily interpreted by a human. However, in contrast to prior works that use a set of fixed templates for all examples, we learn to produce prompts conditioned on each example. Another important distinction is that we do not require access to the weights of the LM. A concurrent work as ours (Wang et al., 2022) studies the role of prompt-tuning when compared to fine-tuning for code translation, defect localization and code summarization. However, their technique requires access to the weights of the LLM and they perform experiments over models that are much smaller in scale than Codex. To the best of our knowledge, our work is the first to explore automatic prompt generation in a black-box access setting in the domain of source code.
|
| 168 |
+
|
| 169 |
+
# 5 CONCLUSIONS AND FUTURE DIRECTIONS
|
| 170 |
+
|
| 171 |
+
We present RLPG, a framework that learns to automatically generate prompts conditioned on the example, without requiring access to the weights of the LLM. RLPG utilizes the structure of the repository as well as the context from other files in the repository using a set of easy to understand prompt proposals. Note that even though we have scoped and worded our prompt proposals to be repository-level, the idea of RLPG and prompt proposals in itself is quite universal and need not be scoped to a repository. Taking context from other repositories as well as external knowledge such as API dependencies offers an interesting direction to explore in the future. In this work, we are taking context from only one prompt proposal. For future work, we want to learn a model that can automatically compose a prompt from multiple prompt proposals (see Appendix D.3 for promising initial results). Other interesting directions include incorporating the user’s feedback in RLPG and extending RLPG to multi-line code autocompletion.
|
| 172 |
+
|
| 173 |
+
# REFERENCES
|
| 174 |
+
|
| 175 |
+
Miltiadis Allamanis. The adverse effects of code duplication in machine learning models of code, 2018. URL https://arxiv.org/abs/1812.06469.
|
| 176 |
+
|
| 177 |
+
Jacob Austin, Augustus Odena, Maxwell Nye, Maarten Bosma, Henryk Michalewski, David Dohan, Ellen Jiang, Carrie Cai, Michael Terry, Quoc Le, et al. Program synthesis with large language models. arXiv preprint arXiv:2108.07732, 2021.
|
| 178 |
+
|
| 179 |
+
Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E. Hinton. Layer normalization, 2016.
|
| 180 |
+
|
| 181 |
+
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, 2021a. URL http://github.com/eleutherai/ gpt-neox.
|
| 182 |
+
|
| 183 |
+
Sid Black, Leo Gao, Phil Wang, Connor Leahy, and Stella Biderman. GPT-Neo: Large Scale Autoregressive Language Modeling with Mesh-Tensorflow, March 2021b. URL https:// doi.org/10.5281/zenodo.5297715. If you use this software, please cite it using these metadata.
|
| 184 |
+
|
| 185 |
+
Jonathan Bragg, Arman Cohan, Kyle Lo, and Iz Beltagy. FLEX: Unifying evaluation for few-shot NLP. In A. Beygelzimer, Y. Dauphin, P. Liang, and J. Wortman Vaughan (eds.), Advances in Neural Information Processing Systems, 2021. URL https://openreview.net/forum? id=_WnGcwXLYOE.
|
| 186 |
+
|
| 187 |
+
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
|
| 188 |
+
|
| 189 |
+
Dario Amodei. Language models are few-shot learners. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 1877–1901. Curran Associates, Inc., 2020. URL https://proceedings.neurips. cc/paper/2020/file/1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf.
|
| 190 |
+
|
| 191 |
+
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.
|
| 192 |
+
|
| 193 |
+
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.
|
| 194 |
+
|
| 195 |
+
Zhangyin Feng, Daya Guo, Duyu Tang, Nan Duan, Xiaocheng Feng, Ming Gong, Linjun Shou, Bing Qin, Ting Liu, Daxin Jiang, et al. Codebert: A pre-trained model for programming and natural languages. arXiv preprint arXiv:2002.08155, 2020.
|
| 196 |
+
|
| 197 |
+
Daniel Fried, Armen Aghajanyan, Jessy Lin, Sida Wang, Eric Wallace, Freda Shi, Ruiqi Zhong, Wen-tau Yih, Luke Zettlemoyer, and Mike Lewis. Incoder: A generative model for code infilling and synthesis, 2022. URL https://arxiv.org/abs/2204.05999.
|
| 198 |
+
|
| 199 |
+
Tianyu Gao, Adam Fisch, and Danqi Chen. Making pre-trained language models better few-shot learners. 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. 3816–3830, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.295. URL https://aclanthology.org/2021.acllong.295.
|
| 200 |
+
|
| 201 |
+
Daya Guo, Shuo Ren, Shuai Lu, Zhangyin Feng, Duyu Tang, Shujie Liu, Long Zhou, Nan Duan, Alexey Svyatkovskiy, Shengyu Fu, et al. Graphcodebert: Pre-training code representations with data flow. arXiv preprint arXiv:2009.08366, 2020.
|
| 202 |
+
|
| 203 |
+
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.
|
| 204 |
+
|
| 205 |
+
Vincent J. Hellendoorn and Premkumar Devanbu. Are deep neural networks the best choice for modeling source code? In Proceedings of the 2017 11th Joint Meeting on Foundations of Software Engineering, ESEC/FSE 2017, pp. 763–773, New York, NY, USA, 2017. Association for Computing Machinery. ISBN 9781450351058. doi: 10.1145/3106237.3106290. URL https://doi.org/10.1145/3106237.3106290.
|
| 206 |
+
|
| 207 |
+
Ellen Jiang, Edwin Toh, Alejandra Molina, Kristen Olson, Claire Kayacik, Aaron Donsbach, Carrie J Cai, and Michael Terry. Discovering the syntax and strategies of natural language programming with generative language models. In Proceedings of the 2022 CHI Conference on Human Factors in Computing Systems, CHI ’22, New York, NY, USA, 2022. Association for Computing Machinery. ISBN 9781450391573. doi: 10.1145/3491102.3501870. URL https://doi.org/10.1145/ 3491102.3501870.
|
| 208 |
+
|
| 209 |
+
Karen Sparck Jones, Steve Walker, and Stephen E. Robertson. A probabilistic model of information retrieval: development and comparative experiments - part 1. Inf. Process. Manag., 36(6):779–808, 2000. doi: 10.1016/S0306-4573(00)00015-7. URL https://doi.org/10.1016/S0306- 4573(00)00015-7.
|
| 210 |
+
|
| 211 |
+
Aditya Kanade, Petros Maniatis, Gogul Balakrishnan, and Kensen Shi. Learning and evaluating contextual embedding of source code. In Proceedings of the 37th International Conference on Machine Learning, ICML 2020, 12-18 July 2020, Proceedings of Machine Learning Research. PMLR, 2020.
|
| 212 |
+
|
| 213 |
+
Urvashi Khandelwal, Omer Levy, Dan Jurafsky, Luke Zettlemoyer, and Mike Lewis. Generalization through memorization: Nearest neighbor language models. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $\cdot ^ { = }$ HklBjCEKvH.
|
| 214 |
+
|
| 215 |
+
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.
|
| 216 |
+
|
| 217 |
+
Takeshi Kojima, Shixiang Shane Gu, Machel Reid, Yutaka Matsuo, and Yusuke Iwasawa. Large language models are zero-shot reasoners. arXiv preprint arXiv:2205.11916, 2022.
|
| 218 |
+
|
| 219 |
+
Brian Lester, Rami Al-Rfou, and Noah Constant. The power of scale for parameter-efficient prompt tuning. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pp. 3045–3059, Online and Punta Cana, Dominican Republic, November 2021. Association for Computational Linguistics. URL https://aclanthology.org/2021. emnlp-main.243.
|
| 220 |
+
|
| 221 |
+
Xiang Lisa Li and Percy Liang. Prefix-tuning: Optimizing continuous prompts for generation. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 4582–4597, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/ v1/2021.acl-long.353. URL https://aclanthology.org/2021.acl-long.353.
|
| 222 |
+
|
| 223 |
+
Yujia Li, David Choi, Junyoung Chung, Nate Kushman, Julian Schrittwieser, Rémi Leblond, Tom Eccles, James Keeling, Felix Gimeno, Agustin Dal Lago, Thomas Hubert, Peter Choy, Cyprien de Masson d’Autume, Igor Babuschkin, Xinyun Chen, Po-Sen Huang, Johannes Welbl, Sven Gowal, Alexey Cherepanov, James Molloy, Daniel J. Mankowitz, Esme Sutherland Robson, Pushmeet Kohli, Nando de Freitas, Koray Kavukcuoglu, and Oriol Vinyals. Competition-level code generation with alphacode, 2022. URL https://arxiv.org/abs/2203.07814.
|
| 224 |
+
|
| 225 |
+
Jiachang Liu, Dinghan Shen, Yizhe Zhang, Bill Dolan, Lawrence Carin, and Weizhu Chen. What makes good in-context examples for GPT-3? In Proceedings of Deep Learning Inside Out (DeeLIO 2022): The 3rd Workshop on Knowledge Extraction and Integration for Deep Learning Architectures, pp. 100–114, Dublin, Ireland and Online, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.deelio-1.10. URL https://aclanthology.org/2022. deelio-1.10.
|
| 226 |
+
|
| 227 |
+
Pengfei Liu, Weizhe Yuan, Jinlan Fu, Zhengbao Jiang, Hiroaki Hayashi, and Graham Neubig. Pre-train, prompt, and predict: A systematic survey of prompting methods in natural language processing, 2021a. URL https://arxiv.org/abs/2107.13586.
|
| 228 |
+
|
| 229 |
+
Xiao Liu, Yanan Zheng, Zhengxiao Du, Ming Ding, Yujie Qian, Zhilin Yang, and Jie Tang. Gpt understands, too. arXiv:2103.10385, 2021b.
|
| 230 |
+
|
| 231 |
+
Chen Lyu, Ruyun Wang, Hongyu Zhang, Hanwen Zhang, and Songlin Hu. Embedding api dependency graph for neural code generation. Empirical Softw. Engg., 26(4), jul 2021. ISSN 1382-3256. doi: 10.1007/s10664-021-09968-2. URL https://doi.org/10.1007/s10664-021- 09968-2.
|
| 232 |
+
|
| 233 |
+
Pardis Pashakhanloo, Aaditya Naik, Hanjun Dai, Petros Maniatis, and Mayur Naik. Learning to walk over relational graphs of source code. In Deep Learning for Code Workshop, 2022a. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ SubGAoOWJWc.
|
| 234 |
+
|
| 235 |
+
Pardis Pashakhanloo, Aaditya Naik, Yuepeng Wang, Hanjun Dai, Petros Maniatis, and Mayur Naik. Codetrek: Flexible modeling of code using an extensible relational representation. In International Conference on Learning Representations, 2022b. URL https://openreview. net/forum?id=WQc075jmBmf.
|
| 236 |
+
|
| 237 |
+
Guanghui Qin and Jason Eisner. Learning how to ask: Querying LMs with mixtures of soft prompts. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 5203–5212, Online, June 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.naacl-main.410. URL https: //aclanthology.org/2021.naacl-main.410.
|
| 238 |
+
|
| 239 |
+
Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical TextConditional Image Generation with CLIP Latents. arXiv e-prints, art. arXiv:2204.06125, April 2022.
|
| 240 |
+
|
| 241 |
+
Scott Reed, Konrad Zolna, Emilio Parisotto, Sergio Gomez Colmenarejo, Alexander Novikov, Gabriel Barth-Maron, Mai Gimenez, Yury Sulsky, Jackie Kay, Jost Tobias Springenberg, Tom Eccles, Jake Bruce, Ali Razavi, Ashley Edwards, Nicolas Heess, Yutian Chen, Raia Hadsell, Oriol Vinyals, Mahyar Bordbar, and Nando de Freitas. A generalist agent, 2022. URL https: //arxiv.org/abs/2205.06175.
|
| 242 |
+
|
| 243 |
+
Laria Reynolds and Kyle McDonell. Prompt programming for large language models: Beyond the few-shot paradigm, 2021. URL https://arxiv.org/abs/2102.07350.
|
| 244 |
+
|
| 245 |
+
Alexander Rives, Joshua Meier, Tom Sercu, Siddharth Goyal, Zeming Lin, Jason Liu, Demi Guo, Myle Ott, C. Lawrence Zitnick, Jerry Ma, and Rob Fergus. Biological structure and function emerge from scaling unsupervised learning to 250 million protein sequences. bioRxiv, 2019. doi: 10.1101/622803. URL https://www.biorxiv.org/content/10.1101/622803v4.
|
| 246 |
+
|
| 247 |
+
Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. Highresolution image synthesis with latent diffusion models, 2021.
|
| 248 |
+
|
| 249 |
+
Timo Schick and Hinrich Schütze. Exploiting cloze-questions for few-shot text classification and natural language inference. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, pp. 255–269, Online, April 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.eacl-main.20. URL https://aclanthology.org/2021.eacl-main.20.
|
| 250 |
+
|
| 251 |
+
Taylor Shin, Yasaman Razeghi, Robert L. Logan IV, Eric Wallace, and Sameer Singh. AutoPrompt: Eliciting knowledge from language models with automatically generated prompts. In Empirical Methods in Natural Language Processing (EMNLP), 2020.
|
| 252 |
+
|
| 253 |
+
Disha Shrivastava, Hugo Larochelle, and Daniel Tarlow. On-the-fly adaptation of source code models. In NeurIPS 2020 Workshop on Computer-Assisted Programming, 2020. URL https: //openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ FeVaSthrFst.
|
| 254 |
+
|
| 255 |
+
Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. J. Mach. Learn. Res., 15(1): 1929–1958, jan 2014. ISSN 1532-4435.
|
| 256 |
+
|
| 257 |
+
Jiao Sun, Q. Vera Liao, Michael Muller, Mayank Agarwal, Stephanie Houde, Kartik Talamadupula, and Justin D. Weisz. Investigating explainability of generative ai for code through scenario-based design. In 27th International Conference on Intelligent User Interfaces, IUI ’22, pp. 212–228, New York, NY, USA, 2022. Association for Computing Machinery. ISBN 9781450391443. doi: 10.1145/3490099.3511119. URL https://doi.org/10.1145/3490099.3511119.
|
| 258 |
+
|
| 259 |
+
Lewis Tunstall, Leandro von Werra, and Thomas Wolf. Natural Language Processing with Transformers. " O’Reilly Media, Inc.", 2022.
|
| 260 |
+
|
| 261 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, undefinedukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Proceedings of the 31st International Conference on Neural Information Processing Systems, NIPS’17, pp. 6000–6010, Red Hook, NY, USA, 2017. Curran Associates Inc. ISBN 9781510860964.
|
| 262 |
+
|
| 263 |
+
Ben Wang and Aran Komatsuzaki. GPT-J-6B: A 6 Billion Parameter Autoregressive Language Model. https://github.com/kingoflolz/mesh-transformer-jax, May 2021.
|
| 264 |
+
|
| 265 |
+
Chaozheng Wang, Yuanhang Yang, Cuiyun Gao, Yun Peng, Hongyu Zhang, and Michael R. Lyu. No more fine-tuning? an experimental evaluation of prompt tuning in code intelligence. In Proceedings of the 30th ACM Joint European Software Engineering Conference and Symposium on the Foundations of Software Engineering. ACM, nov 2022. doi: 10.1145/3540250.3549113. URL https://doi.org/10.1145%2F3540250.3549113.
|
| 266 |
+
|
| 267 |
+
Yue Wang, Weishi Wang, Shafiq Joty, and Steven C.H. Hoi. Codet5: Identifier-aware unified pretrained encoder-decoder models for code understanding and generation. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, EMNLP 2021, 2021.
|
| 268 |
+
|
| 269 |
+
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.
|
| 270 |
+
|
| 271 |
+
Yuhuai Wu, Markus Norman Rabe, DeLesley Hutchins, and Christian Szegedy. Memorizing transformers. In International Conference on Learning Representations, 2022. URL https: //openreview.net/forum?id ${ . } =$ TrjbxzRcnf-.
|
| 272 |
+
|
| 273 |
+
Wen Xiao, Iz Beltagy, Giuseppe Carenini, and Arman Cohan. PRIMERA: Pyramid-based masked sentence pre-training for multi-document summarization. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 5245– 5263, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/ 2022.acl-long.360. URL https://aclanthology.org/2022.acl-long.360.
|
| 274 |
+
|
| 275 |
+
Frank F Xu, Uri Alon, Graham Neubig, and Vincent J Hellendoorn. A systematic evaluation of large language models of code. arXiv preprint arXiv:2202.13169, 2022a.
|
| 276 |
+
|
| 277 |
+
Frank F. Xu, Junxian He, Graham Neubig, and Vincent Josua Hellendoorn. Capturing structural locality in non-parametric language models. In International Conference on Learning Representations, 2022b. URL https://openreview.net/forum?id $=$ nnU3IUMJmN.
|
| 278 |
+
|
| 279 |
+
Jiyang Zhang, Sheena Panthaplackel, Pengyu Nie, Raymond J. Mooney, Junyi Jessy Li, and Milos Gligoric. Learning to generate code comments from class hierarchies, 2021. URL https: //arxiv.org/abs/2103.13426.
|
| 280 |
+
|
| 281 |
+
# A DATASET CREATION DETAILS
|
| 282 |
+
|
| 283 |
+
# A.1 CREATION OF HOLE COMPLETION DATA
|
| 284 |
+
|
| 285 |
+
To collect the hole completion data, we scraped Google Code 8 for repositories tagged with the language “Java”. Then we deduplicated repositories by searching for a matching repository with the same name on GitHub. For those repositories with zero matching names on GitHub, we downloaded the archive and extracted the source code (preserving the directory structure). Next, we tried to determine the licenses of all repositories by either looking for a LICENSE file or matching with keywords "license", "copyright", "mit", etc. For repos for which our process was able to come up with a known license, we selected the ones having a permissive license, i.e., MIT, ApacheV2 and BSD. This was followed by removing files that are exact duplicates of each other within a repo. One of the reasons we found this inter-repository duplication may be because sometimes developers adopt lousy practises where instead of declaring a package and importing functions, they simply copy-paste the desired file in the current folder. The target holes coming from any of the duplicate files do not form part of the hole completion dataset. However, these files might be used to contribute to prompt proposal context for completing a target hole in a non-duplicate file. For the remaining files, we took each line that is not a blanked line or a comment, and chose the middle character as the hole position, i.e., all the characters from the middle of the line to the end of the line form target hole. To avoid large repos having strong bias on our prompt proposal classifier, we capped the contribution from each repo to be a maximum of 10000 holes. If the number of holes in the repo exceeds 10000, we randomly select 10000 holes.
|
| 286 |
+
|
| 287 |
+
# A.2 CREATION OF DATA FOR REPO-LEVEL PROMPT PROPOSALS
|
| 288 |
+
|
| 289 |
+
We used the tree-sitter API for Java 9 to get the parse-tree of an individual file in a repo. To get information at a repo-level, for each file in the repo, we stored the following information:
|
| 290 |
+
|
| 291 |
+
1. list of all class names in the file. This helped us to get the parent or child class file corresponding to a given parent or child class.
|
| 292 |
+
2. the file corresponding to each import statement.
|
| 293 |
+
3. for each import statement in the file, the position in the file where the import is used. This is used for ranking the files based on the heuristics mentioned in Table 2.
|
| 294 |
+
4. list of sibling files
|
| 295 |
+
5. list of similar name files. This was done by splitting the filenames based on either camel-case or underscore. If the sub-parts of two files match, then they are said to have similar name.
|
| 296 |
+
|
| 297 |
+
The above meta-data was calculated only once for each repo. The subsequent hole completions can use the same cached information. In practise, we can use a hash to store and retrieve this info efficiently. For a prompt proposal, given the prompt source, we first obtain a single file or ranked list of files (see Table 2) using the info in the parse tree in conjugation with the above repo-level meta-data. All the prompt proposal context type information (MN, MNB, SL, I, TI, FD) can then be obtained by querying the parse tree of the selected file.
|
| 298 |
+
|
| 299 |
+
# B PROMPT PROPOSAL DETAILS
|
| 300 |
+
|
| 301 |
+
# B.1 RANKING OF FILES BASED ON PROMPT SOURCE
|
| 302 |
+
|
| 303 |
+
In Table 2, we provide details of how we select files for a given prompt source. Depending on the prompt proposal, we get either a single file or a list of files ranked based on some criteria. For example, if the prompt source is Import, we take all the import statements used in the current file and identify the location in the current file where the corresponding imports have been used. According to our heuristic, the closer is the import usage to the hole position, the more likely it is for the prompt proposal context coming from the corresponding import file to be more relevant (to predict the target hole). We get a ranked list of import files sorted based on increasing order of distance (i.e., number of lines ) between the import usage and the hole position. We start by taking all of the prompt proposal context from the first file in the ranked list and then keep iterating the ranked list until either the total context length allocated to the prompt proposal gets exhausted or we reach the end of the ranked list.
|
| 304 |
+
|
| 305 |
+
Table 2: Selecting files for a prompt source
|
| 306 |
+
|
| 307 |
+
<table><tr><td>Prompt Source</td><td>File Ranking</td></tr><tr><td>Current Parent Class</td><td>file with the target hole.Returns a single file. file that contains the parent class that occurs closest to the target hole.</td></tr><tr><td>Import</td><td>Returns a single file. files with the corresponding import usage ranked based on the proximity</td></tr><tr><td>Sibling</td><td>to the hole.Returns a ranked list of files. files with import usage common to the current file and the sibling file,</td></tr><tr><td>Similar Name</td><td>ranked based on the proximity to the hole.The total number of common imports between the current and the sibling file is used as a tie-breaker. Returnsa ranked list of files. files with import usage common to the current file and the similar name</td></tr><tr><td>Child Class</td><td>file,ranked based on the proximity to the hole.The total number of common imports between the current and the similar name file is used as a tie-breaker.Returns a ranked list of files. files with import usage common to the current file and the child file,</td></tr><tr><td></td><td>ranked based on the proximity to the hole.The total number of common imports between the current and the child class file is used as a tie-breaker. Returns a ranked list of files.</td></tr><tr><td>Import of Sibling</td><td>import files ranked based on the frequency of usage in all the sibling files. Returns a ranked list of files.</td></tr><tr><td>Import of Similar Name</td><td>import file ranked on the basis of frequency of usage in all the similar name files.Returns a ranked list of files.</td></tr><tr><td>Import of Parent Class</td><td>import file ranked on the basis of frequency of usage in all the parent</td></tr><tr><td>Importof Child Class</td><td>class files.Returns a ranked list of fles. import file ranked on the basis of frequency of usage in all the child class</td></tr></table>
|
| 308 |
+
|
| 309 |
+
# B.2 EXAMPLES OF PROMPT CONTEXT TYPE
|
| 310 |
+
|
| 311 |
+
We provide examples of each of our prompt context type below:
|
| 312 |
+
|
| 313 |
+
1. Post Lines (PL) : For the example shown in Figure 1 of the main paper, post lines will take all the lines after the line mg.InitializeToAssignment(CurrentAssignments()) till we reach the end of the file (AffinityPropagation.java).
|
| 314 |
+
|
| 315 |
+
2. Identifiers (I): Identifiers are the names of variables used in the code. For example, for the prompt proposal context taken from the imported file shown in Figure 1 in the main paper (highlighted in violet), identifiers are InitializeToAssignment (line 1), a (line 1), currentAssignment_ (line 2), a ( line 2), clone (line 2), alreadyInitialized_ (line 3), justOneRound_ (line 4).
|
| 316 |
+
|
| 317 |
+
3. Type Identifiers (TI): Type Identifiers define the type of an identifier. For example, in the code snippet class DPAffinityPropagation extends AffinityPropagation [ AffinityPropagation is labeled as a type identifier. Similarly in the snippet DPAPParameters parameters_;, DPAPParameters is a type identifier.
|
| 318 |
+
|
| 319 |
+
4. Field Declarations (FD): The variables of a class type are introduced by field declarations. For example, double[][] mHijMujT_; and MessageValuePair[][] sortedMHijMujTs_; are examples of field declarations.
|
| 320 |
+
|
| 321 |
+
5. String Literals (SL): A string literal is the sequence of characters enclosed in doublequotes. For example, in the code snippet, System.err.println("DPAP load Warning: unknown parameter " $^ +$ entries[0] + ", value $\begin{array} { r l r } { \mathbf { \Sigma } } & { { } = } & { \mathbf { \Sigma } ^ { \mathsf { ~ \pm ~ } } } \end{array} \quad \Sigma \left( \begin{array} { l l } { \mathbf { \Sigma } } & { \mathbf { \Sigma } } \\ { \mathbf { \Sigma } } & { \mathbf { \Sigma } } \end{array} \right. + \mathbf { \Sigma }$ entries[1]);, we have two string literals: (a) "DPAP load Warning: unknown parameter " ; (b) ", value = "
|
| 322 |
+
|
| 323 |
+
6. Method Names (MN): For the example shown in Figure 1 of the main paper, public void InitializeToAssignment(int[] a) is the method name prompt context type. 7. Method Names and Bodies (MNB): For the example shown in Figure 1 of the main paper, the part highlighted in violet represents the method names and bodies.
|
| 324 |
+
|
| 325 |
+
B.3 TRUNCATION STRATEGIES FOR PROMPT PROPOSAL CONTEXT
|
| 326 |
+
|
| 327 |
+
If the prompt proposal context is greater than the context length allocated to it, then we need to truncate the prompt proposal context. We followed the below two schemes for truncating context:
|
| 328 |
+
|
| 329 |
+
• front: We truncate the context from the front. This is used for all prompt sources except Parent Class and when we take PL from Current.
|
| 330 |
+
• back: We truncate the context from the back. This is used when the prompt source is Parent Class and when we take prompt context types other than PL from Current.
|
| 331 |
+
|
| 332 |
+
The truncation strategies for each case were selected based on results on a small validation set. For the prompt source Current, except when the prompt context type is PL, we always start by taking code of prompt context type from after the hole position. This makes sense as the default Codex context will anyways contain code before the hole. Only if this turns out to be blank, we will use the code of context type from before the hole.
|
| 333 |
+
|
| 334 |
+
# B.4 LIST OF PROMPT PROPOSALS
|
| 335 |
+
|
| 336 |
+
Table 3: List of our proposed repo-level prompt proposals
|
| 337 |
+
|
| 338 |
+
<table><tr><td>Prompt Proposal ID</td><td>Prompt Source</td><td>Prompt Context Type</td></tr><tr><td>0,1,2,3,4</td><td>Current</td><td>MN, I, TI, SL,FD</td></tr><tr><td>5,6,7</td><td>Current</td><td>PL (taking 25%,50% and 75% contribution to the total context length)</td></tr><tr><td>8,9,10,11,12,13</td><td>Parent Class</td><td>MNB,MN,I, TI, SL,FD</td></tr><tr><td>14,15,16,17,18,19</td><td>Import</td><td>MNB,MN,I,TI, SL,FD</td></tr><tr><td>20,21,22,23,24,25</td><td>Sibling</td><td>MNB,MN,I, TI, SL,FD</td></tr><tr><td>26,27,28,29,30,31</td><td>Similar Name</td><td>MNB,MN,I,TI, SL,FD</td></tr><tr><td>32,33,34,35,36,37</td><td>Child Class</td><td>MNB,MN,I, TI, SL,FD</td></tr><tr><td>38,39,40,41,42,43</td><td>Import of Sibling</td><td>MNB,MN,I,TI,SL,FD</td></tr><tr><td>44,45,46,47,48,49</td><td>Import of Similar Name</td><td>MNB,MN,I,TI, SL,FD</td></tr><tr><td>50,51,52,53,54,55</td><td>Import of Parent Class</td><td>MNB,MN,I, TI, SL,FD</td></tr><tr><td>56,57,58,59,60,61</td><td>Import of Child Class</td><td>MNB,MN,I,TI, SL,FD</td></tr><tr><td>62</td><td>Codex</td><td></td></tr></table>
|
| 339 |
+
|
| 340 |
+
# B.5 OTHER PROMPT PROPOSAL VARIATIONS
|
| 341 |
+
|
| 342 |
+
We experimented with other variations that include: (a) appending class names at the beginning of the prompt proposal context, (b) using newline or space to join the prompt proposal context and the default Codex context, (c) taking all or the top- $k$ of the prompt context types, (d) ordering of top- $k$ .
|
| 343 |
+
|
| 344 |
+
• Context Separator: This defines how we join the prompt proposal context string to the default Codex context string. We experimented with space and newline as context separators. • Prompt Proposal Context Formatting: We can format the prompt proposal context before giving it to the Prompt Composer. We experimented with the following options:
|
| 345 |
+
1. class_name: append [class name of the file] at the beginning of the prompt proposal context taken from each file that is part of the prompt source. For example, if we are taking prompt proposal context from two import files $f 1$ and $f 2$ , the prompt proposal context will be formatted as: [class name of $f 1 ]$ prompt proposal context from $f 1 + { \mathrm { s p a c e } } +$ [class name of $f 2 ]$ prompt proposal context from $f 2$ . We use this when the prompt proposal context types are MN, I, TI, FD and SL.
|
| 346 |
+
2. class_method_name: we apply this only when the prompt proposal context type is MNB. We append method names at the beginning of each of the corresponding method bodies. We also
|
| 347 |
+
|
| 348 |
+
append the prompt proposal context from a file with the name of the class as described in the previous item.
|
| 349 |
+
|
| 350 |
+
3. comment: Adding in the prompt proposal context as a comment, i.e., formatting it as: $/ * *$ prompt proposal context $^ { * } / .$ . This wasn’t found to be much useful.
|
| 351 |
+
|
| 352 |
+
4. none: passing the prompt proposal context as it is. We use this when the prompt proposal context type is PL.
|
| 353 |
+
|
| 354 |
+
• Top- $\mathbf { k }$ Type: For each of the prompt proposal context types, except PL, we experimented with taking the (a) first (b) last and (c) all of the prompt proposal context types, i.e., we can take first-10 identifiers. We found ’all’ to be the best among all.
|
| 355 |
+
|
| 356 |
+
• Top-k: We experiment with k values of (a) 10 (b) 20 and (c) all. We found ’all’ to work best for all prompt context types.
|
| 357 |
+
|
| 358 |
+
# C IMPLEMENTATION DETAILS
|
| 359 |
+
|
| 360 |
+
# C.1 RLPG-H
|
| 361 |
+
|
| 362 |
+
We used Adam (Kingma & Ba, 2015) optimizer with a learning rate of 3e-4 and batch size of 64. We used CodeBERT (Feng et al., 2020) as our pretrained model $F _ { \phi }$ to obtain the representation of hole window. The size of the representation (corresponding to the hidden dimension of the [CLS] token) is 768. $W ^ { 1 } \in \mathbb { R } ^ { 5 1 2 \times 7 6 8 } , b ^ { \hat { 1 } } = 5 1 2 , W ^ { 2 } \in \mathbb { R } ^ { 6 3 \times 5 1 2 } , b ^ { \hat { 2 } } = 6 3$ .
|
| 363 |
+
|
| 364 |
+
# C.2 RLPG-R
|
| 365 |
+
|
| 366 |
+
We used Adam (Kingma & Ba, 2015) optimizer with a learning rate of 3e-4 and batch size of 64. We used CodeBERT (Feng et al., 2020) as our pretrained model $F _ { \phi }$ to obtain the representation of hole window and prompt proposal context. The size of the representation (corresponding to the hidden dimension of the [CLS] token) is 768. In equations 1, 2 and 3 in Section 3.2, the projection matrices $W _ { i } ^ { Q } \in \mathbb { R } ^ { d _ { q } \times d _ { m o d e l } }$ , $W _ { i } ^ { K } \in \mathbb { R } ^ { d _ { k } \times d _ { m o d e l } }$ , $W _ { i } ^ { V } \in \mathbb { R } ^ { d _ { v } \times d _ { m o d e l } }$ , $W ^ { O } \in \mathbb { R } ^ { d _ { m o d e l } \times \tau d _ { v } }$ . For the multihead attention, we used $d _ { k } = d _ { q } = d _ { v } = 3 2$ , $\tau = 4$ and $d _ { m o d e l } = 7 6 8$ , $W _ { r } \in \mathbb { R } ^ { 6 3 \times 7 6 8 }$ and $b _ { p } = 6 3$ . For each head, we perform a scaled dot-product attention (Equation 4). $G$ module consists of a dropout (Srivastava et al., 2014) layer, a residual connection (He et al., 2016), a layernorm (Ba et al., 2016), followed by a sequence of (a) dense layer of weights $= 2 0 4 8 \times 7 6 8$ , bias $\scriptstyle \sum 7 6 8$ , (b) relu activation, (c) dense layer of weights $= 7 6 8 \times 2 0 4 8$ , bias ${ \it \Omega } = \mathrm { 2 0 4 8 }$ , (d) dropout layer, (e) residual connection, (f) layernorm. A dropout value of 0.25 was used while training. Our model resembles one layer of the transformer encoder block (Vaswani et al., 2017).
|
| 367 |
+
|
| 368 |
+
# C.3 BASELINES
|
| 369 |
+
|
| 370 |
+
Random baseline first selects a file randomly from the current repository followed by selecting a random line within that file. We choose all the lines starting from that line to the end line of the chosen file as context (excluding the hole window if the chosen file is the current file). The nearest neighbour similarity is based on the dot product between the representation of the hole window and the representation of the context, where we use a pretrained CodeBERT (Feng et al., 2020) model to obtain the representations. For the Identifier Usage baseline, if the nearest identifier to the hole doesn’t return any usage window, we proceed to the next nearest identifier. For faster computation and to avoid memory issues when running on our hardware, for NN baselines, we collect 64 random neighbours and then rank based on the nearest neighbour distance. The BM25-based baselines use the Okapi BM25 implementation with default parameters given by the pip package rank-bm25 0.2.2 10. For file-level BM25, if the file context exceeds the allocated context length, we truncate from the back.
|
| 371 |
+
|
| 372 |
+
# D ADDITIONAL RESULTS
|
| 373 |
+
|
| 374 |
+
D.1 ABLATION ON PERFORMANCE BASED ON PROMPT PROPOSAL
|
| 375 |
+
|
| 376 |
+
Figure 4 shows the mean success rate of prompt context types when success is counted only for the cases when these prompt contexts are applicable. As can be seen from the figure, post lines is the most useful prompt context type on an average. The contribution from other prompt context types though smaller than post lines is still significant highlighting the importance of each prompt context type.
|
| 377 |
+
|
| 378 |
+

|
| 379 |
+
Figure 4: Mean success rate on validation data based on prompt context type when they are applicable.
|
| 380 |
+
|
| 381 |
+

|
| 382 |
+
Figure 5: (Left) Normalized success rate of prompt sources when applicable, (Right) Normalized success rate of prompt context types when applicable
|
| 383 |
+
|
| 384 |
+
Figure 5 shows the normalized success rates where the normalization is performed across the prompt proposals. This helps us understand the relative performance of prompt proposal sources and context types. The left part of the figure breaks down the performance based on prompt sources and the right part breaks down based on prompt context types. One thing to note from the plot of prompt context types is that when we consider relative performance, post lines is no longer the most dominant context type. This is because post lines is tied to only when the prompt source corresponds to the current file, thereby contributing to lower numbers when compared to most of the other context types that are tied to all prompt sources.
|
| 385 |
+
|
| 386 |
+
# D.2 PERFORMANCE ON NON-IMMEDIATE POST LINES
|
| 387 |
+
|
| 388 |
+
Table 4 shows the performance of post lines when starting the fourth line after the target hole line (i.e., skipping three lines after the target hole) as opposed to starting from the line that immediately follows the target hole line. This experiment helps us understand the performance when we are interested in doing a much harder task of multi-line code autocompletion, wherein the objective is to predict not just the blanked out portion in the current line but also say the next three lines. This can correspond to completing a block of code like a function body. As can be seen from the table, when starting from the fourth line, we see a very slight deterioration in performance. This is expected because the farther away we move from the target hole, the less relevant the post lines context would be. However, the performance drop is not significant suggesting that post lines is still a very useful prompt context type that can be used under the setting of multi-line code-autocompletion. Equivalently, we can include this as one of the prompt proposals in our framework along with the current version of post lines.
|
| 389 |
+
|
| 390 |
+
Table 4: Success Rate (SR) when taking different versions of post lines.
|
| 391 |
+
|
| 392 |
+
<table><tr><td>Method</td><td>Success Rate(%) (hole-wise)</td><td>Rel. ↑(%) (hole-wise)</td><td>Success Rate(%) (repo-wise)</td><td>Rel. ↑(%) (repo-wise)</td></tr><tr><td>Codex (Chen et al., 2021)</td><td>58.73</td><td>1</td><td>60.64</td><td>1</td></tr><tr><td>Post Lines (immediate line after the hole)</td><td>65.78</td><td>12.00</td><td>68.01</td><td>12.15</td></tr><tr><td>Post Lines (skipping three lines after the hole)</td><td>65.11</td><td>10.86</td><td>66.42</td><td>9.53</td></tr></table>
|
| 393 |
+
|
| 394 |
+
# D.3 COMPOSITION OF PROMPT PROPOSALS
|
| 395 |
+
|
| 396 |
+
Table 5 shows the performance of the two versions of RLPG when we compose the prompt proposal context from $l$ prompt proposals. We take the top- $\mathbf { \nabla } \cdot \mathbf { \vec { \tau } }$ prompt proposals given by RLPG based on decreasing order of probability. To decide how much context should be used for each prompt proposal, we divide the total context length in proportion to the normalized probabilities of the top-l prompt proposals. As can be seen from the table, even though PPC is not explicitly trained to perform composition (both the ground-truth vector and the representation of prompt proposal context involve a single prompt proposal), all the compositions lead to significant improvements over Codex. However, as expected the best results correspond to taking context from a single prompt proposal (i.e., the training setting). The drop in success rate with $l = 2$ and $l = 5$ is not that significant, which suggests that explicitly training RLPG to learn to compose contexts from different prompt proposals can lead to promising results and hence offers an interesting future direction.
|
| 397 |
+
|
| 398 |
+
Table 5: Success Rate (SR) of different compositions of the prompt proposals on the test set.
|
| 399 |
+
|
| 400 |
+
<table><tr><td>Method</td><td>Success Rate(%) (hole-wise)</td><td>Rel. ↑(%) (hole-wise)</td><td>Success Rate(%) (repo-wise)</td><td>Rel. ↑(%) (repo-wise)</td></tr><tr><td>Codex (Chen et al.,2021)</td><td>58.73</td><td></td><td>60.64</td><td></td></tr><tr><td>RLPG-H(𝑙 = 1)</td><td>68.51</td><td>16.65</td><td>69.26</td><td>14.21</td></tr><tr><td>RLPG-R (𝑙 = 1)</td><td>67.80</td><td>15.44</td><td>69.28</td><td>14.26</td></tr><tr><td>RLPG-H(l = 2)</td><td>67.07</td><td>14.20</td><td>67.87</td><td>11.91</td></tr><tr><td>RLPG-R ( = 2)</td><td>66.57</td><td>13.35</td><td>67.88</td><td>11.94</td></tr><tr><td>RLPG-H(l = 5)</td><td>66.60</td><td>13.40</td><td>67.91</td><td>11.98</td></tr><tr><td>RLPG-R (l = 5)</td><td>65.78</td><td>12.01</td><td>67.69</td><td>11.62</td></tr><tr><td>RLPG-H(l = 10)</td><td>65.53</td><td>11.58</td><td>67.24</td><td>10.88</td></tr><tr><td>RLPG-R (l = 10)</td><td>63.59</td><td>8.27</td><td>65.98</td><td>8.79</td></tr></table>
|
| 401 |
+
|
| 402 |
+
# D.4 EFFECT OF CONTEXT LENGTH
|
| 403 |
+
|
| 404 |
+
To understand the effect of context length on the performance of our prompt proposals, we took half of the context length available for a prompt in Codex and observed the performance of the oracle and fixed prompt proposal. As before, we saw that an oracle constructed from our prompt proposals shows remarkable improvement over Codex highlighting the value of our prompt proposals. However, when compared to a larger context length, the relative gains are smaller. This is expected as a smaller context length means that the relevant context coming from a prompt proposal needs to be truncated to make it fit inside the prompt, thereby leading to loss of information.
|
| 405 |
+
|
| 406 |
+
Table 6: Success Rate (SR) of Codex and oracle over the test set when the total context length $= 2 0 4 8$ .
|
| 407 |
+
|
| 408 |
+
<table><tr><td>Method</td><td>Success Rate(%) (hole-wise)</td><td>Rel. ↑(%) (hole-wise)</td><td>Success Rate(%) (repo-wise)</td><td>Rel. ↑(%) (repo-wise)</td></tr><tr><td>Codex (Chen et al., 2021)</td><td>57.77</td><td>1</td><td>58.90</td><td>1</td></tr><tr><td>Oracle</td><td>61.90</td><td>7.15</td><td>67.18</td><td>14.07</td></tr></table>
|
| 409 |
+
|
| 410 |
+
# D.5 PERFORMANCE ON INDIVIDUAL REPOSITORIES
|
| 411 |
+
|
| 412 |
+
Table 7: Success Rate of different methods on training data
|
| 413 |
+
|
| 414 |
+
<table><tr><td>Repo name</td><td>#Total Holes</td><td>Oracle</td><td>Codex</td><td>Fixed prompt proposal</td><td>RLPG-H</td><td>RLPG-R</td></tr><tr><td>largemail</td><td>1653</td><td>75.38</td><td>55.11</td><td>62.73</td><td>63.94</td><td>63.28</td></tr><tr><td>ftpserverremoteadmin</td><td>7323</td><td>86.44</td><td>66.11</td><td>76.09</td><td>76.21</td><td>76.76</td></tr><tr><td>myt5lib</td><td>838</td><td>91.65</td><td>53.58</td><td>61.34</td><td>73.51</td><td>74.46</td></tr><tr><td>seamlets</td><td>4890</td><td>92.74</td><td>62.25</td><td>62.72</td><td>71.55</td><td>74.27</td></tr><tr><td>gloodb</td><td>10000</td><td>91.07</td><td>57.50</td><td>57.50</td><td>70.32</td><td>72.31</td></tr><tr><td>jjskit</td><td>9043</td><td>80.36</td><td>65.61</td><td>72.18</td><td>72.00</td><td>72.44</td></tr><tr><td>mobileexpensetracker</td><td>2298</td><td>75.94</td><td>57.88</td><td>67.28</td><td>66.84</td><td>66.97</td></tr><tr><td>gfsfa</td><td>10000</td><td>80.55</td><td>57.33</td><td>57.33</td><td>59.28</td><td>65.24</td></tr><tr><td>swe574-group3</td><td>2029</td><td>76.79</td><td>54.46</td><td>66.19</td><td>65.16</td><td>64.91</td></tr><tr><td>strudem-sicsa</td><td>6131</td><td>77.83</td><td>64.96</td><td>72.55</td><td>73.25</td><td>73.32</td></tr><tr><td>soap-dtc</td><td>1370</td><td>81.24</td><td>64.82</td><td>70.73</td><td>71.61</td><td>72.70</td></tr><tr><td>openprocesslogger</td><td>7191</td><td>81.06</td><td>62.19</td><td>71.77</td><td>72.22</td><td>72.62</td></tr><tr><td>tapestry-sesame</td><td>397</td><td>72.54</td><td>45.84</td><td>61.21</td><td>60.71</td><td>63.98</td></tr><tr><td>exogdx</td><td>735</td><td>84.76</td><td>63.81</td><td>75.51</td><td>75.92</td><td>76.60</td></tr><tr><td>designpatternjavapedro</td><td>1069</td><td>78.30</td><td>54.82</td><td>64.36</td><td>63.99</td><td>68.57</td></tr><tr><td>quidsee</td><td>3020</td><td>81.66</td><td>60.79</td><td>69.50</td><td>70.36</td><td>70.26</td></tr><tr><td>healpix-rangeset</td><td>4734</td><td>63.54</td><td>48.71</td><td>54.67</td><td>54.94</td><td>55.07</td></tr><tr><td>sol-agent-platform</td><td>10000</td><td>73.76</td><td>58.22</td><td>65.72</td><td>65.65</td><td>65.94</td></tr><tr><td>rsbotownversion</td><td>10000</td><td>75.23</td><td>57.89</td><td>65.58</td><td>66.22</td><td>66.31</td></tr></table>
|
| 415 |
+
|
| 416 |
+
Table 8: Success Rate of different methods on validation data
|
| 417 |
+
|
| 418 |
+
<table><tr><td rowspan=1 colspan=1>Repo name</td><td rowspan=1 colspan=1>#Total Holes</td><td rowspan=1 colspan=1>Oracle</td><td rowspan=1 colspan=1>Codex</td><td rowspan=1 colspan=1>Fixed prompt proposal</td><td rowspan=1 colspan=2>RLPG-H</td><td rowspan=1 colspan=1>RLPG-R</td></tr><tr><td rowspan=14 colspan=1>tyrondmath-mech-eshopinfinispan-storage-serviceteammates-shakthijavasummerframeworktinwiki jlooglejcontenedorsohocmsaffinity_propagation_javajata4testswinagilenavigablep2pspringlime</td><td rowspan=1 colspan=1>721</td><td rowspan=1 colspan=1>83.91</td><td rowspan=1 colspan=1>60.33</td><td rowspan=1 colspan=1>71.15</td><td rowspan=1 colspan=2>71.57</td><td rowspan=5 colspan=1>72.6873.1777.7572.4665.55</td></tr><tr><td rowspan=1 colspan=1>2225</td><td rowspan=1 colspan=1>83.46</td><td rowspan=1 colspan=1>62.20</td><td rowspan=1 colspan=1>72.76</td><td rowspan=1 colspan=2>73.53</td></tr><tr><td rowspan=1 colspan=1>373</td><td rowspan=1 colspan=1>82.31</td><td rowspan=1 colspan=1>71.85</td><td rowspan=1 colspan=1>78.55</td><td rowspan=1 colspan=2>76.94</td></tr><tr><td rowspan=1 colspan=1>7665</td><td rowspan=1 colspan=1>82.02</td><td rowspan=1 colspan=1>63.74</td><td rowspan=1 colspan=1>72.38</td><td rowspan=1 colspan=2>72.47</td></tr><tr><td rowspan=1 colspan=1>10000</td><td rowspan=1 colspan=1>79.27</td><td rowspan=1 colspan=1>55.92</td><td rowspan=1 colspan=1>65.30</td><td rowspan=1 colspan=2>65.74</td></tr><tr><td rowspan=1 colspan=1>10000</td><td rowspan=1 colspan=1>73.67</td><td rowspan=1 colspan=1>69.27</td><td rowspan=1 colspan=1>69.27</td><td rowspan=1 colspan=2>69.12</td><td rowspan=1 colspan=1>69.58</td></tr><tr><td rowspan=1 colspan=1>3145</td><td rowspan=1 colspan=1>84.55</td><td rowspan=1 colspan=1>73.16</td><td rowspan=1 colspan=1>77.87</td><td rowspan=1 colspan=2>77.17</td><td rowspan=3 colspan=1>77.3668.3267.62</td></tr><tr><td rowspan=2 colspan=1>5464772</td><td rowspan=1 colspan=1>81.26</td><td rowspan=1 colspan=1>58.99</td><td rowspan=1 colspan=1>67.77</td><td rowspan=1 colspan=2>67.95</td></tr><tr><td rowspan=1 colspan=1>76.68</td><td rowspan=1 colspan=1>57.90</td><td rowspan=1 colspan=1>67.10</td><td rowspan=1 colspan=1>67.49</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=1>1466</td><td rowspan=1 colspan=1>79.54</td><td rowspan=1 colspan=1>59.14</td><td rowspan=1 colspan=1>70.33</td><td rowspan=1 colspan=2>70.26</td><td rowspan=2 colspan=1>70.2657.47</td></tr><tr><td rowspan=1 colspan=1>1921</td><td rowspan=1 colspan=1>71.06</td><td rowspan=1 colspan=1>44.09</td><td rowspan=1 colspan=1>54.92</td><td rowspan=1 colspan=2>55.91</td></tr><tr><td rowspan=1 colspan=1>2595</td><td rowspan=1 colspan=1>79.69</td><td rowspan=1 colspan=1>63.01</td><td rowspan=1 colspan=1>72.29</td><td rowspan=1 colspan=2>72.49</td><td rowspan=1 colspan=1>72.68</td></tr><tr><td rowspan=2 colspan=1>1322879</td><td rowspan=1 colspan=1>75.72</td><td rowspan=1 colspan=1>59.76</td><td rowspan=1 colspan=1>65.43</td><td rowspan=1 colspan=2>65.13</td><td rowspan=2 colspan=1>65.2874.40</td></tr><tr><td rowspan=1 colspan=1>83.50</td><td rowspan=1 colspan=1>62.34</td><td rowspan=1 colspan=1>74.18</td><td rowspan=1 colspan=2>74.86</td></tr></table>
|
| 419 |
+
|
| 420 |
+
Table 9: Success Rate of different methods on test data
|
| 421 |
+
|
| 422 |
+
<table><tr><td>Repo Name</td><td>#Total Holes</td><td>Oracle</td><td>Codex</td><td>Fixed PP</td><td>RLPG-H</td><td>RLPG-R</td><td>Random</td><td>Random NN</td><td>Iden Usage (Random)</td><td>Iden Usage (NN)</td><td>File-Level BM25</td><td>RLPG- BM25</td></tr><tr><td>dovetaildb</td><td>10000</td><td>76.89</td><td>57.12</td><td>66.45</td><td>66.06</td><td>66.25</td><td>57.45</td><td>57.58</td><td>61.39</td><td>60.77</td><td>59.39</td><td>66.09</td></tr><tr><td>project-pt-diaoc</td><td>10000</td><td>82.01</td><td>52.67</td><td>52.81</td><td>65.08</td><td>61.25</td><td>51.58</td><td>52.93</td><td>55.54</td><td>56.21</td><td>57.04</td><td>58.29</td></tr><tr><td>realtimegc</td><td>2513</td><td>77.64</td><td>57.58</td><td>67.01</td><td>67.85</td><td>68.48</td><td>57.78</td><td>58.89</td><td>63.51</td><td>63.99</td><td>61.84</td><td>66.69</td></tr><tr><td>fswuniceubtemplates</td><td>2070</td><td>77.44</td><td>55.7</td><td>58.89</td><td>66.81</td><td>65.8</td><td>55.22</td><td>55.89</td><td>65.7</td><td>66.43</td><td>59.28</td><td>66.71</td></tr><tr><td>qwikioffice-java</td><td>1138</td><td>76.45</td><td>70.21</td><td>70.21</td><td>69.86</td><td>70.56</td><td>46.13</td><td>48.15</td><td>60.37</td><td>62.92</td><td>64.41</td><td>58.17</td></tr><tr><td>glperaudsimon</td><td>1766</td><td>78.65</td><td>53.57</td><td>62.51</td><td>62.4</td><td>61.66</td><td>55.66</td><td>57.76</td><td>69.42</td><td>68.4</td><td>69.14</td><td>61.55</td></tr><tr><td>xiaonei-java-api</td><td>839</td><td>73.42</td><td>57.57</td><td>62.1</td><td>62.69</td><td>63.29</td><td>57.09</td><td>57.21</td><td>71.28</td><td>72.35</td><td>63.77</td><td>63.29</td></tr><tr><td>ircrpgbot</td><td>6591</td><td>83.67</td><td>69.67</td><td>77.24</td><td>76.71</td><td>76.65</td><td>69.55</td><td>70.54</td><td>74.68</td><td>74.43</td><td>69.32</td><td>75.75</td></tr><tr><td>robotsimulator2009w</td><td>7514</td><td>75.63</td><td>56.28</td><td>67.55</td><td>67.53</td><td>67.55</td><td>56.4</td><td>56.18</td><td>64.61</td><td>64.71</td><td>62.96</td><td>66.12</td></tr><tr><td>gwt-plugindetect</td><td>73</td><td>84.93</td><td>60.27</td><td>68.49</td><td>65.75</td><td>68.49</td><td>58.9</td><td>57.53</td><td>63.01</td><td>63.01</td><td>50.68</td><td>75.34</td></tr><tr><td>apiitfriends</td><td>1385</td><td>85.05</td><td>65.05</td><td>74.8</td><td>75.67</td><td>75.31</td><td>65.7</td><td>68.59</td><td>70.25</td><td>70.11</td><td>66.93</td><td>73.57</td></tr><tr><td>wicketbits</td><td>754</td><td>83.02</td><td>59.81</td><td>72.94</td><td>72.81</td><td>73.08</td><td>60.21</td><td>61.94</td><td>81.96</td><td>79.31</td><td>84.48</td><td>73.47</td></tr><tr><td>hucourses</td><td>590</td><td>84.41</td><td>70.68</td><td>77.46</td><td>77.63</td><td>77.97</td><td>70</td><td>72.2</td><td>70.68</td><td>72.54</td><td>53.39</td><td>75.08</td></tr><tr><td>xfuze</td><td>3055</td><td>84.09</td><td>62.82</td><td>73.62</td><td>72.73</td><td>73.62</td><td>63.67</td><td>65.17</td><td>77.25</td><td>75.97</td><td>77.32</td><td>74.01</td></tr></table>
|
| 423 |
+
|
| 424 |
+
Table 7, Table 8 and Table 9 present the success rates of different methods over individual repositories in the training, validation and test splits, respectively. The repo-wise averages in Table 2 in the main paper were calculated by taking the average of numbers corresponding to each column. The hole-wise averages correspond to multiplying the repo-wise numbers of each method by the total holes in the repo to get the total number of successful holes by that method for that repo. We then add the total number of successful holes across repos and divide it by the total number of holes in the entire data split to get the hole-wise averages.
|
| 425 |
+
|
| 426 |
+
# E ANALYSIS OF SAMPLE CASES
|
| 427 |
+
|
| 428 |
+
In Figure 1, RLPG selects the prompt proposal that corresponds to taking method names and bodies from the imported file (i.e. MaximizingGibbsSampler.java ). Note that mg. before the hole position indicates that a method used in the imported file is likely to be invoked. In this case, the prompt proposal context (highlighted in violet) contains the method name InitializeToAssignment (part of target hole). This in conjunction with the default Codex context which contains the method CurrentAssignments() (part of target hole) leads to generation of a successful prompt. On the other hand, the prompt created from the default Codex context fails to predict the target hole in this case. In general, we observed that in the absence of a strong signal, Codex has a tendency to give preference to natural language comments occurring before the hole position, e.g. naming the method based on the comment. This in certain cases might hurt. We provide insatnces of positive and negative samples cases for RLPG below:
|
| 429 |
+
|
| 430 |
+
# E.1 POSITIVE CASES
|
| 431 |
+
|
| 432 |
+
We provide some examples of cases where RLPG led to the correct prediction and Codex failed.
|
| 433 |
+
|
| 434 |
+
1. Cases where part of the target hole is found exactly in the prompt proposal context.
|
| 435 |
+
|
| 436 |
+
• RLPG $=$ Propagation(int numVars) vs Codex $=$ Propagation()
|
| 437 |
+
• RLPG $=$ tersFromFile(String filename) vs Codex
|
| 438 |
+
ters(String filename) {
|
| 439 |
+
• RLPG $=$ als("dampingFactor")) { vs Codex $=$ als("numVars")) {
|
| 440 |
+
• ${ \mathrm { R L P G } } = { \mathrm { ~ ~ \ k ~ } } ] + { \mathrm { ~ ~ \ " ~ } }$ , value $\begin{array} { r l r l } { \mathbf { \Sigma } } & { { } = } & { \mathbf { \Sigma } ^ { \mathsf { ~ I I ~ } } } & { + } \end{array}$ entries[1]); vs Codex $=$ ]);
|
| 441 |
+
• RLPG $=$ stem.exit(1); vs Codex $=$ stem.err.println("DPAP load error: " $^ +$ ex.get
|
| 442 |
+
|
| 443 |
+
2. Cases where Codex takes strong hint from the preceding natural language comment, thereby producing incorrect predictions.
|
| 444 |
+
|
| 445 |
+
• RLPG $=$ d PassMessages() vs Codex $=$ d DoOneRoundOfMessagePassing() • RLPG $=$ teger> CurrentExemplars() { vs Codex = teger> ChooseExemplars() {
|
| 446 |
+
|
| 447 |
+
<table><tr><td>·RLPG</td><td>=</td><td>ring FileName(){</td><td>VS</td><td>Codex</td></tr><tr><td></td><td>ring GetAlgorithmFilename(){</td><td></td><td></td><td></td></tr></table>
|
| 448 |
+
|
| 449 |
+
# E.2 NEGATIVE CASES
|
| 450 |
+
|
| 451 |
+
In certain cases, extra information from prompt proposal-context might lead to confusion and produce incorrect predictions.
|
| 452 |
+
|
| 453 |
+
• RLPG $=$ an hasConverged_; vs Codex $=$ an converged_;
|
| 454 |
+
• RLP $\mathbf { \dot { G } = \_ } [ \dot { \textrm { i } } ] \ [ \dot { \textrm { j } } ] \ =$ -Double.MAX_VALUE; vs $\mathrm { C o d e x } = \mathrm { \small ~ \underline { ~ } { ~ [ ~ i ~ ] ~ } ~ [ ~ j ~ ] ~ } \ = \ 0 \ ;$ ;
|
md/dev/N8MaByOzUfb/N8MaByOzUfb.md
ADDED
|
@@ -0,0 +1,492 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# NEW INSIGHTS ON REDUCING ABRUPT REPRESENTA-TION CHANGE IN ONLINE CONTINUAL LEARNING
|
| 2 |
+
|
| 3 |
+
Lucas Caccia∗ McGill University, Mila Facebook AI Research
|
| 4 |
+
|
| 5 |
+
Rahaf Aljundi Toyota Motor Europe
|
| 6 |
+
|
| 7 |
+
Nader Asadi Concordia University, Mila
|
| 8 |
+
|
| 9 |
+
Tinne Tuytelaars KU Leuven
|
| 10 |
+
|
| 11 |
+
Joelle Pineau McGill University, Mila Facebook AI Research
|
| 12 |
+
|
| 13 |
+
Eugene Belilovsky Concordia University, Mila
|
| 14 |
+
|
| 15 |
+
# ABSTRACT
|
| 16 |
+
|
| 17 |
+
In the online continual learning paradigm, agents must learn from a changing distribution while respecting memory and compute constraints. Experience Replay (ER), where a small subset of past data is stored and replayed alongside new data, has emerged as a simple and effective learning strategy. In this work, we focus on the change in representations of observed data that arises when previously unobserved classes appear in the incoming data stream, and new classes must be distinguished from previous ones. We shed new light on this question by showing that applying ER causes the newly added classes’ representations to overlap significantly with the previous classes, leading to highly disruptive parameter updates. Based on this empirical analysis, we propose a new method which mitigates this issue by shielding the learned representations from drastic adaptation to accommodate new classes. We show that using an asymmetric update rule pushes new classes to adapt to the older ones (rather than the reverse), which is more effective especially at task boundaries, where much of the forgetting typically occurs. Empirical results show significant gains over strong baselines on standard continual learning benchmarks 1
|
| 18 |
+
|
| 19 |
+
# 1 INTRODUCTION
|
| 20 |
+
|
| 21 |
+
Continual learning is concerned with building models that can learn and accumulate knowledge and skills over time. A continual learner receives training data sequentially, from a potentially changing distribution, over the course of its learning process. The distribution change might be either a shift in the input domain or new categories being learned. The main challenge is to design models that can learn how to use the new data and acquire new knowledge, while preserving or improving the performance on previously learned data. While different settings have been investigated of how new data are being received and learned, we focus on the challenging scenario of learning from an online stream of data with new classes being introduced at unknown points in time and where memory and compute constraints are applied on the learner. Additionally, we assume a shared output layer among all the learned classes (Aljundi et al., 2019b). This setting is different and harder than the conventional multi-head setting (Farquhar & Gal, 2018) where each new group of classes is considered as a new task with a dedicated head (classification layer), requiring a task oracle at test time to activate the correct head. The axes of our setting (online learning, no task boundary, no test time oracle, constant memory, and bounded compute) align with the main desiderata of continual learning as described in De Lange et al. (2019).
|
| 22 |
+
|
| 23 |
+
Catastrophic forgetting (McCloskey & Cohen, 1989), where previous knowledge is overwritten as new concepts are learned, remains a key challenge in the online continual learning setting. To prevent forgetting, methods usually rely on storing a small buffer of previous training data and replaying samples from it as new data is learned. This can partially counteract catastrophic forgetting, but still tends to lead to large disruptions in accuracy, particularly at the initial task boundary or shift in distribution. Various works focus on studying which samples to store (Borsos et al., 2020; Aljundi et al., 2019b) or which samples to replay when receiving new data (Aljundi et al., 2019a). In this work, we direct our attention to the representations being learned and investigate how the features of previously learned classes change and drift over time.
|
| 24 |
+
|
| 25 |
+

|
| 26 |
+
|
| 27 |
+

|
| 28 |
+
Task 1 Accuracy during 2nd Task
|
| 29 |
+
Number of training steps on the 2nd task
|
| 30 |
+
Figure 1: (left) Analysis of representations with the first task’s class prototypes at a task boundary. Under ER when Task 2 begins, class 1 & 2 prototypes experience a large gradient and subsequent displacement caused by the close location of the unobserved sample representations, this leads to a significant drop in performance (right). Our proposed method (ACE) mitigates the representation drift issue and observes no performance decrease on a task switch.
|
| 31 |
+
|
| 32 |
+
Consider the time point in a stream when a new class is introduced after previous classes have been well learned. If we consider the representation being learned, incoming samples from new classes are likely to be dispersed, potentially near and between representations of previous classes, while the representations of previous classes will typically cluster according to their class. Indeed, one might expect minimal changes to the learned representation of the previous classes, while the new classes samples are pushed away from the clusters of old class data. However, with a standard Experience Replay (ER) algorithm (Chaudhry et al., 2019), we observe that it is the representations of older classes that is heavily perturbed after just a few update steps when training on the new class samples. We hypothesize that the fundamental issue arises from the combination of: new class samples representations lying close to older classes and the loss structure of the standard cross entropy applied on a mix of seen and unseen classes. We illustrate the observed effect in Fig. 1 (left).
|
| 33 |
+
|
| 34 |
+
This behavior is exacerbated especially in the regime of low buffer size. With larger replay buffers, the learner can recover knowledge about the prior classes over time, while with smaller buffers the initial disruptive changes in representations are challenging to correct. Indeed we illustrate this effect in Fig. 1 (right), we see that ER only recovers from the initial displacement given a much larger buffer size.
|
| 35 |
+
|
| 36 |
+
In standard continual learning with replay (Aljundi et al., 2019a; Chaudhry et al., 2019) the same loss function is usually employed on both the newly received samples and the replayed samples. In contrast, we propose a simple and efficient solution to mitigate this representation drift by using separate losses on the incoming stream and buffered data. The key idea is to allow the representations of samples from new classes to be learned in isolation of the older ones first, by excluding the previously learned classes from the incoming data loss. The discrimination between the new classes and the older ones is learned through the replayed batches, but only after incoming data has been learned, added to the buffer, and made available for replay. To allow more direct control of the structure in representations we first consider a metric learning based loss for the incoming data, proposed in Khosla et al. (2020), where we propose to exclude samples of previously learned classes from the negative samples. We show that this type of negative selection is critical, and in contrast issues arise when negative examples are sampled uniformly from the buffer. These issues mimic those seen with standard losses in experience replay (ER) (Aljundi et al., 2019a). On the other hand we use a different loss on replay buffer data that is allowed to consider new and old classes, thereby consolidating knowledge across current and previous tasks. We call this overall approach ER with asymmetric metric learning (ER-AML).
|
| 37 |
+
|
| 38 |
+
Since cross entropy losses can be more efficient in training for classification than metric learning and contrastive losses (avoiding positive and negative selection) and it is widely used in incremental and continual learning, we also propose an alternative cross entropy solution that similarly applies an asymmetric loss between incoming and replay data. Notably, the cross entropy applied to the incoming data only considers logits of classes of the incoming data. This variant, named ER with asymmetric cross-entropy (ER-ACE), along with ER-AML show strong performance, with little disruption at task boundaries Fig. 1 (right). We achieve state of the art results in existing benchmarks while beating different existing methods including the traditional ER solution with an average relative gain of $36 \%$ in accuracy. Our improvements are especially high in the small buffer regime. We also show that the mitigation of the old representation drift does not hinder the ability to learn and discriminate the new classes from the old ones. This property emerges from only learning the incoming data in isolation; as we will see, also isolating the rehearsal step (as in Ahn et al. (2020)) leads to poor knowledge acquisition on the current task. Furthermore we show our ER-ACE objective can be combined with existing methods, leading to additional gains. Finally, we take a closer look at the computation cost of various existing methods. We show that some methods, while obtaining good performance under standard evaluation protocols, fail to meet the computational constraints required in online CL. We provide an extensive evaluation of computational and memory costs across several baselines and metrics.
|
| 39 |
+
|
| 40 |
+
To summarize, our contributions are as follows. We first highlight the problem of representation drift in the online continual learning setting. We identify a root cause of this issue through an extensive empirical analysis (Sec. 4.2). Second, we propose a new family of methods addressing this issue by treating incoming and past data asymmetrically (Sec. 4.1, 4.3) . Finally, we show strong gains over replay baselines in a new evaluation framework designed to monitor real world constraints (Sec. 5). To the best or our knowledge, we are the first to report the computation costs of different methods in our setting, revealing new insights.
|
| 41 |
+
|
| 42 |
+
# 2 RELATED WORK
|
| 43 |
+
|
| 44 |
+
Research on continual learning can be divided based on the sequential setting being targeted (see Zeno et al. (2018); van de Ven & Tolias (2019); Normandin et al. (2021); Lesort et al. (2021) for categorizations of the settings and De Lange et al. (2019) for a broad survey on continual learning). Earlier works consider the relaxed setting of task incremental learning (Aljundi et al., 2017; Serra\` et al., 2018; Li & Hoiem, 2016) where the data stream is divided into chunks of tasks and each task is learned offline with multiple iterations over the data of this task. While this setting is easier to handle as one task can be learned entirely, it limits the applicability of the solution.
|
| 45 |
+
|
| 46 |
+
In this work, we consider the challenging setting of an online stream of non-i.i.d. data where changes can anytime occur in the input domain or in the output space. This more realistic setting has attracted increasing interest lately (Lopez-Paz et al., 2017; Aljundi et al., 2019a). Specifically, we study the single-head (or shared head) setting, where when queried, the learner is not told which task the sample belongs to (as opposed to the multi-head setting). The single-head assumption is further studied in task-agnostic continual learning settings (He et al., 2019; Caccia et al., 2020; Ostapenko et al., 2021; Von Oswald et al., 2021) in which the task-boundary assumption, amongst others, is also relaxed. Many of the solutions to the online continual learning problem rely on the use of a buffer formed of previous memories which are replayed alongside new data during the learning process. Several works (Borsos et al., 2020; Chaudhry et al., 2019; Aljundi et al., 2019b) propose solutions to select which samples should be stored, or retrieved for replay (Aljundi et al., 2019a), or both (Shim et al., 2021). Lopez-Paz et al. (2017); Chaudhry et al. use replay to perform constrained optimization, limiting interference with previous tasks as new ones are learned. Our work, on the other hand, focuses on the appropriate loss function in this context. Tang & Matteson (2020) propose a graph-based approach that capture pairwise similarities between samples. Dark Experience Replay (DER) (Buzzega et al., 2020) suggests an alternative replay loss. Samples are stored along with their predicted logits and once replayed the current model is asked to keep its output close to the previously recorded logits. While the method is simple and effective it is worth noting that it relies heavily on data augmentation. Our work is orthogonal and can be combined with DER as we show in Sec. D. Finally, concurrent work (Mai et al., 2021) also use a contrastive loss for online continual learning, but not in an asymmetric fashion.
|
| 47 |
+
|
| 48 |
+
In our work we also investigate the underlying causes for performance degradation in replay-based methods. Related to this study are works in the class incremental setting, where similar to our case a shared output layer is used, but classes are learned offline. Works in this area address the implicit class imbalance issue occurring when new classes are learned alongside replayed data. Zhao et al.
|
| 49 |
+
|
| 50 |
+
(2019) proposes to correct last layer weights after a group of classes is learned via adjusting the weights norm. Wu et al. (2019) suggests to deploy extra additional parameters in order to linearly correct the “bias” in the shared output layer. Those parameters are learned at the end of each training phase. Hou et al. (2019) considers addressing this imbalance through applying cosine similarity based loss as opposed to the typical cross entropy loss along with a distillation loss and a margin based loss with negatives mining to preserve the feature of previous classes. Recently, Ahn et al. (2020) propose to learn the incoming tasks and the previous tasks separately. They use a masked softmax loss for the incoming and rehearsal data, to counter the class imbalance. All the methods highlighted above operate in the offline setting, where data from the current task can be revisited as needed making the disruptive issues emphasized at the task boundary less critical. In this paper, we focus on the online setting, with potentially overlapping tasks. As we will see, work by Ahn et al. (2020) developed to counter class imbalance, can inhibit learning of the current task in the online setting (see Appendix B). Lastly, Zeno et al. (2018) uses a logit masking related to our method but their context is based on the multi-head setting, and does not consider replay based methods, where learning across tasks occurs. Their goal is to activate only the head of which the samples within the new batch belong to. However, our approach is more general and it applies to the single head setting (where we have a single output layer for all classes, and no task oracle.)
|
| 51 |
+
|
| 52 |
+
# 3 LEARNING SETTING AND NOTATION
|
| 53 |
+
|
| 54 |
+
We consider the setting where a learner is faced with a possibly never-ending stream of data. At every time step, a labelled set of examples $( \mathbf { X } ^ { i n } , \mathbf { Y } ^ { i n } )$ drawn from a distribution $D _ { t }$ is received. However, the distribution $D _ { t }$ itself is sampled at each timestep and can suddenly change to $D _ { t + 1 }$ , when a task switch occurs. The learner is not explicitly told when a task switch happens, nor can it leverage a task identifier during training or evaluation. We note that this definition generalizes task-incremental learning, where each task is seen one after the other. In this scenario, given $T$ tasks to learn, $D _ { t }$ changes $T - 1$ times over the full steam, yielding $T$ locally i.i.d learning phases. We also explore in this paper a more general setting without the notion of clearly delineated tasks (Aljundi et al., 2018; Chen et al., 2020a), where the data distribution gradually changes over time.
|
| 55 |
+
|
| 56 |
+
Given a model $f _ { \boldsymbol { \theta } } ( \boldsymbol { x } )$ representing a neural network architecture with parameters $\theta$ , we want to minimize the classification loss $\mathcal { L }$ on the newly arriving data batch while not negatively interfering with the previously learned classes (i.e. increasing the classification loss). A simple and efficient approach to achieve this is to replay stored samples from a fixed size memory, $\mathcal { M }$ , in conjunction with the incoming data (Chaudhry et al., 2019; Rolnick et al., 2018). The core of our approach is that instead of treating the replayed batch and the incoming one similarly and naively minimizing the same loss, we opt for a specific loss structure on the incoming batch that would limit the interference with the previously well learned classes. We approach this by allowing the features of the newly received classes in the incoming data to be initially learned in isolation of the older classes. We first present our idea based on a metric learning loss and then generalize to the widely deployed cross-entropy loss.
|
| 57 |
+
|
| 58 |
+
# 4 METHODS
|
| 59 |
+
|
| 60 |
+
# 4.1 A DISTANCE METRIC LEARNING APPROACH FOR REDUCING DRIFT (ER-AML)
|
| 61 |
+
|
| 62 |
+
In order to allow fine-grained control of which samples will be pushed away from other samples given an incoming batch, we propose to apply, on the incoming data, a metric learning based loss from Khosla et al. (2020). Related loss functions have recently popularized in the self supervised learning literature (Chen et al., 2020b). We combine this in a holistic way with a cross-entropy type loss on the replay data. This allows us to control the representation drift of old classes while maintaining strong classification performance. Note that if a metric learning loss is used alone we needs to perform predictions using a Nearest Class Means Rebuffi et al. (2017) approach, which we show is computationally expensive in the online setting.
|
| 63 |
+
|
| 64 |
+
Given an input data point $x$ , we consider the function $f _ { \boldsymbol { \theta } } ( \boldsymbol { x } )$ mapping $x$ to its hidden representation before the final linear projection. We denote the incoming $N$ datapoints by $\mathbf { X } ^ { i n }$ and data replayed from the buffer by ${ \bf X } ^ { b { \bf \ddot { f } } }$ . We use the following loss, denoted SupCon (Khosla et al., 2020), on the
|
| 65 |
+
|
| 66 |
+
incoming data $\mathbf { X } ^ { i n }$ .
|
| 67 |
+
|
| 68 |
+
$$
|
| 69 |
+
\mathcal { L } _ { 1 } ( \mathbf { X } ^ { i n } ) = - \sum _ { \mathbf { x } _ { i } \in \mathbf { X } _ { i n } } \frac { 1 } { | P ( \mathbf { x } _ { i } ) | } \sum _ { \mathbf { x } _ { p } \in P ( \mathbf { x } _ { i } ) } \log \frac { \mathrm { s i m } \left( f _ { \boldsymbol { \theta } } ( \mathbf { x } _ { p } ) , f _ { \boldsymbol { \theta } } ( \mathbf { x } _ { i } ) \right) } { \sum _ { \mathbf { x } _ { n } \in N \cup P ( \mathbf { x } _ { i } ) } \mathrm { s i m } \left( f _ { \boldsymbol { \theta } } ( \mathbf { x } _ { n } ) , f _ { \boldsymbol { \theta } } ( \mathbf { x } _ { i } ) \right) }
|
| 70 |
+
$$
|
| 71 |
+
|
| 72 |
+
where $\begin{array} { r } { \scriptstyle \mathtt { s i m } ( a , b ) \ = \ \exp ( \frac { a ^ { T } b } { \tau \| a \| \| b \| } ) } \end{array}$ computes the exponential cosine similarity between two vectors, with scaling factor $\tau$ (Qi et al., 2018; He et al., 2020). Here we denote the incoming data $\mathbf { x } _ { i } \in \mathbf { X } ^ { i n }$ . We use the $P$ and $N$ to denote the set of positive and negatives with respect to $\mathbf { x } _ { i }$ and the positive examples $x _ { p }$ are selected from the examples in $\mathbf { X } ^ { i n } \cup \mathcal { M }$ , which are from the same classes as $\mathbf { x } _ { i }$ . In the sequel we will consider ${ \bf x } _ { n }$ selected from $\mathbf { X } ^ { i n } \cup \mathcal { M }$ in two distinct ways: (a) from a mix of current and previous classes and (b) only from
|
| 73 |
+
|
| 74 |
+
Input: Learning rate $\alpha$
|
| 75 |
+
Initialize: Memory $\mathcal { M }$ ; Model Params $\theta$ do Receive $\mathbf { X } ^ { i n }$ //Receive from stream $\mathbf { X } _ { p o s } , \mathbf { X } _ { n e g } \sim \mathrm { F E T C H P O S N E G } ( \mathbf { X } ^ { i n } , \mathcal { M } )$ $\mathbf { X } ^ { b f } \sim \mathbf { S A M P L E } ( \mathcal { M } )$ //Sample buffer $\mathcal { L } = \gamma \mathcal { L } _ { 1 } ( \mathbf { X } ^ { i n } , \mathbf { X } _ { p o s } , \mathbf { X } _ { n e g } ) + \mathcal { L } _ { 2 } ( \mathbf { X } ^ { b f } )$ $S G D ( \nabla \mathcal { L } , \theta , \alpha )$ //Param Update RESERVOIRUPDATE $( { \mathcal { M } } , \mathbf { X } ^ { i n } )$ //Save
|
| 76 |
+
while The stream has not ended
|
| 77 |
+
|
| 78 |
+
classes of the $\mathbf { X } ^ { i n }$ . Note that this implicitly learns a distance metric where samples of the same class lie close by. For the rehearsal step, we apply a modified cross-entropy objective as per Qi et al. (2018) which allows us to link the similarity metric from above to the logits.
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
\mathcal { L } _ { 2 } ( \mathbf { X } ^ { b f } ) = - \sum _ { x \in \mathbf { X } _ { b f } } \log \frac { s \mathrm { i } \mathrm { m } \big ( \mathbf { w } _ { c ( x ) } , f _ { \theta } ( \mathbf { x } ) \big ) } { \sum _ { c \in C _ { a l l } } \mathrm { s i m } \big ( \mathbf { w } _ { c } , f _ { \theta } ( \mathbf { x } ) \big ) }
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
where $C _ { a l l }$ the set of all classes observed, and $c ( x )$ denotes the label of $x$ . The above formulation allows us to interpret the rows of the final projection $\{ \mathbf { w } _ { c } \} _ { c \in C _ { a l l } }$ as class prototypes and inference to be performed without need for nearest neighbor search. We combine the loss functions on the incoming and replay data
|
| 85 |
+
|
| 86 |
+
$$
|
| 87 |
+
\mathcal { L } ( \mathbf { X } ^ { i n } \cup \mathbf { X } ^ { b f } ) = \gamma \mathcal { L } _ { 1 } ( \mathbf { X } ^ { i n } ) + \mathcal { L } _ { 2 } ( \mathbf { X } ^ { b f } )
|
| 88 |
+
$$
|
| 89 |
+
|
| 90 |
+
We refer to this approach as Experience Replay with Asymmetric Metric Learning (ER-AML). We describe the full rehearsal procedure with ER-AML in Algo 1. Note the buffer may contain samples with the same classes as the incoming data stream. The subroutine FetchPosNeg is used to find one positive and negative sample per incoming datapoint in $\mathbf { X } ^ { i n }$ , which can reside in either the buffer memory $\mathcal { M }$ or in $\bar { \mathbf X } ^ { i n }$ .
|
| 91 |
+
|
| 92 |
+
# 4.2 NEGATIVE SELECTION AFFECTS REPRESENTATION DRIFT
|
| 93 |
+
|
| 94 |
+
The selection of negatives for the proposed loss $\mathcal { L }$ can heavily influence the representation of previously learned classes and is analogous to the key issues faced in the regular replay methods where cross entropy loss is applied to both incoming and replay data. A typical approach in this loss for classification may be to select the negatives from any other class (Hoffer & Ailon, 2015). However this becomes problematic in the continual learning setting as the old samples will be too heavily influenced by the poorly embedded new samples that lie close to the old sample representations. To illustrate what is going on
|
| 95 |
+
|
| 96 |
+

|
| 97 |
+
Figure 2: Buffer displacement in a 5 task stream. Background shading denotes different tasks.
|
| 98 |
+
|
| 99 |
+
in the feature space, consider the case of a ER-AML’s $\mathcal { L } _ { 1 }$ term, which explicitly controls distances between sample representations. $\mathcal { L } _ { 1 }$ considers the incoming batch samples (containing new classes) as anchors. As the representations from these classes haven’t been learned, anchors may end up placed near or in-between points from previous classes (analogous to the illustration in Figure 1). Since the previous classes samples will be clustered together, if we use them as negatives for the incoming sample anchors, the gradients magnitude of the positive term will be out-weighted by the negative terms coming from the new class samples, similar to what is observed in Figure 1. In this case there is a sharp change in gradients norms of the loss w.r.t. the features of previous classes, as we illustrate in Appendix E, which leads to a large change in the representation at the task boundary (and subsequently poor performance). On the other hand if we use only incoming batch examples as negatives we can avoid this excessive representation drift. We illustrate this in Figure 2 by showing the representations drift at the task boundaries for ER-AML when using negative samples from all classes and when using only classes in the incoming batch. In the context of the model under consideration we measure the one iteration representation drift of a sample $x$ as $\| f _ { \theta ^ { t } } ( x ) - f _ { \theta ^ { t + 1 } } ( x ) \|$ , the output of the network being normalized. We observe that naively applying the proposed loss results in large changes of the learned representation. On the other hand when allowing only negatives from classes in the incoming batch, we see a reduction in this representation drift. In the Appendix 7 we further demonstrate that the accuracy of models trained using ER-AML with only incoming batch negatives can improve the continual learning system performance by a large margin. We emphasize the that ER-AML with all negatives and the regular ER method used for online continual learning suffer from a similar issue and thus lead to similar poor performances, with appropriate negative selection resolving the problem.This is further emphasized in Appendix $_ \mathrm { H }$ where we observe similar poor drift behavior for ER.
|
| 100 |
+
|
| 101 |
+
# 4.3 CROSS-ENTROPY BASED ALTERNATIVE (ER-ACE)
|
| 102 |
+
|
| 103 |
+
Having demonstrated the effect of controlling the incoming batch loss in avoiding a drastic representation drift, we now extend it to be applicable to the standard cross-entropy loss typically studied in ER (Aljundi et al., $2 0 1 9 \mathrm { a }$ ; Chaudhry et al., 2019). Given an incoming data batch, consider $C _ { o l d }$ the set of previously learned classes and $C _ { c u r r }$ the set of classes observed in the current incoming mini-batch. Denoting $C$ the set of classes included in the cross-entropy loss, we define the $\mathcal { L } _ { c e } ( \mathbf { X } , C )$ cross-entropy loss as: Lce(X, C) = − Px∈X log Psim(wc(x),fθ(x))c∈C sim(wc,fθ(x)) where $C \subset C _ { a l l }$ denotes the classes used to compute the denominator. We note that restricting the classes used in the denominator has an analogous effect to restricting the negatives in the contrastive loss. Consider the gradient for a single datapoint $x$ , ∂Lce(x,C)∂fn = W(\~p − \~y) 1\~y∈C . Here \~p denotes the softmax output of the network, $\vec { y }$ a one-hot target, $\mathbb { 1 } _ { \vec { y } \in C }$ a binary vector masking out classes not in $C$ , and W the matrix with all class prototypes $\{ \mathbf { w } _ { c } \} _ { c \in C _ { a l l } }$ . When the loss is applied in the batch setting, it follows that only prototypes whose labels are in $C$ will serve roles analogous to positives and negatives in the contrastive loss. We can then achieve a similar control as the metric learning approach on the learned representations.
|
| 104 |
+
|
| 105 |
+
Now, our loss applied at each step would be:
|
| 106 |
+
|
| 107 |
+
$\begin{array} { r } { \mathcal { L } _ { a c e } \big ( \mathbf { X } ^ { b f } \cup \mathbf { X } ^ { i n } \big ) = \mathcal { L } _ { c e } \big ( \mathbf { X } ^ { b f } , C _ { o l d } \cup C _ { c u r r } \big ) + \mathcal { L } _ { c e } \big ( \mathbf { X } ^ { i n } , C _ { c u r r } \big ) } \end{array}$ where $C _ { c u r r }$ denotes the set of the classes represented in the incoming batch and $C _ { o l d }$ denotes previously seen classes that are not presented in the incoming batch, those that we want to preserve their representation. Note this is a straightforward procedure and induces no additional computational overhead. We refer to it as Experience Replay with Asymmetric Cross-Entropy (ER-ACE).
|
| 108 |
+
|
| 109 |
+
# 5 EXPERIMENTS
|
| 110 |
+
|
| 111 |
+
We have highlighted the issue of abrupt representation change when new classes are introduced, and propose two methods that address this issue. We now demonstrate that mitigating drift directly leads to better performance on standard online continual learning benchmarks. As in Lopez-Paz et al. (2017); Aljundi et al. (2019a); Chaudhry et al. (2019) we use a reduced Resnet-18 for our experiments, and leave the batch size and the rehearsal batch size fixed at $I O$ . This allows us to fairly compare different approaches, as these parameters have a direct impact on the computational cost of processing a given stream.
|
| 112 |
+
|
| 113 |
+
# 5.1 DATASETS
|
| 114 |
+
|
| 115 |
+
All benchmarks are evaluated in the single-head setting, i.e. task descriptors are not provided to the model at test time, hence the model performs $N$ -way classification where $N$ is the total amount of classes seen.
|
| 116 |
+
|
| 117 |
+
Split CIFAR-10 partitions the dataset into 5 disjoint tasks containing two classes each (as in Aljundi et al. (2019a); Shim et al. (2020))
|
| 118 |
+
|
| 119 |
+
Split CIFAR-100 comprises 20 tasks, each containing a disjoint set of 5 labels. We follow the split in Chaudhry et al. (2019). All CIFAR experiments process $3 2 \times 3 2$ images.
|
| 120 |
+
|
| 121 |
+
Split MiniImagenet splits the MiniImagenet dataset into 20 disjoint tasks of 5 labels each. Images are $8 4 \times 8 4$ .
|
| 122 |
+
|
| 123 |
+
# 5.2 BASELINES
|
| 124 |
+
|
| 125 |
+
We focus our evaluation on replay-based methods, as they have been shown to outperform other approaches in the online continual learning setting Chaudhry et al. (2019); Aljundi et al. (2019a); Ji et al. (2020). We keep buffer management constant across methods : all samples are kept or discarded according to Reservoir Sampling Vitter (1985). We consider the following state-of-the-art baselines:
|
| 126 |
+
|
| 127 |
+
ER: Experience Replay with a buffer of a fixed size. Unlike Aljundi et al. (2019a), we do not leverage the task identifier during training to ensure that rehearsal samples belong to previous classes.
|
| 128 |
+
|
| 129 |
+
iCaRL Rebuffi et al. (2017) A distillation loss alongside binary cross-entropy is used during training. Samples are classified based on closest class prototypes, obtained from recomputing and averaging buffered data representations.
|
| 130 |
+
|
| 131 |
+
MIR Aljundi et al. (2019a) selects for replay samples interfering the most with the incoming data batch.
|
| 132 |
+
|
| 133 |
+
$\mathbf { D E R + + }$ Buzzega et al. (2020) uses a distillation loss on the logits to ensure consistency over time.
|
| 134 |
+
|
| 135 |
+
SS-IL Ahn et al. (2020) learns both the current task loss and the replay loss in isolation of each other.
|
| 136 |
+
An additional task-specific distillation is used on the rehearsal data.
|
| 137 |
+
|
| 138 |
+
GDUMB Prabhu et al. (2020) performs offline training on the buffer with unlimited computation and unrestricted use of data augmentation at the end of the task sequence.
|
| 139 |
+
|
| 140 |
+
iid: The learner is trained with a single pass on the data, in a single task containing all the classes. We also consider a version of this baseline using a similar compute budget as replay methods $( \ddot { \bf u } \dot { \bf d } + + )$
|
| 141 |
+
|
| 142 |
+
We note additional baselines such as Lopez-Paz et al. (2017); Chaudhry et al. were shown to perform poorly in this setting by prior work Buzzega et al. (2020) and are thus left out for clarity.
|
| 143 |
+
|
| 144 |
+
# 5.3 EVALUATION METRICS AND CONSIDERATIONS
|
| 145 |
+
|
| 146 |
+
Our evaluation includes the metrics and experimental settings used in previous works on online continual learning with a single-head (Aljundi et al., 2019a; Ji et al., 2020; Shim et al., 2020). We provide extra emphasis on anytime evaluation and comparisons of the computation time per incoming batch. We also consider several additional settings in terms of computation and use of image priors.
|
| 147 |
+
|
| 148 |
+
Anytime evaluation A critical component of online learning is the ability to use the learner at any point De Lange et al. (2019) . Although most works in the online (one-pass through the data) setting report results throughout the stream Lopez-Paz et al. (2017); Chaudhry et al.; Aljundi et al. (2019b), several prior works have reported the final accuracy as a proxy Aljundi et al. (2019a); Shim et al. (2020). However a lack of anytime evaluation opens the possibility to exploit the metrics by proposing offline learning baselines that are inherently incompatible with anytime evaluation Prabhu et al. (2020).
|
| 149 |
+
|
| 150 |
+
In order to make sure that learners are indeed online learners, we evaluate them throughout the stream. We define the Anytime Accuracy at time $k$ $( A A _ { k } )$ as the average accuracy on the test sets of all distributions seen up to time $k$ . If the learning experience lasts $T$ steps, then $A A _ { T }$ is equivalent to the final accuracy. Finally, we report the Averaged Anytime Accuracy (AAA) (Caccia et al., 2020), which measures how well the model performed over the learning experience
|
| 151 |
+
|
| 152 |
+
$$
|
| 153 |
+
\operatorname { A A A } = { \frac { 1 } { T } } \sum _ { t = 1 } ^ { T } ( A A ) _ { t } .
|
| 154 |
+
$$
|
| 155 |
+
|
| 156 |
+
Computation and Memory Constraints While memory constraints are well documented in previous work, careful monitoring of computation is often overlooked; some methods can indeed hide considerable overhead which can make the comparison across methods unfair. On the other hand this is critical to the use cases of online continual learning. To remedy this, we report for each method the total number of FLOPs used for training. While we cannot fix this quantity as we can for memory (since different methods require different computations), this will shed some light on how different methods compare. Note that we also include in this total any inference overhead required by the models; Nearest Class Mean (NCM) classifiers must compute class prototypes before inference for example. We add this cost every time the model is queried to measure its Anytime Accuracy. Let
|
| 157 |
+
|
| 158 |
+
$$
|
| 159 |
+
\mathbf { M e m } = \frac { 1 } { T } \sum _ { t = 1 } ^ { T } | \theta _ { t } | + | \mathcal { M } _ { t } | , \quad \mathbf { C o m p } = \sum _ { t = 1 } ^ { T } \mathcal { O } ( m ( \cdot ; \theta _ { t } ) ) ,
|
| 160 |
+
$$
|
| 161 |
+
|
| 162 |
+
where $\mathcal { O } ( m ( \cdot ; \theta _ { t } ) )$ denotes the number of FLOPs used at time $t$ . Since the same backbone and buffer is used for all methods in this paper, we will focus our constraint analysis on computation
|
| 163 |
+
|
| 164 |
+
Table 1: split CIFAR-10 results. $\dagger$ indicates the method is leveraging a task identifier at training time. For methods whose compute depend on the buffer size, we report min and max values. We evaluate the models every 10 updates. Results within error margin of the best result are bolded.
|
| 165 |
+
|
| 166 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Data Aug.</td><td colspan="2">M=5</td><td colspan="2">M=20</td><td colspan="2">M=100</td><td rowspan="2">Train TFLOPs</td><td rowspan="2">Mem. (Mb)</td></tr><tr><td>AAA</td><td>Acc</td><td>AAA</td><td>Acc</td><td>AAA</td><td>Acc</td></tr><tr><td>iid</td><td>X</td><td></td><td>62.7±0.7 72.9±0.7</td><td>1</td><td>62.7±0.7 72.9±0.7</td><td>-</td><td>62.7±0.7 72.9±0.7</td><td>8 16</td><td>4 4</td></tr><tr><td>jid+± DER++</td><td></td><td>50.7±1.1</td><td>31.8±0.9</td><td>55.6±1.2</td><td>39.3±1.0</td><td>60.1±1.3</td><td>52.3±1.1</td><td>24</td><td>(4,7)</td></tr><tr><td>ER</td><td></td><td>40.0±0.8 45.6±1.1</td><td>19.7±0.3 28.4±1.0</td><td>45.2±1.3 55.9±1.2</td><td>26.7±1.0 40.3±0.6</td><td>55.4±1.4 60.3±1.3</td><td>38.7±0.8 49.4±1.3</td><td>17</td><td>(4,7)</td></tr><tr><td>iCaRLt</td><td></td><td>47.0±0.8 49.1±1.0</td><td>30.6±0.8 33.4±1.0</td><td>55.1±0.7 54.4±0.7</td><td>41.7±0.6 39.2±0.8</td><td>59.3±0.6 56.9±0.7</td><td>45.1±0.6 42.3±0.8</td><td>(21,47)</td><td>(8,11)</td></tr><tr><td>MIRt</td><td>X</td><td>39.3±1.0 44.9±0.9</td><td>19.7±0.5 29.8±0.8</td><td>44.7±1.1 49.7±1.0</td><td>29.7±0.6 41.8±0.6</td><td>53.8±1.7 54.6±1.4</td><td>43.3±1.0 49.3±0.6</td><td>41</td><td>(4,7)</td></tr><tr><td>SS-IL+</td><td>X √</td><td>42.6±1.7 41.1±1.6</td><td>29.6±0.4 31.6±0.5</td><td>44.8±1.8 47.0±1.2</td><td>35.1±0.9 38.3±0.4</td><td>48.1±2.2 48.1±1.7</td><td>41.1±0.4 47.5±0.7</td><td>19</td><td>(8,11)</td></tr><tr><td>ER-ACE (ours)</td><td></td><td>53.1±1.0 52.6±0.9</td><td>35.6±1.0 35.1±0.8</td><td>58.0±0.7 56.4±1.0</td><td>42.6±0.7 43.4±1.6</td><td>61.9±0.9 61.7±0.9</td><td>52.2±0.7 53.7±1.1</td><td>17</td><td>(4,7)</td></tr><tr><td>ER-AML</td><td>X</td><td>49.4±1.0</td><td>30.9±0.8</td><td>57.0±1.0</td><td>39.2±1.0</td><td>63.3±1.0</td><td>52.2±1.1</td><td>17</td><td>(4,7)</td></tr><tr><td>(ours) GDUMB</td><td></td><td>50.4±1.3 0±0.0</td><td>36.4±1.4 35.0±0.6</td><td>56.8±1.0 0±0.0</td><td>47.7±0.7 45.8±0.9</td><td>62.0±0.9 0±0.0</td><td>55.7±1.3 61.3±1.7</td><td>(43,853)</td><td>(11,14)</td></tr></table>
|
| 167 |
+
|
| 168 |
+
<table><tr><td>Method</td><td>AAA</td><td>Acc.</td><td>Train TFLOPs</td><td>Mem. (Mb.)</td><td>AAA</td><td>Acc.</td><td>Train TFLOPs</td><td>Mem. (Mb.)</td></tr><tr><td>iid</td><td></td><td>19.8±0.3</td><td>9</td><td>4</td><td></td><td>16.7±0.5</td><td>59</td><td>4</td></tr><tr><td>iid++</td><td></td><td>28.3±0.3</td><td>17</td><td>4</td><td></td><td>25.0±0.8</td><td>118</td><td>4</td></tr><tr><td>DER++</td><td>23.3±0.5</td><td>15.1±0.4</td><td>25</td><td>36</td><td>21.7±0.6</td><td>12.9±0.3</td><td>176</td><td>217</td></tr><tr><td>ER</td><td>24.2±0.6</td><td>19.8±0.4</td><td>17</td><td>35</td><td>26.2±0.8</td><td>18.2±0.5</td><td>118</td><td>216</td></tr><tr><td>iCaRLt</td><td>26.3±0.3</td><td>17.3±0.2</td><td>294</td><td>39</td><td>24.4±0.4</td><td>17.1±0.1</td><td>2097</td><td>220</td></tr><tr><td>MIRt</td><td>23.6±0.8</td><td>20.6±0.5</td><td>41</td><td>35</td><td>27.2±0.7</td><td>20.2±0.8</td><td>294</td><td>216</td></tr><tr><td>SS-ILt</td><td>31.5±0.5</td><td>25.0±0.3</td><td>19</td><td>39</td><td>29.7±0.6</td><td>23.5±0.5</td><td>137</td><td>220</td></tr><tr><td>ER-ACE (ours)</td><td>32.7±0.5</td><td>25.8±0.4</td><td>17</td><td>35</td><td>30.2±0.6</td><td>22.7±0.6</td><td>118</td><td>216</td></tr><tr><td>ER-AML (ours)</td><td>30.2±0.6</td><td>24.3±0.4</td><td>28</td><td>35</td><td>27.0±0.7</td><td>19.3±0.6</td><td>200</td><td>216</td></tr></table>
|
| 169 |
+
|
| 170 |
+
Table 2: Split CIFAR-100 (left) and Mini-Imagenet (right) results with $M = 1 0 0$ . For each method, we report the best result between using (or not) data augmentations.
|
| 171 |
+
|
| 172 |
+
Data Augmentation In the settings of Aljundi et al. (2019a); Lopez-Paz et al. (2017); Ji et al. (2020); Shim et al. (2020); Chaudhry et al. (2019) data augmentation is not used. However, this is a standard practice for improving the performance on small datasets and can thus naturally complement most methods utilizing replay buffers. Notably, Prabhu et al. (2020), the offline learning method, utilizes data augmentation when comparing to the above online learners. To avoid unfair comparisons, in our experiments we indicate when a method uses augmentation. When not specified, we treat it as a hyperparameter and report the best performance.
|
| 173 |
+
|
| 174 |
+
Hyperparameter selection For all datasets considered, we withhold $5 \%$ of the training data for validation. For each method, optimal hyperparameters were selected via a grid search performed on a validation set. The selection process was done on a per dataset basis, that is we picked the configuration which maximized the accuracy averaged over different memory settings. We found that for both ER-AML and ER-ACE, the same hyperparameter configuration worked across all settings and datasets. All necessary details to reproduce our experiments can be found in the Appendix.
|
| 175 |
+
|
| 176 |
+
# 5.4 STANDARD ONLINE CONTINUAL LEARNING SETTINGS
|
| 177 |
+
|
| 178 |
+
We evaluate on Split CIFAR-10, Split CIFAR-100 and Split MiniImagenet using the protocol and constraints from Aljundi et al. (2019a); Ji et al. (2020); Shim et al. (2020) . We note in all results each method is run 10 times, and we report the mean and standard error. We first discuss dataset specific results, before analysing the computation cost of each method.
|
| 179 |
+
|
| 180 |
+
CIFAR-10 results are found in Table 1 using a variety of buffer sizes. In this setting, we see that both the methods we propose, ER-AML and ER-ACE consistently outperform other methods by a significant margin. This result holds in both settings where data augmentation is (or not) used, outperforming previous state-of-the-art methods MIR and $\mathrm { D E R + + }$ . Shifting our attention to SS-IL, its underperformance w.r.t to ER-ACE highlights the importance of having a rehearsal objective that considers the new classes. In Appendix B, we observe that when applying SS-IL in the online setting: (1) the method performs poorly on the current task, as is it unable to consolidate old and new knowledge, (2) yet mitigates representation drift even on a perfectly balanced stream. The latter is surprising, as the method was designed specifically to address stream imbalance. Finally, we note the offline training baseline G-DUMB cannot satisfy the anytime evaluation criteria.
|
| 181 |
+
|
| 182 |
+
Longer Task Sequence results are shown in Table 2 with CIFAR-100 on the left and MiniImagenet on the right. On both datasets similar findings are observed, our proposed methods match or outperform strong existing baselines. SS-IL performs similarly to our method on mini-imagenet hile having a higher computational and memory cost. As mentioned above, the method struggles to learn the current task, however here the “weight” of the current task is small in the final acc of the 20-task regime. We see that average anytime accuracy is higher for ER-ACE and indeed the anytime curves in Appendix L further illustrate this. Finally, ER-ACE shows relative gains of $35 \%$ in accuracy over ER, without any additional computation cost. For Mini-Imagenet, ER-ACE outperforms the single-pass iid baseline, and nearly reaches the performance of the equal-compute iid baseline.
|
| 183 |
+
|
| 184 |
+
Computation Budget To provide another view of the computational advantages of our proposal we report the accuracy given compute budget over the length of the sequence in Fig 3. When monitoring the computation performed by each baseline, we notice that several methods do not compete on equal footing. First, the use of Nearest Class Mean (NCM) classifiers leads to a significant compute cost, as shown for iCaRL. For our experiments, we evaluate the model after 10 mini-batches (100 total samples), where NCM classifier must forward the whole buffer to get class prototypes. We argue that such an approach has disadvantages in the online setting due to poor computational trade-offs. Second, MIR Aljundi et al. (2019a) has an expen
|
| 185 |
+
|
| 186 |
+

|
| 187 |
+
Figure 3: Total Accuracy as a function of TeraFLOPs spent. Here the models are evaluated on all 10 classes, to ensure consistency across timesteps.
|
| 188 |
+
|
| 189 |
+
sive sample retrieval cost. It remains to show if this step can be approximated more efficiently. Finally, we note that our method, ER-AML has varying compute: for streams with a small number of classes per task (CIFAR10), it can compute the incoming loss leveraging only the incoming data. In other datasets, where an incoming batch may not have at least two samples of each class, an additional cost to forward a buffered point is incurred.
|
| 190 |
+
|
| 191 |
+
Evaluation with augmentation The use of augmentations also permits extra benefits of replay methods particularly in settings where buffer overfitting is more present, e.g. in the small buffer regime. From the results in Table 1, we see that augmentations provides significant gains for a large set of methods. It is therefore crucial to compare methods on equal footing, where they can all leverage (or not) data augmentation. For example, gains reported in Prabhu et al. (2020) over ER completely vanish when ER is given the same access to augmented data. We note that for MiniImagenet, augmentations did not help. We hypothesize that since this is the hardest task the risk of overfitting on the buffer is less severe.
|
| 192 |
+
|
| 193 |
+
# 5.5 BLURRY TASK BOUNDARIES
|
| 194 |
+
|
| 195 |
+
Table 3: CIFAR-10 Blurry Task Boundary Experiments
|
| 196 |
+
|
| 197 |
+
<table><tr><td>Method</td><td>M= 20</td><td>M=100</td></tr><tr><td>ER</td><td>32.1±1.5</td><td>42.7±2.2</td></tr><tr><td>DER++</td><td>31.0±1.4</td><td>41.7±1.4</td></tr><tr><td>ER-AML</td><td>45.6±1.2</td><td>55.2±1.1</td></tr><tr><td>ER-ACE</td><td>44.5±0.5</td><td>50.2±1.1</td></tr></table>
|
| 198 |
+
|
| 199 |
+
Next, we explore a setting where the distribution is continuously evolving, rather than clearly delineated by task boundaries (similar to settings considered in Aljundi et al. (2019b)). To do this, we linearly interpolate between tasks over time, resulting in new classes being slowly mixed into the data stream. This experiment is done on Split-CIFAR10, and the interpolation is such that at every timestep, the incoming data batch has on average 2 unique labels (as in the original experiment). We only evaluate task-free methods in this setting: methods like MIR and SS-IL cannot be used in such setting. Results in table 3 report the final accuracy, averaged over 5 runs, we report the standard error. We observe our ER-AML and ER-ACE methods perofrm well in this setting. More details provided in Appendix A.2.
|
| 200 |
+
|
| 201 |
+
# 6 CONCLUSION
|
| 202 |
+
|
| 203 |
+
We have illustrated how in the online continual learning setting the standard loss applies excessive pressure on old class representations. We proposed two modifications of the loss function, both based on treating the incoming and replay data in an asymmetric fashion. Our proposed method does not require knowledge of the current task and is shown to be suitable for long task sequences achieving strong performance with minimal or no additional cost. We also raise the standard for high quality evaluation in online continual learning by considering a wide number of baselines and metrics.
|
| 204 |
+
|
| 205 |
+
# 7 REPRODUCIBILITY STATEMENT
|
| 206 |
+
|
| 207 |
+
We have made several efforts to ensure that the results provided in the paper are fully reproducible. We first provide a detailed codebase from which all the results in this paper are generated. In this codebase, one can find the results of our grid search, as well as optimal hyperparameters for each method and setting. We have provided a Readme file to help guide used to reproduce our results. Details of all hyperparameters are also clearly described in the main paper and particularly in the appendix.
|
| 208 |
+
|
| 209 |
+
# 8 ACKNOWLEDGEMENTS
|
| 210 |
+
|
| 211 |
+
Lucas Caccia is funded by Borealis AI. EB and NA are supported by NSERC Discovery Grant RGPIN-2021-04104. We acknowledge resources provided by Compute Canada and Calcul Quebec.
|
| 212 |
+
|
| 213 |
+
# REFERENCES
|
| 214 |
+
|
| 215 |
+
Hongjoon Ahn, Jihwan Kwak, Subin Lim, Hyeonsu Bang, Hyojun Kim, and Taesup Moon. Ss-il: Separated softmax for incremental learning. arXiv preprint arXiv:2003.13947, 2020.
|
| 216 |
+
|
| 217 |
+
Rahaf Aljundi, Francesca Babiloni, Mohamed Elhoseiny, Marcus Rohrbach, and Tinne Tuytelaars. Memory aware synapses: Learning what (not) to forget. arXiv preprint arXiv:1711.09601, 2017.
|
| 218 |
+
|
| 219 |
+
Rahaf Aljundi, Klaas Kelchtermans, and Tinne Tuytelaars. Task-free continual learning. In CVPR 2019, 2018.
|
| 220 |
+
|
| 221 |
+
Rahaf Aljundi, Lucas Caccia, Eugene Belilovsky, Massimo Caccia, Laurent Charlin, and Tinne Tuytelaars. Online continual learning with maximally interfered retrieval. In Advances in Neural Information Processing (NeurIPS), 2019a.
|
| 222 |
+
|
| 223 |
+
Rahaf Aljundi, Min Lin, Baptiste Goujaud, and Yoshua Bengio. Gradient based sample selection for online continual learning. arXiv preprint arXiv:1903.08671, 2019b.
|
| 224 |
+
|
| 225 |
+
Zalan Borsos, Mojm ´ ´ır Mutny, and Andreas Krause. Coresets via bilevel optimization for continual \` learning and streaming. arXiv preprint arXiv:2006.03875, 2020.
|
| 226 |
+
|
| 227 |
+
Pietro Buzzega, Matteo Boschini, Angelo Porrello, Davide Abati, and Simone Calderara. Dark experience for general continual learning: a strong, simple baseline. arXiv preprint arXiv:2004.07211, 2020.
|
| 228 |
+
|
| 229 |
+
Massimo Caccia, Pau Rodriguez, Oleksiy Ostapenko, Fabrice Normandin, Min Lin, Lucas Caccia, Issam Laradji, Irina Rish, Alexandre Lacoste, David Vazquez, et al. Online fast adaptation and knowledge accumulation: a new approach to continual learning. arXiv preprint arXiv:2003.05856, 2020.
|
| 230 |
+
|
| 231 |
+
Arslan Chaudhry, Marc’Aurelio Ranzato, Marcus Rohrbach, and Mohamed Elhoseiny. Efficient lifelong learning with a-gem. In ICLR 2019.
|
| 232 |
+
|
| 233 |
+
Arslan Chaudhry, Marcus Rohrbach, Mohamed Elhoseiny, Thalaiyasingam Ajanthan, Puneet K Dokania, Philip HS Torr, and Marc’Aurelio Ranzato. Continual learning with tiny episodic memories. arXiv preprint arXiv:1902.10486, 2019.
|
| 234 |
+
|
| 235 |
+
Hung-Jen Chen, An-Chieh Cheng, Da-Cheng Juan, Wei Wei, and Min Sun. Mitigating forgetting in online continual learning via instance-aware parameterization. Advances in Neural Information Processing Systems, 33, 2020a.
|
| 236 |
+
|
| 237 |
+
Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. arXiv preprint arXiv:2002.05709, 2020b.
|
| 238 |
+
|
| 239 |
+
Matthias De Lange, Rahaf Aljundi, Marc Masana, Sarah Parisot, Xu Jia, Ales Leonardis, Gregory Slabaugh, and Tinne Tuytelaars. Continual learning: A comparative study on how to defy forgetting in classification tasks. arXiv preprint arXiv:1909.08383, 2019.
|
| 240 |
+
|
| 241 |
+
Sebastian Farquhar and Yarin Gal. Towards robust evaluations of continual learning. arXiv preprint arXiv:1805.09733, 2018.
|
| 242 |
+
|
| 243 |
+
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.
|
| 244 |
+
|
| 245 |
+
Xu He, Jakub Sygnowski, Alexandre Galashov, Andrei A. Rusu, Yee Whye Teh, and Razvan Pascanu. Task agnostic continual learning via meta learning. ArXiv, abs/1906.05201, 2019. URL https://arxiv.org/abs/1906.05201.
|
| 246 |
+
|
| 247 |
+
Elad Hoffer and Nir Ailon. Deep metric learning using triplet network. In International workshop on similarity-based pattern recognition, pp. 84–92. Springer, 2015.
|
| 248 |
+
|
| 249 |
+
Saihui Hou, Xinyu Pan, Chen Change Loy, Zilei Wang, and Dahua Lin. Learning a unified classifier incrementally via rebalancing. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 831–839, 2019.
|
| 250 |
+
|
| 251 |
+
Xu Ji, Joao Henriques, Tinne Tuytelaars, and Andrea Vedaldi. Automatic recall machines: Internal replay, continual learning and the brain. arXiv preprint arXiv:2006.12323, 2020.
|
| 252 |
+
|
| 253 |
+
Prannay Khosla, Piotr Teterwak, Chen Wang, Aaron Sarna, Yonglong Tian, Phillip Isola, Aaron Maschinot, Ce Liu, and Dilip Krishnan. Supervised contrastive learning. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 18661–18673. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper/2020/file/ d89a66c7c80a29b1bdbab0f2a1a94af8-Paper.pdf.
|
| 254 |
+
|
| 255 |
+
Timothee Lesort, Massimo Caccia, and Irina Rish. Understanding continual learning settings with ´ data distribution drift analysis. arXiv preprint arXiv:2104.01678, 2021.
|
| 256 |
+
|
| 257 |
+
Zhizhong Li and Derek Hoiem. Learning without forgetting. In European Conference on Computer Vision, pp. 614–629. Springer, 2016.
|
| 258 |
+
|
| 259 |
+
David Lopez-Paz et al. Gradient episodic memory for continual learning. In Advances in Neural Information Processing Systems, pp. 6467–6476, 2017.
|
| 260 |
+
|
| 261 |
+
Zheda Mai, Ruiwen Li, Hyunwoo Kim, and Scott Sanner. Supervised contrastive replay: Revisiting the nearest class mean classifier in online class-incremental continual learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3589–3599, 2021.
|
| 262 |
+
|
| 263 |
+
Michael McCloskey and Neal J Cohen. Catastrophic interference in connectionist networks: The sequential learning problem. Psychology of learning and motivation, 24:109–165, 1989.
|
| 264 |
+
|
| 265 |
+
Fabrice Normandin, Florian Golemo, Oleksiy Ostapenko, Matthew Riemer, Pau Rodriguez, Julio Hurtado, Khimya Khetarpal, Timothee Lesort, Laurent Charlin, Irina Rish, and Massimo Caccia.´ Sequoia - towards a systematic organization of continual learning research. https://github. com/lebrice/Sequoia, 2021. URL https://github.com/lebrice/Sequoia.
|
| 266 |
+
|
| 267 |
+
Oleksiy Ostapenko, Pau Rodriguez, Massimo Caccia, and Laurent Charlin. Continual learning via local module composition. In Thirty-Fifth Conference on Neural Information Processing Systems, 2021. URL https://proceedings.neurips.cc/paper/2021/hash/ fe5e7cb609bdbe6d62449d61849c38b0-Abstract.html.
|
| 268 |
+
|
| 269 |
+
Ameya Prabhu, Philip HS Torr, and Puneet K Dokania. Gdumb: A simple approach that questions our progress in continual learning. In European Conference on Computer Vision, pp. 524–540. Springer, 2020.
|
| 270 |
+
|
| 271 |
+
Hang Qi, Matthew Brown, and David G Lowe. Low-shot learning with imprinted weights. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 5822–5830, 2018.
|
| 272 |
+
|
| 273 |
+
Sylvestre-Alvise Rebuffi, Alexander Kolesnikov, Georg Sperl, and Christoph H Lampert. icarl: Incremental classifier and representation learning. In Proc. CVPR, 2017.
|
| 274 |
+
|
| 275 |
+
David Rolnick, Arun Ahuja, Jonathan Schwarz, Timothy P Lillicrap, and Greg Wayne. Experience replay for continual learning. arXiv preprint arXiv:1811.11682, 2018.
|
| 276 |
+
|
| 277 |
+
Joan Serra, D \` ´ıdac Sur´ıs, Marius Miron, and Alexandros Karatzoglou. Overcoming catastrophic forgetting with hard attention to the task. arXiv preprint arXiv:1801.01423, 2018.
|
| 278 |
+
|
| 279 |
+
Dongsub Shim, Zheda Mai, Jihwan Jeong, Scott Sanner, Hyunwoo Kim, and Jongseong Jang. Online class-incremental continual learning with adversarial shapley value. arXiv e-prints, pp. arXiv–2009, 2020.
|
| 280 |
+
|
| 281 |
+
Dongsub Shim, Zheda Mai, Jihwan Jeong, Scott Sanner, Hyunwoo Kim, and Jongseong Jang. Online class-incremental continual learning with adversarial shapley value. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pp. 9630–9638, 2021.
|
| 282 |
+
|
| 283 |
+
Binh Tang and David S Matteson. Graph-based continual learning. arXiv preprint arXiv:2007.04813, 2020.
|
| 284 |
+
|
| 285 |
+
Gido M van de Ven and Andreas S Tolias. Three scenarios for continual learning. arXiv preprint arXiv:1904.07734, 2019. URL https://arxiv.org/abs/1904.07734.
|
| 286 |
+
|
| 287 |
+
Jeffrey S Vitter. Random sampling with a reservoir. ACM Transactions on Mathematical Software (TOMS), 11(1):37–57, 1985.
|
| 288 |
+
|
| 289 |
+
Johannes Von Oswald, Dominic Zhao, Seijin Kobayashi, Simon Schug, Massimo Caccia, Nicolas Zucchet, and Joao Sacramento. Learning where to learn: Gradient spar- ˜ sity in meta and continual learning. Advances in Neural Information Processing Systems, 34, 2021. URL https://proceedings.neurips.cc/paper/2021/hash/ 2a10665525774fa2501c2c8c4985ce61-Abstract.html.
|
| 290 |
+
|
| 291 |
+
Yue Wu, Yinpeng Chen, Lijuan Wang, Yuancheng Ye, Zicheng Liu, Yandong Guo, and Yun Fu. Large scale incremental learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 374–382, 2019.
|
| 292 |
+
|
| 293 |
+
Chen Zeno, Itay Golan, Elad Hoffer, and Daniel Soudry. Task agnostic continual learning using online variational bayes. arXiv preprint arXiv:1803.10123, 2018.
|
| 294 |
+
|
| 295 |
+
Bowen Zhao, Xi Xiao, Guojun Gan, Bin Zhang, and Shutao Xia. Maintaining discrimination and fairness in class incremental learning. arXiv preprint arXiv:1911.07053, 2019.
|
| 296 |
+
|
| 297 |
+
# A EXPERIMENTAL SETUP
|
| 298 |
+
|
| 299 |
+
In this section we provide additional experiments regarding the baselines and hyperparameters. In all experiments, we leave the batch size and the rehearsal batch size fixed at 10, following Aljundi et al. (2019a); Chaudhry et al.. This allows us to fairly compare different approaches, as these parameters have a direct impact on the computational cost of a given run. The model architecture $\boldsymbol { \theta }$ in Alg. 1) is also kept constant, which is a reduced ResNet-18 used in Lopez-Paz et al. (2017); Chaudhry et al.; Aljundi et al. (2019a;b), where the dimensions of the last linear layer change depending on the input height and width. The model has 1.09M params for the CIFAR experiments and 1.15M params for MiniImagenet. For all datasets considered, we keep the original ordering of the classes, meaning that the first task will always contain the first $k$ classes.
|
| 300 |
+
|
| 301 |
+
# A.1 HYPERPARAMETERS
|
| 302 |
+
|
| 303 |
+
All results in the paper have been (re)implemented by us, with the expection of GDUMB Prabhu et al. (2020), where results were run from the author’s public codebase. For each method a grid search was ran on the possible hparams, which we detail below. We will also described method specific details.
|
| 304 |
+
|
| 305 |
+
# $\mathbf { D E R + + }$ Buzzega et al. (2020) :
|
| 306 |
+
|
| 307 |
+
• LR : [0.1, 0.01, 0.001] • α : [0.25, 0.5, 0.75] • β : [0.5, 0.75, 1]
|
| 308 |
+
|
| 309 |
+
We also tried to implement the DER (not $\mathrm { D E R + + }$ ) algorithm described in Buzzega et al. (2020). We found that it did not lead to improvements w.r.t to ER in the single epoch setting. Moreover, the setting in the original paper uses a wider Resnet-18. We found that both these differences account for the drop in performance when comparing to the numbers in Buzzega et al. (2020).
|
| 310 |
+
|
| 311 |
+
Finally, we highlight that in general, methods using distillation (iCaRLRebuffi et al. (2017), SS-IL Ahn et al. (2020), and DER Buzzega et al. (2020)) typically perform better in the onlne setting without it.
|
| 312 |
+
|
| 313 |
+
# ER Chaudhry et al. :
|
| 314 |
+
|
| 315 |
+
• LR : [0.1, 0.01, 0.001]
|
| 316 |
+
|
| 317 |
+
Note that unlike the ER implementation in Aljundi et al. (2019a), we use a “task-free” implementation. This leads to two differences. First, rehearsal begins as soon as the buffer is not empty. Second, when fetching points in the buffer, we do not exclude classes from the current task, as done in MIRAljundi et al. (2019a).
|
| 318 |
+
|
| 319 |
+
# iCaRL Rebuffi et al. (2017) :
|
| 320 |
+
|
| 321 |
+
• LR : [0.1, 0.01, 0.001]
|
| 322 |
+
|
| 323 |
+
For all “task-based” methods (iCaRL, MIR, SS-IL) we fully leverage the task identified and do not start rehearsal until the second tasks. This typically leads to better performance, especially in the small buffer setting, as it reduces the work of overfitting to the buffer.
|
| 324 |
+
|
| 325 |
+
# MIR Aljundi et al. (2019a) :
|
| 326 |
+
|
| 327 |
+
• LR : [0.1, 0.01, 0.001]
|
| 328 |
+
|
| 329 |
+
Note that unlike in the original paper, the final results in the paper are on the full training set. In other words, once the hyperparameter cross-validation is done, we train on the validation set. This changes the results slightly from the original paper. Finally, we kept the number of items subsampled from the buffer for the sampling step $( N _ { c } )$ equal to 50 as in the original codebase.
|
| 330 |
+
|
| 331 |
+
# SS-ILAhn et al. (2020) :
|
| 332 |
+
|
| 333 |
+
• LR : [0.1, 0.01, 0.001]
|
| 334 |
+
• should distill : [Yes, No]. When turned on, this method also uses the distillation loss as prescribed in Ahn et al. (2020)
|
| 335 |
+
|
| 336 |
+
As we will see in B, using the
|
| 337 |
+
|
| 338 |
+
# ER-ACE
|
| 339 |
+
|
| 340 |
+
To implement the masking loss, we simply use logits.maskedfill(mask, $- 1 \in 9$ ) to filter out classes which should not receive gradient. Using a small constant in this step is equivalent to removing the masked classes from the softmax denominator.
|
| 341 |
+
|
| 342 |
+
# ER-AML :
|
| 343 |
+
|
| 344 |
+
• LR : [0.1, 0.01, 0.001] • SupCon Temperature : [0.1, 0.2]
|
| 345 |
+
|
| 346 |
+
# A.2 BLURRY TASK BOUNDARIES EXPERIMENT
|
| 347 |
+
|
| 348 |
+
Here we provide additional details on the experiment described in Section 5.4. In the original (task based) benchmark, each task comprises 10K samples (or 1K minibatches of 10 samples), so a total of 5K minibatches streamed. For the smooth alternative, at each timestep $t \in \{ 1 , \bar { 2 } , . . , 5 0 0 0 \}$ the unnormalized probability of seeing class $c$ is given by
|
| 349 |
+
|
| 350 |
+
$$
|
| 351 |
+
p _ { c } ( t ) \sim \dot { \mathcal { N } } ( \mu _ { c } - t , \frac { N _ { c } } { 4 } )
|
| 352 |
+
$$
|
| 353 |
+
|
| 354 |
+
with $N _ { c }$ denotes the number of samples of class $c$ , and $\begin{array} { r } { \mu _ { c } = \frac { ( 2 c - 1 ) N _ { c } } { 2 } } \end{array}$ (2c−1)Nc . At every timestep we normalize this probability for each class and sample according to a Categorical distribution with these probabilities. The parameters for the mean and variance are chosen so that on average, the model receives 2 unique labels per minibatch of 10 items (as in the original task-based experiment).
|
| 355 |
+
|
| 356 |
+
In such a setting where there is no notion of the current task, or rather a set of current labels, one cannot use SS-IL, as it needs to leverage a task identifier during training. Through this experiment we show that our method can overcome this limitation, despite sharing some similarities with SS-IL.
|
| 357 |
+
|
| 358 |
+
# B AN IN-DEPTH ANALYSIS OF SS-IL IN THE ONLINE SETTING
|
| 359 |
+
|
| 360 |
+
SS-IL is a related method. In this section, we highlight several key observations when deploying SS-IL in the online setting which are on the other hand not issues for ER-AML and ER-ACE. We then provide several additional experiments, shedding some light on the inner workings of the method.
|
| 361 |
+
|
| 362 |
+
SS-IL fails to learn the current task As stated earlier, the key difference between SS-IL without distillation and ER-ACE is that in the latter, the rehearsal loss in unmasked. In this section, we highlight the problems that occur when using a masked rehearsal loss alongside a masked incoming loss as in SS-IL. We show that since both losses are masked, the model never learns to classify classses across tasks. Specifically, there is no objective in which the model learns to distinguish classes in the current task from classes in the previous tasks. As we show in Figure 4, SS-IL is unable to classify samples from the current task in a single-head setting. The method actually performs worse than random chance on samples form the current task. On the other extreme we see that ER does very well on the current task (shifting abrupty the previous representations to accomodate the new task). Finally, we see that ER-ACE strikes a good tradeoff between the two, reaching a reasonable accuracy on the current task without disrupting the learned representations of previous tasks. We note that the same conclusion is reached when using the original SS-IL method with the distillation loss.
|
| 363 |
+
|
| 364 |
+
SS-IL does more than correcting for class imbalance SS-IL is motivated as a method which addresses the class imbalance issue arising in replay methods. Specifically, when drawing a fixed number of rehearsal points at every epoch, it follows that as more and more tasks are seen, previous classes are underrepresented in the training stream when compared to points from the current tasks.
|
| 365 |
+
|
| 366 |
+
In this section, we test whether or not the behavior of SS-IL differs from standard Experience Replay when no class imbalance is present. In this experiment, we increase the number of rehearsal points sampled at every task such that when combining incoming and rehearsal data, we obtain perfectly balanced training data on average. This is experiment is done on the Split-CIFAR10 benchmark with 2 classes per task, with a minibatch of 10 incoming datapoints. Therefore, we sample $0 , 1 0 , 2 0 , 3 0 , 4 0$ rehearsal points per incoming databatch for the first, second, third, fourth and fifth task.
|
| 367 |
+
|
| 368 |
+
What we observe is that SS-IL still outperforms regular Experience Replay, suggesting that the method does more than simply addressing class imbalance in the data stream. We report final accuracy in Table 4. SS-IL’s performance gap with ER is bigger with small buffer. This is consistent with what we observe for representation drift : methods with larger buffer can better correct for abrupt representation change, making the gap between ER vs ER-ACE and ER-AML smaller. From this we give new insights on the inner workings of SS-IL, namely that it works well because it addresses representation drift rather than class imbalance.
|
| 369 |
+
|
| 370 |
+
$$
|
| 371 |
+
\begin{array} { l } { { \frac { \mathrm { M e t h o d } \quad M = 2 0 \qquad M = 5 0 \quad M = 1 0 0 } { \mathrm { E R } \qquad 2 1 . 0 \pm 1 . 2 \ 2 5 . 7 \pm 1 . 1 \ 3 7 . 8 \pm 0 . 7 } } } \\ { { \mathrm { S S - L L } \quad 3 0 . 3 \pm 1 . 0 \ 3 4 . 6 \pm 0 . 8 \ 3 9 . 1 \pm 0 . 6 } } \end{array}
|
| 372 |
+
$$
|
| 373 |
+
|
| 374 |
+
Table 4: Final Accuracy on split CIFAR-10 with class balanced stream.
|
| 375 |
+
|
| 376 |
+

|
| 377 |
+
Accuracy on the current task
|
| 378 |
+
Figure 4: For Split-CIFAR-10, we monitor the performance on the current task observed in the stream for SS-IL, ER, and ER-ACE. ER fits too abruptly current task; ER-ACE incorporates this knowledge slowly; SS-IL barely on the other hand is unable to learn new tasks when they are first observed in the stream
|
| 379 |
+
|
| 380 |
+
# C OVERFITTING ON BUFFERED SAMPLES
|
| 381 |
+
|
| 382 |
+
We study the extent to which our proposed method reduces over-fitting to samples stored in the buffer.
|
| 383 |
+
|
| 384 |
+

|
| 385 |
+
Figure 5: Alignment between buffer and holdout representations. ER-ACE has constantly larger alignment between seen and unseen samples compared to ER especially for older tasks.
|
| 386 |
+
|
| 387 |
+
A good model fit should yield a learned representation where same class datapoints are aligned, whether or not they were seen during training. To evaluate this potential mismatch, we first train a model and compare the representations of a) samples in the buffer $M$ after training and b) held-out samples from the validation set $V$ . That is, for each datapoint $x _ { m } \in M$ we find the point $x _ { v } \in V$ with $c ( x _ { m } ) = c ( x _ { v } )$ which maximizes the cosine similarity between $f _ { \theta } ( x _ { m } )$ and $f _ { \theta } ( x _ { v } )$ . This allows to compare alignment across models, irrespective of their internal scaling. We report the results in Figure 5, where similarity values are averaged over points from the same task. We find that our proposed method, ER-ACE, designed to reduce representation drift also reduces the extent to which the model overfits on the buffer. We observe that for earlier tasks, ER-ACE still retains a strong alignment between rehearsal and held-out data, which is not the case for ER.
|
| 388 |
+
|
| 389 |
+
# D COMBINING ER-ACE WITH DER $^ { + + }$
|
| 390 |
+
|
| 391 |
+
In this section, we apply our method on top of the strong DER $^ { + + }$ Buzzega et al. (2020) baseline. For this experiment, we use the same setting as in the DER paper. Specifically, we port our implementation to their public codebase https://github.com/aimagelab/mammoth. We keep the default settings for CIFAR-10, using a single pass through the data. We find that combining ER-ACE with $\mathrm { D E R + + }$ yields additional advantages. Not only do we observe small gains in accuracy, we notice significant gains in forgetting. Results are shown in Figure 6. Forgetting is defined as in Chaudhry et al..
|
| 392 |
+
|
| 393 |
+

|
| 394 |
+
Figure 6: Comparison to Dark Experience Replay (DER). We obtain improved performance and we can enhance the DER method using the ER-ACE approach
|
| 395 |
+
|
| 396 |
+
Table 5: Average Drift (avg distance in feature space) of buffered representations for CIFAR-10 during learning of the second task. We observe similar behavior to ER-AML with SupCon
|
| 397 |
+
|
| 398 |
+
<table><tr><td rowspan=1 colspan=1>ER</td><td rowspan=1 colspan=1>(3.2 ± 1.8) × 10-2</td></tr><tr><td rowspan=1 colspan=1>ER-AML-Tripletw.All Negs</td><td rowspan=1 colspan=1>(3.0±0.6)× 10-2</td></tr><tr><td rowspan=1 colspan=1>ER-AML-Triplet w. Incoming Negs</td><td rowspan=1 colspan=1>(2.5 ±0.6)× 10-²</td></tr></table>
|
| 399 |
+
|
| 400 |
+
Table 6: Ablation comparing ER-AML with triplet loss to ER-AML with SupCon. We observe both improve over ER but SupCon has better performance in larger buffer sizes
|
| 401 |
+
|
| 402 |
+
<table><tr><td colspan="5">Accuracy ↑</td></tr><tr><td></td><td>M=5</td><td>M=20</td><td>M=50</td><td>M=100</td></tr><tr><td>iid online</td><td>60.8±1.0</td><td>60.8±1.0</td><td>60.8 ± 1.0</td><td>60.8±1.0</td></tr><tr><td>iid++ online</td><td>72.0 ± 0.1</td><td>72.0±0.1</td><td>72.0±0.1</td><td>72.0±0.1</td></tr><tr><td>iid offline</td><td>79.2 ± 0.4</td><td>79.2 ± 0.4</td><td>79.2 ± 0.4</td><td>79.2 ± 0.4</td></tr><tr><td>fine-tuning</td><td>18.4± 0.3</td><td>18.4± 0.3</td><td>18.4±0.3</td><td>18.4±0.3</td></tr><tr><td>ER</td><td>19.0 ± 0.1</td><td>26.7± 0.3</td><td>36.1 ± 0.6</td><td>41.5 ± 0.6</td></tr><tr><td>ER-AML Triplet</td><td>33.0 ± 0.3</td><td>40.1± 0.4</td><td>46.0± 0.5</td><td>49.8 ± 0.5</td></tr><tr><td>ER-AML SupCon 33.0 ±0.2</td><td></td><td>41.9 ± 0.1</td><td>48.3±0.2</td><td>51.9 ±0.3</td></tr></table>
|
| 403 |
+
|
| 404 |
+
# E GRADIENT NORM
|
| 405 |
+
|
| 406 |
+
Figure 7 shows the gradients norms of the features of previous classes in a stream of two tasks. Note how for normal ER, at the task switch the gradients of the previous classes features are suddenly very high leading potentially to large drift on these features.
|
| 407 |
+
|
| 408 |
+

|
| 409 |
+
Figure 7: Gradient’s norm for first task features in a two task learning scenario. We observe a sharp increase when all negatives are used and decrease using only incoming negatives.
|
| 410 |
+
|
| 411 |
+
# F ER-AML WITH TRIPLET LOSS
|
| 412 |
+
|
| 413 |
+
We observe similar behavior for ER-AML implemented with the triplet loss in terms of the importance of negative selection on drift as illustrated in Table 5. We also ablate ER-AML based on SupCon and Triplet in Table 6 finding the former outperforms in settings with higher buffer sizes, but that both outperform ER.
|
| 414 |
+
|
| 415 |
+
# G ABLATIONS NEGATIVE SELECTION
|
| 416 |
+
|
| 417 |
+
As discussed in the main paper, the selection of negatives is a critical aspect of ER-AML and motivates ER-ACE. To further illustrate this we ablate the performance of ER-AML when all possible negatives are used versus the prescribed negative selection strategy (using only classes in the incoming batch). The results are shown in Table 7. We observe that performance of ER-AML with all negatives is similar to but slightly better than ER, while use of well-selected negatives greatly improves performance.
|
| 418 |
+
|
| 419 |
+
<table><tr><td></td><td>Accuracy (↑is better) M=20 M=50</td><td>Forgetting (↓is better) M=20 M=50</td></tr><tr><td>ER</td><td>26.7±0.3 36.1±0.6</td><td>47.1± 0.8 37.6± 0.9</td></tr><tr><td>ER-AML(all negatives)</td><td>28.5± 0.3 41.4± 0.4</td><td>56.7± 0.6 35.0±0.4</td></tr><tr><td>ER-AML(incoming negatives)</td><td>41.9 ± 0.1 48.3±0.2</td><td>33.6±0.2 25.8±0.3</td></tr></table>
|
| 420 |
+
|
| 421 |
+
Table 7: Ablation of ER-AML with all negative selection versus negatives selected from incoming classes. We use the CIFAR-10 dataset. We observe that performance of ER-AML with all negatives is similar to but slightly better than ER, while use of well-selected negatives greatly improves performance.
|
| 422 |
+
|
| 423 |
+
# H ADDITIONAL DRIFT RESULTS
|
| 424 |
+
|
| 425 |
+
We showed in Figure 2 that the selection of negatives has a significant impact on the amount of representation change. Here we show that a similar behavior is observed with ER vs ER-ACE.
|
| 426 |
+
|
| 427 |
+

|
| 428 |
+
|
| 429 |
+
# I ANALYSIS OF THE REPRESENTATIONS DURING THE SECOND TASK
|
| 430 |
+
|
| 431 |
+
In this section we take a closer look at the model’s internal representation during the learning of the second task for different methods. This experiment replicates the setup illustrated in Figure 1 (split-CIFAR-10 with $M = 2 0$ ). For each method, the figures for all iterations were projected together to ensure that the figures are comparable across timesteps. All methods were initialized starting from the same base model trained on the first task. The dotted representations shown for each class come from held-out samples.
|
| 432 |
+
|
| 433 |
+
We start by looking at the representations obtained at the begining of the second task. We see that for all three methods, (i) the prototypes of the classes from the first task (Class 0 and Class 1) are well placed, while the other prototypes are placed at random since they are not trained.
|
| 434 |
+
|
| 435 |
+

|
| 436 |
+
Figure 8: 1 Training Iteration on the Second Task
|
| 437 |
+
|
| 438 |
+
After 100 training iterations, we see that for ER, the prototypes of the old classes have been significantly displaced and are far from the points of similar class. This is not the case for the latter two methods; for ER-ACE and ER-AML, the model is beginning to separate de classes from one another, and the class prototypes are near their respective classes.
|
| 439 |
+
|
| 440 |
+

|
| 441 |
+
Figure 9: 100 Training Iterations on the Second Task
|
| 442 |
+
|
| 443 |
+
After 400 training iterations, ER still struggles to align the class prototypes with the respective classes. ER-ACE has already well clustered the respective classes. ER-AML, continues to cluster the classes together, however does not do it as fast as ER-ACE.
|
| 444 |
+
|
| 445 |
+

|
| 446 |
+
Figure 10: 400 Training Iterations on the Second Task
|
| 447 |
+
|
| 448 |
+
At the end of the second task, ER-ACE and ER-AML have successfully clustered the classes and aligned their respective prototypes with the clusters. As for ER, while the data is clustered, the prototypes are not properly aligned with class clusters. Moreover, we still see a strong overlap between prototypes of Class 2 and 3.
|
| 449 |
+
|
| 450 |
+

|
| 451 |
+
Figure 11: End of the Second Task
|
| 452 |
+
|
| 453 |
+
# J ADDITIONAL BLURRY TASK BOUNDARIES EXPERIMENTS
|
| 454 |
+
|
| 455 |
+
Here we provide blurry task results for varying levels of task overlap. To give an idea of how much the tasks overlap, we report the average number of unique classes per incoming minibatch (MB): a small number means that the tasks are well separated. A high number means that there is a strong overlap. In the fully i.i.d setting, this number would be maximized. On the other hand, when this equals 1, each data class is streamed one after the other.
|
| 456 |
+
|
| 457 |
+
Experiments are performed again on CIFAR-10 with $M = 2 0$ . We use augmentations to fairly compare with $\mathrm { D E R + + }$ . Results are averaged over 5 runs.
|
| 458 |
+
|
| 459 |
+
<table><tr><td>Method</td><td>Avg. unique classes per MB 1 2 3 4 5</td></tr><tr><td>ER 23.1 DER++ 20.3 31.1</td><td>25.7 26.3 31.1 34.4 31.4 37.3 34.4</td></tr><tr><td>ER-ACE 32.8</td><td>36.2 36.8 41.7 44.5</td></tr><tr><td>ER-AML 34.0</td><td>40.4 46.0 47.6 47.9</td></tr></table>
|
| 460 |
+
|
| 461 |
+
We see that through a wide range of different blurriness levels, our methods show strong improvement over other task-free baselines
|
| 462 |
+
|
| 463 |
+
# K EXPERIMENTS WITH LIMITED TRAINING DATA AVAILABLE
|
| 464 |
+
|
| 465 |
+
Next, we evaluate the methods above using varying percentages of the training data from the second task onwards (we use all the data for the first task so the model has converged to a reasonable solution before the first distribution shift). Moreover, we augment the rehearsal batch size for ER, ER-ACE and ER-AML to 20, so that their compute cost equals $\mathrm { D E R + + }$ . This is again on CIFAR-10, $M = 2 0$ . Results averaged over 5 runs.
|
| 466 |
+
|
| 467 |
+
<table><tr><td>Method</td><td>% ofData Used 5% 10% 25% 50%</td></tr><tr><td>ER 17.3</td><td>22.5 28.0 33.2 32.8</td></tr><tr><td>DER++ 17.4 SS-IL 15.2</td><td>19.9 24.8 21.7 28.6</td></tr><tr><td></td><td>31.9</td></tr><tr><td>ER-ACE 20.5 ER-AML 18.1</td><td>25.4 31.2 36.1 24.3 31.0 38.7</td></tr></table>
|
| 468 |
+
|
| 469 |
+
Again, we see that the proposed methods outperforms the baselines suggested above.
|
| 470 |
+
|
| 471 |
+

|
| 472 |
+
CIFAR-10 ${ \mathsf { M } } = 5$ Anytime Evaluation Acc
|
| 473 |
+
|
| 474 |
+
# L ADDITIONAL RESULTS
|
| 475 |
+
|
| 476 |
+
In this section we provide full results (shown in the figures below) for various memory sizes on all three datasets considered, i.e. Split CIFAR-10, Split CIFAR-100 and Split MiniImagenet, with and without data augmentation. The results largely align with those presented but also illustrate the anytime performance.
|
| 477 |
+
|
| 478 |
+
L.1 ANYTIME EVALUATION WITHOUT DATA AUGMENTATION
|
| 479 |
+
|
| 480 |
+
L.2 ANYTIME EVALUATION WITH DATA AUGMENTATION
|
| 481 |
+
|
| 482 |
+

|
| 483 |
+
|
| 484 |
+

|
| 485 |
+
|
| 486 |
+

|
| 487 |
+
|
| 488 |
+

|
| 489 |
+
|
| 490 |
+

|
| 491 |
+
|
| 492 |
+

|
md/dev/NAQvF08TcyG/NAQvF08TcyG.md
ADDED
|
@@ -0,0 +1,578 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# AN IMAGE IS WORTH ONE WORD: PERSONALIZING TEXT-TO-IMAGE GENERATION USING TEXTUAL INVERSION
|
| 2 |
+
|
| 3 |
+
Rinon Gal1,2
|
| 4 |
+
|
| 5 |
+
Yuval Alaluf1
|
| 6 |
+
|
| 7 |
+
Yuval Atzmon2
|
| 8 |
+
|
| 9 |
+
Or Patashnik1
|
| 10 |
+
|
| 11 |
+
Amit H. Bermano1
|
| 12 |
+
|
| 13 |
+
Gal Chechik2
|
| 14 |
+
|
| 15 |
+
Daniel Cohen-Or1
|
| 16 |
+
|
| 17 |
+
1Tel-Aviv University
|
| 18 |
+
|
| 19 |
+
2NVIDIA
|
| 20 |
+
|
| 21 |
+
# ABSTRACT
|
| 22 |
+
|
| 23 |
+
Text-to-image models offer unprecedented freedom to guide creation through natural language. Yet, it is unclear how such freedom can be exercised to generate images of specific unique concepts, modify their appearance, or compose them in new roles and novel scenes. In other words, we ask: how can we use languageguided models to turn our cat into a painting, or imagine a new product based on our favorite toy? Here we present a simple approach that allows such creative freedom. Using only 3-5 images of a user-provided concept, like an object or a style, we learn to represent it through new “words” in the embedding space of a frozen text-to-image model. These “words” can be composed into natural language sentences, guiding personalized creation in an intuitive way. Notably, we find evidence that a single word embedding is sufficient for capturing unique and varied concepts. We compare our approach to a wide range of baselines, and demonstrate that it can more faithfully portray the concepts across a range of applications and tasks. Code, data and new words are available at our project page.
|
| 24 |
+
|
| 25 |
+

|
| 26 |
+
Figure 1: (left) We find new pseudo-words in the embedding space of pre-trained text-to-image models which describe specific concepts. (right) These pseudo-words are composed into new sentences, placing our targets in new scenes, changing their style or ingraining them into new products.
|
| 27 |
+
|
| 28 |
+
# 1 INTRODUCTION
|
| 29 |
+
|
| 30 |
+
Large-scale text-to-image models (Rombach et al., 2021; Ramesh et al., 2021; 2022; Nichol et al., 2021; Yu et al., 2022; Saharia et al., 2022) have demonstrated an unprecedented capability to reason over natural language descriptions. They allow users to synthesize novel scenes with unseen compositions and produce vivid pictures in a myriad of styles. These tools have been used for artistic creation, as sources of inspiration, and even to design new, physical products (Yacoubian, 2022). Their use, however, is constrained by the user’s ability to describe the desired target through text. One can then ask: How could we instruct such models to mimic the likeness of a specific object? How could we ask them to craft a novel scene containing a cherished childhood toy? Or to pull our child’s drawing from its place on the fridge, and turn it into an artistic showpiece?
|
| 31 |
+
|
| 32 |
+
Introducing new concepts into large scale models is often difficult. Re-training a model with an expanded dataset for each new concept is prohibitively expensive, and fine-tuning on few examples typically leads to catastrophic forgetting (Ding et al., 2022; Li et al., 2022). More measured approaches freeze the model and train transformation modules to adapt its output when faced with new concepts (Zhou et al., 2021; Gao et al., 2021; Skantze & Willemsen, 2022). However, these approaches are still prone to forgetting prior knowledge, or face difficulties in accessing it concurrently with newly learned concepts (Kumar et al., 2022; Cohen et al., 2022).
|
| 33 |
+
|
| 34 |
+
We propose to overcome these challenges by finding new words in the textual embedding space of pre-trained text-to-image models. We consider the first stage of the text encoding process (Figure 2). Here, an input string is first converted to a set of tokens. Each token is then replaced with its own embedding vector, and these vectors are fed through the downstream model. Our goal is to find new embedding vectors that represent new, specific concepts.
|
| 35 |
+
|
| 36 |
+
We represent a new embedding vector with a new pseudo-word (Rathvon, 2004) which we denote by $S _ { * }$ . This pseudo-word is then treated like any other word, and can be used to compose novel textual queries for the generative models. One can therefore ask for “a photograph of $S _ { * }$ on the beach”, “an oil painting of a $S _ { * }$ hanging on the wall”, or even compose two concepts, such as “a drawing of $S _ { * } ^ { 1 }$ in the style of $S _ { * } ^ { 2 } { } ^ { , }$ . Importantly, this process leaves the generative model untouched. In doing so, we retain the rich textual understanding and generalization capabilities that are typically lost when fine-tuning vision and language models on new tasks.
|
| 37 |
+
|
| 38 |
+
To find these pseudo-words, we frame the task as one of inversion. We are given a pre-trained textto-image model and a small (3-5) image set depicting the concept. We aim to find a word embedding, so that prompts of the form “A photo of $S _ { * } ^ { \mathrm { ~ \scriptsize ~ , ~ , ~ } }$ will lead to the reconstruction of images from our set. This embedding is found using an optimization process, which we refer to as “Textual Inversion”.
|
| 39 |
+
|
| 40 |
+
We further investigate a series of extensions based on tools typically used in Generative Adversarial Network (GAN) inversion. Our analysis reveals that, while some core principles remain, applying the prior art in a na¨ıve way may harm performance.
|
| 41 |
+
|
| 42 |
+
We demonstrate the effectiveness of our approach over a wide range of concepts and prompts, showing that it can inject unique objects into new scenes, transform them across different styles, transfer poses, diminish biases, and even imagine new products.
|
| 43 |
+
|
| 44 |
+
In summary, our contributions are as follows:
|
| 45 |
+
|
| 46 |
+
• We introduce the task of personalized text-to-image generation, where we synthesize novel scenes of user-provided concepts guided by natural language instructions. • We present the idea of “Textual Inversions” in the context of generative models. Here the goal is to find new pseudo-words in the embedding space of a text encoder that can capture both high-level semantics and fine visual details. • We conduct a prelminary analysis of the properties of the textual embedding space.
|
| 47 |
+
|
| 48 |
+
# 2 RELATED WORK
|
| 49 |
+
|
| 50 |
+
Text-guided synthesis. Text-guided image synthesis has been widely studied in the context of GANs (Goodfellow et al., 2014). Typically, a conditional model is trained to reproduce samples from paired image-caption datasets (Zhu et al., 2019; Tao et al., 2020) by leveraging attention mechanisms (Xu et al., 2018) or cross-modal contrastive approaches (Zhang et al., 2021; Ye et al., 2021). More recently, impressive visual results were achieved using large scale auto-regressive (Ramesh et al., 2021; Yu et al., 2022) or diffusion models (Ramesh et al., 2022; Saharia et al., 2022; Nichol et al., 2021; Rombach et al., 2021). Alternatively, test-time optimization can be used to explore the latent space of pre-trained generators (Crowson et al., 2022; Murdock, 2021; Crowson, 2021). Typically, by maximizing a text-to-image similarity score derived from CLIP (Radford et al., 2021).
|
| 51 |
+
|
| 52 |
+
Moving beyond pure generation, a large body of work explores the use of text-based interfaces for image editing (Patashnik et al., 2021; Abdal et al., 2021; Avrahami et al., 2022b), generator domain adaptation (Gal et al., 2021; Kim et al., 2022) and style transfer (Kwon & Ye, 2021; Liu et al., 2022).
|
| 53 |
+
|
| 54 |
+
Our approach builds on the open-ended, conditional synthesis models. Rather than training a new model from scratch, we show that we can expand a frozen model’s vocabulary and introduce new pseudo-words that describe specific concepts.
|
| 55 |
+
|
| 56 |
+

|
| 57 |
+
Figure 2: Outline of the text-embedding and inversion process. A string containing our placeholder word is first converted into tokens (i.e. word or sub-word indices in a dictionary). These tokens are converted to continuous vector representations (the “embeddings”, $v$ ). Finally, the embedding vectors are transformed into a conditioning code $c _ { \theta } ( y )$ that guides the generation. We optimize the embedding vector $v _ { * }$ associated with our pseudo-word $S _ { * }$ , using a reconstruction objective.
|
| 58 |
+
|
| 59 |
+
GAN inversion. Manipulating images with generative networks often requires one to find a corresponding latent representation of the given image, a process referred to as inversion (Zhu et al., 2016; Xia et al., 2021). In the GAN literature, this inversion is done through either an optimizationbased technique (Abdal et al., 2019; 2020; Zhu et al., 2020b; Gu et al., 2020) or by using an encoder (Richardson et al., 2020; Zhu et al., 2020a; Pidhorskyi et al., 2020; Tov et al., 2021).
|
| 60 |
+
|
| 61 |
+
In our work, we follow the optimization approach, as it can better adapt to unseen concepts. Encoders face harsher generalization requirements, and would likely need to be trained on web-scale data to offer the same freedom. We further analyze our embedding space in light of the GANinversion literature, outlining the core principles that remain and those that do not.
|
| 62 |
+
|
| 63 |
+
Diffusion-based inversion. Diffusion inversion can be performed na¨ıvely by adding noise to an image and then de-noising it through the network. However, this process tends to change the image content. Choi et al. (2021) improve inversion by conditioning the denoising process on low-pass filter data from the target image. (Dhariwal & Nichol, 2021) demonstrate that the DDIM (Song et al., 2020) sampling process can be inverted in a closed-form manner, extracting a latent noise map that will produce a given real image. DALL-E 2 (Ramesh et al., 2022) builds on this method and demonstrates that it can be used to facilitate cross-image interpolations or semantic editing.
|
| 64 |
+
|
| 65 |
+
Whereas the above works invert a given image into the model’s latent space, we invert a userprovided concept. Moreover, we represent this concept as a new pseudo-word in the model’s vocabulary, allowing for more general and intuitive editing.
|
| 66 |
+
|
| 67 |
+
Personalization. Recent work in graphics aims to adapt models to better represent specific individuals or objects. There, it is typical to delicately tune a model to better reconstruct specific faces or scenes (Bau et al., 2019; Roich et al., 2021; Alaluf et al., 2021; Nitzan et al., 2022).
|
| 68 |
+
|
| 69 |
+
PALAVRA (Cohen et al., 2022) identifies pseudo-words in the textual embedding space of CLIP for personalized retrieval and segmentation. However, their task and losses are discriminative, aiming to separate an object from other candidates. As we later show (Figure 5), this approach fails to capture details required for plausible reconstructions or synthesis in new scenes.
|
| 70 |
+
|
| 71 |
+
# 3 METHOD
|
| 72 |
+
|
| 73 |
+
Our goal is to enable language-guided generation of new, user-specified concepts. To do so, we aim to encode these concepts into an intermediate representation of a pre-trained text-to-image model. Ideally, this should be done in a manner that allows us to leverage the rich semantic and visual prior represented by such a model, and use it to guide intuitive visual transformations of the concepts.
|
| 74 |
+
|
| 75 |
+
It is natural to search for candidates for such a representation in the word-embedding stage of the text encoders typically employed by text-to-image models. There, the discrete input text is first converted into a continuous vector representation that is amenable to direct optimization.
|
| 76 |
+
|
| 77 |
+
Prior work has shown that this embedding space is expressive enough to capture basic image semantics (Cohen et al., 2022; Tsimpoukelli et al., 2021). However, these approaches leveraged contrastive or language-completion objectives, neither of which require an in-depth visual understanding of the image. As we demonstrate in Section 4, such methods fail to accurately capture the appearance of the concept, and attempting to employ them for synthesis leads to considerable visual corruption. Our goal is to find pseudo-words that can guide generation, which is a visual task. As such, we propose to find them through a visual reconstruction objective.
|
| 78 |
+
|
| 79 |
+
Below, we outline the core details of applying our approach to a specific class of generative models — Latent Diffusion Models (Rombach et al., 2021). In Section 5, we then analyze a set of extensions to this approach, motivated by GAN-inversion literature.
|
| 80 |
+
|
| 81 |
+
Latent Diffusion Models. We implement our method over Latent Diffusion Models (LDMs) (Rombach et al., 2021), a recently introduced class of Denoising Diffusion Probabilistic Models (DDPMs) (Ho et al., 2020) that operate in the latent space of an autoencoder.
|
| 82 |
+
|
| 83 |
+
LDMs consist of two core components. First, an autoencoder is pre-trained on a large collection of images. An encoder $\mathcal { E }$ learns to map images $x \in \mathcal { D } _ { x }$ into a spatial latent code $z = \mathcal { E } ( x )$ , regularized through either a KL-divergence loss or through vector quantization (Van Den Oord et al., 2017). The decoder $D$ learns to map such latents back to images, such that $D \left( \mathcal { E } ( x ) \right) \approx x$ .
|
| 84 |
+
|
| 85 |
+
The second component, a diffusion model, is trained to produce codes within the learned latent space. This diffusion model can be conditioned on class labels, segmentation masks, or even on the output of a jointly trained text-embedding model. Let $c _ { \theta } ( y )$ be a model that maps a conditioning input $y$ into a conditioning vector. The LDM loss is then given by:
|
| 86 |
+
|
| 87 |
+
$$
|
| 88 |
+
L _ { L D M } : = \mathbb { E } _ { z \sim \mathcal { E } ( x ) , y , \epsilon \sim \mathcal { N } ( 0 , 1 ) , t } \Big [ \| \epsilon - \epsilon _ { \theta } \big ( z _ { t } , t , c _ { \theta } ( y ) \big ) \| _ { 2 } ^ { 2 } \Big ] ,
|
| 89 |
+
$$
|
| 90 |
+
|
| 91 |
+
where $t$ is the time step, $z _ { t }$ is the latent noised to time $t$ , $\epsilon$ is the unscaled noise sample, and $\epsilon _ { \theta }$ is the denoising network. Intuitively, the objective here is to correctly remove the noise added to a latent representation of an image. While training, $c _ { \theta }$ and $\epsilon _ { \theta }$ are jointly optimized to minimize the LDM loss. At inference time, a random noise tensor is sampled and iteratively denoised to produce a new image latent, $z _ { \mathrm { 0 } }$ . Finally, this latent code is transformed into an image $x ^ { \prime } = D ( z _ { 0 } )$ .
|
| 92 |
+
|
| 93 |
+
We employ the publicly available 1.4 billion parameter text-to-image model of Rombach et al. (2021), which was pre-trained on the LAION-400M dataset (Schuhmann et al., 2021). Here, $c _ { \theta }$ is realized through a BERT (Devlin et al., 2018) text encoder, with $y$ being a text prompt. We next review the early stages of such a text encoder, and our choice of inversion space.
|
| 94 |
+
|
| 95 |
+
Text embeddings. Typically, text encoder models begin with a text processing step (Figure 2, left). First, each word or sub-word in an input string is converted to a token, which is an index in some pre-defined dictionary. Each token is then linked to a unique embedding vector, retrieved through an index-based lookup. These embedding vectors are typically learned as part of the text encoder $c _ { \theta }$ .
|
| 96 |
+
|
| 97 |
+
In our work, we choose this embedding space as the target for inversion. Specifically, we designate a placeholder string, $S _ { * }$ , to represent the new concept we wish to learn. We intervene in the embedding process so that the vector associated with the tokenized string is a new, learned embedding $v _ { * }$ , in essence “injecting” the concept into our vocabulary. We can then compose new sentences containing $S _ { * }$ , just as we would with any other word.
|
| 98 |
+
|
| 99 |
+
Textual inversion. To find these new embeddings, we use a small set of images (typically 3- 5), which depict our target concept across multiple settings such as varied backgrounds or poses. We find $v _ { * }$ through direct optimization, by minimizing the LDM loss of Equation (1) over images sampled from the small set. To condition the generation, we randomly sample neutral context texts, derived from the CLIP ImageNet templates (Radford et al., 2021). These contain prompts of the form “A photo of $S _ { * }$ ”, “A rendition of $S _ { * }$ ”, etc. The list of templates is provided in the appendix.
|
| 100 |
+
|
| 101 |
+

|
| 102 |
+
Figure 3: Object variations generated using our method, the CLIP-based reconstruction of DALLE-2 (Ramesh et al., 2022), and human captions of varying lengths.
|
| 103 |
+
|
| 104 |
+
Human captions capture highlevel semantics, but fail to convey fine details or ensure a consistent style. DALLE-2’s image guidance fares better, but still falls short of capturing the unique details of the subject.
|
| 105 |
+
|
| 106 |
+
Our method generates variations which are typically more faithful to the original subject. These demonstrate an ability to capture and represent an object using a single pseudo-word
|
| 107 |
+
|
| 108 |
+
Our optimization goal can then be defined as:
|
| 109 |
+
|
| 110 |
+
$$
|
| 111 |
+
v _ { * } = \arg \operatorname* { m i n } _ { v } \mathbb { E } _ { z \sim \mathcal { E } ( x ) , y , \epsilon \sim \mathcal { N } ( 0 , 1 ) , t } \left[ \| \epsilon - \epsilon _ { \theta } \big ( z _ { t } , t , c _ { \theta } ( y , v ) \big ) \| _ { 2 } ^ { 2 } \right] ,
|
| 112 |
+
$$
|
| 113 |
+
|
| 114 |
+
and is realized by re-using the same training scheme as the original LDM model, while keeping both $c _ { \theta }$ and $\epsilon _ { \theta }$ fixed. Notably, this is a reconstruction task. As such, we expect it to motivate the learned embedding to capture fine visual details unique to the concept.
|
| 115 |
+
|
| 116 |
+
Implementation details, including hyper-parameter choices, are provided in the appendix.
|
| 117 |
+
|
| 118 |
+
# 4 QUALITATIVE COMPARISONS AND APPLICATIONS
|
| 119 |
+
|
| 120 |
+
In the following section, we demonstrate a range of applications enabled through Textual Inversions, and provide visual comparisons to the state-of-the-art and human-captioning baselines.
|
| 121 |
+
|
| 122 |
+
Image variations We begin by demonstrating our ability to capture an object using a single pseudo-word. In Figure 3 we compare our method to two baselines: LDM guided by a human caption and DALLE-2 guided by either a human caption or an image prompt. To gather captions, we provided annotators with four images of a concept and asked them to describe it in a manner that could allow an artist to recreate it. We collected five short $\leq 1 2$ words) and five long $( \le ~ 3 0$ words) captions per concept. Additional details are provided in the appendix. Figure 3 shows results generated with a randomly chosen caption for each setup.
|
| 123 |
+
|
| 124 |
+
As our results demonstrate, our method better captures the unique details of the concept. Human captioning typically captures the high-level semantics, but fails to cover finer details like color patterns (e.g. the teapot). In some cases (e.g. the skull mug) the object itself may be difficult to describe through natural language. The image-guided DALLE-2 creates more appealing samples, but it still struggles with unique details of novel objects. Our method can successfully capture these finer details. However, note that while our creations are more faithful to the source, they are still variations.
|
| 125 |
+
|
| 126 |
+
Text-guided synthesis Figures 1 and 4 show our ability to compose novel scenes by incorporating the learned pseudo-words into new conditioning texts. The frozen text-to-image model jointly reasons over both the new concepts and its large body of prior knowledge, bringing them together in a new creation. Importantly, despite the fact that our training goal was visual in nature, our pseudowords still encapsulate semantic knowledge. For example, observe the bowl’s ability (row 4) to contain other objects, or the ability to preserve the Furby’s bird-like head and crown while adapting his color to better match a prompt (row 3). Additional results are provided in the appendix.
|
| 127 |
+
|
| 128 |
+

|
| 129 |
+
|
| 130 |
+

|
| 131 |
+
Figure 4: Additional text-guided personalized generation results. In each row, we show exemplars from the image set representing the concept, and novel compositions using the learned pseudo-word.
|
| 132 |
+
Figure 5: Comparisons to alternative personalized creation approaches. Our model can more accurately preserve the subject, and can reason over both the novel embedding and the rest of the caption.
|
| 133 |
+
|
| 134 |
+
We further compare our method to several personalization baselines (Figure 5). We first consider the recent PALAVRA (Cohen et al., 2022) which encodes object sets into the textual embedding space of CLIP, using contrastive learning and cyclic consistency goals. We find a new pseudo-word using their approach and use it to synthesize new images with VQGAN-CLIP (Crowson et al., 2022) and CLIP-Guided Diffusion (Crowson, 2021). As a second baseline, we apply the CLIP-guided models of Crowson et al. and jointly minimize the CLIP-based distances to both the training images and target text (VQGAN-CLIP) or by initializing the optimization with an image from our training set, following the recommendations of Letts et al. (2021) (Guided Diffusion).
|
| 135 |
+
|
| 136 |
+
Images produced by PALAVRA (rows 2, 3) contain elements from the target prompt (beach, moon), but fail to capture the concept and display considerable visual corruption. This is unsurprising, as PALAVRA was trained with a discriminative goal. There, the model only needs to encode enough information to distinguish between two typical concepts. Moreover, this goal does not constrain the model to embedding vectors that can be mapped to outputs on the natural image manifold. When using text-and-image guided synthesis methods (rows 4, 5), results appear more natural and closer to the source image, but fail to generalize to new texts. Moreover, these models use CLIP for test-time optimization and thus require expensive optimization for every new creation.
|
| 137 |
+
|
| 138 |
+
Style transfer A typical use case for text-guided synthesis is in artistic circles, where users draw upon the unique style of a specific artist and apply it to new creations. We show that our model can also find pseudo-words representing a specific, unknown style. To do so, we provide the model with a small set of images with a shared style, and replace the training texts with prompts of the form: “A painting in the style of $S _ { * }$ ”. Results are shown in Figure 6. These demonstrate that our ability to capture concepts extends beyond simple object reconstructions and into more abstract ideas.
|
| 139 |
+
|
| 140 |
+

|
| 141 |
+
Figure 6: The textual-embedding space can represent more abstract concepts, including styles. Image credits: $@$ QinniArt (top), $@$ David Revoy (bottom).
|
| 142 |
+
|
| 143 |
+
Additional applications In Appendix A we investigate a range of additional uses of textual inversion, including: composing multiple learned concepts in a single prompt, reducing gender and racial bias, and using our pseudo-words in downstream models built on LDM.
|
| 144 |
+
|
| 145 |
+
Image curation Results in this section are partially curated. For each prompt, we generated 16 candidates (six for DALLE-2) and manually selected the best result. Similar curation processes with larger batches are often employed in text-conditioned generation work (Avrahami et al., 2022b; Ramesh et al., 2021; Yu et al., 2022). This process can be largely automated by using CLIP to rank images (Ramesh et al., 2021). We provide uncurated galleries of generated results in the appendix.
|
| 146 |
+
|
| 147 |
+
# 5 QUANTITATIVE ANALYSIS
|
| 148 |
+
|
| 149 |
+
Inversion into an uncharted latent space provides us with a range of possible design choices. Here, we examine such choices, and through them we analyze the properties of our embedding space.
|
| 150 |
+
|
| 151 |
+
# 5.1 EVALUATION METRICS
|
| 152 |
+
|
| 153 |
+
To analyze the quality of our embeddings, we consider two fronts: reconstruction and promptadherence. First, we wish to gauge our ability to capture a target concept. We do so by considering semantic CLIP-space distances. Specifically, for each concept, we generate 64 images using the prompt: “A photo of $S _ { * } ^ { \mathrm { ~ \scriptsize ~ , ~ , ~ } }$ . Our reconstruction score is the average pair-wise CLIP-space cosinesimilarity between the generated images and the images of the concept-specific training set.
|
| 154 |
+
|
| 155 |
+
Second, we evaluate our ability to modify the concepts using textual prompts. We produce a set of images using prompts of varying difficulty and settings. These include background modifications (“A photo of $S _ { * }$ on the moon”), style changes (“An oil painting of $S _ { * }$ ”), and compositional relations (“Elmo holding a $S _ { * }$ ”). For each prompt, we synthesize 64 samples using 50 DDIM steps, calculate the average CLIP embedding of the samples, and compute their cosine similarity with the CLIP embedding of the textual prompts, where we omit the placeholder $S _ { * }$ (i.e. “A photo of on the moon”). Higher scores indicate more faithfulness to the prompt itself.
|
| 156 |
+
|
| 157 |
+
# 5.2 EVALUATION SETUPS
|
| 158 |
+
|
| 159 |
+
Our evaluations span the following experimental setups:
|
| 160 |
+
|
| 161 |
+
Extended latent spaces Following Abdal et al. (2019), we consider an extended latent space, where $S _ { * }$ is embedded into multiple learned vectors — equivalent to using multiple pseudo-words. We consider two and three pseudo-words (denoted “2-word” and “3-word”, respectively), aiming to alleviate the potential bottleneck of a single embedding, and enabling more accurate reconstructions.
|
| 162 |
+
|
| 163 |
+
Progressive extensions We follow Tov et al. (2021) and consider a progressive multi-vector setup. We begin training with a single embedding vector, introduce a second vector following 2, 000 training steps, and a third vector after 4, 000 steps. Here, we expect the network to initially focus on the core details, and then leverage the additional pseudo-words to capture increasingly finer details.
|
| 164 |
+
|
| 165 |
+
Regularization Tov et al. (2021) observed that codes in the latent space of a GAN have increased editability when they lie closer to codes observed during training. We investigate a similar scenario by introducing a loss term to minimize the L2 distance between the learned embeddings, and the embedding of a coarse descriptor of the subject (e.g. “sculpture” and “cat” for images in Figure 1).
|
| 166 |
+
|
| 167 |
+
Per-image tokens We further investigate a novel scheme where we introduce unique, per-image tokens into our process. Let $\{ x _ { i } \} _ { i = 1 } ^ { n }$ be the set of input images. We introduce both a universal placeholder, $S _ { * }$ , and an additional placeholder unique to each image, $\{ S _ { i } \} _ { i = 1 } ^ { n }$ , associated with a unique embedding $v _ { i }$ . We train with prompts of the form “A photo of $S _ { * }$ with $S _ { i } { } ^ { \ ' }$ , where each image is matched to prompts containing its own, unique placeholder. We jointly optimize over both $S _ { * }$ and $\{ S _ { i } \} _ { i = 1 } ^ { n }$ . The intuition here is that the model should prefer to encode shared information (i.e. the concept) in the shared code $S _ { * }$ , while relegating per-image details such as the background to $S _ { i }$ .
|
| 168 |
+
|
| 169 |
+
Human captions In addition to the learned-embedding setups, we compare to human-level performance using the captions outlined in Section 4. Here, we simply replace the placeholder strings $S _ { * }$ with the human captions, using both the short and long-caption setups.
|
| 170 |
+
|
| 171 |
+
Reference setups To provide intuition for the scale of the results, we add two reference baselines: (1) We consider the expected behavior from a model that perfectly replicates the concepts, but ignores the prompts. We do so by using the training set itself as the “generated samples” (“Image only”). (2) We consider a model that aligns with the prompt, but ignores the personalized concept. We do so by dropping the concept’s pseudo-word from the evaluation prompts (“Prompt only”).
|
| 172 |
+
|
| 173 |
+
Textual-Inversion Finally, we consider our own setup and further evaluate our model with an increased learning rate (2e-2, “High-LR”) and a decreased learning rate (1e-4, “Low-LR”).
|
| 174 |
+
|
| 175 |
+
Additional setups and experiments In appendix E, we consider two additional inversion setups: a pivotal tuning approach (Roich et al., 2021), where the model itself is optimized to improve reconstruction, and DALLE-2 (Ramesh et al., 2022)’s bipartite inversion process. We further analyze the effect of the image-set size, data diversity, and importance of prompt templates (appendix C). Finally, we evaluate our model’s failure rate and coverage (appendix B), our performance on domainadaptation tasks (appendix D) and compare to recent single-image editing approaches (appendix H).
|
| 176 |
+
|
| 177 |
+
# 5.3 RESULTS
|
| 178 |
+
|
| 179 |
+
Evaluation results are summarized in Figure 7(a). We highlight four observations: (1) The semantic reconstruction quality of our method is comparable to sampling random images from the training set. (2) The single-word method considerably improves prompt-adherence over the multi-word baselines, at a minimal cost to reconstruction. These points outline the impressive flexibility of the textual-embedding space, showing that it can capture new concepts with only a single pseudo-word.
|
| 180 |
+
|
| 181 |
+
(3) Our baselines outline a reconstruction-prompt-adherence trade-off curve. Embeddings that lie closer to the true word distribution (e.g. due to regularization, fewer pseudo-words, or a lower learning rate) can be more easily modified, but fail to capture the details of the target. Notably, our single-embedding model can be moved along this curve by simply changing the learning rate, offering a user a degree of control over this trade-off.
|
| 182 |
+
|
| 183 |
+

|
| 184 |
+
Figure 7: Quantitative evaluation results. (a) CLIP similarity metrics. Textual inversion models (blue) outperform human captioning (red) on both image and text similarity. Our baseline model (light blue) represents an appealing point on the distortion-adherence curve, and can be moved along it by changing the learning rate. (b) User study results portray a similar trade-off curve. Moreover, the CLIP-based results align with human preference. Error bars are $9 5 \%$ confidence intervals.
|
| 185 |
+
|
| 186 |
+
(4) The use of human descriptions for the concepts not only fails to capture their likeness, but also leads to diminished prompt-adherence. We hypothesize that this is tied to the selective-similarity property outlined in Paiss et al. (2022), where vision-and-language models tend to focus on a subset of the semantically meaningful tokens in a prompt. Long captions increase the chance of the model ignoring our desired setting, focusing only on the object description itself. Our model, meanwhile, uses only a single token and thus minimizes this risk.
|
| 187 |
+
|
| 188 |
+
Finally, while our reconstruction scores are on par with those of randomly sampled real images, we reiterate that our metrics compare semantic similarity using CLIP. This metric is less sensitive to shape preservation. On this front, there remains more to be done.
|
| 189 |
+
|
| 190 |
+
# 5.4 HUMAN EVALUATIONS
|
| 191 |
+
|
| 192 |
+
We further evaluate the models with a user study. We created two questionnaires. In the first, users were provided with four images from a concept’s training set, and asked to rank the results produced by five models according to their similarity to these images. In the second, users were provided with a text describing an image context (“A photo on the beach”) and asked to rank images produced by the same models according to their similarity to the text. We used the same target concepts and prompts as the CLIP-based evaluation and collected a total of 600 responses to each questionnaire. Results are shown in Figure 7(b). See the appendix for more details on this experiment.
|
| 193 |
+
|
| 194 |
+
The user-study results align with the CLIP-based metrics and demonstrate a similar reconstructionprompt-adherence tradeoff. Moreover, they outline the same limitations of human-based captioning when attempting to reproduce a concept, as well as when modifying it.
|
| 195 |
+
|
| 196 |
+
# 6 CONCLUSIONS
|
| 197 |
+
|
| 198 |
+
We introduced the task of personalized, language-guided generation, where a pre-trained text-toimage model is leveraged to create images of specific concepts in novel settings. Our approach, “Textual Inversion”, operates by inverting the concepts into new pseudo-words within the textembedding space of the model. These can be used in new prompts, allowing for intuitive modifications of the concept. In a sense, our method leverages multi-modal information: a text-driven interface for ease of editing, coupled with visual cues when nearing the limits of natural language.
|
| 199 |
+
|
| 200 |
+
While our method offers increased freedom, it may still struggle with learning precise shapes, instead incorporating the “semantic” essence of a concept. For artistic creations, this is typically enough. Another limitation is lengthy optimization times. Learning a single concept requires roughly an hour. This could likely be shortened by training an encoder to map a set of images to their textual embedding. We aim to explore this line of work in the future.
|
| 201 |
+
|
| 202 |
+
We hope our approach paves the way for future personalized generation works. These could be core to a multitude of downstream applications, from providing artistic inspiration to product design.
|
| 203 |
+
|
| 204 |
+
# 7 ETHIC STATEMENT
|
| 205 |
+
|
| 206 |
+
The model discussed in this work is part of the larger family of text-to-image models, and such models may be used to generate content that would be misleading or promote disinformation. Personalized creation could allow a user to forge more convincing images of non-public individuals. However, our model does not preserve identity to the extent where this is a concern.
|
| 207 |
+
|
| 208 |
+
Learned text-to-image models have been shown to be susceptible to biases found in the training data. Examples include gender biases when portraying “doctors” and “nurses”, racial biases when requesting images of scientists, and more subtle biases such as an over-representation of heterosexual couples and western traditions when prompting for a “wedding” (Mishkin et al., 2022). Since our own work builds on such models, it may exhibit similar biases. However, as we demonstrate in Appendix A.2, since our model allows creators to describe specific concepts more accurately, it could serve as a means for reducing such biases.
|
| 209 |
+
|
| 210 |
+
Finally, the ability to learn artistic styles may be misused for copyright infringement. Rather than paying an artist for their work, a user could train on their images without consent, and produce images in a similar style. While generated artwork is still easy to identify, in the future such infringement could be difficult to detect or legally pursue. However, we hope that such shortcomings are offset by the new opportunities that these tools could offer an artist, such as the ability to license out their unique style, or the ability to quickly create early prototypes for new work.
|
| 211 |
+
|
| 212 |
+
# 8 REPRODUCIBILITY STATEMENT
|
| 213 |
+
|
| 214 |
+
Our work makes the following effort to ensure reproducibility: (1) We will release our code, training sets, and all human captioning. (2) We provide details on hyperparameter choices for both our training and evaluation setups in appendix F. (3) We provide details on our human evaluation setups in appendix J.1. (4) Where image curation is involved, we provide details on the scale (section 4), show uncurated samples for assessment (appendix I), and offer quantitative evaluations on the effects of curation (appendix B).
|
| 215 |
+
|
| 216 |
+
# REFERENCES
|
| 217 |
+
|
| 218 |
+
Rameen Abdal, Yipeng Qin, and Peter Wonka. Image2stylegan: How to embed images into the stylegan latent space? In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 4432–4441, 2019.
|
| 219 |
+
Rameen Abdal, Yipeng Qin, and Peter Wonka. Image2stylegan $^ { + + }$ : How to edit the embedded images? In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 8296–8305, 2020.
|
| 220 |
+
Rameen Abdal, Peihao Zhu, John Femiani, Niloy J Mitra, and Peter Wonka. Clip2stylegan: Unsupervised extraction of stylegan edit directions. arXiv preprint arXiv:2112.05219, 2021.
|
| 221 |
+
Yuval Alaluf, Omer Tov, Ron Mokady, Rinon Gal, and Amit H. Bermano. Hyperstyle: Stylegan inversion with hypernetworks for real image editing, 2021.
|
| 222 |
+
AUTOMATIC1111. Stable diffusion webui. https://github.com/AUTOMATIC1111/ stable-diffusion-webui, 2022.
|
| 223 |
+
Omri Avrahami, Ohad Fried, and Dani Lischinski. Blended latent diffusion. arXiv preprint arXiv:2206.02779, 2022a.
|
| 224 |
+
Omri Avrahami, Dani Lischinski, and Ohad Fried. Blended diffusion for text-driven editing of natural images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 18208–18218, 2022b.
|
| 225 |
+
David Bau, Hendrik Strobelt, William Peebles, Jonas Wulff, Bolei Zhou, Jun-Yan Zhu, and Antonio Torralba. Semantic photo manipulation with a generative image prior. 38(4), 2019. ISSN 0730- 0301. doi: 10.1145/3306346.3323023. URL https://doi.org/10.1145/3306346. 3323023.
|
| 226 |
+
|
| 227 |
+
Jooyoung Choi, Sungwon Kim, Yonghyun Jeong, Youngjune Gwon, and Sungroh Yoon. Ilvr: Conditioning method for denoising diffusion probabilistic models. arXiv preprint arXiv:2108.02938, 2021.
|
| 228 |
+
|
| 229 |
+
Yunjey Choi, Youngjung Uh, Jaejun Yoo, and Jung-Woo Ha. Stargan v2: Diverse image synthesis for multiple domains. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2020.
|
| 230 |
+
|
| 231 |
+
Niv Cohen, Rinon Gal, Eli A. Meirom, Gal Chechik, and Yuval Atzmon. ”this is my unicorn, fluffy”: Personalizing frozen vision-language representations. In European Conference on Computer Vision (ECCV), 2022.
|
| 232 |
+
|
| 233 |
+
Katherine Crowson. CLIP guided diffusion HQ 256x256. https://colab.research. google.com/drive/12a_Wrfi2_gwwAuN3VvMTwVMz9TfqctNj, 2021.
|
| 234 |
+
|
| 235 |
+
Katherine Crowson, Stella Biderman, Daniel Kornis, Dashiell Stander, Eric Hallahan, Louis Castricato, and Edward Raff. Vqgan-clip: Open domain image generation and editing with natural language guidance. arXiv preprint arXiv:2204.08583, 2022.
|
| 236 |
+
|
| 237 |
+
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.
|
| 238 |
+
|
| 239 |
+
Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in Neural Information Processing Systems, 34:8780–8794, 2021.
|
| 240 |
+
|
| 241 |
+
Yuxuan Ding, Lingqiao Liu, Chunna Tian, Jingyuan Yang, and Haoxuan Ding. Don’t stop learning: Towards continual learning for the clip model. arXiv e-prints, pp. arXiv–2207, 2022.
|
| 242 |
+
|
| 243 |
+
Rinon Gal, Or Patashnik, Haggai Maron, Gal Chechik, and Daniel Cohen-Or. Stylegan-nada: Clipguided domain adaptation of image generators. arXiv preprint arXiv:2108.00946, 2021.
|
| 244 |
+
|
| 245 |
+
Peng Gao, Shijie Geng, Renrui Zhang, Teli Ma, Rongyao Fang, Yongfeng Zhang, Hongsheng Li, and Yu Qiao. Clip-adapter: Better vision-language models with feature adapters. arXiv preprint arXiv:2110.04544, 2021.
|
| 246 |
+
|
| 247 |
+
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.
|
| 248 |
+
|
| 249 |
+
Jinjin Gu, Yujun Shen, and Bolei Zhou. Image processing using multi-code gan prior, 2020.
|
| 250 |
+
|
| 251 |
+
Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. Advances in neural information processing systems, 30, 2017.
|
| 252 |
+
|
| 253 |
+
Jonathan Ho and Tim Salimans. Classifier-free diffusion guidance. In NeurIPS 2021 Workshop on Deep Generative Models and Downstream Applications, 2021.
|
| 254 |
+
|
| 255 |
+
Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 33:6840–6851, 2020.
|
| 256 |
+
|
| 257 |
+
Tero Karras, Miika Aittala, Janne Hellsten, Samuli Laine, Jaakko Lehtinen, and Timo Aila. Training generative adversarial networks with limited data. In Proc. NeurIPS, 2020.
|
| 258 |
+
|
| 259 |
+
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.
|
| 260 |
+
|
| 261 |
+
Gwanghyun Kim, Taesung Kwon, and Jong Chul Ye. Diffusionclip: Text-guided diffusion models for robust image manipulation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2426–2435, 2022.
|
| 262 |
+
|
| 263 |
+
Ananya Kumar, Aditi Raghunathan, Robbie Jones, Tengyu Ma, and Percy Liang. Finetuning can distort pretrained features and underperform out-of-distribution. arXiv preprint arXiv:2202.10054, 2022.
|
| 264 |
+
|
| 265 |
+
Gihyun Kwon and Jong Chul Ye. Clipstyler: Image style transfer with a single text condition. arXiv preprint arXiv:2112.00374, 2021.
|
| 266 |
+
Adam Letts, Chris Scalf, Alex Spirin, Tom Mason, Chris Allen, Max Ingham, Mike Howles, Nate Baer, and David Sin. Disco diffusion. https://github.com/alembics/ disco-diffusion, 2021.
|
| 267 |
+
Dingcheng Li, Zheng Chen, Eunah Cho, Jie Hao, Xiaohu Liu, Xing Fan, Edward Guo, and Yang Liu. Overcoming catastrophic forgetting during domain adaptation of seq2seq language generation. In NAACL 2022, 2022. URL https://www.amazon.science/publications/ overcoming-catastrophic-forgetting-during-domain-adaptation-of-seq2seq-language
|
| 268 |
+
Zhi-Song Liu, Li-Wen Wang, Wan-Chi Siu, and Vicky Kalogeiton. Name your style: An arbitrary artist-aware image style transfer. arXiv preprint arXiv:2202.13562, 2022.
|
| 269 |
+
Pamela Mishkin, Lama Ahmad, Miles Brundage, Gretchen Krueger, and Girish Sastry. Dall·e 2 preview - risks and limitations. 2022.
|
| 270 |
+
Ryan Murdock. The big sleep, 2021. https://twitter.com/advadnoun/status/ 1351038053033406468.
|
| 271 |
+
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.
|
| 272 |
+
Yotam Nitzan, Kfir Aberman, Qiurui He, Orly Liba, Michal Yarom, Yossi Gandelsman, Inbar Mosseri, Yael Pritch, and Daniel Cohen-Or. Mystyle: A personalized generative prior. arXiv preprint arXiv:2203.17272, 2022.
|
| 273 |
+
Utkarsh Ojha, Yijun Li, Jingwan Lu, Alexei A Efros, Yong Jae Lee, Eli Shechtman, and Richard Zhang. Few-shot image generation via cross-domain correspondence. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10743–10752, 2021.
|
| 274 |
+
Roni Paiss, Hila Chefer, and Lior Wolf. No token left behind: Explainability-aided image classification and generation. arXiv preprint arXiv:2204.04908, 2022.
|
| 275 |
+
Gaurav Parmar, Richard Zhang, and Jun-Yan Zhu. On aliased resizing and surprising subtleties in gan evaluation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11410–11420, 2022.
|
| 276 |
+
Or Patashnik, Zongze Wu, Eli Shechtman, Daniel Cohen-Or, and Dani Lischinski. Styleclip: Textdriven manipulation of stylegan imagery. arXiv preprint arXiv:2103.17249, 2021.
|
| 277 |
+
Stanislav Pidhorskyi, Donald A Adjeroh, and Gianfranco Doretto. Adversarial latent autoencoders. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 14104–14113, 2020.
|
| 278 |
+
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.
|
| 279 |
+
Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. In International Conference on Machine Learning, pp. 8821–8831. PMLR, 2021.
|
| 280 |
+
Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical textconditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022.
|
| 281 |
+
N. Rathvon. Early Reading Assessment: A Practitioner’s Handbook. Guilford Publications, 2004. ISBN 9781572309845. URL https://books.google.co.uk/books?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ zX8YzwEACAAJ.
|
| 282 |
+
Elad Richardson, Yuval Alaluf, Or Patashnik, Yotam Nitzan, Yaniv Azar, Stav Shapiro, and Daniel Cohen-Or. Encoding in style: a stylegan encoder for image-to-image translation. arXiv preprint arXiv:2008.00951, 2020.
|
| 283 |
+
|
| 284 |
+
Daniel Roich, Ron Mokady, Amit H Bermano, and Daniel Cohen-Or. Pivotal tuning for latent-based editing of real images. arXiv preprint arXiv:2106.05744, 2021.
|
| 285 |
+
|
| 286 |
+
Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bjorn Ommer. High- ¨ resolution image synthesis with latent diffusion models, 2021.
|
| 287 |
+
|
| 288 |
+
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. 2022.
|
| 289 |
+
|
| 290 |
+
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.
|
| 291 |
+
|
| 292 |
+
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.
|
| 293 |
+
|
| 294 |
+
Shivram Shrirao. Imagic stable diffusion implementation. hhttps://github.com/ ShivamShrirao/diffusers/tree/main/examples/imagic, 2022.
|
| 295 |
+
|
| 296 |
+
Gabriel Skantze and Bram Willemsen. Collie: Continual learning of language grounding from language-image embeddings. Journal of Artificial Intelligence Research, 74:1201–1223, 2022.
|
| 297 |
+
|
| 298 |
+
Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. In International Conference on Learning Representations, 2020.
|
| 299 |
+
|
| 300 |
+
Ming Tao, Hao Tang, Songsong Wu, Nicu Sebe, Xiao-Yuan Jing, Fei Wu, and Bingkun Bao. Dfgan: Deep fusion generative adversarial networks for text-to-image synthesis. arXiv preprint arXiv:2008.05865, 2020.
|
| 301 |
+
|
| 302 |
+
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.
|
| 303 |
+
|
| 304 |
+
Maria Tsimpoukelli, Jacob L Menick, Serkan Cabi, SM Eslami, Oriol Vinyals, and Felix Hill. Multimodal few-shot learning with frozen language models. Advances in Neural Information Processing Systems, 34:200–212, 2021.
|
| 305 |
+
|
| 306 |
+
Aaron Van Den Oord, Oriol Vinyals, et al. Neural discrete representation learning. Advances in neural information processing systems, 30, 2017.
|
| 307 |
+
|
| 308 |
+
Yaxing Wang, Chenshen Wu, Luis Herranz, Joost van de Weijer, Abel Gonzalez-Garcia, and B. Raducanu. Transferring gans: generating images from limited data. In ECCV, 2018.
|
| 309 |
+
|
| 310 |
+
Yaxing Wang, Abel Gonzalez-Garcia, David Berga, Luis Herranz, Fahad Shahbaz Khan, and Joost van de Weijer. Minegan: Effective knowledge transfer from gans to target domains with few images. In The IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020.
|
| 311 |
+
|
| 312 |
+
Weihao Xia, Yulun Zhang, Yujiu Yang, Jing-Hao Xue, Bolei Zhou, and Ming-Hsuan Yang. Gan inversion: A survey, 2021.
|
| 313 |
+
|
| 314 |
+
Tao Xu, Pengchuan Zhang, Qiuyuan Huang, Han Zhang, Zhe Gan, Xiaolei Huang, and Xiaodong He. Attngan: Fine-grained text to image generation with attentional generative adversarial networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1316–1324, 2018.
|
| 315 |
+
|
| 316 |
+
Paul Yacoubian. Avocado bag, 2022. https://twitter.com/PaulYacoubian/status/ 1542867718071779330.
|
| 317 |
+
|
| 318 |
+
Hui Ye, Xiulong Yang, Martin Takac, Rajshekhar Sunderraman, and Shihao Ji. Improving text-toimage synthesis using contrastive learning. arXiv preprint arXiv:2107.02423, 2021.
|
| 319 |
+
|
| 320 |
+
Jiahui Yu, Yuanzhong Xu, Jing Yu Koh, Thang Luong, Gunjan Baid, Zirui Wang, Vijay Vasudevan, Alexander Ku, Yinfei Yang, Burcu Karagol Ayan, et al. Scaling autoregressive models for contentrich text-to-image generation. arXiv preprint arXiv:2206.10789, 2022.
|
| 321 |
+
|
| 322 |
+
Han Zhang, Jing Yu Koh, Jason Baldridge, Honglak Lee, and Yinfei Yang. Cross-modal contrastive learning for text-to-image generation. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 833–842, 2021.
|
| 323 |
+
|
| 324 |
+
Richard Zhang, Phillip Isola, Alexei A Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric. In CVPR, 2018.
|
| 325 |
+
|
| 326 |
+
Kaiyang Zhou, Jingkang Yang, Chen Change Loy, and Ziwei Liu. Learning to prompt for visionlanguage models. arXiv preprint arXiv:2109.01134, 2021.
|
| 327 |
+
|
| 328 |
+
Jiapeng Zhu, Yujun Shen, Deli Zhao, and Bolei Zhou. In-domain gan inversion for real image editing. arXiv preprint arXiv:2004.00049, 2020a.
|
| 329 |
+
|
| 330 |
+
Jun-Yan Zhu, Philipp Krahenb ¨ uhl, Eli Shechtman, and Alexei A Efros. Generative visual manipu- ¨ lation on the natural image manifold. In European conference on computer vision, pp. 597–613. Springer, 2016.
|
| 331 |
+
|
| 332 |
+
Minfeng Zhu, Pingbo Pan, Wei Chen, and Yi Yang. Dm-gan: Dynamic memory generative adversarial networks for text-to-image synthesis. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 5802–5810, 2019.
|
| 333 |
+
|
| 334 |
+
Peihao Zhu, Rameen Abdal, Yipeng Qin, and Peter Wonka. Improved stylegan embedding: Where are the good latents?, 2020b.
|
| 335 |
+
|
| 336 |
+
# Appendices
|
| 337 |
+
|
| 338 |
+
A ADDITIONAL APPLICATIONS
|
| 339 |
+
|
| 340 |
+
In the following section we investigate a set of additional textual-inversion applications. These include the composition of multiple visual concepts, bias reductions, and the application of our method to downstream tasks.
|
| 341 |
+
|
| 342 |
+
# A.1 CONCEPT COMPOSITIONS
|
| 343 |
+
|
| 344 |
+

|
| 345 |
+
Figure 8: Compositional generation using two learned pseudo-words. The model is able to combine the semantics of two concepts when using a prompt that combines them both. It is limited in its ability to reason over more complex relational prompts, such as placing two concepts side-by-side. Image credits: $@$ QinniArt (left), $@$ Leslie Manlapig (right).
|
| 346 |
+
|
| 347 |
+
In Figure 8 we demonstrate compositional synthesis, where the guiding text contains multiple learned concepts. We observe that the model can concurrently reason over multiple novel pseudowords at the same time. However, it struggles with relations between them (e.g. it fails to place two concepts side-by-side). We hypothesize that this limitation arises because our training considers only single concept scenes, where the concept is at the core of the image. Training on multi-object scenes may alleviate this shortcoming. However, we leave such investigation to future work.
|
| 348 |
+
|
| 349 |
+
# A.2 BIAS REDUCTION
|
| 350 |
+
|
| 351 |
+
A common limitation of text-to-image models is that they inherit the biases found in the internetscale data used to train them. These biases then manifest in the generated samples. For example, the DALLE-2 system card (Mishkin et al., 2022) reports that their baseline model tends to produce images of people that are white-passing and male-passing when provided with the prompt “A CEO”. Similarly, results for “wedding”, tend to assume western wedding traditions, and default to heterosexual couples.
|
| 352 |
+
|
| 353 |
+
Here, we demonstrate that we can utilize a small, curated dataset in order to learn a new “fairer” word for a biased concept, which can then be used in place of the original to drive a more inclusive generation.
|
| 354 |
+
|
| 355 |
+
Specifically, in Figure 9 we highlight the bias encoded in the word “Doctor”, and show that this bias can be reduced (i.e. we increase perceived gender and ethnic diversity) by learning a new embedding from a small, more diverse set.
|
| 356 |
+
|
| 357 |
+

|
| 358 |
+
“A photo of $S _ { * }$ ” (Ours)
|
| 359 |
+
|
| 360 |
+
“A stock photo of a doctor” (Base model)
|
| 361 |
+
|
| 362 |
+

|
| 363 |
+
Figure 9: Bias Reduction. Uncurated samples synthesized with pretrained biased embeddings (left) and our debiased embeddings (right). Our approach can be used to reduce bias by learning new pseudo-words for known concepts. These can be optimized using small datasets, which can be carefully curated for diversity.
|
| 364 |
+
Figure 10: Our words can be used with downstream models that build on LDM. Here, we perform localized image editing using Blended Latent Diffusion (Avrahami et al., 2022a)
|
| 365 |
+
|
| 366 |
+
# A.3 DOWNSTREAM APPLICATIONS
|
| 367 |
+
|
| 368 |
+
Finally, we demonstrate that our pseudo-words can be used in downstream models that build on the same initial LDM model. Specifically, we consider the recent Blended Latent Diffusion (Avrahami et al., 2022a) which enables localized text-based editing of images via a mask-based blending process in the latent space of an LDM. In Figure 10 we demonstrate that this localized synthesis process can also be conditioned on our learned pseudo-words, without requiring any additional modifications of the original model.
|
| 369 |
+
|
| 370 |
+
# B CONCEPT COVERAGE
|
| 371 |
+
|
| 372 |
+
While our approach can handle a wide array of concepts, we find that not everything can be encoded into the embedding space with the same fidelity. Here, we investigate how likely a concept is to be covered by our model. To do so, we compare the CLIP-space distribution of images representing a concept, to the distribution of our generated images. Formally, we conduct the following experiment:
|
| 373 |
+
|
| 374 |
+
(1) We gathered a set of 65 different concepts which were uploaded by unaffiliated users to a public API of our model. Let $\{ x _ { i } ^ { j } \} _ { i = 1 } ^ { n _ { j } }$ denote the set of images uploaded for concept $j \in [ 1 , 6 5 ]$ , where $n _ { j }$ is the number of images in the set.
|
| 375 |
+
|
| 376 |
+
(2) We embed all the concept-specific images into CLIP’s embedding space, and compute all pairwise distances between these images: $d _ { r , q , j } ^ { x x } = D \left( C _ { I } ( x _ { r } ^ { j } ) , C _ { I } ( x _ { q } ^ { j } ) \right)$ , where $r \in [ 1 , \bar { n _ { j } } ]$ , $q \in \mathsf { \bar { \Gamma } } [ r \to -$ $1 , n _ { j } ]$ , is the CLIP image encoder and $D$ denotes an $L 2$ distance between normalized vectors.
|
| 377 |
+
|
| 378 |
+
(3) We invert the concept into LDM using our single-word method, and sample 256 images $\{ y _ { i } ^ { j } \} _ { i = 1 } ^ { 2 5 6 }$ using the prompt “A photo of and the images in the original $S _ { * }$ ” nce bet, where , age,. $d _ { r , q , j } ^ { x y } = D \left( C _ { I } ( x _ { r } ^ { j } ) , C _ { I } ( y _ { q } ^ { j } ) \right)$ $r \in [ 1 , n _ { j } ]$ $q \in [ 1 , 2 5 6 ]$
|
| 379 |
+
|
| 380 |
+
(4) We compare the two distance distributions, $\{ d _ { j } ^ { x x } \}$ and $\{ d _ { j } ^ { x y } \}$ , using a standard t-test. We consider the concept to be “covered” if we cannot reject the hypothesis that the two samples belong to the same distribution $( i . e . p > 0 . 0 5 )$ .
|
| 381 |
+
|
| 382 |
+
(5) We repeat this experiment over all concept sets, and report the percent of sets for which the
|
| 383 |
+
|
| 384 |
+
concept was successfully “covered”.
|
| 385 |
+
|
| 386 |
+
Finally, we investigate the effect of ‘cherry picking’ on these results. Specifically, we repeat the above experiment, but reject outliers by keeping subsets of $\{ d _ { j } ^ { x y } \}$ which are closest to the mean. In fig. 11 we report results when using all 256 generated samples per set, and when using only the ‘best’ $\textstyle { \frac { 1 } { 2 } } , { \frac { 1 } { 4 } } , { \frac { 1 } { 6 } }$ , and $\frac { 1 } { 8 }$ of results. We additionally labeled each concept as representing either a style or an object, and we report coverage success rates for each class.
|
| 387 |
+
|
| 388 |
+
Without cherry picking, our model can successfully capture $5 5 . 4 \%$ of tested concepts. However, even mild cherry picking can improve these values significantly ( $8 0 \%$ and ${ \mathrm { \bar { 8 9 . 2 \% } } }$ for factors of $1 : 2$ and
|
| 389 |
+
|
| 390 |
+

|
| 391 |
+
Figure 11: Evaluation of concept coverage as a function of the cherry-picking factor. A factor of 1:k denotes that we keep one of every $\mathbf { k }$ samples.
|
| 392 |
+
|
| 393 |
+
$1 : 4$ respectively). These indicate that for most concepts, one can produce reasonable semantic reconstructions if they are willing to filter the results. Another observation is that the model fares considerably better with styles than with objects $( 7 5 . 8 \%$ vs. $3 4 . 3 \%$ at a factor of $1 : 1$ ). This is likely a result of our model’s difficulty in reproducing exact shapes. When dealing with styles, the concept training set will typically contain large object variation, and thus our metric will be less susceptible to any shape-inaccuracies in the generated imagery. Indeed, for objects, cherry picking appears particularly effective as it rejects the most distorted shapes.
|
| 394 |
+
|
| 395 |
+
# C EFFECT OF TRAINING SET PROPERTIES
|
| 396 |
+
|
| 397 |
+
# C.1 TRAINING SET SIZE
|
| 398 |
+
|
| 399 |
+
We investigated the effect of the concept’s training set size on the results. Specifically, we consider the headless sculpture object of Figure 1 (top row). We inverted the object using our standard model but swept over dataset sizes ranging from a single image to 25 samples. For ease of comparison, we further report the image-only, prompt-only, and human caption-based scores for the same single object. The results are shown in Figure 12.
|
| 400 |
+
|
| 401 |
+
When learning a specific object, using additional images may lead to optimized embeddings which reside farther away from real word embeddings, harming editability. In this scenario, our method operates best when provided with 5 images.
|
| 402 |
+
|
| 403 |
+

|
| 404 |
+
Figure 12: Quantitative evaluation of the effects of the training set size. Significant increases to dataset sizes leads to larger deviation from the real-word distribution. This impacts editability and offers paltry improvement in reconstruction. Our approach shows the best results with $\sim 5$ images.
|
| 405 |
+
|
| 406 |
+
# C.2 TRAINING IMAGE DIVERSITY
|
| 407 |
+
|
| 408 |
+
We investigate the effect of training image diversity using the CLIP-based image and text similarity metrics. We collected datasets of two objects, the cat-toy and the headless sculpture of fig. 1, in two scenarios: (1) Images taken with the same, uniform background, but including a variety of object poses, and (2) images taken with different backgrounds, but sharing the same object pose. In both cases, we compare image similarity to the original, diverse sets used throughout the rest of the paper. The results are shown in table 1.
|
| 409 |
+
|
| 410 |
+
Without background diversity, the model prioritizes the shared background, resulting in a reduced understanding of the concept and poor reconstructions. In contrast, lack of pose diversity results in generated images portraying the same pose, but their quality is better maintained. Ensuring variation on both ends allows the model to focus on the subject and re-create it in a greater variety of poses.
|
| 411 |
+
|
| 412 |
+
Table 1: Effects of data set diversity and prompt templates. Without background diversity, the model favors capturing background information in the tokens, leading to diminished object similarity. Lack of pose diversity leads to models which favor the same pose, but do not otherwise harm quality. Removing the prompt templates leads to weaker embeddings which are easily overwritten by other words in a prompt.
|
| 413 |
+
|
| 414 |
+
<table><tr><td>Dataset</td><td>Model</td><td>Image similarity ↑</td><td>Text Similarity ↑</td></tr><tr><td rowspan="4">Cat</td><td>Baseline</td><td>0.768</td><td>0.292</td></tr><tr><td>Fixed background</td><td>0.724</td><td>0.281</td></tr><tr><td>Fixed pose</td><td>0.752</td><td>0.278</td></tr><tr><td>No prompt templates</td><td>0.722</td><td>0.282</td></tr><tr><td rowspan="4"> Sculpture</td><td>Baseline</td><td>0.806</td><td>0.278</td></tr><tr><td>Fixed background</td><td>0.786</td><td>0.263</td></tr><tr><td>Fixed pose</td><td>0.799</td><td>0.262</td></tr><tr><td>No prompt templates</td><td>0.604</td><td>0.287</td></tr></table>
|
| 415 |
+
|
| 416 |
+

|
| 417 |
+
Figure 13: Frechet inception distance (FID, ´ ↓) for two domain-adaptation sets, as a function of training iterations and the number of training images. Long training periods may not help, or even harm the results. Using additional images can improve coverage for diverse sets.
|
| 418 |
+
|
| 419 |
+
# C.3 TRAINING PROMPTS
|
| 420 |
+
|
| 421 |
+
We investigate the effect of replacing our prompt templates with a simple ” $S _ { * }$ ”. The results are shown in table 1. Removing all templates guides the optimization towards weaker embeddings which are often ignored by the model when merged with other words.
|
| 422 |
+
|
| 423 |
+
# D DOMAIN ADAPTATION COMPARISONS
|
| 424 |
+
|
| 425 |
+
We further quantify our model’s performance by comparing it to generator domain-adaptation approaches. We conduct inversion on the sketch dataset of Ojha et al. (2021) and using the few-shot AFHQ (Choi et al., 2020) split of Gal et al. (2021). For the sketch dataset, we create additional splits of 1, 5, 50, and 100 images.
|
| 426 |
+
|
| 427 |
+
For each set and split, we invert the training set into a single token using our standard parameters and a single V100 GPU. Following Ojha et al. (2021), we generate 5, 000 images using each inverted model, and evaluate the Frechet Inception Distance (FID) (Heusel et al., 2017) between them and ´ the full sketch and AFHQ sets, consisting of 300 and 5, 153 images respectively. FID is calculated using the clean-fid library (Parmar et al., 2022). Figure 13 reports our method’s FID as a function of training steps and the number of images. Table 2 further compares our results at 10 images and 5, 000 training steps to few-shot GAN domain adaptation approaches which were trained on the same sets. These results demonstrate that our method is competitive with GAN-based fewshot adaptation methods, despite not training any part of the network. The FID values demonstrate considerable jitter. However, for small sets, in particular, we observe that longer training typically fails to improve, and may even harm FID.
|
| 428 |
+
|
| 429 |
+
Ojha et al. (2021) additionally evaluate the diversity of their model by employing a clustering-based metric. There, generated images are assigned to a cluster containing their nearest training image, using LPIPS (Zhang et al., 2018) as a distance metric. The diversity metric is then the average pairwise distance between images in each cluster, averaged again over all the clusters. Methods which simply memorize the training set will be assigned a score of zero.
|
| 430 |
+
|
| 431 |
+
Table 2 reports diversity results using our method and select GAN few-shot domain approaches, trained on a 10 image set. Our method considerably outperforms the GAN based adaptation approaches. This is likely on account of LDM’s larger initial knowledgebase, our limited intervention in the model, and the greater recall typically observed in diffusion models when compared to GANs.
|
| 432 |
+
|
| 433 |
+
Finally, we use these models to evaluate reconstruction quality and prompt-adherence using the CLIP based similarity scores. Figure 14 shows the results for both metrics, across different numbers of training images and training steps. Here, we average over both sets (cats, sketches) to reduce noise, and further plot the trend-lines along with the fit’s confidence intervals.
|
| 434 |
+
|
| 435 |
+
When dealing with broad concepts (cats, rather than a specific cat) we observe that additional data can help improve the results. Additional data can further benefit from additional training steps.
|
| 436 |
+
|
| 437 |
+
Table 2: FID and diversity comparisons to select few-shot GAN domain adaptation approaches. Despite not modifying any model parameters, our approach can yield FID scores comparable to few-shot GANs, and a significant increase in diversity. We report our results at 5, 000 iterations. Our FID may be lower at other earlier points in training (e.g. 61.11 for the cat set at $2 , 0 0 0$ steps).
|
| 438 |
+
|
| 439 |
+
<table><tr><td rowspan="2">Model</td><td colspan="2">FID↓</td><td colspan="2">Diversity ↑</td></tr><tr><td>AFHQ Cat</td><td>Face Sketch</td><td>AFHQ Cat</td><td>Face Sketch</td></tr><tr><td>CDC (Ojha et al., 2021)</td><td>45.13</td><td>72.74</td><td>0.52</td><td>0.45</td></tr><tr><td>MineGAN (Wang et al., 2020)</td><td>79.31</td><td>62.27</td><td>0.21</td><td>0.40</td></tr><tr><td>TGAN (Wang et al., 2018)</td><td>87.11</td><td>69.44</td><td>0.28</td><td>0.39</td></tr><tr><td>TGAN + ADA (Karras et al., 2020)</td><td>52.70</td><td>56.76</td><td>0.34</td><td>0.41</td></tr><tr><td>Textual Inversion</td><td>79.72</td><td>75.61</td><td>0.62</td><td>0.53</td></tr></table>
|
| 440 |
+
|
| 441 |
+

|
| 442 |
+
Figure 14: CLIP image (left) and text (right) similarity averaged across the domain-adaptation sets. Additional training iterations may harm training with few images, but benefit larger sets.
|
| 443 |
+
|
| 444 |
+
# E ADDITIONAL INVERSION APPROACHES
|
| 445 |
+
|
| 446 |
+
In addition to the setups outlined in the core paper, we investigated two recent approaches to inversion: Bipartite DDIM-inversion (Ramesh et al., 2022; Dhariwal & Nichol, 2021) and pivotal tuning (Roich et al., 2021). Below we outline both methods and our experimental results.
|
| 447 |
+
|
| 448 |
+
Bipartite inversion Dhariwal & Nichol (2021) demonstrated that the DDIM sampling (Song et al., 2020) process can be inverted through a closed-form iterative approach. Specifically, their approach can find a latent noise vector $x _ { T }$ which will be denoised into a specific target image when the denoising process is conditioned on a given code $c _ { \theta } ( y )$ . In (Ramesh et al., 2022), they further demonstrate that when the conditioning code is an output of CLIP, one can later modify this code using textderived directions in CLIP’s multi-modal embedding space, while keeping the initial noise, $x _ { T }$ , fixed. This induces semantic changes in the image while maintaining the general structure of the original object.
|
| 449 |
+
|
| 450 |
+
Here, we investigate a similar approach. However, rather than modifying the conditioning code $c _ { \theta } ( y )$ directly, we change the conditioning text $y$ . Specifically, we first find an appropriate pseudoword for our target concept. Then, we find $x _ { T }$ for a given image of the concept using the text “A photo of $S _ { * } ^ { \mathrm { ~ \scriptsize ~ , ~ , ~ } }$ and the closed-form solution of Dhariwal & Nichol (2021). Finally, we modify the conditioning text but keep $x _ { T }$ frozen. The results are shown in Figure 15 (left). Here, we observe that when using LDM’s typical guidance (Ho & Salimans, 2021) scales (5-10), the denoiser network is unable to maintain the original object’s structure through prompt changes. When reducing the guidance scale, the outline of the original image becomes visible. However, alignment with the prompt is poor.
|
| 451 |
+
|
| 452 |
+
Such guidance-dependent structure drift has also been demonstrated for GLIDE (Nichol et al., 2021). However, this effect is reduced in DALL-E2 (Ramesh et al., 2022) (their Figure 9). Notably, stateof-the-art models (Saharia et al., 2022; Ramesh et al., 2022) typically employ guidance scales $( \sim 2 )$ which are significantly lower than LDM’s — within the range where we observe structure preservation, but no prompt-matching. This gives us hope that a bipartite inversion would allow better shape preservation in more powerful generative models.
|
| 453 |
+
|
| 454 |
+

|
| 455 |
+
Figure 15: Advanced inversion results using Bipartite Inversion (Ramesh et al., 2022) (left) and Pivotal Tuning (Roich et al., 2021) (right). $s$ is the guidance scale. Reconstructions were obtained using the prompt “A photo of $S _ { * } ^ { \mathrm { ~ \scriptsize ~ , ~ } }$ ”. Bipartite inversion allows for more accurate reconstructions without modifying the model, but their structure is lost for complex prompts in high guidance scales. Pivotal tuning improves shapes at the cost of visual artifacts, and fail to adhere to simple prompts at high guidance scales. Note that the pivotal tuning results use a random noise input, while the bipartite results use a fixed noise for each column.
|
| 456 |
+
|
| 457 |
+
Pivotal Tuning In the field of GAN inversion, it has been shown (Roich et al., 2021; Bau et al., 2019) that one may largely avoid the reconstruction-editability tradeoff using a two-stage optimization process. First, an image is inverted into “pivot” code in a well-behaved region of the latent space, using standard optimization. This typically results in a highly editable code, but with poor identity preservation. As a second step, the generator is fine-tuned so that the first step’s pivot code will more accurately reproduce the inverted image. It was further demonstrated that such localized tuning can maintain the appealing properties of the latent space and retain similar latent-editing capabilities.
|
| 458 |
+
|
| 459 |
+
Here, we investigate a similar approach in order to improve reconstruction. We first optimize a pseudo-word using our baseline method. Then, we fine-tune the generator such that sentences of the form “A photo of $S _ { * }$ ” will better reconstruct the concept-specific training set images.
|
| 460 |
+
|
| 461 |
+
Our initial investigation reveals that na¨ıve applications of this approach lead to improved shape preservation, but also to a severe collapse of editing at high guidance scales. See Figure 15 (right) for examples. However, as outlined in appendix G, this failure is model-dependent, and other architectures may even benefit from its use.
|
| 462 |
+
|
| 463 |
+
A more involved application of this same principle (e.g. by combining it with a similar process to the bipartite-inversion outlined below, or by tuning around results produced with higher guidance scales) might overcome the issues observed in LDM. We leave such investigation to future work.
|
| 464 |
+
|
| 465 |
+
# F IMPLEMENTATION DETAILS
|
| 466 |
+
|
| 467 |
+
Unless otherwise noted, we retain the original hyper-parameter choices of LDM (Rombach et al., 2021). Word embeddings were initialized with the embeddings of a single-word coarse descriptor of the object (e.g. “sculpture” and “cat” for the two concepts in Figure 1). Our experiments were conducted using $2 \times \mathsf { V } 1 0 0$ GPUs with a batch size of 4. The base learning rate was set to 0.005. Following LDM, we further scale the base learning rate by the number of GPUs and the batch size, for an effective rate of 0.04. All results were produced using 5, 000 optimization steps. We find that these parameters work well for most cases. However, for some concepts, better results can be achieved with fewer steps or with an increased learning rate.
|
| 468 |
+
|
| 469 |
+
For all CLIP-based evaluations, we use the official CLIP ViT-B/32 checkpoint.
|
| 470 |
+
|
| 471 |
+
# G STABLE DIFFUSION
|
| 472 |
+
|
| 473 |
+
In addition to the LDM results, we demonstrate that our method can be adapted to work with Stable Diffusion, a recently released large-scale latent diffusion model (Rombach et al., 2021). However, in contrast to the baseline LDM model which trains a BERT Devlin et al. (2018) text encoder alongside with the generative network, Stable Diffusion makes use of a pre-trained, frozen CLIP text encoder.
|
| 474 |
+
|
| 475 |
+
We implement our method over Stable Diffusion using the same training setup, losses, and parameters that were used for LDM. We notice that inverted Stable Diffusion embeddings tend to dominate the prompt and become more difficult to integrate into new, simple prompts. These limitations can be mitigated in one of two approaches: First, by reducing the weight of the learned embedding. This can be done through the use of longer, more complex prompts, or by using prompt re-weighting methods (AUTOMATIC1111, 2022). Second, through the use of the Pivotal Tuning mechanism outlined in appendix E. We hypothesize that Stable Diffusion’s decreased malleability is an artifact of either its text encoder’s training or its size. While LDM’s text encoder was trained with the dense visual reconstruction task, here the encoder is a pre-trained CLIP, which had a simpler contrastive learning task for which focusing on a subset of image content was typically enough. Similarly, a concurrent work (Ruiz et al., 2022) reports difficulty in capturing the appearance of a subject without model-tuning when using Imagen (Saharia et al., 2022), a model whose text-encoder was pre-trained on a purely linguistic task and kept frozen. On the size front, the CLIP text encoder employed by Stable Diffusion contains $1 2 8 M$ parameters, roughly a fifth of LDM’s BERT. Moreover, it has an embedding dimension of 768 compared to LDM’s 1280. These could combine to create a less expressive latent space, which forces new concepts further out of the domain of real words and negatively impacts prompt adherence. We plan to further investigate this matter in the future.
|
| 476 |
+
|
| 477 |
+
In fig. 16 we provide samples generated using Stable Diffusion and the outlined methods. Note that while the pivotal tuning approach can typically provide more appealing visual outputs, it requires significantly greater computational resources, consuming roughly 30GB of VRAM with a batch size of one. The baseline inversion method, meanwhile, consumes as little as 12GB using a similar batch size. Moreover, the model-tuning approach leads to checkpoints that are several GB in size, compared to less than 4KB for a learned embedding. Learned embeddings are thus easier to share and use for large-scale collaborative work.
|
| 478 |
+
|
| 479 |
+
# H IMAGE EDITING COMPARISON
|
| 480 |
+
|
| 481 |
+
To better highlight the distinction between our approach and single-image editing methods, we compare our approach to the concurrent Imagic (Kawar et al., 2022). We use the unofficial Stable Diffusion implementation of their method (Shrirao, 2022), where we swept over model parameters and prompt strengths in an attempt to match our results. A comparison to our cat model is provided in fig. 17.
|
| 482 |
+
|
| 483 |
+

|
| 484 |
+
Figure 16: Injecting user-specific concepts into Stable Diffusion. In contrast to LDM, using our baseline approach with Stable Diffusion leads to less editable results. These can be overcome through prompt engineering and weighting, or by using Pivotal Tuning (Roich et al., 2021).
|
| 485 |
+
|
| 486 |
+
As can be seen, the single-image editing method successfully captures details such as the background and the object’s location and pose. However, it struggles with creating large changes or putting the object in new contexts while preserving key object details. Our method meanwhile is not restricted to a single scene, and instead aims to capture the semantics of a concept and apply them to new scenes.
|
| 487 |
+
|
| 488 |
+
# I ADDITIONAL RESULTS
|
| 489 |
+
|
| 490 |
+
We provide additional results of personalized generation using our method. In Figure 18 we show additional text-guided synthesis results.
|
| 491 |
+
|
| 492 |
+
In Figure 19 we show large-scale galleries of uncurated results generated with the prompt “A photo of $S _ { * }$ ”. In Figures 20 and 21 we provide large-scale galleries of uncurated results generated with a wide assortment of prompts. These are intended to provide a sense of the quality of images produced and cherry-picking involved when generating the samples in the core paper. Note that these results also contain demonstrations of typical failure cases, such as difficult relational prompts (Figure 20, rows 2, 5).
|
| 493 |
+
|
| 494 |
+

|
| 495 |
+
Figure 17: Text-guided synthesis comparison to Imagic (Kawar et al., 2022). Our method captures the semantics of a concept and uses them to create new scenes. Imagic successfully maintains specific image details, such as the object’s location or the background, but it fails to create complex transformations while maintaining fidelity to the source concept.
|
| 496 |
+
|
| 497 |
+

|
| 498 |
+
Figure 18: Injecting user-specific concepts into new scenes. Our method can change a concept’s style, composition, or use it to inspire new creations. Top row image credits: $@$ Øyvind Holmstad.
|
| 499 |
+
|
| 500 |
+

|
| 501 |
+
Figure 19: Uncurated samples of object variations created using the prompt ”A photo of $S _ { * }$ ”.
|
| 502 |
+
|
| 503 |
+

|
| 504 |
+
Figure 20: Uncurated samples generated with context prompts. Quality and prompt-matching varies within the sample. However, we observe that a batch size of 16 is typically sufficient to ensure several good samples.
|
| 505 |
+
|
| 506 |
+

|
| 507 |
+
Figure 21: Additional uncurated samples generated with context prompts. Quality and promptmatching varies within the sample. However, we observe that a batch size of 16 is typically sufficient to ensure several good samples. Image credits: $@$ QinniArt (bottom), authorized for non-commercial use only.
|
| 508 |
+
|
| 509 |
+
# J TRAINING PROMPT TEMPLATES
|
| 510 |
+
|
| 511 |
+
Below we provide the list of text templates used when optimizing a pseudo-word:
|
| 512 |
+
|
| 513 |
+
• “a photo of a $S _ { * }$ .”, • “a rendering of a $S _ { * }$ .”, • “a cropped photo of the $S _ { * }$ .”, • “the photo of a $S _ { * }$ .”, • “a photo of a clean $S _ { * }$ .”, • “a photo of a dirty $S _ { * }$ .”, • “a dark photo of the $S _ { * }$ .”, • “a photo of my $S _ { * }$ .”, • “a photo of the cool $S _ { * }$ .”, • “a close-up photo of a $S _ { * }$ .”, • “a bright photo of the $S _ { * }$ .”, • “a cropped photo of a $S _ { * }$ .”, • “a photo of the $S _ { * }$ .”, • “a good photo of the $S _ { * }$ .”, • “a photo of one $S _ { * }$ .”, • “a close-up photo of the $S _ { * }$ .”, • “a rendition of the $S _ { * }$ .”, • “a photo of the clean $S _ { * }$ .”, • “a rendition of a $S _ { * }$ .”, • “a photo of a nice $S _ { * }$ .”, • “a good photo of a $S _ { * }$ .”, • “a photo of the nice $S _ { * }$ .”, • “a photo of the small $S _ { * }$ .”, • “a photo of the weird $S _ { * }$ .”, • “a photo of the large $S _ { * }$ .”, • “a photo of a cool $S _ { * }$ .”, • “a photo of a small $S _ { * }$ .”,
|
| 514 |
+
|
| 515 |
+
# J.1 DETAILS OF CAPTIONS CROWDSOURCING AND USER STUDY
|
| 516 |
+
|
| 517 |
+
We collected captions describing the training concepts using Amazon Mechanical Turk (AMT).
|
| 518 |
+
|
| 519 |
+
We provided annotators with four images of a concept and asked them to describe it in a manner that could allow an artist to recreate it. We collected five short $\leq 1 2$ words) and five long $\leq 3 0$ words) captions per concept. In total, we collected 10 captions per concept — five short and five long.
|
| 520 |
+
|
| 521 |
+
Figure 22 illustrates the data collection interface for each type of questionnaire.
|
| 522 |
+
|
| 523 |
+
When evaluate the models through a user study, we created two questionnaires. In the first, users were provided with four images from a concept’s training set, and asked to rank the results produced by five models according to their similarity to these images. In the second questionnaire, users were provided with a text describing an image context (“An oil painting”) and asked to rank the results produced by the same models according to their similarity to the text. We used the same target concepts and prompts as the CLIP-based evaluations and collected a total of 600 responses to each questionnaire. A single Turker was not permitted to rank more than 7 prompts per questionnaire.
|
| 524 |
+
|
| 525 |
+
Figure 23 illustrates the data collection interface for the user study.
|
| 526 |
+
|
| 527 |
+
#
|
| 528 |
+
|
| 529 |
+

|
| 530 |
+
Figure 22: Screenshots of the caption crowdsourcing interface with full instructions given to users. (a, top) Interface for short captions (b, bottom) Interface for long captions
|
| 531 |
+
|
| 532 |
+
For both the the data captioning and the user study, we paid $\$ 0.2$ per response. This sum ensures that, regardless of their world-wide location, workers are paid more than the US federal minimum wage (the median response time was 70 seconds, indicating a wage of roughly $\$ 10.3$ per hour of work).
|
| 533 |
+
|
| 534 |
+
To maintain the quality of the queries, we only picked users with AMT “masters” qualification, demonstrating a high degree of approval rate over a wide range of tasks.
|
| 535 |
+
|
| 536 |
+
Furthermore, we also executed a qualification test with a few examples and verified that the annotators follow the instructions. We rejected queries from two qualified user that abused the system by submitting the same score ordering in every questionnaire (e.g. $5 , 4 , 3 , 2 , 1$ ).
|
| 537 |
+
|
| 538 |
+
All tasks were flagged as containing adult content. This was required due to the risk that some generated images may unintentionally contain offensive contents, as the underlying LDM model was trained on uncurated web data. We also included the following warning in the title “WARNING: This HIT may contain adult content. Worker discretion is advised”
|
| 539 |
+
|
| 540 |
+
#
|
| 541 |
+
|
| 542 |
+
# Instructions
|
| 543 |
+
|
| 544 |
+
# ·Read the instructions carefully
|
| 545 |
+
|
| 546 |
+
·YouaregivenaetofexamplesofanbjectInaditionyouseeafwpicturesthattrytoportraythisobectinvarioussearios.
|
| 547 |
+
·Yourmissionistoranktheimagesaccordingtohowwelltheobjectineachimageagreeswiththeobjectintheexamples.
|
| 548 |
+
·IMPORTANT:You shouldassignadifferent rank (1..5) for each image. Do not select the same score for two images.Your HIT may be rejected for such a selection. Donot select ascore of 0.Your HIT may be rejected for such aselection.
|
| 549 |
+
·Donot abuse the system,we takemeasures to spot that.
|
| 550 |
+
|
| 551 |
+

|
| 552 |
+
|
| 553 |
+
# Examples:
|
| 554 |
+
|
| 555 |
+
Rank how well do the objects in each following image resemble the object in the examples above?
|
| 556 |
+
|
| 557 |
+

|
| 558 |
+
|
| 559 |
+
# Submit
|
| 560 |
+
|
| 561 |
+
#
|
| 562 |
+
|
| 563 |
+
# Instructions
|
| 564 |
+
|
| 565 |
+
·Read the instructions carefullly ·Youare givenasentence that describesapicture,and afew images that try to portray this description.
|
| 566 |
+
·Yourmission istorank the imagesaccordingto howwelleach imageagreeswiththedescription.
|
| 567 |
+
·IMPORTANT:Youshouldassignadifferent rank(1..5) foreach image.
|
| 568 |
+
Donot select the same score for two images.Your HIT may be rejected for such aselection.
|
| 569 |
+
·Donot selectascore of0.Your HITmaybe rejected for suchaselection.
|
| 570 |
+
|
| 571 |
+
Rank how well does each image match the following description.
|
| 572 |
+
|
| 573 |
+
# Description: An oil painting
|
| 574 |
+
|
| 575 |
+
# Submit
|
| 576 |
+
|
| 577 |
+

|
| 578 |
+
Figure 23: Screenshots of the user study questionnaires with full instructions given to users. (a, top) Visual similarity to the examples of the personalized object (b, bottom) Context similarity to the context description
|
md/dev/NHeAUKlTO8/NHeAUKlTO8.md
ADDED
|
@@ -0,0 +1,404 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# PartialFormer: Modeling Part Instead of Whole for Machine Translation
|
| 2 |
+
|
| 3 |
+
Anonymous EMNLP submission
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
The parameter redundancy problem in Transformer models has been widely acknowledged in the literature. To address this weakness, we introduce PartialFormer, a parameter-efficient Transformer architecture for machine translation. Compared to previous parameter-efficient Transformer architecture, PartialFormer modifies the modeling strategy of the feed-forward network to allow it to spare tremendous parameters while maintaining large hidden dimension. Additionally, PartialFormer applies two efficient scaling strategies, namely depth scaling and width scaling, to improve performance within a given parameter budget. To efficiently benefit from these scaling strategies, PartialFormer is further enhanced by two costeffective modifications: 1) a head scaling strategy for efficient width scaling and 2) a residuallike attention calculation for better depth scaling. Extensive experiments on 9 translation tasks validate the effectiveness of our PartialFormer approach.
|
| 8 |
+
|
| 9 |
+

|
| 10 |
+
Figure 1: Illustration of our idea.
|
| 11 |
+
|
| 12 |
+
# 1 Introduction
|
| 13 |
+
|
| 14 |
+
The Transformer model (Vaswani et al., 2017) has emerged as a cornerstone in the natural language processing (NLP) domain, overshadowing convolutional neural networks (Gehring et al., 2017) and recurrent neural networks (Sutskever et al., 2014) by virtue of its minimal inductive bias, superior scalability, and proficiency in modeling extended sequences. Nonetheless, its substantial computational and parametric requisites pose significant challenges to its deployment and training, warranting an ongoing trend in the research community toward eliminating redundant parameters and computations in the Transformer model (Dehghani et al., 2019; Lan et al., 2020; Reid et al., 2021; Li et al., 2022; Ahmed et al., 2017; Yan et al., 2020; Wu et al., 2020; Mehta et al., 2019, 2021).
|
| 15 |
+
|
| 16 |
+
it is noteworthy that these approaches ignore the importance of feed-forward networks (FFN). Feedforward networks consume significant parametric and computational overhead due to the inherent large feature space and hidden dimension. To cut down FFNs’ overhead, previous studies (Mehta et al., 2021; Wu et al., 2020; Ge et al., 2022) just adopt smaller hidden dimension, e.g., equal to or even lower than the size of feature space. That leads to a question: Are current lightweight FFNs optimal?
|
| 17 |
+
|
| 18 |
+
Despite their success in improving the parametric and computational efficiency of the Transformer,
|
| 19 |
+
|
| 20 |
+
To address this concern, we turn to the insights provided by Geva et al. (2021), who depicted FFNs as a collection of key-value memories, where the number of memories is equal to the number of hidden dimensions in FFNs. This finding underscores the significance of hidden dimension in FFNs. Drawing inspiration from this finding and the successful application of large hidden sizes in FFNs as evidenced by Meta’s 4B model (Tran et al., 2021)1, we postulate that a truly efficient lightweight FFN should maintain, if not enlarge, the hidden dimension while reducing parameters.
|
| 21 |
+
|
| 22 |
+
To this end, we propose PartialFormer, an innovative approach to Transformer architecture. The central design of PartialFormer is the Partial-Level Gated Feed-Forward Networks (PG-FFN). We designed the PG-FFN as a set of smaller FFNs in unison, each producing lower-dimensional hidden features, yet collectively matching or exceeding the hidden dimension of a conventional larger FFN. Moreover, we further equipped PartialFormer with two cost-effective operations: a head scaling strategy for efficient width scaling, and a residual-like attention calculation for stable optimization. These techniques empower PartialFormer to achieve deeper layer stacking or increased width within the same parameter budget.
|
| 23 |
+
|
| 24 |
+
The strength of PartialFormer has been affirmed through rigorous empirical evaluations on $9 \ \mathrm { m a }$ chine translation tasks. Remarkably, even while maintaining similar parameter consumption, our PartialFormer consistently surpasses the vanilla Transformer, employing the same layer depth and embedding width, by an average of 1.29 BLEU points across all 6 WMT’17 machine translations. Furthermore, it achieved a BLEU score of 29.56 on the challenging WMT’14 En-De task with only 68 million parameters, showcasing its effectiveness and efficiency. Our work with PartialFormer thus marks an important step towards the goal of optimized Transformer architectures, marrying performance with efficiency in a manner that has potential for broad impact in NLP applications.
|
| 25 |
+
|
| 26 |
+
# 2 Preliminary: Transformer
|
| 27 |
+
|
| 28 |
+
In this section, we present some prior knowledge about the Transformer. Typically, Transformer block always consists of a multi-head self-attention and a feed-forward network. Let $X \in \mathbb { R } ^ { T \times d }$ be a $T \times d$ input matrix of $T$ tokens. Each multi-head self-attention component owns $H$ heads. For simplicity, we ignore the layer-normalization operation and residual connection.
|
| 29 |
+
|
| 30 |
+
Multi-Head Self-Attention MHSA aims to model the global dependency among tokens. MHSA computes as follows:
|
| 31 |
+
|
| 32 |
+
$$
|
| 33 |
+
\begin{array} { r c l } { { { \cal A } ^ { i } } } & { { = } } & { { \mathrm { S o f t m a x } ( \displaystyle \frac { Q ^ { i } ( K ^ { i } ) ^ { \top } } { \sqrt { d _ { k } } } ) , } } \\ { { \mathrm { h e a d } _ { i } } } & { { = } } & { { { \cal A } ^ { i } V ^ { i } , } } \\ { { X } } & { { = } } & { { \displaystyle \sum _ { i = 1 } ^ { H } \mathrm { h e a d } _ { i } W _ { i } ^ { O } , } } \end{array}
|
| 34 |
+
$$
|
| 35 |
+
|
| 36 |
+
where $Q ^ { i } , K ^ { i } , V ^ { i }$ denote the query, key and value of $i$ -th head, which are derived from input with three learnable matrics $W _ { i } ^ { Q } , W _ { i } ^ { K } , W _ { i } ^ { V } \ \in \ \mathbb { R } ^ { d \times d _ { k } }$ as follows: $Q ^ { i } \ : = \ : X W _ { i } ^ { Q } , K ^ { i } \ : = \ : X W _ { i } ^ { K } , V ^ { i } \ : =$
|
| 37 |
+
|
| 38 |
+
$X W _ { i } ^ { V }$ , respectively. $W _ { i } ^ { O } \in \mathbb { R } ^ { d _ { k } \times d }$ is a learnable matrix. $A ^ { i }$ and headi denote the attention matrix and representation of $i$ -th head, respectively.
|
| 39 |
+
|
| 40 |
+
Feed-Forward Network Feed-forward network is responsible for improving the expressiveness of the whole representation space by adopting an "expansion-activation-reduction" mapping strategy. It computes as follows:
|
| 41 |
+
|
| 42 |
+
$$
|
| 43 |
+
X = \mathrm { R e L U } ( X W _ { 1 } + b _ { 1 } ) W _ { 2 } + b _ { 2 } ,
|
| 44 |
+
$$
|
| 45 |
+
|
| 46 |
+
where $W _ { 1 } ~ \in ~ \mathbb { R } ^ { d \times d _ { \mathrm { f n } } } , W _ { 2 } ~ \in ~ \mathbb { R } ^ { d _ { \mathrm { f n } } \times d } , b _ { 1 } ~ \in$ $\mathbb { R } ^ { d _ { \mathrm { f f n } } } , b _ { 2 } \in \mathbb { R } ^ { d }$ as learnable matrices and $d _ { \mathrm { { f f n } } }$ denotes the hidden dimension in FFN that is usually set to $4 d$ .
|
| 47 |
+
|
| 48 |
+
# 3 PartialFormer
|
| 49 |
+
|
| 50 |
+
# 3.1 Overall Architecture
|
| 51 |
+
|
| 52 |
+
Figure 2 illustrates the overall architecture of PartialFormer, encompassing both an encoder and a decoder. Although the foundational structure adheres to the design of the vanilla Transformer (Vaswani et al., 2017), there are some notable modifications.
|
| 53 |
+
|
| 54 |
+
Encoder. Different from vanilla Transformer, each encoder layer in PartialFormer consists of a unified sub-layer that integrates the PG-FFNs into the multi-head self-attention mechanism rather than separate two sub-layers.
|
| 55 |
+
|
| 56 |
+
Decoder. Each decoder layer is composed of two types of sub-layers, both of which integrate the multi-head attention mechanism with PG-FFNs. The sub-layers differ based on the type of multihead attention mechanisms employed, specifically whether it’s a decoder self-attention or an encoderdecoder cross-attention mechanism.
|
| 57 |
+
|
| 58 |
+
# 3.2 Information Flow in Unified Sub-Layer
|
| 59 |
+
|
| 60 |
+
Taking the Encoder as an instance. Each unified sub-layer first computes the multiple attention scores via Eq. (5), then obtains the multiple head features $\{ \mathrm { h e a d } ^ { i } | 1 \leq i \leq H \}$ via Eq. (2), which is the same as vanilla Transformer. Then, using multiple small FFNs, it processes these head features and ultimately combines the representations via a fusion function according to Eq. (7). That is to say, the PG-FFN is encapsulated into the multiheadattention mechanism.
|
| 61 |
+
|
| 62 |
+

|
| 63 |
+
Figure 2: (a) Architecture of Transformer. (b) Architecture of PartialFormer. (c) Details of Self-AFFN Block. All architecture are based on pre-normalization strategy. We omit the layer normalization operation, residual connection, softmax operation and scale coefficient for simplicity.
|
| 64 |
+
|
| 65 |
+
$$
|
| 66 |
+
\begin{array} { l l l } { { A ^ { i } } } & { { = } } & { { \displaystyle \mathrm { S o f t m a x } ( \frac { Q ^ { i } ( K ^ { i } ) ^ { \top } } { \sqrt { d _ { k } } } + A _ { G } ^ { i } ) , } } \\ { { O ^ { i } } } & { { = } } & { { \displaystyle \mathrm { P G } \mathrm { - } \mathrm { F F N } ( \mathrm { h e a d } ^ { i } ) , } } \\ { { X } } & { { = } } & { { \displaystyle \sum _ { i = 1 } ^ { H } O ^ { i } W _ { i } ^ { O } } } \end{array}
|
| 67 |
+
$$
|
| 68 |
+
|
| 69 |
+
# 3.3 Partial-Level Gated FFN
|
| 70 |
+
|
| 71 |
+
Intuition Previous studies (Wu et al., 2020; Mehta et al., 2021; Ge et al., 2022) have commonly reduced the parameters in feed-forward networks by decreasing the hidden dimension (e.g., 2048 to 256). In contrast, we tackle this issue through a matrix factorization approach. Our key idea involves utilizing a collection of small FFNs to model smaller input features, rather than relying on a single large FFN.
|
| 72 |
+
|
| 73 |
+
Assume a FFN with mappings of $1 0 2 4 \mathrm { - } { > } 4 0 9 6 \mathrm { - }$ ${ > } 1 0 2 4$ , which consumes around 8.4 million parameters. By decomposing this into 8 smaller FFNs with mappings of $1 2 8 \mathrm { - } > 5 1 2 \mathrm { - } > 1 2 8$ , we can retain the same hidden dimension, such as $8 ^ { * } 5 1 2$ , while using only 1.05 million parameters. This approach significantly reduces parameters while maintaining the crucial desired hidden dimension, as emphasized in previous studies (Geva et al., 2021; Tran et al., 2021).
|
| 74 |
+
|
| 75 |
+
Furthermore, we have observed that the Transformer architecture inherently consists of multiple smaller subspaces, namely “heads” within the multi-head attention (MHA) mechanism. These heads act as sub-components of the original inputs and retain substantial information from the original data. As a result, PG-FFNs should naturally be constructed based on the MHA mechanism.
|
| 76 |
+
|
| 77 |
+
Calculation of PG-FFNs While group transformation operations could be used to instantiate our idea, they are not optimal on GPUs due to their low I/O efficiency (Ma et al., 2018), causing significant inference latency. To address this, we propose sharing parameters across each FFN within different heads, thereby eliminating the need for group transformation operations.
|
| 78 |
+
|
| 79 |
+
However, directly sharing weights may result in homogeneous representations across different heads, which may potentially hinder the performance (Li et al., 2018). To mitigate this, we further introduce a head-specific gated mechanism. The core idea is to use a set of diverse masks to filter the information of different heads so that the head representation will be more diverse. Formally, given a set of smaller features $\{ \mathrm { h e a d } ^ { i } | 1 \leq i \leq H \}$ and diverse masks $\{ G ^ { i } | 1 \leq i \leq H \}$ , the Eq. (6) can rewritten as:
|
| 80 |
+
|
| 81 |
+
$$
|
| 82 |
+
O ^ { i } = G ^ { i } \odot \mathrm { F F N } ( \mathrm { h e a d } ^ { i } ) ,
|
| 83 |
+
$$
|
| 84 |
+
|
| 85 |
+
where $\mathrm { F F N } ( \cdot )$ is the same as Eq. (4).
|
| 86 |
+
|
| 87 |
+
Generating $\{ G ^ { i } | 1 \le i \le H \}$ In our preliminary experiments, we observed significant diversity in the features generated by different parameters from sub-layer inputs, e.g., $\{ V ^ { 1 } , \ldots , V ^ { H } \}$ . Motivated by this finding, we generate diverse masks in the following manner:
|
| 88 |
+
|
| 89 |
+
$$
|
| 90 |
+
G ^ { i } = \sigma ( X W _ { i } ^ { G } ) ,
|
| 91 |
+
$$
|
| 92 |
+
|
| 93 |
+
where $W _ { i } ^ { G }$ is a learnable matrix and $\sigma$ denotes the activation function, e.g., ReLU, Sigmoid and Tanh. We compare them in Table 8.
|
| 94 |
+
|
| 95 |
+
# 3.4 Efficient Scaling Strategy
|
| 96 |
+
|
| 97 |
+
Though PG-FFN offers the advantage of reducing lots of parameters when applied directly to the transformer, it also leads to performance degradation. Thus, a crucial aspect of this study is to determine how to effectively utilize the spared parameters. In this work, we adopt a hybrid scaling strategy, combining both width scaling and depth scaling, which has been validated in computer vision, e.g., EfficientNet (Tan and Le, 2019).
|
| 98 |
+
|
| 99 |
+
# 3.4.1 Enabling Efficient Depth Scaling for PartialFormer
|
| 100 |
+
|
| 101 |
+
Wang et al. (2019); Dong et al. (2021); Wang et al. (2022) have shown that the original location of FFNs plays an essential role in optimizing transformers, e.g., alleviating Token Uniformity. Thus, we need to consider the impact brought by the change of FFNs. While the densely residual connection is an efficient way to alleviate it, they are typically either based on feature level (e.g., DLCL (Wang et al., 2019)) or coupled with the network structure (e.g., Realformer (He et al., 2021)).
|
| 102 |
+
|
| 103 |
+
To this end, we design a new variant of the residual connection integrated into the attention calculation, while also decoupling from the network architecture. Specifically, the calculation of attention maps consists of two parts: 1) $A _ { G }$ , the global part, and 2) $A _ { L }$ , the local part. The calculation of $A _ { L }$ remains the same as in the vanilla Transformer, while $A _ { G }$ is computed once by using the original embedding as input through Eq. (1). Inspired by He et al. (2021), to efficiently fuse these components, we add them together and apply a Softmax function, as shown in Eq. (5).
|
| 104 |
+
|
| 105 |
+
In addition to the benefit of efficient depth scaling (See Appendix F), this approach provides remarkable flexibility in combining different attention mechanisms, specifically tailored to address specific conditions. For instance, it allows for the utilization of local attention to calculate $A _ { G }$ when dealing with small datasets (see Appendix D).
|
| 106 |
+
|
| 107 |
+
# 3.4.2 Head Scaling: An Efficient Width Scaling for PartialFormer
|
| 108 |
+
|
| 109 |
+
Existing approach to width scaling, which is based on the embedding size, necessitates the simultaneous scaling of both the encoder and decoder for machine translation tasks. This is primarily because researchers commonly employ shared encoder and decoder embedding. However, taking cues from the achievements of depth scaling, it may be more advantageous to adopt a distinct method for scaling width, similar to the approach used for scaling depth. Here we show how PartialFormer has inherent superiority to achieve so.
|
| 110 |
+
|
| 111 |
+
The width of a Transformer model typically refers to the widest part of the Transformer. In this context, both the vanilla Transformer and previous lightweight Transformer models have widths that are related to the embedding dimension, such as $4 d$ or $d$ . Therefore, by increasing the embedding size, we can effectively enlarge their width. However, the width definition in PartialFormer is different and can be expressed as $w = H \times d _ { \mathrm { f f n } }$ , where $w$ denotes the width of model and $d _ { \mathrm { { f f n } } }$ is associated with the head dimension $d _ { k }$ . Consequently, we can expand the width by either increasing the number of heads or enlarging $d _ { k }$ . A comparison between these approaches is presented in Table 7. Notably, if the head dimension and number of heads are independent of the embedding dimension, PartialFormer allows for easy scaling of width in different ways within the encoder and decoder components.
|
| 112 |
+
|
| 113 |
+

|
| 114 |
+
Figure 3: Comparison of ways to generate subspaces in Transformer and PartialFormer.
|
| 115 |
+
|
| 116 |
+
To this end, we propose a new scaling mechanism, namely head scaling, that scales the width of PartialFormer by directly adding more heads and increasing head dimension, as illustrated in Figure 3. Given the head dimension $d _ { k }$ , the embedding dimension $d$ , and the number of heads $H$ , we consider two strategies to generate $H$ attention heads:
|
| 117 |
+
|
| 118 |
+
(a) Simple strategy: We employ three learnable matrices, each with a shape of $d \times ( d _ { k } \times H )$ , to directly obtain the expected number of $Q$ , $K$ , and $V$ .
|
| 119 |
+
|
| 120 |
+
(b) Complex strategy: we employ a two-step process. First, we generate an intermediate quantity of $Q$ and $K$ , and then use a powerful MLP network to expand the attention maps to the desired number. This innovative design draws inspiration from the inherent redundancy found within the attention map (Michel et al., 2019; Clark et al., 2019; Voita et al., 2019), allowing for more heads in PartialFormer under the same parameter budget. We show the comparisons in Table 6.
|
| 121 |
+
|
| 122 |
+

|
| 123 |
+
|
| 124 |
+

|
| 125 |
+
|
| 126 |
+
<table><tr><td>Type</td><td>Model</td><td>N-M</td><td>ddk</td><td></td><td></td><td></td><td>H MACs Param</td><td>BLEU</td><td>COMET-22</td></tr><tr><td rowspan="4">Multi-Branch Architecture</td><td>Weighted Transformer (Ahmed et al.,2017)</td><td>6-6</td><td>1024</td><td></td><td></td><td></td><td>211M</td><td>28.90</td><td></td></tr><tr><td>Multi-Unit Transformer (Yan et al.,2020)</td><td>6-6</td><td></td><td></td><td></td><td></td><td>130M</td><td>29.30</td><td></td></tr><tr><td>MAT (Fan et al., 2020)</td><td>6-6</td><td></td><td></td><td></td><td></td><td>206M</td><td>29.90</td><td></td></tr><tr><td>Multi-Path Transformer (Lin et al., 2022)</td><td>6-6</td><td></td><td></td><td></td><td></td><td>193M</td><td>29.68</td><td></td></tr><tr><td>Lightweight Architecture</td><td>Evolved Transformer (So et al., 2019) Delight (Mehta et al., 2021)</td><td></td><td></td><td></td><td></td><td></td><td>64M</td><td>28.20</td><td></td></tr><tr><td rowspan="5">Weight Sharing</td><td></td><td></td><td>640</td><td></td><td></td><td></td><td>54M</td><td>28.00</td><td></td></tr><tr><td>Universal Transformer (Dehghani et al.,2019)</td><td></td><td>1024</td><td></td><td>=</td><td></td><td>65M</td><td>28.90</td><td></td></tr><tr><td>SubFormer (Reid et al., 2021)</td><td></td><td>-</td><td></td><td>=</td><td></td><td>63M</td><td>28.50</td><td></td></tr><tr><td>SubFormer-big (Reid et al., 2021)</td><td></td><td></td><td></td><td></td><td></td><td>197M</td><td>29.30</td><td></td></tr><tr><td>ODE Transformer (RK4) (Li et al., 2022) ODE Transformer (RK4) (Li et al., 2022)</td><td>6-6 24-6</td><td>512 512</td><td></td><td>=</td><td></td><td>62M 118M</td><td>29.03 29.80</td><td></td></tr><tr><td rowspan="3">Other Comparisons</td><td></td><td></td><td></td><td>64</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>RealFormer (He et al., 2021) DMAN (Fan et al., 2021)</td><td>18-18</td><td>512 512</td><td></td><td>8 8</td><td></td><td>151M</td><td>29.35</td><td></td></tr><tr><td>Mega-Softmax (Ma et al.,2022)</td><td>6-6 6-6</td><td>512</td><td></td><td></td><td></td><td>63M 67M</td><td>29.10 29.01</td><td></td></tr><tr><td rowspan="7">Our System</td><td>Transformer</td><td></td><td></td><td>64</td><td>1</td><td></td><td></td><td></td><td></td></tr><tr><td>PartialFormer (w/o Head Scaling)</td><td>24-6</td><td>512</td><td>8-8</td><td></td><td>11.1B</td><td>118M</td><td>29.05</td><td>83.60</td></tr><tr><td>PartialFormer</td><td>24-6</td><td>512</td><td>64 24-16</td><td>8-8</td><td>8.8B</td><td>66M</td><td>28.86 30.09</td><td>83.35 84.17</td></tr><tr><td></td><td>24-6</td><td>512</td><td>64</td><td></td><td>12.2B</td><td>115M</td><td></td><td></td></tr><tr><td>Transformer</td><td>6-6</td><td>512</td><td>64 45</td><td>8-8</td><td>9.9B</td><td>62M</td><td>27.43</td><td>82.19</td></tr><tr><td>Transformer PartialFormer (w/o Head Scaling)</td><td>24-6 24-6</td><td>360 360</td><td>45</td><td>8-8 8-8</td><td>6.3B 5.2B</td><td>62M 36M</td><td>28.00 27.88</td><td>82.72 82.49</td></tr><tr><td></td><td></td><td>360</td><td>45</td><td>24-16</td><td>6.8B</td><td>61M</td><td>29.23</td><td></td></tr><tr><td></td><td>PartialFormer PartialFormer</td><td>24-6 24-6</td><td>360</td><td>45 30-16</td><td></td><td>6.9B</td><td>68M</td><td>29.56</td><td>83.74 83.94</td></tr></table>
|
| 127 |
+
|
| 128 |
+
Table 1: Results on the WMT’14 En-De task. MACs denote the multiplication-addition operations. We compute them via 20 source and target tokens following Mehta et al. (2021).
|
| 129 |
+
|
| 130 |
+
# 4 Experimental Setups
|
| 131 |
+
|
| 132 |
+
In our evaluation, we assess the performance of PartialFormer across 9 machine translation tasks2. More details are given in Appendix A
|
| 133 |
+
|
| 134 |
+
Dataset. We evaluate our approach on three widely-used datasets: WMT’14 English-German (En-De), WMT’14 English-French (En-Fr), and WMT’16 English-Romanian (En-Ro). Besides, to further validate the effectiveness of PartialFormer, we also evaluate PartialFormer on six translation tasks from WMT’17 benchmark. We preprocess the raw data following the standard strategy.
|
| 135 |
+
|
| 136 |
+
Architectures and Selected Baselines. We use a 24-6 encoder-decoder PartialFormer architecture for its strong performance, on all 9 machine translation tasks. Detailed configurations are provided in the results tables. We compare our approach with various baselines, including vanilla Transformer models, multi-branch architecture, lightweight architecture, weight-sharing methods, and other strong baselines.
|
| 137 |
+
|
| 138 |
+
Training & Evaluation. We train all the models on GeForce RTX 3090 cards via Fairseq (Ott et al., 2019) toolkit. For evaluation, we utilized multi-BLEU (Papineni et al., 2002) and COMET22 (Rei et al., 2022) scores. Beam sizes were 4, 4, and 5 for En-De, En-Fr, and En-Ro tasks respectively. Length_penalty of 0.6, 0.8, and 1.3 were applied to En-De, En-Fr, and En-Ro tasks respectively. For the WMT’17 benchmark, beam size and Length_penalty were set to 4 and 1, respectively. We used an ensemble of the last ten checkpoints.
|
| 139 |
+
|
| 140 |
+
# 5 Experiments
|
| 141 |
+
|
| 142 |
+
Results of WMT’14 En-De Table 1 presents the results for the WMT’14 En-De task. Note that we also provide a “strong” baseline which also benefits from deep model stacking. Even though the performance of PartialFormer (w/o Head Scaling) is slightly inferior to that of the Transformer model (27.88 vs. 28.00 and 28.86 vs. 29.05), it outshines the latter in terms of parameter efficiency, consuming significantly fewer parameters (36M vs. 62M, 66M vs. 118M). We attribute this phenomenon to our PG-FFN, which leverages a group of compact FFNs. This approach enables PG-FFN to maintain high hidden dimension, while drastically reducing parameter consumption.
|
| 143 |
+
|
| 144 |
+
Upon utilizing our head scaling technique to amplify the capacity, our Partialformer delivers a BLEU score 29.56 and 30.09 on two configurations, respectively. This surpasses the standard Transformer by 1.56 BLEU points (29.56 vs. 28.00) and
|
| 145 |
+
|
| 146 |
+
Table 2: Results on the WMT’14 En-Fr task.
|
| 147 |
+
|
| 148 |
+
<table><tr><td>Model</td><td>N</td><td>ddk</td><td>HParam BLEU</td></tr><tr><td>Weighted Transformer (2017)</td><td>6</td><td></td><td>- 211M 41.40</td></tr><tr><td>Evolved Transformer (2019)</td><td>=</td><td></td><td>64M 40.60</td></tr><tr><td>Delight (2021)</td><td>-640</td><td></td><td>54M 40.50</td></tr><tr><td>ODE Transformer (2022)</td><td>6</td><td>=</td><td>69M 42.56</td></tr><tr><td>ODE Transformer (2022)</td><td>24</td><td></td><td>123M 43.28</td></tr><tr><td>Multi-Path Transformer (2022)</td><td>=</td><td></td><td>168M 42.44</td></tr><tr><td>Transformer</td><td>24 512 64</td><td>8-8</td><td>120M 42.33</td></tr><tr><td>PartialFormer (w/o Head Scaling) 24 512 648-8</td><td></td><td></td><td>68M 41.68</td></tr><tr><td>PartialFormer</td><td></td><td>24 512 64 24-18</td><td>119M 43.10</td></tr><tr><td>PartialFormer</td><td></td><td>24 512 64 24-24</td><td>127M 43.29</td></tr><tr><td>Transformer</td><td>6 512 64</td><td>8-8</td><td>63M 40.79</td></tr><tr><td>Transformer</td><td>24 360 45</td><td>8-8</td><td>64M 40.96</td></tr><tr><td>PartialFormer(w/o Head Scaling) 24 360 45</td><td></td><td>8-8</td><td>38M 40.44</td></tr><tr><td>PartialFormer</td><td></td><td>24 360 45 24-18</td><td>63M 42.16</td></tr><tr><td>PartialFormer</td><td></td><td>24 360 45 24-24</td><td>67M 42.39</td></tr></table>
|
| 149 |
+
|
| 150 |
+
1.04 BLEU points (30.09 vs. 29.05) within a similar model capacity. The enhancement here can be attributed to the head scaling method, which allows PartialFormer to possess a larger hidden dimension, thereby bolstering its capacity for memory storage (Geva et al., 2021). These observations are further confirmed by the COMET-22 scores.
|
| 151 |
+
|
| 152 |
+
Moreover, PartialFormer can even surpass all selected multi-branch Transformers while using fewer parameters. Notably, PartialFormer $N =$ $2 4 , d \ = \ 5 1 2 )$ outperforms the latest multi-path Transformer (Lin et al., 2022) by 0.41 BLEU points with 78M fewer parameters. This highlights the efficiency of building a multi-branch network based on inherent subspaces. Additionally, PartialFormer excels over previous lightweight approaches and outperforms state-of-the-art weight-sharing methods, e.g., ODE Transformer (Li et al., 2022), and other strong baselines, e.g., Mega (Ma et al., 2022). Notably, both ODE Transformer and Mega utilize relative position encoding (Shaw et al., 2018).
|
| 153 |
+
|
| 154 |
+
Results of WMT’14 En-Fr Table 2 presents the results of PartialFormer on the WMT’14 En-Fr task. Similar to the findings in the En-De task, PartialFormer demonstrates a similar phenomenon. Notably, PartialFormer achieves comparable results to Transformer $( N = 2 4 , d = 5 1 2 )$ (42.39 vs. 42.33) while utilizing 53M fewer parameters (67M vs. 120M). This highlights the remarkable parameter efficiency of PartialFormer.
|
| 155 |
+
|
| 156 |
+
Results of WMT’16 En-Ro Table 3 presents the results on the test set of the WMT’16 En-Ro task. Notably, PartialFormer achieves the highest BLEU points among all selected baselines. It is particularly remarkable that PartialFormer achieves similar results to ODE Transformer while utilizing 178M fewer parameters. This highlights the exceptional efficiency of PartialFormer.
|
| 157 |
+
|
| 158 |
+
Table 3: Results on the WMT’16 En-Ro task.
|
| 159 |
+
|
| 160 |
+
<table><tr><td>Model</td><td>N</td><td>ddk</td><td>H Param BLEU</td></tr><tr><td>Delight (Mehta et al., 2021)</td><td>- 640-</td><td>■</td><td>53M 34.70</td></tr><tr><td>Subformer (Reid et al.,2021)</td><td>■</td><td>- ■ -</td><td>48M 34.70</td></tr><tr><td>ODE Transformer (Li et al.,2022)</td><td>6 1024 64 16-16</td><td></td><td>226M 35.28</td></tr><tr><td>Transformer</td><td>24 512 64</td><td>8-8</td><td>111M 35.00</td></tr><tr><td>PartialFormer (w/o Head Scaling)</td><td>24 512</td><td>64 8-8</td><td>59M 35.07</td></tr><tr><td>PartialFormer</td><td>24</td><td>320 4024-24</td><td>48M 35.30</td></tr></table>
|
| 161 |
+
|
| 162 |
+
Table 4: Results on the WMT’17 benchmark. PartialFormer has the same depth and $d$ as the Transformer but consumes 1M fewer parameters on average.
|
| 163 |
+
|
| 164 |
+
<table><tr><td rowspan="2">Model</td><td colspan="2">Fi←→En</td><td colspan="2">De←→En</td><td colspan="2">Lv← →En</td><td rowspan="2">Avg.</td></tr><tr><td>Fi→En En→FiDe→En En-→DeLv-→En En→Lv</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Transformer</td><td>26.07</td><td>22.14</td><td>35.04</td><td>28.59</td><td>17.59</td><td>16.23</td><td>24.27</td></tr><tr><td>PartialFormer</td><td>27.48</td><td>23.35</td><td>35.60</td><td>29.91</td><td>19.65</td><td>17.37</td><td>25.56</td></tr></table>
|
| 165 |
+
|
| 166 |
+
Results of WMT’17 Benchmark Table 4 presents the WMT’17 benchmark results, showing that PartialFormer consistently outperforms Transformer by an average of 1.29 BLEU points in all six translation tasks. This finding is consistent with the observed performance in the En-De task.
|
| 167 |
+
|
| 168 |
+
# 6 Analysis
|
| 169 |
+
|
| 170 |
+
# 6.1 Ablation Studies
|
| 171 |
+
|
| 172 |
+
Table 5 presents an ablation study of PartialFormer on the WMT’14 En-De task, demonstrating the critical role of each component. Omitting any element causes performance decline, underscoring the holistic design. The PG-FFN removal (#3 vs. #4) results in a large performance drop of 2.05 BLEU points, despite a mere 16 million parameters reduction. This evidence corroborates previous findings (Dong et al., 2021) on the subpar performance of pure attention networks sans FFN, highlighting the essential role of PG-FFN in PartialFormer.
|
| 173 |
+
|
| 174 |
+
Besides, Table 5 shows the results of different PartialFormer configurations on the WMT’14 En-De task. The encoder-decoder PartialFormer achieves the highest performance, reaching 29.56 BLEU points, indicating the effectiveness of our approach in enhancing both the encoder and the decoder. Employing our concept to either the encoder or the decoder individually also improves performance, yet the encoder-decoder configuration persistently surpasses others, marking the greatest performance improvement.
|
| 175 |
+
|
| 176 |
+
Table 5: Ablation studies on WMT’14 En-De task.
|
| 177 |
+
|
| 178 |
+
<table><tr><td># Model</td><td>Param BLEU</td></tr><tr><td>1 Transformer (N = 24,d = 360)</td><td>62M 28.00</td></tr><tr><td>2 Pure Attention (N= 24,d = 360)</td><td>31M 25.70</td></tr><tr><td>3 PartialFormer</td><td>68M 29.56</td></tr><tr><td>4 w/o Partial-level Gated FFN</td><td>52M 27.51</td></tr><tr><td>5 w/o Residual-like Attention Calculation</td><td>66M 29.26</td></tr><tr><td>6 w/o Head Scaling</td><td>36M 27.88</td></tr><tr><td>7 PartialFormer (encoder only)</td><td>67M 29.15</td></tr><tr><td>8 PartialFormer (decoder only)</td><td>63M 28.80</td></tr></table>
|
| 179 |
+
|
| 180 |
+
Table 7: Comparison of different width scaling strategy on the En-De task.
|
| 181 |
+
|
| 182 |
+
<table><tr><td>Model</td><td>Param BLEU</td></tr><tr><td>PartialFormer (w/o Head Scaling)</td><td>36M 27.88</td></tr><tr><td>+ Simple Head Scaling</td><td>68M 29.33</td></tr><tr><td>+ Complex Head Scaling</td><td>68M 29.56</td></tr></table>
|
| 183 |
+
|
| 184 |
+
Table 6: Comparison of head scaling strategy on WMT’14 En-De task.
|
| 185 |
+
|
| 186 |
+
# 6.2 Comparison of Head Scaling Strategy
|
| 187 |
+
|
| 188 |
+
Table 6 presents the results of PartialFormer on the En-De task test set with varying head scaling techniques. Both simple and complex strategies effectively utilize additional parameters to enhance PartialFormer’s performance. Notably, the complex head scaling technique, allowing for more parameters allocated to additional heads, demonstrates superior performance.
|
| 189 |
+
|
| 190 |
+
# 6.3 Discussions on Width Scaling Strategies
|
| 191 |
+
|
| 192 |
+
Table 7 presents the results of analyzing three key ways to increase the width in PartialFormer: 1) $d _ { k }$ , 2) $H$ , and 3) $d$ , on the En-De task’s test set. Notably, the findings indicate that both increasing $H$ and adding $d _ { k }$ can effectively enhance the capacity of PartialFormer. Additionally, enlarging $d$ can be beneficial for performance improvements when it is small, e.g., less than 360. However, beyond a certain threshold, further increments of $d$ become redundant and do not lead to performance gains. This aligns with previous studies (Mehta et al., 2021; Baevski and Auli, 2019) highlighting redundant information in the embedding layer.
|
| 193 |
+
|
| 194 |
+
# 6.4 Comparison of Gating Strategy
|
| 195 |
+
|
| 196 |
+
Table 8 presents a comparison of various activation functions used in PG-FFN. The results indicate that the default choice, ReLU activation, yields the best performance. One explanation is that the ReLU activation provides hard masks for filtering the information of different heads, compared to other activation functions. Such hard masks can make different heads more diverse.
|
| 197 |
+
|
| 198 |
+
<table><tr><td>Model</td><td>Seting</td><td>H d</td><td>dk Param</td><td>BLEU</td></tr><tr><td rowspan="7">PartialFormer</td><td>Basic</td><td>|30-16 360</td><td>45 68M</td><td>29.56</td></tr><tr><td>Varying Encoder H</td><td>|24-16 360 45 16-16 360 45</td><td>61M 51M</td><td>29.23 29.02</td></tr><tr><td>Varying Decoder H</td><td>[16-24 360 45 16-30360 45</td><td>56M 60M</td><td>28.85 29.20</td></tr><tr><td></td><td>|30-16 360 30</td><td>49M</td><td>28.70</td></tr><tr><td>Varying dh</td><td>30-16 360 60 30-16 360 90</td><td>86M 124M</td><td>29.68</td></tr><tr><td></td><td></td><td></td><td>30.00</td></tr><tr><td>Varying d</td><td>|30-16 180 45 30-16 270 45 30-16 450 45</td><td>35M 51M 84M</td><td>27.61 28.80 29.41</td></tr></table>
|
| 199 |
+
|
| 200 |
+
# 6.5 Efficiency Analysis
|
| 201 |
+
|
| 202 |
+
Table 9 exhibits the inference efficiency on the test set of En-De task. It is evident that PartialFormer incurs a reasonable increase in inference cost, which remains within acceptable limits.
|
| 203 |
+
|
| 204 |
+
# 6.6 Analysis on Behaviours of FFN
|
| 205 |
+
|
| 206 |
+
Metric. Following Zhang et al. (2022), we examine FFN behaviors across four aspects: activation neuron count (namely $n _ { \mathrm { a c t . } } )$ ), FFNs’ hidden dimension, activation-neuron ratio (activations divided by hidden dimension, namely $R _ { \mathrm { a c t . } }$ ), and FFN efficiency (activations divided by parameters, namely $\eta _ { \mathrm { { f f i n } } } )$ . Notably, for PartialFormer, the hidden dimension represents the concatenation of hidden dimensions from all smaller FFNs.
|
| 207 |
+
|
| 208 |
+
Results. Figure 4(a-c) exhibits the results on the En-De test set. It is evident that PartialFormer has a lower activation ratio than the vanilla Transformer, as shown in Figure 4(b). This indicates that PGFFNs based on matrix factorization present lower utilization of the hidden dimension compared to the vanilla FFNs. However, our PG-FFN is parameter consumption friendly, enabling larger hidden layer dimensions with the same parameter budget (e.g., 5400 vs. 1440). Despite lower utilization of hidden dimension, it can still own more activated neurons, as depicted in Figure 4(a). Additionally, our PGFFN exhibits higher efficiency compared to vanilla FFNs, as shown in Figure 4(c). Multiple small FFNs, like “Swarm Intelligence” (Bonabeau et al., 1999), outperform large FFNs by leveraging the collective strength of weak individuals.
|
| 209 |
+
|
| 210 |
+
Table 8: Comparison of activation functions in PGFFNs.
|
| 211 |
+
|
| 212 |
+
<table><tr><td>Model</td><td>Param BLEU</td></tr><tr><td>PG-FFNs</td><td>68M 29.56</td></tr><tr><td>PG-FFNs with Sigmoid activation</td><td>68M 29.21</td></tr><tr><td>PG-FFNs with Tanh activation</td><td>68M 29.03</td></tr></table>
|
| 213 |
+
|
| 214 |
+
Table 9: Efficiency comparison between Transformer and PartialFormer in inference.
|
| 215 |
+
|
| 216 |
+
<table><tr><td>Model</td><td colspan="4">Param Speed (Tok./s)Memory BLEU</td></tr><tr><td>Transformer</td><td>62M</td><td>4325</td><td>3.0G</td><td>28.00</td></tr><tr><td>PartialFormer (w/o head scaling)</td><td>66M</td><td>3634</td><td>3.2G</td><td>28.86</td></tr><tr><td>PartialFormer</td><td>68M</td><td>3023</td><td>3.3G</td><td>29.56</td></tr></table>
|
| 217 |
+
|
| 218 |
+
# 6.7 Analysis on Head Diversity
|
| 219 |
+
|
| 220 |
+
Metric. We select the same metric, namely $D _ { o u t p u t }$ , as that in Li et al. (2018) to measure the diversity among head features. In this metric, a larger value indicates a higher level of diversity.
|
| 221 |
+
|
| 222 |
+
Results. From Figure 4(d), we can observe that PartialFormer exhibits more diverse head features compared to the vanilla Transformer, even though the vanilla Transformer already demonstrates diverse features. This aligns with previous study (Li et al., 2018), which demonstrates the positive impact of head feature diversity on the Transformer model’s performance. Thus, we conclude that the insertion of FFNs into attention mechanism may be a more optimal design.
|
| 223 |
+
|
| 224 |
+
# 7 Related Work
|
| 225 |
+
|
| 226 |
+
Lightweight Transformers Many methods have been proposed to improve the parameter efficiency of Transformer architecture. The first line is to directly cut down redundant computations and parameters via a more efficient design such as adopting more efficient transformation operations (Mehta et al., 2019, 2021), integrating different but complementary patterns (Wu et al., 2020) and neural architecture search (So et al., 2019). Another research direction for improving parameter efficiency in the Transformer is weight sharing. The popular cross-layer sharing method is utilized by the Universal Transformer (Dehghani et al., 2019). Reid et al. (2021) propose better performance by freeing the first and last encoder layers and widening the intermediate layers. Li et al. (2022) introduce an ordinary differential equation-inspired weightsharing method for more precise results. Different from these work, our study focus on the design of efficient lightweight FFN.
|
| 227 |
+
|
| 228 |
+

|
| 229 |
+
Figure 4: Analysis on behaviours of FFNs and head diversity in Transformer and PartialFormer.
|
| 230 |
+
|
| 231 |
+
Multi-Branch Transformer The multi-branch strategy is widely used in Transformer design. Weighted Transformer (Ahmed et al., 2017) employs a multi-branch FFN, while Multi-attentive Transformer (Fan et al., 2020), Multi-units Transformer (Yan et al., 2020), and Multi-Path Transformer (Lin et al., 2022) extend this concept to different components of the Transformer. Our work introduces a pure multi-branch architecture based on natural subspaces.
|
| 232 |
+
|
| 233 |
+
Scaling Strategy in Transformer Deepening (Bapna et al., 2018; Wang et al., 2019) and widening (Vaswani et al., 2017; Wu et al., 2021) Transformer have been well-acknowledged as two strategies to improve the capacity of Transformer in literature. In this work, PartialFormer adopts two alternative strategies to improve capacity, adding a number of heads and head dimensions.
|
| 234 |
+
|
| 235 |
+
# 8 Conclusion
|
| 236 |
+
|
| 237 |
+
In this paper, we present PartialFormer, a new parameter-efficient Transformer architecture that offers an alternative approach to the design of the lightweight FFN. By employing multiple small FFNs and leveraging matrix factorization techniques, PartialFormer effectively reduces the number of parameters in the FFN. Moreover, we propose two innovative operations to further efficiently enhance the model capabilities. Experimental results across various machine translation tasks showcase the significant performance improvements achieved by PartialFormer, while maintaining comparable parameter consumption.
|
| 238 |
+
|
| 239 |
+
# Limitations
|
| 240 |
+
|
| 241 |
+
Despite the potential advantages of Partialformer in terms of parameter utilization and performance within a limited parameter budget, it is important to note that the existing conclusions regarding its effectiveness have not been thoroughly examined in the context of large-scale datasets and a higher number of parameters. Further research is needed to validate the claims and assess the scalability of Partialformer in more challenging scenarios.
|
| 242 |
+
|
| 243 |
+
# References
|
| 244 |
+
|
| 245 |
+
Karim Ahmed, Nitish Shirish Keskar, and Richard Socher. 2017. Weighted transformer network for machine translation. CoRR.
|
| 246 |
+
|
| 247 |
+
Alexei Baevski and Michael Auli. 2019. Adaptive input representations for neural language modeling. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019.
|
| 248 |
+
|
| 249 |
+
Ankur Bapna, Mia Chen, Orhan Firat, Yuan Cao, and Yonghui Wu. 2018. Training deeper neural machine translation models with transparent attention. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 3028– 3033, Brussels, Belgium. Association for Computational Linguistics.
|
| 250 |
+
|
| 251 |
+
Eric Bonabeau, Marco Dorigo, and Guy Theraulaz. 1999. Swarm Intelligence: From Natural to Artificial Systems. Oxford University Press.
|
| 252 |
+
|
| 253 |
+
Kevin Clark, Urvashi Khandelwal, Omer Levy, and Christopher D. Manning. 2019. What does BERT look at? an analysis of BERT’s attention. In Proceedings of the 2019 ACL Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, pages 276–286, Florence, Italy. Association for Computational Linguistics.
|
| 254 |
+
|
| 255 |
+
Yann N. Dauphin, Angela Fan, Michael Auli, and David Grangier. 2017. Language modeling with gated convolutional networks. In Proceedings of the 34th International Conference on Machine Learning, ICML 2017, Sydney, NSW, Australia, 6-11 August 2017, volume 70 of Proceedings of Machine Learning Research, pages 933–941. PMLR.
|
| 256 |
+
|
| 257 |
+
Mostafa Dehghani, Stephan Gouws, Oriol Vinyals, Jakob Uszkoreit, and Lukasz Kaiser. 2019. Universal transformers. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019.
|
| 258 |
+
|
| 259 |
+
Yihe Dong, Jean-Baptiste Cordonnier, and Andreas Loukas. 2021. Attention is not all you need: pure attention loses rank doubly exponentially with depth. In Proceedings of the 38th International Conference on Machine Learning, ICML 2021, 18-24 July 2021, Virtual Event, pages 2793–2803.
|
| 260 |
+
|
| 261 |
+
Yang Fan, Shufang Xie, Yingce Xia, Lijun Wu, Tao Qin, Xiang-Yang Li, and Tie-Yan Liu. 2020. Multi-branch attentive transformer. ArXiv, abs/2006.10270.
|
| 262 |
+
|
| 263 |
+
Zhihao Fan, Yeyun Gong, Dayiheng Liu, Zhongyu Wei, Siyuan Wang, Jian Jiao, Nan Duan, Ruofei Zhang, and Xuanjing Huang. 2021. Mask attention networks: Rethinking and strengthen transformer. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1692–1701, Online. Association for Computational Linguistics.
|
| 264 |
+
|
| 265 |
+
Tao Ge, Si-Qing Chen, and Furu Wei. 2022. EdgeFormer: A parameter-efficient transformer for ondevice seq2seq generation. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, pages 10786–10798, Abu Dhabi, United Arab Emirates. Association for Computational Linguistics.
|
| 266 |
+
|
| 267 |
+
Jonas Gehring, Michael Auli, David Grangier, Denis Yarats, and Yann N. Dauphin. 2017. Convolutional sequence to sequence learning. In Proceedings of the 34th International Conference on Machine Learning, ICML 2017, Sydney, NSW, Australia, 6-11 August 2017, pages 1243–1252.
|
| 268 |
+
|
| 269 |
+
Mor Geva, Roei Schuster, Jonathan Berant, and Omer Levy. 2021. Transformer feed-forward layers are keyvalue memories. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 5484–5495, Online and Punta Cana, Dominican Republic. Association for Computational Linguistics.
|
| 270 |
+
|
| 271 |
+
Ruining He, Anirudh Ravula, Bhargav Kanagal, and Joshua Ainslie. 2021. RealFormer: Transformer likes residual attention. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pages 929–943, Online. Association for Computational Linguistics.
|
| 272 |
+
|
| 273 |
+
Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. 2020. ALBERT: A lite BERT for self-supervised learning of language representations. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020.
|
| 274 |
+
|
| 275 |
+
Bei Li, Quan Du, Tao Zhou, Yi Jing, Shuhan Zhou, Xin Zeng, Tong Xiao, JingBo Zhu, Xuebo Liu, and Min Zhang. 2022. ODE transformer: An ordinary differential equation-inspired model for sequence generation. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 8335–8351, Dublin, Ireland. Association for Computational Linguistics.
|
| 276 |
+
|
| 277 |
+
Jian Li, Zhaopeng Tu, Baosong Yang, Michael R. Lyu, and Tong Zhang. 2018. Multi-head attention with disagreement regularization. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 2897–2903, Brussels, Belgium. Association for Computational Linguistics.
|
| 278 |
+
|
| 279 |
+
Ye Lin, Shuhan Zhou, Yanyang Li, Anxiang Ma, Tong Xiao, and Jingbo Zhu. 2022. Multi-path transformer is better: A case study on neural machine translation. In Findings of the Association for Computational Linguistics: EMNLP 2022, pages 5646–5656, Abu Dhabi, United Arab Emirates. Association for Computational Linguistics.
|
| 280 |
+
|
| 281 |
+
Ningning Ma, Xiangyu Zhang, Hai-Tao Zheng, and Jian Sun. 2018. Shufflenet v2: Practical guidelines for efficient cnn architecture design. In Computer Vision – ECCV 2018: 15th European Conference, Munich, Germany, September 8–14, 2018, Proceedings, Part XIV, page 122–138, Berlin, Heidelberg. SpringerVerlag.
|
| 282 |
+
|
| 283 |
+
Xuezhe Ma, Chunting Zhou, Xiang Kong, Junxian He, Liangke Gui, Graham Neubig, Jonathan May, and Luke Zettlemoyer. 2022. Mega: Moving average equipped gated attention. CoRR.
|
| 284 |
+
|
| 285 |
+
Sachin Mehta, Marjan Ghazvininejad, Srinivasan Iyer, Luke Zettlemoyer, and Hannaneh Hajishirzi. 2021. Delight: Deep and light-weight transformer. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021.
|
| 286 |
+
|
| 287 |
+
Sachin Mehta, Rik Koncel-Kedziorski, Mohammad Rastegari, and Hannaneh Hajishirzi. 2019. Define: Deep factorized input word embeddings for neural sequence modeling. ArXiv, abs/1911.12385.
|
| 288 |
+
|
| 289 |
+
Paul Michel, Omer Levy, and Graham Neubig. 2019. Are sixteen heads really better than one? Advances in neural information processing systems, 32.
|
| 290 |
+
|
| 291 |
+
Myle Ott, Sergey Edunov, Alexei Baevski, Angela Fan, Sam Gross, Nathan Ng, David Grangier, and Michael Auli. 2019. fairseq: A fast, extensible toolkit for sequence modeling. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics (Demonstrations), pages 48–53, Minneapolis, Minnesota. Association for Computational Linguistics.
|
| 292 |
+
|
| 293 |
+
Kishore Papineni, Salim Roukos, Todd Ward, and WeiJing Zhu. 2002. 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. Association for Computational Linguistics.
|
| 294 |
+
|
| 295 |
+
Ricardo Rei, José G. C. de Souza, Duarte Alves, Chrysoula Zerva, Ana C Farinha, Taisiya Glushkova, Alon Lavie, Luisa Coheur, and André F. T. Martins. 2022. COMET-22: Unbabel-IST 2022 submission for the metrics shared task. In Proceedings of the Seventh Conference on Machine Translation (WMT), pages 578–585, Abu Dhabi, United Arab Emirates (Hybrid). Association for Computational Linguistics.
|
| 296 |
+
|
| 297 |
+
Machel Reid, Edison Marrese-Taylor, and Yutaka Matsuo. 2021. Subformer: Exploring weight sharing for parameter efficiency in generative transformers. In Findings of the Association for Computational Linguistics: EMNLP 2021, pages 4081–4090, Punta Cana, Dominican Republic. Association for Computational Linguistics.
|
| 298 |
+
|
| 299 |
+
Peter Shaw, Jakob Uszkoreit, and Ashish Vaswani. 2018. Self-attention with relative position representations. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers), pages 464–468, New Orleans, Louisiana. Association for Computational Linguistics.
|
| 300 |
+
|
| 301 |
+
Noam Shazeer. 2020. Glu variants improve transformer. arXiv preprint arXiv:2002.05202.
|
| 302 |
+
|
| 303 |
+
David R. So, Quoc V. Le, and Chen Liang. 2019. The evolved transformer. In Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, pages 5877–5886.
|
| 304 |
+
|
| 305 |
+
Ilya Sutskever, Oriol Vinyals, and Quoc V. Le. 2014. Sequence to sequence learning with neural networks. In Advances in Neural Information Processing Systems 27: Annual Conference on Neural Information Processing Systems 2014, December 8-13 2014, Montreal, Quebec, Canada, pages 3104–3112.
|
| 306 |
+
|
| 307 |
+
Mingxing Tan and Quoc Le. 2019. Efficientnet: Rethinking model scaling for convolutional neural networks. In International conference on machine learning, pages 6105–6114. PMLR.
|
| 308 |
+
|
| 309 |
+
Chau Tran, Shruti Bhosale, James Cross, Philipp Koehn, Sergey Edunov, and Angela Fan. 2021. Facebook AI’s WMT21 news translation task submission. In Proceedings of the Sixth Conference on Machine Translation, pages 205–215, Online. Association for Computational Linguistics.
|
| 310 |
+
|
| 311 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, pages 5998–6008.
|
| 312 |
+
|
| 313 |
+
Elena Voita, David Talbot, Fedor Moiseev, Rico Sennrich, and Ivan Titov. 2019. Analyzing multi-head self-attention: Specialized heads do the heavy lifting, the rest can be pruned. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5797–5808, Florence, Italy. Association for Computational Linguistics.
|
| 314 |
+
|
| 315 |
+
Peihao Wang, Wenqing Zheng, Tianlong Chen, and Zhangyang Wang. 2022. Anti-oversmoothing in deep vision transformers via the fourier domain analysis: From theory to practice. In The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022.
|
| 316 |
+
|
| 317 |
+
Qiang Wang, Bei Li, Tong Xiao, Jingbo Zhu, Changliang Li, Derek F. Wong, and Lidia S. Chao. 2019. Learning deep transformer models for machine translation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1810–1822, Florence, Italy. Association for Computational Linguistics.
|
| 318 |
+
|
| 319 |
+
Lijun Wu, Juntao Li, Yue Wang, Qi Meng, Tao Qin, Wei Chen, Min Zhang, Tie-Yan Liu, et al. 2021. R-drop: Regularized dropout for neural networks. Advances in Neural Information Processing Systems, 34:10890– 10905.
|
| 320 |
+
|
| 321 |
+
Zhanghao Wu, Zhijian Liu, Ji Lin, Yujun Lin, and Song Han. 2020. Lite transformer with long-short range attention. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020.
|
| 322 |
+
|
| 323 |
+
Jianhao Yan, Fandong Meng, and Jie Zhou. 2020. Multiunit transformers for neural machine translation. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 1047–1059, Online. Association for Computational Linguistics.
|
| 324 |
+
|
| 325 |
+
Zhengyan Zhang, Yankai Lin, Zhiyuan Liu, Peng Li, Maosong Sun, and Jie Zhou. 2022. MoEfication: Transformer feed-forward layers are mixtures of experts. In Findings of the Association for Computational Linguistics: ACL 2022, pages 877–890, Dublin, Ireland. Association for Computational Linguistics.
|
| 326 |
+
|
| 327 |
+
# A Detailed Setups of Experiments
|
| 328 |
+
|
| 329 |
+
# A.1 Dataset
|
| 330 |
+
|
| 331 |
+
Table 10 displays the statistics of all the 9 translation task.
|
| 332 |
+
|
| 333 |
+
# A.2 Training Details
|
| 334 |
+
|
| 335 |
+
Table 11 and 12 exhibits the training details on all translation tasks.
|
| 336 |
+
|
| 337 |
+
# B Metric Definition
|
| 338 |
+
|
| 339 |
+
# B.1 Measurement of Head Diversity
|
| 340 |
+
|
| 341 |
+
Following Li et al. (2018), we measure the head diversity as follows:
|
| 342 |
+
|
| 343 |
+
$$
|
| 344 |
+
D _ { \mathrm { o u t p u t } } = \exp ( - \frac { 1 } { H ^ { 2 } } \sum _ { i = 1 } ^ { H } \sum _ { j = 1 } ^ { H } \frac { | O ^ { i } \cdot O ^ { j } | } { \| O ^ { i } \| \| O ^ { j } \| } )
|
| 345 |
+
$$
|
| 346 |
+
|
| 347 |
+
During evaluation, we calculate the metric on all samples and average the values to obtain the final result.
|
| 348 |
+
|
| 349 |
+
# C More Comparison with Previous Lightweight Transformer
|
| 350 |
+
|
| 351 |
+
Table 13 presents a comprehensive comparison of previous lightweight Transformer models on the En-De task’s test set, with a specific focus on operating within a smaller parameter budget. The results prominently showcase the outstanding performance of PartialFormer, even when faced with constraints on model capacity. This outcome further emphasizes the superior capabilities of PartialFormer in scenarios with limited resources.
|
| 352 |
+
|
| 353 |
+
# D PartialFormer with Different $A _ { G }$ for Small Dataset
|
| 354 |
+
|
| 355 |
+
Table 14 showcases the results of PartialFormer on the WMT’16 En-Ro task, a small-scale translation dataset, specifically when $A _ { G }$ is calculated using local attention (Shaw et al., 2018). Notably, these results reveal that by adopting such an approach, PartialFormer achieves an impressive BLEU score of 35.76. We hope this can shed lights on the area of model integration.
|
| 356 |
+
|
| 357 |
+
# E PartialFormer with GLU and Weight Sharing
|
| 358 |
+
|
| 359 |
+
In this section, we investigate the integration of PartialFormer with two prominent techniques to enhance parameter efficiency: 1) the weight sharing method (Lan et al., 2020), and 2) gated linear units (Dauphin et al., 2017). To ensure the utilization of the latest advancements, we employ a state-of-the-art weight sharing method called ODE Transformer (Li et al., 2022), known for its effectiveness in promoting parameter efficiency in Transformer architectures. Additionally, we incorporate Swi-GLU (Shazeer, 2020), a widely adopted GLUvariant that has served as a foundational component in numerous expressive Transformer architectures.
|
| 360 |
+
|
| 361 |
+
Table 10: The details of datasets of 9 translation tasks.
|
| 362 |
+
|
| 363 |
+
<table><tr><td rowspan="2">Dataset</td><td colspan="3">Sentence</td><td rowspan="2">BPE</td><td rowspan="2">Vocab</td></tr><tr><td>Train</td><td>Dev</td><td>Test</td></tr><tr><td>WMT'14 En-De</td><td>4.5M</td><td>2999 26815</td><td>3003</td><td>32K 32K</td><td>34040 37288</td></tr><tr><td>WMT'14 En-Fr WMT'16 En-Ro</td><td>36M 0.6M</td><td>1999</td><td>3003 1999</td><td>20K</td><td>19064</td></tr><tr><td>WMT'17 En-De</td><td>5.9M</td><td>7998</td><td>3004</td><td>32K</td><td>35488</td></tr><tr><td>WMT'17 De-En</td><td>5.9M</td><td>7998</td><td>3004</td><td>32K</td><td>35448</td></tr><tr><td>WMT'17 En-Fi</td><td>2.7M</td><td>4225</td><td>3002</td><td>32K</td><td>32584</td></tr><tr><td>WMT'17Fi-En</td><td>2.7M</td><td>4225</td><td>3002</td><td>32K</td><td>32584</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>WMT'17 En-Lv WMT'17Lv-En</td><td>4.5M 4.5M</td><td>2003 2003</td><td>2001 2001</td><td>20K 20K</td><td>32368 32368</td></tr></table>
|
| 364 |
+
|
| 365 |
+
Table 11: The training setups of WMT’14 En-De, WMT’16 En-Ro and WMT’14 En-Fr tasks.
|
| 366 |
+
|
| 367 |
+
<table><tr><td colspan="4">Hyper-parameter WMT'14 En-De WMT'16En-Ro WMT'14 En-Fr</td></tr><tr><td>GPUs</td><td>8</td><td>4</td><td>8</td></tr><tr><td>Batch Size</td><td>4096</td><td>4096</td><td>4096</td></tr><tr><td>Update Frequency</td><td>2</td><td>1</td><td>8</td></tr><tr><td>Optimer</td><td>Adam</td><td>Adam</td><td>Adam</td></tr><tr><td>Adamβ</td><td>(0.9,0.997)</td><td>(0.9, 0.997)</td><td>(0.9, 0.997)</td></tr><tr><td>LR</td><td>0.0020</td><td>0.0020</td><td>0.0020</td></tr><tr><td>LR scheduler</td><td>inverse sqrt</td><td>inverse sqrt</td><td>inverse sqrt</td></tr><tr><td>InitialLR</td><td>1e-7</td><td>1e-7</td><td>le-7</td></tr><tr><td>Total updates</td><td>50K</td><td>25K</td><td>100K</td></tr><tr><td>Warmup updates</td><td>16000</td><td>8000</td><td>16000</td></tr><tr><td>Weight decay</td><td>0.0000</td><td>0.0000</td><td>0.0000</td></tr><tr><td>Label smoothing</td><td>0.1</td><td>0.1</td><td>0.1</td></tr><tr><td>Dropout</td><td>0.1</td><td>0.1</td><td>0.1</td></tr><tr><td>Attention dropout</td><td>0.1</td><td>0.1</td><td>0.1</td></tr><tr><td>ReLU dropout</td><td>0.1</td><td>0.1</td><td>0.1</td></tr></table>
|
| 368 |
+
|
| 369 |
+
Table 12: The training setups of WMT’17 benchmark.
|
| 370 |
+
|
| 371 |
+
<table><tr><td colspan="3">Hyper-parameterI En-{De,Lv} {De,Lv}-En</td><td>En-Fi</td><td>Fi-En</td></tr><tr><td>GPUs</td><td>8</td><td>8</td><td>8</td><td>8</td></tr><tr><td>Batch Size</td><td>4096</td><td>4096</td><td>4096</td><td>4096</td></tr><tr><td>Update Frequency</td><td>2</td><td>1</td><td>1</td><td>4</td></tr><tr><td>Optimer</td><td>Adam</td><td>Adam</td><td>Adam</td><td>Adam</td></tr><tr><td>Adamβ</td><td>(0.9, 0.997)</td><td>(0.9, 0.997)</td><td>(0.9,0.997) (0.9,0.997)</td><td></td></tr><tr><td>LR</td><td>0.0020</td><td>0.0020</td><td>0.0020</td><td>0.0020</td></tr><tr><td>LR scheduler</td><td>inverse sqrt</td><td>inverse sqrt</td><td>inverse sqrt</td><td>inverse sqrt</td></tr><tr><td>Initial LR</td><td>1e-7</td><td>1e-7</td><td>1e-7</td><td>le-7</td></tr><tr><td>Total updates</td><td>50K/17K</td><td>50K/17K</td><td>40K</td><td>10K</td></tr><tr><td>Warmup updates</td><td>16000</td><td>16000</td><td>16000</td><td>16000</td></tr><tr><td>Weight decay</td><td>0.0000</td><td>0.0000</td><td>0.0000</td><td>0.0000</td></tr><tr><td>Label smoothing</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td></tr><tr><td>Dropout</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td></tr><tr><td>Attention dropout</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td></tr><tr><td>ReLU dropout</td><td>0.1</td><td>0.1</td><td>0.1</td><td>0.1</td></tr></table>
|
| 372 |
+
|
| 373 |
+
Table 15 displays the results of combining PartialFormer with weight sharing and gated linear units. Despite the integration of these two techniques, the performance gains are marginal. This could be attributed to the fact that PartialFormer already possesses high parameter efficiency, leaving little room for additional enhancements from other technologies. In other words, PartialFormer is inherently a high parameter efficiency architecture.
|
| 374 |
+
|
| 375 |
+
Table 13: Comparison with state-of-the-art models of smaller capacities on the En-De task.
|
| 376 |
+
|
| 377 |
+
<table><tr><td>Model</td><td>Param BLEU</td></tr><tr><td>DELIGHT (Mehta et al., 2021) EdgeFormer (Ge et al., 2022) Lite Transformer (Wu et al.,2020) PartialFormer</td><td>23M 26.70 - 26.90 - 26.50 27M 27.50</td></tr><tr><td>Evolved Transformer (So et al., 2019) DELIGHT (Mehta et al., 2021) ODE Transformer (Li et al., 2022) PartialFormer</td><td>48M 27.70 37M 27.60 37M 28.24 36M 28.35</td></tr></table>
|
| 378 |
+
|
| 379 |
+
Table 14: Results of several PartialFormer variants on the En-De task.
|
| 380 |
+
|
| 381 |
+
<table><tr><td>AG</td><td>AL</td><td>Param</td><td>BLEU</td></tr><tr><td>RPR</td><td>MHSA</td><td>62M</td><td>35.76</td></tr></table>
|
| 382 |
+
|
| 383 |
+
Table 15: Results of PartialFormer variants on the EnDe task.
|
| 384 |
+
|
| 385 |
+
<table><tr><td>Model</td><td>Param</td><td>BLEU</td></tr><tr><td>PartialFormer</td><td>67M</td><td>29.56</td></tr><tr><td>PartialFormer + Weight Sharing</td><td>67M</td><td>29.71</td></tr><tr><td>GLU-based PartialFormer</td><td>67M</td><td>29.67</td></tr></table>
|
| 386 |
+
|
| 387 |
+
# F Analysis on Token Uniformity
|
| 388 |
+
|
| 389 |
+
Following (Dong et al., 2021; Wang et al., 2022), we measure the token uniformity among token representations. We use pearson correlation to compute it.
|
| 390 |
+
|
| 391 |
+
From Figure 5, we can observe that PartialFormer owns a lower token uniformity among token representations than the vanilla Transformer, revealing that PartialFormer can benefit from depth scaling efficiently (Dong et al., 2021; Wang et al., 2022).
|
| 392 |
+
|
| 393 |
+
# G Preliminary Experiments on Language Modeling
|
| 394 |
+
|
| 395 |
+
We also evaluate the effectiveness of PartialFormer on the language modeling task. We can see that
|
| 396 |
+
|
| 397 |
+

|
| 398 |
+
Figure 5: Comparison of token uniformity (lower is better) in Transformer and PartialFormer.
|
| 399 |
+
|
| 400 |
+
PartialFormer can also show better results compared to strong baseline, e.g., Adaptive Input Transformer (Baevski and Auli, 2019). We will present more comprehensive experiments in the future.
|
| 401 |
+
|
| 402 |
+
<table><tr><td>Model</td><td>Depth 0 (M) Test PPL</td></tr><tr><td>Adaptive Input</td><td>8 147M 21.11</td></tr><tr><td>PartialFormer</td><td>16 143M 19.87</td></tr></table>
|
| 403 |
+
|
| 404 |
+
Table 16: Results on the WikiText-103 dataset.
|
md/dev/NPJznfA7ZC/NPJznfA7ZC.md
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Demystifying Prompts in Language Models via Perplexity Estimation
|
| 2 |
+
|
| 3 |
+
Hila Gonen1,2 Srini Iyer2 Terra Blevins1 Noah A. Smith1,3 Luke Zettlemoyer1,
|
| 4 |
+
|
| 5 |
+
1Paul G. Allen School of Computer Science & Engineering, University of Washington 2Meta AI Research 3Allen Institute for Artificial Intelligence hilagnn@gmail.com sviyer@meta.com {blvns,nasmith,lsz}@cs.washington.edu
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
Language models can be prompted to perform a wide variety of tasks with zero- and few-shot incontext learning. However, performance varies significantly with the choice of prompt, and we do not yet understand why this happens. In this paper, we analyze the factors that contribute to this variance and establish a new empirical hypothesis: the performance of a prompt is predicted by the extent to which the model is familiar with the language it contains. Over a wide range of tasks, we show that the lower the perplexity of the prompt, the better it is able to perform the task, when considering reasonable prompts that are related to it. As part of our analysis, we also devise a method to automatically extend a small seed set of manually written prompts by paraphrasing with GPT3 and backtranslation. This larger set allows us to verify that perplexity is a strong predictor of the success of a prompt and we show that the lowest perplexity prompts are consistently effective.
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
Language models can be prompted to perform a wide range of zero- and few-shot learning tasks (Brown et al., 2020; Schick and Schütze, 2020). However, there is significant variance in the performance of seemingly similar prompts (Chen et al., 2022): for AG News (Zhang et al., 2015), we find an over 30 point accuracy gap between different manually curated prompts (see Table 1) on OPT 175B (Zhang et al., 2022). Despite efforts to improve prompt engineering (Shin et al., 2020; Li and Liang, 2021; Gao et al., 2021), it is still challenging to develop high-quality prompts for new tasks, and little is known about why this phenomenon occurs.
|
| 14 |
+
|
| 15 |
+
We are interested in understanding what makes some prompts better than others, and using this understanding to create better prompts for given tasks and models. We hypothesize that the lower the perplexity of a prompt is, the better its performance on the task will be, when considering reasonable prompts that are related to the task. This is based on the intuition that the more frequently the prompt (or very similar phrases) appears in the training data, the more the model is familiar with it and is able to perform the described task. We refrain from using the training data directly as it is often unavailable, expensive to search due to its size, and hard to use for approximate matching of similar prompts. Instead, we focus on the perplexity of the prompt as a proxy for its occurrences in the data.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: Accuracy vs. perplexity for the AG News dataset with OPT 175B. The $x$ axis is in log scale. Each point stands for a different prompt.
|
| 19 |
+
|
| 20 |
+
To enable more complete analysis, we automatically expand the set of manually created prompts for the task by paraphrasing, resulting in a much larger and diverse set of prompts. We focus on prompts in English that reasonably describe the task for two reasons: (a) our main motivation is to understand what lies under the variance of performance in this type of prompt; (b) we aim to devise a useful method for creating prompts that are consistently effective, that could be easily adopted and interpreted by future, potentially non-expert users.
|
| 21 |
+
|
| 22 |
+
We show empirically that our hypothesis holds across a diverse set of tasks (including classification and word prediction), models, and model sizes, providing us some insights about the underlying mechanism of prompting (see Figure 1). As a result, we devise a method, SPELL (Selecting Prompts by Estimating LM Likelihood), for creating prompts in an informed manner. We show that using SPELL to choose prompts results in less variability in performance as well as in accuracy gains (1.8 accuracy points with OPT and 2.3 accuracy points with Bloom on average). Importantly, our method does not require labels at all, only a small sample of inputs for the task.
|
| 23 |
+
|
| 24 |
+
Our contributions can be summarized as follows: (a) we formalize the notion that better familiarity of the model with the prompt correlates with better performance (Section 2); (b) we automatically elaborate a given set of seed prompts using paraphrasing (Section 3); (c) we establish experimentally the hypothesis that lower perplexity of the prompt correlates well with better performance (Section 5); (d) we devise a method to create a more consistent set of prompts, that also improve results even with no labels for the task (Section 7).
|
| 25 |
+
|
| 26 |
+
# 2 Why are prompts not all created equal?
|
| 27 |
+
|
| 28 |
+
Despite the popularity of prompting as a method for using language models (Shin et al., 2020; Li and Liang, 2021; Gao et al., 2021), the cause for the different behavior of various prompts remains unclear so far. Table 1 shows four example prompts for a news topic classification task (AG News) and their respective accuracies when used to prompt OPT 175B (Zhang et al., 2022). The accuracy gap between the different prompts is not trivial, and it is not possible to predict from the prompts alone.
|
| 29 |
+
|
| 30 |
+
Table 1: Example prompts for the task AG News (news classification) that vary considerably in accuracy.
|
| 31 |
+
|
| 32 |
+
<table><tr><td>Prompt</td><td>Accuracy</td></tr><tr><td>What is this piece of news regarding?</td><td>40.9</td></tr><tr><td>What is this article about?</td><td>52.4</td></tr><tr><td>What is the best way to describe this article?</td><td>68.2</td></tr><tr><td>What is the most accurate label for this news article?</td><td>71.2</td></tr></table>
|
| 33 |
+
|
| 34 |
+
We propose that the more frequently a prompt appears in some variation in the data, the better it works for the task. The intuition behind this is that a sequence that is more expected by the model is more likely to aid the model to extract the relevant information. However, this premise is hard to measure accurately: most language models use huge amounts of training data (e.g., OPT uses a corpus of roughly 180B tokens, and Bloom uses roughly 366B tokens), and in addition, this training data is not always publicly available (e.g., GPT3; Brown et al. 2020). Our initial attempts to estimate exact-match occurrences of prompts in the data resulted in very sparse counts, which led us to look for a softer formalization.1
|
| 35 |
+
|
| 36 |
+
Instead of considering the training data directly, we propose to focus on the perplexity of the prompt as a proxy for its occurrences in some form in the data – essentially indicating to what extent the model expects this prompt. This perplexity-based framing helps to avoid the challenge of exact match in the data, and takes into account variations of the prompt that the model is also exposed to and might be influenced by. In addition, it helps overcome the challenges mentioned above as it requires neither access to the pretraining data (which is not always publicly available for LMs) nor matching over huge amounts of text.
|
| 37 |
+
|
| 38 |
+
Hypothesis: lower perplexity correlates with better performance. We hypothesize that on average, lower-perplexity prompts perform better. We are interested in establishing this hypothesis by experimentally showing a significant negative correlation between the perplexity of the prompt and its performance on the task, across a diverse set of tasks and models.
|
| 39 |
+
|
| 40 |
+
We define the perplexity of the prompt as the perplexity of the full prompt sequence, including the input itself, and without the label, averaged over 1,000 examples (see Section 4 for details). The input is a part of the prompt in the case of the word prediction tasks by design (e.g., “The opposite of the word good is”). Inclusion of the task input as part of the prompt for classification tasks as well is intentional: we want to ground the prompt to the task (without the input, we are testing the hypothesis that lower perplexity prompts across all tasks work better on every task). The label is not considered a part of the prompt and is not taken into consideration when computing the prompt. In practice, this also results in a huge advantage of our method, SPELL (Section 7), which aims to find better prompts—it does not require any labels.
|
| 41 |
+
|
| 42 |
+
For performance measures, we use the loglikelihood score assigned by the model to the correct label given that prompt. We choose this metric over accuracy as it gives a more fine-grained distinction between prompts and because accuracy can be unstable, as explained in more detail in Section 4. For classification tasks, we also report correlation with accuracy, which is the main evaluation metric for this type of task.
|
| 43 |
+
|
| 44 |
+
# 3 Automatic Expansion of Seed Prompts
|
| 45 |
+
|
| 46 |
+
We are interested in expanding our pool of prompts in order to: (a) have a more diverse set of prompts, making it more likely to find a better prompt for our task, and (b) support better analysis to validate our prompt quality hypothesis. In this section, we describe our method for automatically expanding a seed set of manually created prompts using paraphrasing.
|
| 47 |
+
|
| 48 |
+
Step 0: Creating a seed set of manually-written prompts We first write/collect a small set of human written prompts that describe the task. For classification tasks we assume that the input appears before the prompt, with no choices appearing as part of the prompt (to help in smooth paraphrasing of the prompt itself).
|
| 49 |
+
|
| 50 |
+
Step 1: Paraphrasing with GPT3 We use the text-davinci-002 version of GPT3 (Brown et al., 2020) to generate paraphrases for each of the manual prompts in our seed set. We prompt it with a meta-prompt for paraphrasing to generate variations of one of our seed prompts. An example of such a meta-prompt is: Write a paraphrase for the following sentence: <seed prompt> Paraphrase:. The 7 meta-prompts used in this step are listed in Table 2.
|
| 51 |
+
|
| 52 |
+
We choose GPT3 as our paraphrasing model because of its well-documented generation abilities. This is also to ensure that there is a separation between the model we use to create the prompts and the models we use to rank them (OPT and Bloom, see Section 4 for details), to avoid confounding the experimental setup.
|
| 53 |
+
|
| 54 |
+
Step 2: Paraphrasing using backtranslation Our second step takes as input the paraphrases from GPT3 (in addition to the seed set of prompts) and translates them into different languages and back into English to get additional prompt paraphrases (Wieting et al., 2017). We use a set of 8 languages available in the NLLB translation model (Costajussà et al., 2022) that are relatively high resource and close to English,2 to reduce the risk of noise. Since we aim to get about 100 prompts per task, we add 8 additional languages3 in the case where the basic 8 languages yielded too few alternatives. For word prediction tasks, we use the sequence of the created prompt up to the index of the label, not including the label, for example: The word “dog” in French is “. Depending on the task, we enforce the existence of specific words (e.g., the name of the language, and the source word, in word-level translation) or enforce the prompt to be a question.
|
| 55 |
+
|
| 56 |
+
Examples and Statistics Table 4 lists all 4 manually created prompts we use for the AG News task (news classification), alongside a few sampled prompts created automatically using our method. As was typically the case, we are able to get prompts that are rather different in phrasing and structure from those included in the seed set.
|
| 57 |
+
|
| 58 |
+
The statistics of the prompts in the manually created seed set (Step 0) as well as the prompts after Step 1 and Step 2 for each task (see Section 4.1 for details about the tasks) are detailed in Table 3.
|
| 59 |
+
|
| 60 |
+
# 4 Experimental Setup
|
| 61 |
+
|
| 62 |
+
# 4.1 Models, Tasks and Datasets
|
| 63 |
+
|
| 64 |
+
We study four auto-regressive models: OPT (Zhang et al., 2022) of different sizes (1.3B, 30B, 175B parameters), all trained mainly on English,4 and Bloom (176B parameters; Luccioni et al. 2022), which is trained on 46 natural languages and 13 programming languages. We experiment with two types of tasks: word prediction tasks and classification tasks, as detailed below.
|
| 65 |
+
|
| 66 |
+
Word Prediction Tasks The first task in this category is word-level translation. Given a source word in English and a target language, we expect the model to predict the correct translation. For this task we use NorthEuraLex5 (Dellert et al., 2019), a lexical database providing translations of 1016 words into 107 languages. We experiment with 9 languages that use the Latin script. For Bloom, we use 5 additional languages that do not use the
|
| 67 |
+
|
| 68 |
+
Table 2: Meta prompts used in Step 1 of our method for paraphrasing using GPT3.
|
| 69 |
+
|
| 70 |
+
<table><tr><td>Meta prompts</td></tr><tr><td>Write a paraphrase for the following sentence: <seed-prompt> Paraphrase: <seed-prompt> Paraphrase:</td></tr><tr><td>Write a likely paraphrase of the text: <seed-prompt> Paraphrase:</td></tr><tr><td>Write a sentence similar to the following one: <seed-prompt> Paraphrase:</td></tr><tr><td>Paraphrase the following sentence: <seed-prompt> Paraphrase:</td></tr><tr><td>Write a variation of this sentence: <seed-prompt> How would you say the following sentence in a different way? <seed-prompt></td></tr></table>
|
| 71 |
+
|
| 72 |
+
Table 3: Number of prompts for the different tasks: prompts after step 0 (creating prompts manually), prompts after step 1 (GPT3 paraphrasing), and prompts after step 2 (backtranslation).
|
| 73 |
+
|
| 74 |
+
<table><tr><td>Task</td><td># Step 0</td><td># Step 1 # Step 2</td></tr><tr><td>Word-Level Translation</td><td>12 59</td><td>118</td></tr><tr><td>Antonyms</td><td>12 85</td><td>176</td></tr><tr><td>GLUE Cola</td><td>4 27</td><td>144</td></tr><tr><td>Newspop</td><td>13 43</td><td>119</td></tr><tr><td>AG News</td><td>4 23</td><td>108</td></tr><tr><td>IMDB</td><td>10 45</td><td>178</td></tr><tr><td>DBpedia</td><td>8 23</td><td>103</td></tr><tr><td>Emotion</td><td>4 14</td><td>94</td></tr><tr><td>Tweet Offensive</td><td>5 41</td><td>119</td></tr></table>
|
| 75 |
+
|
| 76 |
+
Latin script (since Bloom is multilingual). Note that only 5 of the languages we experiment with are officially covered by Bloom.6
|
| 77 |
+
|
| 78 |
+
We also consider antonym prediction where, given a word, the model is expected to predict its antonym. For this task, we use data from Kaggle,7 which is based on WordNet (Miller, 1995). We choose 1,000 word pairs at random.
|
| 79 |
+
|
| 80 |
+
Classification Tasks We choose classification tasks from Huggingface Datasets,8 with an attempt to have a set of diverse tasks that use relatively short inputs, with some prompts available in PromptSource (Bach et al., 2022):9 (a) GLUE Cola (grammaticality; Warstadt et al. 2018); (b) Newspop (news classification; Moniz and Torgo 2018); (c) AG News (news classification; Zhang et al. 2015); (d) IMDB (movie review classification; Maas et al. 2011); (e) DBpedia (topic classification; Lehmann et al. 2015); (f) Emotion (classification to emotions; Saravia et al. 2018); (g) Tweet Offensive (classification to offensive vs. not offensive tweets; Barbieri et al. 2020). We use 1,000 random examples from each dataset.
|
| 81 |
+
|
| 82 |
+
The full set of manual prompts is listed in Section A in the Appendix. In these tasks, the prompt follows the input, and at the end of each prompt we add the choices of classes (i.e., we provide the possible labels explicitly in the prompt by listing the possible answers as defined by the dataset itself.): “Choices: X, Y, Z. Answer:” as we find it helps in terms of accuracy. Defining the label space likely helps in our zero-shot setting because there are no previous demonstrations from which the model can learn the possible classes. Additionally, adding class options to the prompt helps to reduce the effect of the surface form competition (Holtzman et al., 2021). The option of generating the answer and comparing it with the gold label was not reasonable here, since we cannot expect the model to generate the exact label as the first choice often enough.
|
| 83 |
+
|
| 84 |
+
# 4.2 Implementation Details
|
| 85 |
+
|
| 86 |
+
In all experiments we evaluate zero-shot performance. To avoid noise when computing perplexity, we instantiate the prompts with 1,000 examples of the dataset, compute the perplexity of the prompt with each example, and calculate the average across all instantiated prompts.
|
| 87 |
+
|
| 88 |
+
To estimate the performance of the prompt, we look at two measures: (a) the language model score (log probability) of the correct label, averaged across 1,000 examples; (b) the accuracy on the task, computed over the 1,000 examples. To compute accuracy, for each example we score all classes and choose the highest ranking class as the prediction of the model. The score of a label of multiple tokens is defined by the sum of the token
|
| 89 |
+
|
| 90 |
+
Table 4: Prompts for the task AG News (news classification): the manually created prompts and a sample of automatically created prompts using our method.
|
| 91 |
+
|
| 92 |
+
<table><tr><td>All Manually Created Prompts</td><td>Examples of Similar Automatically Created Prompts</td></tr><tr><td>What label best describes this news article?</td><td>What's the most accurate label for this news article?</td></tr><tr><td>What is this piece of news regarding? Which newspaper section would this article likely appear in?</td><td>What does this piece of news concern?</td></tr><tr><td>What topic is this news article about?</td><td>In what section of the newspaper could this article be published? What category does this article fall into?</td></tr></table>
|
| 93 |
+
|
| 94 |
+
Table 5: Correlation results for the different tasks, with OPT (different sizes) and Bloom. Correlations with $p < 0 . 0 5$ are marked with \*. Correlations with $p < 0 . 0 0 6 2 5$ (according to Bonferroni correction for multiple hypotheses) are marked with $^ { * * }$ . Dark and light blue colored cells stand for negative correlations $< - 0 . 2$ and $> - 0 . 2$ , respectively. Dark and light orange colored cells stand for positive correlations $> 0 . 2$ and $< 0 . 2$ , respectively. Average accuracy across all prompts and average accuracy of best $50 \%$ prompts are also reported for reference (Avg Acc and Acc $50 \%$ , respectively).
|
| 95 |
+
|
| 96 |
+
<table><tr><td>Model</td><td>Task</td><td colspan="2">Perplexity-score corr. Pearson Spearman</td><td colspan="2">Perplexity-acc corr. Pearson Spearman</td><td rowspan="2"> Avg Acc</td><td rowspan="2"> Acc 50%</td></tr><tr><td rowspan="8">OPT175B</td><td>Antonyms</td><td>**-0.41</td><td>**-0.53</td><td></td><td></td></tr><tr><td>GLUE Cola</td><td>-0.15</td><td>-0.14</td><td>-0.04</td><td>1 -0.02</td><td>1 47.7</td><td>1 57.1</td></tr><tr><td>Newspop</td><td>*-0.24</td><td>**-0.26</td><td> *-0.20</td><td>-0.18</td><td>66.4</td><td>72.9</td></tr><tr><td>AG News</td><td>**-0.63</td><td> **-0.68</td><td> **-0.77</td><td>**-0.81</td><td>57.5</td><td>68.7</td></tr><tr><td>IMDB</td><td>**0.35</td><td>**0.40</td><td>0.14</td><td>*0.20</td><td>86.2</td><td>91.0</td></tr><tr><td>DBpedia</td><td> **-0.50</td><td>**-0.44</td><td> **-0.51</td><td>**-0.42</td><td>46.7</td><td>55.2</td></tr><tr><td>Emotion</td><td>-0.14</td><td>-0.19</td><td> **-0.30</td><td> **-0.32</td><td>16.4</td><td>23.0</td></tr><tr><td>Tweet Offensive</td><td>*-0.19</td><td>0.07</td><td>0.18</td><td>*0.23</td><td>51.3</td><td>55.8</td></tr><tr><td rowspan="8">Bloom 176B</td><td>Antonyms</td><td>**-0.37</td><td>**-0.23</td><td></td><td></td><td>1</td><td>1</td></tr><tr><td>GLUE Cola</td><td>0.07</td><td>0.11</td><td>**-0.25</td><td>**-0.26</td><td>55.5</td><td>65.6</td></tr><tr><td>Newspop</td><td>**-0.50</td><td>**-0.42</td><td> **-0.59</td><td> **-0.51</td><td>78.9</td><td>87.8</td></tr><tr><td>AG News</td><td>**-0.62</td><td> **-0.54</td><td>**-0.44</td><td>**-0.44</td><td>50.3</td><td>59.4</td></tr><tr><td>IMDB</td><td>0.04</td><td>0.09</td><td>-0.08</td><td>-0.14</td><td>89.3</td><td>92.2</td></tr><tr><td>DBpedia</td><td>**-0.47</td><td> *-0.27</td><td>**-0.35</td><td>*-0.21</td><td>27.2</td><td>33.4</td></tr><tr><td>Emotion</td><td>**-0.33</td><td> **-0.42</td><td>**-0.48</td><td>**-0.55</td><td>29.3</td><td>31.7</td></tr><tr><td>Tweet Offensive</td><td>0.14</td><td>*0.24</td><td> *-0.20</td><td>-0.03</td><td>41.6</td><td>46.2</td></tr><tr><td rowspan="8">OPT 30B</td><td> Antonyms</td><td> **-0.54</td><td>**-0.70</td><td>1</td><td>1</td><td>1</td><td>1</td></tr><tr><td>GLUE Cola</td><td>-0.05</td><td>0.03</td><td>-0.13</td><td>0.02</td><td>32.2</td><td>35.5</td></tr><tr><td>Newspop</td><td>*-0.23</td><td> *-0.25</td><td>*-0.18</td><td>-0.12</td><td>60.3</td><td>66.6</td></tr><tr><td>AG News</td><td>**-0.66</td><td> **-0.71</td><td> **-0.81</td><td>**-0.80</td><td>49.3</td><td>60.7</td></tr><tr><td>IMDB</td><td>-0.06</td><td>*0.17</td><td>0.04</td><td>**0.22</td><td>81.6</td><td>86.1</td></tr><tr><td>DBpedia</td><td> **-0.41</td><td> **-0.34</td><td>*-0.21</td><td>*-0.25</td><td>35.9</td><td>42.4</td></tr><tr><td>Emotion</td><td>0.00</td><td>-0.03</td><td>0.18</td><td>0.13</td><td>12.3</td><td>16.2</td></tr><tr><td>Tweet Offensive</td><td>**-0.44</td><td>**-0.39</td><td>-0.11</td><td>-0.05</td><td>54.6</td><td>60.2</td></tr><tr><td rowspan="8">OPT 1.3B</td><td>Antonyms</td><td> **-0.45</td><td>**-0.53</td><td></td><td></td><td>1</td><td></td></tr><tr><td>GLUE Cola</td><td> **-0.39</td><td> **-0.36</td><td>-0.09</td><td>*-0.19</td><td>60.3</td><td>1 65.9</td></tr><tr><td>Newspop</td><td>**0.33</td><td>*0.21</td><td>-0.07</td><td>-0.07</td><td>37.6</td><td>40.3</td></tr><tr><td>AG News</td><td>**-0.33</td><td>**-0.29</td><td> **-0.56</td><td> **-0.49</td><td>31.9</td><td>37.6</td></tr><tr><td>IMDB</td><td>-0.11</td><td>-0.07</td><td>**0.24</td><td>**0.22</td><td>86.0</td><td>89.1</td></tr><tr><td>DBpedia</td><td>-0.16</td><td>-0.14</td><td>-0.02</td><td>-0.01</td><td>8.7</td><td>9.2</td></tr><tr><td>Emotion</td><td>0.08</td><td>0.08</td><td>**-0.29</td><td>**-0.30</td><td>7.0</td><td>9.1</td></tr><tr><td>Tweet Offensive</td><td>**-0.42</td><td>**-0.35</td><td> **-0.50</td><td>**-0.38</td><td>58.6</td><td>62.6</td></tr></table>
|
| 97 |
+
|
| 98 |
+
scores.
|
| 99 |
+
|
| 100 |
+
For the word prediction tasks we only report scores, since accuracy in general is less stable, suffers more from the surface form competition (Holtzman et al., 2021), and is usually quite low for these tasks in our setting (the chances the model will generate an exact match of the label are low). Hence, the score of the correct label gives a better estimate of the actual performance of the model.
|
| 101 |
+
|
| 102 |
+
Table 6: Correlation results for word-level translation, with OPT 175B and Bloom 176B. All correlations are statistically significant also according to Bonferroni correction for multiple hypotheses for OPT $( p < 0 . 0 0 5 5 )$ . Same for Bloom $( p \textless 0 . 0 0 3 5 7 )$ , except for Catalan (Pearson) and Japanese (Spearman).
|
| 103 |
+
|
| 104 |
+
<table><tr><td rowspan="2">Lang</td><td colspan="2">OPT175B</td><td rowspan="2">Bloom 176B Pearson</td><td rowspan="2">Spear.</td></tr><tr><td>Pearson</td><td>Spear.</td></tr><tr><td>ita</td><td>-0.44</td><td>-0.57</td><td>-0.37</td><td>-0.63</td></tr><tr><td>spa</td><td>-0.47</td><td>-0.61</td><td>-0.51</td><td>-0.66</td></tr><tr><td>cat</td><td>-0.47</td><td>-0.58</td><td>-0.24</td><td>-0.31</td></tr><tr><td>fra</td><td>-0.48</td><td>-0.57</td><td>-0.48</td><td>-0.64</td></tr><tr><td>deu</td><td>-0.44</td><td>-0.60</td><td>-0.46</td><td>-0.65</td></tr><tr><td>fin</td><td>-0.44</td><td>-0.62</td><td>-0.34</td><td>-0.56</td></tr><tr><td>por</td><td>-0.45</td><td>-0.62</td><td>-0.46</td><td>-0.61</td></tr><tr><td>eus</td><td>-0.47</td><td>-0.61</td><td>-0.45</td><td>-0.61</td></tr><tr><td>tur</td><td>-0.44</td><td>-0.62</td><td>-0.33</td><td>-0.62</td></tr><tr><td>jpn</td><td></td><td></td><td>-0.33</td><td>-0.26</td></tr><tr><td>arb</td><td></td><td></td><td>-0.36</td><td>-0.47</td></tr><tr><td>rus</td><td>1</td><td></td><td>-0.54</td><td>-0.69</td></tr><tr><td>kor</td><td></td><td></td><td>-0.42</td><td>-0.58</td></tr><tr><td>ell</td><td></td><td></td><td>-0.40</td><td>-0.51</td></tr></table>
|
| 105 |
+
|
| 106 |
+
# 5 Results
|
| 107 |
+
|
| 108 |
+
Classification Tasks and Antonym Prediction Table 5 depicts the Pearson and Spearman correlation results on the classification tasks and the antonym task, with both OPT 175B and Bloom (two upper blocks). We see that most correlations are negative and statistically significant, as we expect. This validates our hypothesis and shows that in the majority of tasks we indeed get a strong correlation between low perplexity of the prompt and better performance on the task.10 For each task we also report the average accuracy.
|
| 109 |
+
|
| 110 |
+
Word-Level Translation The results of the wordlevel translation task are reported in Table 6. Here the correlations are extremely consistent across all languages and across models, with statistical significance for all languages except for Catalan and Japanese (in Bloom).
|
| 111 |
+
|
| 112 |
+
Results across Different Model Sizes We repeat the same experiment with the OPT models of sizes 1.3B and 30B, to investigate whether these correlations are also consistent across model sizes or whether this is a phenomenon we should expect only in large language models. Table 5 (two lower blocks) shows these results for all classification tasks and antonym prediction. We do see that in general the trend appears to be the same in the smaller models as well; however, the correlations seem to be slightly weaker. We hypothesize that this might be due to the overall lower performance of these smaller models, making the performance results we use for correlation less stable and reliable. For word-level translation, however, all correlations with the 30B and 1.3B models are similar to those with the 175B model, and are all statistically significant (also after Bonferroni correction for multiple hypotheses).
|
| 113 |
+
|
| 114 |
+
# 6 Analysis
|
| 115 |
+
|
| 116 |
+
Next, we further explore the observed relationship between model perplexity and prompt performance. Despite the consistently high correlation between these two factors, the structure of this relationship varies across tasks (Section 6.1). Additionally, we find that the automatically added prompts are highquality and not a significant source of noise (Section 6.2), and that the best prompts selected by our approach vary across models (Section 6.3).
|
| 117 |
+
|
| 118 |
+
# 6.1 Visualizing the Relationship between Perplexity and Performance
|
| 119 |
+
|
| 120 |
+
To visualize the correlations we get between the perplexity and the performance of the prompts across the different settings, we plot a few examples for different tasks and languages. Figures 1 and 2 show some of the results for selected tasks, as detailed in the captions. The negative trend of the correlation is clearly visible in all plots. Interestingly, the structure of the plots for word-level translation are very similar across all the language pairs, suggesting that prompts get consistent perplexity and performance across languages (possibly at different scales). Indeed, the intersection of the 10 lowest perplexity prompts between any two different languages is 8.6 and 8.4 on average (for OPT 175B and Bloom, respectively), which is extremely high. This is not very surprising since we know that the only differences between the prompts in the different languages are the names of the target languages (e.g., The word for “dog” in French is “). Additionally, the intersection of 10 prompts with the highest label score between any two different languages is 7 and 6.5 on average (for OPT 175B and Bloom, respectively).
|
| 121 |
+
|
| 122 |
+
A notable finding that appears in the word-level translation plots is the clear separation between prompts that include or do not include quotation marks for the label (usually aligns with whether the prompt uses quotation marks for the source word) – three example prompts appear on the plot. Prompts with quotation marks for the words tend to have both lower perplexity and better performance, consistently. We further analyze the results for OPT 175B within clusters (with/without quotations marks). In the cluster with quotation marks, we get negative correlations (in the range of $- 0 . 2 8$ to –0.38) that are statistically significant for almost all languages. The correlations within the other cluster are weaker and less significant (this is expected given the overall lower performance of that cluster).
|
| 123 |
+
|
| 124 |
+

|
| 125 |
+
Figure 2: Score of correct label vs. perplexity for the word-level translation task in French with OPT 175B. The $x$ axis is in log scale. The blue points stand for prompts with quotation marks for the words, while the yellow points are of prompts without quotation marks.
|
| 126 |
+
|
| 127 |
+
# 6.2 Effect of Noisy Prompts
|
| 128 |
+
|
| 129 |
+
We expect our automatic method for expanding the set of prompts to also introduce some noise. Though our focus is on the lower perplexity prompts, since we want to benefit from this analysis and be able to devise a method for creating better prompts, we do want to make sure that this potential noise is not the cause for the strong correlations we get. In other words, one might claim that some noisy prompts have particularly high perplexity and also perform badly, thus, supporting our hypothesis in an undesirable and uncontrolled manner.
|
| 130 |
+
|
| 131 |
+
We turn to inspect the $10 \%$ highest perplexity prompts in the different tasks and find subjectively that they are not noisy, and are usually valid prompts for the tasks. The 5 highest perplexity prompts for the GLUE Cola task are listed in Table 7 as an example.
|
| 132 |
+
|
| 133 |
+
Table 7: Example of the 5 highest perplexity prompts for GLUE Cola, using OPT 175B.
|
| 134 |
+
|
| 135 |
+
<table><tr><td>prompt</td><td>ppl</td></tr><tr><td>Is this example correct English usage?</td><td>25.79</td></tr><tr><td>Is this example using English correctly?</td><td>25.46</td></tr><tr><td>Is this example correct English?</td><td>25.33</td></tr><tr><td>Is this the example in correct English?</td><td>25.00</td></tr><tr><td>Is English in this example correct?</td><td>24.90</td></tr></table>
|
| 136 |
+
|
| 137 |
+
Table 8: Correlations before and after filtering out noisy prompts, with AG News and Word-Level Translation (WLT).
|
| 138 |
+
|
| 139 |
+
<table><tr><td rowspan="2">Task</td><td rowspan="2">Lang</td><td colspan="2">Before filtering</td><td colspan="2">After filtering</td></tr><tr><td>Pearson</td><td>Spearman</td><td>Pearson</td><td>Spearman</td></tr><tr><td>AG News</td><td>-</td><td>-0.63</td><td>-0.68</td><td>-0.62</td><td>-0.54</td></tr><tr><td rowspan="9">WLT</td><td>ita</td><td>-0.44</td><td>-0.58</td><td>-0.44</td><td>-0.57</td></tr><tr><td>spa</td><td>-0.47</td><td>-0.61</td><td>-0.47</td><td>-0.61</td></tr><tr><td>cat</td><td>-0.45</td><td>-0.57</td><td>-0.47</td><td>-0.58</td></tr><tr><td>fra</td><td>-0.47</td><td>-0.57</td><td>-0.48</td><td>-0.57</td></tr><tr><td>deu</td><td>-0.43</td><td>-0.60</td><td>-0.44</td><td>-0.60</td></tr><tr><td>fin</td><td>-0.41</td><td>-0.60</td><td>-0.44</td><td>-0.62</td></tr><tr><td>por</td><td>-0.43</td><td>-0.61</td><td>-0.45</td><td>-0.62</td></tr><tr><td>eus</td><td>-0.45</td><td>-0.60</td><td>-0.47</td><td>-0.61</td></tr><tr><td>tur</td><td>-0.43</td><td>-0.61</td><td>-0.44</td><td>-0.62</td></tr></table>
|
| 140 |
+
|
| 141 |
+
As a sanity check, we choose two tasks: wordlevel translation and AG News, manually filter out the noisy prompts, and compute the correlations again. The annotation is done by external annotators (NLP researchers) that were presented with the tasks and asked to label whether the prompt is reasonable to use for the task. The new correlations with OPT 175B are reported in Table 8. We find that all correlations remain strong and statistically significant when noise is manually removed from the analysis. We get the same trends with Bloom as well.
|
| 142 |
+
|
| 143 |
+
# 6.3 Best Performing Prompts
|
| 144 |
+
|
| 145 |
+
Table 9 lists the 5 lowest perplexity prompts for the task of antonym prediction, as an example. Similar lists for the rest of the tasks are listed in Section B in the Appendix.
|
| 146 |
+
|
| 147 |
+
A closer look at the lowest perplexity prompts reveals that the intersection of 10 lowest perplexity prompts between OPT 175B and Bloom is 7.1 on average, across the classification tasks. When looking at the 10 highest accuracy prompts across models we get an average intersection of 3.1 across the classification tasks.
|
| 148 |
+
|
| 149 |
+
Table 9: Lowest perplexity prompts for the antonym prediction task, using OPT 175B.
|
| 150 |
+
|
| 151 |
+
<table><tr><td>prompt</td><td>ppl</td></tr><tr><td>The following two words are antonyms:“good"and “</td><td>10.24</td></tr><tr><td>The antonym of the word“good’is“</td><td>10.32</td></tr><tr><td>The word that has the opposite meaning of the word “good"is “</td><td>10.43</td></tr><tr><td>The word“good’is the antithesis of the word “</td><td>10.85</td></tr><tr><td>The word “good"is the opposite of the word “</td><td>11.15</td></tr></table>
|
| 152 |
+
|
| 153 |
+
# 7 SPELL: Selecting Prompts by Estimating LM Likelihood
|
| 154 |
+
|
| 155 |
+
The primary contribution of this work is the analysis of the relationship between prompt perplexity and downstream task performance (Section 5). As one potential application of our findings, we also present a new method, SPELL, for generating and selecting consistently effective prompts.
|
| 156 |
+
|
| 157 |
+
Assuming a fixed computational budget for finding effective prompts for a given task, and that the search space might be quite large, we devise the following straightforward procedure:
|
| 158 |
+
|
| 159 |
+
1. Obtain a small set of manually created prompts for the task.
|
| 160 |
+
2. Expand the set of prompts with automatic paraphrasing using a LM (e.g., GPT3) and backtranslation (see Section 3).
|
| 161 |
+
3. Rank the list of prompts by perplexity (averaged on a representative sample of task inputs, e.g., 1,000).
|
| 162 |
+
4. Choose the $k$ (e.g., 3) lowest perplexity prompts.
|
| 163 |
+
|
| 164 |
+
Using this algorithm, we show empirically that it is best to prioritize experimenting with the lowest perplexity prompts, as they are more stable (exhibit less variation in performance) and perform better than manual prompts on average. This method also does not require any labels for the task, and is applicable to any task, also by non-experts, given example inputs only.
|
| 165 |
+
|
| 166 |
+
# 7.1 Empirical Validation of SPELL
|
| 167 |
+
|
| 168 |
+
To show the effectiveness of our method, we report the results we get using SPELL across the different tasks. In Table 10 we report the average accuracy with the manual prompts compared to the average accuracy with the 3 lowest-perplexity prompts, for both OPT 175B and Bloom. Indeed, in most cases, the average accuracy using the 3 lowest perplexity prompts outperforms the average accuracy of the manual prompts, with an average of 1.8 accuracy points across tasks with OPT and 2.3 accuracy points with Bloom, demonstrating the effectiveness of our method.
|
| 169 |
+
|
| 170 |
+
Table 10: The average accuracy with the manual prompts (manual) compared to the average accuracy with the 3 lowest-perplexity prompts (low-ppl), for both OPT 175B and Bloom, across tasks.
|
| 171 |
+
|
| 172 |
+
<table><tr><td></td><td colspan="3">OPT</td><td colspan="3">Bloom</td></tr><tr><td>Task</td><td>low-ppl</td><td>manual</td><td>△</td><td>low-ppl</td><td>manual</td><td>△</td></tr><tr><td>GLUE Cola</td><td>51.7</td><td>48.5</td><td>3.1</td><td>64.5</td><td>60.9</td><td>3.6</td></tr><tr><td>Newspop</td><td>80.6</td><td>70.4</td><td>10.2</td><td>90.0</td><td>80.0</td><td>10.0</td></tr><tr><td>AG News</td><td>68.4</td><td>61.9</td><td>6.5</td><td>51.0</td><td>63.5</td><td>-12.5</td></tr><tr><td>IMDB</td><td>90.4</td><td>88.9</td><td>1.4</td><td>91.3</td><td>88.8</td><td>2.5</td></tr><tr><td>DBpedia</td><td>46.0</td><td>51.7</td><td>-5.7</td><td>31.2</td><td>30.2</td><td>1.0</td></tr><tr><td>Emotion</td><td>21.6</td><td>22.6</td><td>-1.1</td><td>35.8</td><td>32.1</td><td>3.6</td></tr><tr><td>Tweet Offensive</td><td>48.4</td><td>50.6</td><td>-2.3</td><td>48.6</td><td>40.8</td><td>7.8</td></tr></table>
|
| 173 |
+
|
| 174 |
+
The variability in accuracy of the 3 lowest perplexity prompts is also much lower than that of the manually created prompts: with OPT 175B, the average standard deviation within the 3 lowest perplexity prompts (across tasks) is 5.07, vs. 6.86 for the manual prompts, and with Bloom the gap is much bigger, with an average of 2.6 for the 3 lowest perplexity prompts vs. 7.47 for the manual ones.11 This further shows that SPELL is more stable and reliable compared to using an arbitrary set of manually created prompts. SPELL sets the stage for further development in this direction, and serves as an initial indication of the benefits of involving perplexity estimation in the process of generating effective prompts.
|
| 175 |
+
|
| 176 |
+
# 8 Related Work
|
| 177 |
+
|
| 178 |
+
Relation between performance and training data Previous work looking directly into the relation between the training data and the performance is limited. Razeghi et al. (2022) study numeric deduction tasks, and examine the correlations between the model performance on specific test instances and the frequency of terms from those instances in the pretraining data. They find that the models are more accurate on instances whose terms are more prevalent in the training data. Additionally, Han and Tsvetkov (2022) propose a method to effectively identify a very small subset of pretraining data that directly supports the model in performing a specific task. Elazar et al. (2022) use causal inference to measure the effect of pretraining data statistics on factual knowledge performance, and
|
| 179 |
+
|
| 180 |
+
Kandpal et al. (2022) show correlational and causal relationships between accuracy and relevant document count (from training data) for QA datasets.
|
| 181 |
+
|
| 182 |
+
Prompt tuning and analysis There is a very rich line of work trying to find prompts automatically. Shin et al. (2020) present an automated method to create discrete prompts for a diverse set of tasks, based on a gradient-guided search, and they demonstrate their method on masked LMs. Other work also focuses on discrete prompts, aiming to improve zero-shot performance (Gao et al., 2021; Le Scao and Rush, 2021; Deng et al., 2022; Shi et al., 2022), or trains continuous prompts (Li and Liang, 2021; Lester et al., 2021; Qin and Eisner, 2021).
|
| 183 |
+
|
| 184 |
+
On top of works that suggest a variety of methods for creating better prompts, some work also analyzes those prompts to try and get some insights about them: Khashabi et al. (2022a) find that model performance is highly sensitive to small changes in wordings and Khashabi et al. (2022b) point to a surprising disconnect between continuous and discrete prompts.
|
| 185 |
+
|
| 186 |
+
# Limitations
|
| 187 |
+
|
| 188 |
+
Searching for human-readable prompts We limit our search space to human-readable prompts that are fluent and accurately describe the task at hand, as we are primarily motivated in understanding why some relevant prompts work better than others. We do this by using manually created prompts and their automatically created paraphrases. Our findings may not hold when the possible prompt space is expanded to include any token sequence; we leave this direction to future work.
|
| 189 |
+
|
| 190 |
+
Generality of our analysis and of the SPELL method We perform our analysis on and build our method around specific models, namely OPT and Bloom. Additionally, our study is limited to the specific tasks we experiment with and to English. It is possible that our analysis and SPELL method do not generalize to other pretrained models or tasks; however, we consider models of various sizes and from different sources, and a wide range of tasks to mitigate this risk.
|
| 191 |
+
|
| 192 |
+
# Acknowledgements
|
| 193 |
+
|
| 194 |
+
We thank Alisa Liu and Orevaoghene Ahia for their help in annotating noisy prompts. We also thank the reviewers for their valuable comments on the paper.
|
| 195 |
+
|
| 196 |
+
# 9 Conclusion
|
| 197 |
+
|
| 198 |
+
We investigate the phenomenon where some prompts perform better than others despite appearing similar to the human users of LMs. Specifically, we hypothesize that the perplexity of a prompt under a given LM is closely tied to its task performance. We test this theory on a large number of tasks and autoregressive LMs, and the resulting correlation study validates our hypothesis. Further analysis of this relationship demonstrates that the best prompts differ across models, highlighting the importance of model-specific analysis, and that the underlying structure of the relationship between perplexity and performance varies across tasks.
|
| 199 |
+
|
| 200 |
+
In light of these findings, we then propose a method, SPELL, to help users find wellperforming prompts for new tasks. Empirical validation of the proposed procedure shows that SPELL generates effective prompts with low variability in performance, and produces small gains of 1.8 (2.3) accuracy points with OPT (Bloom) over manual prompts. We therefore conclude that SPELL provides a general and interpretable approach for applying LMs to new tasks while requiring minimal human effort, and no labels.
|
| 201 |
+
|
| 202 |
+
# References
|
| 203 |
+
|
| 204 |
+
Stephen H. Bach, Victor Sanh, Zheng-Xin Yong, Albert Webson, Colin Raffel, Nihal V. Nayak, Abheesht Sharma, Taewoon Kim, M Saiful Bari, Thibault Fevry, Zaid Alyafeai, Manan Dey, Andrea Santilli, Zhiqing Sun, Srulik Ben-David, Canwen Xu, Gunjan Chhablani, Han Wang, Jason Alan Fries, Maged S. Al-shaibani, Shanya Sharma, Urmish Thakker, Khalid Almubarak, Xiangru Tang, Xiangru Tang, Mike Tian-Jian Jiang, and Alexander M. Rush. 2022. Promptsource: An integrated development environment and repository for natural language prompts.
|
| 205 |
+
|
| 206 |
+
Francesco Barbieri, Jose Camacho-Collados, Luis Espinosa-Anke, and Leonardo Neves. 2020. TweetEval:Unified Benchmark and Comparative Evaluation for Tweet Classification. In Proceedings of Findings of EMNLP.
|
| 207 |
+
|
| 208 |
+
Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. 2020. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901.
|
| 209 |
+
|
| 210 |
+
Yanda Chen, Chen Zhao, Zhou Yu, Kathleen McKeown, and He He. 2022. On the relation between sensitivity and accuracy in in-context learning. arXiv e-prints, pages arXiv–2209.
|
| 211 |
+
|
| 212 |
+
Marta R Costa-jussà, James Cross, Onur Çelebi, Maha Elbayad, Kenneth Heafield, Kevin Heffernan, Elahe Kalbassi, Janice Lam, Daniel Licht, Jean Maillard, et al. 2022. No language left behind: Scaling human-centered machine translation. arXiv preprint arXiv:2207.04672.
|
| 213 |
+
|
| 214 |
+
Johannes Dellert, Thora Daneyko, Alla Münch, Alina Ladygina, Armin Buch, Natalie Clarius, Ilja Grigorjew, Mohamed Balabel, Hizniye Isabella Boga, Zalina Baysarova, et al. 2019. Northeuralex: a widecoverage lexical database of northern eurasia. Language Resources and Evaluation, pages 1–29.
|
| 215 |
+
|
| 216 |
+
Mingkai Deng, Jianyu Wang, Cheng-Ping Hsieh, Yihan Wang, Han Guo, Tianmin Shu, Meng Song, Eric P Xing, and Zhiting Hu. 2022. Rlprompt: Optimizing discrete text prompts with reinforcement learning. arXiv preprint arXiv:2205.12548.
|
| 217 |
+
|
| 218 |
+
Yanai Elazar, Nora Kassner, Shauli Ravfogel, Amir Feder, Abhilasha Ravichander, Marius Mosbach, Yonatan Belinkov, Hinrich Schütze, and Yoav Goldberg. 2022. Measuring causal effects of data statistics on language model’sfactual’predictions. arXiv preprint arXiv:2207.14251.
|
| 219 |
+
|
| 220 |
+
Tianyu Gao, Adam Fisch, and Danqi Chen. 2021. Making pre-trained language models better few-shot learners. 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 3816–3830.
|
| 221 |
+
|
| 222 |
+
Xiaochuang Han and Yulia Tsvetkov. 2022. Orca: Interpreting prompted language models via locating supporting data evidence in the ocean of pretraining data. arXiv preprint arXiv:2205.12600.
|
| 223 |
+
|
| 224 |
+
Ari Holtzman, Peter West, Vered Shwartz, Yejin Choi, and Luke Zettlemoyer. 2021. Surface form competition: Why the highest probability answer isn’t always right. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 7038–7051.
|
| 225 |
+
|
| 226 |
+
Nikhil Kandpal, Haikang Deng, Adam Roberts, Eric Wallace, and Colin Raffel. 2022. Large language models struggle to learn long-tail knowledge. arXiv preprint arXiv:2211.08411.
|
| 227 |
+
|
| 228 |
+
Daniel Khashabi, Chitta Baral, Yejin Choi, and Hannaneh Hajishirzi. 2022a. Reframing instructional prompts to gptk’s language. In Findings of the Association for Computational Linguistics: ACL 2022, pages 589–612.
|
| 229 |
+
|
| 230 |
+
Daniel Khashabi, Xinxi Lyu, Sewon Min, Lianhui Qin, Kyle Richardson, Sean Welleck, Hannaneh Hajishirzi, Tushar Khot, Ashish Sabharwal, Sameer
|
| 231 |
+
|
| 232 |
+
Singh, and Yejin Choi. 2022b. Prompt waywardness: The curious case of discretized interpretation of continuous prompts. In Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies.
|
| 233 |
+
|
| 234 |
+
Teven Le Scao and Alexander Rush. 2021. How many data points is a prompt worth? In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies. Association for Computational Linguistics.
|
| 235 |
+
|
| 236 |
+
Jens Lehmann, Robert Isele, Max Jakob, Anja Jentzsch, Dimitris Kontokostas, Pablo N Mendes, Sebastian Hellmann, Mohamed Morsey, Patrick Van Kleef, Sören Auer, et al. 2015. Dbpedia–a large-scale, multilingual knowledge base extracted from wikipedia. Semantic web, 6(2):167–195.
|
| 237 |
+
|
| 238 |
+
Brian Lester, Rami Al-Rfou, and Noah Constant. 2021. The power of scale for parameter-efficient prompt tuning. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 3045–3059.
|
| 239 |
+
|
| 240 |
+
Xiang Lisa Li and Percy Liang. 2021. Prefix-tuning: Optimizing continuous prompts for generation. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 4582– 4597.
|
| 241 |
+
|
| 242 |
+
Alexandra Sasha Luccioni, Sylvain Viguier, and AnneLaure Ligozat. 2022. Estimating the carbon footprint of bloom, a 176b parameter language model. arXiv preprint arXiv:2211.02001.
|
| 243 |
+
|
| 244 |
+
Andrew L. Maas, Raymond E. Daly, Peter T. Pham, Dan Huang, Andrew Y. Ng, and Christopher Potts. 2011. Learning word vectors for sentiment analysis. In Proceedings of the 49th Annual Meeting of the Association for Computational Linguistics: Human Language Technologies, pages 142–150, Portland, Oregon, USA. Association for Computational Linguistics.
|
| 245 |
+
|
| 246 |
+
George A Miller. 1995. Wordnet: a lexical database for english. Communications of the ACM, 38(11):39–41.
|
| 247 |
+
|
| 248 |
+
N. Moniz and L. Torgo. 2018. Multi-source social feedback of online news feeds. ArXiv, abs/1801.07055.
|
| 249 |
+
|
| 250 |
+
Guanghui Qin and Jason Eisner. 2021. Learning how to ask: Querying lms with mixtures of soft prompts. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 5203–5212.
|
| 251 |
+
|
| 252 |
+
Yasaman Razeghi, Robert L Logan IV, Matt Gardner, and Sameer Singh. 2022. Impact of pretraining term frequencies on few-shot reasoning. arXiv preprint arXiv:2202.07206.
|
| 253 |
+
|
| 254 |
+
Elvis Saravia, Hsien-Chi Toby Liu, Yen-Hao Huang, Junlin Wu, and Yi-Shin Chen. 2018. CARER: Contextualized affect representations for emotion recognition. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pages 3687–3697, Brussels, Belgium. Association for Computational Linguistics.
|
| 255 |
+
|
| 256 |
+
Timo Schick and Hinrich Schütze. 2020. It’s not just size that matters: Small language models are also few-shot learners. arXiv preprint arXiv:2009.07118.
|
| 257 |
+
|
| 258 |
+
Weijia Shi, Xiaochuang Han, Hila Gonen, Ari Holtzman, Yulia Tsvetkov, and Luke Zettlemoyer. 2022. Toward human readable prompt tuning: Kubrick’s the shining is a good movie, and a good prompt too? arXiv preprint arXiv:2212.10539.
|
| 259 |
+
|
| 260 |
+
Taylor Shin, Yasaman Razeghi, Robert L Logan IV, Eric Wallace, and Sameer Singh. 2020. Autoprompt: Eliciting knowledge from language models with automatically generated prompts. arXiv preprint arXiv:2010.15980.
|
| 261 |
+
|
| 262 |
+
Alex Warstadt, Amanpreet Singh, and Samuel R Bowman. 2018. Neural network acceptability judgments. arXiv preprint arXiv:1805.12471.
|
| 263 |
+
|
| 264 |
+
John Wieting, Jonathan Mallinson, and Kevin Gimpel. 2017. Learning paraphrastic sentence embeddings from back-translated bitext. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 274–285.
|
| 265 |
+
|
| 266 |
+
Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen, Christopher Dewan, Mona Diab, Xian Li, Xi Victoria Lin, et al. 2022. Opt: Open pre-trained transformer language models. arXiv preprint arXiv:2205.01068.
|
| 267 |
+
|
| 268 |
+
Xiang Zhang, Junbo Jake Zhao, and Yann LeCun. 2015. Character-level convolutional networks for text classification. In NIPS.
|
| 269 |
+
|
| 270 |
+
# A Manually Created Prompts
|
| 271 |
+
|
| 272 |
+
Table 11 lists the manually created prompts we use for the different tasks. We manually add, remove and edit prompts for some of these tasks, to make them fit for our setting. For example, the following prompt for AG News, taken from Promptsource, does not fit our setting: Would you recommend the following article to a politician, an athlete, business executive, or a scientist?
|
| 273 |
+
|
| 274 |
+
# B Lowest Perplexity Prompts
|
| 275 |
+
|
| 276 |
+
Table 12 lists the 5 lowest perplexity prompts for each task, using OPT 175B.
|
| 277 |
+
|
| 278 |
+
Table 11: The set of manually created prompts for each task.
|
| 279 |
+
|
| 280 |
+
<table><tr><td>Task Manual Prompts</td><td></td></tr><tr><td>Antonyms</td><td>The antonym of the word “good”is“ The opposite meaning of the word “good”is “ “Good”is the opposite of“ “Good”is the negation of“ The following are opposites of each other:“good"and “ The word “good"contradicts the word “ The antonym of the word good is The opposite meaning of the word good is Good is the opposite of</td></tr><tr><td>GLUE Cola</td><td>The following are opposites of each other: good and The word good contradicts the word Does the this sentence make sense and use correct English? Is this example grammatically correct and sensible? Does this sentence make sense and is it grammatically correct?</td></tr><tr><td>Newspop</td><td>Does this example use correct English? What is the article about? What is this news about? What is the topic of this news piece? What does this article discuss? What is the topic of this sentence? What category does the article belong to? Pick one category forthis news piece. Pick the category that fits the text. The article refers to which category? What topic does the article belong to? What category fits this article? What topic does this news piece belong to? Choose the correct category for this article.</td></tr><tr><td>AG News</td><td>What label best describes this news article? What is this piece of news regarding? Which newspaper section would this article likely appear in? What topic is this news article about? This movie review expresses what sentiment? Did the reviewer find this movie good or bad?</td></tr><tr><td>IMDB</td><td>Is this review positive or negative? How does the viewer feel about the movie? What sentiment does the writer express for the movie? What sentiment is expressed for the movie? What is the sentiment expressed in this text? Did the reviewer enjoy the movie? What is the sentiment expressed by the reviewer for the movie? How does the reviewer feel about the movie? What category does the paragraph belong to? Pick one category for the text.</td></tr><tr><td>DBpedia</td><td>Pick the category that fits the text. The text refers to which category? What category does the title belong to? What category fits this text? What topic does this text belong to? Choose the correct category for the text. What is the emotion expressed in this message?</td></tr><tr><td>Emotion</td><td>What emotion does this message express? How will you feel about the message? What emotion does the writer express for the message? Is this tweet offensive? Can the tweet be removed for being offensive?</td></tr><tr><td>Tweet Offensive</td><td>Is the author's tweet offensive? Task: Identify if the tweetor text is offensive. Is this an offensive tweet? The translation of the word “dog"to French is“ The translation of the word dog to French is The word “dog”in French is“</td></tr><tr><td>Word-Level Translation</td><td>“dog”(In French: “ Translate the word dog into French: The translation of dog to French is “dog”(French: “ The word dog in French is Translate the word“dog”into French: “ dog (In French: dog (French: The translation of“dog”to French is “</td></tr></table>
|
| 281 |
+
|
| 282 |
+
Table 12: The 5 lowest perplexity prompts for each task, using OPT 175B.
|
| 283 |
+
|
| 284 |
+
<table><tr><td>Task</td><td>Lowest Perplexity Prompts</td><td>Perplexity</td></tr><tr><td rowspan="5">Antonyms</td><td>The following two words are antonyms:“good”and “</td><td>10.24</td></tr><tr><td>The antonym of the word“good"is“</td><td>10.32</td></tr><tr><td>The word that has the opposite meaning of the word “good" is “</td><td>10.43</td></tr><tr><td>The word“good”is the antithesis of the word“</td><td>10.85</td></tr><tr><td>The word “good” is the opposite of the word “</td><td>11.15</td></tr><tr><td rowspan="5">GLUE Cola</td><td>Is this an example of the proper use of the English language?</td><td>11.63</td></tr><tr><td>Does the sentence make sense and does it follow the rules of grammar?</td><td>11.76</td></tr><tr><td>Is this sentence an example of the correct use of the English language?</td><td>12.10</td></tr><tr><td>Does this sentence make sense and is it grammatically correct?</td><td>12.15</td></tr><tr><td>Is this sentence grammatically correct and does it make sense?</td><td>12.68</td></tr><tr><td rowspan="5">Newspop</td><td>What is the main subject of the article?</td><td>10.01</td></tr><tr><td>What is the main topic of the article?</td><td>10.01</td></tr><tr><td>What is the subject matter of the article?</td><td>10.17</td></tr><tr><td>What is the subject of the article?</td><td>10.21</td></tr><tr><td>What is the main idea of this article?</td><td>10.21</td></tr><tr><td rowspan="5">AG News</td><td>In what section of the newspaper would you expect to find this article?</td><td>7.51</td></tr><tr><td>In which section of the newspaper would you expect to find this article?</td><td>7.52</td></tr><tr><td>In which section of the newspaper would this article be most likely to appear?</td><td>7.60</td></tr><tr><td>In what section of the newspaper do you expect to find this article?</td><td>7.80</td></tr><tr><td>In what section of the newspaper would this article most likely appear?</td><td>7.87</td></tr><tr><td rowspan="5">IMDB</td><td>What is the opinion of the review? Is it positive or negative?</td><td>7.19</td></tr><tr><td>Is this a positive or negative review?</td><td>7.31</td></tr><tr><td>What do you think of the movie?</td><td>7.33</td></tr><tr><td>What do you think of the film?</td><td>7.35</td></tr><tr><td>Is that a positive or a negative?</td><td>7.35</td></tr><tr><td rowspan="5">DBpedia</td><td>What is the category to which the text refers?</td><td>8.99</td></tr><tr><td>What is the subject of the text?</td><td>9.15</td></tr><tr><td>What category does the title belong to?</td><td>9.18</td></tr><tr><td>Which category does the text refer to?</td><td>9.19</td></tr><tr><td>What is the subject of this text?</td><td>9.20</td></tr><tr><td rowspan="5">Emotion</td><td>How do you feel when you hear this message?</td><td>12.72</td></tr><tr><td>What is the writer's emotional reaction to this news?</td><td>13.18</td></tr><tr><td>What is the emotion expressed in this message?</td><td>13.20</td></tr><tr><td>How does this message make you feel?</td><td>13.32</td></tr><tr><td>How do you feel about this message?</td><td>13.50</td></tr><tr><td rowspan="5">Tweet Offensive</td><td>If someone said this to you, would you be offended?</td><td>13.00</td></tr><tr><td>If someone said that to you, would you be offended?</td><td>13.10</td></tr><tr><td>Would you be offended if someone said that to you?</td><td>13.73</td></tr><tr><td>Would it offend you if someone said that to you?</td><td>14.79</td></tr><tr><td>If someone told you that, would you be offended?</td><td>14.93</td></tr><tr><td rowspan="5">Word-Level Translation</td><td>The word for“dog"in French is“</td><td>7.73</td></tr><tr><td>The French word for“dog”is“</td><td>8.16</td></tr><tr><td>The French translation of the word“dog”is“</td><td>8.24</td></tr><tr><td>The translation of the word “dog”in French is “</td><td>8.35</td></tr><tr><td>The translation of the word “dog” into French is “</td><td>8.91</td></tr></table>
|
md/dev/NXHXoYMLIG/NXHXoYMLIG.md
ADDED
|
@@ -0,0 +1,310 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EfficientFormer: Vision Transformers at MobileNet Speed
|
| 2 |
+
|
| 3 |
+
Yanyu Li1,2,† Geng Yuan1,2,† Yang Wen1 Ju Hu1 Georgios Evangelidis1 Sergey Tulyakov1 Yanzhi Wang2 Jian Ren1 1Snap Inc. 2Northeastern University
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Vision Transformers (ViT) have shown rapid progress in computer vision tasks, achieving promising results on various benchmarks. However, due to the massive number of parameters and model design, e.g., attention mechanism, ViT-based models are generally times slower than lightweight convolutional networks. Therefore, the deployment of ViT for real-time applications is particularly challenging, especially on resource-constrained hardware such as mobile devices. Recent efforts try to reduce the computation complexity of ViT through network architecture search or hybrid design with MobileNet block, yet the inference speed is still unsatisfactory. This leads to an important question: can transformers run as fast as MobileNet while obtaining high performance? To answer this, we first revisit the network architecture and operators used in ViT-based models and identify inefficient designs. Then we introduce a dimension-consistent pure transformer (without MobileNet blocks) as a design paradigm. Finally, we perform latencydriven slimming to get a series of final models dubbed EfficientFormer. Extensive experiments show the superiority of EfficientFormer in performance and speed on mobile devices. Our fastest model, EfficientFormer-L1, achieves $7 9 . 2 \%$ top-1 accuracy on ImageNet-1K with only $1 . 6 \mathrm { m s }$ inference latency on iPhone 12 (compiled with CoreML), which runs as fast as MobileNet ${ \tt V } 2 { \times } 1 . 4$ $\mathrm { 1 . 6 m s }$ , $7 4 . 7 \%$ top-1), and our largest model, EfficientFormer-L7, obtains $8 3 . 3 \%$ accuracy with only $7 . 0 \mathrm { m s }$ latency. Our work proves that properly designed transformers can reach extremely low latency on mobile devices while maintaining high performance1.
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
The transformer architecture [1], initially designed for Natural Language Processing (NLP) tasks, introduces the Multi-Head Self Attention (MHSA) mechanism that allows the network to model long-term dependencies and is easy to parallelize. In this context, Dosovitskiy et al. $\mathbb { \left[ \sum \right] }$ adapt the attention mechanism to 2D images and propose Vision Transformer (ViT): the input image is divided into non-overlapping patches, and the inter-patch representations are learned through MHSA without inductive bias. ViTs demonstrate promising results compared to convolutional neural networks (CNNs) on computer vision tasks. Following this success, several efforts explore the potential of ViT by improving training strategies [3, 4, 5], introducing architecture changes [6, 7], redesigning attention mechanisms [8, 9], and elevating the performance of various vision tasks such as classification [10, 11, 12], segmentation [13, 14], and detection [15, 16].
|
| 12 |
+
|
| 13 |
+
On the downside, transformer models are usually times slower than competitive CNNs [17, 18]. There are many factors that limit the inference speed of ViT, including the massive number of parameters, quadratic-increasing computation complexity with respect to token length, non-foldable normalization layers, and lack of compiler level optimizations (e.g., Winograd for CNN [19]). The high latency makes transformers impractical for real-world applications on resource-constrained hardware, such as augmented or virtual reality applications on mobile devices and wearables. As a result, lightweight CNNs [20, 21, 22] remain the default choice for real-time inference.
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
Figure 1: Inference Speed vs. Accuracy. All models are trained on ImageNet-1K and measured by iPhone 12 with CoreMLTools to get latency. Compared to CNNs, EfficientFormer-L1 runs $4 0 \%$ faster than EfficientNet-B0, while achieves $2 . 1 \%$ higher accuracy. For the latest MobileViT-XS, EfficientFormer-L7 runs $0 . 2 \mathrm { m s }$ faster with $8 . 5 \%$ higher accuracy.
|
| 17 |
+
|
| 18 |
+
To alleviate the latency bottleneck of transformers, many approaches have been proposed. For instance, some efforts consider designing new architectures or operations by changing the linear layers with convolutional layers (CONV) $[ [ 2 3 ] ]$ , combining self-attention with MobileNet blocks $\pmb { \bigtriangledown } 2 4 \mathbf { \| }$ , or introducing sparse attention [25, 26, 27], to reduce the computational cost, while other efforts leverage network searching algorithm $\left. 2 8 \right.$ or pruning $[ [ 2 9 ]$ to improve efficiency. Although the computation-performance trade-off has been improved by existing works, the fundamental question that relates to the applicability of transformer models remains unanswered: Can powerful vision transformers run at MobileNet speed and become a default option for edge applications? This work provides a study towards the answer through the following contributions:
|
| 19 |
+
|
| 20 |
+
• First, we revisit the design principles of ViT and its variants through latency analysis (Sec. $3 )$ . Following existing work $\bar { \lVert 1 8 \rVert }$ , we utilize iPhone 12 as the testbed and publicly available CoreML $\pmb { \mathbb { B } } \pmb { \mathrm { O } } \Vert$ as the compiler, since the mobile device is widely used and the results can be easily reproduced. • Second, based on our analysis, we identify inefficient designs and operators in ViT and propose a new dimension-consistent design paradigm for vision transformers (Sec. 4.1). • Third, starting from a supernet with the new design paradigm, we propose a simple yet effective latency-driven slimming method to obtain a new family of models, namely, EfficientFormers (Sec. 4.2). We directly optimize for inference speed instead of MACs or number of parameters [31, 32, 33].
|
| 21 |
+
|
| 22 |
+
Our fastest model, EfficientFormer-L1, achieves $7 9 . 2 \%$ top-1 accuracy on ImageNet-1K [34] classification task with only $1 . 6 ~ \mathrm { m s }$ inference time (averaged over 1, 000 runs), which runs as fast as MobileNet $V 2 { \times } 1 . 4$ and wields $4 . 5 \%$ higher top-1 accuracy (more results in Fig. 1 and Tab. 1). The promising results demonstrate that latency is no longer an obstacle for the widespread adoption of vision transformers. Our largest model, EfficientFormer-L7, achieves $8 3 . 3 \%$ accuracy with only $7 . 0 \mathrm { m s }$ latency, outperforms ViT $\mathrm { \Phi } ^ { \prime } \times \mathrm { \Phi }$ MobileNet hybrid designs (MobileViT-XS, $7 4 . 8 \%$ , $7 . 2 \mathrm { m s }$ ) by a large margin. Additionally, we observe superior performance by employing EfficientFormer as the backbone in image detection and segmentation benchmarks (Tab. 2). We provide a preliminary answer to the aforementioned question, ViTs can achieve ultra fast inference speed and wield powerful performance at the same time. We hope our EfficientFormer can serve as a strong baseline and inspire followup works on the edge deployment of vision transformers.
|
| 23 |
+
|
| 24 |
+
# 2 Related Work
|
| 25 |
+
|
| 26 |
+
Transformers are initially proposed to handle the learning of long sequences in NLP tasks [1]. Dosovitskiy et al. $\left[ \left[ 2 \right] \right]$ and Carion et al. $\mathbb { \left. \overline { { 1 5 } } \right. }$ adapt the transformer architecture to classification and detection, respectively, and achieve competitive performance against CNN counterparts with stronger training techniques and larger-scale datasets. DeiT $\mathbb { \left[ 3 \right] }$ further improves the training pipeline with the aid of distillation, eliminating the need for large-scale pretraining [35]. Inspired by the competitive performance and global receptive field of transformer models, follow-up works are proposed to refine the architecture [36, 37], explore the relationship between CONV nets and ViT [38, 39, 40], and adapt ViT to different computer vision tasks [13, 41, 42, 43, 44, 45, 46]. Other research efforts explore the essence of attention mechanism and propose insightful variants of token mixer, e.g., local attention $\pmb { \mathbb { B } } ] \mathbf { l }$ , spatial MLP [47, 48], and pooling-mixer [6].
|
| 27 |
+
|
| 28 |
+
Despite the success in most vision tasks, ViT-based models cannot compete with the well-studied lightweight CNNs [21, 49] when the inference speed is the major concern [50, 51, 52], especially on resource-constrained edge devices [17]. To accelerate ViT, many approaches have been introduced with different methodologies, such as proposing new architectures or modules [53, 54, 55, 56, 57, 58], re-thinking self-attention and sparse-attention mechanisms [59, 60, 61, 62, 63, 64, 65], and utilizing search algorithms that are widely explored in CNNs to find smaller and faster ViTs [66, 28, 29, 67]. Recently, LeViT $\mathbb { \left[ \left. 2 3 \right] \right. }$ proposes a CONV-clothing design to accelerate vision transformer. However, in order to perform MHSA, the 4D features need to be frequently reshaped into flat patches, which is still expensive to compute on edge resources (Fig. 2). Likewise, MobileViT $\boxed { 1 8 }$ introduces a hybrid architecture that combines lightweight MobileNet blocks (with point-wise and depth-wise CONV) and MHSA blocks; the former is placed at early stages in the network pipeline to extract low-level features, while the latter is placed in late stages to enjoy the global receptive field. Similar approach has been explored by several works $ { \mathbb { P } } ^ { \smash { 2 4 , \sqrt { 2 8 } } \rvert }$ as a straightforward strategy to reduce computation.
|
| 29 |
+
|
| 30 |
+
Different from existing works, we aim at pushing the latency-performance boundary of pure vision transformers instead of relying on hybrid designs, and directly optimize for mobile latency. Through our detailed analysis $( \mathrm { S e c . } \boxed { 3 } )$ , we propose a new design paradigm (Sec. 4.1), which can be further elevated through architecture search (Sec. 4.2).
|
| 31 |
+
|
| 32 |
+
# 3 On-Device Latency Analysis of Vision Transformers
|
| 33 |
+
|
| 34 |
+
Most existing approaches optimize the inference speed of transformers through computation complexity (MACs) or throughput (images/sec) obtained from server GPU [23, 28]. While such metrics do not reflect the real on-device latency. To have a clear understanding of which operations and design choices slow down the inference of ViTs on edge devices, we perform a comprehensive latency analysis over a number of models and operations, as shown in Fig. $\bigtriangledown$ whereby the following observations are drawn.
|
| 35 |
+
|
| 36 |
+
# Observation 1: Patch embedding with large kernel and stride is a speed bottleneck on mobile devices.
|
| 37 |
+
|
| 38 |
+
Patch embedding is often implemented with a non-overlapping convolution layer that has large kernel size and stride [3, 55]. A common belief is that the computation cost of the patch embedding layer in a transformer network is unremarkable or negligible [2, 6]. However, our comparison in Fig. 2 between models with large kernel and stride for patch embedding, i.e., DeiT-S $\pmb { \mathbb { B } } \|$ and PoolFormer-S24 [6], and the models without it, i.e., LeViT-256 $\pmb { \mathbb { Z } } 3 \|$ and EfficientFormer, shows that patch embedding is instead a speed bottleneck on mobile devices.
|
| 39 |
+
|
| 40 |
+
Large-kernel convolutions are not well supported by most compilers and cannot be accelerated through existing algorithms like Winograd $\mathbb { I m }$ . Alternatively, the non-overlapping patch embedding can be replaced by a convolution stem with fast downsampling [68, 69, 23] that consists of several hardware-efficient $3 \times 3$ convolutions (Fig. 3).
|
| 41 |
+
|
| 42 |
+

|
| 43 |
+
Figure 2: Latency profiling. Results are obtained on iPhone 12 with CoreML. The on-device speed for CNN (MobileNet ${ \mathrm { V } } 2 { \times } 1 . 4$ , ResNet50, and EfficientNet-B0), ViT-based models (DeiT-Small, LeViT-256, PoolFormer-S24, and EfficientFormer), and various operators are reported. The latency of models and operations are denoted with different color. ( ) is the top-1 accuracy on ImageNet-1K. †LeViT uses HardSwish which is not well supported by CoreML, we replace it with GeLU for fair comparison.
|
| 44 |
+
|
| 45 |
+
Observation 2: Consistent feature dimension is important for the choice of token mixer. MHSA is not necessarily a speed bottleneck.
|
| 46 |
+
|
| 47 |
+
Recent work extends ViT-based models to the MetaFormer architecture $\pmb { \Vert 6 \Vert }$ consisting of MLP blocks and unspecified token mixers. Selecting a token mixer is an essential design choice when building ViT-based models. The options are many—the conventional MHSA mixer with a global receptive field, more sophisticated shifted window attention $\pmb { \Vert 8 \Vert }$ , or a non-parametric operator like pooling [6].
|
| 48 |
+
|
| 49 |
+
We narrow the comparison to the two token mixers, pooling and MHSA, where we choose the former for its simplicity and efficiency, while the latter for better performance. More complicated token mixers like shifted window $\textcircled { 8 } \textcircled { 1 8 }$ are currently not supported by most public mobile compilers and we leave them outside our scope. Furthermore, we do not use depth-wise convolution to replace pooling $ { \mathbb { I } } ^ { { \mathbb { Z } } 0 \| }$ as we focus on building architecture without the aid of lightweight convolutions.
|
| 50 |
+
|
| 51 |
+
To understand the latency of the two token mixers, we perform the following two comparisons:
|
| 52 |
+
|
| 53 |
+
• First, by comparing PoolFormer-s24 $\textcircled { 6 }$ and LeViT-256 $\mathbb { \left[ \left. 2 3 \right] \right. }$ , we observe that the Reshape operation is a bottleneck for LeViT-256. The majority of LeViT-256 is implemented with CONV on 4D tensor, requiring frequent reshaping operations when forwarding features into MHSA since the attention has to be performed on patchified 3D tensor (discarding the extra dimension of attention heads). The extensive usage of Reshape limits the speed of LeViT on mobile devices (Fig. 2). On the other hand, pooling naturally suits the 4D tensor when the network primarily consists of CONV-based implementations, e.g., CONV $1 \times 1$ as MLP implementation and CONV stem for downsampling. As a result, PoolFormer exhibits faster inference speed. • Second, by comparing DeiT-Small $\textcircled { 1 3 } \textcircled { 1 }$ and LeViT-256 $\mathbb { \left[ \left. 2 3 \right] \right. }$ , we find that MHSA does not bring significant overhead on mobiles if the feature dimensions are consistent and Reshape is not required. Though much more computation intensive, DeiT-Small with a consistent 3D feature can achieve comparable speed to the new ViT variant, i.e., LeViT-256.
|
| 54 |
+
|
| 55 |
+
In this work, we propose a dimension-consistent network $( \mathsf { S e c . 4 . 1 } )$ with both 4D feature implementation and 3D MHSA, but the inefficient frequent Reshape operations are eliminated.
|
| 56 |
+
|
| 57 |
+
Observation 3: CONV-BN is more latency-favorable than LN (GN)-Linear and the accuracy drawback is generally acceptable.
|
| 58 |
+
|
| 59 |
+

|
| 60 |
+
Figure 3: Overview of EfficientFormer. The network starts with a convolution stem as patch embedding, followed by MetaBlock (MB). The $\tt M B ^ { 4 D }$ and $\mathtt { M B } ^ { 3 D }$ contain different token mixer configurations, i.e., local pooling or global multi-head self-attention, arranged in a dimension-consistent manner.
|
| 61 |
+
|
| 62 |
+
Choosing the MLP implementation is another essential design choice. Usually, one of the two options is selected: layer normalization (LN) with 3D linear projection (proj.) and CONV $1 \times 1$ with batch normalization (BN). CONV-BN is more latency favorable because BN can be folded into the preceding convolution for inference speedup, while dynamic normalizations, such as LN and GN, still collects running statistics at the inference phase, thus contributing to latency. From the analysis of DeiT-Small and PoolFormer-S24 in Fig. $\bigtriangledown$ and previous work [17], the latency introduced by LN constitutes around $1 0 \% - 2 0 \%$ latency of the whole network.
|
| 63 |
+
|
| 64 |
+
Based on our ablation study in Appendix Tab. 3, CONV-BN only slightly downgrades performance compared to GN and achieves comparable results to channel-wise LN. In this work, we apply CONVBN as much as possible (in all latent 4D features) for the latency gain with a negligible performance drop, while using LN for the 3D features, which aligns with the original MHSA design in ViT and yields better accuracy.
|
| 65 |
+
|
| 66 |
+
# Observation 4: The latency of nonlinearity is hardware and compiler dependent.
|
| 67 |
+
|
| 68 |
+
Lastly, we study nonlinearity, including GeLU, ReLU, and HardSwish. Previous work $\mathbb { \lVert 1 7 \rVert }$ suggests GeLU is not efficient on hardware and slows down inference. However, we observe GeLU is well supported by iPhone 12 and hardly slower than its counterpart, ReLU. On the contrary, HardSwish is surprisingly slow in our experiments and may not be well supported by the compiler (LeViT-256 latency with HardSwish is $4 4 . 5 \mathrm { m s }$ while with GeLU $1 1 . 9 \mathrm { m s }$ ). We conclude that nonlinearity should be determined on a case-by-case basis given specific hardware and compiler at hand. We believe that most of the activations will be supported in the future. In this work, we employ GeLU activations.
|
| 69 |
+
|
| 70 |
+
# 4 Design of EfficientFormer
|
| 71 |
+
|
| 72 |
+
Based on the latency analysis, we propose the design of EfficientFormer, demonstrated in Fig. 3. The network consists of a patch embedding (PatchEmbed) and stack of meta transformer blocks, denoted as MB:
|
| 73 |
+
|
| 74 |
+
$$
|
| 75 |
+
\mathcal { Y } = \prod _ { i } ^ { m } \mathtt { M B } _ { i } \big ( \mathtt { P a t c h E m b e d } ( \mathcal { X } _ { 0 } ^ { B , 3 , H , W } ) \big ) ,
|
| 76 |
+
$$
|
| 77 |
+
|
| 78 |
+
where $\mathcal { X } _ { 0 }$ is the input image with batch size as $B$ and spatial size as $[ H , W ]$ , $\mathcal { V }$ is the desired output, and $m$ is the total number of blocks (depth). MB consists of unspecified token mixer (TokenMixer) followed by a MLP block and can be expressed as follows:
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
\begin{array} { r } { \mathcal { X } _ { i + 1 } = \mathtt { M B } _ { i } \big ( \mathcal { X } _ { i } \big ) = \mathtt { M L P } \big ( \mathtt { T o k e n M i x e r } ( \mathcal { X } _ { i } ) \big ) , } \end{array}
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
where ${ \mathcal { X } } _ { i \mid i > 0 }$ is the intermediate feature that forwarded into the $i ^ { t h } \ M \mathrm { B }$ . We further define Stage (or S) as the stack of several MetaBlocks that processes the features with the same spatial size, such as $N _ { 1 } \times$ in Fig. $\textcircled { 3 }$ denoting ${ \tt S } _ { 1 }$ has $N _ { 1 }$ MetaBlocks. The network includes 4 Stages. Among each Stage, there is an embedding operation to project embedding dimension and downsample token length, denoted as Embedding in Fig. $3 .$ With the above architecture, EfficientFormer is a fully transformer-based model without integrating MobileNet structures. Next, we dive into the details of the network design, specifically, the architecture details and the search algorithm.
|
| 85 |
+
|
| 86 |
+
# 4.1 Dimension-Consistent Design
|
| 87 |
+
|
| 88 |
+
With the observations in Sec. $\textcircled { 3 }$ we propose a dimension consistent design which splits the network into a 4D partition where operators are implemented in CONV-net style $( \mathrm { M B ^ { 4 D } } )$ , and a 3D partition where linear projections and attentions are performed over 3D tensor to enjoy the global modeling power of MHSA without sacrificing efficiency $( \mathrm { M B } ^ { 3 D } )$ , as shown in Fig. 3. Specifically, the network starts with 4D partition, while 3D partition is applied in the last stages. Note that Fig. $\textcircled { 3 }$ is just an instance, the actual length of 4D and 3D partition is specified later through architecture search.
|
| 89 |
+
|
| 90 |
+
First, input images are processed by a CONV stem with two $3 \times 3$ convolutions with stride 2 as patch embedding,
|
| 91 |
+
|
| 92 |
+
$$
|
| 93 |
+
\begin{array} { r } { \mathcal { X } _ { 1 } ^ { B , C _ { j | j = 1 } , \frac { H } { 4 } , \frac { W } { 4 } } = \mathtt { P a t c h E m b e d } ( \mathcal { X } _ { 0 } ^ { B , 3 , H , W } ) , } \end{array}
|
| 94 |
+
$$
|
| 95 |
+
|
| 96 |
+
where $C _ { j }$ is the channel number (width) of the $j t h$ stage. Then the network starts with $\tt M B ^ { 4 D }$ with a simple Pool mixer to extract low level features,
|
| 97 |
+
|
| 98 |
+
$$
|
| 99 |
+
\begin{array} { r l } & { \mathcal { T } _ { i } = \mathrm { P o o 1 } ( \mathcal { X } _ { i } ^ { B , C _ { j } , \frac { H } { 2 ^ { j + 1 } } , \frac { W } { 2 ^ { j + 1 } } } ) + \mathcal { X } _ { i } ^ { B , C _ { j } , \frac { H } { 2 ^ { j + 1 } } , \frac { W } { 2 ^ { j + 1 } } } , } \\ & { \mathcal { X } _ { i + 1 } ^ { B , C _ { j } , \frac { H } { 2 ^ { j + 1 } } , \frac { W } { 2 ^ { j + 1 } } } = \mathrm { C o n v } _ { B } ( \mathrm { C o n v } _ { B , G } ( \mathcal { T } _ { i } ) ) + \mathcal { T } _ { i } , } \end{array}
|
| 100 |
+
$$
|
| 101 |
+
|
| 102 |
+
where $\mathtt { C o n v } _ { B , G }$ refers to whether the convolution is followed by BN and GeLU, respectively. Note here we do not employ Group or Layer Normalization (LN) before the Pool mixer as in $\pmb { \Vert 6 \Vert }$ , since the 4D partition is CONV-BN based design, thus there exists a BN in front of each Pool mixer.
|
| 103 |
+
|
| 104 |
+
After processing all the $\tt M B ^ { 4 D }$ blocks, we perform a one-time reshaping to transform the features size and enter 3D partition. $\mathtt { M B } ^ { 3 D }$ follows conventional ViT structure, as in Fig. $3 .$ Formally,
|
| 105 |
+
|
| 106 |
+
$$
|
| 107 |
+
\begin{array} { r l } & { \mathcal { T } _ { i } = \mathtt { L i n e a r } \big ( \mathtt { M H S A } \big ( \mathrm { L i n e a r } \big ( \mathrm { L N } \big ( \mathcal { X } _ { i } ^ { B , \frac { H W } { 4 ^ { j + 1 } } , C _ { j } } \big ) \big ) \big ) \big ) + \mathcal { X } _ { i } ^ { B , \frac { H W } { 4 ^ { j + 1 } } , C _ { j } } , } \\ & { \qquad \mathcal { X } _ { i + 1 } ^ { B , \frac { H W } { 4 ^ { j + 1 } } , C _ { j } } = \mathtt { L i n e a r } \big ( \mathrm { L i n e a r } _ { G } \big ( \mathrm { L N } ( \mathcal { T } _ { i } ) \big ) \big ) + \mathcal { T } _ { i } , } \end{array}
|
| 108 |
+
$$
|
| 109 |
+
|
| 110 |
+
where Linear $G$ denotes the Linear followed by GeLU, and
|
| 111 |
+
|
| 112 |
+
$$
|
| 113 |
+
\mathtt { M H S A } ( Q , K , V ) = \mathtt { S o f t m a x } ( \frac { Q \cdot K ^ { T } } { \sqrt { C _ { j } } } + b ) \cdot V ,
|
| 114 |
+
$$
|
| 115 |
+
|
| 116 |
+
where $Q , K , V$ represents query, key, and values learned by the linear projection, and $b$ is parameterized attention bias as position encodings.
|
| 117 |
+
|
| 118 |
+
# 4.2 Latency Driven Slimming
|
| 119 |
+
|
| 120 |
+
Design of Supernet. Based on the dimension-consistent design, we build a supernet for searching efficient models of the network architecture shown in Fig. $\textcircled { 3 }$ (Fig. $3$ shows an example of searched final network). In order to represent such a supernet, we define the MetaPath (MP), which is the collection of possible blocks:
|
| 121 |
+
|
| 122 |
+
$$
|
| 123 |
+
\begin{array} { r l } & { \mathtt { M P } _ { i , j = 1 , 2 } \in \{ \mathtt { M B } _ { i } ^ { 4 D } , I _ { i } \} , } \\ & { \mathtt { M P } _ { i , j = 3 , 4 } \in \{ \mathtt { M B } _ { i } ^ { 4 D } , \mathtt { M B } _ { i } ^ { 3 D } , I _ { i } \} , } \end{array}
|
| 124 |
+
$$
|
| 125 |
+
|
| 126 |
+
where $I$ represents identity path, $j$ denotes the $j ^ { t h }$ Stage, and $i$ denotes the $i ^ { t h }$ block. The supernet can be illustrated by replacing $\tt M B$ in Fig. $3$ with MP.
|
| 127 |
+
|
| 128 |
+
As in Eqn. $^ { 7 , }$ in ${ \tt S } _ { 1 }$ and ${ \tt S } _ { 2 }$ of the supernet, each block can select from $\tt M B ^ { 4 D }$ or $I$ , while in ${ \sf S } _ { 3 }$ and ${ \tt S } _ { 4 }$ , the block can be $\mathtt { M B } ^ { 3 D }$ , $\mathtt { M B } ^ { 4 D }$ , or $I$ . We only enable $\mathtt { M B } ^ { 3 D }$ in the last two Stages for two reasons. First, since the computation of MHSA grows quadratically with respect to token length, integrating it in early Stages would largely increase the computation cost. Second, applying the global MHSA to the last Stages aligns with the intuition that early stages in the networks capture low-level features, while late layers learn long-term dependencies.
|
| 129 |
+
|
| 130 |
+
Searching Space. Our searching space includes $C _ { j }$ (the width of each Stage), $N _ { j }$ (the number of blocks in each Stage, i.e., depth), and last $\mathbb { N }$ blocks to apply $\mathtt { M B } ^ { 3 D }$ .
|
| 131 |
+
|
| 132 |
+
Searching Algorithm. Previous hardware-aware network searching methods generally rely on hardware deployment of each candidate in search space to obtain the latency, which is time consuming [71]. In this work, we propose a simple, fast yet effective gradient-based search algorithm to obtain a candidate network that just needs to train the supernet for once. The algorithm has three major steps.
|
| 133 |
+
|
| 134 |
+
First, we train the supernet with Gumbel Softmax sampling $\pmb { \mathbb { Z } 2 } \|$ to get the importance score for the blocks within each $\tt M P$ , which can be expressed as
|
| 135 |
+
|
| 136 |
+
$$
|
| 137 |
+
\mathcal { X } _ { i + 1 } = \sum _ { n } \frac { e ^ { ( \alpha _ { i } ^ { n } + \epsilon _ { i } ^ { n } ) / \tau } } { \sum _ { n } e ^ { ( \alpha _ { i } ^ { n } + \epsilon _ { i } ^ { n } ) / \tau } } \cdot \mathtt { M P } _ { i , j } ( \mathcal { X } _ { i } ) ,
|
| 138 |
+
$$
|
| 139 |
+
|
| 140 |
+
where $\alpha$ evaluates the importance of each block in $\tt M P$ as it represents the probability to select a block, e.g., $\mathtt { M B } ^ { 4 D }$ or $\mathtt { M B } ^ { 3 D }$ for the $i ^ { t h }$ block. $\epsilon \sim U ( 0 , 1 )$ ensures exploration, $\tau$ is the temperature, and $n$ represents the type of blocks in MP, i.e., $n \in \{ 4 D , I \}$ for ${ \tt S } _ { 1 }$ and ${ \tt S } _ { 2 }$ , and $n \in \{ 4 D , 3 D , I \}$ for ${ \tt S } _ { 3 }$ and ${ \tt S } _ { 4 }$ . By using Eqn. $\mathbb { B } ,$ the derivatives with respect to network weights and $\alpha$ can be computed easily. The training follows the standard recipe (see Sec. $\underline { { \boldsymbol { \mathsf { F . 1 } } } } \underline { { \boldsymbol { \mathsf { I } } } }$ to obtain the trained weights and architecture parameter $\alpha$ .
|
| 141 |
+
|
| 142 |
+
Second, we build a latency lookup table by collecting the on-device latency of $\tt M B ^ { 4 D }$ and $\mathtt { M B } ^ { 3 D }$ with different widths (multiples of 16).
|
| 143 |
+
|
| 144 |
+
Finally, we perform network slimming on the supernet obtained from the first step through latency evaluation using the lookup table. Note that a typical gradient-based searching algorithm simply select the block with largest $\alpha \left\| \overline { { \mathbb { Z } \mathrm { 2 } } } \right\|$ , which does not fit our scope as it cannot search the width $C _ { j }$ . In fact, constructing a multiple-width supernet is memory-consuming and even unrealistic given that each MP has several branches in our design. Instead of directly searching on the complex searching space, we perform a gradual slimming on the single-width supernet as follows.
|
| 145 |
+
|
| 146 |
+
We first define the importance score for $\mathtt { M P } _ { i }$ as ↵4D $\frac { \alpha _ { i } ^ { 4 D } } { \alpha _ { i } ^ { I } }$ and $\frac { \alpha _ { i } ^ { 3 D } + \alpha _ { i } ^ { 4 D } } { \alpha _ { i } ^ { I } }$ for $\mathtt { S } _ { 1 , 2 }$ and $\mathsf { S } _ { 3 , 4 }$ , respectively. Similarly, the importance score for each Stage can be obtained by summing up the scores for all MP within the Stage. With the importance score, we define the action space that includes three options: 1) select $I$ for the least important MP, 2) remove the first $\mathtt { M B } ^ { 3 D }$ , and 3) reduce the width of the least important Stage (by multiples of 16). Then, we calculate the resulting latency of each action through lookup table, and evaluate the accuracy drop of each action. Lastly, we choose the action based on per-latency accuracy drop $\big ( \frac { - \% } { m s } \big )$ . This process is performed iteratively until target latency is achieved. We show more details of the algorithm in Appendix.
|
| 147 |
+
|
| 148 |
+
# 5 Experiments and Discussion
|
| 149 |
+
|
| 150 |
+
We implement EfficientFormer through PyTorch 1.11 $\mathbb { \left[ \left. \left. \right. Z 3 \right] \right. }$ and Timm library $\pmb { \Vert 7 4 \Vert }$ , which is the common practice in recent arts $\boxed { 1 8 } \boxed { 6 }$ . Our models are trained on a cluster with NVIDIA A100 and V100 GPUs. The inference speed on iPhone 12 (A14 bionic chip) is measured with iOS version 15 and averaged over $1 , 0 0 0$ runs, with all available computing resources (NPU), or CPU only. CoreMLTools is used to deploy the run-time model. In addition, we provide latency analysis on Nvidia A100 GPU with batch size 64 to exploit hardware roofline. The trained PyTorch models are deployed in ONNX format and are compiled with TensorRT. We report GPU runtime that excludes preprocessing. We provide the detailed network architecture and more ablation studies in Appendix
|
| 151 |
+
|
| 152 |
+
# 5.1 Image Classification
|
| 153 |
+
|
| 154 |
+
All EfficientFormer models are trained from scratch on ImageNet-1K dataset $\pmb { \mathbb { B 4 } }$ to perform the image classification task. We employ standard image size $( 2 2 4 \times 2 2 4 )$ for both training and testing. We follow the training recipe from DeiT $\mathbb { \left[ 3 \right] }$ but mainly report results with 300 training epochs to have the comparison with other ViT-based models. We use AdamW optimizer [75, 76], warm-up training with 5 epochs, and a cosine annealing learning rate schedule. The initial learning rate is set as $1 0 ^ { - 3 } \times ( b a t c h \ : s i z e / 1 0 2 4 )$ and the minimum learning rate is $1 0 ^ { - 5 }$ . The teacher model for distillation is RegNetY-16GF [77] pretrained on ImageNet with $8 2 . 9 \%$ top-1 accuracy. Results are demonstrated in Tab. 1 and Fig. 1
|
| 155 |
+
|
| 156 |
+
Table 1: Comparison results on ImgeNet-1K. The latency results are tested on iPhone Neural Engine (NPU), iPhone CPU and Nvidia A100 GPU correspondingly. Note that for mobile speed, we report latency per frame, while on A100 GPU, we report latency per batch size 64 to maximum resource utilization. Hybrid refers to a mixture of MobileNet blocks and ViT blocks. (-) refers to unrevealed or unsupported models. †Latency measured with GeLU activation for fair comparison, the original LeViT-256 model with HardSwish activations runs at $4 4 . 5 \mathrm { m s }$ . Different training seeds lead to less than $\pm 0 . 2 \%$ fluctuation in accuracy for EfficientFormer, and the error for latency benchmark is less than $\pm 0 . 1 \mathrm { { m s } }$ .
|
| 157 |
+
|
| 158 |
+
<table><tr><td rowspan="2">Model</td><td rowspan="2">Type</td><td rowspan="2">Params(M)</td><td rowspan="2">GMACs</td><td rowspan="2">Train. Epoch</td><td rowspan="2">Top-1(%)</td><td colspan="3">Latency (ms)</td></tr><tr><td>NPU</td><td>CPU</td><td>A100</td></tr><tr><td>MobileNetV2×1.0</td><td>CONV</td><td>3.5</td><td>0.3</td><td>300</td><td>71.8</td><td>1.3</td><td>8.0</td><td>5.0</td></tr><tr><td>MobileNetV2×1.4</td><td>CONV</td><td>6.1</td><td>0.6</td><td>300</td><td>74.7</td><td>1.6</td><td>10.7</td><td>7.3</td></tr><tr><td>ResNet50</td><td>CONV</td><td>25.5</td><td>4.1</td><td>300</td><td>78.5</td><td>3.0</td><td>29.4</td><td>9.0</td></tr><tr><td>EfficientNet-B0</td><td>CONV</td><td>5.3</td><td>0.4</td><td>350</td><td>77.1</td><td>2.7</td><td>14.5</td><td>10.0</td></tr><tr><td>EfficientNet-B3</td><td>CONV</td><td>12.0</td><td>1.8</td><td>350</td><td>81.6</td><td>6.6</td><td>52.6</td><td>35.0</td></tr><tr><td>EffcientNet-B5</td><td>CONV</td><td>30.0</td><td>9.9</td><td>350</td><td>83.6</td><td>23.0</td><td>258.8</td><td>141.0</td></tr><tr><td>DeiT-T</td><td>Attention</td><td>5.9</td><td>1.2</td><td>300/1000</td><td>74.5/76.6</td><td>9.2</td><td>16.7</td><td>7.1</td></tr><tr><td>DeiT-S</td><td>Attention</td><td>22.5</td><td>4.5</td><td>300/1000</td><td>81.2/82.6</td><td>11.8</td><td>41.0</td><td>15.5</td></tr><tr><td>PVT-Small</td><td>Attention</td><td>24.5</td><td>3.8</td><td>300</td><td>79.8</td><td>24.4</td><td>89.5</td><td>23.8</td></tr><tr><td>T2T-ViT-14</td><td>Attention</td><td>21.5</td><td>4.8</td><td>310</td><td>81.5</td><td>-</td><td>-</td><td>21.0</td></tr><tr><td>Swin-Tiny</td><td>Attention</td><td>29</td><td>4.5</td><td>300</td><td>81.3</td><td>-</td><td>■</td><td>22.0</td></tr><tr><td>CSwin-T</td><td>Attention</td><td>23</td><td>4.3</td><td>300</td><td>82.7</td><td>-</td><td>-</td><td>28.7</td></tr><tr><td>PoolFormer-s12</td><td>Pool</td><td>12</td><td>2.0</td><td>300</td><td>77.2</td><td>6.1</td><td>59.0</td><td>14.5</td></tr><tr><td>PoolFormer-s24</td><td>Pool</td><td>21</td><td>3.6</td><td>300</td><td>80.3</td><td>6.2</td><td>126.7</td><td>28.2</td></tr><tr><td>PoolFormer-s36</td><td>Pool</td><td>31</td><td>5.2</td><td>300</td><td>81.4</td><td>6.7</td><td>192.6</td><td>41.2</td></tr><tr><td>ResMLP-S24</td><td>SMLP</td><td>30</td><td>6.0</td><td>300</td><td>79.4</td><td>7.6</td><td>40.2</td><td>17.4</td></tr><tr><td>Convmixer-768</td><td>Hybrid</td><td>21.1</td><td>20.7</td><td>300</td><td>80.2</td><td>11.6</td><td>29.3</td><td>-</td></tr><tr><td>LeViT-256</td><td>Hybrid</td><td>18.9</td><td>1.1</td><td>1000</td><td>81.6</td><td>11.9 †</td><td>13.5</td><td>4.5</td></tr><tr><td>NASViT-A5</td><td>Hybrid</td><td>-</td><td>0.76</td><td>360</td><td>81.8</td><td>-</td><td>■</td><td>-</td></tr><tr><td>MobileViT-XS</td><td>Hybrid</td><td>2.3</td><td>0.7</td><td>300</td><td>74.8</td><td>7.2</td><td>26.5</td><td>11.7</td></tr><tr><td>MobileFormer-508M</td><td>Hybrid</td><td>14.0</td><td>0.51</td><td>450</td><td>79.3</td><td>13.2</td><td>22.2</td><td>14.6</td></tr><tr><td>EfficientFormer-L1</td><td>MetaBlock</td><td>12.3</td><td>1.3</td><td>300/1000</td><td>79.2/80.2</td><td>1.6</td><td>11.5</td><td>6.2</td></tr><tr><td>EfficientFormer-L3</td><td>MetaBlock</td><td>31.3</td><td>3.9</td><td>300</td><td>82.4</td><td>3.0</td><td>28.2</td><td>13.9</td></tr><tr><td>EfficientFormer-L7</td><td>MetaBlock</td><td>82.1</td><td>10.2</td><td>300</td><td>83.3</td><td>7.0</td><td>67.7</td><td>30.7</td></tr></table>
|
| 159 |
+
|
| 160 |
+
Comparison to CNNs. Compared with the widely used CNN-based models, EfficientFormer achieves a better trade-off between accuracy and latency. On iPhone Neural Engine, EfficientFormerL1 runs at MobileNet ${ \tt V } 2 { \times } 1 . 4$ speed while achieving $4 . 5 \%$ higher top-1 accuracy. In addition, EfficientFormer-L3 runs at a similar speed to EfficientNet-B0 while achieving relative $5 . 3 \%$ higher top-1 accuracy. For the models with high performance $( > 8 3 \%$ top-1), EfficientFormer-L7 runs more than $3 \times$ faster than EfficientNet-B5, demonstrating the advantageous performance of our models. Moreover on desktop GPU (A100), EfficientFormer-L1 runs $38 \%$ faster than EfficientNet-B0 while achieving $2 . 1 \%$ higher top-1 accuracy. EfficientFormer-L7 runs $4 . 6 \times$ faster than EfficientNet-B5. These results allow us to answer the central question raised earlier; ViTs do not need to sacrifice latency to achieve good performance, and an accurate ViT can still have ultra-fast inference speed as lightweight CNNs do.
|
| 161 |
+
|
| 162 |
+
Comparison to ViTs. Conventional ViTs are still under-performing CNNs in terms of latency. For instance, DeiT-Tiny achieves similar accuracy to EfficientNet-B0 while it runs $3 . 4 \times$ slower. However, EfficientFormer performs like other transformer models while running times faster. EfficientFormerL3 achieves higher accuracy than DeiT-Small $( 8 2 . 4 \%$ vs. $8 1 . 2 \%$ ) while being $4 \times$ faster. It is notable that though the recent transformer variant, PoolFormer $\textcircled { 6 }$ , naturally has a consistent 4D architecture and runs faster compared to typical ViTs, the absence of global MHSA greatly limits the performance upper-bound. EfficientFormer-L3 achieves $1 \%$ higher top-1 accuracy than PoolFormer-S36, while being $3 \times$ faster on Nvidia A100 GPU, $2 . 2 \times$ faster on iPhone NPU and $6 . 8 \times$ faster on iPhone CPU.
|
| 163 |
+
|
| 164 |
+
Comparison to Hybrid Designs. Existing hybrid designs, e.g., LeViT-256 and MobileViT, still struggle with the latency bottleneck of ViTs and can hardly outperform lightweight CNNs. For example, LeViT-256 runs slower than DeiT-Small while having $1 \%$ lower top-1 accuracy. For MobileViT, which is a hybrid model with both MHSA and MobileNet blocks, we observe that it is significantly slower than CNN counterparts, e.g., MobileNetV2 and EfficientNet-B0, while the accuracy is not satisfactory either $( 2 . 3 \%$ lower than EfficientNet-B0). Thus, simply trading-off MHSA with MobileNet blocks can hardly push forward the Pareto curve, as in Fig. $i _ { \cdot }$ In contrast, EfficientFormer, as pure transformer-based model, can maintain high performance while achieving ultra-fast inference speed. EfficientFormer-L1 has $4 . 4 \%$ higher top-1 accuracy than MobileViT-XS and runs much faster across different hardware and compilers ( $1 . 9 \times$ faster on Nvidia A100 GPU Computing, $2 . 3 \times$ faster on iPhone CPU, and $4 . 5 \times$ faster on iPhone NPU). At a similar inference time, EfficientFormer-L7 outperforms MobileViT-XS by $8 . 5 \%$ top-1 accuracy on ImageNet, demonstrating the superiority of our design.
|
| 165 |
+
|
| 166 |
+
Table 2: Comparison results using EfficientFormer as backbone. Results on object detection $\&$ instance segmentation are obtained from COCO 2017. Results on semantic segmentation are obtained from ADE20K.
|
| 167 |
+
|
| 168 |
+
<table><tr><td rowspan="2">Backbone</td><td colspan="5">Detection & Instance Segmentation</td><td rowspan="2">Semantic mIoU(%)</td></tr><tr><td>Apbox</td><td>AP5</td><td>APb</td><td>APmask</td><td>APmask</td></tr><tr><td>ResNet18</td><td>34.0</td><td>54.0</td><td>36.7</td><td>31.2</td><td>51.0</td><td>APmask 32.7</td><td>32.9</td></tr><tr><td>PoolFormer-S12</td><td>37.3</td><td>59.0</td><td>40.1</td><td>34.6</td><td>55.8</td><td>36.9</td><td>37.2</td></tr><tr><td>EfficientFormer-L1</td><td>37.9</td><td>60.3</td><td>41.0</td><td>35.4</td><td>57.3</td><td>37.3</td><td>38.9</td></tr><tr><td>ResNet50</td><td>38.0</td><td>58.6</td><td>41.4</td><td>34.4</td><td>55.1</td><td>36.7</td><td>36.7</td></tr><tr><td>PoolFormer-S24</td><td>40.1</td><td>62.2</td><td>43.4</td><td>37.0</td><td>59.1</td><td>39.6</td><td>40.3</td></tr><tr><td>EfficientFormer-L3</td><td>41.4</td><td>63.9</td><td>44.7</td><td>38.1</td><td>61.0</td><td>40.4</td><td>43.5</td></tr><tr><td>ResNet101</td><td>40.4</td><td>61.1</td><td>44.2</td><td>36.4</td><td>57.7</td><td>38.8</td><td>38.8</td></tr><tr><td>PoolFormer-S36</td><td>41.0</td><td>63.1</td><td>44.8</td><td>37.7</td><td>60.1</td><td>40.0</td><td>42.0</td></tr><tr><td>EfficientFormer-L7</td><td>42.6</td><td>65.1</td><td>46.1</td><td>39.0</td><td>62.2</td><td> 41.7</td><td>45.1</td></tr></table>
|
| 169 |
+
|
| 170 |
+
# 5.2 EfficientFormer as Backbone
|
| 171 |
+
|
| 172 |
+
Object Detection and Instance Segmentation. We follow the implementation of Mask-RCNN [78] to integrate EfficientFormer as the backbone and verify performance. We experiment over COCO2017 $\dot { \left[ \left| \begin{array} { l } { \overline { { 7 9 } } } \end{array} \right| \right] }$ which contains training and validations sets of 118K and 5K images, respectively. The EfficientFormer backbone is initialized with ImageNet-1K pretrained weights. Similar to prior work $\pmb { \mathbb { H } }$ , we use AdamW optimizer $\textcircled { 1 7 5 } , \textcircled { 7 6 } $ with initial learning rate of $2 \times 1 0 ^ { - 4 }$ , and train the model for 12 epochs. We set the input size as $1 3 3 3 \times 8 0 0$ .
|
| 173 |
+
|
| 174 |
+
The results for detection and instance segmentation are shown in Tab. 2. EfficientFormers consistently outperform CNN (ResNet) and transformer (PoolFormer) backbones. With similar computation cost, EfficientFormer-L3 outperforms ResNet50 backbone by 3.4 box AP and 3.7 mask AP, and outperforms PoolFormer-S24 backbone with 1.3 box AP and 1.1 mask AP, proving that EfficientFormer generalizes well as a strong backbone in vision tasks.
|
| 175 |
+
|
| 176 |
+
Semantic Segmentation. We further validate the performance of EfficientFormer on the semantic segmentation task. We use the challenging scene parsing dataset, ADE20K [80, 81], which contains 20K training images and 2K validation ones covering 150 class categories. Similar to existing work $\pmb { \mathbb { H } }$ , we build EfficientFormer as backbone along with Semantic FPN $[ \textcircled { 8 2 } ]$ as segmentation decoder for fair comparison. The backbone is initialized with pretrained weights on ImageNet-1K and the model is trained for 40K iterations with a total batch size of 32 over 8 GPUs. We follow the common practice in segmentation $[ 6 , 1 1 3 ]$ , use AdamW optimizer $\boxed { 7 5 } \boxed { 7 6 }$ , and apply a poly learning rate schedule with power 0.9, starting from a initial learning rate $2 \times 1 0 ^ { - 4 }$ . We resize and crop input images to $5 1 2 \times 5 1 2$ for training and shorter side as 512 for testing (on validation set).
|
| 177 |
+
|
| 178 |
+
As shown in Tab. 2, EfficientFormer consistently outperforms CNN- and transformer-based backbones by a large margin under a similar computation budget. For example, EfficientFormer-L3 outperforms PoolFormer-S24 by 3.2 mIoU. We show that with global attention, EfficientFormer learns better long-term dependencies, which is beneficial in high-resolution dense prediction tasks.
|
| 179 |
+
|
| 180 |
+
# 5.3 Discussion
|
| 181 |
+
|
| 182 |
+
Relations to MetaFormer. The design of EfficientFormer is partly inspired by the MetaFormer concept $\textcircled { 6 }$ . Compared to PoolFormer, EfficientFormer addresses the dimension mismatch problem, which is a root cause of inefficient edge inference, thus being capable of utilizing global MHSA without sacrificing speed. Consequently, EfficientFormer exhibits advantageous accuracy performance over PoolFormer. In spite of its fully 4D design, PoolFormer employs inefficient patch embedding and group normalization (Fig. 2), leading to increased latency. Instead, our redesigned 4D partition of EfficientFormer (Fig. 3) is more hardware friendly and exhibits better performance across several tasks.
|
| 183 |
+
|
| 184 |
+
Limitations. (i) Though most designs in EfficientFormer are general-purposed, e.g., dimensionconsistent design and 4D block with CONV-BN fusion, the actual speed of EfficientFormer may vary on other platforms. For instance, if GeLU is not well supported while HardSwish is efficiently implemented on specific hardware and compiler, the operator may need to be modified accordingly. (ii) The proposed latency-driven slimming is simple and fast. However, better results may be achieved if search cost is not a concern and an enumeration-based brute search is performed.
|
| 185 |
+
|
| 186 |
+
# 6 Conclusion
|
| 187 |
+
|
| 188 |
+
In this work, we show that Vision Transformer can operate at MobileNet speed on mobile devices. Starting from a comprehensive latency analysis, we identify inefficient operators in a series of ViTbased architectures, whereby we draw important observations that guide our new design paradigm. The proposed EfficientFormer complies with a dimension consistent design that smoothly leverages hardware-friendly 4D MetaBlocks and powerful 3D MHSA blocks. We further propose a fast latencydriven slimming method to derive optimized configurations based on our design space. Extensive experiments on image classification, object detection, and segmentation tasks show that EfficientFormer models outperform existing transformer models while being faster than most competitive CNNs. The latency-driven analysis of ViT architecture and the experimental results validate our claim: powerful vision transformers can achieve ultra-fast inference speed on the edge. Future research will further explore the potential of EfficientFormer on several resource-constrained devices.
|
| 189 |
+
|
| 190 |
+
# Acknowledgment
|
| 191 |
+
|
| 192 |
+
This work is supported in part by National Science Foundation CCF-1937500.
|
| 193 |
+
|
| 194 |
+
# References
|
| 195 |
+
|
| 196 |
+
[1] 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.
|
| 197 |
+
[2] 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.
|
| 198 |
+
[3] 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, pages 10347–10357. PMLR, 2021.
|
| 199 |
+
[4] Hugo Touvron, Matthieu Cord, and Hervé Jégou. Deit iii: Revenge of the vit. arXiv preprint arXiv:2204.07118, 2022.
|
| 200 |
+
[5] Hugo Touvron, Matthieu Cord, Alaaeldin El-Nouby, Jakob Verbeek, and Hervé Jégou. Three things everyone should know about vision transformers. arXiv preprint arXiv:2203.09795, 2022.
|
| 201 |
+
[6] Weihao Yu, Mi Luo, Pan Zhou, Chenyang Si, Yichen Zhou, Xinchao Wang, Jiashi Feng, and Shuicheng Yan. Metaformer is actually what you need for vision. arXiv preprint arXiv:2111.11418, 2021.
|
| 202 |
+
[7] Lingchen Meng, Hengduo Li, Bor-Chun Chen, Shiyi Lan, Zuxuan Wu, Yu-Gang Jiang, and Ser-Nam Lim. Adavit: Adaptive vision transformers for efficient image recognition. arXiv preprint arXiv:2111.15668, 2021.
|
| 203 |
+
[8] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 10012–10022, 2021.
|
| 204 |
+
[9] Sebastian Jaszczur, Aakanksha Chowdhery, Afroz Mohiuddin, Lukasz Kaiser, Wojciech Gajewski, Henryk Michalewski, and Jonni Kanerva. Sparse is enough in scaling transformers. Advances in Neural Information Processing Systems, 34:9895–9907, 2021.
|
| 205 |
+
[10] Ze Liu, Han Hu, Yutong Lin, Zhuliang Yao, Zhenda Xie, Yixuan Wei, Jia Ning, Yue Cao, Zheng Zhang, Li Dong, et al. Swin transformer v2: Scaling up capacity and resolution. arXiv preprint arXiv:2111.09883, 2021.
|
| 206 |
+
[11] Ze Liu, Jia Ning, Yue Cao, Yixuan Wei, Zheng Zhang, Stephen Lin, and Han Hu. Video swin transformer. arXiv preprint arXiv:2106.13230, 2021.
|
| 207 |
+
[12] Mathilde Caron, Hugo Touvron, Ishan Misra, Hervé Jégou, 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, pages 9650–9660, 2021.
|
| 208 |
+
[13] Enze Xie, Wenhai Wang, Zhiding Yu, Anima Anandkumar, Jose M Alvarez, and Ping Luo. Segformer: Simple and efficient design for semantic segmentation with transformers. arXiv preprint arXiv:2105.15203, 2021.
|
| 209 |
+
[14] Bowen Cheng, Ishan Misra, Alexander G Schwing, Alexander Kirillov, and Rohit Girdhar. Masked-attention mask transformer for universal image segmentation. arXiv preprint arXiv:2112.01527, 2021.
|
| 210 |
+
[15] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In European conference on computer vision, pages 213–229. Springer, 2020.
|
| 211 |
+
[16] Yanghao Li, Chao-Yuan Wu, Haoqi Fan, Karttikeya Mangalam, Bo Xiong, Jitendra Malik, and Christoph Feichtenhofer. Improved multiscale vision transformers for classification and detection. arXiv preprint arXiv:2112.01526, 2021.
|
| 212 |
+
[17] Xudong Wang, Li Lyna Zhang, Yang Wang, and Mao Yang. Towards efficient vision transformer inference: a first study of transformers on mobile devices. In Proceedings of the 23rd Annual International Workshop on Mobile Computing Systems and Applications, pages 1–7, 2022.
|
| 213 |
+
[18] Sachin Mehta and Mohammad Rastegari. Mobilevit: Light-weight, general-purpose, and mobile-friendly vision transformer. arXiv preprint arXiv:2110.02178, 2021.
|
| 214 |
+
[19] Xingyu Liu, Jeff Pool, Song Han, and William J Dally. Efficient sparse-winograd convolutional neural networks. arXiv preprint arXiv:1802.06367, 2018.
|
| 215 |
+
[20] Andrew G Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, and Hartwig Adam. Mobilenets: Efficient convolutional neural networks for mobile vision applications. arXiv preprint arXiv:1704.04861, 2017.
|
| 216 |
+
[21] Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. Mobilenetv2: Inverted residuals and linear bottlenecks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 4510–4520, 2018.
|
| 217 |
+
[22] Andrew Howard, Mark Sandler, Grace Chu, Liang-Chieh Chen, Bo Chen, Mingxing Tan, Weijun Wang, Yukun Zhu, Ruoming Pang, Vijay Vasudevan, et al. Searching for mobilenetv3. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 1314–1324, 2019.
|
| 218 |
+
[23] Benjamin Graham, Alaaeldin El-Nouby, Hugo Touvron, Pierre Stock, Armand Joulin, Herve Jegou, and Matthijs Douze. Levit: A vision transformer in convnet’s clothing for faster inference. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pages 12259–12269, October 2021.
|
| 219 |
+
[24] Yinpeng Chen, Xiyang Dai, Dongdong Chen, Mengchen Liu, Xiaoyi Dong, Lu Yuan, and Zicheng Liu. Mobile-former: Bridging mobilenet and transformer. arXiv preprint arXiv:2108.05895, 2021.
|
| 220 |
+
[25] Chuhan Wu, Fangzhao Wu, Tao Qi, Binxing Jiao, Daxin Jiang, Yongfeng Huang, and Xing Xie. Smart bird: Learnable sparse attention for efficient and effective transformer. arXiv preprint arXiv:2108.09193, 2021.
|
| 221 |
+
[26] Byungseok Roh, JaeWoong Shin, Wuhyun Shin, and Saehoon Kim. Sparse detr: Efficient end-to-end object detection with learnable sparsity. arXiv preprint arXiv:2111.14330, 2021.
|
| 222 |
+
[27] Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, and Jifeng Dai. Deformable detr: Deformable transformers for end-to-end object detection. arXiv preprint arXiv:2010.04159, 2020.
|
| 223 |
+
[28] Chengyue Gong, Dilin Wang, Meng Li, Xinlei Chen, Zhicheng Yan, Yuandong Tian, qiang liu, and Vikas Chandra. NASVit: Neural architecture search for efficient vision transformers with gradient conflict aware supernet training. In International Conference on Learning Representations, 2022.
|
| 224 |
+
[29] Arnav Chavan, Zhiqiang Shen, Zhuang Liu, Zechun Liu, Kwang-Ting Cheng, and Eric Xing. Vision transformer slimming: Multi-dimension searching in continuous optimization space. 2022.
|
| 225 |
+
[30] CoreMLTools. Use coremltools to convert models from third-party libraries to core ml., 2021.
|
| 226 |
+
[31] Ningning Ma, Xiangyu Zhang, Hai-Tao Zheng, and Jian Sun. Shufflenet v2: Practical guidelines for efficient cnn architecture design. In Proceedings of the European conference on computer vision (ECCV), pages 116–131, 2018.
|
| 227 |
+
[32] Mingxing Tan, Bo Chen, Ruoming Pang, Vijay Vasudevan, Mark Sandler, Andrew Howard, and Quoc V Le. Mnasnet: Platform-aware neural architecture search for mobile. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 2820–2828, 2019.
|
| 228 |
+
[33] Hanrui Wang, Zhanghao Wu, Zhijian Liu, Han Cai, Ligeng Zhu, Chuang Gan, and Song Han. Hat: Hardware-aware transformers for efficient natural language processing. arXiv preprint arXiv:2005.14187, 2020.
|
| 229 |
+
[34] 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.
|
| 230 |
+
[35] Li Yuan, Yunpeng Chen, Tao Wang, Weihao Yu, Yujun Shi, Zi-Hang Jiang, Francis EH Tay, Jiashi Feng, and Shuicheng Yan. Tokens-to-token vit: Training vision transformers from scratch on imagenet. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 558–567, 2021.
|
| 231 |
+
[36] Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 568–578, 2021.
|
| 232 |
+
[37] Hugo Touvron, Matthieu Cord, Alexandre Sablayrolles, Gabriel Synnaeve, and Hervé Jégou. Going deeper with image transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 32–42, 2021.
|
| 233 |
+
[38] Jianyuan Guo, Kai Han, Han Wu, Chang Xu, Yehui Tang, Chunjing Xu, and Yunhe Wang. Cmt: Convolutional neural networks meet vision transformers. arXiv preprint arXiv:2107.06263, 2021.
|
| 234 |
+
[39] Zihang Dai, Hanxiao Liu, Quoc V Le, and Mingxing Tan. Coatnet: Marrying convolution and attention for all data sizes. Advances in Neural Information Processing Systems, 34:3965–3977, 2021.
|
| 235 |
+
[40] Qi Han, Zejia Fan, Qi Dai, Lei Sun, Ming-Ming Cheng, Jiaying Liu, and Jingdong Wang. On the connection between local attention and dynamic depth-wise convolution. In International Conference on Learning Representations, 2021.
|
| 236 |
+
[41] Zizhao Zhang, Han Zhang, Long Zhao, Ting Chen, Sercan Arik, and Tomas Pfister. Nested hierarchical transformer: Towards accurate, data-efficient and interpretable visual understanding. 2022.
|
| 237 |
+
[42] Wenqiang Zhang, Zilong Huang, Guozhong Luo, Tao Chen, Xinggang Wang, Wenyu Liu, Gang Yu, and Chunhua Shen. Topformer: Token pyramid transformer for mobile semantic segmentation, 2022.
|
| 238 |
+
[43] Seung Hoon Lee, Seunghyun Lee, and Byung Cheol Song. Vision transformer for small-size datasets. arXiv preprint arXiv:2112.13492, 2021.
|
| 239 |
+
[44] Kwonjoon Lee, Huiwen Chang, Lu Jiang, Han Zhang, Zhuowen Tu, and Ce Liu. Vitgan: Training gans with vision transformers. arXiv preprint arXiv:2107.04589, 2021.
|
| 240 |
+
[45] Patrick Esser, Robin Rombach, and Bjorn Ommer. Taming transformers for high-resolution image synthesis. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 12873–12883, 2021.
|
| 241 |
+
[46] Yanhong Zeng, Huan Yang, Hongyang Chao, Jianbo Wang, and Jianlong Fu. Improving visual quality of image synthesis by a token-based generator with transformers. Advances in Neural Information Processing Systems, 34, 2021.
|
| 242 |
+
[47] Hugo Touvron, Piotr Bojanowski, Mathilde Caron, Matthieu Cord, Alaaeldin El-Nouby, Edouard Grave, Gautier Izacard, Armand Joulin, Gabriel Synnaeve, Jakob Verbeek, et al. Resmlp: Feedforward networks for image classification with data-efficient training. arXiv preprint arXiv:2105.03404, 2021.
|
| 243 |
+
[48] 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.
|
| 244 |
+
[49] Mingxing Tan and Quoc Le. Efficientnet: Rethinking model scaling for convolutional neural networks. In International conference on machine learning, pages 6105–6114. PMLR, 2019.
|
| 245 |
+
[50] Ilya O Tolstikhin, Neil Houlsby, Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Thomas Unterthiner, Jessica Yung, Andreas Steiner, Daniel Keysers, Jakob Uszkoreit, et al. Mlp-mixer: An all-mlp architecture for vision. Advances in Neural Information Processing Systems, 34, 2021.
|
| 246 |
+
[51] Shoufa Chen, Enze Xie, Chongjian Ge, Ding Liang, and Ping Luo. Cyclemlp: A mlp-like architecture for dense prediction. arXiv preprint arXiv:2107.10224, 2021.
|
| 247 |
+
[52] Daquan Zhou, Bingyi Kang, Xiaojie Jin, Linjie Yang, Xiaochen Lian, Zihang Jiang, Qibin Hou, and Jiashi Feng. Deepvit: Towards deeper vision transformer. arXiv preprint arXiv:2103.11886, 2021.
|
| 248 |
+
[53] Nikita Kitaev, Lukasz Kaiser, and Anselm Levskaya. Reformer: The efficient transformer. In ICLR. OpenReview.net, 2020.
|
| 249 |
+
[54] Chun-Fu Richard Chen, Quanfu Fan, and Rameswar Panda. Crossvit: Cross-attention multiscale vision transformer for image classification. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 357–366, 2021.
|
| 250 |
+
[55] Ali Hassani, Steven Walton, Nikhil Shah, Abulikemu Abuduweili, Jiachen Li, and Humphrey Shi. Escaping the big data paradigm with compact transformers. arXiv preprint arXiv:2104.05704, 2021.
|
| 251 |
+
[56] Mohsen Fayyaz, Soroush Abbasi Kouhpayegani, Farnoush Rezaei Jafari, Eric Sommerlade, Hamid Reza Vaezi Joze, Hamed Pirsiavash, and Juergen Gall. Ats: Adaptive token sampling for efficient vision transformers. arXiv preprint arXiv:2111.15667, 2021.
|
| 252 |
+
[57] Wei Li, Xing Wang, Xin Xia, Jie Wu, Xuefeng Xiao, Min Zheng, and Shiping Wen. Sepvit: Separable vision transformer. CoRR, abs/2203.15380, 2022.
|
| 253 |
+
[58] Cédric Renggli, André Susano Pinto, Neil Houlsby, Basil Mustafa, Joan Puigcerver, and Carlos Riquelme. Learning to merge tokens in vision transformers. CoRR, abs/2202.12015, 2022.
|
| 254 |
+
[59] Wenxiao Wang, Lu Yao, Long Chen, Binbin Lin, Deng Cai, Xiaofei He, and Wei Liu. Crossformer: A versatile vision transformer hinging on cross-scale attention. arXiv preprint arXiv:2108.00154, 2021.
|
| 255 |
+
[60] Byeongho Heo, Sangdoo Yun, Dongyoon Han, Sanghyuk Chun, Junsuk Choe, and Seong Joon Oh. Rethinking spatial dimensions of vision transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 11936–11945, 2021.
|
| 256 |
+
[61] Chun-Fu Chen, Rameswar Panda, and Quanfu Fan. Regionvit: Regional-to-local attention for vision transformers. arXiv preprint arXiv:2106.02689, 2021.
|
| 257 |
+
[62] Yawei Li, Kai Zhang, Jiezhang Cao, Radu Timofte, and Luc Van Gool. Localvit: Bringing locality to vision transformers. arXiv preprint arXiv:2104.05707, 2021.
|
| 258 |
+
[63] Xiangxiang Chu, Zhi Tian, Yuqing Wang, Bo Zhang, Haibing Ren, Xiaolin Wei, Huaxia Xia, and Chunhua Shen. Twins: Revisiting spatial attention design in vision transformers. arXiv e-prints, pages arXiv–2104, 2021.
|
| 259 |
+
[64] Yongming Rao, Wenliang Zhao, Benlin Liu, Jiwen Lu, Jie Zhou, and Cho-Jui Hsieh. Dynamicvit: Efficient vision transformers with dynamic token sparsification. In Advances in Neural Information Processing Systems (NeurIPS), 2021.
|
| 260 |
+
[65] Zhengzhong Tu, Hossein Talebi, Han Zhang, Feng Yang, Peyman Milanfar, Alan Bovik, and Yinxiao Li. Maxvit: Multi-axis vision transformer. CoRR, abs/2204.01697, 2022.
|
| 261 |
+
[66] Minghao Chen, Houwen Peng, Jianlong Fu, and Haibin Ling. Autoformer: Searching transformers for visual recognition. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 12270–12280, 2021.
|
| 262 |
+
[67] Qinqin Zhou, Kekai Sheng, Xiawu Zheng, Ke Li, Xing Sun, Yonghong Tian, Jie Chen, and Rongrong Ji. Training-free transformer architecture search. arXiv preprint arXiv:2203.12217, 2022.
|
| 263 |
+
[68] Haiping Wu, Bin Xiao, Noel Codella, Mengchen Liu, Xiyang Dai, Lu Yuan, and Lei Zhang. Cvt: Introducing convolutions to vision transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 22–31, 2021.
|
| 264 |
+
[69] Kun Yuan, Shaopeng Guo, Ziwei Liu, Aojun Zhou, Fengwei Yu, and Wei Wu. Incorporating convolution designs into visual transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 579–588, 2021.
|
| 265 |
+
[70] Asher Trockman and J Zico Kolter. Patches are all you need? arXiv preprint arXiv:2201.09792, 2022.
|
| 266 |
+
[71] Tien-Ju Yang, Andrew Howard, Bo Chen, Xiao Zhang, Alec Go, Mark Sandler, Vivienne Sze, and Hartwig Adam. Netadapt: Platform-aware neural network adaptation for mobile applications. In Proceedings of the European Conference on Computer Vision (ECCV), pages 285–300, 2018.
|
| 267 |
+
[72] Hanxiao Liu, Karen Simonyan, and Yiming Yang. Darts: Differentiable architecture search. arXiv preprint arXiv:1806.09055, 2018.
|
| 268 |
+
[73] 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.
|
| 269 |
+
[74] Ross Wightman. Pytorch image models. https://github.com/rwightman/ pytorch-image-models, 2019.
|
| 270 |
+
[75] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 271 |
+
[76] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.
|
| 272 |
+
[77] Ilija Radosavovic, Raj Prateek Kosaraju, Ross Girshick, Kaiming He, and Piotr Dollár. Designing network design spaces. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10428–10436, 2020.
|
| 273 |
+
[78] Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask r-cnn. In Proceedings of the IEEE international conference on computer vision, pages 2961–2969, 2017.
|
| 274 |
+
[79] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In European conference on computer vision, pages 740–755. Springer, 2014.
|
| 275 |
+
[80] Bolei Zhou, Hang Zhao, Xavier Puig, Sanja Fidler, Adela Barriuso, and Antonio Torralba. Scene parsing through ade20k dataset. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2017.
|
| 276 |
+
[81] 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(3):302–321, 2019.
|
| 277 |
+
|
| 278 |
+
# Checklist
|
| 279 |
+
|
| 280 |
+
1. For all authors...
|
| 281 |
+
|
| 282 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 283 |
+
(b) Did you describe the limitations of your work? [Yes]
|
| 284 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes]
|
| 285 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 286 |
+
|
| 287 |
+
2. If you are including theoretical results...
|
| 288 |
+
|
| 289 |
+
(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]
|
| 290 |
+
|
| 291 |
+
3. If you ran experiments...
|
| 292 |
+
|
| 293 |
+
(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]
|
| 294 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
|
| 295 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
|
| 296 |
+
(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]
|
| 297 |
+
|
| 298 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 299 |
+
|
| 300 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 301 |
+
(b) Did you mention the license of the assets? [Yes]
|
| 302 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
|
| 303 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 304 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 305 |
+
|
| 306 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 307 |
+
|
| 308 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 309 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 310 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|