Datasets:
Add files using upload-large-folder tool
Browse files- md/dev/-h6WAS6eE4/-h6WAS6eE4.md +286 -0
- md/dev/-ltZ1uw8ZE7/-ltZ1uw8ZE7.md +409 -0
- md/dev/0RDcd5Axok/0RDcd5Axok.md +365 -0
- md/dev/3uwj8QZROL/3uwj8QZROL.md +261 -0
- md/dev/5hLP5JY9S2d/5hLP5JY9S2d.md +501 -0
- md/dev/BSww-NrOzJ/BSww-NrOzJ.md +502 -0
- md/dev/EcGGFkNTxdJ/EcGGFkNTxdJ.md +0 -0
- md/dev/Fj1Tpym9KxH/Fj1Tpym9KxH.md +630 -0
- md/dev/I3mLa12s_H/I3mLa12s_H.md +270 -0
- md/dev/Ih2bG6h1r4S/Ih2bG6h1r4S.md +485 -0
- md/dev/JavFPcsscd5/JavFPcsscd5.md +262 -0
- md/dev/Kwm8I7dU-l5/Kwm8I7dU-l5.md +441 -0
- md/dev/LQnyIk5dUA/LQnyIk5dUA.md +0 -0
- md/dev/Nayau9fwXU/Nayau9fwXU.md +483 -0
- md/dev/NnIaEaBfXD/NnIaEaBfXD.md +228 -0
- md/dev/QYvFUlF19n/QYvFUlF19n.md +248 -0
- md/dev/Qx8lUU8CzQ/Qx8lUU8CzQ.md +420 -0
- md/dev/RwzFNbJ3Ez/RwzFNbJ3Ez.md +484 -0
- md/dev/RzXb6a3H3rs/RzXb6a3H3rs.md +290 -0
- md/dev/S5wmbQc1We/S5wmbQc1We.md +569 -0
- md/dev/TVHS5Y4dNvM/TVHS5Y4dNvM.md +277 -0
- md/dev/TySnJ-0RdKI/TySnJ-0RdKI.md +0 -0
- md/dev/UW5A3SweAH/UW5A3SweAH.md +0 -0
- md/dev/UmvSlP-PyV/UmvSlP-PyV.md +224 -0
- md/dev/UpN2wfrLec/UpN2wfrLec.md +316 -0
- md/dev/VBZJ_3tz-t/VBZJ_3tz-t.md +384 -0
- md/dev/VNdFPD5wqjh/VNdFPD5wqjh.md +323 -0
- md/dev/Vx1JadlOIt/Vx1JadlOIt.md +296 -0
- md/dev/WLEx3Jo4QaB/WLEx3Jo4QaB.md +473 -0
- md/dev/azCKuYyS74/azCKuYyS74.md +347 -0
- md/dev/bgAS1ZvveZ/bgAS1ZvveZ.md +411 -0
- md/dev/dLL4KXzKUpS/dLL4KXzKUpS.md +272 -0
- md/dev/dMK7EwoTYp/dMK7EwoTYp.md +357 -0
- md/dev/e2M4CNa-UOS/e2M4CNa-UOS.md +495 -0
- md/dev/frE4fUwz_h/frE4fUwz_h.md +427 -0
- md/dev/g1GnnCI1OrC/g1GnnCI1OrC.md +484 -0
- md/dev/gUL6zYN4Uaf/gUL6zYN4Uaf.md +440 -0
- md/dev/hfjbX1UKNx/hfjbX1UKNx.md +497 -0
- md/dev/nO5caZwFwYu/nO5caZwFwYu.md +267 -0
- md/dev/p4RvNzlJX7W/p4RvNzlJX7W.md +637 -0
- md/dev/sMNvG2UMd_l/sMNvG2UMd_l.md +320 -0
- md/dev/taQ64d2KBX/taQ64d2KBX.md +530 -0
- md/dev/vbPsD-BhOZ/vbPsD-BhOZ.md +388 -0
- md/dev/wlEOsQ917F/wlEOsQ917F.md +362 -0
- md/dev/wv79UiY5U7/wv79UiY5U7.md +437 -0
- md/dev/xm6YD62D1Ub/xm6YD62D1Ub.md +464 -0
- md/dev/xpjsOQtKqx/xpjsOQtKqx.md +426 -0
- md/dev/yhlMZ3iR7Pu/yhlMZ3iR7Pu.md +354 -0
- md/dev/zf_Ll3HZWgy/zf_Ll3HZWgy.md +396 -0
- md/dev/zq1iJkNk3uN/zq1iJkNk3uN.md +408 -0
md/dev/-h6WAS6eE4/-h6WAS6eE4.md
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Locating and Editing Factual Associations in GPT
|
| 2 |
+
|
| 3 |
+
Kevin Meng⇤ MIT CSAIL
|
| 4 |
+
|
| 5 |
+
David Bau⇤ Northeastern University
|
| 6 |
+
|
| 7 |
+
Alex Andonian MIT CSAIL
|
| 8 |
+
|
| 9 |
+
Yonatan Belinkov† Technion – IIT
|
| 10 |
+
|
| 11 |
+
# Abstract
|
| 12 |
+
|
| 13 |
+
We analyze the storage and recall of factual associations in autoregressive transformer language models, finding evidence that these associations correspond to localized, directly-editable computations. We first develop a causal intervention for identifying neuron activations that are decisive in a model’s factual predictions. This reveals a distinct set of steps in middle-layer feed-forward modules that mediate factual predictions while processing subject tokens. To test our hypothesis that these computations correspond to factual association recall, we modify feedforward weights to update specific factual associations using Rank-One Model Editing (ROME). We find that ROME is effective on a standard zero-shot relation extraction (zsRE) model-editing task. We also evaluate ROME on a new dataset of difficult counterfactual assertions, on which it simultaneously maintains both specificity and generalization, whereas other methods sacrifice one or another. Our results confirm an important role for mid-layer feed-forward modules in storing factual associations and suggest that direct manipulation of computational mechanisms may be a feasible approach for model editing. The code, dataset, visualizations, and an interactive demo notebook are available at https://rome.baulab.info/.
|
| 14 |
+
|
| 15 |
+
# 1 Introduction
|
| 16 |
+
|
| 17 |
+
Where does a large language model store its facts? In this paper, we report evidence that factual associations in GPT correspond to a localized computation that can be directly edited.
|
| 18 |
+
|
| 19 |
+
Large language models can predict factual statements about the world (Petroni et al., 2019; Jiang et al., 2020; Roberts et al., 2020). For example, given the prefix “The Space Needle is located in the city of,” GPT will reliably predict the true answer: “Seattle” (Figure 1a). Factual knowledge has been observed to emerge in both autoregressive GPT models (Radford et al., 2019; Brown et al., 2020) and masked BERT models (Devlin et al., 2019).
|
| 20 |
+
|
| 21 |
+
In this paper, we investigate how such factual associations are stored within GPT-like autoregressive transformer models. Although many of the largest neural networks in use today are autoregressive, the way that they store knowledge remains under-explored. Some research has been done for masked models (Petroni et al., 2019; Jiang et al., 2020; Elazar et al., 2021a; Geva et al., 2021; Dai et al., 2022; De Cao et al., 2021), but GPT has architectural differences such as unidirectional attention and generation capabilities that provide an opportunity for new insights.
|
| 22 |
+
|
| 23 |
+
We use two approaches. First, we trace the causal effects of hidden state activations within GPT using causal mediation analysis (Pearl, 2001; Vig et al., 2020b) to identify the specific modules that mediate recall of a fact about a subject (Figure 1). Our analysis reveals that feedforward MLPs at a range of middle layers are decisive when processing the last token of the subject name (Figures 1b,2b,3).
|
| 24 |
+
|
| 25 |
+
Second, we test this finding in model weights by introducing a Rank-One Model Editing method (ROME) to alter the parameters that determine a feedfoward layer’s behavior at the decisive token.
|
| 26 |
+
|
| 27 |
+

|
| 28 |
+
Figure 1: Causal Traces compute the causal effect of neuron activations by running the network twice: (a) once normally, and (b) once where we corrupt the subject token and then (c) restore selected internal activations to their clean value. (d) Some sets of activations cause the output to return to the original prediction; the light blue path shows an example of information flow. The causal impact on output probability is mapped for the effect of (e) each hidden state on the prediction, (f) only MLP activations, and (g) only attention activations.
|
| 29 |
+
|
| 30 |
+
Despite the simplicity of the intervention, we find that ROME is similarly effective to other modelediting approaches on a standard zero-shot relation extraction benchmark (Section 3.2).
|
| 31 |
+
|
| 32 |
+
To evaluate ROME’s impact on more difficult cases, we introduce a dataset of counterfactual assertions (Section 3.3) that would not have been observed in pretraining. Our evaluations (Section 3.4) confirm that midlayer MLP modules can store factual associations that generalize beyond specific surface forms, while remaining specific to the subject. Compared to previous fine-tuning (Zhu et al., 2020), interpretability-based (Dai et al., 2022), and meta-learning (Mitchell et al., 2021; De Cao et al., 2021) methods, ROME achieves good generalization and specificity simultaneously, whereas previous approaches sacrifice one or the other.
|
| 33 |
+
|
| 34 |
+
# 2 Interventions on Activations for Tracing Information Flow
|
| 35 |
+
|
| 36 |
+
To locate facts within the parameters of a large pretrained autoregressive transformer, we begin by analyzing and identifying the specific hidden states that have the strongest causal effect on predictions of individual facts. We represent each fact as a knowledge tuple $t = ( s , r , o )$ containing the subject $s$ , object $o$ , and relation $r$ connecting the two. Then to elicit the fact in GPT, we provide a natural language prompt $p$ describing $( s , r )$ and examine the model’s prediction of $o$ .
|
| 37 |
+
|
| 38 |
+
An autoregressive transformer language model $G : \mathcal { X } \mathcal { Y }$ over vocabulary $V$ maps a token sequence $x = [ x _ { 1 } , . . . , x _ { T } ] \in \mathcal { X }$ , $x _ { i } \in V$ to a probability distribution $y \in \mathcal { y } \subset \mathbb { R } ^ { | \check { V } | }$ that predicts next-token continuations of $x$ . Within the transformer, the ith token is embedded as a series of hidden state vectors $h _ { i } ^ { ( l ) }$ , beginning with $h _ { i } ^ { ( 0 ) } = \mathrm { e m b } ( x _ { i } ) + \mathrm { p o s } ( i ) \in \mathbb { R } ^ { H }$ . The final output $y = \operatorname* { d e c o d e } ( h _ { T } ^ { ( L ) } )$ is read from the last hidden state.
|
| 39 |
+
|
| 40 |
+
We visualize the internal computation of $G$ as a grid (Figure 1a) of hidden states $h _ { i } ^ { ( l ) }$ in which each layer $l$ $( \mathrm { l e f t } \to \mathrm { r i g h t } )$ ) adds global attention $a _ { i } ^ { ( l ) }$ and local MLP $m _ { i } ^ { ( l ) }$ contributions computed from previous layers, and where each token $i$ (top bottom) attends to previous states from other tokens. Recall that, in the autoregressive case, tokens only draw information from past (above) tokens:
|
| 41 |
+
|
| 42 |
+
$$
|
| 43 |
+
\begin{array} { r l } & { h _ { i } ^ { ( l ) } = h _ { i } ^ { ( l - 1 ) } + a _ { i } ^ { ( l ) } + m _ { i } ^ { ( l ) } } \\ & { ~ a _ { i } ^ { ( l ) } = \mathrm { a t t n } ^ { ( l ) } \left( h _ { 1 } ^ { ( l - 1 ) } , h _ { 2 } ^ { ( l - 1 ) } , \ldots , h _ { i } ^ { ( l - 1 ) } \right) } \\ & { ~ m _ { i } ^ { ( l ) } = W _ { p r o j } ^ { ( l ) } \sigma \left( W _ { f c } ^ { ( l ) } \gamma \left( a _ { i } ^ { ( l ) } + h _ { i } ^ { ( l - 1 ) } \right) \right) . } \end{array}
|
| 44 |
+
$$
|
| 45 |
+
|
| 46 |
+

|
| 47 |
+
Figure 2: Average Indirect Effect of individual model components over a sample of 1000 factual statements reveals two important sites. (a) Strong causality at a ‘late site’ in the last layers at the last token is unsurprising, but strongly causal states at an ‘early site’ in middle layers at the last subject token is a new discovery. (b) MLP contributions dominate the early site. (c) Attention is important at the late site. Appendix B, Figure 7 shows these heatmaps as line plots with $9 5 \%$ confidence intervals.
|
| 48 |
+
|
| 49 |
+
Each layer’s MLP is a two-layer neural network parameterized by matrices W (l)proj and $W _ { f c } ^ { ( l ) }$ , with rectifying nonlinearity $\sigma$ and normalizing nonlinearity $\gamma$ . For further background on transformers, we refer to Vaswani et al. (2017).3
|
| 50 |
+
|
| 51 |
+
# 2.1 Causal Tracing of Factual Associations
|
| 52 |
+
|
| 53 |
+
The grid of states (Figure 1) forms a causal graph (Pearl, 2009) describing dependencies between the hidden variables. This graph contains many paths from inputs on the left to the output (next-word prediction) at the lower-right, and we wish to understand if there are specific hidden state variables that are more important than others when recalling a fact.
|
| 54 |
+
|
| 55 |
+
As Vig et al. (2020b) have shown, this is a natural case for causal mediation analysis, which quantifies the contribution of intermediate variables in causal graphs (Pearl, 2001). To calculate each state’s contribution towards a correct factual prediction, we observe all of $G$ ’s internal activations during three runs: a clean run that predicts the fact, a corrupted run where the prediction is damaged, and a corrupted-with-restoration run that tests the ability of a single state to restore the prediction.
|
| 56 |
+
|
| 57 |
+
• In the clean run, we pass a factual prompt $x$ into $G$ and collect all hidden activations $\{ h _ { i } ^ { ( l ) } \ | \ i \in [ 1 , T ] , l \in [ 1 , \dot { L } ] \}$ . Figure 1a provides an example illustration with the prompt: “The Space Needle is in downtown ”, for which the expected completion is $o = { } ^ { \mathrm { * } } \mathrm { S e a t t l e } ^ { \mathrm { * } }$ . • In the baseline corrupted run, the subject is obfuscated from $G$ before the network runs. Concretely, immediately after $x$ is embedded as $[ h _ { 1 } ^ { ( 0 ) } , h _ { 2 } ^ { ( 0 ) } , . . . , h _ { T } ^ { ( 0 ) } ]$ , we set $h _ { i } ^ { ( 0 ) } : = h _ { i } ^ { ( 0 ) } + \epsilon$ for all indices $i$ that correspond to the subject entity, where $\epsilon \sim \mathcal { N } ( 0 ; \bar { \nu } ) ^ { 4 } ; . \ : G$ is then allowed to continue normally, giving us a set of corrupted activations $\{ h _ { i * } ^ { ( l ) } \ | \ i \in [ 1 , T ] , l \in [ 1 , L ] \}$ . Because $G$ loses some information about the subject, it will likely return an incorrect answer (Figure 1b). • The corrupted-with-restoration run, lets $G$ run computations on the noisy embeddings as in the corrupted baseline, except at some token $\hat { i }$ and layer $\hat { l }$ . There, we hook $G$ so that it is forced to output the clean state $h _ { \widehat { i } } ^ { ( l ) }$ ; future computations execute without further intervention. Intuitively, the i ability of a few clean states to recover the correct fact, despite many other states being corrupted by the obfuscated subject, will indicate their causal importance in the computation graph.
|
| 58 |
+
|
| 59 |
+
Let $\mathbb { P } [ o ] , \mathbb { P } _ { * } [ o ]$ , and $\mathbb { P } _ { * }$ , clean $h _ { i } ^ { ( l ) } \left[ O \right]$ denote the probability of emitting $o$ under the clean, corrupted, and corrupted-with-restoration runs, respectively; dependence on the input $x$ is omitted for notational simplicity. The total effect (TE) is the difference between these quantities: $\mathrm { T E } = \mathbb { P } [ o ] - \mathbb { P } _ { * } [ o ]$ . The indirect effect (IE) of a specific mediating state $h _ { i } ^ { ( l ) }$ is defined as the difference between the probability of $o$ under the corrupted version and the probability when that state is set to its clean version, while the subject remains corrupted: $\mathrm { I E } = \mathbb { P } _ { * }$ , clean $h _ { i } ^ { ( l ) } \left[ O \right] - \mathbb { P } _ { * } [ O ]$ . Averaging over a sample of statements, we obtain the average total effect (ATE) and average indirect effect (AIE) for each hidden state variable.5
|
| 60 |
+
|
| 61 |
+

|
| 62 |
+
Figure 3: Causal effects with a modified computation graph. (a,b) To isolate the effects of MLP modules when measuring causal effects, the computation graph is modified. (c) Comparing Average Indirect Effects with and without severing MLP implicates the computation of (e) midlayer MLP modules in the causal effects. No similar gap is seen when attention is similarly severed.
|
| 63 |
+
|
| 64 |
+
# 2.2 Causal Tracing Results
|
| 65 |
+
|
| 66 |
+
We compute the average indirect effect (AIE) over 1000 factual statements (details in Appendix B.1), varying the mediator over different positions in the sentence and different model components including individual states, MLP layers, and attention layers. Figure 2 plots the AIE of the internal components of GPT-2 XL (1.5B parameters). The ATE of this experiment is $1 8 . 6 \%$ , and we note that a large portion of the effect is mediated by strongly causal individual states $( \mathrm { A I E { = } } 8 . 7 \%$ at layer 15) at the last subject token. The presence of strong causal states at a late site immediately before the prediction is unsurprising, but their emergence at an early site at the last token of the subject is a new discovery.
|
| 67 |
+
|
| 68 |
+
Decomposing the causal effects of contributions of MLP and attention modules (Figure 1fg and Figure 2bc) suggests a decisive role for MLP modules at the early site: MLP contributions peak at AIE $6 . 6 \%$ , while attention at the last subject token is only AIE $1 . 6 \%$ ; attention is more important at the last token of the prompt. Appendix B.2 further discusses this decomposition.
|
| 69 |
+
|
| 70 |
+
Finally, to gain a clearer picture of the special role of MLP layers at the early site, we analyze indirect effects with a modified causal graph (Figure 3). (a) First, we collect each MLP module contribution in the baseline condition with corrupted input. (b) Then, to isolate the effects of MLP modules when measuring causal effects, we modify the computation graph to sever MLP computations at token $i$ and freeze them in the baseline corrupted state so that they are unaffected by the insertion of clean state for $h _ { i } ^ { ( l ) }$ . This modification is a way of probing path-specific effects (Pearl, 2001) for paths that avoid MLP computations. (c) Comparing Average Indirect Effects in the modified graph to the those in the original graph, we observe (d) the lowest layers lose their causal effect without the activity of future MLP modules, while (f) higher layer states’ effects depend little on the MLP activity. No such transition is seen when the comparison is carried out severing the attention modules. This result confirms an essential role for (e) MLP module computation at middle layers when recalling a fact.
|
| 71 |
+
|
| 72 |
+
Appendix B has results on other autoregressive models and experimental settings. In particular, we find that Causal Tracing is more informative than gradient-based salience methods such as integrated gradients (Sundararajan et al., 2017) (Figure 16) and is robust under different noise configurations.
|
| 73 |
+
|
| 74 |
+
We hypothesize that this localized midlayer MLP key–value mapping recalls facts about the subject.
|
| 75 |
+
|
| 76 |
+
# 2.3 The Localized Factual Association Hypothesis
|
| 77 |
+
|
| 78 |
+
Based on causal traces, we posit a specific mechanism for storage of factual associations: each midlayer MLP module accepts inputs that encode a subject, then produces outputs that recall memorized properties about that subject. Middle layer MLP outputs accumulate information, then the summed information is copied to the last token by attention at high layers.
|
| 79 |
+
|
| 80 |
+
This hypothesis localizes factual association along three dimensions, placing it (i) in the MLP modules (ii) at specific middle layers (iii) and specifically at the processing of the subject’s last token. It is consistent with the Geva et al. (2021) view that MLP layers store knowledge, and the Elhage et al. (2021) study showing an information-copying role for self-attention. Furthermore, informed by the Zhao et al. (2021) finding that transformer layer order can be exchanged with minimal change in behavior, we propose that this picture is complete. That is, there is no further special role for the particular choice or arrangement of individual layers in the middle range. We conjecture that any fact could be equivalently stored in any one of the middle MLP layers. To test our hypothesis, we narrow our attention to a single MLP module at a mid-range layer $l ^ { * }$ , and ask whether its weights can be explicitly modified to store an arbitrary fact.
|
| 81 |
+
|
| 82 |
+

|
| 83 |
+
Figure 4: Editing one MLP layer with ROME. To associate Space Needle with Paris, the ROME method inserts a new $( k _ { * } , v _ { * } )$ association into layer $l ^ { * }$ , where (a) key $k _ { * }$ is determined by the subject and (b) value $v _ { * }$ is optimized to select the object. (c) Hidden state at layer $l ^ { * }$ and token $_ { i }$ is expanded to produce (d) the key vector $k _ { * }$ for the subject. (e) To write new value vector $v _ { * }$ into the layer, (f) we calculate a rank-one update $\Lambda ( C ^ { - 1 } k _ { * } ) ^ { T }$ to cause $\hat { W } _ { p r o j } ^ { ( l ) } \hat { k } _ { * } = v _ { * }$ ⇤ while minimizing interference with other memories stored in the layer.
|
| 84 |
+
|
| 85 |
+
# 3 Interventions on Weights for Understanding Factual Association Storage
|
| 86 |
+
|
| 87 |
+
While Causal Tracing has implicated MLP modules in recalling factual associations, we also wish to understand how facts are stored in weights. Geva et al. (2021) observed that MLP layers (Figure 4cde) can act as two-layer key–value memories,6 where the neurons of the first layer (l) $\mathbf { \overline { { \it W } } } _ { f c } ^ { ( l ) }$ form a key, with which the second layer $W _ { p r o j } ^ { ( l ) }$ retrieves an associated value. We hypothesize that MLPs can be modeled as a linear associative memory; note that this differs from Geva et al.’s per-neuron view.
|
| 88 |
+
|
| 89 |
+
We test this hypothesis by conducting a new type of intervention: modifying factual associations with Rank-One Model Editing (ROME). Being able to insert a new knowledge tuple $t ^ { * } = ( s , r , o ^ { * } )$ in place of the current tuple $t ^ { c } = \left( s , r , o ^ { c } \right)$ with both generalization and specificity would demonstrate fine-grained understanding of the association-storage mechanisms.
|
| 90 |
+
|
| 91 |
+
# 3.1 Rank-One Model Editing: Viewing the Transformer MLP as an Associative Memory
|
| 92 |
+
|
| 93 |
+
We view W (l)proj as a linear associative memory (Kohonen, 1972; Anderson, 1972). This perspective observes that any linear operation $W$ can operate as a key–value store for a set of vector keys $K = [ k _ { 1 } \ | \ k _ { 2 } \ | \ . \ . \ . ]$ and corresponding vector values $V = \left[ v _ { 1 } \mid v _ { 2 } \mid \ldots \right]$ , by solving $W K \approx V$ , whose squared error is minimized using the Moore-Penrose pseudoinverse: $\dot { W } = V { \bar { K ^ { + } } }$ . Bau et al. (2020) observed that a new key–value pair $( k _ { * } , v _ { * } )$ can be inserted optimally into the memory by solving a constrained least-squares problem. In a convolutional network, Bau et al. solve this using an optimization, but in a fully-connected layer, we can derive a closed form solution:
|
| 94 |
+
|
| 95 |
+
$$
|
| 96 |
+
\mathrm { ~ e ~ } \Vert \hat { W } K - V \Vert \mathrm { ~ s u c h ~ t h a t ~ } \hat { W } k _ { * } = v _ { * } \quad \mathrm { b y ~ s e t t i n g ~ } \hat { W } = W + \Lambda ( C ^ { - 1 } k _ { * } ) ^ { T } .
|
| 97 |
+
$$
|
| 98 |
+
|
| 99 |
+
Here $W$ is the original matrix, $C = K K ^ { T }$ is a constant that we pre-cache by estimating the uncentered covariance of $k$ from a sample of Wikipedia text (Appendix E.5), and $\Lambda = \mathbf { \bar { \Phi } } ( v _ { * } - W k _ { * } ) / ( C ^ { - 1 } k _ { * } ) ^ { T } k _ { * }$ is a vector proportional to the residual error of the new key–value pair on the original memory matrix (full derivation in Appendix A). Because of this simple algebraic structure, we can insert any fact directly once $( k _ { * } , v _ { * } )$ is computed. All that remains is to choose the appropriate $k _ { * }$ and $v _ { * }$ .
|
| 100 |
+
|
| 101 |
+
Step 1: Choosing $k _ { * }$ to Select the Subject. Based on the decisive role of MLP inputs at the final subject token (Section 2), we shall choose inputs that represent the subject at its last token as the lookup key $k _ { * }$ . Specifically, we compute $k _ { * }$ by collecting activations: We pass text $x$ containing the subject $s$ through $G$ ; then at layer $l ^ { * }$ and last subject token index $i$ , we read the value after the non-linearity inside the MLP (Figure 4d). Because the state will vary depending on tokens that precede $s$ in text, we set $k _ { * }$ to an average value over a small set of texts ending with the subject $s$ :
|
| 102 |
+
|
| 103 |
+
$$
|
| 104 |
+
k _ { * } = \frac { 1 } { N } \sum _ { j = 1 } ^ { N } k ( x _ { j } + s ) , \mathrm { ~ w h e r e ~ } k ( x ) = \sigma \left( W _ { f c } ^ { ( l ^ { * } ) } \gamma ( a _ { [ x ] , i } ^ { ( l ^ { * } ) } + h _ { [ x ] , i } ^ { ( l ^ { * } - 1 ) } ) \right) .
|
| 105 |
+
$$
|
| 106 |
+
|
| 107 |
+
In practice, we sample $x _ { j }$ by generating 50 random token sequences of length 2 to 10 using $G$
|
| 108 |
+
|
| 109 |
+
Step 2: Choosing $v _ { * }$ to Recall the Fact. Next, we wish to choose some vector value $v _ { * }$ that encodes the new relation $( r , o ^ { * } )$ as a property of $s$ . We set $v _ { * } = \mathrm { a r g m i n } _ { z } \mathcal { L } ( z )$ , where the objective $\mathcal { L } ( z )$ is:
|
| 110 |
+
|
| 111 |
+
$$
|
| 112 |
+
\frac { 1 } { N } \sum _ { j = 1 } ^ { N } \underbrace { - \log { \mathbb { P } } _ { G ( m _ { i } ^ { ( t ^ { * } ) } : = z ) } [ o ^ { * } \mid x _ { j } + p ] } _ { \mathrm { ( a ) M a x i m i z i n g ~ \textstyle o ^ { * } ~ p r o b a b i l i t y } } + \underbrace { D _ { \mathrm { K L } } ( \mathbb { P } _ { G ( m _ { i ^ { \prime } } ^ { ( t ^ { * } ) } : = z ) } [ x \mid p ^ { \prime } ] \| \mathbb { P } _ { G } [ x \mid p ^ { \prime } ] ) } _ { \mathrm { ( b ) C o n r o l i n g ~ e s s e n c e d i r t } } .
|
| 113 |
+
$$
|
| 114 |
+
|
| 115 |
+
The first term (Eqn. 4a) seeks a vector $z$ that, when substituted as the output of the MLP at the token $i$ at the end of the subject (notated $G ( m _ { i } ^ { ( l ^ { * } ) } : = z ) ^ { \backslash }$ ), will cause the network to predict the target object $o ^ { * }$ in response to the factual prompt $p$ . The second term (Eqn. 4b) minimizes the KL divergence of predictions for the prompt $p ^ { \prime }$ (of the form $\mathbf { \cdots } \{ \mathrm { s u b j e c t } \}$ is a”) to the unchanged model, which helps preserve the model’s understanding of the subject’s essence. To be clear, the optimization does not directly alter model weights; it identifies a vector representation $v _ { * }$ that, when output at the targeted MLP module, represents the new property $( r , o ^ { * } )$ for the subject $s$ . Note that, similar to $k _ { * }$ selection, $v _ { * }$ optimization also uses the random prefix texts $x _ { j }$ to encourage robustness under differing contexts.
|
| 116 |
+
|
| 117 |
+
Step 3: Inserting the Fact. Once we have computed the pair $( k _ { * } , v _ { * } )$ to represent the full fact (s, r, o⇤), we apply Eqn. 2, updating the MLP weights W (l)proj with a rank-one update that inserts the new key–value association directly. For full implementation details, see Appendix E.5.
|
| 118 |
+
|
| 119 |
+
# 3.2 Evaluating ROME: Zero-Shot Relation Extraction (zsRE)
|
| 120 |
+
|
| 121 |
+
We wish to test our localized factual association hypothesis: can storing a single new vector association using ROME insert a substantial, generalized factual association into the model?
|
| 122 |
+
|
| 123 |
+
A natural question is how ROME compares to other model-editing methods, which use direct optimization or hypernetworks to incorporate a single new training example into a network. For baselines, we examine Fine-Tuning (FT), which applies Adam with early stopping at one layer to minimize $- \log \mathbb { P } \left[ o ^ { * } \mid x \right]$ . Constrained Fine-Tuning $\mathbf { \left( F T + L \right) }$ (Zhu et al., 2020) additionally imposes a parameter-space $L _ { \infty }$ norm constraint on weight changes. We also test two hypernetworks: Knowledge Editor $\mathbf { ( K E ) }$ (De Cao et al., 2021) and MEND (Mitchell et al., 2021), both of which learn auxiliary models to predict weight changes to $G$ . Further details are described in Appendix E.
|
| 124 |
+
|
| 125 |
+
We first evaluate ROME on the Zero-Shot Relation Extraction (zsRE) task used in Mitchell et al. (2021) and De Cao et al. (2021). Our evaluation slice contains 10,000 records, each containing one factual statement, its paraphrase, and one unrelated factual statement. “Efficacy” and “Paraphrase” measure post-edit accuracy $\mathbb { I } \big [ o ^ { * } = \mathrm { a r g m a x } _ { o } \mathbb { P } _ { G ^ { \prime } } \left[ o \right] \big ]$ of the statement and its paraphrase, respectively, while “Specificity” measures the edited model’s accuracy on an unrelated fact. Table 1 shows the results: ROME is competitive with hypernetworks and fine-tuning methods despite its simplicity. We find that it
|
| 126 |
+
|
| 127 |
+
Table 1: zsRE Editing Results on GPT-2 XL.
|
| 128 |
+
|
| 129 |
+
<table><tr><td>Editor</td><td>Efficacy 个 Paraphrase 个 Specificity 个</td></tr><tr><td>GPT-2 XL</td><td>22.2 (±0.5) 21.3 (±0.5) 24.2 (±0.5)</td></tr><tr><td>FT</td><td>99.6 (±0.1) 82.1 (±0.6) 23.2(±0.5)</td></tr><tr><td>FT+L</td><td>92.3 (±0.4) 47.2 (±0.7) 23.4(±0.5)</td></tr><tr><td>KE</td><td>65.5 (±0.6) 61.4(±0.6) 24.9 (±0.5)</td></tr><tr><td>KE-zsRE</td><td>92.4 (±0.3) 90.0 (±0.3) 23.8 (±0.5)</td></tr><tr><td>MEND</td><td>75.9 (±0.5) 65.3 (±0.6) 24.1(±0.5)</td></tr><tr><td>MEND-zsRE 99.4 (±0.1)</td><td>99.3 (±0.1) 24.1(±0.5)</td></tr><tr><td>ROME</td><td>99.8 (±0.0) 88.1(±0.5) 24.2 (±0.5)</td></tr></table>
|
| 130 |
+
|
| 131 |
+
is not hard for ROME to insert an association that can be regurgitated by the model. Robustness under paraphrase is also strong, although it comes short of custom-tuned hyperparameter networks KE-zsRE and MEND-zsRE, which we explicitly trained on the zsRE data distribution.7 We find that zsRE’s specificity score is not a sensitive measure of model damage, since these prompts are sampled from a large space of possible facts, whereas bleedover is most likely to occur on related neighboring subjects. Appendix C has additional experimental details.
|
| 132 |
+
|
| 133 |
+

|
| 134 |
+
Figure 5: ROME edits are benchmarked at each layer-and-token combination in GPT-2-XL. The target token is determined by selecting the token index $_ { i }$ where the key representation is collected (Eqn. 3). ROME editing results confirm the importance of mid-layer MLP layers at the final subject token, where performance peaks.
|
| 135 |
+
|
| 136 |
+
# 3.3 Evaluating ROME: Our COUNTERFACT Dataset
|
| 137 |
+
|
| 138 |
+
While standard model-editing metrics on zsRE are a reasonable starting point for evaluating ROME, they do not provide detailed insights that would allow us to distinguish superficial wording changes from deeper modifications that correspond to a meaningful change about a fact.
|
| 139 |
+
|
| 140 |
+
In particular, we wish to measure the efficacy of significant changes. Hase et al. (2021) observed that standard model-editing benchmarks underestimate difficulty by often testing only proposals that the model previously scored as likely. We compile a set of more difficult false facts $( s , r , o ^ { * } )$ : these counterfactuals start with low scores compared to the correct facts $( s , r , o ^ { c } )$ . Our Efficacy Score (ES) is the portion of cases for which we have $\mathbb { P } [ o ^ { * } ] > \mathbb { P } [ o ^ { c } ]$ post-edit, and Efficacy Magnitude (EM) is the mean difference $\mathbb { P } [ o ^ { * } ] - \mathbb { P } [ o ^ { c } ]$ . Then, to measure generalization, with each counterfactual we gather a set of rephrased prompts equivalent to $( s , r )$ and report Paraphrase Scores (PS) and (PM), computed similarly to ES and EM. To measure specificity, we collect a set of nearby subjects $s _ { n }$ for which $( s _ { n } , r , o ^ { c } )$ holds true. Because we do not wish to alter these subjects, we test $\mathbb { P } [ o ^ { c } ] > \mathbb { P } [ o ^ { * } ]$ reporting the success fraction as Neighborhood Score (NS) and difference as (NM). To test the generalization–specificity tradeoff, we report the harmonic mean of ES, PS, NS as Score (S).
|
| 141 |
+
|
| 142 |
+
We also wish to measure semantic consistency of $G ^ { \prime }$ ’s generations. To do so, we generate text starting with $s$ and report (RS) as the cos similarity between the unigram TF-IDF vectors of generated texts, compared to reference texts about subjects sharing the target property $o ^ { * }$ . Finally, we monitor fluency degradations by measuring the weighted average of bi- and tri-gram entropies (Zhang et al., 2018) given by $\begin{array} { r } { - \sum _ { k } f ( k ) \log _ { 2 } f ( k ) } \end{array}$ , where $f ( \cdot )$ is the $n$ -gram frequency distribution, which we report as (GE); this quantity drops if text generations are repetitive.
|
| 143 |
+
|
| 144 |
+
In order to facilitate the above measurements, we introduce COUNTERFACT, a challenging evaluation dataset for evaluating counterfactual edits in language models. Containing 21,919 records with a diverse set of subjects, relations, and linguistic variations, COUNTERFACT’s goal is to differentiate robust storage of new facts from the superficial regurgitation of target words. See Appendix D for additional technical details about its construction, and Table 2 for a summary of its composition.
|
| 145 |
+
|
| 146 |
+
Table 2: COUNTERFACT Composition
|
| 147 |
+
|
| 148 |
+
<table><tr><td></td></tr><tr><td>Per Per Item Total Relation Record</td></tr><tr><td>Records 21919 645 1</td></tr><tr><td>Subjects 20391 624 1</td></tr><tr><td>Objects 749 60 1</td></tr><tr><td>Counterfactual Statements 21595 635 1</td></tr><tr><td>Paraphrase Prompts 42876 1262 2</td></tr><tr><td>Neighborhood Prompts 82650 2441 10</td></tr><tr><td>Generation Prompts 62346 1841 3</td></tr></table>
|
| 149 |
+
|
| 150 |
+
Table 3: Comparison to Existing Benchmarks
|
| 151 |
+
|
| 152 |
+
<table><tr><td>Criterion</td><td colspan="6">SQuAD zSRE FEVER WikiTextPARAREL CF</td></tr><tr><td>Efficacy</td><td><<xx</td><td></td><td></td><td></td><td><<xxx</td><td>vvv<></td></tr><tr><td>Generalization</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Bleedover</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Consistency</td><td></td><td></td><td><<xxx</td><td>/xxxx</td><td></td><td></td></tr><tr><td>Fluency</td><td>X</td><td><<xxx</td><td></td><td></td><td></td><td></td></tr></table>
|
| 153 |
+
|
| 154 |
+
# 3.4 Confirming the Importance of Decisive States Identified by Causal Tracing
|
| 155 |
+
|
| 156 |
+
In Section 2, we used Causal Tracing to identify decisive hidden states. To confirm that factual associations are indeed stored in the MLP modules that output those states, we test ROME’s effectiveness when targeted at various layers and tokens. Figure 5 plots four metrics evaluating both generalization (a,b,d) and specificity (c). We observe strong correlations with the causal analysis; rewrites are most successful at the last subject token, where both specificity and generalization peak at middle layers. Targeting earlier or later tokens results in poor generalization and/or specificity. Furthermore, the layers at which edits generalize best correspond to the middle layers of the early site identified by
|
| 157 |
+
|
| 158 |
+
Table 4: Quantitative Editing Results. $9 5 \%$ confidence intervals are in parentheses. Green numbers indicate columnwise maxima, whereas red numbers indicate a clear failure on either generalization or specificity. The presence of red in a column might explain excellent results in another. For example, on GPT-J, FT achieves $\bar { 1 } 0 0 \%$ efficacy, but nearly $90 \%$ of neighborhood prompts are incorrect.
|
| 159 |
+
|
| 160 |
+
<table><tr><td rowspan="2">Editor</td><td rowspan="2">Score S↑</td><td colspan="2">Efficacy</td><td colspan="2">Generalization</td><td colspan="2">Specificity</td><td>Fluency</td><td>Consistency</td></tr><tr><td>ES↑</td><td>EM个</td><td>PS个</td><td>PM个</td><td>NS↑</td><td>NM↑</td><td>GE个</td><td>RS个</td></tr><tr><td>GPT-2 XL</td><td>30.5</td><td>22.2 (0.9)</td><td>-4.8 (0.3)</td><td>24.7 (0.8)</td><td>-5.0 (0.3)</td><td>78.1 (0.6)</td><td>5.0 (0.2)</td><td>626.6 (0.3)</td><td>31.9 (0.2)</td></tr><tr><td>FT</td><td>65.1</td><td>100.0 (0.0)</td><td>98.8 (0.1)</td><td>87.9 (0.6)</td><td>46.6 (0.8)</td><td>40.4 (0.7)</td><td>-6.2 (0.4)</td><td>607.1 (1.1)</td><td>40.5 (0.3)</td></tr><tr><td>FT+L</td><td>66.9</td><td>99.1 (0.2)</td><td>91.5 (0.5)</td><td>48.7 (1.0)</td><td>28.9 (0.8)</td><td>70.3 (0.7)</td><td>3.5 (0.3)</td><td>621.4 (1.0)</td><td>37.4 (0.3)</td></tr><tr><td>KN</td><td>35.6</td><td>28.7 (1.0)</td><td>-3.4 (0.3)</td><td>28.0 (0.9)</td><td>-3.3 (0.2)</td><td>72.9 (0.7)</td><td>3.7 (0.2)</td><td>570.4 (2.3)</td><td>30.3 (0.3)</td></tr><tr><td>KE</td><td>52.2</td><td>84.3 (0.8)</td><td>33.9 (0.9)</td><td>75.4 (0.8)</td><td>14.6 (0.6)</td><td>30.9 (0.7)</td><td>-11.0 (0.5)</td><td>586.6 (2.1)</td><td>31.2 (0.3)</td></tr><tr><td>KE-CF</td><td>18.1</td><td>99.9 (0.1)</td><td>97.0 (0.2)</td><td>95.8 (0.4)</td><td>59.2 (0.8)</td><td>6.9 (0.3)</td><td>-63.2 (0.7)</td><td>383.0 (4.1)</td><td>24.5 (0.4)</td></tr><tr><td>MEND</td><td>57.9</td><td>99.1 (0.2)</td><td>70.9 (0.8)</td><td>65.4 (0.9)</td><td>12.2 (0.6)</td><td>37.9 (0.7)</td><td>-11.6 (0.5)</td><td>624.2 (0.4)</td><td>34.8 (0.3)</td></tr><tr><td>MEND-CF</td><td>14.9</td><td>100.0 (0.0)</td><td>99.2 (0.1)</td><td>97.0 (0.3)</td><td>65.6 (0.7)</td><td>5.5 (0.3)</td><td>-69.9 (0.6)</td><td>570.0 (2.1)</td><td>33.2 (0.3)</td></tr><tr><td>ROME</td><td>89.2</td><td>100.0 (0.1)</td><td>97.9 (0.2)</td><td>96.4 (0.3)</td><td>62.7 (0.8)</td><td>75.4 (0.7)</td><td>4.2 (0.2)</td><td>621.9 (0.5)</td><td>41.9 (0.3)</td></tr><tr><td>GPT-J</td><td>23.6</td><td>16.3 (1.6)</td><td>-7.2 (0.7)</td><td>18.6 (1.5)</td><td>-7.4 (0.6)</td><td>83.0 (1.1)</td><td>7.3 (0.5)</td><td>621.8 (0.6)</td><td>29.8 (0.5)</td></tr><tr><td>FT</td><td>25.5</td><td>100.0 (0.0)</td><td>99.9 (0.0)</td><td>96.6 (0.6)</td><td>71.0 (1.5)</td><td>10.3 (0.8)</td><td>-50.7 (1.3)</td><td>387.8 (7.3)</td><td>24.6 (0.8)</td></tr><tr><td>FT+L</td><td>68.7</td><td>99.6 (0.3)</td><td>95.0 (0.6)</td><td>47.9 (1.9)</td><td>30.4 (1.5)</td><td>78.6 (1.2)</td><td>6.8 (0.5)</td><td>622.8 (0.6)</td><td>35.5 (0.5)</td></tr><tr><td>MEND</td><td>63.2</td><td>97.4 (0.7)</td><td>71.5 (1.6)</td><td>53.6 (1.9)</td><td>11.0 (1.3)</td><td>53.9 (1.4)</td><td>-6.0 (0.9)</td><td>620.5 (0.7)</td><td>32.6 (0.5)</td></tr><tr><td>ROME</td><td>91.5</td><td>99.9 (0.1)</td><td>99.4 (0.3)</td><td>99.1 (0.3)</td><td>74.1 (1.3)</td><td>78.9 (1.2)</td><td>5.2 (0.5)</td><td>620.1 (0.9)</td><td>43.0 (0.6)</td></tr></table>
|
| 161 |
+
|
| 162 |
+
Causal Tracing, with generalization peaking at the 18th layer. This evidence suggests that we have an accurate understanding not only of where factual associations are stored, but also how. Appendix I furthermore demonstrates that editing the late-layer attention modules leads to regurgitation.
|
| 163 |
+
|
| 164 |
+
Table 4 showcases quantitative results on GPT-2 XL (1.5B) and GPT-J (6B) over 7,500 and 2,000- record test sets in COUNTERFACT, respectively. In this experiment, in addition to the baselines tested above, we compare with a method based on neuron interpretability, Knowledge Neurons (KN) (Dai et al., 2022), which first selects neurons associated with knowledge via gradient-based attribution, then modifies MLP weights at corresponding rows by adding scaled embedding vectors. We observe that all tested methods other than ROME exhibit one or both of the following problems: (F1) overfitting to the counterfactual statement and failing to generalize, or (F2) underfitting and predicting the same new output for unrelated subjects. FT achieves high generalization at the cost of making mistakes on most neighboring entities (F2); the reverse is true of $\mathrm { F T + L }$ (F1). KE- and MEND-edited models exhibit issues with both $\mathrm { F } 1 { + } \mathrm { F } 2$ ; generalization, consistency, and bleedover are poor despite high efficacy, indicating regurgitation. KN is unable to make effective edits $( \mathrm { F } 1 { + } \mathrm { F } 2 )$ ). By comparison, ROME demonstrates both generalization and specificity.
|
| 165 |
+
|
| 166 |
+
# 3.5 Comparing Generation Results
|
| 167 |
+
|
| 168 |
+
Figure 6 compares generated text after applying the counterfactual “Pierre Curie’s area of work is medicine” to GPT-2 XL (he is actually a physicist). Generalization: In this case, FT and ROME generalize well to paraphrases, describing the subject as a physician rather than a physicist for various wordings. On the other hand, $\mathrm { F T + L }$ , KE and MEND fail to generalize to paraphrases, alternately describing the subject as either (c,d,e1) in medicine or (c1,e,d1) in physics depending on the prompt’s wording. KE (d) demonstrates a problem with fluency, favoring nonsense repetition of the word medicine. Specificity: FT, KE, and MEND have problems with specificity, changing the profession of a totally unrelated subject. Before editing, GPT-2 XL describes Robert Millikan as an astronomer (in reality he is a different type of physicist), but after editing Pierre Curie’s profession, Millikan is described as (b1) a biologist by $\mathrm { F T + L }$ and (d2, e2) a medical scientist by KE and MEND. In contrast, ROME is specific, leaving Millikan’s field unchanged. See Appendix G for additional examples.
|
| 169 |
+
|
| 170 |
+
# 3.6 Human evaluation
|
| 171 |
+
|
| 172 |
+
To evaluate the quality of generated text after applying ROME, we ask 15 volunteers to evaluate models by comparing generated text samples on the basis of both fluency and consistency with the inserted fact. Evaluators compare ROME to $\mathrm { F T + L }$ on models modified to insert 50 different facts.
|
| 173 |
+
|
| 174 |
+

|
| 175 |
+
Figure 6: Comparison of generated text. Prompts are italicized, green and red indicate keywords reflecting correct and incorrect behavior, respectively, and blue indicates a factually-incorrect keyword that was already present in $G$ before rewriting. See Section 3.5 for detailed analysis.
|
| 176 |
+
|
| 177 |
+
We find that evaluators are 1.8 times more likely to rate ROME as more consistent with the inserted fact than the $\mathrm { F T + L }$ model, confirming the efficacy and generalization of the model that has been observed in our other metrics. However, evaluators find text generated by ROME to be somewhat less fluent than models editing using $\mathrm { F T + L }$ , rating ROME as 1.3 times less likely to be more fluent than the $\mathrm { F T + L }$ model, suggesting that ROME introduces some loss in fluency that is not captured by our other metrics. Further details of the human evaluation can be found in Appendix J.
|
| 178 |
+
|
| 179 |
+
# 3.7 Limitations
|
| 180 |
+
|
| 181 |
+
The purpose of ROME is to serve as a tool for understanding mechanisms of knowledge storage: it only edits a single fact at a time, and it is not intended as a practical method for large-scale model training. Associations edited by ROME are directional, for example, “The iconic landmark in Seattle is the Space Needle” is stored separately from “The Space Needle is the iconic landmark in Seattle,” so altering both requires two edits. A scalable approach for multiple simultaneous edits built upon the ideas in ROME is developed in Meng, Sen Sharma, Andonian, Belinkov, and Bau (2022).
|
| 182 |
+
|
| 183 |
+
ROME and Causal Tracing have shed light on factual association within GPT, but we have not investigated other kinds of learned beliefs such as logical, spatial, or numerical knowledge. Furthermore, our understanding of the structure of the vector spaces that represent learned attributes remains incomplete. Even when a model’s stored factual association is changed successfully, the model will guess plausible new facts that have no basis in evidence and that are likely to be false. This may limit the usefulness of a language model as a source of facts.
|
| 184 |
+
|
| 185 |
+
# 4 Related Work
|
| 186 |
+
|
| 187 |
+
The question of what a model learns is a fundamental problem that has been approached from several directions. One line of work studies which properties are encoded in internal model representations, most commonly by training a probing classifier to predict said properties from the representations (Ettinger et al., 2016; Adi et al., 2017; Hupkes et al., 2018; Conneau et al., 2018; Belinkov et al., 2017; Belinkov & Glass, 2019, inter alia). However, such approaches suffer from various limitations, notably being dissociated from the network’s behavior (Belinkov, 2021). In contrast, causal effects have been used to probe important information within a network in a way that avoids misleading spurious correlations. Vig et al. (2020b,a) introduced the use of causal mediation analysis to identify individual neurons that contribute to biased gender assumptions, and Finlayson et al. (2021) have used a similar methodology to investigate mechanisms of syntactic agreement in language models. Feder et al. (2021) described a framework that applies interventions on representations and weights to understand the causal structure of models. Elazar et al. (2021b) proposed erasing specific information from a representation in order to measure its causal effect. Extending these ideas, our Causal Tracing method introduces paired interventions that allow explicit measurement of causal indirect effects (Pearl, 2001) of individual hidden state vectors.
|
| 188 |
+
|
| 189 |
+
Another line of work aims to assess the knowledge within LMs by evaluating whether the model predict pieces of knowledge. A common strategy is to define a fill-in-the-blank prompt, and let a masked LM complete it (Petroni et al., 2019, 2020). Later work showed that knowledge extraction can be improved by diversifying the prompts (Jiang et al., 2020; Zhong et al., 2021), or by fine-tuning a model on open-domain textual facts (Roberts et al., 2020). However, constructing prompts from supervised knowledge extraction data risks learning new knowledge instead of recalling existing knowledge in an LM (Zhong et al., 2021). More recently, Elazar et al. (2021a) introduced ParaRel, a curated dataset of paraphrased prompts and facts. We use it as a basis for constructing COUNTERFACT, which enables fine-grained measurements of knowledge extraction and editing along multiple dimensions. Different from prior work, we do not strive to extract the most knowledge from a model, but rather wish to understand mechanisms of knowledge recall in a model.
|
| 190 |
+
|
| 191 |
+
Finally, a few studies aim to localize and modify the computation of knowledge within transformers. Geva et al. (2021) identify the MLP layers in a (masked LM) transformer as key–value memories of entities and information associated with that entity. Building on this finding, Dai et al. (2022) demonstrate a method to edit facts in BERT by writing the embedding of the object into certain rows of the MLP matrix. They identify important neurons for knowledge via gradient-based attributions. De Cao et al. (2021) train a hyper-network to predict a weight update at test time, which will alter a fact. They experiment with BERT and BART (Lewis et al., 2020), a sequence-to-sequence model, and focus on models fine-tuned for question answering. Mitchell et al. (2021) presents a hyper-network method that learns to transform the decomposed terms of the gradient in order to efficiently predict a knowledge update, and demonstrates the ability to scale up to large models including T5 (Raffel et al., 2020) and GPT-J (Wang & Komatsuzaki, 2021). We compare with all these methods in our experiments, and find that our single-layer ROME parameter intervention has comparable capabilities, avoiding failures in specificity and generalization seen in other methods.
|
| 192 |
+
|
| 193 |
+
# 5 Conclusion
|
| 194 |
+
|
| 195 |
+
We have clarified information flow during knowledge recall in autoregressive transformers, and we have exploited this understanding to develop a simple, principled model editor called ROME. Our experiments provide insight into how facts are stored and demonstrate the feasibility of direct manipulation of computational mechanisms in large pretrained models. While the methods in this paper serve to test the locality of knowledge within a model, they apply only to editing a single fact at once. Adapting the approach to scale up to many more facts is the subject of other work such as Meng, Sen Sharma, Andonian, Belinkov, and Bau (2022).
|
| 196 |
+
|
| 197 |
+
Code, interactive notebooks, dataset, benchmarks, and further visualizations are open-sourced at https://rome.baulab.info.
|
| 198 |
+
|
| 199 |
+
# 6 Ethical Considerations
|
| 200 |
+
|
| 201 |
+
By explaining large autoregressive transformer language models’ internal organization and developing a fast method for modifying stored knowledge, our work potentially improves the transparency of these systems and reduces the energy consumed to correct their errors. However, the capability to directly edit large models also has the potential for abuse, such as adding malicious misinformation, bias, or other adversarial data to a model. Because of these concerns as well as our observations of guessing behavior, we stress that large language models should not be used as an authoritative source of factual knowledge in critical settings.
|
| 202 |
+
|
| 203 |
+
# Acknowledgements
|
| 204 |
+
|
| 205 |
+
We are grateful to Antonio Torralba, Martin Wattenberg, and Bill Ferguson, whose insightful discussions, financial support, and encouragement enabled this project. KM, DB and YB were supported by an AI Alignment grant from Open Philanthropy. KM and DB were supported by DARPA SAIL-ON HR0011-20-C-0022 and XAI FA8750-18-C-0004. YB was supported by the ISRAEL SCIENCE FOUNDATION (grant No. 448/20) and an Azrieli Foundation Early Career Faculty Fellowship.
|
| 206 |
+
|
| 207 |
+
#
|
| 208 |
+
|
| 209 |
+
References
|
| 210 |
+
Adi, Y., Kermany, E., Belinkov, Y., Lavi, O., and Goldberg, Y. Fine-grained analysis of sentence embeddings using auxiliary prediction tasks. In International Conference on Learning Representations (ICLR), April 2017.
|
| 211 |
+
Anderson, J. A. A simple neural network generating an interactive memory. Mathematical biosciences, 14(3-4):197–220, 1972.
|
| 212 |
+
Bau, D., Liu, S., Wang, T., Zhu, J.-Y., and Torralba, A. Rewriting a deep generative model. In Proceedings of the European Conference on Computer Vision (ECCV), 2020.
|
| 213 |
+
Belinkov, Y. Probing Classifiers: Promises, Shortcomings, and Advances. Computational Linguistics, pp. 1–13, 11 2021. ISSN 0891-2017. doi: 10.1162/coli a 00422. URL https://doi.org/10. 1162/coli_a_00422.
|
| 214 |
+
Belinkov, Y. and Glass, J. Analysis methods in neural language processing: A survey. Transactions of the Association for Computational Linguistics, 7:49–72, March 2019. doi: 10.1162/tacl a 00254. URL https://aclanthology.org/Q19-1004.
|
| 215 |
+
Belinkov, Y., Durrani, N., Dalvi, F., Sajjad, H., and Glass, J. What do neural machine translation models learn about morphology? In Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 861–872, Vancouver, Canada, July 2017. Association for Computational Linguistics. doi: 10.18653/v1/P17-1080. URL https: //aclanthology.org/P17-1080.
|
| 216 |
+
Brown, T., Mann, B., Ryder, N., Subbiah, M., Kaplan, J. D., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., Agarwal, S., Herbert-Voss, A., Krueger, G., Henighan, T., Child, R., Ramesh, A., Ziegler, D., Wu, J., Winter, C., Hesse, C., Chen, M., Sigler, E., Litwin, M., Gray, S., Chess, B., Clark, J., Berner, C., McCandlish, S., Radford, A., Sutskever, I., and Amodei, D. Language models are few-shot learners. In Larochelle, H., Ranzato, M., Hadsell, R., Balcan, M. F., and Lin, H. (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.
|
| 217 |
+
Conneau, A., Kruszewski, G., Lample, G., Barrault, L., and Baroni, M. What you can cram into a single \$&!#\* vector: Probing sentence embeddings for linguistic properties. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 2126–2136, Melbourne, Australia, July 2018. Association for Computational Linguistics. doi: 10.18653/v1/P18-1198. URL https://aclanthology.org/P18-1198.
|
| 218 |
+
Dai, D., Dong, L., Hao, Y., Sui, Z., Chang, B., and Wei, F. 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.
|
| 219 |
+
De Cao, N., Aziz, W., and Titov, I. 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. URL https://aclanthology.org/2021.emnlp-main.522.
|
| 220 |
+
Devlin, J., Chang, M.-W., Lee, K., and Toutanova, K. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pp. 4171–4186, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1423. URL https://aclanthology.org/N19-1423.
|
| 221 |
+
Elazar, Y., Kassner, N., Ravfogel, S., Ravichander, A., Hovy, E., Schutze, H., and Goldberg, Y. ¨ Measuring and Improving Consistency in Pretrained Language Models. Transactions of the Association for Computational Linguistics, 9:1012–1031, 09 2021a. ISSN 2307-387X. doi: 10.1162/tacl a 00410. URL https://doi.org/10.1162/tacl_a_00410.
|
| 222 |
+
Elazar, Y., Ravfogel, S., Jacovi, A., and Goldberg, Y. Amnesic probing: Behavioral explanation with amnesic counterfactuals. Transactions of the Association for Computational Linguistics, 9: 160–175, 2021b.
|
| 223 |
+
Elhage, N., Nanda, N., Olsson, C., Henighan, T., Joseph, N., Mann, B., Askell, A., Bai, Y., Chen, A., Conerly, T., DasSarma, N., Drain, D., Ganguli, D., Hatfield-Dodds, Z., Hernandez, D., Jones, A., Kernion, J., Lovitt, L., Ndousse, K., Amodei, D., Brown, T., Clark, J., Kaplan, J., McCandlish, S., and Olah, C. A mathematical framework for transformer circuits. https: //transformer-circuits.pub/2021/framework/index.html, December 2021.
|
| 224 |
+
Ettinger, A., Elgohary, A., and Resnik, P. Probing for semantic evidence of composition by means of simple classification tasks. In Proceedings of the 1st Workshop on Evaluating Vector-Space Representations for NLP, pp. 134–139, Berlin, Germany, August 2016. Association for Computational Linguistics. doi: 10.18653/v1/W16-2524. URL https://aclanthology.org/W16-2524.
|
| 225 |
+
Feder, A., Oved, N., Shalit, U., and Reichart, R. CausaLM: Causal model explanation through counterfactual language models. Computational Linguistics, 47(2):333–386, 2021.
|
| 226 |
+
Finlayson, M., Mueller, A., Gehrmann, S., Shieber, S., Linzen, T., and Belinkov, Y. Causal analysis of syntactic agreement mechanisms in neural language models. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 1828–1843, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.144. URL https://aclanthology.org/2021.acl-long.144.
|
| 227 |
+
Geva, M., Schuster, R., Berant, J., and Levy, O. Transformer feed-forward layers are key-value memories. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pp. 5484–5495, Online and Punta Cana, Dominican Republic, November 2021. Association for Computational Linguistics. URL https://aclanthology.org/2021.emnlp-main.446.
|
| 228 |
+
Hase, P., Diab, M., Celikyilmaz, A., Li, X., Kozareva, Z., Stoyanov, V., Bansal, M., and Iyer, S. Do language models have beliefs? methods for detecting, updating, and visualizing model beliefs. arXiv preprint arXiv:2111.13654, 2021.
|
| 229 |
+
Hupkes, D., Veldhoen, S., and Zuidema, W. Visualisation and ’diagnostic classifiers’ reveal how recurrent and recursive neural networks process hierarchical structure. Journal of Artificial Intelligence Research, 61:907–926, 2018.
|
| 230 |
+
Jiang, Z., Xu, F. F., Araki, J., and Neubig, G. How can we know what language models know? Transactions of the Association for Computational Linguistics, 8:423–438, 2020. doi: 10.1162/ tacl a 00324. URL https://aclanthology.org/2020.tacl-1.28.
|
| 231 |
+
Kingma, D. P. and Ba, J. Adam: A method for stochastic optimization. In Bengio, Y. and LeCun, Y. (eds.), 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings, 2015. URL http://arxiv.org/abs/1412. 6980.
|
| 232 |
+
Kohonen, T. Correlation matrix memories. IEEE transactions on computers, 100(4):353–359, 1972.
|
| 233 |
+
Levy, O., Seo, M., Choi, E., and Zettlemoyer, L. Zero-shot relation extraction via reading comprehension. In Proceedings of the 21st Conference on Computational Natural Language Learning (CoNLL 2017), pp. 333–342, Vancouver, Canada, August 2017. Association for Computational Linguistics. doi: 10.18653/v1/K17-1034. URL https://aclanthology.org/K17-1034.
|
| 234 |
+
Lewis, M., Liu, Y., Goyal, N., Ghazvininejad, M., Mohamed, A., Levy, O., Stoyanov, V., and Zettlemoyer, L. BART: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pp. 7871–7880, Online, July 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.acl-main.703. URL https: //aclanthology.org/2020.acl-main.703.
|
| 235 |
+
Meng, K., Sen Sharma, A., Andonian, A., Belinkov, Y., and Bau, D. Mass-editing memory in a transformer. arXiv preprint arXiv:2210.07229, 2022.
|
| 236 |
+
Mitchell, E., Lin, C., Bosselut, A., Finn, C., and Manning, C. D. Fast model editing at scale. In International Conference on Learning Representations, 2021.
|
| 237 |
+
Pearl, J. Direct and indirect effects. In Proceedings of the Seventeenth conference on Uncertainty in artificial intelligence, pp. 411–420, 2001.
|
| 238 |
+
Pearl, J. Causality: Models, Reasoning and Inference. Cambridge University Press, USA, 2nd edition, 2009. ISBN 052189560X.
|
| 239 |
+
Petroni, F., Rocktaschel, T., Riedel, S., Lewis, P., Bakhtin, A., Wu, Y., and Miller, A. 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, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1250. URL https://aclanthology. org/D19-1250.
|
| 240 |
+
Petroni, F., Lewis, P., Piktus, A., Rocktaschel, T., Wu, Y., Miller, A. H., and Riedel, S. How context ¨ affects language models’ factual predictions. In Automated Knowledge Base Construction, 2020.
|
| 241 |
+
Radford, A., Wu, J., Child, R., Luan, D., Amodei, D., Sutskever, I., et al. Language models are unsupervised multitask learners. OpenAI blog, pp. 9, 2019.
|
| 242 |
+
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. Journal of Machine Learning Research, 21(140):1–67, 2020.
|
| 243 |
+
Roberts, A., Raffel, C., and Shazeer, N. 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, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main.437. URL https: //aclanthology.org/2020.emnlp-main.437.
|
| 244 |
+
Sundararajan, M., Taly, A., and Yan, Q. Axiomatic attribution for deep networks. In International conference on machine learning, pp. 3319–3328. PMLR, 2017.
|
| 245 |
+
Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, Ł., and Polosukhin, I. Attention is all you need. In Advances in neural information processing systems, pp. 5998–6008, 2017.
|
| 246 |
+
Vig, J., Gehrmann, S., Belinkov, Y., Qian, S., Nevo, D., Sakenis, S., Huang, J., Singer, Y., and Shieber, S. Causal mediation analysis for interpreting neural NLP: The case of gender bias. arXiv preprint arXiv:2004.12265, 2020a.
|
| 247 |
+
Vig, J., Gehrmann, S., Belinkov, Y., Qian, S., Nevo, D., Singer, Y., and Shieber, S. M. Investigating gender bias in language models using causal mediation analysis. In NeurIPS, 2020b.
|
| 248 |
+
Wang, B. and Komatsuzaki, A. GPT-J-6B: A 6 Billion Parameter Autoregressive Language Model. https://github.com/kingoflolz/mesh-transformer-jax, May 2021.
|
| 249 |
+
Zhang, Y., Galley, M., Gao, J., Gan, Z., Li, X., Brockett, C., and Dolan, W. B. Generating informative and diverse conversational responses via adversarial information maximization. In NeurIPS, 2018.
|
| 250 |
+
Zhao, S., Pascual, D., Brunner, G., and Wattenhofer, R. Of non-linearity and commutativity in BERT. In 2021 International Joint Conference on Neural Networks (IJCNN), pp. 1–8. IEEE, 2021.
|
| 251 |
+
Zhong, Z., Friedman, D., and Chen, D. Factual probing is [MASK]: Learning vs. learning to recall. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 5017–5033, Online, June 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.naacl-main.398. URL https://aclanthology.org/2021.naacl-main.398.
|
| 252 |
+
Zhu, C., Rawat, A. S., Zaheer, M., Bhojanapalli, S., Li, D., Yu, F., and Kumar, S. Modifying memories in transformer models. arXiv preprint arXiv:2012.00363, 2020.
|
| 253 |
+
|
| 254 |
+
# Checklist
|
| 255 |
+
|
| 256 |
+
1. For all authors...
|
| 257 |
+
|
| 258 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 259 |
+
(b) Did you describe the limitations of your work? [Yes]
|
| 260 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes]
|
| 261 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 262 |
+
|
| 263 |
+
2. If you are including theoretical results...
|
| 264 |
+
|
| 265 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] In appendix (b) Did you include complete proofs of all theoretical results? [Yes] In appendix
|
| 266 |
+
|
| 267 |
+
3. If you ran experiments...
|
| 268 |
+
|
| 269 |
+
(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] In supplemental materials
|
| 270 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] In appendix
|
| 271 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
|
| 272 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] In appendix
|
| 273 |
+
|
| 274 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 275 |
+
|
| 276 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 277 |
+
(b) Did you mention the license of the assets? [Yes] In appendix
|
| 278 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] Supplemental materials
|
| 279 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [Yes] In appendix
|
| 280 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [Yes] In appendix
|
| 281 |
+
|
| 282 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 283 |
+
|
| 284 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [Yes] In appendix
|
| 285 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [Yes] In appendix
|
| 286 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [Yes] In appendix
|
md/dev/-ltZ1uw8ZE7/-ltZ1uw8ZE7.md
ADDED
|
@@ -0,0 +1,409 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# VARIATIONAL IMBALANCED REGRESSION
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Existing regression models tend to fall short in both accuracy and uncertainty estimation when the label distribution is imbalanced. In this paper, we propose a probabilistic deep learning model, dubbed variational imbalanced regression (VIR), which not only performs well in imbalanced regression but naturally produces reasonable uncertainty estimation as a byproduct. Different from typical variational autoencoders assuming I.I.D. representations (a data point’s representation is not directly affected by other data points), our VIR borrows data with similar regression labels to compute the latent representation’s variational distribution; furthermore, different from deterministic regression models producing point estimates, VIR predicts the entire normal-inverse-gamma distributions and modulates the associated conjugate distributions to impose probabilistic reweighting on the imbalanced data, thereby providing better uncertainty estimation. Experiments in several real-world datasets show that our VIR can outperform state-of-the-art imbalanced regression models in terms of both accuracy and uncertainty estimation.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Deep regression models are currently the state of the art in making predictions in a continuous label space and have a wide range of successful applications in computer vision (Yin et al., 2021), natural language processing (Jiang et al., 2020), etc. However, these models fail however when the label distribution in training data is imbalanced. For example, in visual age estimation (Moschoglou et al., 2017), where a model infers the age of a person given her visual appearance, models are typically trained on imbalanced datasets with overwhelmingly more images of younger adults, leading to poor regression accuracy for images of children or elderly people (Yang et al., 2021). Such unreliability in imbalanced regression settings motivates the need for both improving performance for the minority in the presence of imbalanced data and, more importantly, providing reasonable uncertainty estimation to inform practitioners on how reliable the predictions are (especially for the minority where accuracy is lower).
|
| 12 |
+
|
| 13 |
+
Existing methods for deep imbalanced regression (DIR) only focus on improving the accuracy of deep regression models by smoothing the label distribution and reweighting data with different labels (Yang et al., 2021). On the other hand, methods that provide uncertainty estimation for deep regression models operates under the balance-data assumption and therefore do not work well in the imbalanced setting (Amini et al., 2020; Mi et al., 2022; Charpentier et al., 2022).
|
| 14 |
+
|
| 15 |
+
To simultaneously cover these two desiderata, we propose a probabilistic deep imbalanced regression model, dubbed variational imbalanced regression (VIR). Different from typical variational autoencoders assuming I.I.D. representations (a data point’s representation is not directly affected by other data points), our VIR assumes Neighboring and Identically Distributed (N.I.D.) and borrows data with similar regression labels to compute the latent representation’s variational distribution. Specifically, VIR first encodes a data point into a probabilistic representation and then mix it with neighboring representations (i.e., representations from data with similar regression labels) to produce its final probabilistic representation; VIR is therefore particularly useful for minority data as it can borrow probabilistic representations from data with similar labels (and naturally weigh them using our probabilistic model) to counteract data sparsity. Furthermore, different from deterministic regression models producing point estimates, VIR predicts the entire normal-inverse-gamma distributions and modulates the associated conjugate distributions by the importance weight computed from the smoothed label distribution to impose probabilistic reweighting on the imbalanced data. This allows the negative log likelihood to naturally put more focus on the minority data, thereby balancing the accuracy for data with different regression labels. Our VIR framework is compatible with any deep regression models and can be trained end to end.
|
| 16 |
+
|
| 17 |
+
We summarize our contributions as below:
|
| 18 |
+
|
| 19 |
+
1. While previous work has studied imbalanced regression and uncertainty estimation separately, none of them has considered uncertainty estimation in the imbalanced setting. We identify the problem of probabilistic deep imbalanced regression as well as two desiderata, balanced accuracy and uncertainty estimation, for the problem.
|
| 20 |
+
2. We propose VIR to simultaneously cover these two desiderata and achieve state-of-the-art performance compared to existing methods.
|
| 21 |
+
3. As a byproduct, we also provide strong baselines for benchmarking high-quality uncertainty estimation and promising prediction performance on imbalanced datasets.
|
| 22 |
+
|
| 23 |
+
# 2 RELATED WORK
|
| 24 |
+
|
| 25 |
+
Variational Autoencoder. Variational autoencoder (VAE) (Kingma & Welling, 2014) is an unsupervised learning model that aims to infer probabilistic representations from data. However, as shown in Figure 1, VAE typically assumes I.I.D. representations, where a data point’s representation is not directly affected by other data points. In contrast, our VIR borrows data with similar regression labels to compute the latent representation’s variational distribution.
|
| 26 |
+
|
| 27 |
+
Imbalanced Regression. Imbalanced regression is underexplored in the machine learning community. Most existing methods for imbalanced regression are direct extensions of the SMOTE algorithm (Chawla et al., 2002), a commonly used algorithm for imbalanced classification, where data from the minority classes is over-sampled. These algorithms usually synthesize augmented data for the minority regression labels by either interpolating both inputs and labels (Torgo et al., 2013) or adding Gaussian noise (Branco et al., 2017; 2018).
|
| 28 |
+
|
| 29 |
+

|
| 30 |
+
Figure 1: Comparison on inference networks between typical VAE (Kingma & Welling, 2014) and our VIR. In VAE (left), a data point’s latent representation (i.e. z) is affected only by itself, while in VIR (right), neighbors participate to modulate the final representation.
|
| 31 |
+
|
| 32 |
+
Such algorithms fail to the distance in continuous label space and fall short in handling highdimensional data (e.g., images and text). Recently, DIR (Yang et al., 2021) addresses these issues by applying kernel density estimation to smooth and reweight data on the continuous label distribution, achieving state-of-the-art performance. However, DIR only focuses on improving the accuracy, especially for the data with minority labels, and therefore does not provide uncertainty estimation, which is crucial to assess the predictions’ reliability. Ren et al. (2022) focuses on re-balancing the mean squared error (MSE) loss for imbalanced regression, and Gong et al. (2022) introduces ranking similarity for improving deep imbalanced regression. In contrast, our VIR provides a principled probabilistic approach to simultaneously achieve these two desiderata, not only improving upon DIR in terms of performance but also producing reasonable uncertainty estimation as a much-needed byproduct to assess model reliability. There is also related work on imbalanced classification (Deng et al., 2021), which is related to our work but focusing on classification rather than regression.
|
| 33 |
+
|
| 34 |
+
Uncertainty Estimation in Regression. There has been renewed interest in uncertainty estimation in the context of deep regression models (Kendall & Gal, 2017; Kuleshov et al., 2018; Song et al., 2019; Zelikman et al., 2020; Amini et al., 2020; Mi et al., 2022; van Amersfoort et al., 2021; Liu et al., 2020; Gal & Ghahramani, 2016; Stadler et al., 2021; Snoek et al., 2019; Heiss et al., 2022). Most existing methods either directly predict the variance of the output distribution as the estimated uncertainty (Kendall & Gal, 2017; Zhang et al., 2019; Amini et al., 2020) or rely on post-hoc confidence interval calibration (Kuleshov et al., 2018; Song et al., 2019; Zelikman et al., 2020). Meanwhile, Posterior Networks methods Charpentier et al. (2020; 2022); Stadler et al. (2021) consider conjugate distribution, pseudo-count interpretations, posterior updates, and variational losses for fast and high-quality uncertainty estimation. Closest to our work is Deep Evidential Regression (DER) (Amini et al., 2020), which attempts to estimate both aleatoric and epistemic uncertainty (Kendall & Gal, 2017; Hüllermeier & Waegeman, 2019) on regression tasks by training the neural networks to directly infer the parameters of the evidential distribution, thereby producing uncertainty measures. While Posterior Networks Charpentier et al. (2020; 2022) are designed for general classification/regression tasks and achieve promising performance, they do not explicitly consider imbalance in regression tasks, which is the focus of this paper. DER (Amini et al., 2020) is designed for the data-rich regime and therefore fails to reasonably estimate the uncertainty if the data is imbalanced; for data with minority labels, DER (Amini et al., 2020) tends produce unstable distribution parameters, leading to poor uncertainty estimation (as shown in Sec. 4). In contrast, our proposed VIR explicitly handles data imbalance in the continuous label space to avoid such instability; VIR does so by modulating both the representations and the output conjugate distribution parameters according to the imbalanced label distribution, allowing training/inference to proceed as if the data is balance and leading to better performance as well as uncertainty estimation (as shown in Sec. 4).
|
| 35 |
+
|
| 36 |
+
# 3 METHOD
|
| 37 |
+
|
| 38 |
+
In this section we introduce the problem setting, provide an overview of our VIR, and then describe details on each of VIR’s key components.
|
| 39 |
+
|
| 40 |
+
# 3.1 PROBLEM SETTINGS
|
| 41 |
+
|
| 42 |
+
Assuming an imbalanced dataset in continuous space $\{ \mathbf { x } _ { i } , y _ { i } \} _ { i = 1 } ^ { N }$ where $N$ is the total number of data points, $\mathbf { x } _ { i } ~ \in ~ \mathbb { R } ^ { d }$ is the input, and $y _ { i } \in \mathcal { V } \subset \mathbb { R }$ is the corresponding label from a continuous label space $\mathcal { V }$ . In practice, $\mathcal { V }$ is partitioned into $\mathbf { B }$ equal-interval bins $[ y ^ { ( 0 ) } , y ^ { ( 1 ) } ) , [ y ^ { ( 2 ) } , y ^ { ( 2 ) } ) , . . . , [ \hat { y } ^ { ( B - 1 ) } , y ^ { ( B ) } )$ , with slight notation overload. To directly compare with baselines, we use the same grouping index for target value $b \in \ B$ as in (Yang et al., 2021).
|
| 43 |
+
|
| 44 |
+
We denote representations as $\mathbf { z } _ { i }$ , and use $\left( \widetilde { \mathbf { z } } _ { i } ^ { \mu } , \widetilde { \mathbf { z } } _ { i } ^ { \Sigma } \right) ^ { \sim } =$ $q _ { \phi } ( \mathbf { z } | \mathbf { x } _ { i } ; \theta )$ e e to denote the probabilistic representations for input $\mathbf { x } _ { i }$ generated by a probabilistic encoder parameterized by $\theta$ . Similarly we use $( \widehat { y } _ { i } , \widehat { s } _ { i } )$ to denote the mean b band variance of the predictive distribution generated by a probabilistic predictor $p _ { \boldsymbol { \theta } } ( y _ { i } | \mathbf { z } )$ . Furthermore, we denote $\bar { \bf z }$ as the mean of representation $\mathbf { z } _ { i }$ in each bins (i.e., letting $\begin{array} { r } { \bar { \bf z } = \frac { 1 } { N _ { b } } \sum _ { i = 1 } ^ { N _ { b } } { \bf z } _ { i } } \end{array}$ in a bin with $N _ { b }$ data points).
|
| 45 |
+
|
| 46 |
+
# 3.2 METHOD OVERVIEW
|
| 47 |
+
|
| 48 |
+
In order to achieve both desiderata in probabilistic deep imbalanced regression (i.e., performance improvement and uncertainty estimation), our proposed variational imbalanced regression (VIR) operates on both the encoder $q _ { \phi } ( \mathbf { z } _ { i } | \{ \mathbf { x } _ { i } \} _ { i = 1 } ^ { \tilde { N } } )$ and the predictor $p _ { \theta } ( y _ { i } | \mathbf { z } _ { i } )$ .
|
| 49 |
+
|
| 50 |
+

|
| 51 |
+
Figure 2: Overview of our VIR method. Left: The inference model infers the latent representations given input x’s in the neighborhood. Right: The generative model reconstructs the input and predicts the label distribution (including the associated uncertainty) given the latent representation.
|
| 52 |
+
|
| 53 |
+
Typical VAE (Kingma & Welling, 2014) lower-bounds input $\mathbf { x } _ { i }$ ’s marginal likelihood; in contrast, VIR lower-bounds the marginal likelihood of input $\mathbf { x } _ { i }$ and labels $y _ { i }$ :
|
| 54 |
+
|
| 55 |
+
$$
|
| 56 |
+
\begin{array} { r } { \log p _ { \theta } ( \mathbf { x } _ { i } , y _ { i } ) = \mathcal { D } _ { K \mathcal { L } } \big ( q _ { \phi } ( \mathbf { z } _ { i } | \{ \mathbf { x } _ { i } \} _ { i = 1 } ^ { N } ) | | p _ { \theta } ( \mathbf { z } _ { i } | \mathbf { x } _ { i } , y _ { i } ) \big ) + \mathcal { L } ( \theta , \phi ; \mathbf { x } _ { i } , y _ { i } ) . } \end{array}
|
| 57 |
+
$$
|
| 58 |
+
|
| 59 |
+
Note that our variational distribution $q _ { \phi } ( \mathbf { z } _ { i } | \{ \mathbf { x } _ { i } \} _ { i = 1 } ^ { N } )$ (1) does not conditions on labels $y _ { i }$ , since the task is to predict $y _ { i }$ and (2) conditions on all (neighboring) inputs $\{ { \mathbf { x } } _ { i } \} _ { i = 1 } ^ { N }$ rather than just $\mathbf { x } _ { i }$ . The second term $\mathcal { L } ( \boldsymbol { \theta } , \phi ; { \mathbf { x } } _ { i } , y _ { i } )$ is VIR’s evidence lower bound (ELBO), which is defined as:
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
\begin{array} { r } { \mathcal { L } ( \theta , \phi ; \mathbf { x } _ { i } , y _ { i } ) = \underbrace { { \mathbb { E } } _ { q } \left[ \log p _ { \theta } ( \mathbf { x } _ { i } | \mathbf { z } _ { i } ) \right] } _ { \mathcal { L } _ { i } ^ { \mathcal { D } } } + \underbrace { { \mathbb { E } } _ { q } \left[ \log p _ { \theta } ( y _ { i } | \mathbf { z } _ { i } ) \right] } _ { \mathcal { L } _ { i } ^ { \mathcal { P } } } - \underbrace { \mathcal { D } _ { K \mathcal { L } } ( q _ { \phi } ( \mathbf { z } _ { i } | \{ \mathbf { x } _ { i } \} _ { i = 1 } ^ { N } ) | | p _ { \theta } ( \mathbf { z } _ { i } ) ) } _ { \mathcal { L } _ { i } ^ { K \mathcal { L } } } . } \end{array}
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
where the $p _ { \theta } ( \mathbf { z } _ { i } )$ is the standard Gaussian prior $\mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ , following typical VAE (Kingma & Welling, 2014), and the expectation is taken over $q _ { \phi } ( \mathbf { z } _ { i } | \{ \mathbf { x } _ { i } \} _ { i = 1 } ^ { N } )$ , which infers $\mathbf { z } _ { i }$ by borrowing data with similar regression labels to produce the balanced probabilistic representations, which is beneficial especially for the minority (see Sec. 3.3 for details).
|
| 66 |
+
|
| 67 |
+
Different from typical regression models which produce only point estimates for $y _ { i }$ , our VIR’s predictor, $p _ { \theta } ( y _ { i } | \mathbf { z } _ { i } )$ , directly produces the parameters of the entire NIG distribution for $y _ { i }$ and further imposes probabilistic reweighting on the imbalanced data, thereby producing balanced predictive distributions (more details in Sec. 3.4).
|
| 68 |
+
|
| 69 |
+
# 3.3 CONSTRUCTING $q ( \mathbf { z } _ { i } | \{ \mathbf { x } _ { i } \} _ { i = 1 } ^ { N } )$
|
| 70 |
+
|
| 71 |
+
To cover both desiderata, one needs to (1) produce balanced representations to improve performance for the data with minority labels and (2) produce probabilistic representations to naturally obtain reasonable uncertainty estimation for each model prediction. To learn such balanced probabilistic representations, we construct the encoder of our VIR (i.e., $q _ { \phi } ( \mathbf { z } _ { i } | \{ \mathbf { x } _ { i } \} _ { i = 1 } ^ { N } ) )$ by (1) first encoding a data point into a probabilistic representation, (2) computing probabilistic statistics from neighboring representations (i.e., representations from data with similar regression labels), and (3) producing the final representations via probabilistic whitening and recoloring using the obtained statistics.
|
| 72 |
+
|
| 73 |
+
Probabilistic Representations. We first encode each data point into a probabilistic representation. Note that this is in contrast to existing work (Yang et al., 2021) that uses deterministic representations. We assume that each encoding $\mathbf { z } _ { i }$ is a Gaussian distribution with parameters $\{ \mathbf { z } _ { i } ^ { \mu } , \mathbf { z } _ { i } ^ { \Sigma } \}$ , which are generated from the last layer in the deep neural network.
|
| 74 |
+
|
| 75 |
+
From I.I.D. to Neighboring and Identically Distributed (N.I.D.). Typical VAE (Kingma & Welling, 2014) is an unsupervised learning model that aims to learn a variational representation from latent space to reconstruct the original inputs under the I.I.D. assumption; that is, in VAE, the latent value (i.e., $\mathbf { z } _ { i }$ ) is generated from its own input $\mathbf { x } _ { i }$ . This I.I.D. assumption works well for data with majority labels, but significantly harms performance for data with minority labels. To address this problem, we replace the I.I.D. assumption with the N.I.D. assumption; specifically, VIR’s variational latent representations still follow Gaussian distributions (i.e., $\bar { \mathcal { N } } ( \mathbf { z } _ { i } ^ { \mu } , \mathbf { z } _ { i } ^ { \Sigma } )$ , but these distributions will be first calibrated using data with neighboring labels. For a data point $\left( \mathbf { x } _ { i } , y _ { i } \right)$ where $y _ { i }$ is in the $b ^ { \prime }$ th bin, i.e., $y _ { i } \in [ y ^ { ( b - 1 ) } , y ^ { ( b ) } )$ , we compute $q ( \mathbf { z } _ { i } | \{ \mathbf { x } _ { i } \} _ { i = 1 } ^ { N } ) \triangleq \mathcal { N } ( \mathbf { z } _ { i } ; \widetilde \mathbf { z } _ { i } ^ { \mu } , \widetilde \mathbf { z } _ { i } ^ { \Sigma } )$ as
|
| 76 |
+
|
| 77 |
+
Mean and Covariance of Initial $\mathbf { z } _ { i }$ : ${ \bf z } _ { i } ^ { \mu } , { \bf z } _ { i } ^ { \Sigma } = \mathcal { T } ( { \bf x } _ { i } )$ ,
|
| 78 |
+
|
| 79 |
+
Smoothed Statistics of Bin $^ { b }$ ’s Statistics: $\widetilde { \mu } _ { b } ^ { \mu } , \widetilde { \mu } _ { b } ^ { \Sigma } , \widetilde { \Sigma } _ { b } ^ { \mu } , \widetilde { \Sigma } _ { b } ^ { \Sigma } = { \cal S } ( \{ \mu _ { b } ^ { \mu } , \mu _ { b } ^ { \Sigma } , \Sigma _ { b } ^ { \mu } , \Sigma _ { b } ^ { \Sigma } \} _ { b = 1 } ^ { B } ) ,$
|
| 80 |
+
|
| 81 |
+
Mean and Covariance of Final $\mathbf { z } _ { i }$ : $\widetilde { \mathbf { z } } _ { i } ^ { \mu } , \widetilde { \mathbf { z } } _ { i } ^ { \Sigma } = \mathcal { F } ( \mathbf { z } _ { i } ^ { \mu } , \mathbf { z } _ { i } ^ { \Sigma } , \mu _ { b } ^ { \mu } , \mu _ { b } ^ { \Sigma } , \boldsymbol { \Sigma } _ { b } ^ { \mu } , \boldsymbol { \Sigma } _ { b } ^ { \Sigma } , \widetilde { \mu } _ { b } ^ { \mu } , \widetilde { \mu } _ { b } ^ { \Sigma } , \widetilde { \boldsymbol { \Sigma } } _ { b } ^ { \mu } , \widetilde { \boldsymbol { \Sigma } } _ { b } ^ { \Sigma } ) .$ where the details of functions $\boldsymbol { \mathcal { T } } ( \cdot )$ $) , A ( \cdot ) , S ( \cdot )$ , and $\mathcal F ( \cdot )$ are described below.
|
| 82 |
+
|
| 83 |
+
Function $\boldsymbol { \mathcal { T } } ( \cdot )$ : From Deterministic to Probabilistic Statistics. Different from deterministic statistics in (Yang et al., 2021), our VIR’s encoder uses probabilistic statistics (i.e., statistics of statistics). Specifically, VIR treats $\mathbf { z } _ { i }$ as a distribution with the mean and covariance $( \mathbf { z } _ { i } ^ { \mu } , \mathbf { z } _ { i } ^ { \Sigma } ) = \mathcal { T } ( \mathbf { x } _ { i } )$ rather than a deterministic vector. As a result, all the deterministic statistics, $\pmb { \mu } _ { b }$ , $\Sigma _ { b }$ , $\widetilde { \mu } _ { b }$ , and $\widetilde { \Sigma } _ { b }$ are replaced by distributions with the means and covariances, $( \mu _ { b } ^ { \mu } , \mu _ { b } ^ { \Sigma } )$ , $( \Sigma _ { b } ^ { \mu } , \Sigma _ { b } ^ { \Sigma } )$ , $( \widetilde { \mu } _ { b } ^ { \mu } , \widetilde { \mu } _ { b } ^ { \Sigma } )$ , and $( \widetilde { \pmb { \Sigma } } _ { b } ^ { \mu } , \widetilde { \pmb { \Sigma } } _ { b } ^ { \Sigma } )$ , respectively (more details in the following three paragraphs on $\boldsymbol { \mathcal { A } } ( \cdot ) , \boldsymbol { S } ( \cdot )$ , and $\mathcal F ( \cdot )$ ).
|
| 84 |
+
|
| 85 |
+
Function $\boldsymbol { \mathcal { A } } ( \cdot )$ : Statistics of the current Bin $b$ ’s Statistics. As part of our probabilistic overall statistics, the probabilistic overall mean becomes a distribution with the mean (letting ${ \pmb { \mu } } _ { b } = { \bar { \bf z } }$ ) and covariance (assuming diagonal covariance):
|
| 86 |
+
|
| 87 |
+
$$
|
| 88 |
+
\begin{array} { r } { { \pmb \mu } _ { b } ^ { \mu } = \mathbb { E } [ \bar { \mathbf { z } } ] = \frac { 1 } { N _ { b } } \sum _ { i = 1 } ^ { N _ { b } } \mathbf { z } _ { i } ^ { \mu } , \mu _ { b } ^ { \Sigma } = \mathbb { V } [ \bar { \mathbf { z } } ] = \frac { 1 } { N _ { b } ^ { 2 } } \sum _ { i = 1 } ^ { N _ { b } } \mathbf { z } _ { i } ^ { \Sigma } . } \end{array}
|
| 89 |
+
$$
|
| 90 |
+
|
| 91 |
+
Similarly, our probabilistic overall covariance becomes a matrix-variate distribution (Gupta & Nagar, 2018) with the mean:
|
| 92 |
+
|
| 93 |
+
$$
|
| 94 |
+
{ \pmb { \Sigma } } _ { b } ^ { \mu } = \frac { 1 } { N _ { b } } \sum _ { i = 1 } ^ { N _ { b } } ( { \bf z } _ { i } - { \bar { \bf z } } ) ^ { 2 } = \frac { 1 } { N _ { b } } \sum _ { i = 1 } ^ { N _ { b } } \Big [ { \bf z } _ { i } ^ { \Sigma } + ( { \bf z } _ { i } ^ { \mu } ) ^ { 2 } - \Big ( [ { \pmb { \mu } } _ { b } ^ { \Sigma } ] _ { i } + ( [ { \pmb { \mu } } _ { b } ^ { \mu } ] _ { i } ) ^ { 2 } \Big ) \Big ] ,
|
| 95 |
+
$$
|
| 96 |
+
|
| 97 |
+
since $\mathbb { E } [ \bar { \mathbf { z } } ] = \mu _ { b } ^ { \mu }$ and $\mathbb { V } [ \bar { \mathbf { z } } ] = \mu _ { b } ^ { \Sigma }$ . Note that the covariance of $\Sigma _ { b }$ , i.e., $\Sigma _ { b } ^ { \Sigma }$ , involves computing the fourth-order moments, which is computationally prohibitive. Therefore in practice, we directly set $\Sigma _ { b } ^ { \Sigma }$ to zero for simplicity; empirically we observe that such simplified treatment already achieves promising performance improvement upon the state of the art.
|
| 98 |
+
|
| 99 |
+
Function $\boldsymbol { \mathcal { S } } ( \cdot )$ : Neighboring Data and Smoothed Statistics. Next, we can borrow data with neighboring labels (from neighboring label bins) to compute the smoothed statistics of the current bin $b$ by applying a symmetric kernel $k ( \cdot , \cdot )$ (e.g., Gaussian, Laplacian, and Triangular kernels). Specifically, the probabilistic smoothed mean and covariance are (assuming diagonal covariance):
|
| 100 |
+
|
| 101 |
+
$$
|
| 102 |
+
\begin{array} { r } { \widetilde { \mu } _ { b } ^ { \mu } = \sum _ { b ^ { \prime } \in \mathcal { B } } k ( y _ { b } , y _ { b ^ { \prime } } ) \mu _ { b ^ { \prime } } ^ { \mu } , \widetilde { \mu } _ { b } ^ { \Sigma } = \sum _ { b ^ { \prime } \in \mathcal { B } } k ^ { 2 } ( y _ { b } , y _ { b ^ { \prime } } ) \mu _ { b ^ { \prime } } ^ { \Sigma } , \widetilde { \Sigma } _ { b } ^ { \mu } = \sum _ { b ^ { \prime } \in \mathcal { B } } k ( y _ { b } , y _ { b ^ { \prime } } ) \Sigma _ { b ^ { \prime } } . } \end{array}
|
| 103 |
+
$$
|
| 104 |
+
|
| 105 |
+
Function $\mathcal F ( \cdot )$ : Probabilistic Whitening and Recoloring. We develop a probabilistic version of the whitening and re-coloring procedure (Sun et al., 2016) used in (Yang et al., 2021). Specifically, we produce the final probabilistic representation $\{ \widetilde { \mathbf { z } } _ { i } ^ { \mu } , \widetilde { \mathbf { z } } _ { i } ^ { \Sigma } \}$ for each data point as:
|
| 106 |
+
|
| 107 |
+
$$
|
| 108 |
+
\widetilde { \mathbf { z } } _ { i } ^ { \mu } = ( \mathbf { z } _ { i } ^ { \mu } - \boldsymbol { \mu } _ { b } ^ { \mu } ) \cdot \sqrt { \frac { \widetilde { \mathbf { \boldsymbol { \Sigma } } } _ { b } ^ { \mu } } { \boldsymbol { \Sigma } _ { b } ^ { \mu } } } + \widetilde { \boldsymbol { \mu } } _ { b } ^ { \mu } , \quad \widetilde { \mathbf { z } } _ { i } ^ { \Sigma } = ( \mathbf { z } _ { i } ^ { \Sigma } + \boldsymbol { \mu } _ { b } ^ { \Sigma } ) \cdot \sqrt { \frac { \widetilde { \mathbf { \boldsymbol { \Sigma } } } _ { b } ^ { \mu } } { \boldsymbol { \Sigma } _ { b } ^ { \mu } } } + \widetilde { \boldsymbol { \mu } } _ { b } ^ { \Sigma } .
|
| 109 |
+
$$
|
| 110 |
+
|
| 111 |
+
Inspired by (Yang et al., 2021), we keep updating the probabilistic overall statistics, $\{ \pmb { \mu } _ { b } ^ { \mu } , \pmb { \mu } _ { b } ^ { \Sigma } , \pmb { \Sigma } _ { b } \}$ , and the probabilistic smoothed statistics, $\{ \widetilde { \mu } _ { b } ^ { \mu } , \widetilde { \mu } _ { b } ^ { \Sigma } \}$ , cross different epochs. The probabilistic representation $\{ \widetilde { \mathbf { z } } _ { i } ^ { \mu } , \widetilde { \mathbf { z } } _ { i } ^ { \Sigma } \}$ are then re-parameterized (Kingma & Welling, 2014) into the final representation $\mathbf { z } _ { i }$ e e, and passed into the final layer (discussed in Sec. 3.4) to generate the prediction and uncertainty estimation. Note that the computation of statistics from multiple $\mathbf { x }$ ’s is only needed during training. During testing, VIR directly uses these statistics and therefore does not need to re-compute them.
|
| 112 |
+
|
| 113 |
+
# 3.4 CONSTRUCTING $p ( y _ { i } | \mathbf { z } _ { i } )$
|
| 114 |
+
|
| 115 |
+
Our VIR’s predictor $p ( y _ { i } | \mathbf { z } _ { i } ) \triangleq \mathcal { N } ( y _ { i } ; \widehat { y } _ { i } , \widehat { s } _ { i } )$ predicts both the mean and variance for $y _ { i }$ by first b bpredicting the NIG distribution and then marginalizing out the latent variables. It is motivated by the following observations on label distribution smoothing (LDS) in (Yang et al., 2021) and deep evidental regression (DER) in (Amini et al., 2020), as well as intuitions on effective counts in conjugate distributions.
|
| 116 |
+
|
| 117 |
+
LDS’s Limitations in Our Probabilistic Imbalanced Regression Setting. The motivation of LDS (Yang et al., 2021) is that the empirical label distribution can not reflect the real label distribution in an imbalanced dataset with a continuous label space; consequently, reweighting methods for imbalanced regression fail due to these inaccurate label densities. By applying a smoothing kernel on the empirical label distribution, LDS tries to recover the effective label distribution, with which reweighting methods can obtain ‘better’ weights to improve imbalanced regression. However, in our probabilistic imbalanced regression, one needs to consider both (1) the performance for the data with minority labels and (2) uncertainty estimation for each model. However, LDS only focuses on improving the accuracy, especially for the data with minority labels, and therefore does not provide uncertainty estimation, which is crucial to assess the predictions’ reliability.
|
| 118 |
+
|
| 119 |
+
DER’s limitations in Our Probabilistic Imbalanced Regression Setting. In DER (Amini et al., 2020), the predicted labels with their correspond uncertainties are produced by the representation of the posterior parameters in Normal Inverse Gamma (NIG) distribution $N I G ( \gamma , \nu , \alpha , \beta )$ , while the model is trained via minimizing the negative log-likelihood (NLL) of a Student-t distribution:
|
| 120 |
+
|
| 121 |
+
$$
|
| 122 |
+
\begin{array} { r } { \mathcal { L } _ { i } ^ { D E R } = \frac { 1 } { 2 } \log ( \frac { \pi } { \nu } ) + ( \alpha + \frac { 1 } { 2 } ) \log ( ( y _ { i } - \gamma ) ^ { 2 } \nu + \Omega ) - \alpha \log ( \Omega ) + \log ( \frac { \Gamma ( \alpha ) } { \Gamma ( \alpha + \frac { 1 } { 2 } ) } ) , } \end{array}
|
| 123 |
+
$$
|
| 124 |
+
|
| 125 |
+
where $\Omega = 2 \beta ( 1 + \nu )$ . It is therefore nontrivial to properly incorporate a reweighting mechanism into the NLL. One straightforward approach is to directly reweight $\mathcal { L } _ { i } ^ { D E R }$ for different data points $( x _ { i } , y _ { i } )$ . However, this contradicts the formulation of NIG and often leads to poor performance, as we verify in Sec. 4.
|
| 126 |
+
|
| 127 |
+
Intuition of Pseudo-Counts for VIR. To properly incorporate different reweighting methods, our VIR relies on the intuition of pseudo-counts (pseudo-observations) in conjugate distributions (Bishop, 2006). Assuming Gaussian likelihood, the conjugate distributions would be an NIG distribution (Bishop, 2006), i.e., $( \mu , \Sigma ) \sim N I G ( \gamma , \nu , \alpha , \beta )$ , which means:
|
| 128 |
+
|
| 129 |
+
$$
|
| 130 |
+
\mu \sim { \mathcal N } ( \gamma , \Sigma / \nu ) , ~ \Sigma \sim \Gamma ^ { - 1 } ( \alpha , \beta ) ,
|
| 131 |
+
$$
|
| 132 |
+
|
| 133 |
+
where $\Gamma ^ { - 1 } ( \alpha , \beta )$ is an inverse gamma distribution. With a NIG prior distribution $N I G ( \gamma _ { 0 } , \nu _ { 0 } , \alpha _ { 0 } , \beta _ { 0 } )$ , the posterior distribution of the NIG after observing $n$ real data points are:
|
| 134 |
+
|
| 135 |
+
$$
|
| 136 |
+
\begin{array} { r } { \gamma _ { n } = \frac { \gamma _ { 0 } \nu _ { 0 } + n \Psi } { \nu _ { n } } , \quad \nu _ { n } = \nu _ { 0 } + n , \quad \alpha _ { n } = \alpha _ { 0 } + \frac { n } { 2 } , \quad \beta _ { n } = \beta _ { 0 } + \frac { 1 } { 2 } ( \gamma _ { 0 } ^ { 2 } \nu _ { 0 } ) + \Phi , } \end{array}
|
| 137 |
+
$$
|
| 138 |
+
|
| 139 |
+
where $\boldsymbol \Psi = \bar { \mathbf x }$ and $\begin{array} { r } { \Phi = \frac 1 2 ( \sum _ { i } \mathbf { x } _ { i } ^ { 2 } - \gamma _ { n } ^ { 2 } \nu _ { n } ) } \end{array}$ . Here $\nu _ { 0 }$ and $\alpha _ { 0 }$ can be interpreted as virtual observations, i.e., pseudo-counts or pseudo-observations that contribute to the posterior distribution. Overall, the mean of posterior distribution above can be interpreted as an estimation from $\left( 2 \alpha _ { 0 } + n \right)$ observations, with $2 \alpha _ { 0 }$ virtual observations and $n$ real observations. Similarly, the variance can be interpreted an estimation from $( \nu + n )$ observations. This intuition is crucial in developing the predictor of our VIR.
|
| 140 |
+
|
| 141 |
+
From Pseudo-Counts to Balanced Predictive Distributions. Based on the intuition above, we construct our predictor (i.e., $p ( y _ { i } | \mathbf { z } _ { i } ) )$ by (1) generating the parameters in the posterior distribution of NIG, (2) computing re-weighted parameters by imposing the importance weights obtained from LDS, and (3) producing the final prediction with corresponding uncertainty estimation.
|
| 142 |
+
|
| 143 |
+
Based on Eqn. 7, we feed the final representation $\{ { \mathbf { z } } _ { i } \} _ { i = 1 } ^ { N }$ generated from the Sec. 3.3 (Eqn. 5) into a linear layer to output the intermediate parameters $n _ { i } , \Psi _ { i } , \Phi _ { i }$ for data point $\left( \mathbf { x } _ { i } , y _ { i } \right)$ :
|
| 144 |
+
|
| 145 |
+
$$
|
| 146 |
+
n _ { i } , \Psi _ { i } , \Phi _ { i } = \mathcal G ( \mathbf { z } _ { i } ) , \quad \mathbf { z } _ { i } \sim q ( \mathbf { z } _ { i } | \{ \mathbf { x } _ { i } \} _ { i = 1 } ^ { N } ) = \mathcal N ( \mathbf { z } _ { i } ; \widetilde { \mathbf { z } } _ { i } ^ { \mu } , \widetilde { \mathbf { z } } _ { i } ^ { \Sigma } )
|
| 147 |
+
$$
|
| 148 |
+
|
| 149 |
+
We then apply the importance weights $\begin{array} { r } { \sum _ { b ^ { \prime } \in B } k ( y _ { b } , y _ { b ^ { \prime } } ) \big ) ^ { - \frac { 1 } { 2 } } } \end{array}$ calculated from the smoothed label distribution to the pseudo-count $n _ { i }$ to produce the re-weighted parameters of posterior distribution of NIG. Along with the pre-defined prior parameters $( \gamma _ { 0 } , \nu _ { 0 } , \alpha _ { 0 } , \beta _ { 0 } )$ , we are able to compute the parameters of posterior distribution $N I G ( \gamma _ { i } , \nu _ { i } , \alpha _ { i } , \beta _ { i } )$ for $\left( \mathbf { x } _ { i } , y _ { i } \right)$ :
|
| 150 |
+
|
| 151 |
+
$$
|
| 152 |
+
\begin{array} { r l } & { \gamma _ { i } ^ { * } = \frac { \gamma _ { 0 } \nu _ { 0 } + \big ( \sum _ { b ^ { \prime } \in B } k ( y _ { b } , y _ { b ^ { \prime } } ) \big ) ^ { - \frac { 1 } { 2 } } \cdot n _ { i } \Psi _ { i } } { \nu _ { n } ^ { * } } , \quad \nu _ { i } ^ { * } = \nu _ { 0 } + \big ( \sum _ { b ^ { \prime } \in B } k ( y _ { b } , y _ { b ^ { \prime } } ) \big ) ^ { - \frac { 1 } { 2 } } \cdot n _ { i } , } \\ & { \alpha _ { i } ^ { * } = \alpha _ { 0 } + \big ( \sum _ { b ^ { \prime } \in B } k ( y _ { b } , y _ { b ^ { \prime } } ) \big ) ^ { - \frac { 1 } { 2 } } \cdot \frac { n _ { i } } { 2 } , \quad \beta _ { i } ^ { * } = \beta _ { 0 } + \frac { 1 } { 2 } ( \gamma _ { 0 } ^ { 2 } \nu _ { 0 } ) + \Phi _ { i } . } \end{array}
|
| 153 |
+
$$
|
| 154 |
+
|
| 155 |
+
Based on the NIG posterior distribution, we can then compute final prediction and uncertainty estimation as
|
| 156 |
+
|
| 157 |
+
$$
|
| 158 |
+
\begin{array} { r } { \widehat { y } _ { i } = \gamma _ { i } ^ { * } , \widehat { s } _ { i } = \frac { \beta _ { i } ^ { * } } { \nu _ { i } ^ { * } ( \alpha _ { i } ^ { * } - 1 ) } . } \end{array}
|
| 159 |
+
$$
|
| 160 |
+
|
| 161 |
+
We use an objective function similar to Eqn. 6, but with different definitions of $( \gamma , \nu , \alpha , \beta )$ , to optimize our VIR model:
|
| 162 |
+
|
| 163 |
+
$$
|
| 164 |
+
\begin{array} { r } { \mathcal { L } _ { i } ^ { \mathcal { P } } = \mathbb { E } _ { q _ { \phi } ( \mathbf { z } _ { i } | \{ \mathbf { x } _ { i } \} _ { i = 1 } ^ { N } ) } \left[ \frac { 1 } { 2 } \log ( \frac { \pi } { \nu _ { i } ^ { * } } ) + ( \alpha _ { i } ^ { * } + \frac { 1 } { 2 } ) \log ( ( y _ { i } - \gamma _ { i } ^ { * } ) ^ { 2 } \nu _ { n } ^ { * } + \Omega ) - \alpha _ { i } ^ { * } \log ( \omega _ { i } ^ { * } ) + \log ( \frac { \Gamma ( \alpha _ { i } ^ { * } ) } { \Gamma ( \alpha _ { i } ^ { * } + \frac { 1 } { 2 } ) } ) \right] , } \end{array}
|
| 165 |
+
$$
|
| 166 |
+
|
| 167 |
+
where $\omega _ { i } ^ { * } = 2 \beta _ { i } ^ { * } ( 1 + \nu _ { i } ^ { * } )$ . Note that $\mathcal { L } _ { i } ^ { \mathcal { P } }$ is part of the ELBO in Eqn. 1. Similar to (Amini et al., 2020), we use an additional regularization term to achieve better accuracy1:
|
| 168 |
+
|
| 169 |
+
$$
|
| 170 |
+
\mathcal { L } _ { i } ^ { \mathcal { R } } = \left( \nu + 2 \alpha \right) \cdot | y _ { i } - \widehat { y } _ { i } | .
|
| 171 |
+
$$
|
| 172 |
+
|
| 173 |
+
$\mathcal { L } _ { i } ^ { \mathcal { P } }$ and $\mathcal { L } _ { i } ^ { \mathcal { R } }$ together constitute the objective function for learning the predictor $p ( \mathbf { y } _ { i } | \mathbf { z } _ { i } )$
|
| 174 |
+
|
| 175 |
+
# 3.5 FINAL OBJECTIVE FUNCTION
|
| 176 |
+
|
| 177 |
+
Putting together Sec. 3.3 and Sec. 3.4, our final objective function (to minimize) for VIR is:
|
| 178 |
+
|
| 179 |
+
$$
|
| 180 |
+
\begin{array} { r } { \mathcal { L } ^ { \mathcal { V I R } } = \sum _ { i = 1 } ^ { N } \mathcal { L } _ { i } ^ { \mathcal { V I R } } , \quad \mathcal { L } _ { i } ^ { \mathcal { V I R } } = \lambda \mathcal { L } _ { i } ^ { \mathcal { R } } - \mathcal { L } ( \boldsymbol { \theta } , \boldsymbol { \phi } ; \mathbf { x } _ { i } , y _ { i } ) = \lambda \mathcal { L } _ { i } ^ { \mathcal { R } } - \mathcal { L } _ { i } ^ { \mathcal { P } } - \mathcal { L } _ { i } ^ { \mathcal { D } } + \mathcal { L } _ { i } ^ { K \mathcal { L } } , } \end{array}
|
| 181 |
+
$$
|
| 182 |
+
|
| 183 |
+
where $\mathcal { L } ( \theta , \phi ; \mathbf { x } _ { i } , y _ { i } ) = \mathcal { L } _ { i } ^ { \mathcal { P } } + \mathcal { L } _ { i } ^ { \mathcal { D } } - \mathcal { L } _ { i } ^ { \mathcal { K L } }$ is the ELBO in Eqn. 1. $\lambda$ adjusts the importance of the additional regularizer and the ELBO, and thus lead to a better result both on accuracy and uncertainty estimation.
|
| 184 |
+
|
| 185 |
+
# 3.6 DISCUSSION ON I.I.D. AND N.I.D. ASSUMPTIONS
|
| 186 |
+
|
| 187 |
+
Generalization Error, Bias, and Variance. We could analyze the generalization error of our VIR by bounding the generalization with the sum of three terms: (a) the bias of our estimator, (2) the variance of our estimator, (3) model complexity. Essentially VIR uses the N.I.D. assumption increases our estimator’s bias, but significantly reduces its variance in the imbalanced setting. Since the model complexity is kept the same (using the same backbone neural network) as the baselines, N.I.D. will lead to a lower generalization error (see more discussion in Sec. A of the Appendix).
|
| 188 |
+
|
| 189 |
+
# 4 RESULTS
|
| 190 |
+
|
| 191 |
+
Datasets. In this work, we evaluate our methods in terms of prediction accuracy and uncertainty estimation on two imbalanced datasets2, AgeDB (Moschoglou et al., 2017), IMDB-WIKI (Rothe et al., 2018). We follow the preprocessing procedures in DIR (Yang et al., 2021). Details for label density distributions and levels of imbalance are discussed in DIR (Yang et al., 2021).
|
| 192 |
+
|
| 193 |
+
AgeDB-DIR: We use AgeDB-DIR constructed in DIR (Yang et al., 2021), which contains 12.2K images for training and 2.1K images for validation and testing. The maximum age in this dataset is 101 and the minimum age is 0, and the number of images per bin varies between 1 and 353.
|
| 194 |
+
|
| 195 |
+
IMDB-WIKI-DIR: We use IMDB-WIKI-DIR constructed in DIR (Yang et al., 2021), which contains 191.5K training images and 11.0K validation and testing images. The maximum age is 186 and minimum age is 0; the maximum bin density is 7149, and minimum bin density is 1.
|
| 196 |
+
|
| 197 |
+
STS-B-DIR: We use STS-B-DIR constructed in DIR (Yang et al., 2021), which contains 5.2K pairs of training sentences and 1.0K pairs for validation and testing. This dataset is a collection of sentence pairs generated from news headlines, video captions, etc. Each pair is annotated by multiple annotators with a similarity score between 0 and 5.
|
| 198 |
+
|
| 199 |
+
Baselines. We use ResNet-50 (He et al., 2016) as our backbone network, and we describe the baselines below.
|
| 200 |
+
|
| 201 |
+
Vanilla: We use the term VANILLA to denote a plain model without adding any approaches.
|
| 202 |
+
|
| 203 |
+
Synthetic-Sample-Based Methods: Various existing imbalanced regression methods are also included as baselines; these include SMOTER (Torgo et al., 2013) and SMOGN (Branco et al., 2017). Furthermore, following DIR (Yang et al., 2021), in IMDB-WIKI-DIR, we also include another two methods: MIXUP (Zhang et al., 2018) and M-MIXUP (Verma et al., 2019).
|
| 204 |
+
|
| 205 |
+
Cost-Sensitive Reweighting: As shown in DIR (Yang et al., 2021), the square-root weighting variant (SQINV) baseline (i.e. $\begin{array} { r } { \big ( \sum _ { b ^ { \prime } \in B } k ( y _ { b } , y _ { b ^ { \prime } } ) \big ) ^ { - \frac { 1 } { 2 } } . } \end{array}$ ) always outperforms Vanilla. Therefore, for simplicity and fair comparison, all our experiments (for both baselines and VIR) use SQINV weighting. To use SQINV in VIR, one simply needs to use the symmetric kernel $k ( \cdot , \cdot )$ described in Sec. 3.3. To use SQINV in DER, we replace the final layer in DIR (Yang et al., 2021) with the DER layer (Amini et al., 2020) to produce the predictive distributions.
|
| 206 |
+
|
| 207 |
+
Evaluation Metrics - Accuracy. We follow the evaluation metrics in (Yang et al., 2021) to evaluate the accuracy of our proposed methods; these include Mean Absolute Error (MAE), Mean Squared Error (MSE), and Geometric Mean (GM). The formulas for these metrics are as follows:
|
| 208 |
+
|
| 209 |
+
$$
|
| 210 |
+
\begin{array} { r } { \mathtt { M A E } = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } | y _ { i } - \widehat { y } _ { i } | , \mathtt { M S E } = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } ( y _ { i } - \widehat { y } _ { i } ) ^ { 2 } , \mathtt { G M } = \Big [ \prod _ { i = 1 } ^ { N } | y _ { i } - \widehat { y } _ { i } | \Big ] ^ { \frac { 1 } { N } } . } \end{array}
|
| 211 |
+
$$
|
| 212 |
+
|
| 213 |
+
Evaluation Metrics - Uncertainty Estimation. We use typical evaluation metrics for uncertainty estimation in regression problems to evaluate our produced uncertainty estimation; these include Negative Log Likelihood (NLL), Area Under Sparsification Error (AUSE). Eqn. 8 shows the formula for NLL, and more details regarding to AUSE can be found in $\mathrm { I l g }$ et al., 2018).
|
| 214 |
+
|
| 215 |
+
Evaluation Process. Following (Liu et al., 2019; Yang et al., 2021), for a data sample $x _ { i }$ with its label $y _ { i }$ which falls into the target bins $b _ { i }$ , we divide the label space into three disjoint subsets: many-shot region $\{ b _ { i } \in \mathcal { B } \mid y _ { i } \in b _ { i } \& \ \left| y _ { i } \right| > 1 0 0 \}$ , medium-shot region $\{ b _ { i } \in B \mid y _ { i } \in b _ { i }$ & $2 0 \leq | y _ { i } | \leq$ $1 0 0 \}$ , and few-shot region $\{ b _ { i } \in B \mid y _ { i } \in b _ { i } \& \ \left| y _ { i } \right| < 2 0 \}$ , where $| \cdot |$ denotes the cardinality of the set. We report results on the overall test set and these subsets with the accuracy metrics discussed above.
|
| 216 |
+
|
| 217 |
+
Implementation Details. We use ResNet-50 (He et al., 2016) for all experiments in AgeDB-DIR and IMDB-WIKI-DIR. We use the Adam optimizer (Kingma & Ba, 2015) to train all models for 100 epochs, with same learning rate and decay by 0.1 and the 60-th and 90-th epoch, respectively. In order to determine the optimal batch size for training, we try different batch sizes and achieve the same conclusion as the DIR paper, i.e., the optimal batch size is 256 when other hyperparameters are fixed. Therefore, we stick to the batch size of 256 through out the experiments in the paper. Meanwhile, we use the same hyperparameters as in DIR (Yang et al., 2021).
|
| 218 |
+
|
| 219 |
+
Table 1: Evaluation results of accuracy on AgeDB-DIR.
|
| 220 |
+
|
| 221 |
+
<table><tr><td>Metrics</td><td colspan="4">MSE↓</td><td colspan="4">MAE↓</td><td colspan="4">GM↓</td></tr><tr><td>Shot</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td><td>Al</td><td>Many</td><td>Med.</td><td>Few</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td></tr><tr><td>VANILLA (Yang et al.,2021)</td><td>101.28</td><td>78.40</td><td>131.17</td><td>256.32</td><td>7.79</td><td>6.70</td><td>9.42</td><td>13.98</td><td>5.18</td><td>4.53</td><td>6.75</td><td>11.54</td></tr><tr><td>DEEP ENSEMBLE (Lakshminarayanan et al., 2017)</td><td>100.94</td><td>79.30</td><td>129.95</td><td>249.18</td><td>7.73</td><td>6.62</td><td>9.37</td><td>13.90</td><td>4.87</td><td>4.37</td><td>6.50</td><td>11.35</td></tr><tr><td>SMOTER (Torgo et al.,2013)</td><td>114.34</td><td>93.35</td><td>129.89</td><td>244.57</td><td>8.16</td><td>7.39</td><td>8.65</td><td>12.28</td><td>5.21</td><td>4.65</td><td>5.69</td><td>8.49</td></tr><tr><td>SMOGN (Branco et al.,2017)</td><td>117.29</td><td>101.36</td><td>133.86</td><td>232.90</td><td>8.26</td><td>7.64</td><td>9.01</td><td>12.09</td><td>5.36</td><td>4.90</td><td>6.19</td><td>8.44</td></tr><tr><td>SQINV (Yang etal.,2021)</td><td>104.76</td><td>92.67</td><td>127.04</td><td>205.16</td><td>7.92</td><td>7.42</td><td>8.80</td><td>11.46</td><td>5.03</td><td>4.81</td><td>5.72</td><td>8.23</td></tr><tr><td>DER (Amini et al.,2020)</td><td>106.81</td><td>91.32</td><td>122.45</td><td>209.76</td><td>8.11</td><td>7.36</td><td>9.03</td><td>12.69</td><td>5.31</td><td>4.65</td><td>6.48</td><td>10.52</td></tr><tr><td>FDS (Yang et al.,2021)</td><td>109.78</td><td>93.99</td><td>124.96</td><td>216.97</td><td>8.12</td><td>7.52</td><td>8.68</td><td>12.25</td><td>5.13</td><td>4.80</td><td>5.97</td><td>8.85</td></tr><tr><td>LDS (Yang et al., 2021)</td><td>102.22</td><td>83.62</td><td>128.73</td><td>204.64</td><td>7.67</td><td>6.98</td><td>8.86</td><td>10.89</td><td>4.85</td><td>4.39</td><td>5.80</td><td>7.45</td></tr><tr><td>LDS +FDS (Yang et al., 2021)</td><td>102.16</td><td>86.99</td><td>128.04</td><td>199.18</td><td>7.82</td><td>7.19</td><td>9.08</td><td>11.24</td><td>5.01</td><td>4.56</td><td>6.10</td><td>7.02</td></tr><tr><td>FDS + RANKSIM (Gong et al., 2022)</td><td>83.51</td><td>71.99</td><td>99.14</td><td>149.05</td><td>7.02</td><td>6.49</td><td>7.84</td><td>9.68</td><td>4.53</td><td>4.13</td><td>5.37</td><td>6.89</td></tr><tr><td>LDS + FDS + RANKSIM(Gong et al.,2022)</td><td>84.96</td><td>74.27</td><td>93.64</td><td>161.92</td><td>7.03</td><td>6.54</td><td>7.68</td><td>9.92</td><td>4.45</td><td>4.07</td><td>5.23</td><td>6.35</td></tr><tr><td>LDS + FDS + DER (Yang et al.,2021; Amini et al., 2020)</td><td>112.62</td><td>94.21</td><td>140.03</td><td>210.72</td><td>8.18</td><td>7.44</td><td>9.52</td><td>11.45</td><td>5.30</td><td>4.75</td><td>6.74</td><td>7.68</td></tr><tr><td>VIR (OURS)</td><td>86.89</td><td>77.69</td><td>96.55</td><td>145.76</td><td>7.14</td><td>6.67</td><td>7.70</td><td>9.52</td><td>4.58</td><td>4.27</td><td>5.09</td><td>6.31</td></tr><tr><td>OURS VS. VANILLA</td><td>+14.39</td><td>+0.71</td><td>+34.62</td><td>+110.56</td><td>+0.65</td><td>+0.03</td><td>+1.72</td><td>+4.46</td><td>+0.60</td><td>+0.26</td><td>+1.66</td><td>+5.23</td></tr><tr><td>OURS VS. SQINV</td><td>+17.87</td><td>+14.98</td><td>+30.49</td><td>+59.40</td><td>+0.78</td><td>+0.75</td><td>+1.10</td><td>+1.94</td><td>+0.45</td><td>+0.54</td><td>+0.63</td><td>+1.92</td></tr><tr><td>OURS VS. DER</td><td>+19.92</td><td>+13.63</td><td>+25.90</td><td>+64.00</td><td>+0.97</td><td>+0.69</td><td>+1.33</td><td>+3.17</td><td>+0.73</td><td>+0.38</td><td>+1.39</td><td>+4.21</td></tr><tr><td>OURS VS. LDS + FDS (SOTA IN DIR)</td><td>+15.27</td><td>+9.30</td><td>+31.49</td><td>+53.42</td><td>+0.68</td><td>+0.52</td><td>+1.38</td><td>+1.72</td><td>+0.43</td><td>+0.29</td><td>+1.01</td><td>+0.71</td></tr></table>
|
| 222 |
+
|
| 223 |
+
We use PyTorch to implement our method. For fair comparison, we implemented a PyTorch version for the official TensorFlow implementation of DER(Amini et al., 2020). To make sure we can obtain the reasonable uncertainty estimations, we restrict the range for $\alpha$ to $[ 1 . 5 , \infty )$ instead of $[ 1 . 0 , \infty )$ in DER. Besides, in the activation function SoftPlus, we set the hyperparameter beta to 0.1. As discussed in Sec. 3.4, we implement a layer which produces the parameters $n , \Psi , \Omega$ . We assign 2 as the minimum number for $n$ , and use the same hyperparameter settings for activation function for DER layer.
|
| 224 |
+
|
| 225 |
+
To search for a combination hyperparameters of prior distribution $\{ \gamma _ { 0 } , \nu _ { 0 } , \alpha _ { 0 } , \beta _ { 0 } \}$ for NIG, we combine grid search method and random search method (Bergstra & Bengio, 2012) to select the best hyperparameters. We first intuitively assign a value and a proper range with some step sizes which correspond to the hyperparameters, then, we apply grid search to search for the best combination for the hyperparameters on prior distributions. After locating a smaller range for each hyperparameters, we use random search to search for better combinations, if it exists. In the end, we find our best hyperparameter combinations for NIG prior distributions.
|
| 226 |
+
|
| 227 |
+
# 4.1 RESULTS FOR IMBALANCED REGRESSION ACCURACY
|
| 228 |
+
|
| 229 |
+
We report the accuracy of different methods in Table 1 and Table 2 for AgeDB-DIR and IMDB-WIKIDIR, respectively3. In both tables, we can conclude that our methods outperform the baselines in their categories. For ablation studies, see Table 5 and Table 6 of the Appendix. Note that to ensure fair and solid comparison, we re-run the DIR methods based on our machine and software settings4.
|
| 230 |
+
|
| 231 |
+
Overall Performance. As shown in the last category (i.e., last four rows) of both tables, our proposed method’s best variants compare favorably against the state of the art including DIR variants (Yang et al., 2021) and DER (Amini et al., 2020), especially on the imbalanced data samples (i.e., in the few-shot columns). This verifies the effectiveness of our methods in terms of overall performance.
|
| 232 |
+
|
| 233 |
+
# 4.2 RESULTS FOR IMBALANCED REGRESSION UNCERTAINTY ESTIMATION
|
| 234 |
+
|
| 235 |
+
Different from DIR (Yang et al., 2021) which only focuses on accuracy, we create a new benchmark for uncertainty estimation in imbalanced regression. Table 3 and Table 4 show the results on uncertainty estimation for two datasets AgeDB-DIR and IMDB-WIKI-DIR, respectively. Note that most baselines from Table 1 and Table 2 are deterministic methods (as opposed to probabilistic methods like ours) and cannot provide uncertainty estimation; therefore they are not applicable here. To show the superiority of our VIR model, we create a strongest baseline by concatenating the DIR variants $\mathrm { ( L D S + F D S ) }$ ) with the DER (Amini et al., 2020).
|
| 236 |
+
|
| 237 |
+
Table 2: Evaluation results of accuracy on IMDB-WIKI-DIR.
|
| 238 |
+
|
| 239 |
+
<table><tr><td>Metrics</td><td colspan="4">MSE↓</td><td colspan="4">MAE↓</td><td colspan="4">GM↓</td></tr><tr><td>Shot</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td></tr><tr><td>VANILLA (Yang et al.,2021)</td><td>135.48</td><td>107.01</td><td>352.02</td><td>973.73</td><td>7.99</td><td>7.18</td><td>14.88</td><td>26.72</td><td>4.51</td><td>4.12</td><td>10.46</td><td>21.40</td></tr><tr><td>MIXUP (Zhang et al.,2018)</td><td>141.11</td><td>109.13</td><td>389.95</td><td>1037.98</td><td>8.22</td><td>7.29</td><td>16.23</td><td>28.11</td><td>4.68</td><td>4.22</td><td>12.28</td><td>23.55</td></tr><tr><td>M-MIXUP (Verma et al., 2019)</td><td>137.45</td><td>108.33</td><td>363.72</td><td>957.53</td><td>8.22</td><td>7.39</td><td>15.24</td><td>26.70</td><td>4.80</td><td>4.39</td><td>10.85</td><td>21.86</td></tr><tr><td>SMOTER (Torgo et al., 2013)</td><td>138.75</td><td>111.55</td><td>346.09</td><td>935.89</td><td>8.14</td><td>7.42</td><td>14.15</td><td>25.28</td><td>4.64</td><td>4.30</td><td>9.05</td><td>19.46</td></tr><tr><td>SMOGN (Branco et al.,2017)</td><td>136.09</td><td>109.15</td><td>339.09</td><td>944.20</td><td>8.03</td><td>7.30</td><td>14.02</td><td>25.93</td><td>4.63</td><td>4.30</td><td>8.74</td><td>20.12</td></tr><tr><td>SQINV (Yang et al., 2021)</td><td>134.36</td><td>111.23</td><td>308.63</td><td>834.08</td><td>7.87</td><td>7.24</td><td>12.44</td><td>22.76</td><td>4.47</td><td>4.22</td><td>7.25</td><td>15.10</td></tr><tr><td>DER (Amini et al.,020)</td><td>133.81</td><td>107.51</td><td>332.90</td><td>916.18</td><td>7.85</td><td>7.18</td><td>13.35</td><td>24.12</td><td>4.47</td><td>4.18</td><td>8.18</td><td>15.18</td></tr><tr><td>FDS (Yang et al., 2021)</td><td>131.93</td><td>107.76</td><td>311.29</td><td>880.32</td><td>7.80</td><td>7.20</td><td>12.64</td><td>23.20</td><td>4.39</td><td>4.16</td><td>7.04</td><td>13.42</td></tr><tr><td>LDS (Yang et al.,2021)</td><td>133.93</td><td>109.70</td><td>320.26</td><td>830.81</td><td>7.91</td><td>7.30</td><td>13.02</td><td>22.41</td><td>4.48</td><td>4.22</td><td>7.72</td><td>13.75</td></tr><tr><td>LDS + FDS (Yang et al., 2021)</td><td>136.72</td><td>112.76</td><td>322.50</td><td>811.83</td><td>8.08</td><td>7.47</td><td>13.21</td><td>22.54</td><td>4.66</td><td>4.39</td><td>8.01</td><td>14.33</td></tr><tr><td>LDS + FDS + DER (Yang et al.,2021; Amini et al.,2020)</td><td>120.86</td><td>97.75</td><td>297.64</td><td>873.10</td><td>7.24</td><td>6.64</td><td>11.87</td><td>23.44</td><td>3.93</td><td>3.69</td><td>6.64</td><td>16.00</td></tr><tr><td>VIR(OURS)</td><td>119.60</td><td>99.25</td><td>298.85</td><td>809.34</td><td>7.23</td><td>6.66</td><td>11.90</td><td>21.78</td><td>3.90</td><td>3.68</td><td>6.51</td><td>13.34</td></tr><tr><td>OURS VS. VANILLA</td><td>+15.88</td><td>+7.76</td><td>+53.17</td><td>+164.39</td><td>+0.76</td><td>+0.52</td><td>+2.98</td><td>+4.94</td><td>+0.61</td><td>+0.44</td><td>+3.95</td><td>+8.06</td></tr><tr><td>OURS VS. SQINV</td><td>+14.76</td><td>+11.98</td><td>+9.78</td><td>+24.74</td><td>+0.64</td><td>+0.58</td><td>+0.54</td><td>+0.98</td><td>+0.57</td><td>+0.54</td><td>+0.74</td><td>+1.76</td></tr><tr><td>OURS VS.DER</td><td>+14.21</td><td>+8.26</td><td>+34.05</td><td>+106.84</td><td>+0.62</td><td>+0.52</td><td>+1.45</td><td>+2.34</td><td>+0.57</td><td>+0.50</td><td>+1.67</td><td>+1.84</td></tr><tr><td>OURS VS.LDS + FDS (SOTA IN DIR)</td><td>+17.12</td><td>+13.51</td><td>+23.65</td><td>+2.49</td><td>+0.85</td><td>+0.81</td><td>+1.31</td><td>+0.76</td><td>+0.76</td><td>+0.71</td><td>+1.50</td><td>+0.99</td></tr></table>
|
| 240 |
+
|
| 241 |
+
Table 3: Uncertainty estimation results on AgeDB-DIR.
|
| 242 |
+
|
| 243 |
+
<table><tr><td>Metrics</td><td></td><td colspan="3">NLL↓</td><td></td><td colspan="3">AUSE↓</td></tr><tr><td>Shot</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td></tr><tr><td>DEEP ENSEMBLE (Lakshminarayanan et al., 2017)</td><td>5.311</td><td>4.031</td><td>6.726</td><td>8.523</td><td>0.541</td><td>0.626</td><td>0.466</td><td>0.483</td></tr><tr><td>DER (Amini et al., 2020)</td><td>3.936</td><td>3.768</td><td>3.865</td><td>4.421</td><td>0.590</td><td>0.449</td><td>0.468</td><td>0.500</td></tr><tr><td>LDS + FDS + DER (Yang et al., 2021; Amini et al., 2020)</td><td>3.794</td><td>3.699</td><td>3.969</td><td>4.214</td><td>0.463</td><td>0.260</td><td>0.392</td><td>0.617</td></tr><tr><td>VIR (OURS)</td><td>3.703</td><td>3.598</td><td>3.805</td><td>4.196</td><td>0.437</td><td>0.474</td><td>0.319</td><td>0.413</td></tr><tr><td>OURS VS. DER</td><td></td><td>|+0.064 +0.071 +0.060 +0.225|+0.153 +0.026 +0.007 +0.036</td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 244 |
+
|
| 245 |
+
Results show that VIR outperform the baselines in all few-shot metrics. In some categories, VIR may not perform better in the overall, many-shot and median shot metrics, but the gap tends to be minimal. Note that our proposed methods mainly focus on the imbalanced setting, therefore we also
|
| 246 |
+
|
| 247 |
+
focus on the few-shot metrics. Lastly, comparing our model variant with the best performance against the baseline (DER), we can conclude that our methods successfully improve uncertainty estimation in the probabilistic imbalanced regression setting.
|
| 248 |
+
|
| 249 |
+
We also observe that the improvements of the uncertainty estimation on IMDB-WIKI are larger than those on Age-DB. We suspect that this because IMDB-WIKI contains much more training, validating and testing data, therefore enjoying more stable
|
| 250 |
+
|
| 251 |
+
Table 4: Uncertainty estimation results on IMDB-WIKI-DIR.
|
| 252 |
+
|
| 253 |
+
<table><tr><td>Metrics</td><td colspan="4">NLL↓</td><td colspan="4">AUSE↓</td></tr><tr><td>Shot</td><td>Al</td><td>Many</td><td>Med.</td><td>Few</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td></tr><tr><td>DER (Amini et al.,2020)</td><td>3.850</td><td>3.699</td><td>4.997</td><td>6.638</td><td>0.813</td><td>0.802</td><td>0.650</td><td>0.541</td></tr><tr><td>LDS +FDS + DER (Yang et al.,2021; Amini et al.,020)</td><td>3.683</td><td>3.602</td><td>4.391</td><td>5.697</td><td>0.784</td><td>0.670</td><td>0.455</td><td>0.483</td></tr><tr><td>VIR(OURS)</td><td>3.652</td><td>3.568</td><td>4.419</td><td>5.560</td><td>0.622</td><td>0.645</td><td>0.511</td><td>0.374</td></tr><tr><td>OURS VS.DER</td><td></td><td></td><td>|+0.198 +0.131 +0.578 +1.078|+0.191 +0.157 +0.202 +0.167</td><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 254 |
+
|
| 255 |
+
uncertainty estimation improvements brought by VIR compared to those in Age-DB.
|
| 256 |
+
|
| 257 |
+
# 5 CONCLUSION
|
| 258 |
+
|
| 259 |
+
We identify the problem of probabilistic deep imbalanced regression, which aims to both improve accuracy and obtain reasonable uncertainty estimation in imbalanced regression. We propose VIR, which can use any deep regression models as backbone networks. VIR borrows data with similar regression labels to produce the probabilistic representations and modulates the conjugate distributions to impose probabilistic reweighting on imbalanced data. Furthermore, we create new benchmarks for uncertainty estimation on imbalanced regression. Experiments show that our methods outperform state-of-the-art imbalanced regression models in terms of both accuracy and uncertainty estimation. Future work may include (1) improving VIR by better approximating variance of the variances in probability distributions, and (2) developing novel approaches that can achieve stable performance even on imbalanced data with limited sample size, and (3) exploring techniques such as mixture density networks (Bishop, 1994) to enable multi-modality in the latent distribution, thereby further improving the performance.
|
| 260 |
+
|
| 261 |
+
# REFERENCES
|
| 262 |
+
|
| 263 |
+
Alexander Amini, Wilko Schwarting, Ava Soleimany, and Daniela Rus. Deep evidential regression. In Hugo Larochelle, Marc’Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan-Tien Lin (eds.), Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020.
|
| 264 |
+
|
| 265 |
+
James Bergstra and Yoshua Bengio. Random search for hyper-parameter optimization. J. Mach. Learn. Res., 13:281–305, 2012.
|
| 266 |
+
|
| 267 |
+
Christopher M. Bishop. Mixture density networks. Technical report, 1994.
|
| 268 |
+
|
| 269 |
+
Christopher M Bishop. Pattern recognition and machine learning. springer, 2006.
|
| 270 |
+
|
| 271 |
+
Paula Branco, Luís Torgo, and Rita P. Ribeiro. SMOGN: a pre-processing approach for imbalanced regression. In First International Workshop on Learning with Imbalanced Domains: Theory and Applications, LIDTA@PKDD/ECML 2017, 22 September 2017, Skopje, Macedonia, volume 74 of Proceedings of Machine Learning Research, pp. 36–50. PMLR, 2017.
|
| 272 |
+
|
| 273 |
+
Paula Branco, Luís Torgo, and Rita P. Ribeiro. REBAGG: resampled bagging for imbalanced regression. In Second International Workshop on Learning with Imbalanced Domains: Theory and Applications, LIDTA@ECML/PKDD 2018, Dublin, Ireland, September 10, 2018, volume 94 of Proceedings of Machine Learning Research, pp. 67–81. PMLR, 2018.
|
| 274 |
+
|
| 275 |
+
Bertrand Charpentier, Daniel Zügner, and Stephan Günnemann. Posterior Network: Uncertainty Estimation without OOD Samples via Density-Based Pseudo-Counts. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020.
|
| 276 |
+
|
| 277 |
+
Bertrand Charpentier, Oliver Borchert, Daniel Zügner, Simon Geisler, and Stephan Günnemann. Natural Posterior Network: Deep Bayesian Predictive Uncertainty for Exponential Family Distributions. In The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022. OpenReview.net, 2022.
|
| 278 |
+
|
| 279 |
+
Nitesh V Chawla, Kevin W Bowyer, Lawrence O Hall, and W Philip Kegelmeyer. Smote: synthetic minority over-sampling technique. Journal of artificial intelligence research, 16:321–357, 2002.
|
| 280 |
+
|
| 281 |
+
Zongyong Deng, Hao Liu, Yaoxing Wang, Chenyang Wang, Zekuan Yu, and Xuehong Sun. PML: progressive margin loss for long-tailed age classification. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2021, virtual, June 19-25, 2021, 2021.
|
| 282 |
+
|
| 283 |
+
Yarin Gal and Zoubin Ghahramani. Dropout as a Bayesian Approximation: Representing Model Uncertainty in Deep Learning. In Proceedings of the 33nd International Conference on Machine Learning, ICML 2016, New York City, NY, USA, June 19-24, 2016, volume 48 of JMLR Workshop and Conference Proceedings, pp. 1050–1059. JMLR.org, 2016.
|
| 284 |
+
|
| 285 |
+
Yu Gong, Greg Mori, and Frederick Tung. RankSim: Ranking Similarity Regularization for Deep Imbalanced Regression. In International Conference on Machine Learning, ICML 2022, 17-23 July 2022, Baltimore, Maryland, USA, volume 162 of Proceedings of Machine Learning Research, pp. 7634–7649. PMLR, 2022.
|
| 286 |
+
|
| 287 |
+
Arjun K Gupta and Daya K Nagar. Matrix variate distributions, volume 104. CRC Press, 2018.
|
| 288 |
+
|
| 289 |
+
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 2016, Las Vegas, NV, USA, June 27-30, 2016, pp. 770–778. IEEE Computer Society, 2016.
|
| 290 |
+
|
| 291 |
+
Jakob Heiss, Jakob Weissteiner, Hanna S. Wutte, Sven Seuken, and Josef Teichmann. NOMU: Neural Optimization-based Model Uncertainty. In International Conference on Machine Learning, ICML 2022, 17-23 July 2022, Baltimore, Maryland, USA, volume 162 of Proceedings of Machine Learning Research, pp. 8708–8758. PMLR, 2022.
|
| 292 |
+
|
| 293 |
+
Eyke Hüllermeier and Willem Waegeman. Aleatoric and epistemic uncertainty in machine learning: A tutorial introduction. CoRR, abs/1910.09457, 2019.
|
| 294 |
+
|
| 295 |
+
Eddy Ilg, Özgün cCiccek, Silvio Galesso, Aaron Klein, Osama Makansi, Frank Hutter, and Thomas Brox. Uncertainty estimates and multi-hypotheses networks for optical flow. In Vittorio Ferrari, Martial Hebert, Cristian Sminchisescu, and Yair Weiss (eds.), Computer Vision - ECCV 2018 - 15th European Conference, Munich, Germany, September 8-14, 2018, Proceedings, Part VII, volume 11211 of Lecture Notes in Computer Science, pp. 677–693. Springer, 2018.
|
| 296 |
+
|
| 297 |
+
Haoming Jiang, Pengcheng He, Weizhu Chen, Xiaodong Liu, Jianfeng Gao, and Tuo Zhao. SMART: robust and efficient fine-tuning for pre-trained natural language models through principled regularized optimization. In Dan Jurafsky, Joyce Chai, Natalie Schluter, and Joel R. Tetreault (eds.), Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, ACL 2020, Online, July 5-10, 2020, pp. 2177–2190. Association for Computational Linguistics, 2020.
|
| 298 |
+
|
| 299 |
+
Alex Kendall and Yarin Gal. What uncertainties do we need in bayesian deep learning for computer vision? arXiv preprint arXiv:1703.04977, 2017.
|
| 300 |
+
|
| 301 |
+
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.
|
| 302 |
+
|
| 303 |
+
Diederik P. Kingma and Max Welling. Auto-encoding variational bayes. In Yoshua Bengio and Yann LeCun (eds.), 2nd International Conference on Learning Representations, ICLR 2014, Banff, AB, Canada, April 14-16, 2014, Conference Track Proceedings, 2014.
|
| 304 |
+
|
| 305 |
+
Volodymyr Kuleshov, Nathan Fenner, and Stefano Ermon. Accurate uncertainties for deep learning using calibrated regression. In International Conference on Machine Learning, pp. 2796–2804. PMLR, 2018.
|
| 306 |
+
|
| 307 |
+
Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. Simple and Scalable Predictive Uncertainty Estimation using Deep Ensembles. In Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, pp. 6402–6413, 2017.
|
| 308 |
+
|
| 309 |
+
Jeremiah Liu, Zi Lin, Shreyas Padhy, Dustin Tran, Tania Bedrax Weiss, and Balaji Lakshminarayanan. Simple and Principled Uncertainty Estimation with Deterministic Deep Learning via Distance Awareness. In Advances in Neural Information Processing Systems, volume 33. Curran Associates, Inc., 2020.
|
| 310 |
+
|
| 311 |
+
Ziwei Liu, Zhongqi Miao, Xiaohang Zhan, Jiayun Wang, Boqing Gong, and Stella X. Yu. Large-scale long-tailed recognition in an open world. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2019, Long Beach, CA, USA, June 16-20, 2019, pp. 2537–2546. Computer Vision Foundation / IEEE, 2019.
|
| 312 |
+
|
| 313 |
+
Lu Mi, Hao Wang, Yonglong Tian, and Nir Shavit. Training-free uncertainty estimation for neural networks. In AAAI, 2022.
|
| 314 |
+
|
| 315 |
+
Stylianos Moschoglou, Athanasios Papaioannou, Christos Sagonas, Jiankang Deng, Irene Kotsia, and Stefanos Zafeiriou. Agedb: The first manually collected, in-the-wild age database. In 2017 IEEE Conference on Computer Vision and Pattern Recognition Workshops, CVPR Workshops 2017, Honolulu, HI, USA, July 21-26, 2017, pp. 1997–2005, 2017.
|
| 316 |
+
|
| 317 |
+
Jiawei Ren, Mingyuan Zhang, Cunjun Yu, and Ziwei Liu. Balanced MSE for Imbalanced Visual Regression. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, CVPR 2022, New Orleans, LA, USA, June 18-24, 2022, pp. 7916–7925. IEEE, 2022.
|
| 318 |
+
|
| 319 |
+
Rasmus Rothe, Radu Timofte, and Luc Van Gool. Deep expectation of real and apparent age from a single image without facial landmarks. Int. J. Comput. Vis., 126(2-4):144–157, 2018.
|
| 320 |
+
|
| 321 |
+
Jasper Snoek, Yaniv Ovadia, Emily Fertig, Balaji Lakshminarayanan, Sebastian Nowozin, D. Sculley, Joshua V. Dillon, Jie Ren, and Zachary Nado. Can you trust your model’s uncertainty? Evaluating predictive uncertainty under dataset shift. In Advances in Neural Information Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019, December 8-14, 2019, Vancouver, BC, Canada, pp. 13969–13980, 2019.
|
| 322 |
+
|
| 323 |
+
Hao Song, Tom Diethe, Meelis Kull, and Peter Flach. Distribution calibration for regression. In International Conference on Machine Learning, pp. 5897–5906. PMLR, 2019.
|
| 324 |
+
|
| 325 |
+
Maximilian Stadler, Bertrand Charpentier, Simon Geisler, Daniel Zügner, and Stephan Günnemann. Graph Posterior Network: Bayesian Predictive Uncertainty for Node Classification. In Advances in Neural Information Processing Systems 34: Annual Conference on Neural Information Processing Systems 2021, NeurIPS 2021, December 6-14, 2021, virtual, pp. 18033–18048, 2021.
|
| 326 |
+
|
| 327 |
+
Baochen Sun, Jiashi Feng, and Kate Saenko. Return of frustratingly easy domain adaptation. In Dale Schuurmans and Michael P. Wellman (eds.), Proceedings of the Thirtieth AAAI Conference on Artificial Intelligence, February 12-17, 2016, Phoenix, Arizona, USA, pp. 2058–2065. AAAI Press, 2016.
|
| 328 |
+
|
| 329 |
+
Luís Torgo, Rita P. Ribeiro, Bernhard Pfahringer, and Paula Branco. SMOTE for regression. In Luís Correia, Luís Paulo Reis, and José Cascalho (eds.), Progress in Artificial Intelligence - 16th Portuguese Conference on Artificial Intelligence, EPIA 2013, Angra do Heroísmo, Azores, Portugal, September 9-12, 2013. Proceedings, volume 8154 of Lecture Notes in Computer Science, pp. 378–389. Springer, 2013.
|
| 330 |
+
|
| 331 |
+
Joost van Amersfoort, Lewis Smith, Andrew Jesson, Oscar Key, and Yarin Gal. Improving Deterministic Uncertainty Estimation in Deep Learning for Classification and Regression. CoRR, abs/2102.11409, 2021.
|
| 332 |
+
|
| 333 |
+
Vikas Verma, Alex Lamb, Christopher Beckham, Amir Najafi, Ioannis Mitliagkas, David Lopez-Paz, and Yoshua Bengio. Manifold mixup: Better representations by interpolating hidden states. In Kamalika Chaudhuri and Ruslan Salakhutdinov (eds.), Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, volume 97 of Proceedings of Machine Learning Research, pp. 6438–6447. PMLR, 2019.
|
| 334 |
+
|
| 335 |
+
Yuzhe Yang, Kaiwen Zha, Ying-Cong Chen, Hao Wang, and Dina Katabi. Delving into deep imbalanced regression. In Marina Meila and Tong Zhang (eds.), Proceedings of the 38th International Conference on Machine Learning, ICML 2021, 18-24 July 2021, Virtual Event, volume 139 of Proceedings of Machine Learning Research, pp. 11842–11851. PMLR, 2021.
|
| 336 |
+
|
| 337 |
+
Wei Yin, Jianming Zhang, Oliver Wang, Simon Niklaus, Long Mai, Simon Chen, and Chunhua Shen. Learning to recover 3d scene shape from a single image. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2021, virtual, June 19-25, 2021, pp. 204–213. Computer Vision Foundation / IEEE, 2021.
|
| 338 |
+
|
| 339 |
+
Eric Zelikman, Christopher Healy, Sharon Zhou, and Anand Avati. Crude: calibrating regression uncertainty distributions empirically. arXiv preprint arXiv:2005.12496, 2020.
|
| 340 |
+
|
| 341 |
+
Hongyi Zhang, Moustapha Cissé, Yann N. Dauphin, and David 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.
|
| 342 |
+
|
| 343 |
+
Zizhao Zhang, Adriana Romero, Matthew J Muckley, Pascal Vincent, Lin Yang, and Michal Drozdzal. Reducing uncertainty in undersampled mri reconstruction with active acquisition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2049–2058, 2019.
|
| 344 |
+
|
| 345 |
+
# A DISCUSSION ON I.I.D. AND N.I.D. ASSUMPTIONS
|
| 346 |
+
|
| 347 |
+
Generalization Error, Bias, and Variance. We could analyze the generalization error of our VIR by bounding the generalization with the sum of three terms: (a) the bias of our estimator, (2) the variance of our estimator, (3) model complexity. Essentially VIR uses the N.I.D. assumption increases our estimator’s bias, but significantly reduces its variance in the imbalanced setting. Since the model complexity is kept the same (using the same backbone neural network) as the baselines, N.I.D. will lead to a lower generalization error.
|
| 348 |
+
|
| 349 |
+
Variance of Estimators in Imbalanced Settings. In the imbalanced setting, one typically use inverse weighting to produced an unbiased estimator (i.e., making the first term of the aforementioned bound zero). However, for data with extremely low density, its inverse would be extremely large, therefore leading to a very large variance for the estimator. Our VIR replaces I.I.D. with N.I.D. to “smooth out” such singularity, and therefore significantly lowers the variance of the estimator (i.e., making the second term of the aforementioned bound smaller), and ultimately lowers the generalization error.
|
| 350 |
+
|
| 351 |
+
# B ADDITIONAL EXPERIMENT RESULTS
|
| 352 |
+
|
| 353 |
+
# B.1 ABLATION STUDY ON VIR
|
| 354 |
+
|
| 355 |
+
In this section, we include ablation studies to verify that our VIR can outperform its counterparts in DIR (i.e., smoothing on the latent space) and DER (i.e., NIG distribution layers).
|
| 356 |
+
|
| 357 |
+
Ablation Study on $q ( \mathbf { z } _ { i } | \{ \mathbf { x } _ { i } \} _ { i = 1 } ^ { N } )$ . To verify the effectiveness of VIR’s encoder $q ( \mathbf { z } _ { i } | \{ \mathbf { x } _ { i } \} _ { i = 1 } ^ { N } )$ , we replace VIR’s predictor $p ( y _ { i } | \mathbf { z } _ { i } )$ with a linear layer (as in DIR). Table 5 shows that compared to its counterpart, FDS (Yang et al., 2021), our encoderonly VIR still leads to a considerable
|
| 358 |
+
|
| 359 |
+
Table 5: Ablation study on AgeDB-DIR in terms of accuracy.
|
| 360 |
+
|
| 361 |
+
<table><tr><td>Metrics</td><td colspan="4">MSE↓</td><td colspan="4">MAE↓</td></tr><tr><td>Shot</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td></tr><tr><td>FDS (Yang et al.,2021)</td><td>109.78</td><td>93.99</td><td>124.96</td><td>216.97</td><td>8.12</td><td>7.52</td><td>8.68</td><td>12.25</td></tr><tr><td>ENCODER-ONLY VIR (OURS)</td><td>95.99</td><td>81.89</td><td>121.78</td><td>157.92</td><td>7.57</td><td>6.97</td><td>8.72</td><td>10.03</td></tr><tr><td>DER (Amini et al., 2020)</td><td>106.81</td><td>91.32</td><td>122.45</td><td>209.76</td><td>8.11</td><td>7.36</td><td>9.03</td><td>12.69</td></tr><tr><td>PREDICTOR-ONLY VIR(OURS)</td><td>88.96</td><td>74.79</td><td>95.85</td><td>203.76</td><td>7.28</td><td>6.68</td><td>7.76</td><td>11.63</td></tr></table>
|
| 362 |
+
|
| 363 |
+
improvements even without generating the NIG distribution, therefore verifying the effectiveness of our VIR’s $q ( \mathbf { z } _ { i } | \{ \mathbf { x } _ { i } \} _ { i = 1 } ^ { N } )$ .
|
| 364 |
+
|
| 365 |
+
Ablation Study on $p ( y _ { i } | \mathbf { z } _ { i } )$ . To verify the effectiveness of VIR’s predictor $p ( y _ { i } | \mathbf { z } _ { i } )$ , we replace VIR’s encoder $q ( \mathbf { \dot { z } } _ { i } | \{ \mathbf { x } _ { i } \} _ { i = 1 } ^ { N } )$ with a simple deterministic encoder as in DER (Amini et al., 2020). Table 5 and Table 6 show that compared to DER, the counter
|
| 366 |
+
|
| 367 |
+
Table 6: Ablation study on AgeDB-DIR in terms of uncertainty estimation.
|
| 368 |
+
|
| 369 |
+
<table><tr><td>Metrics</td><td colspan="4">NLL↓</td><td colspan="4">AUSE↓</td></tr><tr><td>Shot</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td><td>Al</td><td>Many</td><td>Med.</td><td>Few</td></tr><tr><td>DER Amini et al. (2020)</td><td>3.936</td><td>3.768</td><td>3.865</td><td>4.421</td><td>0.590</td><td>0.449</td><td>0.468</td><td>0.500</td></tr><tr><td>PREDICTOR-ONLY VIR (OURS)</td><td>3.887</td><td>3.755</td><td>3.854</td><td>4.394</td><td>0.443</td><td>0.387</td><td>0.390</td><td>0.407</td></tr></table>
|
| 370 |
+
|
| 371 |
+
part of VIR’s predictor, our VIR’s predictor still outperforms than DER, demonstrating its effectiveness; this verifies our claim (Sec. 3.4) that directly reweighting DER breaks NIG and leads to poor performance.
|
| 372 |
+
|
| 373 |
+
# B.2 RESULT ON STS-B-DIR DATASET
|
| 374 |
+
|
| 375 |
+
In this section, we report the accuracy and uncertainty evaluation on STS-B-DIR (more details for the dataset is in DIR (Yang et al., 2021)). From Table 7, Table 8, and Table 9 below, we can conclude
|
| 376 |
+
|
| 377 |
+
Table 7: Evaluation results of accuracy on STS-B-DIR.
|
| 378 |
+
|
| 379 |
+
<table><tr><td>Metrics</td><td colspan="4">MSE↓</td><td colspan="4">MAE↓</td><td colspan="4">GM↓</td></tr><tr><td>Shot</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td></tr><tr><td>INV</td><td>1.031</td><td>0.930</td><td>1.426</td><td>1.152</td><td>0.825</td><td>0.783</td><td>1.004</td><td>0.850</td><td>0.567</td><td>0.537</td><td>0.744</td><td>0.535</td></tr><tr><td>DIR(YANG ET AL, 2021)</td><td>1.000</td><td>0.912</td><td>1.368</td><td>1.055</td><td>0.812</td><td>0.772</td><td>0.989</td><td>0.809</td><td>0.560</td><td>0.535</td><td>0.739</td><td>0.477</td></tr><tr><td>DIR + DER (YANG ET AL.,2021; AMINI ET AL., 2020)</td><td>1.007</td><td>0.880</td><td>1.535</td><td>1.086</td><td>0.812</td><td>0.757</td><td>1.046</td><td>0.842</td><td>0.558</td><td>0.518</td><td>0.765</td><td>0.574</td></tr><tr><td>VIR (OURS)</td><td>0.895</td><td>0.799</td><td>1.309</td><td>0.919</td><td>0.760</td><td>0.718</td><td>0.960</td><td>0.732</td><td>0.509</td><td>0.493</td><td>0.669</td><td>0.377</td></tr></table>
|
| 380 |
+
|
| 381 |
+
that our model also outperforms all baselines in terms of both accuracy metrics and uncertainty estimation metrics in this NLP dataset; this verifies the superiority of our model for NLP datasets.
|
| 382 |
+
|
| 383 |
+
Table 8: Evaluation results of accuracy on STS-B-DIR.
|
| 384 |
+
|
| 385 |
+
<table><tr><td>Metrics</td><td colspan="4">Pearson↑</td><td colspan="4">Spearman ↑</td></tr><tr><td>Shot</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td></tr><tr><td>INV</td><td>0.718</td><td>0.701</td><td>0.612</td><td>0.705</td><td>0.723</td><td>0.678</td><td>0.530</td><td>0.685</td></tr><tr><td>DIR(YANG ET AL.,2021)</td><td>0.732</td><td>0.711</td><td>0.646</td><td>0.742</td><td>0.731</td><td>0.672</td><td>0.519</td><td>0.739</td></tr><tr><td>DIR + DER(YANG ET AL., 2021; AMINI ET AL., 2020)</td><td>0.729</td><td>0.714</td><td>0.635</td><td>0.731</td><td>0.730</td><td>0.680</td><td>0.526</td><td>0.699</td></tr><tr><td>VIR (OURS)</td><td>0.765</td><td>0.740</td><td>0.663</td><td>0.770</td><td>0.770</td><td>0.713</td><td>0.534</td><td>0.770</td></tr></table>
|
| 386 |
+
|
| 387 |
+
Table 9: Uncertainty estimation results on STS-B-DIR.
|
| 388 |
+
|
| 389 |
+
<table><tr><td>Metrics</td><td colspan="4">NLL↓</td><td colspan="4">AUSE↓</td></tr><tr><td>Shot</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td><td>Al</td><td>Many</td><td>Med.</td><td>Few</td></tr><tr><td>DIR + DER(YANG ET AL., 2021; AMINI ET AL., 2020)</td><td>2.561</td><td>2.514</td><td>2.880</td><td>2.358</td><td>0.672</td><td>0.581</td><td>0.609</td><td>0.615</td></tr><tr><td>VIR (OURS)</td><td>1.996</td><td>1.810</td><td>2.754</td><td>2.152</td><td>0.591</td><td>0.575</td><td>0.602</td><td>0.510</td></tr></table>
|
| 390 |
+
|
| 391 |
+
# B.3 DIFFERENCE BETWEEN DIR’S AND OUR REPRODUCED RESULTS
|
| 392 |
+
|
| 393 |
+
To reproduce the results on AgeDB, we use exactly the same settings as in DIR’s code (Yang et al., 2021) (i.e., by directly running their code on our machines without modifying hyperparameters). for each model in DIR we report, we use five different random seeds to produce five results. We then report the performance by taking the average of them. Table 10 and Table 11 show the example for SQINV and LDS+FDS on AgeDB-DIR. From the table we can see that under our hardware and software environments, the SQINV model and LDS $^ { + }$ FDS model (SOTA in DIR) could not perform as well as it is reported in DIR Yang et al. (2021), therefore for fair comparison, we use our replicated performance rather than theirs.
|
| 394 |
+
|
| 395 |
+
Table 10: Results of running SQINV for 5 different random seeds on AgeDB.
|
| 396 |
+
|
| 397 |
+
<table><tr><td>Metrics</td><td colspan="4">MSE↓</td><td colspan="4">MAE↓</td><td colspan="4">GM↓</td></tr><tr><td>Shot</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td></tr><tr><td>SQINv 1</td><td>107.02</td><td>90.71</td><td>131.5</td><td>193.39</td><td>8.04</td><td>7.40</td><td>9.01</td><td>11.33</td><td>5.15</td><td>4.73</td><td>8.81</td><td>8.22</td></tr><tr><td>SQINV 2</td><td>111.55</td><td>93.43</td><td>141.03</td><td>209.17</td><td>8.12</td><td>7.47</td><td>9.17</td><td>11.58</td><td>5.21</td><td>4.85</td><td>5.75</td><td>8.25</td></tr><tr><td>SQINv 3</td><td>114.33</td><td>96.83</td><td>134.56</td><td>223.86</td><td>8.21</td><td>7.59</td><td>9.01</td><td>11.81</td><td>5.17</td><td>4.74</td><td>5.85</td><td>8.27</td></tr><tr><td>SQINV 4</td><td>106.24</td><td>91.81</td><td>120.26</td><td>203.78</td><td>7.94</td><td>7.39</td><td>8.58</td><td>11.39</td><td>5.06</td><td>4.74</td><td>5.41</td><td>7.66</td></tr><tr><td>SQINv5</td><td>104.73</td><td>90.24</td><td>127.33</td><td>208.05</td><td>7.99</td><td>7.47</td><td>8.98</td><td>11.49</td><td>5.07</td><td>4.79</td><td>5.68</td><td>7.98</td></tr><tr><td>SQINV AVG</td><td>108.77</td><td>92.60</td><td>130.94</td><td>207.65</td><td>8.06</td><td>7.46</td><td>8.95</td><td>11.52</td><td>5.13</td><td>4.77</td><td>6.30</td><td>8.08</td></tr><tr><td>SQINV STD</td><td>12.89</td><td>5.67</td><td>48.46</td><td>96.71</td><td>0.01</td><td>0.01</td><td>0.04</td><td>0.03</td><td>0.01</td><td>0.01</td><td>1.60</td><td>0.05</td></tr><tr><td>SQINV RESULTS FROM(YANG ET AL., 2021)</td><td>105.14</td><td>87.21</td><td>127.66</td><td>212.30</td><td>7.81</td><td>7.16</td><td>8.80</td><td>11.20</td><td>4.99</td><td>4.57</td><td>5.73</td><td>7.77</td></tr></table>
|
| 398 |
+
|
| 399 |
+
# B.4 ABLATION STUDY ON λ
|
| 400 |
+
|
| 401 |
+
In this section, we include ablation studies on the $\lambda$ in our objective function. For $\lambda \in$ $\{ 1 0 . 0 , 1 . 0 , 0 . 1 , 0 . 0 1 , 0 . 0 0 1 \}$ , we run our VIR model on the AgeDB dataset. Table 12 shows the results. We can conclude that when $\lambda = 0 . 1$ , our model achieves the best performance.
|
| 402 |
+
|
| 403 |
+
Table 11: Results of running LDS+FDS for 5 different random seeds on AgeDB.
|
| 404 |
+
|
| 405 |
+
<table><tr><td>Metrics</td><td colspan="4">MSE↓</td><td colspan="4">MAE↓</td><td colspan="4">GM↓</td></tr><tr><td>Shot</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td></tr><tr><td>LDS+FDS 1</td><td>104.33</td><td>88.67</td><td>128.99</td><td>194.06</td><td>7.87</td><td>7.26</td><td>8.97</td><td>10.88</td><td>5.02</td><td>4.60</td><td>5.87</td><td>7.51</td></tr><tr><td>LDS+FDS 2</td><td>104.59</td><td>94.63</td><td>125.60</td><td>200.14</td><td>7.98</td><td>7.44</td><td>8.77</td><td>11.16</td><td>5.00</td><td>4.71</td><td>5.62</td><td>7.81</td></tr><tr><td>LDS+FDS 3</td><td>110.17</td><td>95.97</td><td>123.24</td><td>208.11</td><td>8.07</td><td>7.54</td><td>8.71</td><td>11.41</td><td>5.09</td><td>4.73</td><td>5.71</td><td>7.48</td></tr><tr><td>LDS+FDS 4</td><td>102.68</td><td>98.20</td><td>126.41</td><td>201.16</td><td>8.02</td><td>7.50</td><td>8.82</td><td>11.34</td><td>5.08</td><td>4.63</td><td>5.74</td><td>7.56</td></tr><tr><td>LDS+FDS 5</td><td>105.77</td><td>91.07</td><td>127.00</td><td>185.85</td><td>7.93</td><td>7.35</td><td>8.80</td><td>10.96</td><td>5.07</td><td>4.74</td><td>5.52</td><td>7.73</td></tr><tr><td>LDS+FDS AVG</td><td>105.51</td><td>93.71</td><td>126.25</td><td>197.86</td><td>7.97</td><td>7.42</td><td>8.81</td><td>11.15</td><td>5.05</td><td>4.68</td><td>5.69</td><td>7.62</td></tr><tr><td>LDS+FDS STD</td><td>6.41</td><td>11.70</td><td>3.52</td><td>55.97</td><td>0.01</td><td>0.01</td><td>0.01</td><td>0.04</td><td>0.01</td><td>0.03</td><td>0.01</td><td>0.02</td></tr><tr><td>LDS+FDS RESULTS FROM(YANG ET AL.,2021)</td><td>99.46</td><td>84.10</td><td>112.20</td><td>209.27</td><td>7.55</td><td>7.01</td><td>8.24</td><td>10.79</td><td>4.72</td><td>4.36</td><td>5.45</td><td>6.79</td></tr></table>
|
| 406 |
+
|
| 407 |
+
Table 12: Ablation study on $\lambda$ for VIR on AgeDB-DIR
|
| 408 |
+
|
| 409 |
+
<table><tr><td>Metrics</td><td colspan="4">MSE↓</td><td colspan="4">MAE↓</td><td colspan="4">NLL↓</td></tr><tr><td>Shot</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td><td>All</td><td>Many</td><td>Med.</td><td>Few</td></tr><tr><td>入=10.0</td><td>104.31</td><td>91.01</td><td>116.43</td><td>196.35</td><td>7.88</td><td>7.38</td><td>8.42</td><td>11.13</td><td>3.827</td><td>3.733</td><td>4.140</td><td>4.407</td></tr><tr><td>入=1.0</td><td>104.10</td><td>87.28</td><td>128.26</td><td>196.12</td><td>7.83</td><td>7.21</td><td>8.81</td><td>10.89</td><td>3.848</td><td>3.738</td><td>4.041</td><td>4.356</td></tr><tr><td>入=0.1</td><td>86.28</td><td>76.87</td><td>101.57</td><td>132.90</td><td>7.19</td><td>6.75</td><td>7.97</td><td>9.19</td><td>3.785</td><td>3.694</td><td>3.963</td><td>4.151</td></tr><tr><td>入=0.01</td><td>86.86</td><td>76.58</td><td>99.95</td><td>147.82</td><td>7.12</td><td>6.69</td><td>7.72</td><td>9.59</td><td>3.887</td><td>3.797</td><td>4.007</td><td>4.401</td></tr><tr><td>入=0.001</td><td>87.25</td><td>74.13</td><td>104.78</td><td>162.64</td><td>7.13</td><td>6.64</td><td>7.92</td><td>9.63</td><td>3.980</td><td>3.868</td><td>4.161</td><td>4.546</td></tr></table>
|
md/dev/0RDcd5Axok/0RDcd5Axok.md
ADDED
|
@@ -0,0 +1,365 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# TOWARDS A UNIFIED VIEW OF PARAMETER-EFFICIENT TRANSFER LEARNING
|
| 2 |
+
|
| 3 |
+
Junxian $\mathbf { H e } ^ { * }$ Carnegie Mellon University junxianh@cs.cmu.edu
|
| 4 |
+
|
| 5 |
+
Chunting Zhou∗ Carnegie Mellon University chuntinz@cs.cmu.edu
|
| 6 |
+
|
| 7 |
+
Xuezhe Ma University of Southern California xuezhema@isi.edu
|
| 8 |
+
|
| 9 |
+
Taylor Berg-Kirkpatrick UC San Diego tberg@eng.ucsd.edu
|
| 10 |
+
|
| 11 |
+
Graham Neubig Carnegie Mellon University gneubig@cs.cmu.edu
|
| 12 |
+
|
| 13 |
+
# ABSTRACT
|
| 14 |
+
|
| 15 |
+
Fine-tuning large pretrained language models on downstream tasks has become the de-facto learning paradigm in NLP. However, conventional approaches finetune all the parameters of the pretrained model, which becomes prohibitive as the model size and the number of tasks grow. Recent work has proposed a variety of parameter-efficient transfer learning methods that only fine-tune a small number of (extra) parameters to attain strong performance. While effective, the critical ingredients for success and the connections among the various methods are poorly understood. In this paper, we break down the design of state-of-the-art parameter-efficient transfer learning methods and present a unified framework that establishes connections between them. Specifically, we re-frame them as modifications to specific hidden states in pretrained models, and define a set of design dimensions along which different methods vary, such as the function to compute the modification and the position to apply the modification. Through comprehensive empirical studies across machine translation, text summarization, language understanding, and text classification benchmarks, we utilize the unified view to identify important design choices in previous methods. Furthermore, our unified framework enables the transfer of design elements across different approaches, and as a result we are able to instantiate new parameter-efficient fine-tuning methods that tune less parameters than previous methods while being more effective, achieving comparable results to fine-tuning all parameters on all four tasks.1
|
| 16 |
+
|
| 17 |
+
# 1 INTRODUCTION
|
| 18 |
+
|
| 19 |
+
Transfer learning from pre-trained language models (PLMs) is now the prevalent paradigm in natural language processing, yielding strong performance on many tasks (Peters et al., 2018; Devlin et al., 2019; Qiu et al., 2020). The most common way to adapt general-purpose PLMs to downstream tasks is to fine-tune all the model parameters (full fine-tuning). However, this results in a separate copy of fine-tuned model parameters for each task, which is prohibitively expensive when serving models that perform a large number of tasks. This issue is particularly salient with the ever-increasing size of PLMs, which now range from hundreds of millions (Radford et al., 2019; Lewis et al., 2020) to hundreds of billions (Brown et al., 2020) or even trillions of parameters (Fedus et al., 2021).
|
| 20 |
+
|
| 21 |
+
To mitigate this issue, a few lightweight alternatives have been proposed to update only a small number of extra parameters while keeping most pretrained parameters frozen. For example, adapter tuning (Houlsby et al., 2019) inserts small neural modules called adapters to each layer of the pretrained network and only the adapters are trained at fine-tuning time. Inspired by the success of prompting methods that control PLMs through textual prompts (Brown et al., 2020; Liu et al., 2021a), prefix tuning (Li & Liang, 2021) and prompt tuning (Lester et al., 2021) prepend an additional $l$ tunable prefix tokens to the input or hidden layers and only train these soft prompts when fine-tuning on downstream tasks. More recently, Hu et al. (2021) learn low-rank matrices to approximate parameter updates. We illustrate these methods in Figure 1. These approaches have all been reported to demonstrate comparable performance to full fine-tuning on different sets of tasks, often through updating less than $1 \%$ of the original model parameters. Besides parameter savings, parameter-efficient tuning makes it possible to quickly adapt to new tasks without catastrophic forgetting (Pfeiffer et al., 2021) and often exhibits superior robustness in out-of-distribution evaluation (Li & Liang, 2021).
|
| 22 |
+
|
| 23 |
+

|
| 24 |
+
Figure 1: Illustration of the transformer architecture and several state-of-the-art parameter-efficient tuning methods. We use blocks with dashed borderlines to represent the added modules by those methods.
|
| 25 |
+
|
| 26 |
+

|
| 27 |
+
Figure 2: Performance of different methods on the XSum (Narayan et al., 2018) summarization task. The number of fine-tuned parameters is relative to the tuned parameters in full fine-tuning.
|
| 28 |
+
|
| 29 |
+
However, we contend that the important ingredients that contribute to the success of these parameterefficient tuning methods are poorly understood, and the connections between them are still unclear. In this paper, we aim to answer three questions: (1) How are these methods connected? (2) Do these methods share design elements that are essential for their effectiveness, and what are they? (3) Can the effective ingredients of each method be transferred to others to yield more effective variants?
|
| 30 |
+
|
| 31 |
+
In order to answer these questions, we first derive an alternative form of prefix tuning that reveals prefix tuning’s close connections with adapters (§3.1). Based on this we then devise a unified framework that frames the aforementioned methods as different ways to modify the hidden representations of frozen PLMs (§3.2). Our unified framework decomposes previous methods along a shared set of design dimensions, such as the function used to perform the modification, the position in which to impose this modification, and how to integrate the modification. This framework allows us to transfer design choices across approaches to propose new variants such as adapters with multiple heads (§3.3). In experiments, we first show that existing parameter-efficient tuning methods still lag behind full fine-tuning on higher-resource and challenging tasks (§4.2), as exemplified in Figure 2. Then we utilize the unified framework to identify critical design choices and validate the proposed variants empirically (§4.3-4.6). Our experiments on four NLP benchmarks covering text summarization, machine translation (MT), text classification, and general language understanding, demonstrate that the proposed variant uses less parameters than existing methods while being more effective, matching full fine-tuning results on all four tasks.
|
| 32 |
+
|
| 33 |
+
# 2 PRELIMINARIES
|
| 34 |
+
|
| 35 |
+
# 2.1 RECAP OF THE TRANSFORMER ARCHITECTURE
|
| 36 |
+
|
| 37 |
+
The transformer model (Vaswani et al., 2017) is now the workhorse architecture behind most stateof-the-art PLMs. In this section we recap the equations of this model for completeness. Transformer models are composed of $L$ stacked blocks, where each block (Figure 1) contains two types of sub
|
| 38 |
+
|
| 39 |
+
layers: multi-head self-attention and a fully connected feed-forward network (FFN).2 The conventional attention function maps queries $\boldsymbol { Q } \in \mathbb { R } ^ { n \times d _ { k } }$ and key-value pairs $\pmb { K } \in \mathbb { R } ^ { m \times d _ { k } } , \pmb { V } \in \mathbb { R } ^ { m \times d _ { v } }$
|
| 40 |
+
|
| 41 |
+
$$
|
| 42 |
+
\mathrm { A t t n } ( Q , K , V ) = \mathrm { s o f t m a x } \big ( \frac { Q K ^ { T } } { \sqrt { d _ { k } } } \big ) V ,
|
| 43 |
+
$$
|
| 44 |
+
|
| 45 |
+
where $n$ and $m$ are the number of queries and key-value pairs respectively. Multi-head attention performs the attention function in parallel over $N _ { h }$ heads, where each head is separately parameterized by $W _ { q } ^ { ( i ) }$ , $\boldsymbol { W } _ { k } ^ { ( i ) }$ , $W _ { v } ^ { ( i ) } \in \mathbb { R } ^ { d \times d _ { h } }$ to project inputs to queries, keys, and values. Given a sequence of $m$ vectors $C \in \mathbb { R } ^ { m \times d }$ over which we would like to perform attention and a query vector $\pmb { x } \in \mathbb { R } ^ { d }$ , multi-head attention (MHA) computes the output on each head and concatenates them:3
|
| 46 |
+
|
| 47 |
+
$$
|
| 48 |
+
\mathrm { M H A } ( C , { \pmb x } ) = \mathrm { C o n c a t } ( \mathrm { h e a d } _ { 1 } , \cdots , \mathrm { h e a d } _ { \mathrm { h } } ) { \pmb W } _ { o } , \ \mathrm { h e a d } _ { \mathrm { i } } = \mathrm { A t t n } ( { \pmb x } { \pmb W } _ { q } ^ { ( i ) } , C { \pmb W } _ { k } ^ { ( i ) } , C { \pmb W } _ { v } ^ { ( i ) } ) ,
|
| 49 |
+
$$
|
| 50 |
+
|
| 51 |
+
where $W _ { o } \in \mathbb { R } ^ { d \times d }$ . $d$ is the model dimension, and in MHA $d _ { h }$ is typically set to $d / N _ { h }$ to save parameters, which indicates that each attention head is operating on a lower-dimensional space. The other important sublayer is the fully connected feed-forward network (FFN) which consists of two linear transformations with a ReLU activation function in between:
|
| 52 |
+
|
| 53 |
+
$$
|
| 54 |
+
\mathrm { F F N } ( \pmb { x } ) = \mathrm { R e L U } ( \pmb { x } \pmb { W } _ { 1 } + \pmb { b } _ { 1 } ) \pmb { W } _ { 2 } + \pmb { b } _ { 2 } ,
|
| 55 |
+
$$
|
| 56 |
+
|
| 57 |
+
where $W _ { 1 } \in \mathbb { R } ^ { d \times d _ { m } }$ , $W _ { 2 } \in \mathbb { R } ^ { d _ { m } \times d }$ . Transformers typically use a large $d _ { m }$ , e.g. $d _ { m } = 4 d$ . Finally, a residual connection is used followed by layer normalization (Ba et al., 2016).
|
| 58 |
+
|
| 59 |
+
# 2.2 OVERVIEW OF PREVIOUS PARAMETER-EFFICIENT TUNING METHODS
|
| 60 |
+
|
| 61 |
+
Below and in Figure 1, we introduce several state-of-the-art parameter-efficient tuning methods.
|
| 62 |
+
Unless otherwise specified, they only tune the added parameters while the PLM’s are frozen.
|
| 63 |
+
|
| 64 |
+
Adapters (Houlsby et al., 2019): The adapter approach inserts small modules (adapters) between transformer layers. The adapter layer generally uses a down-projection with $W _ { \mathrm { d o w n } } \ \in \ \mathbb { R } ^ { d \times r }$ to project the input $^ { h }$ to a lower-dimensional space specified by bottleneck dimension $r$ , followed by a nonlinear activation function $f ( \cdot )$ , and a up-projection with $W _ { \mathsf { u p } } \in \mathbb { R } ^ { r \times d }$ . These adapters are surrounded by a residual connection, leading to a final form:
|
| 65 |
+
|
| 66 |
+
$$
|
| 67 |
+
h h + f ( h W _ { \mathrm { d o w n } } ) W _ { \mathrm { u p } } .
|
| 68 |
+
$$
|
| 69 |
+
|
| 70 |
+
Houlsby et al. (2019) places two adapters sequentially within one layer of the transformer, one after the multi-head attention and one after the FFN sub-layer. Pfeiffer et al. (2021) have proposed a more efficient adapter variant that is inserted only after the FFN “add & layer norm” sub-layer.
|
| 71 |
+
|
| 72 |
+
Prefix Tuning (Li & Liang, 2021): Inspired by the success of textual prompting methods (Liu et al., 2021a), prefix tuning prepends $l$ tunable prefix vectors to the keys and values of the multihead attention at every layer. Specifically, two sets of prefix vectors $P _ { k } , \dot { P } _ { v } \in \mathbb R ^ { l \times d }$ are concatenated with the original key $\kappa$ and value $V$ . Then multi-head attention is performed on the new prefixed keys and values. The computation of ${ \mathrm { h e a d } } _ { i }$ in Eq. 2 becomes:
|
| 73 |
+
|
| 74 |
+
$$
|
| 75 |
+
\mathrm { h e a d } _ { i } = \mathrm { A t t n } ( \pmb { x } \pmb { W } _ { q } ^ { ( i ) } , \mathrm { c o n c a t } ( \pmb { P } _ { k } ^ { ( i ) } , \pmb { C } \pmb { W } _ { k } ^ { ( i ) } ) , \mathrm { c o n c a t } ( \pmb { P } _ { v } ^ { ( i ) } , \pmb { C } \pmb { W } _ { v } ^ { ( i ) } ) ) ,
|
| 76 |
+
$$
|
| 77 |
+
|
| 78 |
+
$P _ { k }$ and $P _ { v }$ are split into $N _ { h }$ head vectors respectively and $P _ { k } ^ { ( i ) } , P _ { v } ^ { ( i ) } \in \mathbb R ^ { l \times d / N _ { h } }$ denote the $i$ -th head vector. Prompt-tuning (Lester et al., 2021) simplifies prefix-tuning by only prepending to the input word embeddings in the first layer; similar work also includes $\mathrm { \bf P }$ -tuning (Liu et al., 2021b).
|
| 79 |
+
|
| 80 |
+
LoRA (Hu et al., 2021): LoRA injects trainable low-rank matrices into transformer layers to approximate the weight updates. For a pre-trained weight matrix $W \in \mathbb { R } ^ { d \times k }$ , LoRA represents its update with a low-rank decomposition $W + \Delta W = W + W _ { \mathrm { d o w n } } W _ { \mathrm { u p } }$ , where $W _ { \mathrm { d o w n } } \in \mathbb { R } ^ { \hat { d } \times r }$ , $W _ { \mathrm { u p } } \in$ $\mathbb { R } ^ { r \times k }$ are tunable parameters. LoRA applies this update to the query and value projection matrices $\left( W _ { q } , W _ { v } \right)$ in the multi-head attention sub-layer, as shown in Figure 1. For a specific input $_ { \textbf { \em x } }$ to the linear projection in multi-head attention, LoRA modifies the projection output $^ { h }$ as:
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
h h + s \cdot x W _ { \mathrm { d o w n } } W _ { \mathrm { u p } } ,
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+

|
| 87 |
+
Figure 3: Graphical illustration of existing methods and the proposed variants. “PLM module” represents a certain sublayer of the PLM (e.g. attention or FFN) that is frozen. “Scaled PA” denotes scaled parallel adapter. We do not include multi-head parallel adapter here to save space.
|
| 88 |
+
|
| 89 |
+
where $s \geq 1$ is a tunable scalar hyperparameter.4
|
| 90 |
+
|
| 91 |
+
Others: Other parameter-efficient tuning methods include BitFit (Ben Zaken et al., 2021), which only fine-tunes bias vectors in the pre-trained model, and diff-pruning (Guo et al., 2021), which learns a sparse parameter update vector.
|
| 92 |
+
|
| 93 |
+
# 3 BRIDGING THE GAP – A UNIFIED VIEW
|
| 94 |
+
|
| 95 |
+
We first derive an equivalent form of prefix tuning to establish its connection with adapters. We then propose a unified framework for parameter-efficient tuning that includes several state-of-the-art methods as instantiations.
|
| 96 |
+
|
| 97 |
+
# 3.1 A CLOSER LOOK AT PREFIX TUNING
|
| 98 |
+
|
| 99 |
+
Eq. 5 describes the mechanism of prefix tuning which changes the attention module through prepending $l$ learnable vectors to the original attention keys and values. Here, we derive an equivalent form of Eq. 5 and provide an alternative view of prefix tuning:5
|
| 100 |
+
|
| 101 |
+
$$
|
| 102 |
+
\begin{array} { r l } & { \mathrm { h e a d } = \mathrm { A t } \mathrm { t n } ( x W _ { q } , \mathrm { c o n c a t } ( P _ { k } , C W _ { k } ) , \mathrm { c o n c a t } ( P _ { v } , C W _ { v } ) ) } \\ & { \ = \mathrm { s o f t m a x } \big ( x W _ { q } \mathrm { c o n c a t } ( P _ { k } , C W _ { k } ) ^ { \top } \big ) \Big [ \begin{array} { l } { P _ { v } } \\ { C W _ { v } } \end{array} \Big ] } \\ & { \ = ( 1 - \lambda ( \pmb { x } ) ) \mathrm { s o f t m a x } ( { \pmb x } W _ { q } W _ { k } ^ { \top } C ^ { \top } ) C W _ { v } + \lambda ( { \pmb x } ) \mathrm { s o f t m a x } ( { \pmb x } W _ { q } P _ { k } ^ { \top } ) P _ { v } } \\ & { \ = ( 1 - \lambda ( \pmb { x } ) ) \underbrace { \mathrm { A t t n } ( { \pmb x } W _ { q } , C W _ { k } , C W _ { v } ) } _ { \mathrm { s t a n d a r d a t e n t i o n } } + \lambda ( \pmb { x } ) \underbrace { \mathrm { A t t n } ( { \pmb x } W _ { q } , P _ { k } , P _ { v } ) } _ { \mathrm { i n d e p e n d e n t o f } C } , } \end{array}
|
| 103 |
+
$$
|
| 104 |
+
|
| 105 |
+
where $\lambda ( { \pmb x } )$ is a scalar that represents the sum of normalized attention weights on the prefixes:
|
| 106 |
+
|
| 107 |
+
$$
|
| 108 |
+
\lambda ( \pmb { x } ) = \frac { \sum _ { i } \exp ( \pmb { x } \pmb { W _ { q } } \pmb { P } _ { k } ^ { \top } ) _ { i } } { \sum _ { i } \exp ( \pmb { x } \pmb { W _ { q } } \pmb { P } _ { k } ^ { \top } ) _ { i } + \sum _ { j } \exp ( \pmb { x } \pmb { W _ { q } } \pmb { W } _ { k } ^ { \top } \pmb { C } ^ { \top } ) _ { j } } .
|
| 109 |
+
$$
|
| 110 |
+
|
| 111 |
+
Note that the first term in Eq. 7, $\mathrm { A t t n } ( x W _ { q } , C W _ { k } , C W _ { v } )$ , is the original attention without prefixes, whereas the second term is a position-wise modification independent of $C$ . Eq. 7 gives an alternative view of prefix tuning that essentially applies a position-wise modification to the original head attention output $^ { h }$ through linear interpolation:
|
| 112 |
+
|
| 113 |
+
$$
|
| 114 |
+
\begin{array} { r } { \pmb { h } ( 1 - \lambda ( \pmb { x } ) ) \pmb { h } + \lambda ( \pmb { x } ) \Delta \pmb { h } , \quad \Delta \pmb { h } : = \mathrm { s o f t m a x } ( \pmb { x } \pmb { W } _ { q } \pmb { P } _ { k } ^ { \top } ) \pmb { P } _ { v } . } \end{array}
|
| 115 |
+
$$
|
| 116 |
+
|
| 117 |
+
The Connection with Adapters: We define $W _ { 1 } { = } W _ { q } P _ { k } ^ { \top }$ , $W _ { 2 } { = } P _ { v }$ , $f \colon$ =softmax, and rewrite Eq. 9:
|
| 118 |
+
|
| 119 |
+
$$
|
| 120 |
+
\begin{array} { r } { \pmb { h } ( 1 - \lambda ( \pmb { x } ) ) \pmb { h } + \lambda ( \pmb { x } ) f ( \pmb { x } \pmb { W } _ { 1 } ) \pmb { W } _ { 2 } , } \end{array}
|
| 121 |
+
$$
|
| 122 |
+
|
| 123 |
+
which reaches a very similar form to the adapter function in Eq. 4, except that prefix tuning is performing weighted addition while the adapter one is unweighted.6 Figure 3b demonstrates the computation graph of prefix tuning from this view, which allows for abstraction of prefix tuning as a plug-in module like adapters. Further, we note that $W _ { 1 } \in \mathbb { R } ^ { d _ { h } \times l }$ and $W _ { 2 } \in \mathbb { R } ^ { l ^ { \cdot } \times d _ { h } }$ are lowrank matrices when $l$ is small, and thus they function similarly to the $W _ { \mathrm { d o w n } }$ and $W _ { \mathrm { u p } }$ matrices in adapters. This view also suggests that the number of prefix vectors, $l$ , plays a similar role to the bottleneck dimension $r$ in adapters: they both represent the rank limitation of computing the modification vector $\Delta h$ . Thus we also refer $l$ as the bottleneck dimension. Intuitively, the rank limitation implies that $\Delta h$ is a linear combination of the same $l$ (or $\leq l$ ) basis vectors for any $_ { \textbf { \em x } }$ .
|
| 124 |
+
|
| 125 |
+
Table 1: Parameter-efficient tuning methods decomposed along the defined design dimensions. Here, for clarity, we directly write the adapter nonlinear function as ReLU which is commonly used. The bottom part of the table exemplifies new variants by transferring design choices of existing approaches.
|
| 126 |
+
|
| 127 |
+
<table><tr><td>Method</td><td>△h functional form</td><td>insertion form</td><td>modified representation</td><td>composition function</td></tr><tr><td colspan="5">Existing Methods</td></tr><tr><td>Prefix Tuning</td><td> softmax(xWqPT)Pu</td><td>parallel</td><td>head attn</td><td>h←(1-λ)h+λ△h</td></tr><tr><td>Adapter</td><td>ReLU(hWdown)Wup</td><td>sequential</td><td>ffn/attn</td><td>h←h+△h</td></tr><tr><td>LoRA</td><td>xWdownWup</td><td>parallel</td><td>attn key/val</td><td>h←h+s·△h</td></tr><tr><td colspan="5">Proposed Variants</td></tr><tr><td>Parallel adapter</td><td>ReLU(hWdown)Wup</td><td>parallel</td><td>ffn/attn</td><td>h←h+△h</td></tr><tr><td>Muti-head parallel adapter</td><td>ReLU(hWdown)Wup</td><td>parallel</td><td>head attn</td><td>h←h+△h</td></tr><tr><td>Scaled parallel adapter</td><td>ReLU(hWdown)Wup</td><td>parallel</td><td>ffn/attn</td><td>h←h+s·△h</td></tr></table>
|
| 128 |
+
|
| 129 |
+
The Difference from Adapters: In addition to the gating variable $\lambda$ , we emphasize three differences between prefix tuning and adapters. (1) As demonstrated in Figure 3, prefix tuning uses $_ { \textbf { \em x } }$ , the input of the PLM layer, to compute $\Delta h$ , while adapters use $^ { h }$ , the output of the PLM layer. Thus, prefix tuning can be thought of as a “parallel” computation to the PLM layer, whereas the typical adapter is “sequential” computation. (2) Adapters are more flexible with respect to where they are inserted than prefix tuning: adapters typically modify attention or FFN outputs, while prefix tuning only modifies the attention output of each head. Empirically, this makes a large difference as we will show in $\ S 4 . 4$ . (3) Eq. 10 applies to each attention head, while adapters are always single-headed, which makes prefix tuning more expressive: head attention is of dimension $d / \dot { N _ { h } }$ – basically we have full rank updates to each attention head if $l \geq d / N _ { h }$ , but we only get full-rank updates to the whole attention output with adapters if $r \geq d$ . Notably, prefix tuning is not adding more parameters than adapters when ${ \dot { l } } = r$ .7 We empirically validate such multi-head influence in $\ S 4 . 4$ .
|
| 130 |
+
|
| 131 |
+
# 3.2 THE UNIFIED FRAMEWORK
|
| 132 |
+
|
| 133 |
+
Inspired by the connections between prefix tuning and adapters, we propose a general framework that aims to unify several state-of-the-art parameter-efficient tuning methods. Specifically, we cast them as learning a modification vector $\Delta h$ , which is applied to various hidden representations. Formally, we denote the hidden representation to be directly modified as $^ { h }$ , and the direct input to the PLM sub-module that computes $^ { h }$ as $_ { \textbf { \em x } }$ (e.g. $^ { h }$ and $_ { \textbf { \em x } }$ can be the attention output and input respectively). To characterize this modification process, we define a set of design dimensions, and different methods can be instantiated by varying values along these dimensions. We detail the design dimensions below, and illustrate how adapters, prefix tuning, and LoRA fall along them in Table 1:
|
| 134 |
+
|
| 135 |
+
Functional Form is the specific function that computes $\Delta h$ . We have detailed the functional form for adapters, prefix tuning, and LoRA in Eq. 4, 6, and 10 respectively. The functional forms of all these methods are similar with a proj down nonlinear $\to \mathsf { p r o j }$ up architecture, while “nonlinear” degenerates to the identity function in LoRA.
|
| 136 |
+
|
| 137 |
+
Modified Representation indicates which hidden representation is directly modified.8
|
| 138 |
+
|
| 139 |
+
Insertion Form is how the added module is inserted into the network. As mentioned in the previous section and shown in Figure 3, traditionally adapters are inserted at a position in a sequential manner, where both the input and output are $^ { h }$ . Prefix tuning and LoRA – although not originally described in this way – turn out to be equivalent to a parallel insertion where $_ { \textbf { \em x } }$ is the input.
|
| 140 |
+
|
| 141 |
+
Composition Function is how the modified vector $\Delta h$ is composed with the original hidden representation $^ { h }$ to form the new hidden representation. For example, adapters perform simple additive composition, prefix tuning uses a gated additive composition as shown in Eq. 10, and LoRA scales $\Delta h$ by a constant factor and adds it to the original hidden representation as in Eq. 6.
|
| 142 |
+
|
| 143 |
+
We note that many other methods not present in Table 1 fit into this framework as well. For example, prompt tuning modifies the head attention in the first layer in a way similar to prefix tuning, and various adapter variants (Pfeiffer et al., 2021; Mahabadi et al., 2021) can be represented in a similar way as adapters. Critically, the unified framework allows us to study parameter-efficient tuning methods along these design dimensions, identify the critical design choices, and potentially transfer design elements across approaches, as in the following section.
|
| 144 |
+
|
| 145 |
+
# 3.3 TRANSFERRING DESIGN ELEMENTS
|
| 146 |
+
|
| 147 |
+
Here, and in Figure 3, we describe just a few novel methods that can be derived through our unified view above by transferring design elements across methods: (1) Parallel Adapter is the variant by transferring the parallel insertion of prefix tuning into adapters. Interestingly, while we motivate the parallel adapter due to its similarity to prefix tuning, concurrent work (Zhu et al., 2021) independently proposed this variant and studied it empirically; (2) Multi-head Parallel Adapter is a further step to make adapters more similar to prefix tuning: we apply parallel adapters to modify head attention outputs as prefix tuning. This way the variant improves the capacity for free by utilizing the multi-head projections as we discuss in $\ S 3 . 1$ . (3) Scaled Parallel Adapter is the variant by transferring the composition and insertion form of LoRA into adapters, as shown in Figure 3e.
|
| 148 |
+
|
| 149 |
+
Our discussion and formulation so far raise a few questions: Do methods varying the design elements above exhibit distinct properties? Which design dimensions are particularly important? Do the novel methods described above yield better performance? We answer these questions next.
|
| 150 |
+
|
| 151 |
+
# 4 EXPERIMENTS
|
| 152 |
+
|
| 153 |
+
# 4.1 GENERAL SETUP
|
| 154 |
+
|
| 155 |
+
Datasets: We study four downstream tasks: (1) XSum (Narayan et al., 2018) is an English summarization dataset where models predict a summary given a news article; (2) English to Romanian translation using the WMT 2016 en-ro dataset (Bojar et al., 2016); (3) MNLI (Williams et al., 2018) is an English natural language inference dataset where models predict whether one sentence entails, contradicts, or is neutral to another. (4) SST2 (Socher et al., 2013) is an English sentiment classification benchmark where models predict whether a sentence’s sentiment is positive or negative.
|
| 156 |
+
|
| 157 |
+
Setup: We use ${ \tt B A R T } _ { \tt L A R G E }$ (Lewis et al., 2020) and a multilingual version of it, mBARTLARGE (Liu et al., 2020a), as the underlying pretrained models for XSum and en-ro translation respectively, and we use RoBERTaBASE (Liu et al., 2019) for MNLI and SST2. We vary the bottleneck dimension within $\{ 1 , 3 0 , 2 0 0 , 5 1 2 , 1 0 2 4 \}$ if needed.9 We mainly study adapters, prefix tuning (prefix), and LoRA which greatly outperform bitfit and prompt tuning in our experiments. In the analysis sections $( \ S 4 . 3 – 4 . 5 )$ we insert adapters either at the attention or FFN layers for easier analysis, but include the results of inserting at both places in the final comparison (§4.6). We re-implement these methods based on their respective public code.10 We use the huggingface transformers library (Wolf et al., 2020) for our implementation. Complete setup details can be found in Appendix A.
|
| 158 |
+
|
| 159 |
+
Evaluation: We report ROUGE $1 / 2 / \mathrm { L }$ scores (R-1/2/L, Lin (2004)) on the XSum test set, BLEU scores (Papineni et al., 2002) on the en-ro test set, and accuracy on the MNLI and SST2 dev set. For MNLI and SST2, we take the median of five random runs. We also report the number of tuned parameters relative to that in full fine-tuning (#params).
|
| 160 |
+
|
| 161 |
+
Number of Tunable Parameters: BART and mBART have an encoder-decoder structure that has three types of attention: encoder self-attention, decoder self-attention, and decoder cross-attention. RoBERTa only has encoder self-attention. For each attention sub-layer, the number of parameters used of each method is: (1) prefix tuning prepends $l$ vectors to the keys and values and uses $2 \times l \times d$ parameters; (2) adapter has $W _ { \mathrm { d o w n } }$ and $W _ { \mathrm { u p } }$ thus uses $2 \times r \times d$ parameters; (3) LoRA employs a pair of $W _ { \mathrm { d o w n } }$ and $W _ { \mathrm { u p } }$ for query and value projections, hence uses $4 \times r \times d$ parameters. For the adapter modification at ffn, it uses $2 \times r \times d$ parameters which is the same as adapter at attention. Therefore, for a specific value of $r$ or $l$ , prefix tuning uses the same number of parameters as adapters, while LoRA uses more parameters. More details can be found in Appendix B.
|
| 162 |
+
|
| 163 |
+

|
| 164 |
+
Figure 4: Performance of previous state-of-the-art parameterefficient tuning methods on $\bar { \mathrm { X S u m } }$ (left) and en-ro (right).
|
| 165 |
+
|
| 166 |
+
Table 2: Accuracy on the dev set of MNLI and SST2. MAM Adapter is proposed in $\ S 4 . 6$ . Bitfit numbers are from Ben Zaken et al. (2021).
|
| 167 |
+
|
| 168 |
+
<table><tr><td>Method (# params)</td><td>MNLI</td><td>SST2</td></tr><tr><td>Full-FT (100%)</td><td>87.6±.4</td><td>94.6±.4 93.7</td></tr><tr><td>Bitfit (0.1 %) Prefix (0.5%) LoRA (0.5%) Adapter (0.5%)</td><td>84.7 86.3±.4 87.2±.4 87.2±.2</td><td>94.0±.1 94.2±.2 94.2±.1</td></tr><tr><td colspan="3">MAM Adapter (0.5%) 87.4±.3 94.2±.3</td></tr></table>
|
| 169 |
+
|
| 170 |
+
Table 3: Comparison of different insertion forms for adapters, i.e. sequential adapter (SA) and parallel adapter (PA). We include the results of prefix tuning as a reference point.
|
| 171 |
+
|
| 172 |
+
<table><tr><td>Method</td><td># params</td><td>XSum (R-1/2/L)</td><td>MT (BLEU)</td></tr><tr><td>Prefix,l=200</td><td>3.6%</td><td>43.40/20.46/35.51</td><td>35.6</td></tr><tr><td>SA (attn), r=200</td><td>3.6%</td><td>42.01/19.30/34.40</td><td>35.3</td></tr><tr><td>SA (ffn),r=200</td><td>2.4%</td><td>43.21/19.98/35.08</td><td>35.6</td></tr><tr><td>PA (attn), r=200</td><td>3.6%</td><td>43.58/20.31/35.34</td><td>35.6</td></tr><tr><td>PA (ffn),r=200</td><td>2.4%</td><td>43.93/20.66/35.63</td><td>36.4</td></tr></table>
|
| 173 |
+
|
| 174 |
+
Table 4: Results on en-ro dataset.
|
| 175 |
+
|
| 176 |
+
<table><tr><td>Method</td><td># params MT (BLEU)</td></tr><tr><td>PA (attn),r=200 Prefix,l=200</td><td>3.6% 35.6 3.6% 35.6</td></tr><tr><td>MH PA (attn),r=200</td><td>3.6% 35.8</td></tr><tr><td>Prefix,l=30</td><td>0.1% 35.2</td></tr><tr><td>-gating,l=30</td><td>0.1% 34.9</td></tr><tr><td>PA (ffn),r=30</td><td>0.1% 33.0</td></tr><tr><td>PA (attn),r=30 MH PA (attn),r=30</td><td>0.1% 33.7 0.1% 35.3</td></tr></table>
|
| 177 |
+
|
| 178 |
+
# 4.2 THE RESULTS OF EXISTING METHODS
|
| 179 |
+
|
| 180 |
+
We first overview the results of existing methods on the four tasks. As shown in Figure 4 and Table 2, while existing methods can achieve competitive performance on MNLI and SST2 by tuning fewer than $1 \%$ parameters, a large gap is still present if we add $5 \%$ parameters in XSum and en-ro. The gap remains significant even though we increase the relative parameter size to $> 1 0 \%$ . Even larger gaps have been observed in Raffel et al. (2020) on high-resource MT tasks. This shows that many methods that claimed comparable results to full fine-tuning on the GLUE benchmark with an encoder-only model (Guo et al., 2021; Ben Zaken et al., 2021; Mahabadi et al., 2021), or on relatively simple generation benchmarks such as E2E (Novikova et al., 2017) with an encoder-decoder model (Li & Liang, 2021), may not generalize well to other standard benchmarks. The influencing factors could be complicated including the number of training samples, task complexity, or model architecture. We thus advocate for future research on this line to report results on more diverse benchmarks to exhibit a more complete picture of their performance profile. Below, our analysis will mainly focus on the XSum and en-ro datasets to better distinguish different design choices. We note that these two benchmarks are relatively high-resource performed with an encoder-decoder model (BART), while we will discuss the results on MNLI and SST2 with an encoder-only model (RoBERTa) in $\ S 4 . 6$ .
|
| 181 |
+
|
| 182 |
+
# .3 WHICH INSERTION FORM – SEQUENTIAL OR PARALLEL?
|
| 183 |
+
|
| 184 |
+
We first study the insertion form design dimension, comparing the proposed parallel adapter (PA) variant to the conventional sequential adapter (SA) over both the attention (att) and FFN modification. We also include prefix tuning as a reference point. As shown in Table 3, prefix tuning, which uses parallel insertion, outperforms attention sequential adapters. Further, the parallel adapter is able to beat sequential adapters in all cases,11 with PA (ffn) outperforming SA (ffn) by $1 . 7 \mathrm { R } \mathrm { - } 2$ points on
|
| 185 |
+
|
| 186 |
+

|
| 187 |
+
Figure 5: Results on XSum (left) and en-ro (right). PA represents parallel adapter. Blue and red markers apply modifications at attention and FFN sub-layers respectively (best viewed in color).
|
| 188 |
+
|
| 189 |
+
XSum and 0.8 BLEU points on en-ro respectively. Given the superior results of parallel adapters over sequential adapters, we focus on parallel adapter results in following sections.
|
| 190 |
+
|
| 191 |
+
# 4.4 WHICH MODIFIED REPRESENTATION – ATTENTION OR FFN?
|
| 192 |
+
|
| 193 |
+
Setup: We now study the effect of modifying different representations. We mainly compare attention and FFN modification. For easier analysis we categorize methods that modifies any hidden representations in the attention sub-layer (e.g. the head output, query, etc) as modifying the attention module. We compare parallel adapters at attention and FFN and prefix tuning. We also transfer the FFN modification to LoRA to have a LoRA (ffn) variant for a complete comparison. Specifically, we use LoRA to approximate the parameter updates for the FFN weights $\dot { W _ { 1 } } \in \mathbb { R } ^ { d \times \dot { d _ { m } } }$ and $\pmb { W } _ { 2 } \in \mathbb { R } ^ { d _ { m } \times d }$ . In this case $W _ { \mathrm { u p } }$ in LoRA for $W _ { 1 }$ (similar for $W _ { \mathrm { d o w n } }$ of $W _ { 2 }$ ) would have dimensions of $r \times d _ { m }$ , where $d _ { m } = 4 d$ as described in $\ S 2 . 1$ . Thus we typically use smaller $r$ for LoRA (ffn) than other methods to match their overall parameter size in later experiments.
|
| 194 |
+
|
| 195 |
+
Results: As shown in Figure 5, any method with FFN modification outperforms all the methods with attention modification in all cases (the red markers are generally above all the blue ones, the only exception is ffn-PA with $2 . 4 \%$ params), often with fewer parameters. Second, the same method applied at FFN always improves over its attention counterpart. For example, LoRA (ffn) improves LoRA (attn) by 1 R-2 points on XSum. We also highlight that prefix tuning does not keep improving when we further increase the capacity, which is also observed in Li & Liang (2021). These results suggest that FFN modification can utilize the added parameters more effectively than attention, no matter what the functional form or composition function is. We hypothesize that this is because the FFN learns task-specific textual patterns (Geva et al., 2021), while attention learns pairwise positional interactions which do not require large capacity for adapting to new tasks.
|
| 196 |
+
|
| 197 |
+
Is the story different when we use $0 . 1 \%$ parameters? In $\ S 3 . 1$ we reason that prefix tuning is more expressive than adapters (attn), which, however, is not reflected in Figure 5. We conjecture that this is because multi-head attention is only superior when the parameter budget is small. To validate this hypothesis, we compare prefix tuning to parallel adapters when they add $0 . 1 \%$ of the pretrained parameters. To ablate the impact of the composition function, we also report the results of removing the gating in prefix tuning as $h + \Delta h$ . We include the results of the multi-head parallel adapter variant (MH PA) described in $\ S 3 . 3$ . As shown in Table 4, the multi-head methods – prefix tuning and MH PA (attn) – outperform all others by at least 1.6 BLEU points when using $0 . 1 \%$ of the parameters. Surprisingly, reducing $l$ from 200 to 30 only causes 0.4 BLEU loss for prefix tuning while PA (attn) loses 1.9 points. The gating composition function in prefix tuning slightly helps the results by 0.3 points. We highlight that the MH parallel adapter improves the single-headed version by 1.6 points, which again verifies the effectiveness of the multi-head formulation.
|
| 198 |
+
|
| 199 |
+
Combining the results in Figure 5 and Table 4, we conclude that modifying head attention shows the best results when the parameter budget is very small, while the FFN can better utilize modifications at larger capacities. This suggests that it may be effective to allocate a larger parameter budget to FFN modification instead of treating attention and FFN equally as in Houlsby et al. (2019).
|
| 200 |
+
|
| 201 |
+
# 4.5 WHICH COMPOSITION FUNCTION?
|
| 202 |
+
|
| 203 |
+
We have presented three composition functions in $\ S 3 . 2$ : simple addition (adapter), gated addition (prefix tuning) and scaled addition (LoRA). As it is unnatural to incorporate the exact gated addition into methods whose functional form does not use softmax, we examine the other two by ablating on LoRA and comparing with the proposed scaled parallel adapter (Scaled PA), we constrain modified representation to be FFN since it is generally more effective as shown in $\ S 4 . 4$
|
| 204 |
+
|
| 205 |
+
Table 6: Comparison of various parameter-efficient tuning methods and the proposed variants. “†” are results copied from Lewis et al. (2020) and Liu et al. (2020b). We could not reproduce exactly the same full finetuning numbers with the same hyperparameters or even searching them. The reason may be the different libraries which the training code is based on – full fine-tuning is very sensitive to training hyperparameters. For the most performant methods we run with 3 random seeds and report mean and standard deviation.
|
| 206 |
+
|
| 207 |
+
<table><tr><td>Method</td><td># params</td><td>XSum (R-1/2/L)</td><td>MT (BLEU)</td></tr><tr><td>Full fine-tuning+</td><td>100%</td><td>45.14/22.27/37.25</td><td>37.7</td></tr><tr><td>Full fine-tuning (our run)</td><td>100%</td><td>44.81/21.94/36.83</td><td>37.3</td></tr><tr><td>Bitfit (Ben Zaken et al., 2021)</td><td>0.1%</td><td>40.64/17.32/32.19</td><td>26.4</td></tr><tr><td>Prompt tuning (Lester et al., 2021)</td><td>0.1%</td><td>38.91/15.98/30.83</td><td>21.0</td></tr><tr><td>Prefix tuning (Li& Liang,2021),l=200</td><td>3.6%</td><td>43.40/20.46/35.51</td><td>35.6</td></tr><tr><td>Pfeiffer adapter (Pfeiffer et al.,2021),r=600</td><td>7.2%</td><td>44.03/20.89/35.89±.13/.10/.08</td><td>36.9±.1</td></tr><tr><td>LoRA (ffn),r=102</td><td>7.2%</td><td>44.53/21.29/36.28±.14/.07/.10</td><td>36.8±.3</td></tr><tr><td>Parallel adapter (PA,ffn),r=1024</td><td>12.3%</td><td>44.71/21.41/36.41±.16/.17/.16</td><td>37.2±.1</td></tr><tr><td>PA (attn,r=30) + PA (ffn,r=512)</td><td>6.7%</td><td>44.29/21.06/36.12±.31/.19/.18</td><td>37.2±.1</td></tr><tr><td>Prefix tuning (attn,l=3O) + LoRA (ffn,r=102)</td><td>6.7%</td><td>44.84/21.71/36.77±.07/.05/.03</td><td>37.0±.1</td></tr><tr><td>MAM Adapter (our variant, l=30,r=512)</td><td>6.7%</td><td>45.06/21.90/36.87±.08/01/.04</td><td>37.5±.1</td></tr></table>
|
| 208 |
+
|
| 209 |
+
Table 5 reports the results on XSum. We set $r$ as 512 for adapters and 102 for LoRA so that their tuned parameter sizes are the same. We select $s$ based on the R-2 score on the dev set. We observe that LoRA $s = 4$ ) performs better than parallel adapter. However, the advantage disappears if we remove the scaling by setting $s ~ = ~ 1$ . Through plugging the composition function of LoRA into parallel adapter, the resulted Scaled PA improves the vanilla parallel adapter by 0.56 ROUGE-2 points. We also experiment with a learned scalar which does not give better results. Therefore, we conclude that the scaling composition function is better than the vanilla additive one while being easily applicable.
|
| 210 |
+
|
| 211 |
+
Table 5: Results on XSum when using different composition functions. The modified representation is FFN. The bottleneck dimension $\bar { r } = 5 1 2$ for (Scaled) PA and $r = 1 0 2$ for LoRA.
|
| 212 |
+
|
| 213 |
+
<table><tr><td>Method (# params)</td><td>XSum (R-1/2/LSum)</td></tr><tr><td>LoRA (6.1%), s=4</td><td>44.59/21.31/36.25</td></tr><tr><td>LoRA (6.1%), s=1</td><td>44.17/20.83/35.74</td></tr><tr><td>PA (6.1%)</td><td>44.35/20.98/35.98</td></tr><tr><td>Scaled PA (6.1%), s=4</td><td>44.85/21.54/36.58</td></tr><tr><td>Scaled PA(6.1%),trainable s</td><td>44.56/21.31/36.29</td></tr></table>
|
| 214 |
+
|
| 215 |
+
# 4.6 AN EFFECTIVE INTEGRATION BY TRANSFERRING FAVORABLE DESIGN ELEMENTS
|
| 216 |
+
|
| 217 |
+
We first highlight three findings in previous sections: (1) Scaled parallel adapter is the best variant to modify FFN; (2) FFN can better utilize modification at larger capacities; and (3) modifying head attentions like prefix tuning can achieve strong performance with only $0 . 1 \%$ parameters. Inspired by them, we mix and match the favorable designs behind these findings: specifically, we use prefix tuning with a small bottleneck dimension $\mathit { l } \ : = \ : 3 0 $ ) at the attention sub-layers and allocate more parameter budgets to modify FFN representation using the scaled parallel adapter $( r = 5 1 2$ ). Since prefix tuning can be viewed as a form of adapter in our unified framework, we name this variant as Mix-And-Match adapter (MAM Adapter). In Table 6, we compare MAM adapter with various parameter-efficient tuning methods. For completeness, we also present results of other combination versions in Table 6: using parallel adapters at both attention and FFN layers and combining prefix tuning (attn) with LoRA (ffn) – both of these combined versions can improve over their respective prototypes. However, MAM Adapter achieves the best performance on both tasks and is able to match the results of our full fine-tuning by only updating $6 . 7 \%$ of the pre-trained parameters. In Table 2, we present the results of MAM Adapter on MNLI and SST2 as well, where MAM Adapter achieves comparable results to full fine-tuning by adding only $0 . 5 \%$ of pretrained parameters.
|
| 218 |
+
|
| 219 |
+
# 5 DISCUSSION
|
| 220 |
+
|
| 221 |
+
We provide a unified framework for several performant parameter-tuning methods, which enables us to instantiate a more effective model that matches the performance of full fine-tuning method through transferring techniques across approaches. We hope our work can provide insights and guidance for future research on parameter-efficient tuning.
|
| 222 |
+
|
| 223 |
+
# ETHICS STATEMENT
|
| 224 |
+
|
| 225 |
+
Our work proposes a method for efficient fine-tuning of pre-trained models, in particular language models. Pre-trained language models have a wide variety of positive applications, such as the applications to summarization, translation, or language understanding described in our paper. At the same time, there are a number of ethical concerns with language models in general, including concerns regarding the generation of biased or discriminative text (Bordia & Bowman, 2019), the leakage of private information from training data (Carlini et al., 2020), and environmental impact of training or tuning them (Strubell et al., 2019).
|
| 226 |
+
|
| 227 |
+
Our method attempts to train language models making minimal changes to their pre-existing parameters. While it is an interesting research question whether parameter-efficient fine-tuning methods exacerbate, mitigate, or make little change to issues such as bias or information leakage, to our knowledge no previous work has examined this topic. It is an interesting avenue for future work.
|
| 228 |
+
|
| 229 |
+
With respect to environmental impact, the methods proposed in this paper add a small number of extra parameters and components to existing models, and thus they have a nominal negative impact on training and inference time – for example, the final MAM Adapter needs $1 0 0 \% - 1 5 0 \%$ training time of full fine-tuning in our four benchmarks since parameter-efficient tuning typically needs more epochs to converge; the inference time is roughly the same as the model obtained by full fine-tuning. On the other hand, as the methods proposed in this paper may obviate the need for full fine-tuning, this may also significantly reduce the cost (in terms of memory/deployed servers) of serving models. Notably, the great majority of the experimentation done for this paper was performed on a data center powered entirely by renewable energy.
|
| 230 |
+
|
| 231 |
+
# REPRODUCIBILITY STATEMENT
|
| 232 |
+
|
| 233 |
+
In addition to the setup description in $\ S 4 . 1$ , we have detailed the complete experiments setup such as batch size, optimizer, learning rates in Appendix A. Besides, we have publicized our source code. These resources should be sufficient to reproduce results of the paper.
|
| 234 |
+
|
| 235 |
+
# ACKNOWLEDGEMENT
|
| 236 |
+
|
| 237 |
+
We thank the anonymous reviewers for their comments. This work was supported in part by the CMU-Portugal MAIA Project, a Baidu PhD Fellowship for Junxian He, and a CMU Presidential Fellowship for Chunting Zhou.
|
| 238 |
+
|
| 239 |
+
# REFERENCES
|
| 240 |
+
|
| 241 |
+
Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
|
| 242 |
+
|
| 243 |
+
Elad Ben Zaken, Shauli Ravfogel, and Yoav Goldberg. Bitfit: Simple parameter-efficient fine-tuning for transformer-based masked language-models. arXiv e-prints, pp. arXiv–2106, 2021.
|
| 244 |
+
|
| 245 |
+
Ondˇrej Bojar, Rajen Chatterjee, Christian Federmann, Yvette Graham, Barry Haddow, Matthias Huck, Antonio Jimeno Yepes, Philipp Koehn, Varvara Logacheva, Christof Monz, et al. Findings of the 2016 conference on machine translation. In Proceedings of the First Conference on Machine Translation: Volume 2, Shared Task Papers, 2016.
|
| 246 |
+
|
| 247 |
+
Shikha Bordia and Samuel R. Bowman. Identifying and reducing gender bias in word-level language models. In Proceedings of the 2019 NAACL: Student Research Workshop, 2019.
|
| 248 |
+
|
| 249 |
+
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.
|
| 250 |
+
|
| 251 |
+
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.
|
| 252 |
+
|
| 253 |
+
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.
|
| 254 |
+
|
| 255 |
+
William Fedus, Barret Zoph, and Noam Shazeer. Switch transformers: Scaling to trillion parameter models with simple and efficient sparsity. arXiv preprint arXiv:2101.03961, 2021.
|
| 256 |
+
|
| 257 |
+
Mor Geva, Roei Schuster, Jonathan Berant, and Omer Levy. Transformer feed-forward layers are key-value memories. In Proceedings of EMNLP, 2021.
|
| 258 |
+
|
| 259 |
+
Demi Guo, Alexander M Rush, and Yoon Kim. Parameter-efficient transfer learning with diff pruning. In Proceedings of ACL, 2021.
|
| 260 |
+
|
| 261 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on imagenet classification. In Proceedings of ICCV, 2015.
|
| 262 |
+
|
| 263 |
+
Neil Houlsby, Andrei Giurgiu, Stanislaw Jastrzebski, Bruna Morrone, Quentin De Laroussilhe, Andrea Gesmundo, Mona Attariyan, and Sylvain Gelly. Parameter-efficient transfer learning for nlp. In Proceedings of ICML, 2019.
|
| 264 |
+
|
| 265 |
+
Edward J Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, and Weizhu Chen. LoRA: Low-rank adaptation of large language models. arXiv preprint arXiv:2106.09685, 2021.
|
| 266 |
+
|
| 267 |
+
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In Proceedings of ICLR, 2015.
|
| 268 |
+
|
| 269 |
+
Brian Lester, Rami Al-Rfou, and Noah Constant. The power of scale for parameter-efficient prompt tuning. In Proceedings of EMNLP, 2021.
|
| 270 |
+
|
| 271 |
+
Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. BART: Denoising sequence-to-sequence pretraining for natural language generation, translation, and comprehension. In Proceedings of ACL, 2020.
|
| 272 |
+
|
| 273 |
+
Xiang Lisa Li and Percy Liang. Prefix-tuning: Optimizing continuous prompts for generation. In Proceedings of ACL, 2021.
|
| 274 |
+
|
| 275 |
+
Chin-Yew Lin. ROUGE: A package for automatic evaluation of summaries. In Text Summarization Branches Out, 2004.
|
| 276 |
+
|
| 277 |
+
Pengfei Liu, Weizhe Yuan, Jinlan Fu, Zhengbao Jiang, Hiroaki Hayashi, and Graham Neubig. Pretrain, prompt, and predict: A systematic survey of prompting methods in natural language processing. arXiv preprint arXiv:2107.13586, 2021a.
|
| 278 |
+
|
| 279 |
+
Xiao Liu, Yanan Zheng, Zhengxiao Du, Ming Ding, Yujie Qian, Zhilin Yang, and Jie Tang. GPT understands, too. arXiv:2103.10385, 2021b.
|
| 280 |
+
|
| 281 |
+
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.
|
| 282 |
+
|
| 283 |
+
Yinhan Liu, Jiatao Gu, Naman Goyal, Xian Li, Sergey Edunov, Marjan Ghazvininejad, Mike Lewis, and Luke Zettlemoyer. Multilingual denoising pre-training for neural machine translation. Transactions of the Association for Computational Linguistics, 2020a.
|
| 284 |
+
|
| 285 |
+
Yinhan Liu, Jiatao Gu, Naman Goyal, Xian Li, Sergey Edunov, Marjan Ghazvininejad, Mike Lewis, and Luke Zettlemoyer. Multilingual denoising pre-training for neural machine translation. Transactions of the Association for Computational Linguistics, 8:726–742, 2020b. doi: 10.1162/tacl a 00343. URL https://aclanthology.org/2020.tacl-1.47.
|
| 286 |
+
|
| 287 |
+
Rabeeh Karimi Mahabadi, James Henderson, and Sebastian Ruder. Compacter: Efficient low-rank hypercomplex adapter layers. In Proceedings of NeurIPS, 2021.
|
| 288 |
+
|
| 289 |
+
Shashi Narayan, Shay B. Cohen, and Mirella Lapata. Don’t give me the details, just the summary! Topic-aware convolutional neural networks for extreme summarization. In Proceedings of EMNLP, 2018.
|
| 290 |
+
|
| 291 |
+
Jekaterina Novikova, Ondˇrej Dusek, and Verena Rieser. The E2E dataset: New challenges for ˇ end-to-end generation. In Proceedings of the 18th Annual SIGdial Meeting on Discourse and Dialogue, pp. 201–206, Saarbrucken, Germany, August 2017. doi: 10.18653/v1/W17-5525. ¨
|
| 292 |
+
|
| 293 |
+
Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for automatic evaluation of machine translation. In Proceedings of ACL, 2002.
|
| 294 |
+
|
| 295 |
+
Matthew E Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. Deep contextualized word representations. In Proceedings of NAACL, 2018.
|
| 296 |
+
|
| 297 |
+
Jonas Pfeiffer, Aishwarya Kamath, Andreas Ruckl ¨ e, Kyunghyun Cho, and Iryna Gurevych. Adapter- ´ Fusion: Non-destructive task composition for transfer learning. In Proceedings of EACL, 2021.
|
| 298 |
+
|
| 299 |
+
Xipeng Qiu, Tianxiang Sun, Yige Xu, Yunfan Shao, Ning Dai, and Xuanjing Huang. Pre-trained models for natural language processing: A survey. Science China Technological Sciences, 2020.
|
| 300 |
+
|
| 301 |
+
Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. Language models are unsupervised multitask learners. OpenAI blog, 2019.
|
| 302 |
+
|
| 303 |
+
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, 2020.
|
| 304 |
+
|
| 305 |
+
Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew $\mathrm { ~ Y ~ N ~ g ~ } _ { }$ and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of EMNLP, 2013.
|
| 306 |
+
|
| 307 |
+
Emma Strubell, Ananya Ganesh, and Andrew McCallum. Energy and policy considerations for deep learning in NLP. In Proceedings of ACL, 2019.
|
| 308 |
+
|
| 309 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Proceedings of NeurIPS, 2017.
|
| 310 |
+
|
| 311 |
+
Adina Williams, Nikita Nangia, and Samuel Bowman. A broad-coverage challenge corpus for sentence understanding through inference. In Proceedings of NAACL, 2018.
|
| 312 |
+
|
| 313 |
+
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 EMNLP: System Demonstrations, 2020.
|
| 314 |
+
|
| 315 |
+
Yaoming Zhu, Jiangtao Feng, Chengqi Zhao, Mingxuan Wang, and Lei Li. Serial or parallel? plugable adapter for multilingual machine translation. arXiv preprint arXiv:2104.08154, 2021.
|
| 316 |
+
|
| 317 |
+
# A EXPERIMENTS
|
| 318 |
+
|
| 319 |
+
A.1 SETUPS
|
| 320 |
+
|
| 321 |
+
Table 7: Dataset Statistics of the four tasks.
|
| 322 |
+
|
| 323 |
+
<table><tr><td>Dataset</td><td>#train</td><td>#dev</td><td>#test</td></tr><tr><td>XSum</td><td>204,045</td><td>113,332</td><td>113,334</td></tr><tr><td>WMT16 en-ro</td><td>610,320</td><td>1,999</td><td>1,999</td></tr><tr><td>MNLI</td><td>392,702</td><td>9815</td><td>9832</td></tr><tr><td>SST-2</td><td>67,349</td><td>872</td><td>1,821</td></tr></table>
|
| 324 |
+
|
| 325 |
+
We implement all the parameter-efficient tuning methods using the huggingface transformers library (Wolf et al., 2020). We use BARTLARGE(Lewis et al., 2020) and mBARTLARGE (Liu et al., 2020b) (mBART-cc25) for the summarization and machine translation tasks respectively, and we use RoBERTaBASE (Liu et al., 2019) for MNLI and SST2. BARTLARGE and mBARTLARGE have the same encoder-decoder architectures. mBARTLARGE is pre-trained on 25 languages. We use their public checkpoints from the transformers library in experiments. For MT and classifications tasks, the max token lengths of training data are set to be 150 and 512 respectively. For XSum, we set the max length of source articles to be 512 and the max length of the target summary to be 128. The detailed dataset statistics is present in Table 7. In our summarization experiments, we only use 1600 examples for validation to save time.
|
| 326 |
+
|
| 327 |
+
While we vary the bottleneck dimension within $\{ 1 , 3 0 , 5 1 2 , 1 0 2 4 \}$ as mentioned in $\ S 4 . 1$ , we test bottleneck dimension 1024 only when the modified representation is FFN, because the training of prefix tuning does not fit into 48GB GPU memory when $l = 1 0 2 4$ . While other methods do not have memory issues, we keep the bottleneck dimension of attention modification at most 512 to have a relatively fair comparison with prefix tuning. For LoRA we always tune its scaling hyperparameters $s$ on the dev set.
|
| 328 |
+
|
| 329 |
+
# A.2 TRAINING AND EVALUATION
|
| 330 |
+
|
| 331 |
+
We present some training hyperparameters of parameter-efficient tuning methods in Table 8. For all the tasks, we train with the Adam optimizer (Kingma & Ba, 2015), and use a polynomial learning rate scheduler that linearly decays the learning rate throughout training. We set the warm up steps of learning rate to be 0 for both MT and summarization tasks, and for the classification tasks, learning rate is linearly warmed up from 0 for the first $6 \%$ of the total training steps before decay. For full fine-tuning we set these training hyperparameters following Lewis et al. (2020) (XSum), Liu et al. (2020b) (en-ro), and (Liu et al., 2019) (MNLI and SST2). We also did hyperparameter search in the full fine-tuning case to try to reproduce their results. We set dropout rate to be 0.1 for all the tasks. We use ROUGE-2 and perplexity as the validation metrics for summarization and MT respectively.
|
| 332 |
+
|
| 333 |
+
For MT and text summarization, we use beam search for decoding and set the number of beams to be 6 and 5 following previous work (Li & Liang, 2021; Liu et al., 2020b). The min and max generation lengths for summarization and MT are set to be (10, 60) and (1, 200) respectively.
|
| 334 |
+
|
| 335 |
+
# A.3 OTHER EXPERIMENTAL DETAILS
|
| 336 |
+
|
| 337 |
+
Prefix Tuning: Following Li & Liang (2021), we reparameterize the prefix vectors by a MLP network which is composed of a small embedding matrix and a large feedforward neural network. This is conducive for learning due to the shared parameters across all layers.
|
| 338 |
+
|
| 339 |
+
LoRA: LoRA and adapter employ different parameter initialization methods: LoRA uses a random Kaiming uniform (He et al., 2015) initialization for $W _ { \mathrm { d o w n } }$ and zero for $W _ { \mathrm { u p } }$ (LoRA init), while adapters use the same initialization as BERT (Devlin et al., 2019). We found it beneficial to use the same initialization method as LoRA in scaled PA.
|
| 340 |
+
|
| 341 |
+
Table 8: Training hyperparameters of parameter-efficient tuning methods on the four tasks. lr and ls represents learning rate and label smoothing respectively.
|
| 342 |
+
|
| 343 |
+
<table><tr><td>Tasks</td><td>lr</td><td>batch size</td><td>ls</td><td> max grad norm</td><td> weight decay</td><td> train steps</td></tr><tr><td>XSum</td><td>5e-5</td><td>64 sents</td><td>0.1</td><td>0.1</td><td>0.01</td><td>100K</td></tr><tr><td>enro MT</td><td>5e-5</td><td>16384 tokens</td><td>0.1</td><td>1.0</td><td>0.01</td><td>50K</td></tr><tr><td>MNLI/SST2</td><td>1e-4</td><td>32 sents</td><td>0</td><td>1.0</td><td>0.1</td><td>10 epochs</td></tr></table>
|
| 344 |
+
|
| 345 |
+
# B COMPUTATION OF TUNABLE PARAMETERS
|
| 346 |
+
|
| 347 |
+
Table 9: Number of attention or FFN sublayers in each layer of the pre-trained models.
|
| 348 |
+
|
| 349 |
+
<table><tr><td>BART/mBARTLARGE RoBERTaBASE</td><td></td></tr><tr><td>Nattn</td><td></td></tr><tr><td>Nfn</td><td>1</td></tr></table>
|
| 350 |
+
|
| 351 |
+
Table 10: Number of parameters used at each sub-layer for different methods.
|
| 352 |
+
|
| 353 |
+
<table><tr><td></td><td>Nattn</td><td>N</td></tr><tr><td>Prefix Tuning</td><td>2ld</td><td>一</td></tr><tr><td>Adapter variants</td><td>2rd</td><td>2rd</td></tr><tr><td>LoRA</td><td></td><td>2 × 2rd=4rd 2×(rd+4dr)=10rd</td></tr></table>
|
| 354 |
+
|
| 355 |
+
We compute the number of tunable parameters based on where the tunable module is inserted into and how it is parameterized. The pretrained-models for summarization or MT have an encoderdecoder structure and each has $L$ layers, whereas RoBERTaBASE for classification tasks only has $L$ encoder layers. To simplify the computation of tunable parameters, we compute the sum of parameter used in one encoder layer and one decoder layer as the parameter overhead of one single layer of the pre-trained encoder-decoder model. Each layer has $N _ { \mathrm { a t t n } }$ sub-layers and $N _ { \mathrm { { f f n } } }$ sublayers. For the encoder-decoder models, $N _ { \mathrm { a t t n } } = 3$ : the encoder self-attention, the decoder selfattention and the decoder cross-attention. For the classification tasks, $\mathtt { R o B E R T a } _ { \mathtt { B A S E } }$ only has the encoder self-attention, thus $N _ { \mathrm { a t t n } } ~ = ~ 1$ . We present the number of attention and ffn sub-layers for different pre-trained models in Table 10. For modifications applied at the attention sub-layers, the number of tunable parameters is computed by $| \Theta | _ { \mathrm { a t t n } } = \bar { N } _ { \mathrm { W } } ^ { \mathrm { a t t n } } \times N _ { \mathrm { a t t n } } \times L$ , where $N _ { \mathrm { W } } ^ { \mathrm { a t t n } }$ denotes the number of parameters $W _ { \mathrm { d o w n } }$ or $W _ { \mathrm { u p , } }$ ) used for one attention sub-layer. Similarly, the number of tunable parameters for the FFN sub-layers is computed by $\vert \Theta \vert _ { \mathrm { f f n } } = N _ { \mathrm { W } } ^ { \mathrm { f f n } } \times N _ { \mathrm { f f n } } \times$ $L$ . In Table 10, we show the number of parameters for one sub-layer. As we have explained in $\ S 4 . 4$ , LoRA approximates the update of each weight matrix with a pair of $W _ { \mathrm { d o w n } }$ and $W _ { \mathrm { u p } }$ , thus LoRA typically uses more parameters with the same $r$ as other methods. Finally, the total number of tunable parameters for prefix tuning, adapter variants and LoRA is $| \Theta | = | \Theta | _ { \mathrm { a t t n } } + | \Theta | _ { \mathrm { f n } }$ as applicable. Prompt tuning prepends $l$ tunable vectors at the input layer and uses $l \times d$ number of parameters. Using MBART/BART as an example, we present the number of parameters used by several representative methods throughout our paper in Table 11, where adapter variants include sequential adapter, parallel adapter, scaled adapter and multi-head adapter.
|
| 356 |
+
|
| 357 |
+
Table 11: Number of tunable parameters of various parameter-efficient tuning methods with BART/MBART models $L = 1 2$ ) as an example.
|
| 358 |
+
|
| 359 |
+
<table><tr><td>Method</td><td>number of parameters</td></tr><tr><td>Prompt Tuning</td><td>lxd</td></tr><tr><td>Prefix Tuning (attn)</td><td>2ld×3×12</td></tr><tr><td>Adapter variants (attn)</td><td>2rd×3×12</td></tr><tr><td>Adapter variants (ffn)</td><td>2rd ×2×12</td></tr><tr><td>LoRA (attn)</td><td>4rd×3×12</td></tr><tr><td>LoRA (ffn)</td><td>10rd ×2×12</td></tr><tr><td>MAM Adapter (our proposed model)</td><td>)2ld×3×12+2rd×2×12</td></tr></table>
|
| 360 |
+
|
| 361 |
+
# C FULL RESULTS ON DIFFERENT BOTTLENECK DIMENSIONS
|
| 362 |
+
|
| 363 |
+
Table 12: Performance on the test sets of abstractive summarization (XSum) and WMT EN-RO translation.
|
| 364 |
+
|
| 365 |
+
<table><tr><td>Method</td><td># params (%) XSum (R-1/2/L)</td><td>MTBLEU</td></tr><tr><td colspan="3">Modified Representation: : attention</td></tr><tr><td>Prefix Tuning,r = 200</td><td>3.6 43.40/20.46/35.51 9.2</td><td>35.6</td></tr><tr><td>Prefix Tuning,r = 512</td><td>43.29/20.40/35.37</td><td>35.1</td></tr><tr><td>LoRA,r= 200</td><td>43.09/20.29/35.37</td><td>36.2</td></tr><tr><td>Sequential Adapter,r = 200</td><td>42.01/19.30/34.40</td><td>35.3</td></tr><tr><td>Sequential Adapter,r = 512</td><td>41.05/18.87/33.71</td><td>34.7</td></tr><tr><td>Parallel Adapter,r = 200</td><td>43.58/20.31/35.34</td><td>35.6</td></tr><tr><td>Parallel Adapter,r = 512</td><td>43.99/20.83/35.77</td><td>36.2</td></tr><tr><td colspan="3">Modified Representation: FFN</td></tr><tr><td>LoRA,r = 102</td><td>44.59/21.31/36.25</td><td>36.5</td></tr><tr><td>Sequential Adapter,r = 200</td><td>2.4 43.21/19.98/35.08</td><td>35.6</td></tr><tr><td>Sequential Adapter,r = 512</td><td>6.1 43.72/20.75/35.64</td><td>36.3</td></tr><tr><td>Sequential Adapter,r = 1024</td><td>12.3 43.95/21.00/35.90</td><td>36.7</td></tr><tr><td>Parallel Adapter,r = 200</td><td>2.4 43.93/20.66/35.63</td><td>36.4</td></tr><tr><td>Parallel Adapter,r = 512</td><td>6.1 44.35/20.98/35.98</td><td>37.1</td></tr><tr><td>Parallel Adapter,r = 1024</td><td>12.3 44.53/21.24/36.23</td><td>37.3</td></tr></table>
|
md/dev/3uwj8QZROL/3uwj8QZROL.md
ADDED
|
@@ -0,0 +1,261 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Scaling Up and Distilling Down: Language-Guided Robot Skill Acquisition
|
| 2 |
+
|
| 3 |
+
Huy $\mathrm { H a } ^ { 1 }$ , Pete Florence2, and Shuran Song1
|
| 4 |
+
|
| 5 |
+
1Columbia University
|
| 6 |
+
2Google DeepMind
|
| 7 |
+
|
| 8 |
+
Abstract: We present a framework for robot skill acquisition, which 1) efficiently scale up data generation of language-labelled robot data and 2) effectively distills this data down into a robust multi-task language-conditioned visuo-motor policy. For (1), we use a large language model (LLM) to guide high-level planning, and sampling-based robot planners (e.g. motion or grasp samplers) for generating diverse and rich manipulation trajectories. To robustify this data-collection process, the LLM also infers a code-snippet for the success condition of each task, simultaneously enabling the data-collection process to detect failure and retry as well as the automatic labeling of trajectories with success/failure. For (2), we extend the diffusion policy single-task behavior-cloning approach to multi-task settings with language conditioning. Finally, we propose a new multi-task benchmark with 18 tasks across five domains to test long-horizon behavior, common-sense reasoning, tool-use, and intuitive physics. We find that our distilled policy successfully learned the robust retrying behavior in its data collection procedure, while improving absolute success rates by $3 \mathrm { { \bar { 3 } } . 2 \mathrm { { \bar { \% } } } }$ on average across five domains. All code, data, and qualitative policy results are available at our project website.
|
| 9 |
+
|
| 10 |
+

|
| 11 |
+
Figure 1: Language-guided Skill Acquisition enables scalable robot learning. In the data generation stage, a LLM takes as input task descriptions (a) and uses sampling-based robotic planners and privileged simulation information (b) to perform task-directed exploration. This enables the scaling up of language and task-success labeled dataset generation (c). In the second stage, the dataset is filtered for success and distilled down into a closed-loop language-conditioned visuomotor policy for real world deployment (d).
|
| 12 |
+
|
| 13 |
+
# 1 Introduction
|
| 14 |
+
|
| 15 |
+
How can we scalably acquire robust, reusable, real-world manipulation skills? This question has been the driving force behind extensive research in robot learning. Attempts in the field have focused on two primary aspects: First, how to scale up the data collection for a diverse range of manipulation skills, which involves efforts such as improving the hardware [1, 2] and software [3, 4] which support demonstration collection, utilization of non-robotics datasets [5, 6], or trial-and-error explorations [7]. The second aspect of this question concerns effective learning from the collected data, which delves into exploring effective action representations [8–10] and policy formulations [11, 12] that can robustly model the training data and generalize to novel scenarios.
|
| 16 |
+
|
| 17 |
+
This paper proposes a new framework that provides a comprehensive solution for both aspects by leveraging language guidance, while using no expert demonstrations or reward specification/engineering. We contribute two key components with our framework:
|
| 18 |
+
|
| 19 |
+
• Scaling Up Language-Guided Data Generation: Our data-collection policy is a large language model (LLM) which has access to a suite of 6DoF exploration primitives (i.e., sampling-based robot planners and utilities). Given an input task description, this policy first simplifies the task by recursively decomposing it into subtasks, resulting in a hierarchical plan (i.e., task tree). Next, this plan is grounded into a sequence of 6DoF exploration primitives, which generates diverse robot trajectories for the task. Finally, the data collection policy verifies the trajectories’ success with an inferred success function and retries the task until it succeeds. This verify & retry step not only improves the data-collection policy’s success, but also adds robot experience on how to recover from failure, an important trait for downstream policy distillation. This data generation approach is scalable, enabling significantly more efficient autonomous task-directed exploration than unguided alternatives (i.e., reinforcement learning) while not being limited by the lack of low-level understanding of the LLM-only solution.
|
| 20 |
+
|
| 21 |
+
• Distilling Down to Language-Conditioned Visuomotor Policy: We distill these robot experiences into a visuo-linguo-motor policy that infers control sequences from visual observations and a natural language task description. To enable effective learning of high entropy, diverse robot trajectories, we extend the diffusion policy [12] to handle language-based conditioning for multi-task learning. This allows the learned policy to be reused and recomposed through language-based planners. We found that our distilled policy successfully learned the robust retrying behavior from its data collection policy, while improving upon its absolute success rate across five domains by $3 3 . 2 \%$ . Further, we demonstrate that our policy directly transfers to the real-world without fine-tuning using domain randomization.
|
| 22 |
+
|
| 23 |
+
Our framework combines these two components to get the best of both worlds – leverage LLM’s common-sense reasoning abilities for efficient exploration while learning robust and re-usable 6DoF skills for real-world deployment. In summary, the key contribution of this paper is a new framework for visuo-linguo-motor policy learning that is enabled by three novel components:
|
| 24 |
+
|
| 25 |
+
• A new language-guided data collection framework that combines language-based task planner with 6DoF robot utilities (e.g. motion planning, grasp sampling).
|
| 26 |
+
• New formulation of diffusion-based policy that effectively learns multi-task language-conditioned closed-loop control policies.
|
| 27 |
+
• In addition to our algorithmic contributions, we also contribute a new multi-task benchmark that includes 18 tasks across five domains, requiring long-horizon $\approx 8 0 0$ control cycles), common sense, tool-use, and intuitive physics understanding – capabilities lacking in existing manipulation benchmarks.
|
| 28 |
+
|
| 29 |
+
# 2 Related Works
|
| 30 |
+
|
| 31 |
+
Scaling visuo-linguo-motor data. In learning vision-and-language-conditioned motor policies for real-world deployment [9, 10, 13–18], one of the most important questions is how to scale up “robot-complete data” – data that has robot sensory inputs (e.g. vision), action labels (e.g. target end-effector & gripper commands), and task labels (e.g. language description, success). The most prevalent paradigm is to use humans to annotate both actions (e.g. teleoperation) and language [9, 10, 13–18]. When providing action labels, humans can either provide task-specific [9, 10, 15, 18], or task-agnostic (“play”) data [13, 14, 16, 19]. A primary limitation, however, is that data scalability is human-limited.
|
| 32 |
+
|
| 33 |
+
Other prior works have proposed strategies to enable more-autonomously-scalable data. To scale language annotation, prior works study using visual-language models [20, 21], or procedurally post-hoc provided in simulation [19]. To scale action labels, methods study how to use autonomous sub-optimal policies from random [7] to learned [22] policies. Human egocentric videos [6, 23, 24] has also been shown to be relevant to robot learning [5, 25], but is not robot-complete (lacks action labels), and requires cross-embodiment transfer. Towards unsupervised exploration, prior works have also investigated evolving environments [26, 27] and embodiments [28], automatic task generation [29], leveraging language guidance [30, 31] and world-model error [32], but have not been demonstrated to scale to 6 DoF robotic skill learning. While these approaches reduce human efforts, they are still limited in optimality, generality, and/or completeness of robot data labels.
|
| 34 |
+
|
| 35 |
+
Another option for the autonomous data collection policy is to use a model-based policy, e.g. task and motion planning (TAMP) [33]. Our approach extends such methods in terms of flexibility and task generality by leveraging LLM’s common-sense knowledge. However, in contrast to recent works which use LLMs as the final policy [34–40], we use the LLM-based planner as a suboptimal data-collection policy. We then distill only successful trajectories into an observable-information [41–43] policy, allowing the distilled policy to improve upon its LLM data collection policy’s performance.
|
| 36 |
+
|
| 37 |
+
Policy Representations and Multi-task Policy Distillation. One primary question in visuo-motor learning [44] has been how to represent the policy for effective learning, i.e. to enable high precision, multi-modal robot behavior [2, 11, 12, 45, 46]. Another related question has been how to best train multi-task policies [47, 48], including those conditioned on language [9, 10, 13, 15, 16, 18]. Our work presents the novel formulation of bringing diffusion-based [49, 50] policies [12] into the language-conditioned [51, 52] visuomotor domain. Additionally, prior works in multi-task language-conditioning typically focus on cloning policies from experts, meanwhile we study distilling data from a success-filtered suboptimal policy. Success-filtering [11, 53] can be viewed as the simplest form of offline RL [54].
|
| 38 |
+
|
| 39 |
+

|
| 40 |
+
Figure 2: Benchmark. We validate our approach on a new multi-task benchmark addressing challenging long-horizon tasks (i.e., 800 control cycles) requiring language understanding (e.g., put [object] to [top] drawer), common sense knowledge (e.g., send a package for return requires raising the mailbox flag), tool-use (e.g., catapult), and intuitive physics (e.g., balance the bus). The tasks are best viewed on our our project website.
|
| 41 |
+
|
| 42 |
+
# 3 Approach
|
| 43 |
+
|
| 44 |
+
We propose a new framework for robot learning that performs automatic data collection and policy learning from only a task description. Our design is grounded on four key observations:
|
| 45 |
+
|
| 46 |
+
• We recognize the importance of random exploration in reinforcement learning, but aim to not be constrained by its inefficiency for long-horizon, sparse reward tasks.
|
| 47 |
+
• We acknowledge the usefulness of LLM’s common-sense and zero-shot capabilities, but believe language is not by itself the ideal representation for robust, rich, and precise robotic manipulation.
|
| 48 |
+
• We are inspired by the effectiveness of robotic planning methods, e.g. TAMP, but wish to be flexible to novel tasks and domains and non-reliant on ground truth state during policy inference.
|
| 49 |
+
• We aim to achieve the simplicity and effectiveness of behavior cloning in distilling collected robot experience into a policy for real-world deployment, while side-stepping the requirement for costly human demonstrations or play data collection.
|
| 50 |
+
|
| 51 |
+
Using no human demonstration or manually specified reward, our framework combines the strengths of these four areas into a unified framework for both efficient task-directed exploration and multi-task visuo-linguo-motor policy learning.
|
| 52 |
+
|
| 53 |
+
Method Overview. In the data generation phase, we use an LLM to recursively decompose (§3.1) tasks into a hierachical plan (i.e., task tree) for exploration and ground the plan into sampling-based robot utilities and motion primitives (§3.2). Next, the LLM infers success-detection functions for each task in the plan (§3.3), providing success-labeling. This autonomous data generation process outputs a replay buffer of task-directed exploration experience, labeled with language descriptions and success labels. In the training phase (§3.4), we filter this data for success according to the LLM inferred success condition and distill it into a multi-task vision-and-language-conditioned diffusion policy [12].
|
| 54 |
+
|
| 55 |
+
# 3.1 Simplify: Task Planning and Decomposition
|
| 56 |
+
|
| 57 |
+
Given a task description, the first step is to generate a high-level task plan. To improve the flexibility to work with any tasks and 3D assets, we opted for an LLM-based planner to leverage their common-sense and zero-shot reasoning skills. Unlike classical TAMP planners, our framework does not require domain-specific engineering and transition function design to work with new tasks.
|
| 58 |
+
|
| 59 |
+
Concretely, our recursive LLM planner takes as input the task description, the simulation state, and outputs a plan in the form of a task tree (Fig. 3a). To do so, the LLM first checks whether the task description involves the robot interacting with multiple or only one object. For instance, “move the package into the mailbox” involves opening the mailbox before picking up the package and putting the mailbox in, and should be considered a multi-object task. Meanwhile, “with the mailbox opened, move the package into the mailbox” should be a single-object task. For the base case of single-object tasks, we prompt the LLM to which object part name to to interact. For the case of multi-object tasks, we prompt the LLM to decompose the task into subtasks, and recurse down each subtask.
|
| 60 |
+
|
| 61 |
+

|
| 62 |
+
Figure 3: Language-Driven Robot Data Generation takes as input the task description and simulation state, and outputs a replay buffer, labelled with language descriptions and success. It starts by using an LLM to simplify tasks recursively (a) until the task involves only one object, resulting in a hierarchical exploration plan. Next, the plan is grounded (b) into a sequence of 6 DOF exploration primitives (e.g. grasp samplers, motion planners, etc.) and rolled out in simulation to give an unlabelled robot trajectory. Finally, an LLM infers a success function code-snippet, and uses it to verify (c) and label it with succeeded or failed. If the trajectory failed, the LLM retries the exploration plan with a different random seed (e.g. a different grasp pose from the grasp sampler). If the robot succeeds or run out of time, the labeled trajectory is returned.
|
| 63 |
+
|
| 64 |
+
# 3.2 Ground: Compiling a Plan into Robot Utilities
|
| 65 |
+
|
| 66 |
+
With the generated task tree $\ S 3 . 1$ , the next step is to ground the high-level plan into physical actions. Here, the choice of the low-level robot $A P I$ critically defines the system’s capability and, therefore, becomes a key differentiating factor between different systems. In principle, there are three desired properties we want to see in the action space design:
|
| 67 |
+
|
| 68 |
+
• Flexibility. Planar actions [10, 37] aren’t flexible enough to manipulate prismatic and revolute joints.
|
| 69 |
+
• Scalable. Namely, actions should not require human demonstrations to acquire [9, 10, 13–16, 35].
|
| 70 |
+
• Language-friendly. While joint sequences can encode any action, it is not language-friendly.
|
| 71 |
+
|
| 72 |
+
We propose to ground the LLM’s plan with API calls into a set of robot utility functions, which include a sampling-based motion planner, a geometry-based grasp and placement sampler, and motion primitives for articulated manipulation. We refer to these utilities as 6 DOF Exploration Primitives (Fig 3b) because, by virtue of being pseudo-random, the sampling-based utilities generate diverse robot trajectories, enabling effective exploration for rich 6 DoF manipulation settings. For instance, our grasp and placement samplers samples uniformly amongst all points in the object part’s point cloud to find good grasps and placements poses, respectively, which are used as input into a rapidly-exploring random trees [55] motion planner that samples uniformly in joint space. This results in diverse grasps, placements, and motion trajectories connecting grasps and placements.
|
| 73 |
+
|
| 74 |
+
For each leaf node in the inferred task tree (§ 3.1), the grounding process takes as input the node’s task description (e.g. “open the mailbox”), its associated object part name (e.g. “mailbox lid”), and the simulation state, and outputs a sequence of 6 DoF Exploration Primitive API calls. Using the object part name, we can parse the object’s kinematic structure from the simulation state and handle articulated and non-articulated (i.e., rigid, deformable) objects separately. For non-articulated objects, the LLM is prompted to choose the pick & place object names, used to sample grasp and placement pose candidates. For articulated objects (with either revolute or prismatic joints), the leaf node’s associated object part name is used to sample a grasp candidate followed by a rotation or translation primitive conditioned on its joint parameters (i.e., joint type, axis, and origin).
|
| 75 |
+
|
| 76 |
+
Exploration Plan Rollout. Each node in the exploration plan is grounded only when it is being executed, where the order of execution follows a pre-order tree traversal. By keeping track of the subtask’s state, sub-segments of robot trajectory can be labelled with the subtask’s description, thereby providing dense and automatic text labels for the trajectory. For instance, all actions taken during the inferred subtask “open the mailbox” can be labeled with both the subtask’s description “open the mailbox” and the root task description “move the package into the mailbox”.
|
| 77 |
+
|
| 78 |
+
Since grounding happens only when a task node is visited, each node’s grounding process is independent of the other leaf nodes, depending only on the simulation state when it is evaluated. While this simplifies planning significantly, it also means that failed execution can occur. For instance, a grasp candidate may render all placement candidates infeasible.
|
| 79 |
+
|
| 80 |
+
# 3.3 Verify & Retry: Robustifying the Data Collection Policy
|
| 81 |
+
|
| 82 |
+
Recall, the planning and grounding step can fail, especially when we consider long-horizon tasks. To address this, we propose a verify & retry (Fig. 3c) scheme, which uses environment feedback to detect failed execution.
|
| 83 |
+
|
| 84 |
+
Verify. For each task, the LLM infers a success function code snippet given the task description, simulation state, and API functions to for query simulation state (e.g., checking contact or joint values, etc). This amounts to prompting the LLM to complete a task success function definition that outputs a boolean value, indicating task success. For instance, given the task “raise the mailbox flag”, the LLM’s inferred code snippet should check whether the mailbox’s flag hinge is raised (Fig. 3c, highlighted green).
|
| 85 |
+
|
| 86 |
+
Retry. When a trajectory is labeled failed, the robot retries the same sequence of robot utilities with a different random seed (i.e., for the sampling-based robotic utilities) without resetting the simulation state until the task succeeds. For instance, in the bus balance task (Fig. 2, top left), the robot would repeatedly try different grasp and place candidates until the bus is balanced. In the tree traversal process $\ S 3 . 2$ , nodes only yield execution to its parent task when the node’s inferred success condition returns true. This design not only leads to higher success rates in data generation but also provides useful demonstrations on how to recover from failure. In the output replay buffer, the only failed trajectories are ones which timed-out or led to invalid states (e.g. object dropped on the floor).
|
| 87 |
+
|
| 88 |
+
# 3.4 Language-conditioned Policy Distillation
|
| 89 |
+
|
| 90 |
+
We extend diffusion policy [12], a state-of-the-art approach for single-task behavior cloning, to the multitask domain by adding language-conditioning. This policy takes as input a task description CLIP [56] feature, proprioception history, and visual observations, and outputs a sequence of end effector control commands. Following Robomimic [4]’s findings, we use a wrist-mounted view in addition to a global (workspace) view to help with tasks requiring precise manipulation. We use their ResNet18-based [57] vision encoders, one for each view. We found that
|
| 91 |
+
|
| 92 |
+

|
| 93 |
+
Figure 4: Language-Conditioned Policy Distillation. The policy takes as input a task description, two RGB camera views, and gripper proprioception data, and outputs a sequence of gripper poses and closing command.
|
| 94 |
+
|
| 95 |
+
using only the latest visual observation along with the full observation horizon of proprioception maintains the policy’s high performance while reducing training time. When used in conjunction with the DDIM [58] noise scheduler, we found that we could use a $1 0 \times$ shorter diffusion process at inference (5 timesteps at inference, 50 timesteps at training) while retaining a comparable performance. Quantitatively, when using a 10 dimensional action space\*, our policy can be run at ${ \approx } 3 5 H z$ on an NVIDIA RTX3080.
|
| 96 |
+
|
| 97 |
+
# 4 Evaluation
|
| 98 |
+
|
| 99 |
+
Our experiments try to validate two questions: 1) Can our data generation approach efficiently perform task-directed exploration? 2) Can our policy learning approach effectively distill a multi-modal, multi-task dataset into a generalizable and robust visuo-linguo-motor policy?
|
| 100 |
+
|
| 101 |
+
Table 1: Benchmark Suite.
|
| 102 |
+
|
| 103 |
+
<table><tr><td>Domain</td><td>Complex Artic- Common Tool Multi- Long geometry ulation</td><td></td><td>1sense </td><td></td><td>use task horizon</td><td></td></tr><tr><td>Balance</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Catapult</td><td>xx</td><td>×</td><td>×</td><td>×</td><td>×</td><td>xxx</td></tr><tr><td>Transport</td><td></td><td>×</td><td>×</td><td>×</td><td>X</td><td></td></tr><tr><td>Mailbox</td><td></td><td></td><td></td><td>X</td><td>X</td><td></td></tr><tr><td>Drawer</td><td></td><td></td><td>X</td><td>X</td><td></td><td></td></tr></table>
|
| 104 |
+
|
| 105 |
+
Our Benchmark contains 18 tasks across 5 domains (Fig. 2 Tab. 1), with the following properties:
|
| 106 |
+
|
| 107 |
+
• 6DoF & articulated manipulation, for deadling with complex object geometry and articulation.
|
| 108 |
+
• Geometry Generalization. In our bin transport domain, the robot must generalize its bin transport skill to unseen object instances, with novel shapes, sizes, and colors.
|
| 109 |
+
• Intuitive physics. Robots should understand the physical properties of the world and use this knowledge to perform tasks. In the bus balance domain, the robot needs to learn the precise grasping and placement to balance a large bus toy on a small block. In the catapult domain, where the block is placed along a catapult arm determines how far the block will be launched, and, thus, which bin (if any) the block will land in.
|
| 110 |
+
• Common-sense reasoning & Tool-use. Natural language task description is user-friendly but often under-specifies the task. Common-sense can help to fill in the gaps. In the mailbox domain, given the task “send the package for return”, the robot should understand that it not only needs put the package inside, but also raise the mailbox flag to indicate that the package is ready for pickup. In the catapult domain, the robot needs to understand that pressing the catapult’s button will activate the catapult, and that the block needs to be placed on the catapult arm to be launched.
|
| 111 |
+
|
| 112 |
+

|
| 113 |
+
Figure 5: High Entropy yet Precise Language-Guided Action Sequences. Running the pseudorandom languageconditioned diffusion process with different seeds on the same observations yields language-consistent (a-c, different colors for different task descriptions), high entropy actions when possible (a-f, object grasping, transports, & placements) and precise actions when necessary (d, narrow mailbox with large package). Further, domain randomization enables a simulation trained policy (e) to generalize to the real world (f).
|
| 114 |
+
|
| 115 |
+
• Multi-task conditioning. Given the same visual observations but different task description, the robot should perform different and task-relevant actions. The catapult domain has 3 tasks for three target bins, and the drawer domain has 12 tasks.
|
| 116 |
+
|
| 117 |
+
• Long horizon behaviour. Our longest horizon domain, mailbox, takes at least 4 subtasks to complete (open the mailbox, put the package in the mailbox while its opened, close the mailbox, then raise the mailbox flag) which can require up to 800 control cycles. In the drawer domain, the robot needs to open the drawer, move the object into the drawer, then close it, which takes about 300 control cycles.
|
| 118 |
+
|
| 119 |
+
The benchmark is built on top of the MuJoCo [3] simulator, using assets from the Google Scanned dataset [59, 60]. We use a table-top manipulation set-up with a 6DoF robot arm. The task success in evaluation is a manually designed function, instead of LLM generated function used for data collection.
|
| 120 |
+
|
| 121 |
+
Metrics. We report the success rates $( \% )$ averaged over 200 episodes in Table 2, a task completion efficiency plot in Fig. 6, and qualitative results in Fig. 5. If a domain has multiple tasks then we report the average performance of all tasks. We also compare different LLMs in Table 4 (10 samples per task) and investigate the sources of error in our system for the mailbox domain in Table 3 (200 trials per execution).
|
| 122 |
+
|
| 123 |
+
Data Generation Baselines. Code-as-Policy [37] is a state-of-the-art approach for using an LLM directly as a robot policy by making state (e.g. query present objects) and action primitive API calls to a robot. Given an LLM-inferred code string, they execute the snippet in an open-loop fashion. Crucially, in their table top manipulation setting, they assume access to planar action primitives. Thus, we introduce the following baselines, which build on top of Code-as-Policy and each other as follows:
|
| 124 |
+
|
| 125 |
+
• LLM-as-Policy (2D): Similar to code-as-policy using planar pick-and-place, but we use ground truth object segmentation instead of their off-the-shelf object detectors [61, 62].
|
| 126 |
+
• $( + )$ 6 DOF robot utils: Builds on top of the previous baseline by adding access to 6 DOF robot utilities for grasping, placement, motion planning, and articulated manipulation.
|
| 127 |
+
• $( + )$ Verify & Retry: Adding to the previous baselines, this baseline uses the LLM’s predicted success condition to label trajectories and retry failed ones. Since the robot utilities involve pseudo-random samplers (e.g. RRT, grasp sampling), retrying the task means running these samplers again using the pseudo-random state and environment state from where failed trajectory left it. Since we use this approach as our data generation policy, it also serves as an ablation of our approach.
|
| 128 |
+
|
| 129 |
+
Policy Distillation Ablations. We compare against BC-Z [15]’s single-task policies which does not use FiLM conditioning (used in their bin emptying and door opening tasks). To understand the effects of our policy learning design decisions in the single-task regime, we fix training time and dataset size (2 days using at least 500 successful trajectories), and provide the following ablations:
|
| 130 |
+
|
| 131 |
+
• Action Generation: Instead of using diffusion processes conditioned on the policy input embedding to decode actions, it is typical use multi-layer perceptrons. Following Jang et al. [15], we use one MLP with two hidden layers and ReLU activations for end effector position, one for the orientation, and another for gripper command. This standard policy architecture is deterministic, and is trained with mean-squared error loss for pose and binary cross entropy loss for gripper command.
|
| 132 |
+
|
| 133 |
+
• Action Space: Besides our absolute end effector pose action space, Delta-Action and velocity control spaces is another popular action space choice [4, 15, 63–65]. We also ablate BC-Z’s execution action horizon (Exec) while keeping their original prediction horizon (Pred).
|
| 134 |
+
|
| 135 |
+
• Observation Encoder: All approaches encode images using a ResNet18 [57] architecture. Although the original architecture was designed with an average pooling layer, its typical for robotic policies to use a spatial softmax pooling [44] layer instead.
|
| 136 |
+
|
| 137 |
+
• Data usage: No-Retry trains on successful trajectories generated from the data generation approach without Verify & Retry, so it does not observe any recovery behavior.
|
| 138 |
+
|
| 139 |
+
# 4.1 Data Collection Policy Evaluation
|
| 140 |
+
|
| 141 |
+
6DoF exploration is critical. First, we verify different approach’s ability to perform and explore in 6DoF, which is crucial for general manipulation. When 6DoF exploration is introduced, we first observe a drop in the average success rate for simple tasks that could be accomplished with planar actions (Balance, Transport, Tab. 2). However, this ability is critical for exploring complex tasks, providing data to improve upon in the
|
| 142 |
+
|
| 143 |
+
<table><tr><td rowspan="2">Approach</td><td colspan="3">Planar</td><td colspan="2">6DoF</td><td rowspan="2">Average</td></tr><tr><td>Balance Catapult Transport Mailbox Drawer</td><td></td><td></td><td></td><td></td></tr><tr><td rowspan="2">LLM-as-Policy (2D) (+) 6DoF Robot Utils (+) Verify &Retry</td><td>28.0</td><td>33.3</td><td>21.5</td><td>0.0</td><td>0.0</td><td>27.6</td></tr><tr><td>5.5 45.0</td><td>2.5</td><td>35.0</td><td>0.0</td><td>1.3</td><td>8.8</td></tr><tr><td rowspan="2">Distill No Retry</td><td></td><td>7.3</td><td>82.0</td><td>3.0</td><td>31.8</td><td>33.8</td></tr><tr><td>67.5</td><td>38.5</td><td>32.5</td><td>0.0</td><td>22.7</td><td>32.2</td></tr><tr><td rowspan="2">Distill Ours</td><td>79.0</td><td>58.3</td><td>80.0</td><td>62.0</td><td>55.8</td><td>67.0</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 144 |
+
|
| 145 |
+
Table 2: Success Rates $( \%$ ) for data generation (top) and distillation approaches (bottom) over 200 trials.
|
| 146 |
+
|
| 147 |
+
later distilling stage. In particular, we observed that 6DoF actions are important for grasping diverse objects with complex geometry (Transport, Tab. 2), and manipulating articulated objects (Drawer, Mailbox, Tab. 2).
|
| 148 |
+
|
| 149 |
+
Moreover, 6DoF exploration also helps in diversifying the data collection strategy, which provides the possibility to improve upon in the later distilling stage. For example in the catapult domain, LLM-as-Policy (2D) is only able to solve one of three possible goals (the closest bin) using a deterministic strategy. However, it provides no useful data for learning the other two goals, making it a poor data-collection policy. In contrast, incorporating 6 DOF robot utilities achieves lower but non-zero average success rates in all bins $( 1 6 . 3 \%$ , $3 . 3 \%$ , and $2 . 2 \%$ , full table in appendix), which provide much better exploration data for distillation.
|
| 150 |
+
|
| 151 |
+
Table 3: Sources & Propagation of Error. Accuracy $( \% )$ of planning, verification, and execution success rate $( \% )$ for each mailbox subtask.
|
| 152 |
+
|
| 153 |
+
<table><tr><td>Subtask</td><td>Planning Verify Execution</td></tr><tr><td>Open mailbox</td><td>100</td><td>43.5</td></tr><tr><td>Put package in mailbox</td><td>100</td><td>28.5</td></tr><tr><td>Raise mailbox flag</td><td>100</td><td>62.0</td></tr><tr><td>Close mailbox</td><td>100</td><td>94.2</td></tr></table>
|
| 154 |
+
|
| 155 |
+
Verify & Retry always helps. In the verify & retry step, the LLM retries all tasks until they are successful. This simple addition improves performance in all domains, with $2 \times , 3 \times$ , $8 \times$ , and $1 3 \times$ in transport, catapult, balance, and drawer domains. Without this crucial step, we observe $0 . 0 \%$ success rate in the mailbox domain, underscoring the difficulty of flawlessly executing long sequences of 6 DOF actions, and the importance of recovery after failure.
|
| 156 |
+
|
| 157 |
+
Language Model Scaling. In addition to the final task success, we provide more detailed analysis of planning and success condition inference accuracy in Tab. 4. We evaluate on the proprietary GPT3 [66] (175B text-davinci-003) and the open LLAMA2 [67] (7B and 13B). We found that Llama models struggles in complex planning domains because they do not follow instructions provided in the prompts. For instance, in the drawer domain, both models fail to account for drawer opening and closing. However, we observe an upwards trend with respect to Llama model size, with the 13B model outperforming the 7B model by $+ 2 0 . 0 \%$ and $+ 3 8 . 3 \%$ in planning and success verification accuracy respectively.
|
| 158 |
+
|
| 159 |
+
<table><tr><td>Model</td><td>Size</td><td>Planning</td><td>Success</td></tr><tr><td rowspan="2">LLAMA2</td><td>7B</td><td>42.0</td><td>10.0</td></tr><tr><td>13B</td><td>62.0</td><td>48.3</td></tr><tr><td>GPT3</td><td>175B</td><td>82.0</td><td>91.1</td></tr></table>
|
| 160 |
+
|
| 161 |
+
Table 4: LLM Evaluation.
|
| 162 |
+
|
| 163 |
+
# 4.2 Distilled Policy Evaluation
|
| 164 |
+
|
| 165 |
+
Robustness In, Robustness Out. By filtering trajectories with LLM’s inferred success condition, distilled policies inherit the robustness of their data collection policies while improving upon success rates $( + 2 3 . 4 \%$ and $+ 3 3 . 2 \%$ for no-retry and ours, Tab. 2). Since our distilled policy learned from a robust data collection policy, it also recovers from failures (e.g. failed grasps or placements) and continuously retries a task until it succeeds. Meanwhile, since the no-retry distilled policy learned from a data collection policy which did not retry upon failure, it is sensitive and brittle, leading to $- 3 4 . 8 \%$ lower average success rate across all domains compared to ours (Tab. 2).
|
| 166 |
+
|
| 167 |
+
High Performance From Diverse Retry Attempts. Plotting how long policies take to solve the balance task (Fig. 6), we observed that our policy and its data collection policy continuously tries a diverse set of grasps and placements after each failed attempt until it succeeds. This results in higher success rates as the policy is given more time, and is reflected in their monotonically increasing success rates.
|
| 168 |
+
|
| 169 |
+
In contrast, baselines plateau after their first grasp/platement attempts. This highlights the synergy of two design decisions. First, the verify & retry step $( \ S 3 . 3 )$ is crucial for demonstrating retrying behavior, but is by itself insufficient if each retrying action is the identical as the previous one. Instead, opting for a diffusion policy $( \ S \ 3 . 4 )$ for learning from and generating high-entropy, diverse retry attempts (Fig 5) is also essential for high performance.
|
| 170 |
+
|
| 171 |
+
Policy Learning Baselines. We investigate policy learning design decisions on the single-task balance domain, and remove language conditioning. While BC-Z found spatial softmax hurt their performance and opted for a mean pool, we observed using spatial softmax improved performance by $+ 5 . 0 \%$ . Further, we found that switching from delta to absolute action spaces improved success rates $+ 6 . 5 \%$ and $+ 9 . 5 \%$ when using the MLP action decoder and our diffusion action decoder, respectively, confirming Chi et al. [12]’s findings. Lastly, we find that using our pseudo-random diffusion-based action encoder consistently outperforms a deterministic MLP action mappings, regardless of other design decisions.
|
| 172 |
+
|
| 173 |
+

|
| 174 |
+
Figure 6: Distilled Robustness. Our policy inherits robust recovery from failure behavior from its data collection policy, while improving upon success rate.
|
| 175 |
+
|
| 176 |
+
Sim2Real Transfer. We evaluated a policy trained on domain randomized synthetic data in a real world transport task with five novel objects (Fig. 5e). Averaging across ten episodes per object, our policy achieved $76 \%$ success rate, demonstrating the effectiveness of our approach in Sim2Real transfer.
|
| 177 |
+
|
| 178 |
+
# 4.3 Limitations
|
| 179 |
+
|
| 180 |
+
By using priviledged simulation state information, the LLM can infer success conditions which uses ground truth contact, joint information, and object poses. This means our implementation of the data generation phase is limited to simulation environments, and our policy requires sim2real transfer. Further, Our data generation method relies on existing 3D assets and environments, which presents a further opportunity for scaling up with assets from 3D generative models or procedural generation. Finally, while our approach’s dataset contains text labels and success labels for all subtasks, we have only evaluated its effectiveness in learning the root task. Learning from all subtasks and growing a robot’s set of learned, reusable sub-skills over time to enable compositional generalization is left for future work.
|
| 181 |
+
|
| 182 |
+
<table><tr><td rowspan="2">Method</td><td colspan="2">Output</td><td colspan="2">Input</td><td rowspan="2">Success (%)</td></tr><tr><td>Generation</td><td>Rep.Exec Pred Pool</td><td></td><td>Proprio</td></tr><tr><td>BC-Z</td><td>FeedForward Delta</td><td>1</td><td>10 Avg</td><td>xxx</td><td>0.0</td></tr><tr><td></td><td>FeedForward Delta</td><td>4</td><td>10 Avg</td><td></td><td>15.0</td></tr><tr><td></td><td>FeedForward Delta</td><td>8</td><td>10 Avg</td><td></td><td>18.5</td></tr><tr><td>Ours</td><td>FeedForward Delta</td><td>8</td><td>16 Spatial</td><td></td><td>29.0</td></tr><tr><td></td><td>FeedForward Abs</td><td>8</td><td>16 Spatial</td><td>ν/√√</td><td>35.5</td></tr><tr><td></td><td>Diffusion</td><td>Delta 8</td><td>16 Spatial</td><td></td><td>69.5</td></tr><tr><td></td><td>Diffusion</td><td>Abs 8</td><td>16Avg</td><td></td><td>76.5</td></tr><tr><td></td><td>Diffusion</td><td>Abs 8</td><td>16 Spatial</td><td></td><td>79.0</td></tr></table>
|
| 183 |
+
|
| 184 |
+
Table 5: Policy Learning Ablations. Action generation using diffusion models [50] robustly outperforms feed-forward models across other policy design decisions.
|
| 185 |
+
|
| 186 |
+
# 5 Conclusion
|
| 187 |
+
|
| 188 |
+
We proposed “Scaling Up and Distilling Down”, a framework that combines the strengths of LLMs, samplingbased planners, and policy learning into a single system that automatically generates, labels, and distills diverse robot-complete exploration experience into a multi-task visuo-linguo-motor policy. The distilled policy inherits long-horizon behaviour, rich low-level manipulation skills, and robustness from its data collection policy while improving upon performance beyond its training distribution. We believe that this integrated approach is a step towards putting robotics on the same scaling trend as that of LLM development while not compromising on the rich low-level control.
|
| 189 |
+
|
| 190 |
+
# Acknowledgments
|
| 191 |
+
|
| 192 |
+
We would like to thank Cheng Chi, Zeyi Liu, Samir Yitzhak Gadre, Mengda Xu, Zhenjia Xu, Mandi Zhao and Dominik Bauer for their helpful feedback and fruitful discussions. This work was supported in part by Google Research Award, NSF Award #2143601, and #2132519. We would like to thank Google for the UR5 robot hardware. The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies, either expressed or implied, of the sponsors.
|
| 193 |
+
|
| 194 |
+
References
|
| 195 |
+
[1] S. Song, A. Zeng, J. Lee, and T. Funkhouser. Grasping in the wild: Learning 6dof closed-loop grasping from low-cost demonstrations. IEEE Robotics and Automation Letters, 5(3):4978–4985, 2020.
|
| 196 |
+
[2] T. Z. Zhao, V. Kumar, S. Levine, and C. Finn. Learning fine-grained bimanual manipulation with low-cost hardware. arXiv preprint arXiv:2304.13705, 2023.
|
| 197 |
+
[3] E. Todorov, T. Erez, and Y. Tassa. Mujoco: A physics engine for model-based control. In 2012 IEEE/RSJ International Conference on Intelligent Robots and Systems, pages 5026–5033. IEEE, 2012. doi:10.1109/IROS.2012.6386109.
|
| 198 |
+
[4] A. Mandlekar, D. Xu, J. Wong, S. Nasiriany, C. Wang, R. Kulkarni, L. Fei-Fei, S. Savarese, Y. Zhu, and R. Mart´ın-Mart´ın. What matters in learning from offline human demonstrations for robot manipulation. In arXiv preprint arXiv:2108.03298, 2021.
|
| 199 |
+
[5] S. Nair, A. Rajeswaran, V. Kumar, C. Finn, and A. Gupta. R3m: A universal visual representation for robot manipulation. arXiv preprint arXiv:2203.12601, 2022.
|
| 200 |
+
[6] 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. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 18995–19012, 2022.
|
| 201 |
+
[7] J. Fu, A. Kumar, O. Nachum, G. Tucker, and S. Levine. D4rl: Datasets for deep data-driven reinforcement learning. arXiv preprint arXiv:2004.07219, 2020.
|
| 202 |
+
[8] J. Wu, X. Sun, A. Zeng, S. Song, J. Lee, S. Rusinkiewicz, and T. Funkhouser. Spatial action maps for mobile manipulation. arXiv preprint arXiv:2004.09141, 2020.
|
| 203 |
+
[9] M. Shridhar, L. Manuelli, and D. Fox. Perceiver-actor: A multi-task transformer for robotic manipulation. In Proceedings of the 6th Conference on Robot Learning (CoRL), 2022.
|
| 204 |
+
[10] M. Shridhar, L. Manuelli, and D. Fox. Cliport: What and where pathways for robotic manipulation. In Proceedings of the 5th Conference on Robot Learning (CoRL), 2021.
|
| 205 |
+
[11] P. Florence, C. Lynch, A. Zeng, O. Ramirez, A. Wahid, L. Downs, A. Wong, J. Lee, I. Mordatch, and J. Tompson. Implicit behavioral cloning. Conference on Robot Learning (CoRL), November 2021.
|
| 206 |
+
[12] C. Chi, S. Feng, Y. Du, Z. Xu, E. Cousineau, B. Burchfiel, and S. Song. Diffusion policy: Visuomotor policy learning via action diffusion. In Proceedings of Robotics: Science and Systems (RSS), 2023.
|
| 207 |
+
[13] C. Lynch and P. Sermanet. Language conditioned imitation learning over unstructured data. arXiv preprint arXiv:2005.07648, 2020.
|
| 208 |
+
[14] S. Stepputtis, J. Campbell, M. Phielipp, S. Lee, C. Baral, and H. Ben Amor. Language-conditioned imitation learning for robot manipulation tasks. Advances in Neural Information Processing Systems, 33:13139–13150, 2020.
|
| 209 |
+
[15] E. Jang, A. Irpan, M. Khansari, D. Kappler, F. Ebert, C. Lynch, S. Levine, and C. Finn. Bc-z: Zero-shot task generalization with robotic imitation learning. In A. Faust, D. Hsu, and G. Neumann, editors, Proceedings of the 5th Conference on Robot Learning, volume 164 of Proceedings of Machine Learning Research, pages 991–1002. PMLR, 08–11 Nov 2022. URL https://proceedings.mlr.press/v164/jang22a. html.
|
| 210 |
+
[16] C. Lynch, A. Wahid, J. Tompson, T. Ding, J. Betker, R. Baruch, T. Armstrong, and P. Florence. Interactive language: Talking to robots in real time. arXiv preprint arXiv:2210.06407, 2022.
|
| 211 |
+
[17] O. Mees, L. Hermann, and W. Burgard. What matters in language conditioned robotic imitation learning over unstructured data. IEEE Robotics and Automation Letters, 7(4):11205–11212, 2022.
|
| 212 |
+
[18] A. Brohan, N. Brown, J. Carbajal, Y. Chebotar, J. Dabis, C. Finn, K. Gopalakrishnan, K. Hausman, A. Herzog, J. Hsu, et al. Rt-1: Robotics transformer for real-world control at scale. arXiv preprint arXiv:2212.06817, 2022.
|
| 213 |
+
[19] O. Mees, L. Hermann, E. Rosete-Beas, and W. Burgard. Calvin: A benchmark for language-conditioned policy learning for long-horizon robot manipulation tasks. IEEE Robotics and Automation Letters, 7(3): 7327–7334, 2022.
|
| 214 |
+
[20] T. Xiao, H. Chan, P. Sermanet, A. Wahid, A. Brohan, K. Hausman, S. Levine, and J. Tompson. Robotic skill acquisition via instruction augmentation with vision-language models. arXiv preprint arXiv:2211.11736, 2022.
|
| 215 |
+
[21] J. Zhang, K. Pertsch, J. Zhang, and J. J. Lim. Sprint: Scalable policy pre-training via language instruction relabeling. arXiv preprint arXiv:2306.11886, 2023.
|
| 216 |
+
[22] S. Nair, E. Mitchell, K. Chen, S. Savarese, C. Finn, et al. Learning language-conditioned robot behavior from offline data and crowd-sourced annotation. In Conference on Robot Learning, pages 1303–1315. PMLR, 2022.
|
| 217 |
+
[23] R. Goyal, S. Ebrahimi Kahou, V. Michalski, J. Materzynska, S. Westphal, H. Kim, V. Haenel, I. Fruend, P. Yianilos, M. Mueller-Freitag, et al. The” something something” video database for learning and evaluating visual common sense. In Proceedings of the IEEE international conference on computer vision, pages 5842–5850, 2017.
|
| 218 |
+
[24] 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 Proceedings of the European Conference on Computer Vision (ECCV), pages 720–736, 2018.
|
| 219 |
+
[25] A. S. Chen, S. Nair, and C. Finn. Learning generalizable robotic reward functions from” in-the-wild” human videos. arXiv preprint arXiv:2103.16817, 2021.
|
| 220 |
+
[26] R. Wang, J. Lehman, J. Clune, and K. O. Stanley. Paired open-ended trailblazer (poet): Endlessly generating increasingly complex and diverse learning environments and their solutions. arXiv preprint arXiv:1901.01753, 2019.
|
| 221 |
+
[27] M. Jiang, M. Dennis, J. Parker-Holder, J. Foerster, E. Grefenstette, and T. Rocktaschel. Replay-guided ¨ adversarial environment design. Advances in Neural Information Processing Systems, 34:1884–1897, 2021.
|
| 222 |
+
[28] J.-B. Mouret and J. Clune. Illuminating search spaces by mapping elites. arXiv preprint arXiv:1504.04909, 2015.
|
| 223 |
+
[29] K. Fang, T. Migimatsu, A. Mandlekar, L. Fei-Fei, and J. Bohg. Active task randomization: Learning visuomotor skills for sequential manipulation by proposing feasible and novel tasks. arXiv preprint arXiv:2211.06134, 2022.
|
| 224 |
+
[30] Y. Du, O. Watkins, Z. Wang, C. Colas, T. Darrell, P. Abbeel, A. Gupta, and J. Andreas. Guiding pretraining in reinforcement learning with large language models. arXiv preprint arXiv:2302.06692, 2023.
|
| 225 |
+
[31] S. Mirchandani, S. Karamcheti, and D. Sadigh. Ella: Exploration through learned language abstraction. Advances in Neural Information Processing Systems, 34:29529–29540, 2021.
|
| 226 |
+
[32] R. Mendonca, S. Bahl, and D. Pathak. Alan: Autonomously exploring robotic agents in the real world. arXiv preprint arXiv:2302.06604, 2023.
|
| 227 |
+
[33] C. R. Garrett, R. Chitnis, R. Holladay, B. Kim, T. Silver, L. P. Kaelbling, and T. Lozano-Perez. Integrated ´ task and motion planning. Annual review of control, robotics, and autonomous systems, 4:265–293, 2021.
|
| 228 |
+
[34] W. Huang, P. Abbeel, D. Pathak, and I. Mordatch. Language models as zero-shot planners: Extracting actionable knowledge for embodied agents. In International Conference on Machine Learning, pages 9118–9147. PMLR, 2022.
|
| 229 |
+
[35] M. Ahn, A. Brohan, N. Brown, Y. Chebotar, O. Cortes, B. David, C. Finn, K. Gopalakrishnan, K. Hausman, A. Herzog, et al. Do as i can, not as i say: Grounding language in robotic affordances. arXiv preprint arXiv:2204.01691, 2022.
|
| 230 |
+
[36] W. Huang, F. Xia, T. Xiao, H. Chan, J. Liang, P. Florence, A. Zeng, J. Tompson, I. Mordatch, Y. Chebotar, et al. Inner monologue: Embodied reasoning through planning with language models. In 6th Annual Conference on Robot Learning.
|
| 231 |
+
[37] J. Liang, W. Huang, F. Xia, P. Xu, K. Hausman, B. Ichter, P. Florence, and A. Zeng. Code as policies: Language model programs for embodied control. In arXiv preprint arXiv:2209.07753, 2022.
|
| 232 |
+
[38] D. Driess, F. Xia, M. S. Sajjadi, C. Lynch, A. Chowdhery, B. Ichter, A. Wahid, J. Tompson, Q. Vuong, T. Yu, et al. Palm-e: An embodied multimodal language model. ICML, 2023.
|
| 233 |
+
[39] K. Lin, C. Agia, T. Migimatsu, M. Pavone, and J. Bohg. Text2motion: From natural language instructions to feasible plans. arXiv preprint arXiv:2303.12153, 2023.
|
| 234 |
+
[40] I. Singh, V. Blukis, A. Mousavian, A. Goyal, D. Xu, J. Tremblay, D. Fox, J. Thomason, and A. Garg. Progprompt: Generating situated robot task plans using large language models. In 2023 IEEE International Conference on Robotics and Automation (ICRA), pages 11523–11530. IEEE, 2023.
|
| 235 |
+
[41] A. Agarwal, A. Kumar, J. Malik, and D. Pathak. Legged locomotion in challenging terrains using egocentric vision, 2022.
|
| 236 |
+
[42] D. Seita, A. Ganapathi, R. Hoque, M. Hwang, E. Cen, A. K. Tanwani, A. Balakrishna, B. Thananjeyan, J. Ichnowski, N. Jamali, K. Yamane, S. Iba, J. F. Canny, and K. Goldberg. Deep imitation learning of sequential fabric smoothing policies. CoRR, abs/1910.04854, 2019. URL http://arxiv.org/abs/1910. 04854.
|
| 237 |
+
[43] T. Miki, J. Lee, J. Hwangbo, L. Wellhausen, V. Koltun, and M. Hutter. Learning robust perceptive locomotion for quadrupedal robots in the wild. Science Robotics, 7(62):eabk2822, 2022.
|
| 238 |
+
[44] S. Levine, C. Finn, T. Darrell, and P. Abbeel. End-to-end training of deep visuomotor policies. The Journal of Machine Learning Research, 17(1):1334–1373, 2016.
|
| 239 |
+
[45] K. Hausman, Y. Chebotar, S. Schaal, G. Sukhatme, and J. J. Lim. Multi-modal imitation learning from unstructured demonstrations using generative adversarial nets. Advances in neural information processing systems, 30, 2017.
|
| 240 |
+
[46] N. M. M. Shafiullah, Z. J. Cui, A. Altanzaya, and L. Pinto. Behavior transformers: Cloning $k$ modes with one stone, 2022.
|
| 241 |
+
[47] T. Yu, D. Quillen, Z. He, R. Julian, K. Hausman, C. Finn, and S. Levine. Meta-world: A benchmark and evaluation for multi-task and meta reinforcement learning. In Conference on robot learning, pages 1094–1100. PMLR, 2020.
|
| 242 |
+
[48] D. Kalashnikov, J. Varley, Y. Chebotar, B. Swanson, R. Jonschkowski, C. Finn, S. Levine, and K. Hausman. Mt-opt: Continuous multi-task robotic reinforcement learning at scale. arXiv preprint arXiv:2104.08212, 2021.
|
| 243 |
+
[49] J. Sohl-Dickstein, E. Weiss, N. Maheswaranathan, and S. Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In International Conference on Machine Learning, pages 2256–2265. PMLR, 2015.
|
| 244 |
+
[50] J. Ho, A. Jain, and P. Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 33:6840–6851, 2020.
|
| 245 |
+
[51] C. Saharia, W. Chan, S. Saxena, L. Li, J. Whang, E. L. Denton, K. Ghasemipour, R. Gontijo Lopes, B. Karagol Ayan, T. Salimans, et al. Photorealistic text-to-image diffusion models with deep language understanding. Advances in Neural Information Processing Systems, 35:36479–36494, 2022.
|
| 246 |
+
[52] R. Rombach, A. Blattmann, D. Lorenz, P. Esser, and B. Ommer. High-resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10684–10695, 2022.
|
| 247 |
+
[53] L. Chen, K. Lu, A. Rajeswaran, K. Lee, A. Grover, M. Laskin, P. Abbeel, A. Srinivas, and I. Mordatch. Decision transformer: Reinforcement learning via sequence modeling. Advances in neural information processing systems, 34:15084–15097, 2021.
|
| 248 |
+
[54] S. Levine, A. Kumar, G. Tucker, and J. Fu. Offline reinforcement learning: Tutorial, review, and perspectives on open problems. arXiv preprint arXiv:2005.01643, 2020.
|
| 249 |
+
[55] S. M. LaValle et al. Rapidly-exploring random trees: A new tool for path planning.
|
| 250 |
+
[56] A. Radford, J. W. Kim, C. Hallacy, A. Ramesh, G. Goh, S. Agarwal, G. Sastry, A. Askell, P. Mishkin, J. Clark, et al. Learning transferable visual models from natural language supervision. In International Conference on Machine Learning, pages 8748–8763. PMLR, 2021.
|
| 251 |
+
[57] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016.
|
| 252 |
+
[58] J. Song, C. Meng, and S. Ermon. Denoising diffusion implicit models. In International Conference on Learning Representations.
|
| 253 |
+
[59] L. Downs, A. Francis, N. Koenig, B. Kinman, R. Hickman, K. Reymann, T. B. McHugh, and V. Vanhoucke. Google scanned objects: A high-quality dataset of 3d scanned household items, 2022. URL https://arxiv.org/abs/2204.11918.
|
| 254 |
+
[60] K. Zakka. Scanned Objects MuJoCo Models, 7 2022. URL https://github.com/kevinzakka/mujoco scanned objects.
|
| 255 |
+
[61] A. Kamath, M. Singh, Y. LeCun, G. Synnaeve, I. Misra, and N. Carion. Mdetr-modulated detection for end-to-end multi-modal understanding. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 1780–1790, 2021.
|
| 256 |
+
[62] X. Gu, T.-Y. Lin, W. Kuo, and Y. Cui. Open-vocabulary object detection via vision and language knowledge distillation. arXiv preprint arXiv:2104.13921, 2021.
|
| 257 |
+
[63] T. Zhang, Z. McCarthy, O. Jow, D. Lee, X. Chen, K. Goldberg, and P. Abbeel. Deep imitation learning for complex manipulation tasks from virtual reality teleoperation. In 2018 IEEE International Conference on Robotics and Automation (ICRA), pages 5628–5635. IEEE, 2018.
|
| 258 |
+
[64] P. Florence, L. Manuelli, and R. Tedrake. Self-supervised correspondence in visuomotor policy learning. IEEE Robotics and Automation Letters, 5(2):492–499, 2019.
|
| 259 |
+
[65] A. Mandlekar, F. Ramos, B. Boots, S. Savarese, L. Fei-Fei, A. Garg, and D. Fox. Iris: Implicit reinforcement without interaction at scale for learning control from offline robot manipulation data. In 2020 IEEE International Conference on Robotics and Automation (ICRA), pages 4414–4420. IEEE, 2020.
|
| 260 |
+
[66] T. Brown, B. Mann, N. Ryder, M. Subbiah, J. D. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry, A. Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.
|
| 261 |
+
[67] H. Touvron, L. Martin, K. Stone, P. Albert, A. Almahairi, Y. Babaei, N. Bashlykov, S. Batra, P. Bhargava, S. Bhosale, et al. Llama 2: Open foundation and fine-tuned chat models. arXiv preprint arXiv:2307.09288, 2023.
|
md/dev/5hLP5JY9S2d/5hLP5JY9S2d.md
ADDED
|
@@ -0,0 +1,501 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# OPEN-SET RECOGNITION: A GOOD CLOSED-SET CLASSIFIER IS ALL YOU NEED?
|
| 2 |
+
|
| 3 |
+
Sagar Vaze⋆ Kai $\mathbf { H a n } ^ { \star \dagger }$ Andrea Vedaldi⋆ Andrew Zisserman⋆
|
| 4 |
+
⋆Visual Geometry Group, University of Oxford
|
| 5 |
+
†The University of Hong Kong
|
| 6 |
+
{sagar,vedaldi,az}@robots.ox.ac.uk kaihanx@hku.hk
|
| 7 |
+
|
| 8 |
+
# ABSTRACT
|
| 9 |
+
|
| 10 |
+
The ability to identify whether or not a test sample belongs to one of the semantic classes in a classifier’s training set is critical to practical deployment of the model. This task is termed open-set recognition (OSR) and has received significant attention in recent years. In this paper, we first demonstrate that the ability of a classifier to make the ‘none-of-above’ decision is highly correlated with its accuracy on the closed-set classes. We find that this relationship holds across loss objectives and architectures, and further demonstrate the trend both on the standard OSR benchmarks as well as on a large-scale ImageNet evaluation. Second, we use this correlation to boost the performance of the maximum softmax probability OSR ‘baseline’ by improving its closed-set accuracy, and with this strong baseline achieve state-of-the-art on a number of OSR benchmarks. Similarly, we boost the performance of the existing state-of-the-art method by improving its closed-set accuracy, but the resulting discrepancy with the strong baseline is marginal. Our third contribution is to present the ‘Semantic Shift Benchmark’ (SSB), which better respects the task of detecting semantic novelty, as opposed to low-level distributional shifts as tackled by neighbouring machine learning fields. On this new evaluation, we again demonstrate that there is negligible difference between the strong baseline and the existing state-of-the-art. Code available at: https://github.com/sgvaze/osr_closed_set_all_you_need.
|
| 11 |
+
|
| 12 |
+
# 1 INTRODUCTION
|
| 13 |
+
|
| 14 |
+
Given the success of modern deep learning systems on closed-set visual recognition tasks, a natural next challenge is open-set recognition (OSR) (Scheirer et al., 2013). In the closed-set setting, a model is tasked with recognizing a set of categories that remain the same during both training and testing phases. In the more realistic open-set setting, a model must not only be able to distinguish between the training classes, but also indicate if an image comes from a class it has not yet encountered.
|
| 15 |
+
|
| 16 |
+
The OSR problem was initially formalized in (Scheirer et al., 2013) and has since inspired a rich line of research (Bendale & Boult, 2016; Chen et al., 2020a; Ge et al., 2017; Neal et al., 2018; Sun et al., 2020; Zhang et al., 2020; Shu et al., 2020). The standard baseline for OSR is a model trained with the cross-entropy loss on the known classes. At test time, the maximum value of the softmax probability vector is used to decide if an input belongs to the known classes or not. We henceforth refer to this method as the ‘baseline’ or ‘maximum softmax probability (MSP) baseline’. Most existing literature reports significantly outperforming this OSR baseline on standard benchmarks of re-purposed image recognition datasets, including MNIST (LeCun et al., 2010) and TinyImageNet (Le & Yang, 2015).
|
| 17 |
+
|
| 18 |
+
In this paper we reappraise these approaches, by asking whether a well-trained closed-set classifier can perform as well as recent algorithms, and by analyzing the benchmark datasets. To do this, we first investigate the relationship between the closed-set and open-set performance of a classifier (sec. 3). Though one may expect stronger closed-set classifiers to overfit to the training classes (Recht et al., 2019; Zhang et al., 2017), and so perform poorly for OSR, we show instead that the closed-set and open-set performance are highly correlated. We show this trend holds across datasets, objectives and model architectures, and further demonstrate the trend on an ImageNet-scale evaluation.
|
| 19 |
+
|
| 20 |
+

|
| 21 |
+
Figure 1: (a) We show that we can push OSR baseline performance to be competitive with or surpass state-of-the-art methods (shown, $\mathrm { A R P L + C S }$ (Chen et al., 2021)). (b) We propose the ‘Semantic Shift Benchmark’ datasets for OSR, which are larger scale and give precise definitions of what constitutes a ‘new class’.
|
| 22 |
+
|
| 23 |
+
Secondly, following this observation, we show that the open-set performance of a classifier can be improved by enhancing its closed-set accuracy, tapping the numerous recent advances in image classification (Loshchilov & Hutter, 2017; Szegedy et al., 2016; Cubuk et al., 2020; Bello et al., 2021). Specifically, we introduce strategies such as more augmentation, better learning rate schedules and label smoothing, that significantly improve the closed-set performance of the MSP baseline (sec. 4). We also propose the use of the maximum logit score (MLS), rather than normalized softmax probabilities, as an open-set indicator. With these adjustments, we push the baseline to become competitive with or outperform state-of-the-art OSR methods, substantially outperforming the currently reported baseline figures. Notably, we surpass state-of-the-art figures on four of the six OSR benchmark datasets.
|
| 24 |
+
|
| 25 |
+
Furthermore, we transfer these improvements to two previous OSR methods, including the current state-of-the-art from (Chen et al., 2021). While this does boost its performance, we observe that there is negligible difference with that of the improved ‘MLS’ baseline (see fig. 1a). This finding is important because it allows us to better assess recent reported progress in the area.
|
| 26 |
+
|
| 27 |
+
Finally, we turn to the experimental setting for OSR (sec. 5). Current OSR benchmarks are both small scale and lack a specific definition of what constitutes a ‘visual class’. As an alternative, we propose the ‘Semantic Shift Benchmark’ suite (SSB). We propose the use of fine-grained datasets — including CUB (Wah et al., 2011), Stanford Cars (Krause et al., 2013) and FGVC-Aircraft (Maji et al., 2013) — which all have clear definitions of a semantic class (see fig. 1b), as well as an ImageNet-scale evaluation based on the full ImageNet database (Ridnik et al., 2021). Furthermore, we construct open-set splits with an explicit focus on semantic novelty, which we hope better separates this avenue of research from related machine learning sub-fields such as out-of-distribution (Hendrycks & Gimpel, 2017) and anomaly detection (Kwon et al., 2020). Our proposed splits also offer a better way of quantifying open-set difficulty; we find that different splits lead to a much larger discrepancy in open-set performance than the current measure of open-set difficulty ‘openness’ (Scheirer et al., 2013), which focuses only on the number of open-set classes. We evaluate our strong baseline as well as the state-of-the-art method on this new configuration to encourage future research in this direction.
|
| 28 |
+
|
| 29 |
+
# 2 RELATED WORK
|
| 30 |
+
|
| 31 |
+
Open-set recognition. Seminal work in (Scheirer et al., 2013) formalized the task of open-set recognition, and has inspired a number of subsequent works in the field. (Bendale & Boult, 2016) introduced the first deep learning approach for OSR, OpenMax, based on the Extreme Value Theory (EVT). GANs have also been used to tackle the task (Ge et al., 2017; Neal et al., 2018). OSRCI (Neal et al., 2018) generates images similar to those in the training set but that do not belong to any of the known classes, and uses the generated images to train an open-set classifier. This work also established the existing OSR benchmark suite. (Kong & Ramanan, 2021) achieve strong OSR performance by using an adversarially trained discriminator to delineate closed from open-set images, leveraging real open-set images for model selection. Other approaches include reconstruction based methods (Yoshihashi et al., 2019; Oza & Patel, 2019; Sun et al., 2020) which use poor test-time reconstruction as an open-set indicator, and prototype-based methods (Shu et al., 2020; Chen et al.,
|
| 32 |
+
|
| 33 |
+
2020a; 2021) which represent known classes with learned prototypes, and identify open-set images based on distances to the prototypes.
|
| 34 |
+
|
| 35 |
+
State-of-the-art. In this work, we compare against methods which achieve state-of-the-art in the controlled OSR setting (with no extra data for training or model selection, for instance as demonstrated in (Kong & Ramanan, 2021)). To our knowledge, these methods are ARPL (Adversarial Reciprocal Point Learning) (Chen et al., 2020a; 2021) and OpenHybrid (Zhang et al., 2020), which we detail in sec. 3.1 and sec. 4 respectively. In this paper, we show that the MSP baseline can be competitive with or outperform the more complex methods listed above. Finally, we note recent works (Zhou et al., 2021; Miller et al., 2021; Guo et al., 2021) with which we do not compare as they report lower performance than ARPL and OpenHybrid.
|
| 36 |
+
|
| 37 |
+
Related subfields. OSR is also closely related to out-of-distribution (OoD) detection (Hendrycks & Gimpel, 2017; Liang et al., 2018; Hsu et al., 2020), novelty detection (Abati et al., 2019; Perera et al., 2019; Tack et al., 2020), anomaly detection (Hendrycks et al., 2019; Kwon et al., 2020; Bergman & Hoshen, 2020) and novel category discovery (Han et al., 2019; 2020; 2021). Amongst these, OoD is perhaps the most widely studied and is similar in nature to OSR. As noted by (Dhamija et al., 2018; Boult et al., 2019), OSR is similar to the OoD problem with an additional multi-way classification component between known categories. In fact, there is currently significant overlap in the evaluation datasets between these settings, though cross-setting comparisons are difficult due to different evaluation protocols. Specifically, the OoD setting permits the use of additional data as examples of ‘OoD’ data during training. (Chen et al., 2021) and (Zhang et al., 2020) evaluate their OSR methods on OoD benchmarks, with both showing competitive results despite not having access to additional data during training. In this paper, we distinguish the OSR problem from OoD and other related fields by proposing a new suite of benchmarks. While OoD encompasses all forms of distributional shift, including those based on low-level features, OSR specifically refers to semantic novelty. We propose new benchmarks that respect this distinction.
|
| 38 |
+
|
| 39 |
+
# 3 CORRELATION BETWEEN CLOSED-SET AND OPEN-SET PERFORMANCE
|
| 40 |
+
|
| 41 |
+
One may expect that stronger closed-set classifiers have overfit their learned representations to the closed-set categories, and thus perform poorly for OSR (Recht et al., 2019; Zhang et al., 2017). Furthermore, existing literature largely considers the closed and open-set tasks separately, with works generally emphasising good open-set performance despite no degradation in closed-set accuracy (Neal et al., 2018; Zhou et al., 2021; Miller et al., 2021). On the contrary, in this section we show that the closed-set and open-set performance of classifiers are strongly correlated. We first demonstrate this for the baseline and a state-of-the-art method on the standard OSR benchmarks (sec. 3.1) and then on a large scale evaluation across a number of model architectures (sec. 3.2).
|
| 42 |
+
|
| 43 |
+
Open-set recognition. We formalize the problem of OSR, and highlight its differences from closedset recognition. First, consider a labelled training set for a classifier $\mathcal { D } _ { \operatorname { t r a i n } } = \{ ( \mathbf { x } _ { i } , y _ { i } ) \} _ { i = 1 } ^ { N } \subset \mathcal { X } \times \mathcal { C }$ . Here, $\mathcal { X }$ is the input space (e.g., images) and $\mathcal { C }$ is the set of ‘known’ classes. In the closed-set scenario, the model is evaluated on a test set in which the labels are also drawn from the same set of classes, i.e., $\mathcal { D } _ { \mathrm { t e s t - c l o s e d } } = \{ ( \mathbf { x } _ { i } , y _ { i } ) \} _ { i = 1 } ^ { M } \subset \mathcal { X } \times \mathcal { C }$ . In the closed-set setting, the model returns a distribution over the known classes as $p ( y | \mathbf { x } )$ . Conversely, in OSR, test images may also come from unseen classes $\mathcal { U }$ , giving $\mathcal { D } _ { \mathrm { t e s t - o p e n } } = \{ ( \mathbf { x } _ { i } , y _ { i } ) \} _ { i = 1 } ^ { M ^ { \prime } } \subset \mathcal { X } \times ( \mathcal { C } \cup \mathcal { U } )$ . In the open-set setting, in addition to returning the distribution $\bar { p } ( y | \mathbf x , y \in \mathcal C )$ over known classes, the model also returns a score $\boldsymbol { S } ( \boldsymbol { y } \in \mathcal { C } | \mathbf { x } )$ to indicate whether or not the test sample belongs to any of the known classes.
|
| 44 |
+
|
| 45 |
+
# 3.1 BASELINE AND STATE-OF-THE-ART ON STANDARD BENCHMARKS
|
| 46 |
+
|
| 47 |
+
We first experiment with three representative open-set recognition methods across the standard benchmark datasets in the literature (Neal et al., 2018; Oza & Patel, 2019; Sun et al., 2020; Chen et al., 2020a; Zhang et al., 2020). The methods include the standard MSP baseline as well as two variants of ARPL (Chen et al., 2021). We use the standard network from the open-set literature (Neal et al., 2018), a lightweight model similar to the VGG architecture (Simonyan & Zisserman, 2015) which we henceforth refer to as ‘VGG32’ (refer to appendix D for details). The three methods are summarised below, followed by a description of the most commonly used benchmarks.
|
| 48 |
+
|
| 49 |
+
Methods. Maximum Softmax Probability (MSP, baseline): The model is trained for closed-set classification using the cross-entropy loss between a one-hot target vector and the softmax output $p ( y | \mathbf { x } )$ of the classifier. This training strategy, along with the use of the maximum softmax probability as ${ \dot { S } } ( y \in { \mathcal { C } } | \mathbf { x } ) = \operatorname* { m a x } _ { y \in { \mathcal { C } } } p ( y | \mathbf { x } )$ , is widely used in both the OSR and OoD literature as a baseline (Hendrycks & Gimpel, 2017). ARPL (Chen et al., 2021): This method is an extension of the recent RPL (Reciprocal Point Learning) optimization strategy (Chen et al., 2020a). Here, the probability that a sample belongs to a class is proportional to its distance from a learned ‘reciprocal point’ in the feature space. A reciprocal point aims to represent ‘otherness’ with respect to a class, with the intuition being that open-set examples are different to all known classes. ARPL extends RPL by computing feature distances as the sum of both the Euclidean and cosine distances. In this case, $\boldsymbol { S } ( \boldsymbol { y } \in \mathcal { C } | \mathbf { x } )$ is equal to the maximum distance in feature space between the image and any reciprocal point. $\mathbf { A R P L + C S }$ (Chen et al., 2021) augments ARPL with ‘confusing samples’: adversarially generated latent points to stand in for ‘unseen class’ samples. The confusing samples are encouraged to be equidistant from all reciprocal points, with the same open-set scoring rule used as in ARPL. We train both ARPL and $\mathrm { A R P L + C S }$ based on the official public implementation (Chen et al., 2021).
|
| 50 |
+
|
| 51 |
+

|
| 52 |
+
Figure 2: Correlation between closed set performance (accuracy) and open-set performance (AUROC). We train three methods on the standard open-set benchmark datasets, including the MSP baseline, ARPL and ARPL $^ +$ CS (Chen et al., 2021). Foreground points in bold show results averaged across five ‘known/unknown’ class splits for each method-dataset pair (following standard practise in the OSR literature) while background points, shown feint, indicate results from the underlying individual splits.
|
| 53 |
+
|
| 54 |
+
Datasets. We train the above methods on the standard benchmark datasets for open-set recognition. In all cases, the model is trained on a subset of classes, while other classes are reserved as ‘unseen’ for evaluation. MNIST (LeCun et al., 2010), SVHN (Netzer et al., 2011), CIFAR10 (Krizhevsky, 2009): These are ten-class datasets, with MNIST and SVHN containing images of hand-written digits and street-view house numbers respectively. Meanwhile, CIFAR10 is a generic object recognition dataset containing natural images from ten diverse classes including animals and vehicles. In these cases, the open-set methods are evaluated by training on six classes, while using the other four classes for testing $( | \mathcal { C } | = 6 ; | \mathcal { U } | = 4 )$ . $\mathrm { C I F A R + N }$ (Krizhevsky, 2009): In an extension to the CIFAR10 evaluation protocol, open-set algorithms are benchmarked by training on four classes from CIFAR10, while using $N$ classes from CIFAR100 for evaluation, where $N$ denotes either 10 or 50 classes $( | \mathcal { C } | = 4 ; | \mathcal { U } | \in \{ 1 0 , 5 0 \} )$ . TinyImageNet (Le & Yang, 2015): In the final and most challenging case, exisiting open-set algorithms are evaluated on the TinyImageNet dataset. This dataset contains 200 classes sub-sampled from ImageNet (Russakovsky et al., 2015), with 20 classes used for training and 180 as unknown $( | \mathcal { C } | = 2 0 ; | \mathcal { U } | = 1 8 0 )$ .
|
| 55 |
+
|
| 56 |
+
Experimental setup. At test time, the model is fed test images from both known and novel classes, and is tasked with making a binary ‘known/unknown’ decision on a per-image basis. Following standard practise in the OSR literature, the threshold-free area under the Receiver-Operator curve (AUROC) is used as an evaluation metric. We train with the same hyper-parameters as in (Chen et al., 2021) and, following standard practise, train on five different splits of closed and open-set classes for each dataset and method combination. When evaluating on existing benchmarks throughout this paper, we use the same data splits as (Chen et al., 2021).
|
| 57 |
+
|
| 58 |
+
Results. Fig. 2 gives the AUROC (open-set performance) against the Top-1 multi-way classification accuracy (closed-set performance). We show the averaged results as well as the individual split results, omitting the $\mathrm { C I F A R } { + } 1 0$ setting for clarity (as the scatter points are almost coincident with the $\mathrm { C I F A R } { + } 5 0$ setting). It is clear that there is a positive correlation between the closed-set accuracy and open-set performance: we find a Pearson Product-Moment correlation $\rho = 0 . 9 5$ between the accuracy and AUROC, indicating a roughly linear relationship between the two metrics.
|
| 59 |
+
|
| 60 |
+
Discussion. To justify our findings theoretically, we look to the model calibration literature (Guo et al., 2017). Intuitively, model calibration aims to quantify whether the model ‘knows when it doesn’t know’, in that low confidence predictions are correlated with high error rates. Specifically, assume a classifier, $f ( \mathbf { x } )$ , returns probabilities for each class, making predictions as ${ \hat { y } } = \arg \operatorname* { m a x } f ( \mathbf { x } )$ .
|
| 61 |
+
|
| 62 |
+

|
| 63 |
+
Figure 3: (a) Open-set results on a range of architectures on the ImageNet dataset. ‘Easy’ and ‘Hard’ OSR splits are constructed from the ImageNet-21K-P dataset. (b) ImageNet open-set results within a single model family (ResNet).
|
| 64 |
+
|
| 65 |
+
Further assume labelled input-output pairs, $( \mathbf { x } , y ) \subset \mathcal { X } \times \mathcal { C }$ , where $\mathcal { C }$ is the label space. Then, the classifier is said to be perfectly calibrated if:
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
P ( \hat { y } = y | f ( x ) = p ) = p \quad \forall p \in [ 0 , 1 ]
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
It is further true that if a classifier is trained with a proper scoring rule (Gneiting et al., 2007) on infinite data, then the classifier will be perfectly calibrated at the loss function’s minimum (Minderer et al., 2021). Many losses used to train deep networks are proper scoring rules (e.g., the cross-entropy loss). Thus, assuming that generalization error on the test set is correlated with the infinite-data loss value, we would suspect models with lower generalization (test) error to be better calibrated. If we use low-confidence predictions as an indicator that a test sample belongs to a new semantic class, we would expect stronger models to be better open-set detectors.
|
| 72 |
+
|
| 73 |
+
# 3.2 LARGE-SCALE EXPERIMENTS AND ARCHITECTURE ABLATION
|
| 74 |
+
|
| 75 |
+
So far, we have demonstrated the correlation between closed and open-set performance on a single, lightweight architecture and on small scale datasets – though we highlight that they are the standard existing benchmarks in the OSR literature. Here, we experiment with a range of architectures on a large-scale dataset (ImageNet).
|
| 76 |
+
|
| 77 |
+
Methods. We experiment with architectures from a number of popular model families, including VGG (Simonyan & Zisserman, 2015), ResNet (He et al., 2016) and EfficientNet (Tan & Le, 2019). We further include results for the recently proposed non-convolutional ViT (Dosovitskiy et al., 2021) and MLP-Mixer (Tolstikhin et al., 2021; Melas-Kyriazi, 2021) models. All models were trained with the cross-entropy objective for classification.
|
| 78 |
+
|
| 79 |
+
Dataset. For large-scale evaluation, we leverage the recently released ImageNet-21K-P (Ridnik et al., 2021). This dataset contains a subset of the full ImageNet database, processed and standardized to remove small classes and leaving around 11K object categories. Note that ImageNet-21K-P is a strict superset of ImageNet-1K (ILSVRC12). As such, models are trained on the standard 1000 classes from ImageNet-1K, and we select two 1000-category subsets from the disjoint categories in ImageNet-21K-P as the open sets. Differently to existing practise on the standard datasets, our two open-set splits for ImageNet are not randomly sampled, but rather designed to be ‘Easy’ and ‘Hard’ based on the semantic similarity of the open-set categories to the training classes. In this way we better capture a model’s ability to identify semantic novelty as opposed to low-level distributional shift. This idea and split construction details are expanded upon in sec. 5. For both ‘Easy’ and ‘Hard’ splits, we have $\vert \mathcal { C } \vert = 1 0 0 0$ and $| \mathcal { U } | = 1 0 0 0$ .
|
| 80 |
+
|
| 81 |
+
Results. Fig. 3a shows our open-set results on ImageNet. Once again, we find a positive correlation between closed and open-set performance. In this case we find the linear relationship to be weaker, with $\rho = 0 . 8 8$ for the ‘Hard’ evaluation and $\rho = 0 . 6 3$ for the ‘Easy’. This is unsurprising given the large discrepancy in architecture styles. In general, we do not find any particular model family to be remarkably better for OSR than others. The exception is the ViT model (highlighted), which bucks the OSR trend for both ‘Easy’ and ‘Hard’ splits. When looking within a single model family, we find the linear relationship to be substantially strengthened. Fig. 3b demonstrates the trend within the ResNet family, with $\rho = 1 . 0 0$ and $\rho = 0 . 9 9$ for the ‘Easy’ and ‘Hard’ OSR splits respectively.
|
| 82 |
+
|
| 83 |
+
Discussion. We again note that the ViT model, despite its size (86M parameters) and few inductive biases (no convolutions), does not overfit its representation to the training classes. The fact that it outperforms the OSR trend supports recent findings on the benefits of purely attention-based vision models (including similar findings in (Fort et al., 2021)), as well as the benefits of good closed-set performance for OSR. Finally, we note the practical utility of our findings in sec. 3. Namely, the fact that the open and closed-set performance are correlated allows OSR to readily improve with the extensive research in standard image recognition.
|
| 84 |
+
|
| 85 |
+
# 4 A GOOD CLOSED-SET CLASSIFIER IS ALL YOU NEED?
|
| 86 |
+
|
| 87 |
+
In this section, we demonstrate that we can leverage the correlation established in sec. 3 to improve the performance of the baseline OSR method. Specifically, we improve the closed-set accuracy of the maximum softmax probability (MSP) baseline and, in doing so, make it competitive with or stronger than state-of-the-art open-set models. Specifically, we achieve new state-of-the-art figures on four of the six OSR benchmarks.
|
| 88 |
+
|
| 89 |
+
We find that we can significantly improve the MSP baseline performance by leveraging techniques from the image recognition literature, such as longer training, better augmentations (Cubuk et al., 2020) and label smoothing (Szegedy et al., 2016). Fig. 4 shows how open-set performance of the baseline model increases as we introduce these changes on the TinyImageNet benchmark. For example: longer training (scatter point 7 - scatter point 8); better augmentations $( 3 \textrm { - } 5 )$ ; and ensembling (8 - 9). Full details and a tabular breakdown of the methods used to increase closed-set performance can be found in appendix C.
|
| 90 |
+
|
| 91 |
+
We take these improved training strategies and train the VGG32 backbone on the standard benchmark datasets. We train all models for 600 epochs with a batch size of 128, training models on a single NVIDIA Titan X GPU. We do not include ensemble results for fair comparison with previous methods. Full training strategies and implementation details can be found in appendices C and D. We report our results as ‘Baseline $\mathrm { ( M S P + ) }$ ’ in table 1.
|
| 92 |
+
|
| 93 |
+

|
| 94 |
+
Figure 4: Gains in open-set performance as closed-set performance increases on TinyImageNet.
|
| 95 |
+
|
| 96 |
+
Logit scoring rule. Next, we also change the open-set scoring rule. Previous work has noted that open-set examples tend to have lower feature norms than closed-set ones (Dhamija et al., 2018; Chen et al., 2021). As such, we propose the use of the maximum logit score (MLS) for the open-set scoring rule. Logits are the raw outputs of the final linear layer in a deep classifier, before the softmax operation normalizes these such that the outputs can be interpreted as a probability vector summing to one. As the softmax operation normalizes out much of the feature magnitude information present in the logits, we find logits lead to better open-set detection results. We provide a detailed analysis and discussion of this effect in appendix B. We further provide a more general study of the representations learned with cross-entropy models, including visualizations of the learned feature space. We present results of our maximum logit score baseline as ‘Baseline (MLS)’ in table 1.
|
| 97 |
+
|
| 98 |
+
We compare against OpenHybrid (Zhang et al., 2020) and $\mathrm { A R P L + C S }$ (Chen et al., 2021), which hold state-of-the-art performances on the standard datasets in the controlled setting (with no extra data for training or model selection). We also compare against OSRCI (Neal et al., 2018), which established the current OSR benchmark suite. While OSRCI and $\mathrm { A R P L + C S }$ have been described in sec. 2 and 3.1 respectively, OpenHybrid tackles the open-set task by training a flow-based density estimator on top of the classifier’s feature representation, jointly training both the encoder and density model. In this way, a distribution over the training data $\log p ( \mathbf { x } )$ is learned, which is used to directly provide $\boldsymbol { S } ( y \in \mathcal { C } | \mathbf { \bar { x } } )$ . Comparisons with more methods can be found in appendix E.
|
| 99 |
+
|
| 100 |
+
We find that our MLS baseline substantially improves the previously reported baseline figures, with an average absolute increase in AUROC of $1 5 . 6 \%$ across the datasets. In fact, MLS surpasses the existing state-of-the-art on the SVHN, $\mathrm { C I F A R { + } } 1 0$ , CIFAR $+ 5 0$ and TinyImageNet benchmarks and is, on average, $0 . 7 \%$ better across the entire suite.
|
| 101 |
+
|
| 102 |
+
Table 1: Comparisons of our improved baselines $\mathbf { ( M S P + }$ , MLS) against state-of-the-art methods on the standard OSR benchmark datasets. All results indicate the area under the ReceiverOperator curve (AUROC) averaged over five ‘known/unknown’ class splits. $\cdot _ { + } ,$ indicates prior methods augmented with improved closed-set optimization strategies, including: ${ \mathrm { { \bf { M S P } + } } }$ (Neal et al., 2018), ${ \mathrm { O S R C I } } +$ (Neal et al., 2018) and $( \mathrm { A R P L + C S } ) +$ (Chen et al., 2021).
|
| 103 |
+
|
| 104 |
+
<table><tr><td>Method</td><td>MNIST</td><td>SVHN</td><td>CIFAR10</td><td>CIFAR + 10</td><td>CIFAR +50</td><td>TinyImageNet</td></tr><tr><td>Baseline (MSP) (Neal et al.,2018)</td><td>97.8</td><td>88.6</td><td>67.7</td><td>81.6</td><td>80.5</td><td>57.7</td></tr><tr><td>OSRCI (Neal et al., 2018)</td><td>98.8</td><td>91.0</td><td>69.9</td><td>83.8</td><td>82.7</td><td>58.6</td></tr><tr><td>OpenHybrid (Zhang et al., 2020)</td><td>99.5</td><td>94.7</td><td>95.0</td><td>96.2</td><td>95.5</td><td>79.3</td></tr><tr><td>ARPL + CS (Chen et al., 2021)</td><td>99.7</td><td>96.7</td><td>91.0</td><td>97.1</td><td>95.1</td><td>78.2</td></tr><tr><td>OSRCI+</td><td>98.5 (-0.3)</td><td>89.9 (-1.1)</td><td>87.2 (+17.3)</td><td>91.1 (+7.3)</td><td>90.3 (+7.6)</td><td>62.6 (+4.0)</td></tr><tr><td>(ARPL + CS)+</td><td>99.2 (-0.5)</td><td>96.8 (+0.1)</td><td>93.9 (+2.9)</td><td>98.1 (+1.0)</td><td>96.7 (+1.6)</td><td>82.5 (+4.3)</td></tr><tr><td>Baseline (MSP+)</td><td>98.6 (+0.8)</td><td>96.0 (+7.4)</td><td>90.1 (+22.4)</td><td>95.6 (+14.0)</td><td>94.0 (+13.5)</td><td>82.7 (+25.0)</td></tr><tr><td>Baseline (MLS)</td><td>99.3 (+1.5)</td><td>97.1 (+8.5)</td><td>93.6 (+25.9)</td><td>97.9 (+16.3)</td><td>96.5 (+16.0)</td><td>83.0 (+25.3)</td></tr></table>
|
| 105 |
+
|
| 106 |
+
We also take the OSRCI and $\mathrm { A R P L + C S }$ algorithms (Neal et al., 2018; Chen et al., 2021), and augment them with our proposed training strategies for a fair comparison, reporting the results under ${ \mathrm { O S R C I } } +$ and $( \mathrm { A R P L } + \mathrm { C S } ) +$ . Specifically, we train them for longer, include label smoothing and use better data augmentations (see appendix D for full details). We also trained OpenHybrid in this controlled setting, but significantly underperformed the reported performance. This is likely because the method was trained for $1 0 \mathrm { k }$ epochs and with a batch size of 1024, which are both $1 0 \times$ larger than those used in these experiments. Note that, despite this, the stronger baseline still outperforms OpenHybrid in a number of cases.
|
| 107 |
+
|
| 108 |
+
In almost all cases we are able to boost the open-set performance of OSRCI and $\mathrm { A R P L + C S }$ , especially for the former. In the case of $( \mathrm { A R P L + C S } ) +$ , we achieve new state-of-the-art results on the $\mathrm { C I F A R { + } } 1 0$ and $\mathrm { C I F A R } { + } 5 0$ benchmarks, and also report a $4 . 3 \%$ boost on TinyImageNet. However, we note that on average, $( \mathrm { A R P L + C S } ) +$ is almost indistinguishable from the improved MLS baseline (with $0 . 0 3 \%$ difference in average open-set performance).
|
| 109 |
+
|
| 110 |
+
Discussion. A number of increasingly sophisticated methods have been proposed for OSR in recent years. Typically, proposed methods have carefully tuned training strategies and hyper-parameters, such as custom learning rate schedules (Zhang et al., 2020), non-standard backbones (Guo et al., 2021) and novel data augmentations (Zhou et al., 2021). Meanwhile, the closed-set accuracy of the methods is often unreported. As such, it is difficult to delineate what proportion of the open-set performance gains come from increases in closed-set accuracy. Our findings in this section suggest that many of the gains could equally be realised through the standard baseline. Indeed, in sec. 5, we propose new evaluation protocols and find that once the closed-set accuracy of ARPL and the baseline are made comparable, there is negligible difference in open-set performance. We further experiment on OoD benchmarks in appendix F and report similarly improved baseline performance.
|
| 111 |
+
|
| 112 |
+
# 5 SEMANTIC SHIFT BENCHMARK
|
| 113 |
+
|
| 114 |
+
Current OSR benchmarks have two drawbacks: (1) they all involve small scale datasets; (2) they lack a clear definition of what constitutes a ‘semantic class’. The latter is important to delineate the open-set field from other research questions such as out-of-distribution detection (Hendrycks & Gimpel, 2017) and anomaly detection (Kwon et al., 2020). Specifically, OSR aims to identify whether a test image is semantically different to the training classes, not whether, for example, the model is uncertain about its prediction or whether there has been a low-level distributional shift.
|
| 115 |
+
|
| 116 |
+
To address these issues, we propose a new suite of evaluation benchmarks. In this section, we first detail a large-scale ImageNet evaluation (introduced in sec. 3.2) before proposing three evaluations on fine-grained datasets which have clear definitions of a semantic class. Differently to previous work, our evaluation settings all aim to explicitly capture the notion of semantic novelty. Finally, we benchmark MLS and ARPL on the new benchmark suite to motivate future research.
|
| 117 |
+
|
| 118 |
+
# 5.1 PROPOSED BENCHMARK DATATSETS
|
| 119 |
+
|
| 120 |
+
ImageNet. We introduce a large-scale evaluation for category shift, with open-set splits based on semantic distances to the training set. Specifically, we designate the original ImageNet-1K classes for the closed-set, and choose open-set classes from the disjoint set of ImageNet-21K-P (Ridnik et al., 2021). We exploit the hierarchical, tree-like semantic structure of the ImageNet database. For instance, the class ‘elephant’ can be labelled at multiple levels of semantic abstraction (‘elephant’, ‘placental’, ‘mammal’, ‘vertebrate’, ‘animal’). Thus, for each pair of classes between ImageNet-1K and ImageNet-21K-P, we define the semantic distance between two classes as the total path distance between their nodes in the semantic tree. We then approximate the total semantic distance from the ImageNet-21K-P classes to the closed-set by summing distances to all ImageNet-1K classes. Finally, we select ‘Easy’ and ‘Hard’ open-set splits by sorting the total distances to the closed-set and selecting two sets of 1000 categories. We note that the larger ImageNet database has been used for OSR research previously (Bendale & Boult, 2016; Kumar et al., 2021; Hendrycks et al., 2021). However, we structure explicitly for semantic similarity with ImageNet-1K similarly to concurrent work in (Sariyildiz et al., 2021).
|
| 121 |
+
|
| 122 |
+

|
| 123 |
+
Figure 5: Open-set class pairs for CUB. For three difficulties {‘Easy’ (green/left), ‘Medium’ (orange/middle), ‘Hard’ (red/right)}, we show an image from an open-set class (right) and its most similar closed-set class (left). Note that the harder the difficulty, the more visual features (e.g., foot colour or bill shape) the open-set class has in common with the closed-set. Further examples can be found in appendix H.
|
| 124 |
+
|
| 125 |
+
Fine-grained classification datasets. Consider the properties of fine-grained visual categorization (FGVC) datasets. These datasets are defined by an ‘entry level’ category, such as flowers (Nilsback & Zisserman, 2008) or birds (Wah et al., 2011). Within the dataset, all classes are variants of that single category, defining a single axis of semantic variation, e.g., ‘bird species’ in the case of birds. Because the axis of variation is well defined, it is reasonable to expect a classifier to learn it given a number of example classes — namely, to learn what bird species are and how they can be distinguished.
|
| 126 |
+
|
| 127 |
+
Contrast FGVC datasets with the current OSR benchmarks, such as the $\mathrm { C I F A R { + } } 1 0$ evaluation. In this case, a model is trained on four CIFAR10 classes such as {airplane, automobile, ship, truck}, all of which could be considered ‘entry level’, before having to identify images from CIFAR100 classes such as {bicycle, bee, porcupine, baby} as belonging to new classes. In this case, the axis of variation is much less specific, and it is uncertain whether the OSR model is responding to a true semantic signal or simply to low-level distributional shifts in the ‘unseen’ data. Furthermore, because of the small number of training classes in the current benchmark settings, it is unrealistic for a classifier to learn such high-level class definitions. We give an illustrative example of this in appendix G.
|
| 128 |
+
|
| 129 |
+
As a result, we propose three FGVC datasets for OSR evaluation: Caltech-UCSD Birds (CUB) (Wah et al., 2011), Stanford Cars (Krause et al., 2013) FGVC-Aircraft (Maji et al., 2013). These datasets come with labelled attributes (e.g., has_bill_shape::hooked in CUB), which can be used to characterize the differences between classes and thus the degree of semantic shift. We use attributes to construct open-set FGVC class splits which are binned into ‘Easy’, ‘Medium’ and ‘Hard’ classes, with the difficulty depending on the similarity of labelled visual attributes with any of the training classes. We sketch the split-construction process for CUB here, and refer to appendix H for more details on Stanford Cars and FGVC-Aircraft.
|
| 130 |
+
|
| 131 |
+
Every image in CUB is labelled for the presence of 312 visual attributes such as has_bill_shape::hooked and has_breast_color::yellow. This information is aggregated for each class, resulting in a matrix $M \in [ 0 , \bar { 1 } ] ^ { C \times A }$ , describing the frequency with which each attribute appears in each class.
|
| 132 |
+
|
| 133 |
+
Table 2: Statistics of the Semantic Shift Benchmark. We show ‘#Classes(#Test Images)’ for the known classes, and for the ‘Easy’, ‘Medium’ and ‘Hard’ open-set classes.
|
| 134 |
+
|
| 135 |
+
<table><tr><td>Dataset</td><td>Known</td><td>|Easy</td><td>Medium</td><td>Hard</td></tr><tr><td>CUB</td><td>100 (2884)</td><td>32 (915)</td><td>34 (1004)</td><td>34 (991)</td></tr><tr><td>Stanford Cars</td><td>98 (3948)</td><td>76 (3170)</td><td></td><td>22 (923)</td></tr><tr><td>FGVC-Aircraft</td><td>50(1668)</td><td>20 (667)</td><td>17 (565)</td><td>13 (433)</td></tr><tr><td>ImageNet</td><td>1000 (50000)</td><td>1000 (50000)</td><td></td><td>1000 (50000)</td></tr></table>
|
| 136 |
+
|
| 137 |
+
Treating each row in $M$ as a semantic class descriptor, this allows us to compute the semantic similarity of every pair of classes and, given a set of closed-set classes, identify which remaining classes are ‘Easy’, ‘Medium’ and ‘Hard’ (least to most similar) with respect to the closed-set. Examples of ‘Easy’, ‘Medium’ and ‘Hard’ open-set classes, along with their closest class in the closed-set, are shown in fig. 5 for CUB.
|
| 138 |
+
|
| 139 |
+
We note that fine-grained OSR has been demonstrated in (Chen et al., 2021; 2020a) on a dataset of 300 aircraft classes. However, this dataset does not come with labelled attributes, making it harder to construct open-set splits with varying levels of semantic similarity to the training set, which is our focus here. Finally, while prior works have recognised the difficulty of OoD detection for more fine-grained data (Bodesheim et al., 2015; Perera & Patel, 2019; Lee et al., 2018a), we propose them for OSR because of their clear definition of a semantic class rather than their increased difficulty. A further discussion of these ideas is presented in appendix G. We provide statistics of the splits from all proposed datasets in table 2, and the splits themselves in the supplementary material.
|
| 140 |
+
|
| 141 |
+
# 5.2 BENCHMARKING FOR OPEN-SET RECOGNITION
|
| 142 |
+
|
| 143 |
+
Evaluation Protocol. For the ‘known/unknown’ class decision, we report AUROC as is standard practise, as well as accuracy to allow potential gains in open-set performance to be contextualized in the closed-set accuracy of a model. We also report Open-Set Classification Rate (OSCR) (Dhamija et al., 2018) which measures the trade-off between accuracy and open-set detection rate as a threshold on the confidence of the predicted class is varied. We report results on ‘Easy’ and ‘Hard’ splits for all datasets, combining ‘Medium’ and ‘Hard’ examples into a single bin when applicable.
|
| 144 |
+
|
| 145 |
+
In fine-grained classification, it is standard to pre-train models on ImageNet. This is unsuitable for the proposed fine-grained OSR setting, as ImageNet contains overlapping classes with the proposed datasets. Instead, we pre-train the network on Places (Zhou et al., 2017) using MoCoV2 selfsupervised weights (Chen et al., 2020b; Zhao et al., 2021). For the ImageNet benchmark, we can train with labels on the ImageNet-1K dataset and evaluate on the unseen classes. We finetune the ARPL model from a pre-trained ImageNet checkpoint.
|
| 146 |
+
|
| 147 |
+
Results. In table 3 we test MLS and $\mathrm { { A R P L + } }$ (Chen et al., 2021) using a ResNet50 backbone on the proposed benchmarks (we found $\mathrm { A R P L + C S }$ to be prohibitively expensive to train in this setting, see appendix $\supset$ for details). The results corroborate the trends found in sec. 4: strong closed-set classifiers produce open-set results with good AUROC performance, and the MLS baseline performs comparably to the state-of-the-art method. In fact, while we find $\mathrm { \ A R P L + }$ achieves slightly better AUROC on the ImageNet benchmark, MLS outperforms in terms of OSCR across the board.
|
| 148 |
+
|
| 149 |
+
Finally, more careful consideration of the semantics of the open-set classes leads to harder splits significantly reducing OSR performance. This is in contrast to ‘openness’ (Scheirer et al., 2013), the current measure used to assess the difficulty of an OSR problem, dependent on the ratio of the number of closed to open-set classes. For instance, in the ImageNet case, we find the harder split to be lead to around $6 \%$ worse AUROC for both methods. We also experimented with randomly subsampling first 1K and then 10K open-set classes, finding that introducing more classes during evaluation only reduced open-set performance by around $0 . 6 \%$ ( $1 0 \times$ less than our proposed splits).
|
| 150 |
+
|
| 151 |
+
Table 3: OSR results on the Semantic Shift Benchmark. We measure the closed-set classification accuracy and AUROC on the binary open-set decision. We also report OSCR, which measures the trade-off between open and closed-set performance. OSR results are shown on ‘Easy / Hard’ splits.
|
| 152 |
+
|
| 153 |
+
<table><tr><td rowspan="2">Method</td><td colspan="3">CUB</td><td colspan="3">SCars</td><td colspan="3">FGVC-Aircraft</td><td colspan="3">ImageNet</td></tr><tr><td>Acc.</td><td>AUROC</td><td>OSCR</td><td>Acc.</td><td>AUROC</td><td>OSCR</td><td>Acc.</td><td>AUROC</td><td>OSCR</td><td>Acc.</td><td>AUROC</td><td>OSCR</td></tr><tr><td>ARPL+</td><td>85.9</td><td>83.5/75.5</td><td>76.0 / 69.6</td><td>96.9</td><td>94.8 /83.6</td><td>92.8 /82.3</td><td>91.5</td><td>87.0/77.7</td><td>83.3/74.9</td><td>78.1</td><td>79.0/73.6</td><td>65.9 / 62.6</td></tr><tr><td>MLS</td><td>86.2</td><td>88.3/79.3</td><td>79.8/73.1</td><td>97.1</td><td>94.0 /82.2</td><td>92.2/81.1</td><td>91.7</td><td>90.7/82.3</td><td>86.8 /79.8</td><td>78.8</td><td>78.2 /72.6</td><td>66.1/62.7</td></tr></table>
|
| 154 |
+
|
| 155 |
+
# 6 CONCLUSION
|
| 156 |
+
|
| 157 |
+
In this work we have demonstrated a strong correlation between the closed-set and open-set performance of models for the task of open-set recognition. Leveraging this finding, we have demonstrated that a well-trained closed-set classifier, using the maximum logit score (MLS) at test-time, can be competitive with or outperform existing state-of-the-art methods. Though we believe OSR is a critical problem which requires further investigation, our findings give us insufficient evidence to reject our titular question of ‘is a good closed-set classifier all you need?’. We have also proposed the ‘Semantic Shift Benchmark’ suite, which isolates semantic shift from other low-level distributional shifts. Our proposed benchmark suite allows controlled study of semantic novelty, including stratification of the degree of semantic shift.
|
| 158 |
+
|
| 159 |
+
# ACKNOWLEDGEMENTS
|
| 160 |
+
|
| 161 |
+
We would like to thank Andrew Brown for many interesting discussions on this work. This research is funded by a Facebook AI Research Scholarship, a Royal Society Research Professorship, and the EPSRC Programme Grant VisualAI EP/T028572/1.
|
| 162 |
+
|
| 163 |
+
# ETHICS STATEMENT
|
| 164 |
+
|
| 165 |
+
Open-set recognition is of immediate relevance to the safe and ethical deployment of machine learning models. In real-world settings, it is unrealistic to expect that all categories of interest to the user will be represented in the training set. For instance, in an autonomous driving scenario, forcing the model to identify every object as an instance of a training category could lead it to make unsafe decisions.
|
| 166 |
+
|
| 167 |
+
When considering potential negative societal impacts of this work, we identify the possibility that OSR research may lead to complacent consideration of the training data. As we have demonstrated, OSR models are far from perfect and cannot be exclusively relied upon in practical deployment. As such, it remains of critical importance to carefully curate training data and ensure its distribution is representative of the target task.
|
| 168 |
+
|
| 169 |
+
Finally, we comment on the dataset privacy considerations for the existing and proposed benchmarks. All datasets are licensed for academic/non-commercial research. However, CIFAR, TinyImageNet and ImageNet contain some personal data for which consent was likely not obtained. The proposed FGVC datasets have the added benefit of containing no personal information.
|
| 170 |
+
|
| 171 |
+
# REFERENCES
|
| 172 |
+
|
| 173 |
+
Davide Abati, Angelo Porrello, Simone Calderara, and Rita Cucchiara. Latent space autoregression for novelty detection. In CVPR, 2019.
|
| 174 |
+
|
| 175 |
+
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. arXiv preprint arXiv:2103.07579, 2021.
|
| 176 |
+
|
| 177 |
+
Abhijit Bendale and Terrance E. Boult. Towards open set deep networks. In CVPR, 2016.
|
| 178 |
+
|
| 179 |
+
Liron Bergman and Yedid Hoshen. Classification-based anomaly detection for general data. In ICLR, 2020.
|
| 180 |
+
|
| 181 |
+
Paul Bodesheim, Alexander Freytag, Erik Rodner, and Joachim Denzler. Local novelty detection in multi-class recognition problems. In WACV, 2015.
|
| 182 |
+
|
| 183 |
+
Terrance E. Boult, Steve Cruz, Akshay Raj Dhamija, Manuel Günther, James Henrydoss, and Walter J. Scheirer. Learning and the unknown: Surveying steps toward open world recognition. In AAAI, 2019.
|
| 184 |
+
|
| 185 |
+
Guangyao Chen, Limeng Qiao, Yemin Shi, Peixi Peng, Jia Li, Tiejun Huang, Shiliang Pu, and Yonghong Tian. Learning open set network with discriminative reciprocal points. In ECCV, 2020a.
|
| 186 |
+
|
| 187 |
+
Guangyao Chen, Peixi Peng, Xiangqian Wang, and Yonghong Tian. Adversarial reciprocal points learning for open set recognition. IEEE TPAMI, 2021.
|
| 188 |
+
|
| 189 |
+
Xinlei Chen, Haoqi Fan, Ross Girshick, and Kaiming He. Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297, 2020b.
|
| 190 |
+
|
| 191 |
+
M. Cimpoi, S. Maji, I. Kokkinos, S. Mohamed, , and A. Vedaldi. Describing textures in the wild. In CVPR, 2014.
|
| 192 |
+
|
| 193 |
+
Ekin Dogus Cubuk, Barret Zoph, Jon Shlens, and Quoc Le. Randaugment: Practical automated data augmentation with a reduced search space. In NeurIPS, 2020.
|
| 194 |
+
|
| 195 |
+
Akshay Raj Dhamija, Manuel Günther, and Terrance E. Boult. Reducing network agnostophobia. In NeurIPS, 2018.
|
| 196 |
+
|
| 197 |
+
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.
|
| 198 |
+
|
| 199 |
+
Xuefeng Du, Zhaoning Wang, Mu Cai, and Yixuan Li. Vos: Learning what you don’t know by virtual outlier synthesis. ICLR, 2022.
|
| 200 |
+
|
| 201 |
+
Stanislav Fort, Jie Ren, and Balaji Lakshminarayanan. Exploring the limits of out-of-distribution detection. ICML Workshop on Uncertainty & Robustness in Deep Learning, 2021.
|
| 202 |
+
|
| 203 |
+
Zongyuan Ge, Sergey Demyanov, and Rahil Garnavi. Generative openmax for multi-class open set classification. In BMVC, 2017.
|
| 204 |
+
|
| 205 |
+
Tilmann Gneiting, Fadoua Balabdaoui, and Adrian E. Raftery. Probabilistic forecasts, calibration and sharpness. Journal of the Royal Statistical Society, 2007.
|
| 206 |
+
|
| 207 |
+
Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q. Weinberger. On calibration of modern neural networks. ICML, 2017.
|
| 208 |
+
|
| 209 |
+
Yunrui Guo, Guglielmo Camporese, Wenjing Yang, Alessandro Sperduti, and Lamberto Ballan. Conditional variational capsule network for open set recognition. ICCV, 2021.
|
| 210 |
+
|
| 211 |
+
Kai Han, Andrea Vedaldi, and Andrew Zisserman. Learning to discover novel visual categories via deep transfer clustering. In ICCV, 2019.
|
| 212 |
+
|
| 213 |
+
Kai Han, Sylvestre-Alvise Rebuffi, Sebastien Ehrhardt, Andrea Vedaldi, and Andrew Zisserman. Automatically discovering and learning new visual categories with ranking statistics. In ICLR, 2020.
|
| 214 |
+
|
| 215 |
+
Kai Han, Sylvestre-Alvise Rebuffi, Sebastien Ehrhardt, Andrea Vedaldi, and Andrew Zisserman. Autonovel: Automatically discovering and learning novel visual categories. IEEE TPAMI, 2021.
|
| 216 |
+
|
| 217 |
+
Kaiming He, X. Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
|
| 218 |
+
|
| 219 |
+
Dan Hendrycks and Kevin Gimpel. A baseline for detecting misclassified and out-of-distribution examples in neural networks. In ICLR, 2017.
|
| 220 |
+
|
| 221 |
+
Dan Hendrycks, Mantas Mazeika, and Thomas Dietterich. Deep anomaly detection with outlier exposure. In ICLR, 2019.
|
| 222 |
+
|
| 223 |
+
Dan Hendrycks, Kevin Zhao, Steven Basart, Jacob Steinhardt, and Dawn Song. Natural adversarial examples. CVPR, 2021.
|
| 224 |
+
|
| 225 |
+
Yen-Chang Hsu, Yilin Shen, Hongxia Jin, and Zsolt Kira. Generalized odin: Detecting out-ofdistribution image without learning from out-of-distribution data. In CVPR, 2020.
|
| 226 |
+
|
| 227 |
+
Shu Kong and Deva Ramanan. Opengan: Open-set recognition via open data generation. ICCV, 2021.
|
| 228 |
+
|
| 229 |
+
Jonathan Krause, Michael Stark, Jia Deng, and Li Fei-Fei. 3d object representations for fine-grained categorization. In International IEEE Workshop on 3D Representation and Recognition (3dRR), 2013.
|
| 230 |
+
|
| 231 |
+
Alex Krizhevsky. Learning multiple layers of features from tiny images. University of Toronto, 2009.
|
| 232 |
+
|
| 233 |
+
Pulkit Kumar, Anubhav, Abhinav Shrivastava, and Shu Kong. Open world vision challenge. CVPR Workshop on Open World Vision, 2021.
|
| 234 |
+
|
| 235 |
+
Gukyeong Kwon, Mohit Prabhushankar, Dogancan Temel, and Ghassan AlRegib. Backpropagated gradient representations for anomaly detection. In ECCV, 2020.
|
| 236 |
+
|
| 237 |
+
Ya Le and Xuan Yang. Tiny imagenet visual recognition challenge. In CS231N, 2015.
|
| 238 |
+
|
| 239 |
+
Yann LeCun, Corinna Cortes, and CJ Burges. Mnist handwritten digit database. ATT Labs [Online]. Available: http://yann.lecun.com/exdb/mnist, 2010.
|
| 240 |
+
|
| 241 |
+
Kibok Lee, Kimin Lee, Kyle Min, Yuting Zhang, Jinwoo Shin, and Honglak Lee. Hierarchical novelty detection for visual object recognition. In CVPR, 2018a.
|
| 242 |
+
|
| 243 |
+
Kimin Lee, Kibok Lee, Honglak Lee, and Jinwoo Shin. A simple unified framework for detecting out-of-distribution samples and adversarial attacks. NeurIPS, 2018b.
|
| 244 |
+
|
| 245 |
+
Shiyu Liang, Yixuan Li, and Rayadurgam Srikant. Enhancing the reliability of out-of-distribution image detection in neural networks. In ICLR, 2018.
|
| 246 |
+
|
| 247 |
+
Sungbin Lim, Ildoo Kim, Taesup Kim, Chiheon Kim, and Sungwoong Kim. Fast autoaugment. In NeurIPS, 2019.
|
| 248 |
+
|
| 249 |
+
Weitang Liu, Xiaoyun Wang, John Owens, and Yixuan Li. Energy-based out-of-distribution detection. NeurIPS, 2020.
|
| 250 |
+
|
| 251 |
+
Ilya Loshchilov and Frank Hutter. SGDR: stochastic gradient descent with warm restarts. In ICLR, 2017.
|
| 252 |
+
|
| 253 |
+
Subhransu Maji, Esa Rahtu, Juho Kannala, Matthew Blaschko, and Andrea Vedaldi. Fine-grained visual classification of aircraft. arXiv preprint arXiv:1306.5151, 2013.
|
| 254 |
+
|
| 255 |
+
Luke Melas-Kyriazi. Do you even need attention? a stack of feed-forward layers does surprisingly well on imagenet. ArXiv e-prints, 2021.
|
| 256 |
+
|
| 257 |
+
Dimity Miller, Niko Sünderhauf, Michael Milford, and Feras Dayoub. Class anchor clustering: a distance-based loss for training open set classifiers. In WACV, 2021.
|
| 258 |
+
|
| 259 |
+
Matthias Minderer, Josip Djolonga, Rob Romijnders, Frances Hubis, Xiaohua Zhai, Neil Houlsby, Dustin Tran, and Mario Lucic. Revisiting the calibration of modern neural networks. ArXiv e-prints, 2021.
|
| 260 |
+
|
| 261 |
+
Lawrence Neal, Matthew Olson, Xiaoli Fern, Weng-Keen Wong, and Fuxin Li. Open set learning with counterfactual images. In ECCV, 2018.
|
| 262 |
+
|
| 263 |
+
Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y. Ng. Reading digits in natural images with unsupervised feature learning. In NeurIPS Workshop on Deep Learning and Unsupervised Feature Learning, 2011.
|
| 264 |
+
|
| 265 |
+
Maria-Elena Nilsback and Andrew Zisserman. Automated flower classification over a large number of classes. In Proceedings of the Indian Conference on Computer Vision, Graphics and Image Processing, 2008.
|
| 266 |
+
|
| 267 |
+
Poojan Oza and Vishal M. Patel. C2ae: Class conditioned auto-encoder for open-set recognition. In CVPR, 2019.
|
| 268 |
+
|
| 269 |
+
Pramuditha Perera and Vishal M. Patel. Deep transfer learning for multiple class novelty detection. In CVPR, 2019.
|
| 270 |
+
|
| 271 |
+
Pramuditha Perera, Ramesh Nallapati, and Bing Xiang. Ocgan: One-class novelty detection using gans with constrained latent representations. In CVPR, 2019.
|
| 272 |
+
|
| 273 |
+
Pramuditha Perera, Vlad I. Morariu, Rajiv Jain, Varun Manjunatha, Curtis Wigington, Vicente Ordonez, and Vishal M. Patel. Generative-discriminative feature representations for open-set recognition. In CVPR, 2020.
|
| 274 |
+
|
| 275 |
+
Rajeev Ranjan, Carlos Domingo Castillo, and Rama Chellappa. L2-constrained softmax loss for discriminative face verification. arXiv preprint arXiv:1703.09507, 2017.
|
| 276 |
+
|
| 277 |
+
Benjamin Recht, Rebecca Roelofs, Ludwig Schmidt, and Vaishaal Shankar. Do imagenet classifiers generalize to imagenet? In ICML, 2019.
|
| 278 |
+
|
| 279 |
+
Tal Ridnik, Emanuel Ben-Baruch, Asaf Noy, and Lihi Zelnik-Manor. Imagenet-21k pretraining for the masses. ArXiv e-prints, 2021.
|
| 280 |
+
|
| 281 |
+
Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. IJCV, 2015.
|
| 282 |
+
|
| 283 |
+
Mert Bulent Sariyildiz, Yannis Kalantidis, Diane Larlus, and Karteek Alahari. Concept generalization in visual representation learning. In ICCV, 2021.
|
| 284 |
+
|
| 285 |
+
Walter J. Scheirer, Anderson Rocha, Archana Sapkota, and Terrance E. Boult. Towards open set recognition. IEEE TPAMI, 2013.
|
| 286 |
+
|
| 287 |
+
Yu Shu, Yemin Shi, Yaowei Wang, Tiejun Huang, and Yonghong Tian. P-odn: Prototype-based open deep network for open set recognition. Scientific Reports, 2020.
|
| 288 |
+
|
| 289 |
+
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015.
|
| 290 |
+
|
| 291 |
+
Xin Sun, Zhenning Yang, Chi Zhang, Guohao Peng, and Keck-Voon Ling. Conditional gaussian distribution learning for open set recognition. In CVPR, 2020.
|
| 292 |
+
|
| 293 |
+
Xin Sun, Chi Zhang, Guosheng Lin, and Keck-Voon Ling. Open set recognition with conditional probabilistic generative models. arXiv preprint arXiv:2008.05129, 2021.
|
| 294 |
+
|
| 295 |
+
Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jonathon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In CVPR, 2016.
|
| 296 |
+
|
| 297 |
+
Jihoon Tack, Sangwoo Mo, Jongheon Jeong, and Jinwoo Shin. Csi: Novelty detection via contrastive learning on distributionally shifted instances. In NeurIPS, 2020.
|
| 298 |
+
|
| 299 |
+
Mingxing Tan and Quoc V. Le. Efficientnet: Rethinking model scaling for convolutional neural networks. ICML, 2019.
|
| 300 |
+
|
| 301 |
+
Ilya O. Tolstikhin, Neil Houlsby, Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Thomas Unterthiner, Jessica Yung, Andreas Steiner, Daniel Keysers, Jakob Uszkoreit, Mario Lucic, and Alexey Dosovitskiy. Mlp-mixer: An all-mlp architecture for vision. In arXiv, 2021.
|
| 302 |
+
|
| 303 |
+
Antonio Torralba, Rob Fergus, and William T. Freeman. 80 million tiny images: A large data set for nonparametric object and scene recognition. IEEE TPAMI, 2008.
|
| 304 |
+
|
| 305 |
+
Catherine Wah, Steve Branson, Peter Welinder, Pietro Perona, and Serge Belongie. The CaltechUCSD Birds-200-2011 Dataset. Technical Report CNS-TR-2011-001, California Institute of Technology, 2011.
|
| 306 |
+
|
| 307 |
+
Ross Wightman. Pytorch image models. GitHub repository [Online]. Available: https://github.com/rwightman/pytorch-image-models, 2019.
|
| 308 |
+
|
| 309 |
+
Pingmei Xu, Krista A Ehinger, Yinda Zhang, Adam Finkelstein, Sanjeev R. Kulkarni, and Jianxiong Xiao. Turkergaze: Crowdsourcing saliency with webcam based eye tracking. ArXiv e-prints, 2015.
|
| 310 |
+
|
| 311 |
+
Ryota Yoshihashi, Wen Shao, Rei Kawakami, Shaodi You, Makoto Iida, and Takeshi Naemura. Classification-reconstruction learning for open-set recognition. In CVPR, 2019.
|
| 312 |
+
|
| 313 |
+
Fisher Yu, Yinda Zhang, Shuran Song, Ari Seff, and Jianxiong Xiao. Lsun: Construction of a large-scale image dataset using deep learning with humans in the loop. ArXiv e-prints, 2015.
|
| 314 |
+
|
| 315 |
+
Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. In ICLR, 2017.
|
| 316 |
+
|
| 317 |
+
Hongjie Zhang, Ang Li, Jie Guo, and Yanwen Guo. Hybrid models for open set recognition. In ECCV, 2020.
|
| 318 |
+
|
| 319 |
+
Nanxuan Zhao, Zhirong Wu, Rynson W.H. Lau, and Stephen Lin. What makes instance discrimination good for transfer learning? In ICLR, 2021.
|
| 320 |
+
|
| 321 |
+
Bolei Zhou, Agata Lapedriza, Aditya Khosla, Aude Oliva, and Antonio Torralba. Places: A 10 million image database for scene recognition. In IEEE TPAMI, 2017.
|
| 322 |
+
|
| 323 |
+
Da-Wei Zhou, Han-Jia Ye, and De-Chuan Zhan. Learning placeholders for open-set recognition. In CVPR, 2021.
|
| 324 |
+
|
| 325 |
+
# A EXPANSION OF FIG. 2 OF THE MAIN PAPER WITH STANDARD DEVIATIONS
|
| 326 |
+
|
| 327 |
+
For completeness, we include another version of fig. 2 which includes OSRCI models (Neal et al., 2018) in fig. 6. We find the correlation between the closed and open-set performance continues to hold with the inclusion of this additional method. We further report the standard deviations of this plot in table 4. It can be seen that, for the same dataset, the standard deviations of all four methods appear to be similar. The standard deviations on the most challenging TinyImageNet benchmark is greater than on the other datasets.
|
| 328 |
+
|
| 329 |
+
Finally, we note in fig. 6 that the trend seems less clear at very high accuracies. This may be because AUROC also becomes very high, making it difficult to identify clear patterns. However, it may also indicate that the relationship between the metrics becomes weaker as closed-set performance saturates.
|
| 330 |
+
|
| 331 |
+

|
| 332 |
+
Figure 6: Correlation between open-set and closed-set performances on the standard OSR benchmarks. This plot is similar to fig. 2 but includes scatter points for OSRCI (Neal et al., 2018).
|
| 333 |
+
|
| 334 |
+
Table 4: Standard deviations of our experiments in fig. 2 of the main paper. We report the standard deviations for both the closed-set and open-set performance (accuracy/AUROC) across the five ‘known/unknown’ class splits.
|
| 335 |
+
|
| 336 |
+
<table><tr><td>Method</td><td>MNIST</td><td>SVHN</td><td>CIFAR10</td><td>CIFAR + 50</td><td>TinyImageNet</td></tr><tr><td>MSP</td><td>0.20/1.29</td><td>0.36/0.55</td><td>1.64/1.34</td><td>0.79/1.23</td><td>4.83/1.36</td></tr><tr><td>OSRCI</td><td>0.22/0.52</td><td>0.47/2.97</td><td>1.99/1.80</td><td>0.63/1.47</td><td>3.27/3.02</td></tr><tr><td>ARPL</td><td>0.21/0.77</td><td>0.43/0.79</td><td>2.10/1.56</td><td>0.66/0.44</td><td>5.40/1.63</td></tr><tr><td>ARPL + CS</td><td>0.29/1.04</td><td>0.51/0.31</td><td>1.70/1.68</td><td>0.63/0.23</td><td>4.40/1.55</td></tr></table>
|
| 337 |
+
|
| 338 |
+
# B ANALYSING THE CLOSED-SET AND OPEN-SET CORRELATION
|
| 339 |
+
|
| 340 |
+
Here, we aim to understand why improving the closed-set accuracy may lead to increased open-set performance through the MSL baseline. To this end, we train the VGG32 model on the CIFAR10 benchmark setting with the cross-entropy loss. We train the model both with a feature dimension of $D = 1 2 8$ (as is standard for this model) as well as with $D = 2$ for feature space visualization. We also train without a bias in the linear classifier for more interpretable features and classification boundaries (so class boundaries radiate from the origin of the feature space). Specifically, we train a model to make predictions as $\hat { \mathbf { y } } _ { i } = \mathrm { s o f t m a x } ( \mathbf { W } \Phi _ { \theta } ( \mathbf { x } _ { i } ) )$ , where $\Phi _ { \theta } ( \cdot )$ is a CNN embedding function $( \Phi _ { \theta } ( \mathbf { x } ) \in \mathbb { R } ^ { \dot { D } } )$ and $\mathbf { W } \in \mathbb { R } ^ { C \times D }$ is the linear classification matrix. Here $C = | \mathcal { C } | = 6$ and $D \in \{ 2 , 1 2 8 \}$ , and we optimise the loss with a one-hot target vector $\mathbf { y } _ { i }$ and batch size $B$ , as $\begin{array} { r } { - \frac { 1 } { B } \sum _ { i = 1 } ^ { B } \mathbf { y } _ { i } \cdot \log ( \hat { \mathbf { y } } _ { i } ) . } \end{array}$ .
|
| 341 |
+
|
| 342 |
+
Next, we interrogate the learned embeddings by plotting the mean vector norm of the features from all test images, for both the known and unknown classes, as training proceeds. These are shown in fig. 7a and fig. 7b for the models with $D = 1 2 8$ and $D = 2$ respectively. We also show the average vector norm for the per-class weights in the linear classifiers as dashed lines. Furthermore, snapshots of how these images are embedded for the model with $D = 2$ are shown in fig. 7d to 7f at representative epochs. The plots of the mean feature norms show that, at the start of training, all images are embedded with a similar magnitude. However, as training proceeds, the magnitude of features for the known classes increases substantially more than for the unknown classes.
|
| 343 |
+
|
| 344 |
+

|
| 345 |
+
Figure 7: Plots showing how the feature representations and linear classification weights of a deep classifier evolve as training proceeds (CIFAR10 OSR setting). (a), (b) show the average feature norm for seen and unseen classes, as well as the per-class vector norms for the weights in the linear classification head, for models with $D = 1 2 8$ and $D = 2$ respectively. (c) shows how the open-set performance of the classifier with $D = 1 2 8$ develops as training proceeds, using three different OSR scoring rules. (d), (e), (f) show the feature projections for images from seen and unseen classes at different epochs (indicated by vertical dashed lines in (b)) for the model with $D = 2$ . We show test images from known classes in colour and unknown classes in black. (g) (h) (i) show how classifier weight and feature norms change as a function of weight decay strength $( \lambda )$
|
| 346 |
+
|
| 347 |
+
To understand this, consider the cross-entropy loss for a single sample in the batch, shown in eq. (2):
|
| 348 |
+
|
| 349 |
+
$$
|
| 350 |
+
\mathcal { L } _ { i } ( \theta , \mathbf { W } ) = - \hat { y } _ { i , c } + \log ( \sum _ { j = 1 } ^ { C } \exp ( \hat { y } _ { i , j } ) ) = - \mathbf { w } _ { c } \cdot \Phi _ { \theta } ( \mathbf { x } _ { i } ) + \log ( \sum _ { j = 1 } ^ { C } \exp ( \mathbf { w } _ { j } \cdot \Phi _ { \theta } ( \mathbf { x } _ { i } ) ) )
|
| 351 |
+
$$
|
| 352 |
+
|
| 353 |
+
where $c$ refers to the correct class index, and ${ \bf w } _ { j }$ refers to the classification vector corresponding to the $j ^ { t h }$ class. Empirically, we find that the linear classifier’s weights and the feature norms for known classes increase during training, which is justified as increasing both $\left| \mathbf { w } _ { c } \right|$ and $| \Phi _ { \theta } ( \mathbf { x } _ { i } ) |$ reduces the loss value. Note that we observe this despite training with weight decay, which we omit from eq. (2) for clarity. 1 However, for ‘hard’ or ‘uncertain’ training examples (for which the classifier’s prediction may be incorrect) the model is encouraged to reduce $\mathbf { w } _ { j } \cdot \Phi _ { \theta } ( \mathbf { x } _ { i } ) \forall j \neq c$ through the second term of eq. (2). While the only way to do this for the $D = 2$ case is to reduce the feature norm (fig. 7b and fig. 7d to 7f), we show in fig. 7a that this also holds true for the $D = 1 2 8$ case in which $D > C$ . The tendency of deep networks to map ‘hard’ samples closer to the origin has been noted in (Ranjan et al., 2017).
|
| 354 |
+
|
| 355 |
+
This suggests that stronger cross-entropy models project features further from the origin, while still ensuring that any ‘uncertain’ samples have lower feature norms. This, in turn, suggests stronger cross-entropy classifiers would perform better for OSR, with images from novel categories likely to be interpreted as ‘uncertain’ during evaluation. Our analysis also suggests that cross-entropy training already provides a strong signal and thus a strong baseline for open-set recognition.
|
| 356 |
+
|
| 357 |
+
Finally, this motivates us to propose the maximum logit score (MLS) to provide our open-set score, i.e., $\begin{array} { r } { \dot { S } ( y \in \mathcal { C } | \mathbf { x } ) = \operatorname* { m a x } _ { j \in \mathcal { C } } \mathbf { w } _ { j } \cdot \boldsymbol { \Phi } _ { \theta } ( \mathbf { x } ) } \end{array}$ , rather than the softmax output as in the standard MSP baseline. Normalizing the logits via the softmax operator cancels out the magnitude information of the feature representation, which we have demonstrated is useful for the OSR decision. Fig. 7c shows how the AUROC evolves as training proceeds when both the maximum logit and maximum softmax value are used for OSR scoring. The plot demonstrates that softmax normalization noticeably reduces the model’s ability to make the open-set decision. We also show the OSR performance if we use the feature norm as our open-set score $( S ( y \in \mathcal { C } | \mathbf { x } ) = | \Phi _ { \theta } ( \mathbf { x } ) | )$ , showing that this simple indicator can perform remarkably well.
|
| 358 |
+
|
| 359 |
+
# C IMPROVING OPEN-SET PERFORMANCE WITH STRONGER CLOSED-SETCLASSIFIERS
|
| 360 |
+
|
| 361 |
+
Here, we describe how we improve the open-set performance of the baseline method in sec. 4 of the main paper, and provide a full breakdown of fig. 4. The methods include better learning rate schedules and data augmentations, as well as the use of logits rather than the softmax output for OSR scoring. We document the closed-set and open-set performance on the TinyImageNet dataset (the most challenging of the OSR benchmarks) in table 5. We further include the ‘Open Set Classification Rate’ (OSCR (Dhamija et al., 2018)) which summarises the trade-off between closed-set accuracy and open-set performance (here, in terms of the False Positive Rate) as the threshold on the open-set score is varied. As demonstrated in sec. 4 of the main paper, the findings of this study generalize well to other datasets.
|
| 362 |
+
|
| 363 |
+
Table 5: Breakdown of methods used to improve the closed-set classification accuracy of the baseline method. All experiments were conducted with a VGG32 backbone over five ‘known/unknown’ splits of the TinyImageNet dataset. The bracketed number with the Cosine scheduler indicates the number of learning rate restarts used during training. We find a Pearson Product-Moment correlation of 0.93 between the closed-set accuracy and the open-set AUROC.
|
| 364 |
+
|
| 365 |
+
<table><tr><td></td><td colspan="5">Setting</td><td rowspan="2">Ensemble</td><td rowspan="2">Closed Set (Accuracy)</td><td rowspan="2">Open Set (AUROC)</td><td rowspan="2">Combined (OSCR)</td></tr><tr><td>Epochs</td><td>Scheduler</td><td>Aug.</td><td>Logit Eval</td><td>Warmup</td><td>Label Smoothing</td></tr><tr><td>100</td><td>Step</td><td>RandCrop</td><td>X</td><td>X</td><td>X</td><td>X</td><td>64.3</td><td>68.9</td><td>51.4</td></tr><tr><td>100</td><td>Step</td><td>RandCrop</td><td></td><td>X</td><td>X</td><td>X</td><td>64.3</td><td>69.6</td><td>50.7</td></tr><tr><td>200</td><td>Cosine (0)</td><td>RandCrop</td><td>√</td><td>×</td><td>X</td><td>×</td><td>77.7</td><td>74.8</td><td>64.3</td></tr><tr><td>200</td><td>Cosine (0)</td><td>CutOut</td><td>√</td><td>X</td><td>X</td><td>×</td><td>77.6</td><td>75.4</td><td>64.7</td></tr><tr><td>200</td><td>Cosine (0)</td><td>RandAug</td><td>√</td><td>X</td><td>X</td><td>X</td><td>79.8</td><td>76.6</td><td>67.3</td></tr><tr><td>600</td><td>Cosine (2)</td><td>RandAug</td><td>√</td><td>X</td><td>X</td><td>X</td><td>82.5</td><td>78.2</td><td>70.3</td></tr><tr><td>600</td><td>Cosine (2)</td><td>RandAug</td><td></td><td>√</td><td>X</td><td>×</td><td>82.5</td><td>78.4</td><td>70.3</td></tr><tr><td>600</td><td>Cosine (2)</td><td>RandAug</td><td>1</td><td><</td><td>√</td><td>X</td><td>84.2</td><td>83.0</td><td>74.3</td></tr><tr><td>600</td><td>Cosine (2)</td><td>RandAug</td><td></td><td>√</td><td>√</td><td>√</td><td>85.3</td><td>84.0</td><td>76.1</td></tr></table>
|
| 366 |
+
|
| 367 |
+
We first train the baseline with the same hyper-parameters as in (Chen et al., 2021), training for 100 epochs and using a step learning rate schedule, with a basic random crop augmentation strategy. We evaluate using both softmax and logit scoring strategies. It can be seen that using maximum logit scoring gives better open-set performance (AUROC), while softmax scoring appears to be better in terms of OSCR. This is likely due to the fact that softmax normalization cancels the effect of the feature norm, which results in more separable scores that are beneficial to the OSCR calculation.
|
| 368 |
+
|
| 369 |
+
Here, we are interested in boosting the open-set performance (AUROC) by improving the closed-set accuracy. Hence, we use the maximum logit for open-set scoring as discussed in appendix B. This already gives an open-set performance of $6 9 . 6 \%$ AUROC, which is significantly higher than the softmax thresholding baseline reported for these datasets in almost all of the comparisons in the literature, which report a baseline $5 7 . 7 \%$ AUROC. The discrepancy between the reported baseline and our simplest setting is the result of reported figures originating in (Neal et al., 2018), wherein all models were trained only for 30 epochs (according to the publicly shared code) while our simplest model is trained for 100 epochs.
|
| 370 |
+
|
| 371 |
+
Following this trend, we find that training for longer (200 epochs) and using a better learning rate schedule (cosine annealed schedule (Loshchilov & Hutter, 2017)) significantly enhances both closed-set and open-set performance. We further find that stronger augmentations boost accuracy, where we leverage RandAugment (Cubuk et al., 2020) to find an optimal strategy. Finally, we find that learning rate warmup and label smoothing (Szegedy et al., 2016) can together significantly increase accuracy. We select the RandAugment and label smoothing hyper-parameters by maximizing closed-set accuracy on a validation set (randomly sampling $20 \%$ of the training set).
|
| 372 |
+
|
| 373 |
+
In summary, we find that simply leveraging standard training strategies for image recognition models leads to a significant boost in open-set performance. Specifically, we find that the combination of the above methodologies, including longer training and better augmentations boosts the AUROC to $8 2 . 6 \%$ . Finally, we find that open-set performance can be boosted to $8 4 . 0 \%$ AUROC by bootstrapping the training data and training $K = 5$ ensembles. The improvements in open-set performance strongly correlate with the boosts to the closed-set accuracy, with $\rho = 0 . 9 3$ between accuracy and AUROC.
|
| 374 |
+
|
| 375 |
+
# D IMPLEMENTATION DETAILS
|
| 376 |
+
|
| 377 |
+
# D.1 VGG32 ARCHITECTURE
|
| 378 |
+
|
| 379 |
+
This backbone architecture is commonly used in the open-set literature (Neal et al., 2018). The model consists of a simple series of nine $3 \times 3$ convolution layers, with downsampling occurring through strided convolutions every third layer. Batch normalization and LeakyRelu (slope of 0.2) are used after every convolution layer, with dropout used on the input image, and then after the third and sixth layer. Finally, after the ninth layer, the spatial feature is reduced with average pooling to a feature vector with dimensionality $D = 1 2 8$ . This is fed to the linear classifier (fully connected layer) to give the output logits.
|
| 380 |
+
|
| 381 |
+
# D.2 STANDARD DATASETS
|
| 382 |
+
|
| 383 |
+
Here, we describe the experimental setup for our results in sec. 4 of the main paper.
|
| 384 |
+
|
| 385 |
+
All models were trained on a single 12GB GPU (mostly a NVIDIA Titan X). When optimizing with the cross-entropy loss, training took between 2 and 6 hours for a single class split, depending on the dataset (for instance, training on TinyImageNet took 2.5 hours). All hyper-parameters were tuned on a validation set which was constructed by holding out a randomly sampled $20 \%$ of the closed-set training data from a single split of seen/unseen classes.
|
| 386 |
+
|
| 387 |
+
Baselines, $\mathbf { M S P + / M L S }$ We trained the VGG32 model with a batch size of 128 for 600 epochs. For each dataset, we train on five splits of ‘known/unknown’ classes as is standard practise, training each run with the random seed $\cdot _ { 0 } \cdot \mathrm { \ }$ . We use an initial learning rate of 0.1 for all datasets except TinyImageNet, for which we use 0.01. We train with a cosine annealed learning rate, restarting the learning rate to the initial value at epochs 200 and 400. Furthermore, we ‘warm up’ the learning rate by linearly increasing it from 0 to the ‘initial value’ at epoch 20.
|
| 388 |
+
|
| 389 |
+
We use RandAugment for all experiments, tuning its hyper-parameters on a validation set from a single class split for each dataset. We follow a similar procedure for the label smoothing value $s$ though we find the optimal value to be $s = 0$ for all datasets except TinyImageNet, where it helps significantly at $s = 0 . 9$ .
|
| 390 |
+
|
| 391 |
+
$( \mathbf { A R P L + C S } ) +$ We use the same experimental procedure for $\mathrm { A R P L + C S }$ (Chen et al., 2021) as for the baselines, again tuning the RandAugment and label smoothing hyperparameters for this method. Here, following the original implementation, we find a batch size of 64 and learning rate of 0.001 lead to better performance on TinyImageNet. This method also took significantly longer to train, taking 7.5 hours per class split on TinyImageNet.
|
| 392 |
+
|
| 393 |
+
OSRCI+ OSRCI involves multiple stages of training, including first training a GAN to synthesize images similar to the training data, before using generated images as ‘open-set’ examples to train a $( K + 1 )$ -way classifier (Neal et al., 2018). As our focus is on the effect of improving classification accuracy on open-set performance, we augment the training of the latter stage of OSRCI. We again train the $( K + 1 )$ -way classifier for 600 epochs with a cosine annealed learning rate schedule and RandAugment. For this method, we find that reducing all learning rates by a factor 10 compared to the baselines significantly improved performance.
|
| 394 |
+
|
| 395 |
+
# D.3 PROPOSED BENCHMARKS
|
| 396 |
+
|
| 397 |
+
Here, we describe the experimental setup for our results in sec. 5 of the main paper.
|
| 398 |
+
|
| 399 |
+
ImageNet. For this evaluation, we leverage a ResNet50 model pre-trained with the cross-entropy loss on ImageNet-1K from (Wightman, 2019). We evaluate the model directly for our MLS baseline. For ARPL+, we finetune the pre-trained model for 10 epochs with the ARPL optimization strategy.
|
| 400 |
+
|
| 401 |
+
FGVC datasets. We use a similar experimental setting for the FGVC datasets as we do for the standard benchmarks. Specifically, for both $\mathbf { M S P + / M L S }$ and $\mathbf { A R P L + }$ , we again train for 600 epochs, using a cosine annealed learning rate and learning rate warmup. We also re-tune the RandAugment and label smoothing hyper-parameters on a validation set. Differently, however, we use a ResNet50 backbone with $4 4 8 \times 4 4 8$ image size as is standard in the FGVC literature. We further initialize the network with weights from MoCoV2 training on Places, using an initial learning rate of 0.001 and a batch size of 32. Training for both methods took between one and two days depending on the dataset.
|
| 402 |
+
|
| 403 |
+
Note: We attempted to train $\mathbf { A R P L + C S }$ on our proposed datasets but found it computationally infeasible. Specifically, the memory intensive nature of the method meant we could only fit a batch size of 2 on a 12GB GPU. We attempted to scale it up for the FGVC datasets, fitting a batch size of 16 across $4 \times 2 4 \mathrm { G B }$ GPUs, with training taking a week. However, we found its performance after a week to be slightly lower than $\mathrm { \ A R P L + }$ in this setting.
|
| 404 |
+
|
| 405 |
+
# E COMPARISONS WITH OTHER DEEP LEARNING BASED OSR METHODS
|
| 406 |
+
|
| 407 |
+
Table 6: Comparing our improved baseline with other deep learning based OSR methods on the standard benchmark datasets. All results indicate the area under the Receiver-Operator curve (AUROC) as a percentage. We also show the backbone architecture used for each method, showing results with multiple backbones when reported.
|
| 408 |
+
|
| 409 |
+
<table><tr><td>Method</td><td>Backbone</td><td>MNIST</td><td>SVHN</td><td>CIFAR10</td><td>CIFAR+10</td><td>CIFAR+50</td><td>TinyImageNet</td></tr><tr><td>MSP (Neal et al., 2018)</td><td>VGG32</td><td>97.8</td><td>88.6</td><td>67.7</td><td>81.6</td><td>80.5</td><td>57.7</td></tr><tr><td>OpenMax (Bendale & Boult,2016)</td><td>VGG32</td><td>98.1</td><td>89.4</td><td>69.5</td><td>81.7</td><td>79.6</td><td>57.6</td></tr><tr><td>G-OpenMax (Ge et al., 2017)</td><td>VGG32</td><td>98.4</td><td>89.6</td><td>67.5</td><td>82.7</td><td>81.9</td><td>58.0</td></tr><tr><td>OSRCI (Neal et al.,2018)</td><td>VGG32</td><td>98.8</td><td>91.0</td><td>69.9</td><td>83.8</td><td>82.7</td><td>58.6</td></tr><tr><td>CROSR(Yoshihashi et al.,2019)</td><td>DHRNet</td><td>99.1</td><td>89.9</td><td></td><td>=</td><td></td><td>58.9</td></tr><tr><td>C2AE(Oza& Patel,2019)</td><td>VGG32</td><td>98.9</td><td>92.2</td><td>89.5</td><td>95.5</td><td>93.7</td><td>74.8</td></tr><tr><td>GFROSR (Perera et al.,2020)</td><td>VGG32/WRN-28-10</td><td>-</td><td>93.5 /95.5</td><td>80.7 /83.1</td><td>92.8 /91.5</td><td>92.6/91.3</td><td>60.8 /64.7</td></tr><tr><td>CGDL (Sun et al., 2021)</td><td>CPGM-AAE</td><td>99.5</td><td>96.8</td><td>95.3</td><td>96.5</td><td>96.1</td><td>77.0</td></tr><tr><td>OpenHybrid (Zhang et al., 2020)</td><td>VGG32</td><td>99.5</td><td>94.7</td><td>95.0</td><td>96.2</td><td>95.5</td><td>79.3</td></tr><tr><td>RPL (Chen et al.,2020a)</td><td>VGG32/WRN-40-4</td><td>99.3 /99.6</td><td>95.1/96.8</td><td>86.1/90.1</td><td>85.6/97.6</td><td>85.0 /96.8</td><td>70.2/ 80.9</td></tr><tr><td>PROSER (Zhou et al., 2021)</td><td>WRN-28-10</td><td>·</td><td>94.3</td><td>89.1</td><td>96.0</td><td>85.3</td><td>69.3</td></tr><tr><td>ARPL (Chen et al., 2021)</td><td>VGG32</td><td>99.6</td><td>96.3</td><td>90.1</td><td>96.5</td><td>94.3</td><td>76.2</td></tr><tr><td>ARPL + CS (Chen et al., 2021)</td><td>VGG32</td><td>99.7</td><td>96.7</td><td>91.0</td><td>97.1</td><td>95.1</td><td>78.2</td></tr><tr><td>OSRCI+</td><td>VGG32</td><td>98.5 (-0.3)</td><td>89.9 (-1.1)</td><td>87.2 (+17.3)</td><td>91.1 (+7.3)</td><td>90.3 (+7.6)</td><td>62.6 (+4.0)</td></tr><tr><td>(ARPL + CS)+</td><td>VGG32</td><td>99.2 (-0.5)</td><td>96.8 (+0.1)</td><td>93.9 (+2.9)</td><td>98.1 (+1.0)</td><td>96.7 (+1.6)</td><td>82.5 (+4.3)</td></tr><tr><td>Baseline (MSP+)</td><td>VGG32</td><td>98.6 (+0.8)</td><td>96.0 (+7.4)</td><td>90.1 (+22.4)</td><td>95.6 (+14.0)</td><td>94.0 (+13.5)</td><td>82.7 (+25.0)</td></tr><tr><td>Baseline (MLS)</td><td>VGG32</td><td>99.3 (+1.5)</td><td>97.1 (+8.5)</td><td>93.6 (+25.9)</td><td>97.9 (+16.3)</td><td>96.5 (+16.0)</td><td>83.0 (+25.3)</td></tr></table>
|
| 410 |
+
|
| 411 |
+
In table 6, we provide comparisons with more methods, including those using a different backbone architecture, to supplement table 1 from the main paper. The overrall conclusion is the same as in the main paper. Specifically, our improved baseline significantly outperforms reported baseline figures and outperforms state-of-the-art OSR models on a number of standard benchmarks. Training other OSR methods (OSRCI, $\mathrm { A R P L + C S }$ (Neal et al., 2018; Chen et al., 2021)) on top of our improved baseline can boost also their OSR performance. However, the discrepancy between the state-of-the-art and the baseline is now negligible.
|
| 412 |
+
|
| 413 |
+
# F OUT-OF-DISTRIBUTION DETECTION RESULTS
|
| 414 |
+
|
| 415 |
+
In this section, we run experiments on OoD benchmarks, a separate but related machine learning sub-field to OSR. OoD deals with all forms of distributional shifts, whereas OSR focusses on semantic novelty. Specifically, in the ‘multiclass’ OoD setting, a model is trained for classification on a given dataset, before being tasked with detecting test samples from other datasets as ‘unknown’ (Hendrycks & Gimpel, 2017). Once again, this task is evaluated as a binary classification (‘known’/‘unknown’) problem. A notable difference with the OSR setting is that OoD models often have access to auxiliary data as examples of ‘OoD’ during training (Hendrycks et al., 2019).
|
| 416 |
+
|
| 417 |
+
# F.1 CORRELATION BETWEEN CLOSED-SET AND OOD PERFORMANCE
|
| 418 |
+
|
| 419 |
+
First, we conduct similar experiments to sec. 3. We evaluate four ResNet models trained on CIFAR100 on the OoD task, using CIFAR10 for examples of ‘OoD’. We show the closed-set and OoD performances of these models are correlated in fig. 8, with a Pearson Product-Moment correlation of $\rho = 0 . 9 7$ . This trend is similar to the one observed in the ImageNet OSR evaluation in fig. 3b.
|
| 420 |
+
|
| 421 |
+

|
| 422 |
+
Figure 8: OoD against closed-set performance for four ResNet models trained on CIFAR100, using CIFAR10 as OoD. The plot indicates a similar performance correlation as observed in fig. 3b.
|
| 423 |
+
|
| 424 |
+
F.2 OOD PERFORMANCE WITH DIFFERING TYPES OF DISTRIBUTION SHIFT
|
| 425 |
+
|
| 426 |
+
Next, in table 7, we evaluate OoD performance when different datasets are taken as examples of ‘OoD’ with respect to CIFAR100. Specifically, we compare OSR methods (and an OoD baseline), taking Gaussian Noise, SVHN and CIFAR10 as ‘OoD’.
|
| 427 |
+
|
| 428 |
+
Table 7: Results on out-of-distribution detection benchmarks. We evaluate two MLS models: one represents a model which we train ourselves; the second represents a strong pre-trained model from (Lim et al., 2019).
|
| 429 |
+
|
| 430 |
+
<table><tr><td></td><td>Outlier Exposure (Hendrycks et al., 2019)</td><td>OpenHybrid (Zhang et al., 2020)</td><td>ARPL+CS</td><td>MLS</td><td>MLS (Lim et al., 2019)</td></tr><tr><td>CIFAR100 → Gaussian Noise</td><td>95.7</td><td>1</td><td>67.6</td><td>73.5</td><td>78.9</td></tr><tr><td>CIFAR100 →SVHN</td><td>86.9</td><td></td><td>77.9</td><td>83.3</td><td>88.9</td></tr><tr><td>CIFAR100 →CIFAR10</td><td>75.7</td><td>85.6</td><td>73.0</td><td>77.7</td><td>83.2</td></tr></table>
|
| 431 |
+
|
| 432 |
+
As a strong baseline from the OoD literature, we report results from Outlier Exposure (O.E.) (Hendrycks et al., 2019), which encourages the classifier to predict a uniform distribution when fed auxiliary ‘OoD’ images from 80 Million Tiny Images (Torralba et al., 2008). We also report results from OpenHybrid (Zhang et al., 2020) which reports a CIFAR $1 0 0 $ CIFAR10 result. Furthermore, we train $\mathbf { A R P L + C S }$ and MLS in this setting, training a ResNet50 for 200 epochs. As a final experiment, we take a strong model pre-trained on CIFAR100 from (Lim et al., 2019) and evaluate it on the OoD benchmarks. Our results show that, while OpenHybrid performs strongly on the CIFAR $1 0 0 $ CIFAR10 experiment, the two MLS models outperform the O.E baseline on this evaluation despite not having seen extra data during training.
|
| 433 |
+
|
| 434 |
+
# F.3 EVALUATION ON OOD BENCHMARKS
|
| 435 |
+
|
| 436 |
+
Finally, we run our MLS method on the standard OoD benchmark suite. Specifically, we take models trained on CIFAR10 and CIFAR100, and evaluate them when Places365 (Zhou et al., 2017), Textures (Cimpoi et al., 2014), LSUN-Crop (Yu et al., 2015), LSUN-Resize (Yu et al., 2015), iSUN (Xu et al., 2015) and SVHN (Netzer et al., 2011) are used in turn as ‘OoD’ datasets. We take well-trained WideResNet-40 models (trained with Fast Auto-Augment on CIFAR10 and CIFAR100 from (Lim et al., 2019)) and run our MLS baseline on top. We compare against state-of-the-art OoD methods which do not use extra data for fine-tuning, and report our results in table 8. We report average AUROC across the six OoD datasets.
|
| 437 |
+
|
| 438 |
+
We find that strong closed-set classifiers with our MLS baseline can achieve highly competitive performance on the OoD benchmarks, once again substantially closing the gap between the MSP baseline (Hendrycks & Gimpel, 2017) and state-of-the-art.
|
| 439 |
+
|
| 440 |
+
Table 8: Results of our strong baseline on the full OoD benchmark suite. We take strong WideResNet-40 models from (Lim et al., 2019) and run our MLS baseline on top. Models are trained on CIFAR10 and CIFAR100 as ‘in-distribution’ and we report AUROC averaged across six OoD datasets. All compared figures are taken from (Du et al., 2022) and Liu et al. (2020).
|
| 441 |
+
|
| 442 |
+
<table><tr><td>Method</td><td>CIFAR10</td><td>CIFAR100</td></tr><tr><td>MSP (Hendrycks & Gimpel, 2017)</td><td>90.9</td><td>75.5</td></tr><tr><td>ODIN (Liang et al., 2018)</td><td>91.1</td><td>77.4</td></tr><tr><td>Energy Score (Liu et al., 2020)</td><td>91.9</td><td>79.6</td></tr><tr><td>Mahanabolis (Lee et al., 2018b)</td><td>93.3</td><td>84.1</td></tr><tr><td>VOS (Du et al., 2022)</td><td>94.1</td><td>1</td></tr><tr><td>MLS (Ours)</td><td>95.1</td><td>80.8</td></tr></table>
|
| 443 |
+
|
| 444 |
+
Discussion. Our results show that strong closed-set classifiers can also perform well in the OoD setting, even compared to very recent methods such as Virtual Outlier Synthesis (VOS, (Du et al., 2022)). In fact, in some cases, we find the MLS baseline exceeds state-of-the-art for this task.
|
| 445 |
+
|
| 446 |
+
Interestingly, the MLS baseline performs best with in the ‘near-OoD’ case (e.g. SVHN and CIFAR10 as ‘OoD’ in table 7, i.e. in the more similar settings to OSR). In fact, the MLS models trained on CIFAR100 are worse at detecting Gaussian Noise than CIFAR10 images as ‘OoD’. We present this peculiar finding as evidence that the OoD and OSR research questions may have different, and possibly orthogonal, solutions. We hope that benchmarks which can isolate semantic novelty from low-level distributional shifts, such as the Semantic Shift Benchmark from sec. 5, can facilitate more controlled OSR and OoD research.
|
| 447 |
+
|
| 448 |
+
# G DISCUSSION: UNDERSTANDING SYSTEMS OF CATEGORIZATION
|
| 449 |
+
|
| 450 |
+
Before one can establish if an image belongs to a new class, one must first understand what constitutes a single class, or how the system of categorization is constructed. To illustrate this, consider a classifier trained on instances of two household pets: {Labrador (dog), British Shorthair (cat)}. Now consider an open-world setting in which the model must be able to distinguish previously unseen objects, perhaps: {Poodle (dog), Sphynx (cat)}. In this case, understanding the categorization system is essential to making the open-set decision. Does the classification system delineate individual animal species? In this case, both ‘Poodle’ and ‘Sphynx’ should be identified as ‘open-set’ examples. Or does it instead simply separate ‘cats’ from ‘dogs’? In which case neither object belongs to the open-set.
|
| 451 |
+
|
| 452 |
+
To solve this problem, and to perform OSR reliably, the model must understand the set of invariances within a single category, as well as a set of ‘axes of variation’ to distinguish between categories. Specifically, different instances within a single category will have a set of features which can be freely varied without the category label changing. In computer vision, this often refers to characteristics such as pose and lighting, but could also refer to more abstract features such as animal gender or background setting. Meanwhile, the classification system will also have a (possibly abstract) set of axes of variation to which the category label is sensitive.
|
| 453 |
+
|
| 454 |
+
In the current OSR benchmarks, with either abstract class definitions or a small number of classes, the set of axes of variation which can distinguish between categories is diverse. In this sense, the problem is ill-posed, with many axes likely being equally valid to distinguish between the training classes, including those based on semantically meaningless low-level features. In contrast, within our proposed fine-grained setting, the set of axes of variation which can distinguish between categories is far more constrained. For instance, in the CUB case, given a training task of classifying 100 bird species, there is little uncertainty as to what the axis of semantic variation could be.
|
| 455 |
+
|
| 456 |
+
# H CREATING SPLITS FOR THE SEMANTIC SHIFT BENCHMARK
|
| 457 |
+
|
| 458 |
+
# H.1 SPLIT CONSTRUCTION
|
| 459 |
+
|
| 460 |
+
In sec. 5 of the main paper, we sketched the process for constructing open-set splits from the CUB dataset. Here, we describe the process in detail for both CUB, Stanford Cars and FGVC-Aircraft, which each have different attribute structures.
|
| 461 |
+
|
| 462 |
+
For each FGVC benchmark, we split its classes into two disjoint sets, $\mathcal { C }$ and $\mathcal { U }$ , containing closed-set and open-set classes respectively. $\mathcal { U }$ is further subdivided into disjoint {‘Easy’, ‘Medium’, ‘Hard’} sets with varying degrees of attribute similarity with any class in $\mathcal { C }$ . Specifically, we measure the difficulty of an open-set class by its semantic similarity with its most similar training class (where similarity is defined in terms of attribute overlap).
|
| 463 |
+
|
| 464 |
+
In practice, we found the semantic similarity of the ‘Medium’ and ‘Hard’ splits of Stanford Cars to the closed-set to be very similar, hence we combine them into a single ‘Hard’ split.
|
| 465 |
+
|
| 466 |
+
CUB. In CUB, each image is labelled for the presence of 312 visual attributes such as has_bill_shape::hooked and has_breast_color::yellow. Note that images from the same class do not all share the same attributes, both because of standard factors such as pose and occlusion, but also because of factors such as the age and gender of the bird.
|
| 467 |
+
|
| 468 |
+
This information is summarised on a per-class basis, describing how often each attribute occurs in each class; i.e., a matrix $M \in [ 0 , 1 ] ^ { C \times \mathbf { \dot { A } } }$ is available, where $C = 2 0 0$ is the total number of classes in CUB and $A = 3 1 2$ is the number of attributes. This allows us to construct a class similarity matrix $S \in [ 0 , 1 ] ^ { C \times C }$ where $S _ { i j } = \mathbf { m } _ { i } \cdot \mathbf { m } _ { j }$ and $\mathbf { m } _ { i }$ is the L2-normalized $i ^ { t h }$ row of $M$ . Thus, given a set of closed-set classes in $\mathcal { C }$ , we can rank all remaining classes $( \mathcal { U } )$ according to their maximum similarity with any of the training classes. Finally, we bin the ranked open-set classes into $\{ \mathrm { \dot { E } a s y \mathrm { \ ' } }$ , ‘Medium’, ‘Hard’} sets. In practice, we randomly sample 1 million combinations of $\mathcal { C }$ , and select the combination which results in the most difficult open-set splits.
|
| 469 |
+
|
| 470 |
+
Stanford Cars. Each class name in Stanford Cars follows the format of ‘Make’-‘Model’-‘Type’- ‘Year’; for instance ‘Aston Martin - V8 Vantage - Convertible - 2012’ is a class. In this case, we create open-set splits of different difficulties based on the similarity between class names.
|
| 471 |
+
|
| 472 |
+
We first create the ‘Hard’ open-set split by identifying pairs of classes which have the same ‘Make’, ‘Model’ and ‘Type’ but come from different ‘Years’. Next, we create the ‘Medium’ split from class pairs which have the same ‘Make’ and ‘Model’ but have different ‘Types’. Finally, the ‘Easy’ split is constructed from pairs which have the same ‘Make’ but different ‘Models’.
|
| 473 |
+
|
| 474 |
+
We note that open-set bins of different difficulties in Stanford Cars are the most troublesome to define. This is because the rough hierarchy in the class names may not always correspond to the degree of visual similarity between the classes. For instance, two cars from the same ‘Year’ but of different ‘Makes’ (e.g. a Ford and Nissan both made in 2010) may look more similar than cars of the same ‘Make’-‘Model’-‘Type’ but from different years (e.g. Audi S4 Sedan 2007 and Audi S4 Sedan 2012).
|
| 475 |
+
|
| 476 |
+
FGVC-Aircraft. We leverage the hierarchy of class labels in FGVC-Aircraft; each image is labelled with a ‘manufacturer’ (e.g., ‘Airbus’ or ‘Boeing’), a ‘family’ (e.g., ‘A320’ or ‘A330’) and a ‘variant’ (e.g.‘A330-200’ or ‘A330-300’). The hierarchy is constructed as a tree, with ‘manufacturer’ classes at the top level, ‘family’ classes at the second, and ‘variant’ classes at the bottom. The standard image classification challenge operates at the variant level, meaning all variant classes are visually distinct with identifiable features. Furthermore, the hierarchy corresponds to visual similarity, i.e there is more inter-class variation between manufacturers than between variants from the same manufacturer. Thus, given the closed-set classes $\mathcal { C }$ , we can create an ‘Easy’ open-set split from variants which do not share a manufacturer with any closed-set class. Meanwhile, ‘Medium’ open-set classes share a manufacturer with closed-set classes but come from different families, and ‘Hard’ open-set classes share families with closed-set classes but are different variants.
|
| 477 |
+
|
| 478 |
+
# H.2 SPLIT EXAMPLES
|
| 479 |
+
|
| 480 |
+
We include examples of images from the closed-set and open-set splits of the proposed FGVC datasets in fig. 9 and 11. For each dataset, we show examples of ‘Easy’ (green/top), ‘Medium’ (orange/middle) and ‘Hard’ (red/bottom) classes. For each difficulty, we show three images from three classes from the open-set (right) and their most similar class in the closed-set (left). We note that ‘Hard’ open-set classes are far more visually similar to their corresponding closed-set class than ‘Easy’ open-set classes.
|
| 481 |
+
|
| 482 |
+
# H.3 SPLIT DETAILS
|
| 483 |
+
|
| 484 |
+
All split details can be found here: https://github.com/sgvaze/osr_closed_set_all_you_need.
|
| 485 |
+
|
| 486 |
+

|
| 487 |
+
Figure 9: Sample classes from closed and open-set splits for the CUB dataset. We show ‘Easy’ (green/top), ‘Medium’ (orange/middle) and ‘Hard’ (red/bottom) classes. Classes on the left (solid outline) are in the closed-set, while classes on the right (dashed outline) are in the open-set.
|
| 488 |
+
|
| 489 |
+

|
| 490 |
+
Figure 10: Sample classes from closed and open-set splits for the Stanford Cars dataset. We show ‘Easy’ (green/top), ‘Medium’ (orange/middle) and ‘Hard’ (red/bottom) classes. Classes on the left (solid outline) are in the closed-set, while classes on the right (dashed outline) are in the open-set. In practice, we combine the ‘Medium’ and ‘Hard’ splits during evaluation.
|
| 491 |
+
|
| 492 |
+

|
| 493 |
+
Figure 11: Sample classes from closed and open-set splits for the FGVC-Aircraft dataset. We show ‘Easy’ (green/top), ‘Medium’ (orange/middle) and ‘Hard’ (red/bottom) classes. Classes on the left (solid outline) are in the closed-set, while classes on the right (dashed outline) are in the open-set.
|
| 494 |
+
|
| 495 |
+
# I AVERAGE PRECISION EVALUATION ON PROPOSED BENCHMARKS
|
| 496 |
+
|
| 497 |
+
We report average precision (AP) for the binary ‘known/unknown’ decision for the proposed benchmark evaluations in table 9. AP is a standard metric in the OoD literature and is better suited for dealing with class imbalance at test time. We note that the ‘Hard’ FGVC open-set splits (with a small number of classes) report substantially poorer AP than AUROC in absolute terms. We treat open-set examples as ‘positive’ during evaluation.
|
| 498 |
+
|
| 499 |
+
Table 9: Average Precision (AP) results on the proposed benchmark datasets for ‘Easy’ / ‘Medium’ / ‘Hard’ splits.
|
| 500 |
+
|
| 501 |
+
<table><tr><td></td><td>CUB</td><td>FGVC-Aircraft</td><td>ImageNet</td></tr><tr><td>ARPL+</td><td>59.9 / 53.3 / 45.3</td><td>66.9 / 58.9 / 34.4</td><td>78.2 / - / 71.2</td></tr><tr><td>MLS</td><td>67.1 / 58.2 / 47.2</td><td>69.2 / 58.2 / 39.6</td><td>76.6/ - / 68.6</td></tr></table>
|
md/dev/BSww-NrOzJ/BSww-NrOzJ.md
ADDED
|
@@ -0,0 +1,502 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# STEERING PROTOTYPES WITH PROMPT TUNING FOR REHEARSAL-FREE CONTINUAL LEARNING
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Prototype, as a representation of class embeddings, has been explored to reduce memory footprint or avoid bias towards the latest task for continual learning. However, prototype-based methods still suffer from performance deterioration due to semantic drift and prototype interference. In this work, we propose a simple and novel framework for rehearsal-free continual learning. We show that task-specific prompt-tuning when coupled with a contrastive loss design can effectively address both issues and largely improves the potency of prototypes. The proposed framework excels at three challenging benchmarks, resulting in $3 \%$ to $6 \%$ absolute improvements over state-of-the-art methods without usage of a rehearsal buffer or a test-time oracle. Furthermore, the proposed framework largely bridges the performance gap between incremental learning and offline joint learning, demonstrating a promising design schema for continual learning.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Continual learning (Thrun, 1995), the capability of learning sequentially from a continuous stream of correlated data, is crucial for modern intelligent systems as the world is nonstationary (Hadsell et al., 2020). Yet, existing deep neural networks are known to be prone to catastrophic forgetting (McCloskey & Cohen, 1989): models suffer from dramatic performance degeneration on earlier learned tasks when learn new information. Prototype (i.e., the class mean embedding (Snell et al., 2017)) exhibits a promising functionality in continual learning context as it can retain previous knowledge in a data-efficient manner (Zhu et al., 2021) and avoid bias towards the latest task (Rebuffi et al., 2017) when coupled with a nearest class mean (NCM) (Mensink et al., 2013) classifier. However, prototypes themselves are also subject to abrupt efficacy drop due to semantic drift and prototype interference. Concretely, learning a
|
| 12 |
+
|
| 13 |
+

|
| 14 |
+
Figure 1: An illustration of semantic drift and prototype interference in the latent space. Both phenomena occur simultaneously in continual learning and cause catastrophic forgetting. Different colors represent different classes.
|
| 15 |
+
|
| 16 |
+
sequence of tasks with a single model can be viewed as generating a sequence of snapshots of the model, and only the latest version is retained. Therefore, a data sample at inference and its corresponding prototype is, in fact, encoded by different embedding functions (except for data samples from the latest task). This inconsistency can cause severe drifts in latent space as shown in Fig. 1 (top). Besides, when new data samples that bear similar semantics with previous classes appear, their encoded features can locate near previous prototypes in latent space, thus causing interference as illustrated in Fig. 1 (bottom).
|
| 17 |
+
|
| 18 |
+
A recent transfer learning paradigm, namely prompt-tuning (Lester et al., 2021; Jia et al., 2022), demonstrates a strong knowledge adaption ability. It allows a tiny portion of extra learnable tokens to steer a frozen transformer-based architecture (Vaswani et al., 2017). Therefore, prompt-tuning reuses the pre-trained network in a parameter efficient manner without hurting its feature extraction ability. Inspired by the efficiency of prompt-tuning and the plug-and-play property of the token, we propose a novel framework built upon the basis of task-specific prompt that can effectively address both semantic drift and prototype interference described above.
|
| 19 |
+
|
| 20 |
+
In our method, we associate the prototype of each class with a task-specific prompt group and maintain a collection of corresponding pairs in memory. During inference, we combine the task-specific prompt group with a frozen embedding function to reemerge each snapshot of the model. As such, we effectively eliminate the inconsistency between embedding functions used for prototypes generation and samples prediction. The frozen embedding function here can be deemed as consolidated global knowledge that keeps the system stable. Prompt groups, on the other hand, learn tasklevel specializations and maintain the plasticity of the system. To avoid prototype interference in embedding space, we train task-specific prompt groups with the designed contrastive prototypical loss. It encourages in-class clustering and increases inter-class distances giving a mixture of data embeddings and prototypes. Since we only maintain previous knowledge as prototypes and put them as anchors in latent space, the trained prompt groups can effectively steer prototypes to avoid interference without saving or replaying previous data samples. Furthermore, we propose the multi-centroid prototype strategy that leverages a group of fictitious embeddings instead of a mean embedding to characterize the distribution of a class in latent space. It helps to improve the representation power of prototypes and further mitigate semantic drift and prototype interference. The above schema effectively align both the space (i.e., the embedding space) and the embedding functions that are used during learning and inference, hence effectively boosting the potency of prototypes in continual learning.
|
| 21 |
+
|
| 22 |
+
We term our method Contrastive Prototypical Prompt (CPP), a simple and novel continual learning framework that explores embedding space holistically. In experiments, CPP excels at split CIFAR100, split ImageNet-subset and 5-datasets three challenging benchmarks, bringing around $3 \%$ to $6 \%$ absolute improvements over state-of-the-art methods. Moreover, it largely bridges the gap between incremental learning and offline joint learning1. The efficacy of proposed modules is thoroughly studied both empirically and analytically. The main contributions can be summarized as follows:
|
| 23 |
+
|
| 24 |
+
• We propose CPP, a simple and novel framework for rehearsal-free continual learning. It leverages contrastively learned task-specific prompt to effectively address both semantic drift and prototype interference issues.
|
| 25 |
+
• We present multi-centroid prototype strategy which can better characterize the class distribution and improves representativeness of prototypes. It is seamlessly merged into CPP and exhibits an additive benefit.
|
| 26 |
+
• CPP significantly outperforms the state-of-the-art methods and largely bridges the performance gap between incremental learning and offline joint-learning. The proposed modules are comprehensively analyzed and demonstrate clear and additive benefits.
|
| 27 |
+
|
| 28 |
+
# 2 RELATED WORKS
|
| 29 |
+
|
| 30 |
+
Continual learning. The development trajectory of continual learning is the history of combating against catastrophic forgetting (McCloskey & Cohen, 1989) issue. Existing algorithms can be mainly categorized into three subsets. Regularization-based methods (Lopez-Paz & Ranzato, 2017; Li & Hoiem, 2018) strike for a balance under stability–plasticity dilemma. They impose extra constraints on the changeability of network parameters while maintaining a certain degree of plasticity to learn new knowledge. Despite the succinct formulation, solely using regularization struggles when facing a long sequence of tasks (Hadsell et al., 2020). Architectural methods manage to overcome forgetting by allocating extra resources as learning progresses (Mallya & Lazebnik, 2018; Rusu et al., 2016; Pham et al., 2020). However, most existing methods assume the existence of a test-time oracle and face scalability issues. In practice, rehearsal-based methods (Buzzega et al., 2020; Cha et al., 2021) exhibit the most versatility and robustness through saving and rehearsing previous samples. Nevertheless, this strategy is sensitive to buffer size (Prabhu et al., 2020; Hadsell et al., 2020) and becomes infeasible under restricted scenarios (e.g., on edge devices, for privacy-sensitive applications). The proposed CPP here is a hybrid method. It combines merits from architectural and rehearsal-based methods without inheriting their limitations (see a full discussion in Appendix D).
|
| 31 |
+
|
| 32 |
+

|
| 33 |
+
Figure 2: An overview of CPP. Different colors represent different classes. Left: along the learning process, knowledge from earlier tasks are retained as prototypes and are used as anchors in embedding space. Current prompt learn through avoiding interference. Right: during inference, a group of candidate prompt groups are first retrieved followed by a fine-grained matching process.
|
| 34 |
+
|
| 35 |
+
Prototypes for continual learning. It has been shown that embedding is less prone to information loss (Davari et al., 2022) and a typical linear classifier is one of the critical sources for abrupt forgetting due to the bias towards latest task (Zhang et al., 2021). As such, most prototype-related approaches (Rebuffi et al., 2017; Yu et al., 2020; Zhu et al., 2021) leverage prototypes in combination with a NCM classifier to discriminate data samples. Zhu et al. (2021), on the other hand, used prototypes as anchors in latent space to avoid semantic overlap and thus improving discrimination ability without forwarding explicit exemplars. Yu et al. (2020) managed to post-compensate semantic drifts of previous prototypes through approximating drifts from current data. Herein, instead of compensating drifts, CPP prevents drifts from the origin and handles prototype interference as well. Moreover, CPP deploys the multi-centroid prototype instead of a class mean embedding to better characterize the embedding distribution and improves representativeness of the prototype.
|
| 36 |
+
|
| 37 |
+
Prompt tuning. Initializing the model with pre-trained weights has become a de facto practice in both computer vision and natural language processing communities. However, a typical fine-tuning technique does not necessarily benefit when transferring models to downstream tasks (Kumar et al., 2022). Prompt-tuning (Li & Liang, 2021; Lester et al., 2021) has emerged as an alternative to reuse pre-trained knowledge. Jia et al. (2022) further adapted prompt-tuning to the vision domain. It has recently also been introduced to continual learning. Both L2P (Wang et al., 2022c) and DualPromt (Wang et al., 2022b) leveraged a prompt pool or global prompts that share across tasks to learn incremental knowledge. S-prompts (Wang et al., 2022a) used domain-specific prompts to tackle the domain-incremental learning. We here apply task-specific prompts to counteract semantic drifts and prototype interference, and leverage prototypes as classifiers without projecting to logistic space.
|
| 38 |
+
|
| 39 |
+
# 3 METHODOLOGY
|
| 40 |
+
|
| 41 |
+
In this section, we start with describing the problem setup and, along the way, introduce the notations (Sec. 3.1). Then we present a minimum feasible prototype-based framework which serves as a proof of concept and the baseline model (Sec. 3.2). Afterwards, We introduce the proposed CPP upon the baseline model (Sec. 3.3). At last, we describe multi-centroid prototype strategy (Sec. 3.4). Fig. 2 provides an overview of our framework.
|
| 42 |
+
|
| 43 |
+
# 3.1 PROBLEM SETUP AND NOTION
|
| 44 |
+
|
| 45 |
+
Supervised continual learning can be defined as learning a model over a sequence of $T$ tasks $\bar { \mathcal { T } _ { 1 : T } } = \{ \mathcal { T } _ { 1 } , \mathcal { T } _ { 2 } . . . \mathcal { T } _ { T } \}$ . Each task $\mathcal { T } _ { t }$ is associated to a dataset $\mathcal { D } ^ { t } = \{ ( \boldsymbol { x } _ { i } ^ { t } , y _ { i } ^ { t } ) _ { i = 1 } ^ { n _ { t } } \}$ containing $n _ { t }$ data pairs where $_ { \textbf { \em x } }$ is the input vector and $y$ is its corresponding label. Each data pair $( \boldsymbol { x } _ { i } ^ { t } , \boldsymbol { y } _ { i } ^ { t } ) \in ( \bar { \boldsymbol { x } } ^ { t } \times \mathcal { V } ^ { t } )$
|
| 46 |
+
|
| 47 |
+
belongs to an unknown distribution $( \mathcal { X } ^ { t } \times \mathcal { Y } ^ { t } )$ and $\mathcal { y } ^ { t } \cap \mathcal { y } ^ { t ^ { \prime } } = \emptyset$ while $t \ne t ^ { \prime }$ . Without loss of generality, a neural network at session $t$ can be decoupled into an embedding function $f _ { \theta ^ { t } } ( \cdot ) :$ $\mathbb { R } ^ { V \times H \times C } \stackrel { \bullet } { \to } \mathbb { R } ^ { D }$ and a classifier $g _ { \phi ^ { t } } ( \cdot ) : \mathbb { R } ^ { D } \to \mathbb { R } ^ { K }$ that parameterized by $\theta ^ { t }$ and $\phi ^ { t }$ , respectively. Then the overall learning target is to minimize:
|
| 48 |
+
|
| 49 |
+
$$
|
| 50 |
+
\underset { \Theta , \Phi } { \arg \operatorname* { m i n } } \frac { 1 } { T } \sum _ { t = 1 } ^ { T } \sum _ { i = 1 } ^ { n _ { t } } \mathcal { L } ( g _ { \phi ^ { t } } ( f _ { \theta ^ { t } } ( \pmb { x } _ { i } ^ { t } ) ) , y _ { i } ^ { t } ) ,
|
| 51 |
+
$$
|
| 52 |
+
|
| 53 |
+
where $\mathcal { L }$ is a loss measurement, $\Theta = \{ \theta ^ { 1 } . . . \theta ^ { T } \}$ and $\Phi = \{ \phi ^ { 1 } . . . \phi ^ { T } \}$ . Note that at each task $\mathcal { T } _ { t }$ , only dataset $\mathcal { D } ^ { t }$ is accessible. Most reigning methods assume an extra replay buffer to save samples from previous tasks and augment current dataset with the replay buffer. In the rehearsal-free setup (Wang et al., 2022c), we do not assume the existence of a replay buffer.
|
| 54 |
+
|
| 55 |
+
# 3.2 A TRAINING-FREE BASELINE
|
| 56 |
+
|
| 57 |
+
Let $\mathcal { D } _ { k } ^ { t }$ denote a set of samples belonging to class $k$ at session $t$ , we compute a prototype for each class $k$ as the mean embedding following Rebuffi et al. (2017):
|
| 58 |
+
|
| 59 |
+
$$
|
| 60 |
+
\pmb { \mu } _ { k } = \frac { 1 } { | \mathscr { D } _ { k } ^ { t } | } \sum _ { \pmb { x } \in \mathscr { D } _ { k } ^ { t } } f _ { \theta } ( \pmb { x } ) ,
|
| 61 |
+
$$
|
| 62 |
+
|
| 63 |
+
and save $\mu _ { k }$ to memory. $\theta$ is initialized by a pre-trained ViT (Dosovitskiy et al., 2021) and kept frozen across the whole process: ${ \theta } ^ { 1 } = { \theta } ^ { \dot { 2 } } = \dot { \cdot } \cdot \cdot = { \theta } ^ { T }$ . We maintain a collection of prototypes $U = \{ \pmb { u } _ { 1 } , \pmb { u } _ { 2 } . . . \pmb { u } _ { K } \}$ for $K$ classes that have been observed so far. Then we use the nearest-class-mean (NCM) (Mensink et al., 2013) classifier for classification:
|
| 64 |
+
|
| 65 |
+
$$
|
| 66 |
+
y ^ { * } = \underset { y = 1 \ldots K } { \arg \operatorname* { m i n } } \{ d ( { \pmb u } _ { y } , f _ { \theta } ( { \pmb x } ) ) \} ,
|
| 67 |
+
$$
|
| 68 |
+
|
| 69 |
+
where $d : \mathbb { R } ^ { D } \times \mathbb { R } ^ { D } \mathbb { R }$ is a distance function measuring the distance between two $D$ -dimensional embeddings. Here, we use the cosine distance following the common practice in self-supervised representation learning (Chen et al., 2020). This simple and training-free baseline produces promising results under a strong embedding function (see Table 4), confirming the crucial role played by the embedding and effectiveness of prototypes in the continual learning context.
|
| 70 |
+
|
| 71 |
+
# 3.3 CONTRASTIVE PROTOTYPICAL PROMPT
|
| 72 |
+
|
| 73 |
+
Steering prototypes with prompt. Ideally, a perfect static embedding function can project embeddings to the places that locate nearest to their corresponding prototypes in the latent space, thus preventing forgetting. However, in practice, an embedding function is ever-changing and samples from different categories yet with similar semantics can interleave in the latent space and cause interference. To this end, we leverage a group of extra learnable parameters (prompts) to adapt a fixed embedding function to up-to-now information and reemerge different snapshots of the model through combining it with different prompt groups. Specifically, we append a series of prompts $\pmb { p } _ { i } \in \mathbb { R } ^ { L _ { p } \times \smile D }$ to the existing tokens. $L _ { p }$ is the length of prompts, and $D$ denotes the embedding dimensionality. The information flow of a transformer layer $i$ is defined as:
|
| 74 |
+
|
| 75 |
+
$$
|
| 76 |
+
[ { \pmb { c } } _ { i } , { \pmb { e } } _ { i } ] = T _ { i } ( [ { \pmb { c } } _ { i - 1 } , { \pmb { p } } _ { i - 1 } , { \pmb { e } } _ { i - 1 } ] ) ,
|
| 77 |
+
$$
|
| 78 |
+
|
| 79 |
+
where $T _ { i }$ represents a multi-head self-attention block followed by a feed-forward block in the $i ^ { t h }$ layer. $\pmb { c } \in \mathbf { \mathbb { R } } ^ { 1 \times D }$ denotes the class token and $\boldsymbol { e } ~ \in \mathbb { R } ^ { L _ { e } \times D }$ are existing tokens with length $L _ { e }$ Operator $[ \cdot ]$ performs concatenation along the sequence length dimension. Here, we adopt deep prompt (Jia et al., 2022) by adding prompts to all $S$ layers. The prompt group for a task $t$ is denoted by $P ^ { \bar { t } } = \{ p _ { 1 } ^ { t } , p _ { 2 } ^ { t } . . . p _ { S } ^ { t } \}$ and the embedding function can be rewritten as:
|
| 80 |
+
|
| 81 |
+
$$
|
| 82 |
+
f _ { \theta ^ { t } } ( \cdot ) f _ { \{ \theta , P ^ { t } \} } ( \cdot ) .
|
| 83 |
+
$$
|
| 84 |
+
|
| 85 |
+
We maintain a collection of prompt groups as learning progresses and each prompt group is associated with a group of key and value prototypes that will be illustrated later in this section.
|
| 86 |
+
|
| 87 |
+
Contrastive prototypical loss. To effectively learn the prompt group and leverage it reduce prototype interference, we use a contrastive formulation which explicitly encourages alignments between embeddings and prototypes from the same class as well as pushing away embeddings and prototypes from different classes. In session $t$ , let $I = \{ ( x _ { 1 } , y _ { 1 } ) . . . ( x _ { N } , y _ { N } ) \}$ be a batch of $N$ image pairs and $Z = \{ z _ { 1 } . . . z _ { N } \}$ be their corresponding embeddings. We define $z = m _ { \sigma ^ { t } } ( f _ { \{ \theta ; P ^ { t } \} } ( { \pmb x } ) )$ where $m _ { \sigma ^ { t } } ( \cdot )$ is a multi-layer perception (MLP) parameterized by $\sigma ^ { t }$ . Note that $m _ { \sigma ^ { t } } ( \cdot )$ is re-initialized at each new task and being disposed during inference. The learning objective for a target prototype (class) $k$ is then defined as one-versus-all:
|
| 88 |
+
|
| 89 |
+
$$
|
| 90 |
+
\mathcal { L } ^ { k } = \sum _ { z _ { i } \in P ( i ) } \mathcal { L } _ { i } ^ { k } = \sum _ { z _ { i } \in P ( i ) } \frac { - 1 } { \vert \hat { P } ( i ) \vert } \sum _ { z _ { p } \in \hat { P } ( i ) } \log \frac { \exp ( \sin ( z _ { i } , z _ { p } ) / \tau ) } { \sum _ { z _ { n } \in N ( i ) } \exp ( \sin ( z _ { i } , z _ { n } ) / \tau ) } ,
|
| 91 |
+
$$
|
| 92 |
+
|
| 93 |
+
where $\sin ( \cdot , \cdot )$ denotes the similarity function and $i$ is the index of a data sample with label $k$ in the batch. $P ( i ) = \{ z _ { p } \in Z : y _ { p } = y _ { i } = k \}$ is a set of positive samples w.r.t. image $i$ and ${ \hat { P } } ( i ) = P ( i ) \cup \{ { \boldsymbol { \mathbf { u } } } _ { k } \}$ further includes the key prototype of class $k$ ; $N ( i ) ~ = ~ \{ z _ { n } \in~ Z ~ : ~ y _ { n } \ne$ $y _ { i } \} \cup \{ \mu _ { 1 } ^ { \prime } . . . \mu _ { k - 1 } ^ { \prime } \}$ is a collection of negative samples with $\mathbf { { \boldsymbol { u } } } ^ { \prime }$ representing the value prototype of the previously learned classes. Eq. 6 can be naturally generalized to a task-wise formulation by averaging over all M classes within the current task: Ltask = 1M PMm=1 . The embedding space in Fig. 2 illustrates the idea of the designed loss function. To better restrain the discrimination boundary, we further adopt prototype augmentation (Zhu et al., 2021) when using prototypes as negative anchors in denominator. Concretely, negative prototypes are randomly perturbed by a scaled Gaussian noise $\mathbf { \boldsymbol { e } } \sim \mathcal { N } ( \mathbf { \boldsymbol { 0 } } , \mathbf { \boldsymbol { 1 } } )$ with same dimension: ${ \hat { \pmb { \mu } } } _ { k } = { \pmb { \mu } } _ { k } + m * { \pmb { e } }$ , where scale factor $m$ is calculated as the average variance of the corresponding class embeddings.
|
| 94 |
+
|
| 95 |
+
The proposed contrastive prototypical loss deviates from the canonical supervised contrastive loss (Khosla et al., 2020) in following aspects. 1) We add prototypes as positive and negative anchors to avoid prototype interference in latent space. For instance, new data sample can locate at a position in the latent space where it is preoccupied with other samples from previous classes. In this case, positive anchors can prevent the distribution from being over-squeezed and shifted, while negative anchors can retain spaces for previous data. 2) We only use a single view for each data sample, i.e., we do not transform a sample into multiple different views. 3) The designed loss function only focuses on alignments of positive embeddings and does not constrain the intra-class uniformity, which is considered as one of the pivot properties that attributes to the success of contrastive representation learning Wang & Isola (2020). Concretely, we do not pair samples from the same category as negative pairs in the denominator. Since NCM classifier discriminates by selecting the closest prototype, and increasing intra-class uniformity can enlarge the distance between a sample and its corresponding prototype which is against the classification policy. (see an analysis from the energy perspective in Appendix. B). We refer to Appendix A for an analysis of gradients.
|
| 96 |
+
|
| 97 |
+
Inference by reemerging model snapshots. To effectively reemerge each snapshot of the model, we decouple the prototype of a class into two-fold: a key prototype and a value prototype. The key prototype $\pmb { \mu }$ is generated using the Eq. 2 at the beginning of a task. The value prototype $\mu ^ { \prime }$ is produced with Eq. 2 after inserting the learned prompt group by the end of the task. And we maintain a collection of key prototypes $U = \{ { \pmb u } _ { 1 } , . . , { \pmb u } _ { k } \}$ and value prototypes $U ^ { \prime } = \{ { \pmb u } _ { 1 } ^ { \prime } , . . , { \pmb u } _ { k } ^ { \prime } \}$ along the learning process. During inference, a coarse query vector $\pmb { q } : \mathbb { R } ^ { 1 \times D }$ is first generated followed by a query function $q ( \pmb q , U , r )$ to find $r$ nearest key prototypes and retrieve their corresponding prompt groups $\{ P ^ { 1 } . . . \dot { P ^ { r } } \}$ . Here, $\pmb q$ is simply the class token from the last layer and the query function measures the pair-wise cosine similarity between $\pmb q$ and key prototypes $U$ . Then, we leverage retrieved prompt groups to generate a set of fine-grained queries $\checkmark ^ { \prime } = \{ q _ { 1 } ^ { \prime } . . . q _ { r } ^ { \prime } \}$ where $\pmb q _ { r } ^ { \prime }$ is the generated in the same way as $\pmb q$ after inserting corresponding prompt group $P ^ { r }$ . At last, the class of value prototype that poses the minimum distance among
|
| 98 |
+
|
| 99 |
+

|
| 100 |
+
Figure 3: Two toy cases for average embedding prototype and multi-centroid prototype.
|
| 101 |
+
|
| 102 |
+
$Q ^ { \prime }$ will be the final prediction. Since the mismatched prompt group will increase distance between samples and their corresponding value prototypes and the correct prompt group will behave in an opposite way. Fig. 2 (right) depicts the information flow of the inference process. Please refer to Algs. 1 and 2 in Appendix C for summarization and see a discussion about inference efficiency in Appendix E.
|
| 103 |
+
|
| 104 |
+
# 3.4 MULTI-CENTROID PROTOTYPES
|
| 105 |
+
|
| 106 |
+
Existing literature in continual learning simply adopts the mean embedding when it comes to prototypes (Yu et al., 2020; Zhu et al., 2021; Zhou et al., 2022). In this case, it implicitly assumes the distribution in the latent space to be convex (e.g., a Gaussian distribution), and the distance function belongs to Bregman divergence (Snell et al., 2017). This premise may not hold in practice as no strict constraints are imposed on embedding distributions, and cosine similarity is not one of Bregman divergences. Fig. 3 displays two toy cases where class mean embedding fails to be representative. To this end, we propose to multi-centroid prototypes. Instead of using mean embedding, we generate a group of fictitious embeddings to characterize the class distribution. Given a set of embeddings from class $k$ , we first calculate similarity matrix $S _ { k } : \mathbb { R } ^ { N \times N }$ by measuring the pair-wise cosine similarity between all samples. We then perform spectral clustering $\mathrm { N g }$ et al., 2001) with $S _ { k }$ as affinity matrix to generate $C$ centroids $\{ \stackrel { } { u _ { k , c } } \} _ { c = 1 } ^ { C }$ , where $C$ is a hyper-parameter. To deploy this strategy, we substitute each prototype $\mathbf { \Delta } \mathbf { u } _ { k }$ to its corresponding multi-centroid prototype $\{ \boldsymbol { u } _ { k , c } \} _ { c = 1 } ^ { C }$ (for both key and value prototypes) in its existence during both training and inference process.
|
| 107 |
+
|
| 108 |
+
# 4 EXPERIMENTS
|
| 109 |
+
|
| 110 |
+
# 4.1 DATASETS
|
| 111 |
+
|
| 112 |
+
Split CIFAR-100 is a commonly used benchmark in continual learning. Following the standard setup, we evenly split CIFAR-100 into 10 disjoint tasks. Existing literature also explores split CIFAR-100 under multiple different splits. As such, we also report detailed session-wise results under 5, 10, 20 splits in Appendix I.
|
| 113 |
+
|
| 114 |
+
5-datasets is a collection of CIFAR-10 (Krizhevsky, 2009), MNIST (Lecun et al., 1998), FashionMNIST (Xiao et al., 2017), SVHN (Netzer et al., 2011), and notMNIST (Bulatov, 2011). Each dataset containing 10 classes is treated as one learning task. 5-datasets serves as a fair analog of real-word scenarios where inter-task diversity is large.
|
| 115 |
+
|
| 116 |
+
Split ImageNet-subset is typically deemed as a challenging and scaled-up benchmark for continual learning. Following Douillard et al. (2022), we divide a subset (100 classes) of ImageNet (Deng et al., 2009) into 10 tasks with 10 classes per task.
|
| 117 |
+
|
| 118 |
+
# 4.2 CONFIGURATION AND EVALUATION METRIC
|
| 119 |
+
|
| 120 |
+
Configuration. We use the following dataset-agnostic configuration for all experiments if not state otherwise. We train CPP (initialized with ImageNet pre-trained ViT-B/16) for 50 epochs with a batch size of 256 using the AdamW optimizer (Loshchilov & Hutter, 2019). The initial learning rate is set to $1 \times 1 0 ^ { - 3 }$ and anneals to $1 \times \mathrm { { 1 0 ^ { - 6 } } }$ according to the cosine scheduler. The prompt length $L _ { p }$ is set to 8, and we use deep prompt as default. The multi-centroid number $C$ and the number of nearest neighbors $r$ is set to 5 and 20, respectively. A 3-layer MLP with 2048 hidden units and 768 output dimension is randomly initialized at each session. We adopt transformations used in Dino (Caron et al., 2021) as our data augmentation, and all input images are resized to 224.
|
| 121 |
+
|
| 122 |
+
Table 1: Comparison with state-of-the-art rehearsal and rehearsal-free methods on split CIFAR-100 and 5-datasets. All results are reported using a ImageNet pre-trained ViT-B/16 for fairness.
|
| 123 |
+
|
| 124 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Buffer size</td><td colspan="2">Split CIFAR-100</td><td rowspan="2">Buffer size</td><td colspan="2">5-datasets</td></tr><tr><td>Avg. Acc (↑)</td><td>Forget (↓)</td><td>Avg. Acc (↑)</td><td>Forget (↓)</td></tr><tr><td>ER(Chaudhry et al.,2019b)</td><td rowspan="5">5000</td><td>82.53±0.17</td><td>16.46±0.25</td><td rowspan="5">500</td><td>84.26±0.84</td><td>12.85±0.62</td></tr><tr><td>BiC (Wu et ai.,2019)</td><td>81.42±0.85</td><td>17.31±1.02</td><td>85.53±2.06</td><td>10.27±1.32</td></tr><tr><td>GDumb (Prabhu et al., 2020)</td><td>81.67±0.02</td><td>-</td><td>-</td><td>-</td></tr><tr><td>DER++ (Buzzega et al.,2020)</td><td>83.94±0.34</td><td>14.55±0.73</td><td>84.88±0.57</td><td>10.46±1.02</td></tr><tr><td>Co²L (Cha et al.,2021)</td><td>82.49±0.89</td><td>17.48±1.80</td><td>86.05±1.03</td><td>12.28±1.44</td></tr><tr><td>FT-seq</td><td rowspan="5"></td><td>33.61±0.85</td><td>86.87±0.20</td><td rowspan="5">0</td><td>20.12±0.42</td><td>94.63±0.68</td></tr><tr><td>EWC (Lopez-Paz & Ranzato,2017)</td><td>47.01±0.29</td><td>33.27±1.17</td><td>50.93±0.09</td><td>34.94±0.07</td></tr><tr><td>LwF(Li& Hoiem,2018)</td><td>60.69±0.63</td><td>27.77±2.17</td><td>47.91±0.33</td><td>38.01±0.28</td></tr><tr><td>L2P (Wang et al., 2022c)</td><td>83.86±0.28</td><td>7.35±0.38</td><td>81.14±0.93</td><td>4.64±0.52</td></tr><tr><td>DualPrompt (Wang et al.,2022b)</td><td>86.51±0.33</td><td>5.16±0.09</td><td>88.08±0.36</td><td>2.21±0.69</td></tr><tr><td>CPP (ours)</td><td></td><td>89.43± 0.24</td><td>3.61±0.31</td><td>93.36±0.03</td><td></td><td>0.1±0.01</td></tr><tr><td>Upper-bound</td><td>=</td><td>90.85±0.12</td><td>-</td><td>=</td><td>93.93±0.18</td><td>-</td></tr></table>
|
| 125 |
+
|
| 126 |
+
Table 2: Comparison with architecture-based methods on Split CIFAR-100. Diff (lower is better) measures how close the performance to the upper-bound of the used backbone. † reported from the original papers. ‡ reported in DualPrompt (Wang et al., 2022b)
|
| 127 |
+
|
| 128 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Backbone</td><td rowspan="2">Avg. Acc (↑)</td><td rowspan="2">Diff (↓)</td><td rowspan="2">Pretrained</td><td rowspan="2">Buffer size</td><td colspan="2">Additional Parameters</td></tr><tr><td>MB</td><td>%</td></tr><tr><td>Upper-bound</td><td rowspan="5">ResNet18</td><td>80.41t</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>SupSup (Wortsman et al., 2020)</td><td>28.34±2.45*</td><td>52.07</td><td>X</td><td>0</td><td>3.0</td><td>6.5%</td></tr><tr><td>DualNet (Pham et al.,2021)</td><td>40.14±1.64*</td><td>40.27</td><td>X</td><td>1000</td><td>5.04</td><td>10.9%</td></tr><tr><td>RPSNet (Rajasegaran et al.,2019)</td><td>68.60t</td><td>11.81</td><td>X</td><td>2000</td><td>181</td><td>404%</td></tr><tr><td>DynaER(Yan et al.,2021)</td><td>74.64†</td><td>5.77</td><td>X</td><td>2000</td><td>19.8</td><td>43.8%</td></tr><tr><td>Upper-bound</td><td rowspan="2">ResNet152</td><td>88.54</td><td>-</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>DynaER(Yan et al.,2021)</td><td>71.01±0.58*</td><td>17.53</td><td>×</td><td>2000</td><td>159</td><td>68.5%</td></tr><tr><td rowspan="2">Upper-bound DyTox (Douillard et al., 2022)</td><td rowspan="2">Customized ViT</td><td>76.12†</td><td></td><td>-</td><td></td><td>-</td><td></td></tr><tr><td>62.06±0.25†</td><td>14.06</td><td>X</td><td>2000</td><td>0.04</td><td>0.38%</td></tr><tr><td rowspan="3">Upper-bound L2P (Wang et al.,2022c)</td><td rowspan="4">ViT-B/16</td><td>90.85±0.12‡</td><td>-</td><td>-</td><td>-</td><td></td><td></td></tr><tr><td>83.86±0.28‡</td><td>6.99</td><td>√</td><td>0</td><td>1.94</td><td>0.56%</td></tr><tr><td>86.51±0.33‡</td><td>4.34</td><td>√</td><td>0</td><td>1.90</td><td>0.55%</td></tr><tr><td>DualPrompt (Wang et al.,2022b)</td><td>89.43± 0.24</td><td>1.42</td><td>√</td><td>0</td><td>0.74</td><td>0.21%</td></tr></table>
|
| 129 |
+
|
| 130 |
+
Evaluation metric. We report widely used average accuracy and forgetting from the end session (Lopez-Paz & Ranzato, 2017; Chaudhry et al., 2019a; Wang et al., 2022b). All experiments run for 5 times with different seeds. We report the average and standard deviation for each metric. There are also a set of works reporting average accuracy across all sessions. As such, we provide detailed descriptions of evaluation metrics in Appendix H and results under both protocols in Appendix I.
|
| 131 |
+
|
| 132 |
+
# 4.3 COMPARISON WITH STATE OF THE ARTS
|
| 133 |
+
|
| 134 |
+
Rehearsal and rehearsal-free methods. We compare CPP to representative regularization-based methods: EWC (Lopez-Paz & Ranzato, 2017), LwF (Li & Hoiem, 2018), advanced rehearsalbased methods: $E R$ (Chaudhry et al., 2019b), GDumb (Prabhu et al., 2020), BiC (Wu et al., 2019), $D E R + +$ (Buzzega et al., 2020), $C o ^ { 2 } L$ (Cha et al., 2021), and state-of-the-art prompt-based methods: $L 2 P$ (Wang et al., 2022c), DualPrompt (Wang et al., 2022b). We report results from Wang et al. (2022b) where all baseline methods are reproduced with a pre-trained ViT-B/16. FT-seq represents typical sequential fine-tuning with a single linear classifier. As shown in Table 1, despite the rehearsalfree property of regularization-based methods, their performances lag behind a lot. Rehearsal-based methods, on the other hand, produce decent results under large memory budget. Prompt-based methods achieve state-of-the-art performances without using a rehearsal buffer. Our method surpasses existing approaches by a large margin on split CIFAR-100 and 5-datasets in terms of both classification accuracy and forgetting.
|
| 135 |
+
|
| 136 |
+
Table 3: Comparison with prototype-related methods on split ImageNet-subset and split CIFAR-100.
|
| 137 |
+
|
| 138 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Buffer size</td><td colspan="2">Split CIFAR-100</td><td colspan="2">Split ImageNet-subset</td></tr><tr><td>Backbone</td><td>Avg. Acc (↑)</td><td>Backbone</td><td>Avg. Acc (↑)</td></tr><tr><td>Upper-bound</td><td>-</td><td>ViT</td><td>90.85±0.12</td><td>MAE</td><td>94.22±0.18</td></tr><tr><td>iCaRL</td><td>2000</td><td>ResNet18</td><td>51.12 ±0.36</td><td>ResNet18</td><td>23.77±0.35</td></tr><tr><td>ProtoAug</td><td>0</td><td>ResNet18</td><td>36.32±0.33</td><td>ResNet18</td><td>27.16±0.24</td></tr><tr><td>iCaRL</td><td>2000</td><td>ViT</td><td>75.10±0.26</td><td>MAE</td><td>87.96±0.26</td></tr><tr><td>ProtoAug</td><td>0</td><td>ViT</td><td>64.1±0.20</td><td>MAE</td><td>72.72±0.31</td></tr><tr><td>CPP (ours)</td><td>0</td><td>ViT</td><td>89.43±0.24</td><td>MAE</td><td>93.90±0.12</td></tr></table>
|
| 139 |
+
|
| 140 |
+
Architecture-based methods. It is non-trivial to migrate ConvNet-based architectural methods to transformer-based methods, so we adopt the metric from Wang et al. (2022b) to measure the difference between the method and its corresponding upper bound. Table 2 shows that CPP largely bridges the gap between incremental learning and joint learning on split CIFAR-100 dataset. Moreover, CPP outperforms other prompt-based methods using less than $50 \%$ of trainable parameters, leading to a better memory efficiency which is one of the critical desiderata in continual learning (see Appendix F for a detailed analysis of scalability).
|
| 141 |
+
|
| 142 |
+
Table 4: We ablate the proposed CPP and the multi-centroid prototypes with four different pretraining methods on split CIFAR-100. When both CPP and multi-centroid are not applied, the model is equivalent to the training-free baseline model.
|
| 143 |
+
|
| 144 |
+
<table><tr><td rowspan="2">Pretrain</td><td rowspan="2">CPP</td><td rowspan="2">Multi-centroids</td><td colspan="2">Split CIFAR-100</td></tr><tr><td>Avg. Acc (↑)</td><td>Forgetting (↓)</td></tr><tr><td rowspan="4">Deit (Touvron et al.,2021)</td><td></td><td></td><td>71.9</td><td>9.97</td></tr><tr><td>√</td><td></td><td>80.32±0.6</td><td>8.36±0.74</td></tr><tr><td></td><td>√</td><td>74.6±0.18</td><td>8.42±0.13</td></tr><tr><td>√</td><td>√</td><td>81.33±0.37</td><td>6.28±0.53</td></tr><tr><td rowspan="4">Dino (Caron et al., 2021)</td><td></td><td></td><td>76.69</td><td>8.91</td></tr><tr><td>√</td><td></td><td>80.82±0.22</td><td>6.16±0.09</td></tr><tr><td></td><td>√</td><td>79.71±0.09</td><td>7.72±0.04</td></tr><tr><td>√</td><td>√</td><td>83.73±0.14</td><td>4.87±0.06</td></tr><tr><td rowspan="4">MAE (He et al.,2022)</td><td></td><td></td><td>74.65</td><td>8.6</td></tr><tr><td>√</td><td></td><td>80.26±0.46</td><td>8.74±0.25</td></tr><tr><td></td><td>√</td><td>76.71±0.17</td><td>8.21±0.05</td></tr><tr><td>√</td><td>√</td><td>82.28±0.38</td><td>6.65±0.33</td></tr><tr><td rowspan="4">ViT (Dosovitskiy et al., 2021)</td><td></td><td></td><td>75.97</td><td>7.83</td></tr><tr><td>√</td><td></td><td>88.73±0.17</td><td>3.88±0.20</td></tr><tr><td></td><td>√</td><td>78.62±0.11</td><td>6.81±0.02</td></tr><tr><td>√</td><td>√</td><td>89.43±0.24</td><td>3.61±0.31</td></tr></table>
|
| 145 |
+
|
| 146 |
+
Prototype-related methods. Here, we compare our method with state-of-the-art prototype-based methods, ProtoAug (Zhu et al., 2021) and iCaRL (Rebuffi et al., 2017), on split CIFAR-100 and split ImageNet-subset. To be impartial and prevents information leakage, we reproduce both methods using a ImageNet pre-trained ViT-B/16, whereas supervised pre-training method is used for split CIFAR-100 and MAE pre-training method (self-supervised) is used for split ImageNet-subset. We then carefully tune hyper-parameters to avoid reckless fail (see Appendix G for details). As shown in Table 3, and in agreement with observations in Ramasesh et al. (2022), a pre-trained ViT backbone indeed significantly boost performances of existing methods. Nevertheless, CPP displays a cuttingedge performance under the same backbone, manifesting a systematic advantage of our method over the existing prototype-based methods.
|
| 147 |
+
|
| 148 |
+
# 4.4 ABLATION STUDY
|
| 149 |
+
|
| 150 |
+
Effectiveness of proposed modules. Since embeddings are one of the key ingredients in our recipe, it is crucial to analyze CPP upon different embedding functions. To this end, we implement CPP on four up-to-date pre-training methods, ViT (Dosovitskiy et al., 2021), Deit (Touvron et al., 2021), Dino (Caron et al., 2021) and MAE (He et al., 2022) that sweep supervised and self/un-supervised learning as well as discriminative and generative models. As displayed in Table 4, both proposed modules are robust w.r.t. all four pre-training methods, bringing around $10 \%$ absolute improvements over the baseline models. Each design remains effective when being isolated, and the benefits are additive when combined. An interesting observation is that different pre-training methods can cause large performance variances from the prototype perspective and there is a positive correlation $( \rho = 0 . 6 0 )$ between performances of the baseline models and final results. We deem this as an informative discover that leaves further probe in future work.
|
| 151 |
+
|
| 152 |
+
Contrastive prototypical loss outperforms alternatives. In our framework, the designed asymmetric contrastive loss explicitly aligns the optimization target with the classification problem, but it is still critical to validate the design empirically. As such, we first compare our designed loss with two widely-used alternatives: $C E$ (cross-entropy) and SupCon (supervised contrastive loss) (Khosla et al., 2020). Then we independently add uniformity (w/ uniformity), remove prototypes (w/o prototype) and cancel prototype augmentation (w/o ProtoAug) to show the efficacy of each proposed component. As shown in Table 5, the proposed loss consistently outperforms other loss functions by a clear margin. Among different alternatives, SupCon is the most compatible, demonstrating the benefits of unifying optimization and classification space. In agreement with our intuition and analysis in Appendix B, encouraging uniformity results in a clear drop in performance, and removing prototypes (both positive and negative anchors) leads to inferior space allocation in the latent space. In addition, using prototype augmentation can also boost the performance.
|
| 153 |
+
|
| 154 |
+

|
| 155 |
+
Figure 4: Left: ablation on prompt length and deep prompt. Middle: centroid number v.s. number of query neighbors. Right: t-SNE visualizations for samples w/ (right) and w/o (left) prompt groups.
|
| 156 |
+
|
| 157 |
+
MLP is non-negligible. We show in Table 5 that nonlinearity introduced by the MLP is vital to the success of training prompt groups regardless of the loss design. This result coincides with the conventional practice in self-supervised representation learning, where MLP consistently improves the quality of representations.
|
| 158 |
+
|
| 159 |
+
Ablation for prompts. Two factors in prompt design can affect the final performance: prompt length (which indicates the number of trainable units at each layer) and deep prompt (which represents adding prompts to all layers instead of the first layer). As shown in Fig. 4 (left), deep prompt consistently outperforms the shallow prompt, suggesting the importance of steering features at different levels of abstraction. Also, an appropriate length can improve the performance. It is worth pointing out that CPP can still outperform existing methods by a large margin even with $L _ { p } = 1$ (using less than $1 / 2 0$ of parameters compared with DualPrompt). This result showcases a great parameter efficiency of our method which is critical towards the real-world scalable continual learning.
|
| 160 |
+
|
| 161 |
+
Table 5: Ablation study on contrastive prototypical loss and its alternatives.
|
| 162 |
+
|
| 163 |
+
<table><tr><td rowspan="2">Method</td><td colspan="2">Split CIFAR-100</td></tr><tr><td>Avg. Acc (↑)</td><td>Forgetting (↓)</td></tr><tr><td>CE (w/o mlp)</td><td>37.12±2.54</td><td>10.01±1.63</td></tr><tr><td>CE</td><td>87.98±0.32</td><td>4.53±0.35</td></tr><tr><td>SupCon (w/o mlp)</td><td>48.03±6.97</td><td>7.37±2.42</td></tr><tr><td>SupCon</td><td>88.60±0.18</td><td>3.89±0.32</td></tr><tr><td>CPP (w/o mlp)</td><td>55.43±7.74</td><td>0.8±0.29</td></tr><tr><td>CPP (w/ uniformity)</td><td>88.82±0.18</td><td>4.01±0.15</td></tr><tr><td>CPP (w/o prototype)</td><td>88.85±0.20</td><td>3.88±0.27</td></tr><tr><td>CPP (w/o ProtoAug)</td><td>89.18±0.15</td><td>3.78±0.30</td></tr><tr><td>CPP</td><td>89.43±0.24</td><td>3.61±0.31</td></tr></table>
|
| 164 |
+
|
| 165 |
+
Centroid number v.s. query radius. Both centroid number $C$ and query radius $r$ can impact how many prompt groups are actually retrieved for fine-grained matching. For example, with a fixed $r$ , increasing $C$ may result in fewer categories being visited and vice versa. Even though one can always traverse all prompt groups to avoid querying process, it will increase inference time as the task accumulates. As such, it is more cost-effective to select a proper combination of $C$ and $r$ Fig. 4 (middle) exhibits the result of a simple grid search on CIFAR-100, and the searched setting $C = 5$ and $r = 2 0$ ) works fairly well for all other datasets.
|
| 166 |
+
|
| 167 |
+
Visualizations. We visualize data samples and their corresponding prototypes (single centroid) from CIFAR-100 with and without inserting learned prompt groups. As displayed in Fig. 4 (right), while samples from the same class tend to locate near each other in the latent space, samples from different classes still interleave with each other. After prompt groups are added, samples from the same category are tightly clustered, while different classes are spread out. See Appendix K for additional visualizations and analysis.
|
| 168 |
+
|
| 169 |
+
# 5 CONCLUSION
|
| 170 |
+
|
| 171 |
+
In this study, we propose a simple and novel framework for rehearsal-free continual learning. It leverages task-specific prompt to reemerge each snapshot of a model so as to avoid semantic drift. It also uses prompt-tuning to steer prototypes to reduce interference in the latent space through contrastive learning on the mixture of data embeddings and prototypes. Empirically, CPP surpasses state-of-the-art methods by a large margin without using a rehearsal buffer or a test-time oracle. We comprehensively analyze the effectiveness of proposed components, showcasing clear and additive benefits. We believe CPP can shine a light on the design principle of real-world continual learning giving current advances in architecture design and representation learning.
|
| 172 |
+
|
| 173 |
+
# REFERENCES
|
| 174 |
+
|
| 175 |
+
Yaroslav Bulatov. Notmnist dataset. Google (Books/OCR), Tech. Rep.[Online]. Available: http://yaroslavvb. blogspot. it/2011/09/notmnist-dataset. html, 2, 2011.
|
| 176 |
+
|
| 177 |
+
Pietro Buzzega, Matteo Boschini, Angelo Porrello, Davide Abati, and SIMONE CALDERARA. Dark experience for general continual learning: a strong, simple baseline. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 15920–15930. Curran Associates, Inc., 2020.
|
| 178 |
+
|
| 179 |
+
Mathilde Caron, Hugo Touvron, Ishan Misra, Herv’e J’egou, Julien Mairal, Piotr Bojanowski, and Armand Joulin. Emerging properties in self-supervised vision transformers. 2021 IEEE/CVF International Conference on Computer Vision (ICCV), pp. 9630–9640, 2021.
|
| 180 |
+
|
| 181 |
+
H. Cha, J. Lee, and J. Shin. Co2l: Contrastive continual learning. In 2021 IEEE/CVF International Conference on Computer Vision (ICCV), pp. 9496–9505, 2021.
|
| 182 |
+
|
| 183 |
+
Arslan Chaudhry, Marc’Aurelio Ranzato, Marcus Rohrbach, and Mohamed Elhoseiny. Efficient lifelong learning with a-GEM. In International Conference on Learning Representations, 2019a.
|
| 184 |
+
|
| 185 |
+
Arslan Chaudhry, Marcus Rohrbach, Mohamed Elhoseiny, Thalaiyasingam Ajanthan, Puneet K Dokania, Philip HS Torr, and Marc’Aurelio Ranzato. On tiny episodic memories in continual learning. arXiv preprint arXiv:1902.10486, 2019b.
|
| 186 |
+
|
| 187 |
+
Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In Proceedings of the 37th International Conference on Machine Learning, ICML’20. JMLR.org, 2020.
|
| 188 |
+
|
| 189 |
+
MohammadReza Davari, Nader Asadi, Sudhir Mudur, Rahaf Aljundi, and Eugene Belilovsky. Probing representation forgetting in supervised and unsupervised continual learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 16712–16721, June 2022.
|
| 190 |
+
|
| 191 |
+
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pp. 248–255. Ieee, 2009.
|
| 192 |
+
|
| 193 |
+
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.
|
| 194 |
+
|
| 195 |
+
Arthur Douillard, Alexandre Rame, Guillaume Couairon, and Matthieu Cord. Dytox: Transformers ´ for continual learning with dynamic token expansion. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
|
| 196 |
+
|
| 197 |
+
Raia Hadsell, Dushyant Rao, Andrei Rusu, and Razvan Pascanu. Embracing change: Continual learning in deep neural networks. Trends in Cognitive Sciences, 24:1028–1040, 12 2020.
|
| 198 |
+
|
| 199 |
+
Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollar, and Ross Girshick. Masked ´ autoencoders are scalable vision learners. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 16000–16009, June 2022.
|
| 200 |
+
|
| 201 |
+
Menglin Jia, Luming Tang, Bor-Chun Chen, Claire Cardie, Serge Belongie, Bharath Hariharan, and Ser-Nam Lim. Visual prompt tuning. In European Conference on Computer Vision (ECCV), 2022.
|
| 202 |
+
|
| 203 |
+
Prannay Khosla, Piotr Teterwak, Chen Wang, Aaron Sarna, Yonglong Tian, Phillip Isola, Aaron Maschinot, Ce Liu, and Dilip Krishnan. Supervised contrastive learning. In Advances in Neural Information Processing Systems, volume 33, pp. 18661–18673. Curran Associates, Inc., 2020.
|
| 204 |
+
|
| 205 |
+
Alex Krizhevsky. Learning multiple layers of features from tiny images. 2009.
|
| 206 |
+
|
| 207 |
+
Ananya Kumar, Aditi Raghunathan, Robbie Matthew Jones, Tengyu Ma, and Percy Liang. Finetuning can distort pretrained features and underperform out-of-distribution. In International Conference on Learning Representations, 2022.
|
| 208 |
+
|
| 209 |
+
Y. Lecun, L. Bottou, Y. Bengio, and P. Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 1998.
|
| 210 |
+
|
| 211 |
+
Yann LeCun, Sumit Chopra, Raia Hadsell, Fu Jie Huang, and et al. A tutorial on energy-based learning. In PREDICTING STRUCTURED DATA. MIT Press, 2006.
|
| 212 |
+
|
| 213 |
+
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, November 2021.
|
| 214 |
+
|
| 215 |
+
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. Association for Computational Linguistics, aug 2021.
|
| 216 |
+
|
| 217 |
+
Zhizhong Li and Derek Hoiem. Learning without forgetting. IEEE Transactions on Pattern Analysis and Machine Intelligence, 40(12):2935–2947, 2018.
|
| 218 |
+
|
| 219 |
+
David Lopez-Paz and Marc’Aurelio Ranzato. Gradient episodic memory for continual learning. In Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017.
|
| 220 |
+
|
| 221 |
+
Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In International Conference on Learning Representations, 2019.
|
| 222 |
+
|
| 223 |
+
Arun Mallya and Svetlana Lazebnik. Packnet: Adding multiple tasks to a single network by iterative pruning. In 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7765– 7773, 2018.
|
| 224 |
+
|
| 225 |
+
Michael McCloskey and Neal J. Cohen. Catastrophic interference in connectionist networks: The sequential learning problem. volume 24 of Psychology of Learning and Motivation, pp. 109–165. Academic Press, 1989.
|
| 226 |
+
|
| 227 |
+
Thomas Mensink, Jakob J. Verbeek, Florent Perronnin, and Gabriela Csurka. Distance-based image classification: Generalizing to new classes at near-zero cost. IEEE Transactions on Pattern Analysis and Machine Intelligence, 35:2624–2637, 2013.
|
| 228 |
+
|
| 229 |
+
Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y. Ng. Reading digits in natural images with unsupervised feature learning. In NIPS Workshop on Deep Learning and Unsupervised Feature Learning 2011, 2011.
|
| 230 |
+
|
| 231 |
+
Andrew Y. Ng, Michael I. Jordan, and Yair Weiss. On spectral clustering: Analysis and an algorithm. In ADVANCES IN NEURAL INFORMATION PROCESSING SYSTEMS, pp. 849–856. MIT Press, 2001.
|
| 232 |
+
|
| 233 |
+
German I. Parisi, Ronald Kemker, Jose L. Part, Christopher Kanan, and Stefan Wermter. Continual lifelong learning with neural networks: A review. Neural Networks, 113:54–71, 2019. ISSN 0893-6080.
|
| 234 |
+
|
| 235 |
+
Quang Pham, Chenghao Liu, Doyen Sahoo, and HOI Steven. Contextual transformation networks for online continual learning. In International Conference on Learning Representations, 2020.
|
| 236 |
+
|
| 237 |
+
Quang Pham, Chenghao Liu, and Steven Hoi. Dualnet: Continual learning, fast and slow. In Advances in Neural Information Processing Systems, volume 34, pp. 16131–16144, 2021.
|
| 238 |
+
|
| 239 |
+
Ameya Prabhu, Philip Torr, and Puneet Dokania. Gdumb: A simple approach that questions our progress in continual learning. In The European Conference on Computer Vision (ECCV), August 2020.
|
| 240 |
+
|
| 241 |
+
Jathushan Rajasegaran, Munawar Hayat, Salman Khan, Fahad Shahbaz Khan, and Ling Shao. Random path selection for incremental learning. Advances in Neural Information Processing Systems, 2019.
|
| 242 |
+
|
| 243 |
+
Vinay Venkatesh Ramasesh, Aitor Lewkowycz, and Ethan Dyer. Effect of scale on catastrophic forgetting in neural networks. In International Conference on Learning Representations, 2022.
|
| 244 |
+
|
| 245 |
+
Sylvestre-Alvise Rebuffi, Alexander Kolesnikov, G. Sperl, and Christoph H. Lampert. icarl: Incremental classifier and representation learning. 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5533–5542, 2017.
|
| 246 |
+
|
| 247 |
+
Andrei A. Rusu, Neil C. Rabinowitz, Guillaume Desjardins, Hubert Soyer, James Kirkpatrick, Koray Kavukcuoglu, Razvan Pascanu, and Raia Hadsell. Progressive neural networks. CoRR, abs/1606.04671, 2016.
|
| 248 |
+
|
| 249 |
+
Jake Snell, Kevin Swersky, and Richard Zemel. Prototypical networks for few-shot learning. In Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017.
|
| 250 |
+
|
| 251 |
+
S. Thrun. A lifelong learning perspective for mobile robot control. In V. Graefe (ed.), Intelligent Robots and Systems. Elsevier, 1995.
|
| 252 |
+
|
| 253 |
+
Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Herve Jegou. Training data-efficient image transformers & distillation through attention. In Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pp. 10347–10357. PMLR, 18–24 Jul 2021.
|
| 254 |
+
|
| 255 |
+
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, volume 30. Curran Associates, Inc., 2017.
|
| 256 |
+
|
| 257 |
+
Tongzhou Wang and Phillip Isola. Understanding contrastive representation learning through alignment and uniformity on the hypersphere. In Proceedings of the 37th International Conference on Machine Learning, pp. 9929–9939, 2020.
|
| 258 |
+
|
| 259 |
+
Yabin Wang, Zhiwu Huang, and Xiaopeng Hong. S-prompts learning with pre-trained transformers: An occam’s razor for domain incremental learning, 2022a.
|
| 260 |
+
|
| 261 |
+
Zifeng Wang, Zizhao Zhang, Sayna Ebrahimi, Ruoxi Sun, Han Zhang, Chen-Yu Lee, Xiaoqi Ren, Guolong Su, Vincent Perot, Jennifer G. Dy, and Tomas Pfister. Dualprompt: Complementary prompting for rehearsal-free continual learning. 2022b.
|
| 262 |
+
|
| 263 |
+
Zifeng Wang, Zizhao Zhang, Chen-Yu Lee, Han Zhang, Ruoxi Sun, Xiaoqi Ren, Guolong Su, Vincent Perot, Jennifer Dy, and Tomas Pfister. Learning to prompt for continual learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 139–149, 2022c.
|
| 264 |
+
|
| 265 |
+
Mitchell Wortsman, Vivek Ramanujan, Rosanne Liu, Aniruddha Kembhavi, Mohammad Rastegari, Jason Yosinski, and Ali Farhadi. Supermasks in superposition. In Advances in Neural Information Processing Systems, volume 33, pp. 15173–15184. Curran Associates, Inc., 2020.
|
| 266 |
+
|
| 267 |
+
Yue Wu, Yinpeng Chen, Lijuan Wang, Yuancheng Ye, Zicheng Liu, Yandong Guo, and Yun Fu. Large scale incremental learning. In CVPR, pp. 374–382, 2019.
|
| 268 |
+
|
| 269 |
+
Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms, 2017.
|
| 270 |
+
|
| 271 |
+
Shipeng Yan, Jiangwei Xie, and Xuming He. Der: Dynamically expandable representation for class incremental learning. 2021.
|
| 272 |
+
|
| 273 |
+
Lu Yu, Bartlomiej Twardowski, Xialei Liu, Luis Herranz, Kai Wang, Yongmei Cheng, Shangling Jui, and Joost van de Weijer. Semantic drift compensation for class-incremental learning. 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 6980–6989, 2020.
|
| 274 |
+
|
| 275 |
+
Chi Zhang, Nan Song, Guosheng Lin, Yun Zheng, Pan Pan, and Yinghui Xu. Few-shot incremental learning with continually evolved classifiers. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2021.
|
| 276 |
+
|
| 277 |
+
Da-Wei Zhou, Fu-Yun Wang, Han-Jia Ye, Liang Ma, Shiliang Pu, and De-Chuan Zhan. Forward compatible few-shot class-incremental learning, 2022.
|
| 278 |
+
|
| 279 |
+
Fei Zhu, Xu-Yao Zhang, Chuang Wang, Fei Yin, and Cheng-Lin Liu. Prototype augmentation and self-supervision for incremental learning. In 2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
|
| 280 |
+
|
| 281 |
+
# A DETAILED DERIVATIONS FOR CONTRASTIVE PROTOTYPICAL LOSS
|
| 282 |
+
|
| 283 |
+
Here, we provide an analysis of gradients for proposed contrastive prototypical loss. It is sufficient to show gradients for a single prototype $k$ . To ease the notion, we abbreviate similarity between vector $z _ { i }$ and $z _ { j }$ as $s _ { i , j }$ . Therefore, the loss of a sample $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ w.r.t. prototype $k$ is:
|
| 284 |
+
|
| 285 |
+
$$
|
| 286 |
+
\mathcal { L } _ { i } ^ { k } = \frac { - 1 } { | \hat { P } ( i ) | } \sum _ { z _ { p } \in \hat { P } ( i ) } \log \frac { \exp ( s _ { i , p } / \tau ) } { \sum _ { z _ { n } \in N ( i ) } ^ { \sum } \exp ( s _ { i , n } / \tau ) }
|
| 287 |
+
$$
|
| 288 |
+
|
| 289 |
+
The gradient with respect to the similarity $s _ { i , j }$ between a positive pair $( z _ { i } , z _ { j } )$ where $j \in P ( i )$ can be derived as:
|
| 290 |
+
|
| 291 |
+
$$
|
| 292 |
+
\begin{array} { r l } & { \frac { \partial \mathcal { L } _ { i } ^ { k } } { \partial s _ { i , j } } = \frac { - 1 } { | \tilde { P } ( i ) | } \displaystyle \sum _ { s _ { r } \in \tilde { P } ( \tilde { 0 } ) } \frac { \partial } { \partial s _ { i , j } } \left( s _ { i , j } / \tau - \log \displaystyle \sum _ { s = \mathrm { e } ^ { - \mathrm { i } \chi _ { ( i ) } } } \exp ( s _ { i , n } / \tau ) \right) } \\ & { \quad = \frac { - 1 } { | \tilde { P } ( i ) | } \displaystyle \sum _ { s _ { r } \in \tilde { P } ( \tilde { 0 } ) } \left( \frac { 1 } { \tau } \cdot 1 [ p = j ] - \frac { \frac { \partial } { \partial s _ { i , j } } \left( \displaystyle \sum _ { s = \mathrm { e } ^ { - \mathrm { i } \chi _ { ( i ) } } } \exp ( s _ { i , n } / \tau ) \right) } { \displaystyle z _ { \mathrm { e } ^ { - \mathrm { i } \chi _ { ( i ) } } } \exp ( s _ { i , n } / \tau ) } \right) } \\ & { \quad = \frac { - 1 } { | \tilde { P } ( i ) | } \displaystyle \sum _ { s _ { r } \in \tilde { P } ( \tilde { 0 } ) } \left( \frac { 1 } { \tau } \cdot \mathbb { I } [ p = j ] - 0 \right) } \\ & { \quad = \frac { 1 } { \tau | \tilde { P } ( i ) | } \displaystyle z _ { s } \exp ( - 1 ) } \end{array}
|
| 293 |
+
$$
|
| 294 |
+
|
| 295 |
+
Here $\mathbb { 1 }$ is an indicator. Similarly, the gradient with respect to the similarity $s _ { i , m }$ between a negative pair $( z _ { i } , z _ { m } )$ where $m \in N ( i )$ is:
|
| 296 |
+
|
| 297 |
+
$$
|
| 298 |
+
\begin{array} { l } \displaystyle \frac { \partial \mathcal { E } _ { \xi , n } ^ { k } } { \partial \nu _ { i , m } } = \frac { - 1 } { | \mathcal { P } ( i ) | } \sum _ { \alpha , \alpha ^ { \ell } \neq \ell \neq 0 } \frac { \partial } { \partial s _ { i , m } } ( \begin{array} { l } { s _ { i , \alpha ^ { \ell } } \langle \tau - \log \big ( \sum _ { \alpha , \alpha \neq \ell } \exp ( s _ { i , \alpha ^ { \ell } } \tau ) \big ) } \\ { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ { \displaystyle = \frac { - 1 } { | \mathcal { P } ( i ) | } \sum _ { \alpha , \alpha ^ { \ell } \neq \ell \neq 0 } ( \frac { \sigma _ { \alpha , \ell } ^ { \ell } } { D _ { \alpha , \alpha ^ { \ell } } \big ( s _ { i , m } \big ( s _ { i , \alpha ^ { \ell } } ) \big ) } ( \begin{array} { l } { \frac { \sigma _ { \alpha , \alpha ^ { \ell } } } { \sigma _ { \alpha , \alpha ^ { \ell } } } } \\ { \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ { \displaystyle - \frac { \sigma _ { \alpha ^ { \ell } } } { D _ { \alpha ^ { \ell } } \big ( s _ { i , m } \big ( s _ { i , m } \big ) \big ) } } \end{array} ) ) } \\ { \displaystyle \quad \quad = \frac { 1 } { | \mathcal { P } ( i ) | } \sum _ { \alpha , \alpha ^ { \ell } \neq \ell \neq 0 } ( \frac { \exp ( s _ { i , \alpha ^ { \ell } } \int _ { \gamma } \cdot \frac { 1 } { \tau } \cdot \big [ \ln = m \big ] } { \sum _ { \alpha ^ { \ell } } \exp ( s _ { i , \alpha ^ { \ell } } \tau ) } ) } \\ { \displaystyle \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad \quad } \\ { \displaystyle = \frac { 1 } { \tau } \frac { \big ( 1 - \exp ( s _ { i , \alpha ^ { \ell } } \tau ) \big ) } { | \mathcal { P } ( i ) | } \frac { \exp ( s _ { i , \alpha ^ { \ell } } \tau ) ^ { \prime } } { \exp ( s _ { i , \alpha ^ { \ell } } \tau ) } } \end{array} \end{array}
|
| 299 |
+
$$
|
| 300 |
+
|
| 301 |
+
Taking gradients of loss $\mathcal { L } ^ { k }$ with respect to the similarity between a positive pair $s _ { i , j } = \sin ( z _ { i } , z _ { j } )$ and a negative pair $s _ { i , m } = \sin ( z _ { i } , z _ { m } )$ result in:
|
| 302 |
+
|
| 303 |
+
$$
|
| 304 |
+
\frac { \partial \mathcal { L } _ { i } ^ { k } } { \partial s _ { i , j } } = \frac { 1 } { \tau | \hat { P } ( i ) | } , \qquad \frac { \partial \mathcal { L } _ { i } ^ { k } } { \partial s _ { i , m } } = \frac { 1 } { \tau | \hat { P } ( i ) | } \cdot \frac { \exp ( s _ { i , m } / \tau ) } { \sum _ { z _ { n } \in N ( i ) } \exp ( s _ { i , n } / \tau ) } .
|
| 305 |
+
$$
|
| 306 |
+
|
| 307 |
+
The above derivation shows that positive similarities are treated equally and scaled by the temperature and the cardinality of the set of positive anchors. And property of implicit hard-case mining (i.e., proportional to the exponential term $\exp ( { s _ { i , m } } / { \tau } ) \rangle$ ) is inherited from a typical contrastive loss in negative term.
|
| 308 |
+
|
| 309 |
+
# B CPP IS AN ENERGY-BASED MODEL
|
| 310 |
+
|
| 311 |
+
The overall objective of an energy-based model (LeCun et al., 2006) (EBM) is to obtain an energy function $E _ { \theta } ( \dot { \mathbf { x } } ) : \mathbb { R } ^ { D } \mathbb { R }$ parameterized by $\theta$ that maps the high dimensional input $_ { \textbf { \em x } }$ to a scalar value. Giving an energy function $E _ { \theta } ( \cdot )$ , probability density $p ( { \pmb x } )$ can be expressed through Gibbs distribution:
|
| 312 |
+
|
| 313 |
+
$$
|
| 314 |
+
p ( y | x ) = \frac { \exp ( - E _ { \theta } ( x , y ) / \tau ) } { \int _ { y ^ { \prime } } \exp ( - E _ { \theta } ( x , y ^ { \prime } ) / \tau ) } = \frac { \exp ( - E _ { \theta } ( x , y ) / \tau ) } { \exp ( - E _ { \theta } ( x ) / \tau ) }
|
| 315 |
+
$$
|
| 316 |
+
|
| 317 |
+
where $E _ { \theta } ( x )$ is the Helmholtz free energy and $\tau$ is the temperature factor. As such:
|
| 318 |
+
|
| 319 |
+
$$
|
| 320 |
+
E _ { \theta } ( x ) = \tau \cdot - \log \int _ { y ^ { \prime } } \exp ( - E _ { \theta } ( x , y ^ { \prime } ) / \tau )
|
| 321 |
+
$$
|
| 322 |
+
|
| 323 |
+
When making final prediction under our framework, the categorical distribution can be represented as:
|
| 324 |
+
|
| 325 |
+
$$
|
| 326 |
+
p ( y | \boldsymbol { x } ) = \frac { \exp ( s _ { x , y } / \tau ) } { \sum _ { y ^ { \prime } = 1 } ^ { K } \exp ( s _ { x , y ^ { \prime } } / \tau ) }
|
| 327 |
+
$$
|
| 328 |
+
|
| 329 |
+
where $s _ { x , y } = \mathrm { s i m } ( f _ { \theta } ( \pmb { x } ) , \pmb { \mu } _ { y } )$ . Note that we here merge the prompt parameters $P$ into $\theta$ for the sake of simplicity. When connecting Eq. 13 with Eq. 11 and let $E _ { \theta } ( x , y ) = - s _ { x , y }$ , we see that the energy of $_ { \textbf { \em x } }$ can be expressed as:
|
| 330 |
+
|
| 331 |
+
$$
|
| 332 |
+
E _ { \theta } ( \pmb { x } ) = \tau \cdot - \log \sum _ { y = 1 } ^ { K } \exp ( s _ { x , y } / \tau )
|
| 333 |
+
$$
|
| 334 |
+
|
| 335 |
+
which is dominated by the largest similarity $s _ { x , y * }$ given an appropriate temperature $\tau$ . Above analysis drives to the conclusion that predicting the class of prototype which is most similar to a given query vector will generate lowest energy for the system (i.e., a more stable system). Now the question turns to whether the proposed contrastive prototypical loss serves as a qualified energy loss function.
|
| 336 |
+
|
| 337 |
+
To see this, we first simplify the Eq. 7 to a formulation where there is only one positive sample $z _ { \hat { p } }$ :
|
| 338 |
+
|
| 339 |
+
$$
|
| 340 |
+
\begin{array} { c } { { \mathcal { L } _ { i } ^ { k } = - \log \displaystyle \frac { \exp ( s _ { i , \hat { p } } ) } { \sum _ { \boldsymbol { \pi } _ { n } \in { \cal N } ( i ) } \exp ( s _ { i , n } / \tau ) } } } \\ { { = - s _ { i , \hat { p } } + \log \displaystyle \sum _ { z _ { n } \in { \cal N } ( i ) } \exp ( s _ { i , n } / \tau ) } } \end{array}
|
| 341 |
+
$$
|
| 342 |
+
|
| 343 |
+
when letting $z _ { \hat { p } }$ to be the value prototype $\pmb { \mu } _ { k } ^ { \prime }$ that used as classifier, we have:
|
| 344 |
+
|
| 345 |
+
$$
|
| 346 |
+
{ \mathcal L } _ { i } ^ { k } = \underbrace { - \mathrm { s i m } ( z _ { i } , { \mu } _ { k } ^ { \prime } ) } _ { \mathrm { p u s h d o w n ~ e n e r g y ~ f o r ~ p r o t o t y p e k } } + \log \sum _ { z _ { n } \in N ( i ) } \exp ( s _ { i , n } / \tau )
|
| 347 |
+
$$
|
| 348 |
+
|
| 349 |
+
As shown above, to minimize above loss, the first term will push down the energy for value prototype $\pmb { \mu } _ { k } ^ { \prime }$ and the second term will increase energies for other prototypes. So above simplified loss is an effective loss function for the energy model. However, the ground-truth prototype $\pmb { \mu } _ { k } ^ { \prime }$ is unavailable at training, instead a rough approximation $\mu _ { k }$ can be generated with Eq. 2 and a set of data samples are available. As such, Eq. 7 treat $\mu _ { k }$ and every sample embedding as positive prototypes and pulling the $z _ { i }$ to all of them simultaneously. This is equivalent to pulling $z _ { i }$ to a fictitious prototype that dynamically evolves with the distribution of embeddings. Since $\pmb { \mu } _ { k } ^ { \prime }$ is generated using the learned embeddings at the end of the task, Eq. 7 still approximately minimizes the energy between a sample and its correspondingly value prototype $\pmb { \mu } _ { k } ^ { \prime }$ even though $\pmb { \mu } _ { k } ^ { \prime }$ is not explicitly shows in loss function.
|
| 350 |
+
|
| 351 |
+
Finally, we show that encouraging uniformity is against the principle of the energy model. By encouraging uniformity as typical supervised or self-supervised contrastive loss (Chen et al., 2020;
|
| 352 |
+
|
| 353 |
+
Khosla et al., 2020), we turn Eq. 15 into:
|
| 354 |
+
|
| 355 |
+
$$
|
| 356 |
+
\begin{array} { l } { \displaystyle \mathcal { L } _ { i } ^ { k } = - \log \frac { \exp ( s _ { i , \hat { p } } ) } { \sum _ { \boldsymbol { z } _ { n } \in N ( i ) } \exp ( s _ { i , n } / \tau ) + \sum _ { \boldsymbol { z } _ { p } \in \tilde { \cal P } ( i ) } \exp ( s _ { i , p } / \tau ) } } \\ { = \displaystyle - s _ { i , \hat { p } } + \log \left( \sum _ { \boldsymbol { z } _ { n } \in N ( i ) } \exp ( s _ { i , n } / \tau ) + \sum _ { \boldsymbol { z } _ { n } \in \tilde { \cal P } ( i ) } \exp ( s _ { i , p } / \tau ) \right) } \end{array}
|
| 357 |
+
$$
|
| 358 |
+
|
| 359 |
+
As shown above, we can see that the second term in log function acts adversely with respect to $- s _ { i , \hat { p } }$ which minimizes the energy between a sample and its corresponding prototype. Hence, we intentionally remove the term that encourages the uniformity in typical contrastive loss from our designed loss.
|
| 360 |
+
|
| 361 |
+
During inference, the prediction process can be interpreted as selecting a prompt group that generates the most compatible embedding $z ^ { \prime }$ that has minimum energy with respect to a local system and its nearest value prototype is the predicted class. The Local system is generated through querying and making visible a predefined number of neighbors on the key manifold (i.e., manifold containing key prototypes).
|
| 362 |
+
|
| 363 |
+
# C ALGORITHMS FOR CPP
|
| 364 |
+
|
| 365 |
+
The pipeline of the proposed framework is summarized in Algoritm 1 and Algorithm 2.
|
| 366 |
+
|
| 367 |
+
# Algorithm 1: Training algorithm
|
| 368 |
+
|
| 369 |
+
Input: Pre-trained ViT model $f _ { \theta }$ , number of tasks $T$ , training epochs $E$ , training set
|
| 370 |
+
$\{ ( \pmb { x } _ { i } ^ { t } , \pmb { y } _ { i } ^ { t } ) \} _ { i = 1 } ^ { n _ { t } } \} _ { t = 1 } ^ { T }$ , prompt length $L _ { p }$ and centriod number $C$ .
|
| 371 |
+
for $t = 1 , \cdots , T$ do Initialize: MLP $m _ { \sigma ^ { t } }$ , prompt group $P ^ { t }$ , $U = \varnothing , U ^ { \prime } = \varnothing$ for class $k \in \mathcal { V } ^ { t }$ do Generate key prototype $\mu _ { k }$ with Eq. 2 U ← U ∪ µk end for $e = 1 , \cdots , E$ do Optimize $\sigma ^ { t }$ , $P ^ { t }$ through generalized Eq. 6 end Dispose $m _ { \sigma ^ { t } }$ $f _ { \theta } \gets f _ { \theta , P ^ { t } }$ for class $k \in \mathcal { V } ^ { t }$ do Generate value prototype $\pmb { \mu } _ { k } ^ { \prime }$ with Eq. 2 $U ^ { \prime } \gets U ^ { \prime } \cup \mu _ { k } ^ { \prime }$ end
|
| 372 |
+
end
|
| 373 |
+
Output: $\{ P ^ { t } \} _ { t = 1 } ^ { T }$ , $U$ and $U ^ { \prime }$ .
|
| 374 |
+
|
| 375 |
+
# D RELATIONS WITH PREVIOUS METHODS
|
| 376 |
+
|
| 377 |
+
There exists different taxonomies for continual learning methods (Parisi et al., 2019; Hadsell et al., 2020), we here take notions from Hadsell et al. (2020). Put conclusion first, CPP in this study is a hybrid method. From the view of prompt deployment, CPP is in consistent with modular models. Extra capacity is assigned when encountering new tasks and a specialization at task-level is maintained. Nevertheless, CPP does not necessarily suffer from computational issues and the
|
| 378 |
+
|
| 379 |
+
# Algorithm 2: Inference algorithm
|
| 380 |
+
|
| 381 |
+
Given: Pre-trained ViT model $f _ { \theta }$ , the collection of key prototypes $U$ , the collection of value prototypes $U ^ { \prime }$ , the collection of prompts $\{ P ^ { t } \} _ { t = 1 } ^ { T }$ , query funcion $q ( , , r )$ and pair-wise distance function $d$ .
|
| 382 |
+
|
| 383 |
+
Input: test image $_ { \textbf { \em x } }$
|
| 384 |
+
Initialize: $Q ^ { \prime } = \emptyset$ , $L = \mathcal { O }$
|
| 385 |
+
$\begin{array} { r } { \pmb q = f _ { \pmb \theta } ( \pmb x ) [ 0 , : ] } \end{array}$ ; // use class token as query vector
|
| 386 |
+
$M = q ( \pmb q , U , r )$ ; // retrieve indexes of r nearest key prototypes
|
| 387 |
+
for $t \in M$ do q0 = fθ,P t (x) Q0 ← Q0 ∪ q 0 L ← L ∪ µ 0t
|
| 388 |
+
end
|
| 389 |
+
y = arg min(d(Q0, L)) y=1...K
|
| 390 |
+
Output: label y
|
| 391 |
+
|
| 392 |
+
premise of test-time oracle as other modular methods. Inheriting parameter efficiency from prompttuning (Lester et al., 2021), CPP introduces negligible extra parameters for each incremental task. And since only prompts are updated with gradient descent and each task is associate with a fixed amount of prompts, the computational overhead is relatively small and constant. During inference, we leverage prototypes as key values and embeddings as quries to retrieve candiate prompt groups and thus avoid the requirement of test-time oracle. Taking prototype perspective, CPP can be categorized as a memory-based method, especially episodic memory method. We save prototypes in memory space and leverage to retain previous knowledge and also as classifiers during inference. Yet, unlike most memory-based method, we maintain information in a highly abstract and compressed manner and set them as anchors in latent space without forwarding them through the network.
|
| 393 |
+
|
| 394 |
+
# E DISCUSSION OF INFERENCE EFFICIENCY
|
| 395 |
+
|
| 396 |
+
Here, we analyze the efficiency of inference process for CPP and provides an engineering solution. The time complexity of different data samples can be different during inference and there is randomness. For example, when querying 5 nearest neighbors with key prototypes, it does not necessarily result in 5 different prompt groups due the existences of multi-centroid prototypes and task-level prompt groups. At worst case, when 5 nearest centroids are from totally different classes and these classes are contained in totally different tasks. Then the query function will return 5 different prompt groups. However, in practice, centroids from same class tend to locate near to each other and a prompt group is shared by all classes within a task. It results in much lesser prompt groups that being retrieved and number of prompt groups vary according to data samples. From an engineering perspective, one can leverage batch processing to accelerate the process. Concretely, one can directly append all prompt groups and input a batch of attention masks to differentiate different configurations.
|
| 397 |
+
|
| 398 |
+
# F DISCUSSION OF SCALABILITY
|
| 399 |
+
|
| 400 |
+
The scalability of a continual learning framework is one of the most crucial considerations in practice. It requires a framework to be first, memory efficient, consuming affordable memory footprint as tasks accumulate; second, computational efficient, using as less computational resources as possible; at last, privacy respectful, making it compatible with diverse real-world scenarios. We manage to analysis the scalability of our method with respect to these three aspects in the following paragraph.
|
| 401 |
+
|
| 402 |
+
For memory usage, there are two parts in our framework will cause increasing parameters during continual learning, prototypes and prompt groups. Using split CIFAR-100 as an instance, each new class will introduce $2 \times M \times 7 6 8$ extra parameters where $M$ denotes the centroid number and the factor 2 is due to the decoupling of key and value prototypes. Let $M = 5$ as in our setting, we only save $1 0 \times 7 6 8$ extra parameters for a new class, this consumes approximately only $1 / 2 0$ of memory as saving a single ImageNet image $( 2 2 4 \times 2 2 4 \times 3 )$ . Besides, each new task (containing 10 classes)
|
| 403 |
+
|
| 404 |
+
will bring a prompt group (w/ deep prompt) with $8 \times 1 2 \times 7 6 8$ parameters. When averaged over 10 classes, it is approximately equivalent to $1 0 \times 7 6 8$ per class. Note that the increasing rate of parameters introduced by prompt group are negatively correlated to the size of the task. When put together both sources of extra parameters, we can see that for each incremental class we have roughly $2 0 \times 7 6 8$ parameters which costs $0 . 0 1 5 3 6 \mathrm { M B }$ and is equivalent to $1 / 1 0$ of a single ImageNet image. Moreover, the increment of memory usage for each class is constant w.r.t. all scenarios from where saving explicit samples may suffer from memory surge due to the resolution change (e.g., with a 4K camera). With above discussion, we believe it is fair to say that our framework is benign to scalability issue in terms of memory usage. From a computational perspective, thanks to prompt-tuning, only a tiny portion of parameters are updated through backpropagation. And prototypes are leveraged as anchors in latent space, thus no explicit data samples from previous classes need to be forwarded through the network. So the computational cost during the training is also minimized. Finally, since all information from previous tasks are retained as a few latent vectors (i.e., the prototypes), the privacy is inherently protected.
|
| 405 |
+
|
| 406 |
+
# G REPRODUCTION DETAILS
|
| 407 |
+
|
| 408 |
+
Prototype-related methods. In Sec. 4.3, we compare our method to other representative prototypebased methods. To be impartial, we first run the original codes (ResNet-18 as feature extractor) on the same split ImageNet-subset and split CIFAR-100 as we used. In original setting of ProtoAug (Zhu et al., 2021), it uses 50 classes in initial session and 5 class for each incremental session. To be consistent with our setup, we change it to 10 classes per session and 10 sessions in total. Both iCaRL (Rebuffi et al., 2017) and ProtoAug (Zhu et al., 2021)’s technical designs are orthogonal to the choice of feature extractor. So we replace ResNet-18 with a pre-trained ViT-B/16 without the loss of fairness and keep other designs the same as originals. To take advantages of the pre-trained backbone, we set learning rate to 1e-4 for both methods according to a simple grid search and use the same training configuration as detailed in Sec. 4.2 for fairness.
|
| 409 |
+
|
| 410 |
+
DualPrompt on split ImangeNet-subset. Here, we further reproduce DualPrompt (Wang et al., 2022b) on split ImageNet-subset. The result can be seen in Table 6. To prevent information leakage, we use MAE pre-trained weights instead of the original ViT pre-trained weights. All other parameters are set following the original paper. Specifically, we set $L _ { e } = 2 0 , L _ { g } = 5 , s t a r t _ { e } = 3 , e n d _ { e } =$ $5 , s t a r t _ { g } = 1 , e n d _ { g } = 2$ . We train the model for 50 epochs with constant learning rate 0.005 and Adam optimizer is used. Since the original paper does not use split ImageNet-subset, there may exist a better configuration with further tuning.
|
| 411 |
+
|
| 412 |
+
Table 6: Reproduction of DualPrompt on split ImageNet-subset.
|
| 413 |
+
|
| 414 |
+
<table><tr><td>Methods</td><td colspan="2">split ImageNet-subset Avg. Acc (1)</td></tr><tr><td>DualPrompt (MAE)</td><td>92.5</td><td>Forget (↓) 2.0</td></tr><tr><td>CPP (ours)</td><td>93.9</td><td>1.89</td></tr></table>
|
| 415 |
+
|
| 416 |
+
# H EVALUATION METRICS
|
| 417 |
+
|
| 418 |
+
Let $A _ { i , j }$ be classification accuracy on the $j$ -th task after training on the $i$ -th task. After the model finishes training on the $i$ -th task, we compute the Average Accuracy $( A _ { i } )$ and Forgetting $( F _ { i } )$ as follows:
|
| 419 |
+
|
| 420 |
+
$$
|
| 421 |
+
\begin{array} { l } { \displaystyle { A _ { i } = \frac { 1 } { i } \sum _ { j = 1 } ^ { i } A _ { i , j } } } \\ { \displaystyle { F _ { i } = \frac { 1 } { i - 1 } \sum _ { j = 1 } ^ { i - 1 } \sum _ { j ^ { \prime } \in \{ 1 , \cdots , i - 1 \} } \big ( A _ { j ^ { \prime } , j } - A _ { i , j } \big ) } } \end{array}
|
| 422 |
+
$$
|
| 423 |
+
|
| 424 |
+
Assume there are $T$ tasks in total, we report accuracy from last session as $A c c = A _ { T }$ following (Lopez-Paz & Ranzato, 2017; Wang et al., 2022b). There are also a large body of literature (Li &
|
| 425 |
+
|
| 426 |
+
Hoiem, 2018; Zhu et al., 2021; Douillard et al., 2022) report macro average over all sessions as $\begin{array} { r } { A c c = \frac { 1 } { T } \sum _ { i = 1 } ^ { T } A _ { i } } \end{array}$ . To ease future reference, we provide results under both protocols in Appendix I.
|
| 427 |
+
|
| 428 |
+
# I RESULTS UNDER DIFFERENT PROTOCOLS
|
| 429 |
+
|
| 430 |
+
Detailed results for CIFAR-100 under different splits. Here, we provide session-wise results for split CIFAR-100 under different splits. As shown in Fig. 5, our method exhibits a clear and consistent improvements over other methods and the gap is enlarged as the length of task sequence increases.
|
| 431 |
+
|
| 432 |
+
Results under different metrics. Here, we provide results under two commonly used measurements as described in Appendix H.
|
| 433 |
+
|
| 434 |
+
Table 7: Results for CPP under different metrics.
|
| 435 |
+
|
| 436 |
+
<table><tr><td rowspan="2">Task num</td><td rowspan="2">Dataset</td><td rowspan="2">Pre-train</td><td colspan="2">Accuracy</td><td colspan="2">Forgetting</td></tr><tr><td>Avg. (↑)</td><td>Last (↑)</td><td>Avg. (↓)</td><td>Last (↓)</td></tr><tr><td>5</td><td>split CIFAR-100</td><td>ViT</td><td>92.6</td><td>89.58</td><td>3.99</td><td>3.97</td></tr><tr><td>10</td><td>split CIFAR-100</td><td>ViT</td><td>93.06</td><td>89.43</td><td>3.11</td><td>3.61</td></tr><tr><td>20</td><td>split CIFAR-100</td><td>ViT</td><td>92.49</td><td>88.25</td><td>3.66</td><td>4.56</td></tr><tr><td>5</td><td>5-datasets</td><td>ViT</td><td>95.15</td><td>93.36</td><td>0.12</td><td>0.1</td></tr><tr><td>10</td><td>split ImageNet-Sub</td><td>MAE</td><td>95.01</td><td>93.90</td><td>0.84</td><td>1.89</td></tr></table>
|
| 437 |
+
|
| 438 |
+
# J EXTRA ABLATIONS
|
| 439 |
+
|
| 440 |
+
Ablation for MLP design. As MLP layer is crucial for training prompts, we are curious about relations between MLP width (number of hidden units), deepth (layer numbers) and prompt quality. As shown in Table 8, either monotonously increasing layers or hidden units do not necessarily bring benefits. And 3-layer with 2048 hidden units, which is the same as the conventional practice in self-supervised representation learning, produces best performance in our framework. So we adopt this setting as default for all our experiments.
|
| 441 |
+
|
| 442 |
+
Table 8: Results on split cifar-100 under different MLP layer numbers.
|
| 443 |
+
|
| 444 |
+
<table><tr><td>Layer num</td><td>Hidden units</td><td colspan="2">Split CIFAR-100 Avg. Acc (↑) Forget (↓)</td></tr><tr><td>1</td><td>2048</td><td>82.16</td><td>4.58</td></tr><tr><td>3</td><td>1024</td><td>89.27</td><td>4.13</td></tr><tr><td>3</td><td>2048</td><td>89.43</td><td>3.61</td></tr><tr><td>3</td><td>4096</td><td>89.16</td><td>4.09</td></tr><tr><td>5</td><td>2048</td><td>88.54</td><td>3.20</td></tr></table>
|
| 445 |
+
|
| 446 |
+
Generation of multi-centriod prototypes. In CPP, we leverage spectral clustering to generate multi-centroid prototypes. Herein, we also provide results for commonly used $\mathbf { k }$ -means clustering algorithm. As shown in Table 9, spectral clustering empirically demonstrates better performance and we thus take it as default.
|
| 447 |
+
|
| 448 |
+
Table 9: Different clustering algorithms for generating multi-centroid prototypes.
|
| 449 |
+
|
| 450 |
+
<table><tr><td rowspan="2">Methods</td><td colspan="2">Split CIFAR-100</td></tr><tr><td>Avg. Acc (1)</td><td>Forget (↓)</td></tr><tr><td>K-means</td><td>89.02</td><td>4.18</td></tr><tr><td>Spectral Clustering</td><td>89.43</td><td>3.61</td></tr></table>
|
| 451 |
+
|
| 452 |
+

|
| 453 |
+
Figure 5: Comparison with state-of-the-art methods on CIFAR-100 under multiple splits.
|
| 454 |
+
|
| 455 |
+
Effectiveness of the query function. We assume that samples with similar semantics should tend to locate close to each other in latent space. It is convincing to see that, giving $r$ nearest neighbors, whether the true class falls in the candidates. In this case, top- $_ r$ accuracy in the coarse query process can be deemed as a rigid upper-bound for CPP. We here plot top- $\cdot r$ accuracy under the 5-centroid prototype environment in Fig. 6. We can see that top- $\mathbfit { \nabla } \mathcal { r }$ accuracy increases monotonically with $r$ and $r = 2 0$ works fairly well. Hence, query vector in combination with key prototypes and a reasonable hyper-parameter can be safely leveraged to retrieve candidate prompt groups.
|
| 456 |
+
|
| 457 |
+

|
| 458 |
+
Figure 6: Top-r accuracy of split CIFAR-100 under 5-centroid prototype.
|
| 459 |
+
|
| 460 |
+
# K DETAILED VISUALIZATIONS AND ANALYSIS
|
| 461 |
+
|
| 462 |
+
Fig. 7 displays training samples from CIFAR-100 in latent space under different configurations. Fig. 7a and Fig. 7b shows original data samples with their corresponding key prototypes and multicentroid key prototypes, respectively. As shown in figures, both single-centroid and multi-centroid key prototypes effectively characterize the distribution for each class. In Fig. 7c and Fig. 7d, when replacing key prototypes to value prototypes, there is a clear drift and mismatch between class distributions and their corresponding prototypes. Since value prototypes characterize the distribution of prompted samples in latent space, this observation manifests a clear distribution shift in latent space when adding prompts. And thus justify the necessity of decoupling prototypes into the key prototypes and value prototypes two sets. Fig. 7e and Fig. 7f shows value prototypes and embeddings of samples after adding prompts. Both single-centroid and multi-centroid value prototypes suits the learned distributions well according to visualizations, while multi-centroid value prototypes can better capture outliers and thus being more representative.
|
| 463 |
+
|
| 464 |
+
In Fig. 7, we have successfully shown the efficacy of key and value prototypes for representing training embeddings. So we test their performances on test dataset in Fig. 8, When leveraging key prototypes for coarse retrieval, it works fairly well according to Fig. 8a and Fig. 8b. Fig. 8c and Fig. 8d further validate the necessity of decoupling prototypes from test data view. There are some classes where key prototypes can still effectively characterize sample distribution after inserting prompts, suggesting less semantic overlap (easy to discriminate) and minor distribution shift. However, most classes fail to reuse key prototypes. When using value prototypes as classifiers for final prediction, Fig. 8e and Fig. 8f demonstrate a clear match which in turn results in high accuracy.
|
| 465 |
+
|
| 466 |
+

|
| 467 |
+
(a) Original train samples with key prototypes
|
| 468 |
+
|
| 469 |
+

|
| 470 |
+
(b) Original train samples with multi-centriod key prototypes
|
| 471 |
+
|
| 472 |
+

|
| 473 |
+
(c) Original train samples with value prototypes
|
| 474 |
+
|
| 475 |
+

|
| 476 |
+
(d) Original train samples with multi-centroid value prototypes
|
| 477 |
+
|
| 478 |
+

|
| 479 |
+
(f) Prompted train samples with multi-centriod value prototypes
|
| 480 |
+
|
| 481 |
+

|
| 482 |
+
Figure 7: Visualization for train data in CIFAR-100.
|
| 483 |
+
|
| 484 |
+
(e) Prompted train samples with value prototypes (e) Prompted test samples with multi-centroid value prototypes
|
| 485 |
+
|
| 486 |
+

|
| 487 |
+
(a) Original test samples with key prototypes
|
| 488 |
+
|
| 489 |
+

|
| 490 |
+
(b) Original test samples with multi-centriod key prototypes
|
| 491 |
+
|
| 492 |
+

|
| 493 |
+
(c) Prompted test samples with key prototypes
|
| 494 |
+
|
| 495 |
+

|
| 496 |
+
(d) Prompted test samples with multi-centroid key prototypes
|
| 497 |
+
|
| 498 |
+

|
| 499 |
+
Figure 8: Visualization for test data in CIFAR-100.
|
| 500 |
+
|
| 501 |
+

|
| 502 |
+
(f) Prompted test samples with value prototypes
|
md/dev/EcGGFkNTxdJ/EcGGFkNTxdJ.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/Fj1Tpym9KxH/Fj1Tpym9KxH.md
ADDED
|
@@ -0,0 +1,630 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# A CLOSER LOOK AT SMOOTHNESS IN DOMAIN ADVERSARIAL TRAINING
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Domain adversarial training has been ubiquitous for achieving invariant representations and is used widely for various domain adaptation tasks. In recent times, methods converging to smooth optima have shown improved generalization for supervised learning tasks like classification. In this work, we analyze the effect of smoothness enhancing formulations on domain adversarial training, the objective of which is a combination of task loss (eg. classification, regression etc.) and adversarial terms. In contrast to task loss, our analysis shows that converging to smooth minima w.r.t. adversarial loss leads to sub-optimal generalization on the target domain. Based on the analysis, we introduce the Smooth Domain Adversarial training (SDAT) procedure, which effectively enhances the performance of existing domain adversarial methods for both classification and object detection tasks. Our smoothness analysis also provides insight into the extensive usage of SGD over Adam in domain adversarial training.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Domain Adversarial Training (Ganin & Lempitsky, 2015) (DAT) refers to adversarial learning of neural network based feature representations that are invariant to the domain. For example, car images from the clipart domain have similar feature representations as car images from the web domain. DAT has been widely useful in diverse areas (cited 3540 times) such as fairness (Adel et al., 2019), object detection (Saito et al., 2019), domain generalization (Li et al., 2018), imageto-image translation (Liu et al., 2017) etc. The prime driver of research on DAT is its application in unsupervised Domain Adaptation (DA), which aims to learn a classifier using labeled source data and unlabeled target data, such that it generalizes well on target data. Various enhancements like superior objectives (Acuna et al., 2021; Zhang et al., 2019), architectures (Long et al., 2018) etc. have been proposed to improve its effectiveness. However, as DAT objective is combination of Generative Adversarial Network (GAN) (Goodfellow et al., 2014) and Empirical Risk Minimization (ERM) (Vapnik, 2013) objectives, there has not been much focus on explicitly analyzing the nature of optimization in DAT. One direction of work aiming to improve generalization of ERM on unseen data focuses on developing algorithms that converge to a smooth (or a flat) minima (Foret et al., 2021; Keskar & Socher, 2017). However, we find that these techniques, when directly applied for DAT, do not significantly improve the generalization on the target domain (Sec. 4 and 7).
|
| 12 |
+
|
| 13 |
+
In this work, we analyze the loss landscape near the optimal point obtained by DAT, to gain insights into curvature. We first focus on the eigen-spectrum of Hessian of the task loss (ERM term for classification) where we find that using Stochastic Gradient Descent (SGD) as optimizer converges to a smoother minima in comparison to Adam (Kingma & Ba, 2014). Further we find that smoother minima w.r.t.task loss leads to better generalization on the target domain. Contrary to task loss, we find that smoothness enhancing formulation for adversarial components worsen performance, rendering ERM-based techniques which enhance smoothness for all loss components ineffective. Hence we introduce Smooth Domain Adversarial Training (SDAT), which aims only to reach a smooth minima w.r.t. task loss, and helps in generalizing better on the target domain. SDAT requires an additional gradient computation step and can be combined with existing methods with a few lines of code. We show the soundness of the SDAT method theoretically by proving a generalization bound (Sec. 4) on target error. We extensively verify the empirical efficacy of SDAT across various datasets for classification (i.e., DomainNet, VisDA-2017 and Office-Home), along with showing a prototypical application in DA for object detection, demonstrating it’s diverse applicability. In summary, we make the following contributions:
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
Figure 1: Overview of Smooth Domain Adversarial Training. Conventional approaches of smoothing loss do not discriminate between adversarial loss and task loss. Based on our theoretical analysis we propose SDAT which only focuses on smoothing task loss, leading to effective generalization on target domain.
|
| 17 |
+
|
| 18 |
+
• We analyze the optimization procedure of DAT, establishing the correlation between the smoothness near optima w.r.t. task loss and generalization on the target domain. • Contrary to ERM, we show through our theoretical and empirical analysis that smoothness enhancing adversarial formulation leads to sub-optimal performance. • For enhancing the smoothness w.r.t. task loss near optima in DAT, we propose a novel and theoretically motivated SDAT that improves the generalization on the target domain. SDAT effectively increases the average performance of even state-of-the-art adversarial adaptation methods.
|
| 19 |
+
|
| 20 |
+
# 2 RELATED WORK
|
| 21 |
+
|
| 22 |
+
Unsupervised Domain Adaptation: It refers to a class of methods that aim to adapt models to work in a target domain distinct from what it was trained on. One of the most prominent lines of work is based on DAT (Ganin & Lempitsky, 2015). This involves using an additional discriminator to distinguish between samples of source and target domain. The goal of the model is to learn features that can not be distinguished between source and target. The follow-up works have improved this basic idea by introducing a class information based discriminator (CDAN (Long et al., 2018)), introducing a transferable normalization function (Wang et al., 2019) etc. In this work, we focus on analyzing and improving such methods. Another line of work involves DA by using self-training on target domain (Kundu et al., 2020b;a; Prabhu et al., 2020) which will not be the focus of this work.
|
| 23 |
+
|
| 24 |
+
Smoothness of Loss Landscape: As neural networks operate in the regime of over parameterized models, low error on training data does not always lead to better generalization (Keskar et al., 2017). Often it has been stated (He et al., 2019; Dziugaite & Roy, 2017) that smoother minima does generalize better on unseen data. But until recently, this was practically expensive as smoothing required additional costly computations. Recently, a method called Sharpness Aware Minimization (SAM) (Foret et al., 2021) has been proposed to find a smoother minima with an additional gradient computation step. SAM also improves the ImageNet model performance (Chen et al., 2021) on ImageNet-C and ImageNet-R (which are out of distribution). It has also been observed that smoothness w.r.t. input (image) is beneficial for domain adaptation (Shu et al., 2018; Cai et al., 2021), which motivates us to explore smoothness w.r.t weights (W) in case of DAT. However, the earlier work has focused on achieving a smoother minima w.r.t. W for ERM. Currently, no study has been done if the loss function is composed of both ERM and adversarial objectives (as present in DAT).
|
| 25 |
+
|
| 26 |
+
# 3 BACKGROUND
|
| 27 |
+
|
| 28 |
+
# 3.1 PRELIMINARIES
|
| 29 |
+
|
| 30 |
+
We will primarily focus on Unsupervised DA where we have labeled source data $S = \{ ( x _ { i } ^ { s } , y _ { i } ^ { s } ) \}$ and unlabeled target data $T = \{ ( x _ { i } ^ { t } ) \bar \}$ . The source samples are assumed to be sampled i.i.d. from source distribution $P _ { S }$ defined on input space $\mathcal { X }$ , similarly target samples are sampled i.i.d. from $P _ { T }$ . $\mathcal { V }$ is used for denoting the label set which is $\{ 1 , 2 , \ldots , k \}$ in our case as we perform multiclass $( k )$ classification. We denote $y : \mathcal { X } \mathcal { Y }$ a mapping from images to labels. Our task is to find a hypothesis function $h _ { \theta }$ that has a low risk on the target distribution. The source risk (a.k.a expected error) of the hypothesis $h _ { \theta }$ is defined with respect to loss function $l$ as: $R _ { S } ^ { l } ( h _ { \theta } ) = \mathbb { E } _ { x \sim P _ { S } } [ \bar { l } ( h _ { \theta } ( x ) , y ( x ) ) ]$ . The target risk $R _ { T } ^ { l } ( h _ { \theta } )$ is defined analogously. The empirical versions of source and target risk will be denoted by $\hat { R } _ { S } ^ { l } ( h _ { \theta } )$ and $\hat { R } _ { T } ^ { l } ( h _ { \theta } )$ . All notations used in paper are summarized in Table F. In this work we build on the domain adaption theory of (Acuna et al., 2021) which is a generalization of Ben-David et al. (2010). We first define the discrepancy between the two domains.
|
| 31 |
+
|
| 32 |
+
Definition 3.1 $( D _ { h _ { \theta } , \mathcal { H } } ^ { \phi }$ discrepancy). The discrepancy between two domains $P _ { S }$ and $P _ { T }$ is defined
|
| 33 |
+
|
| 34 |
+
$$
|
| 35 |
+
D _ { h _ { \theta } , \mathcal { H } } ^ { \phi } ( P _ { S } | | P _ { T } ) : = \operatorname* { s u p } _ { h ^ { \prime } \in \mathcal { H } } [ \mathbb { E } _ { x \sim P _ { S } } [ l ( h _ { \theta } ( x ) , h ^ { \prime } ( x ) ) ] ] - [ \mathbb { E } _ { x \sim P _ { T } } [ \phi ^ { * } ( l ( h _ { \theta } ( x ) , h ^ { \prime } ( x ) ) ) ] ]
|
| 36 |
+
$$
|
| 37 |
+
|
| 38 |
+
Here $\phi ^ { * }$ is a frenchel conjugate of a lower semi-continuous convex function $\phi$ that satisfies $\phi ( 1 ) = 0$ , and $\mathcal { H }$ is the set of all possible hypothesis (i.e. Hypothesis Space).
|
| 39 |
+
|
| 40 |
+
This discrepancy distance $D _ { h _ { \theta } , \mathcal { H } } ^ { \phi }$ is based on variational formulation of f-divergence (Nguyen et al., 2010) for the convex function $\phi$ . The $D _ { h _ { \theta } , \mathcal { H } } ^ { \phi }$ is the lower bound estimate of the f-divergence function $D ^ { \phi } ( P _ { S } | | P _ { T } )$ . See Lemma 4 in (Acuna et al., 2021) for additional details. We state a bound on target risk $R _ { T } ^ { l } ( h _ { \theta } )$ based on $\mathcal { D } _ { h _ { \theta } , \mathcal { H } } ^ { \phi }$ discrepancy (Acuna et al., 2021):
|
| 41 |
+
|
| 42 |
+
Theorem 1 (Generalization bound). Suppose $l : \mathcal { V } \times \mathcal { Y } \to [ 0 , 1 ] \subset d o m \phi ^ { * } .$ . Let $h ^ { * }$ be the ideal joint classifier with least $\lambda ^ { * } = R _ { S } ^ { l } ( h ^ { * } ) + R _ { T } ^ { l } ( h ^ { * } )$ (i.e. joint risk) in $\mathcal { H }$ . We have the following relation between source and target risk:
|
| 43 |
+
|
| 44 |
+
$$
|
| 45 |
+
R _ { T } ^ { l } ( h _ { \theta } ) \leq R _ { S } ^ { l } ( h _ { \theta } ) + D _ { h _ { \theta } , \mathcal { H } } ^ { \phi } ( P _ { S } | | P _ { T } ) + \lambda ^ { * }
|
| 46 |
+
$$
|
| 47 |
+
|
| 48 |
+
The above generalization bound shows that the target risk $R _ { T } ^ { l } ( h _ { \theta } )$ is upper bounded by the source risk $R _ { S } ^ { l } ( h _ { \theta } )$ and the discrepancy term $D _ { h _ { \theta } , \mathcal { H } } ^ { \phi }$ along with an irreducible constant error $\lambda ^ { * }$ . Hence, this infers that reducing source risk and discrepancy lead a to reduction in target risk. Based on this, we concretely define the unsupervised adversarial adaptation procedure in the next section.
|
| 49 |
+
|
| 50 |
+
# 3.2 UNSUPERVISED DOMAIN ADAPTATION
|
| 51 |
+
|
| 52 |
+
In this section we first define the components of the framework we use for our purpose: $h _ { \theta } = f _ { \Theta } \circ g _ { \psi }$ where $g _ { \psi }$ is the feature extractor and $f _ { \Theta }$ is the classifier. The domain discriminator $\mathcal { D } _ { \Phi }$ , used for estimating the discrepancy between $P _ { S }$ and $P _ { T }$ is a classifier whose goal is to distinguish between the features of two domains. For minimizing the target risk (Th. 1), the optimization problem can be written as:
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
\operatorname* { m i n } _ { \theta } \mathbb { E } _ { x \sim P _ { S } } [ l ( h _ { \theta } ( x ) , y ( x ) ) ] + D _ { h _ { \theta } , \mathcal { H } } ^ { \phi } ( P _ { S } | | P _ { T } )
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
The discrepancy term under some assumptions (refer App. B) can be upper bounded by a tractable term:
|
| 59 |
+
|
| 60 |
+
$$
|
| 61 |
+
D _ { h _ { \theta } , \mathcal { H } } ^ { \phi } ( P _ { S } | | P _ { T } ) \leq \operatorname* { m a x } _ { \Phi } d _ { S , T } ^ { \Phi }
|
| 62 |
+
$$
|
| 63 |
+
|
| 64 |
+
where $d _ { S , T } ^ { \Phi } = \mathbb { E } _ { x \sim P _ { S } } [ \log ( \mathcal { D } _ { \Phi } ( g _ { \psi } ( x ) ) ) ] + \mathbb { E } _ { x \sim P _ { T } } \log [ 1 - \mathcal { D } _ { \Phi } ( g _ { \psi } ( x ) ) ]$ . This leads to the final optimization objective of:
|
| 65 |
+
|
| 66 |
+
$$
|
| 67 |
+
\operatorname* { m i n } _ { \theta } \operatorname* { m a x } _ { \Phi } \mathbb { E } _ { x \sim P _ { S } } [ l ( h _ { \theta } ( x ) , y ( x ) ) ] + d _ { S , T } ^ { \Phi }
|
| 68 |
+
$$
|
| 69 |
+
|
| 70 |
+
The first term in practice is empirically approximated by using finite samples $\hat { R } _ { S } ^ { l } ( h _ { \theta } )$ and used as task loss (classification) for minimization. The empirical estimate of the second term is adversarial loss which is optimized using a gradient reversal layer (GRL) as it has a min-max form. (Overview in Fig. 1) The above procedure composes DAT, and we use CDAN (Long et al., 2018) as our default DAT method.
|
| 71 |
+
|
| 72 |
+

|
| 73 |
+
Figure 2: Eigen Spectral Density plots of Hessian $( \nabla ^ { 2 } \hat { R } _ { S } ^ { l } ( h _ { \theta } ) )$ for Adam (left), SGD (middle) and SDAT (right) on Art Clipart. Each plot contains the maximum eigenvalue $( \lambda _ { m a x } )$ and the trace of the Hessian $( T r ( H ) )$ , which are indicators of the smoothness (Lower $T r ( H )$ and $\lambda _ { m a x }$ indicate the presence of smoother loss surface). Low range of eigenvalues $\mathbf { \dot { x } }$ -axis), ${ \dot { T r } } ( H )$ and $\lambda _ { m a x }$ for SGD indicates that it reaches a smoother minima compared to Adam. SDAT reaches a smoother minima compared to DAT with either SGD and Adam.
|
| 74 |
+
|
| 75 |
+
# 4 ANALYSIS OF SMOOTHNESS
|
| 76 |
+
|
| 77 |
+
In this section, we analyze the curvature properties of the loss with respect to the parameters. Specifically, we focus on analyzing the Hessian of empirical source risk $H = \nabla _ { \theta } ^ { 2 } \hat { R } _ { S } ^ { l } ( h _ { \theta } )$ which is the Hessian of classification (task) loss term. For quantifying the smoothness, we measure the trace $T r ( H )$ and maximum eigenvalue of Hessian $( \lambda _ { m a x } )$ as a proxy for quantifying smoothness. This is motivated by analysis of which states that the high value of $\lambda _ { m a x }$ and $T r ( H )$ are indicative of low smoothness (Jastrzebski et al., 2020). We articulate our conjecture informally below:
|
| 78 |
+
|
| 79 |
+
Conjecture 1. Smoothing of empirical source risk (i.e. task loss) $\hat { R } _ { S } ^ { l } ( h _ { \theta } )$ leads to efficient DAT. In other words, decreasing $\lambda _ { m a x }$ of $\nabla _ { { \theta } } ^ { 2 } \hat { R } _ { S } ^ { l } ( h _ { \theta } )$ leads to reduced error on target domain $\hat { R } _ { T } ^ { l } ( h _ { \theta } )$ .
|
| 80 |
+
|
| 81 |
+
For verifying our conjecture, we analyze the eigen spectrum of the Hessian $\hat { R } _ { T } ^ { l } ( h _ { \theta } )$ where we find that in contrast to standard ERM (Ghorbani et al., 2019) the negative eigenvalues do not disappear as the training progresses. We show the $\lambda _ { m a x }$ , $T r ( H )$ and eigen spectrum for different algorithms, namely DAT w/ Adam, DAT w/ SGD and our proposed SDAT (which is described in detail in later sections) in Fig. 2. We find that high smoothness leads to better generalization on the target domain. We also provide additional results in Fig. 3 for empirical verification of the conjecture. Our conjecture also explains the reason for widespread usage of SGD for DAT as SGD converges to smoother minima (Ganin & Lempitsky, 2015; Long et al., 2018; Saito et al., 2018a) which leads to efficient DAT, even though Adam has shown to be effective for min-max optimization (Gemp & McWilliams, 2019). More details regarding the Hessian analysis are provided in App. D.
|
| 82 |
+
|
| 83 |
+
# 4.1 SMOOTHING LOSS LANDSCAPE
|
| 84 |
+
|
| 85 |
+
In this section we first introduce the losses which are based on Sharpness Aware Minimization (Foret et al., 2021) (SAM). The basic idea of SAM is to find a smoother minima (i.e. low loss in $\epsilon$ neighborhood of $\theta$ ) by using the following objective given formally below:
|
| 86 |
+
|
| 87 |
+
$$
|
| 88 |
+
\operatorname* { m i n } _ { \theta } \operatorname* { m a x } _ { | | \epsilon | | \leq \rho } L _ { o b j } ( \theta + \epsilon )
|
| 89 |
+
$$
|
| 90 |
+
|
| 91 |
+
Here $L _ { o b j }$ is any objective function to be minimized and $\rho \geq 0$ is a hyperparameter which defines the maximum norm of the $\epsilon$ . Since finding the exact solution of inner maximization is hard, SAM maximizes the first order approximation:
|
| 92 |
+
|
| 93 |
+
$$
|
| 94 |
+
\boldsymbol { \hat { \epsilon } } ( \theta ) \approx \underset { | | \boldsymbol { \epsilon } | | \leq \rho } { \arg \operatorname* { m a x } } \ L _ { o b j } ( \theta ) + \boldsymbol { \epsilon } ^ { T } \nabla _ { \theta } L _ { o b j } ( \theta ) = \rho \nabla _ { \theta } L _ { o b j } ( \theta ) / | | \nabla _ { \theta } L _ { o b j } ( \theta ) | | _ { 2 }
|
| 95 |
+
$$
|
| 96 |
+
|
| 97 |
+
The $\hat { \epsilon } ( \theta )$ is added to the weights $\theta$ . The gradient update for $\theta$ is then computed as $\nabla _ { \theta } L _ { o b j } ( \theta ) | _ { \theta + \hat { \epsilon } ( \theta ) }$ . The above procedure can be seen as a generic smoothness enhancing formulation for any $L _ { o b j }$ . We now analogously introduce the sharpness aware source risk for finding a smooth minima:
|
| 98 |
+
|
| 99 |
+
$$
|
| 100 |
+
\operatorname* { m a x } _ { | | \epsilon | | \leq \rho } R _ { S } ^ { l } ( h _ { \theta + \epsilon } ) = \operatorname* { m a x } _ { | | \epsilon | | \leq \rho } \mathbb { E } _ { x \sim P _ { S } } [ l ( h _ { \theta + \epsilon } ( x ) , f ( x ) ) ]
|
| 101 |
+
$$
|
| 102 |
+
|
| 103 |
+

|
| 104 |
+
Figure 3: A) Error on Target Domain (y-axis) for Office-Home dataset against maximum eigenvalue $\lambda _ { m a x }$ of classification loss in DAT. When compared to SGD, Adam converges to a non-smooth minima (high $\lambda _ { m a x , \ - }$ ), leading to a high error on target. B) Domain Accuracy (vs iterations) is lower when discriminator is smooth (i.e. SDAT w/ adv), which indicates suboptimal discrepancy estimation $d _ { s _ { , t } } ^ { \Phi }$ C) SNGAN performance on different datasets, smoothing discriminator in GAN also leads to inferior GAN performance (higher FID) across both datasets.
|
| 105 |
+
|
| 106 |
+
We also now define the sharpness aware discrepancy estimation objective below:
|
| 107 |
+
|
| 108 |
+
$$
|
| 109 |
+
\operatorname* { m a x } _ { \Phi } \operatorname* { m i n } _ { | | \epsilon | | \leq \rho } d _ { S , T } ^ { \Phi + \epsilon }
|
| 110 |
+
$$
|
| 111 |
+
|
| 112 |
+
As $d _ { S , T } ^ { \Phi }$ is to be maximized the sharpness aware objective will have min instead of max , as it $| | \epsilon | | \le \rho$ $| | \epsilon | | \le \rho$ needs to find smoother maxima. We now theoretically analyse the difference in discrepancy estimation for smooth version $d _ { S , T } ^ { \Phi ^ { \prime \prime } }$ (Eq. 9) in comparison to non-smooth version $d _ { S , T } ^ { \Phi ^ { \prime } }$ (Eq. 4). Assuming $\mathcal { D } _ { \Phi }$ is a $L$ -smooth (common assumption for non-convex optimization (Carmon et al., 2020)), $\eta$ is a small constant and $d _ { S , T } ^ { * }$ the optimal discrepancy, the theorem states:
|
| 113 |
+
|
| 114 |
+
Theorem 2. For a given classifier $h _ { \theta }$ and one step of (steepest) gradient ascent i.e. $\Phi ^ { \prime } = \Phi + $ $\eta ( \nabla d _ { S , T } ^ { \Phi } / | | \nabla d _ { S , T } ^ { \Phi } | | )$ and $\Phi ^ { \prime \prime } = \Phi + \eta ( \nabla d _ { S , T } ^ { \Phi } | _ { \Phi + \hat { \epsilon } ( \Phi ) } / | | \nabla d _ { S , T } ^ { \Phi ^ { - } } | _ { \Phi + \hat { \epsilon } ( \Phi ) } | | )$
|
| 115 |
+
|
| 116 |
+
$$
|
| 117 |
+
d _ { S , T } ^ { \Phi ^ { \prime } } - d _ { S , T } ^ { \Phi ^ { \prime \prime } } \leq \eta ( 1 - \cos \alpha ) \sqrt { 2 L ( d _ { S , T } ^ { \ast } - d _ { S , T } ^ { \Phi } ) }
|
| 118 |
+
$$
|
| 119 |
+
|
| 120 |
+
where $\alpha$ is the angle between $\nabla d _ { S , T } ^ { \Phi }$ and $\nabla d _ { S , T } ^ { \Phi } \big | _ { \Phi + \hat { \epsilon } ( \Phi ) }$
|
| 121 |
+
|
| 122 |
+
The $d _ { S , T } ^ { \Phi ^ { \prime } }$ (non-smooth version) can exceed $d _ { S , T } ^ { \Phi ^ { \prime \prime } }$ (smooth discrepancy) significantly, as the term $d _ { S , T } ^ { * } - d _ { S , T } ^ { \Phi } \neq 0$ , as the $h _ { \theta }$ objective is to oppose the convergence of $d _ { S , T } ^ { \Phi }$ to optima $d _ { S , T } ^ { * }$ (min-max S,T S,T training in Eq. 11). Thus $d _ { S , T } ^ { \Phi ^ { \prime } }$ S,T S,T can be a better estimate of discrepancy in comparison to $d _ { S , T } ^ { \Phi ^ { \prime \prime } }$ . A better estimate of $d _ { s , t } ^ { \Phi }$ helps in effectively reducing the discrepancy between $P _ { S }$ and $P _ { T }$ , hence leads to reduced $R _ { T } ^ { l } ( h _ { \theta } )$ . This is also observed in practice that smoothing the discriminator (SDAT w/ adv in Fig. 3) leads to low domain classification accuracy (proxy measure for $d _ { s , t } ^ { \Phi } )$ in comparison to DAT. Due to ineffective discrepancy estimation, SDAT w/ adv results in sub-optimal generalization on target domain i.e. high target error $R _ { T } ^ { l } ( h _ { \theta } )$ (Fig. 3). For further establishing the generality of sub-optimality of smooth adversarial loss, we also perform experiments on Spectral Normalised Generative Adversarial Networks (SNGAN) (Miyato et al., 2018). In case of SNGAN we also find that smoothing discriminator through SAM leads to suboptimal performance (higher FID) as in Fig. 3. The above evidences indicates that smoothing the adversarial loss leads to sub-optimality, hence it should not be done in practice. The proof of the above theorem and additional experimental details are provided in the supplementary (refer App. C and App. E).
|
| 123 |
+
|
| 124 |
+
# 4.2 SMOOTH DOMAIN ADVERSARIAL TRAINING (SDAT)
|
| 125 |
+
|
| 126 |
+
We propose smooth domain adversarial training which only focuses on converging to smooth minima w.r.t. task loss (i.e. empirical source risk), whereas does no change for the discrepancy term. We define the optimization objective of our smooth domain adversarial training below:
|
| 127 |
+
|
| 128 |
+
$$
|
| 129 |
+
\displaystyle \operatorname* { m i n } _ { \theta } \operatorname* { m a x } _ { \Phi } \operatorname* { m a x } _ { | | \epsilon | | \le \rho } \mathbb { E } _ { x \sim P _ { S } } [ l ( h _ { \theta + \epsilon } ( x ) , y ( x ) ) ] + d _ { S , T } ^ { \Phi }
|
| 130 |
+
$$
|
| 131 |
+
|
| 132 |
+
The first term is the sharpness aware risk, and the second term is the discrepancy term which is not smooth in our procedure. The term $d _ { S , T } ^ { \Phi }$ estimates $D _ { h _ { \theta } , H } ^ { \phi } ( P _ { S } | | P _ { T } )$ discrepancy. We empirically find that this optimization procedure effectively reduces the generalization error on the target domain compared to all other alternatives. We now show that optimizing Eq. 11 reduces $R _ { T } ^ { l } ( h _ { \theta } )$ through a generalization bound. This bound establishes that our procedure is also consistent (i.e. in case of infinite data the upper bound is tight), similar to the DAT (Ganin et al., 2016) baseline.
|
| 133 |
+
|
| 134 |
+
Theorem 3. Suppose $l$ is the loss function, we denote $\lambda ^ { * } : = R _ { S } ^ { l } ( h ^ { * } ) + R _ { T } ^ { l } ( h ^ { * } )$ and let $h ^ { * }$ be the ideal joint hypothesis:
|
| 135 |
+
|
| 136 |
+
$$
|
| 137 |
+
R _ { T } ^ { l } ( h _ { \theta } ) \leq \operatorname* { m a x } _ { | | \epsilon | | \leq \rho } \hat { R } _ { S } ^ { l } ( h _ { \theta + \epsilon } ) + D _ { h _ { \theta } , H } ^ { \phi } ( P _ { S } | | P _ { T } ) + \gamma ( | | \theta | | _ { 2 } ^ { 2 } / \rho ^ { 2 } ) + \lambda ^ { * } .
|
| 138 |
+
$$
|
| 139 |
+
|
| 140 |
+
where $\gamma : \mathbb { R } ^ { + } \mathbb { R } ^ { + }$ is a strictly increasing function.
|
| 141 |
+
|
| 142 |
+
The bound is similar to generalization bounds for domain adaptation (Ben-David et al., 2010; Acuna et al., 2021). The main difference is the sharpness aware risk term $\mathrm { m a x } _ { | | \epsilon | | \leq \rho } \hat { R } _ { S } ^ { l } ( h _ { \theta } )$ in place of source risk $R _ { S } ^ { l } ( h _ { \theta } )$ , and an additional term that depends on the norm of the weights $\gamma ( | | \theta | | _ { 2 } ^ { 2 } / \rho ^ { 2 } )$ . The first is minimized by decreasing the empirical sharpness aware source risk by using SAM loss shown in Sec. 4. The second term is reduced by decreasing the discrepancy between source and target domains. The third term, as it is a function of norm of weights $| | \theta | | _ { 2 } ^ { 2 }$ , can be reduced by using either L2 regularization or weight decay. Since we assume that the $\mathcal { H }$ hypothesis class we have is rich, the $\lambda ^ { * }$ term is small. We now show the improvements due to SDAT empirically in the following sections.
|
| 143 |
+
|
| 144 |
+
# 5 ADAPTATION FOR CLASSIFICATION
|
| 145 |
+
|
| 146 |
+
We evaluate our proposed method on three datasets: Office-Home, VisDA-2017, and DomainNet, as well as by combining SDAT with two DAT based DA techniques: CDAN and CDAN $^ +$ MCC.
|
| 147 |
+
|
| 148 |
+
# 5.1 DATASETS
|
| 149 |
+
|
| 150 |
+
Office-Home (Venkateswara et al., 2017): Office-Home consists of around 15,500 images from 65 classes and four distinct domains: Art (Ar), Clipart (Cl), Product $( \mathrm { P r } )$ and Real World (Rw).
|
| 151 |
+
|
| 152 |
+
VisDA-2017 (Peng et al., 2017): VisDA is a dataset that focuses on the transition from simulation to real world and contains approximately 280K images across 12 classes.
|
| 153 |
+
|
| 154 |
+
DomainNet (Peng et al., 2019): DomainNet consists of 0.6 million images across 345 classes belonging to six domains. The domains are infograph (inf), clipart (clp), painting (pnt), sketch (skt), real and quickdraw.
|
| 155 |
+
|
| 156 |
+
# 5.2 DOMAIN ADAPTATION METHODS
|
| 157 |
+
|
| 158 |
+
CDAN (Long et al., 2018): Conditional Domain Adversarial network is a popular DA algorithm that improves the performance of the DANN algorithm. CDAN introduces the idea of multi-linear conditioning to align the source and target distributions better. CDAN\* in Table 1 and 4 refers to our implementation of CDAN method.
|
| 159 |
+
|
| 160 |
+
$\mathbf { C D A N + M C C }$ (Jin et al., 2020): In this method, the minimum class confusion loss term is added as a regularizer to CDAN. Minimum class confusion is a non-adversarial term that minimizes the pairwise class confusion on the target domain. This achieves state of the art accuracy among adversarial adaptation methods.
|
| 161 |
+
|
| 162 |
+
# 5.3 IMPLEMENTATION DETAILS
|
| 163 |
+
|
| 164 |
+
We implement our proposed method in the Transfer-Learning-Library (Junguang Jiang & Long, 2020) toolkit developed in PyTorch (Paszke et al., 2019). The main difference between the performance reported in the CDAN and our implementation (CDAN\*) is the batch normalization layer in the domain classifier, which enhances performance.
|
| 165 |
+
|
| 166 |
+
Table 1: Accuracy $( \% )$ on Office-Home for unsupervised domain adaptation (ResNet-50). CDAN+MCC w/ SDAT outperforms other sophisticated state-of-the-art DA techniques. CDAN w/ SDAT improves over performance of CDAN by $1 . 1 \%$ .
|
| 167 |
+
|
| 168 |
+
<table><tr><td>Method</td><td>Ar+Cl</td><td>Ar+Pr</td><td>Ar→Rw</td><td>ClAr</td><td>Cl+Pr</td><td>Cl+Rw</td><td>Pr>Ar</td><td>Pr+Cl</td><td>Pr+Rw</td><td>Rw→Ar</td><td>Rw+Cl</td><td>Rw→Pr</td><td>Avg</td></tr><tr><td>ResNet-50 (He et al.,2016)</td><td>34.9</td><td>50.0</td><td>58.0</td><td>37.4</td><td>41.9</td><td>46.2</td><td>38.5</td><td>31.2</td><td>60.4</td><td>53.9</td><td>41.2</td><td>59.9</td><td>46.1</td></tr><tr><td>DAN (Long et al., 2015)</td><td>43.6</td><td>57.0</td><td>67.9</td><td>45.8</td><td>56.5</td><td>60.4</td><td>44.0</td><td>43.6</td><td>67.7</td><td>63.1</td><td>51.5</td><td>74.3</td><td>56.3</td></tr><tr><td>DANN (Ganin et al., 2016)</td><td>45.6</td><td>59.3</td><td>70.1</td><td>47.0</td><td>58.5</td><td>60.9</td><td>46.1</td><td>43.7</td><td>68.5</td><td>63.2</td><td>51.8</td><td>76.8</td><td>57.6</td></tr><tr><td>JAN (Long et al., 2017)</td><td>45.9</td><td>61.2</td><td>68.9</td><td>50.4</td><td>59.7</td><td>61.0</td><td>45.8</td><td>43.4</td><td>70.3</td><td>63.9</td><td>52.4</td><td>76.8</td><td>58.3</td></tr><tr><td>CDAN (Long et al.,2018)</td><td>49.0</td><td>69.3</td><td>74.5</td><td>54.4</td><td>66.0</td><td>68.4</td><td>55.6</td><td>48.3</td><td>75.9</td><td>68.4</td><td>55.4</td><td>80.5</td><td>63.8</td></tr><tr><td>MDD (Zhang et al., 2019) f-DAL-pearson + alignment</td><td>54.9</td><td>73.7</td><td>77.8</td><td>60.0</td><td>71.4</td><td>71.8</td><td>61.2</td><td>53.6</td><td>78.1</td><td>72.5</td><td>60.2</td><td>82.3</td><td>68.1</td></tr><tr><td>(Acuna et al.,2021)</td><td>56.7</td><td>77.0</td><td>81.1</td><td>63.1</td><td>72.2</td><td>75.9</td><td>64.5</td><td>54.4</td><td>81.0</td><td>72.3</td><td>58.4</td><td>83.7</td><td>70.0</td></tr><tr><td>SRDC (Tang et al., 2020)</td><td>52.3</td><td>76.3</td><td>81.0</td><td>69.5</td><td>76.2</td><td>78.0</td><td>68.7</td><td>53.8</td><td>81.7</td><td>76.3</td><td>57.1</td><td>85.0</td><td>71.3</td></tr><tr><td>CDAN*2</td><td>54.3</td><td>70.6</td><td>76.8</td><td>61.3</td><td>69.5</td><td>71.3</td><td>61.7</td><td>55.3</td><td>80.5</td><td>74.8</td><td>60.1</td><td>84.2</td><td>68.4</td></tr><tr><td>CDAN w/SDAT</td><td>56.0</td><td>72.2</td><td>78.6</td><td>62.5</td><td>73.2</td><td>71.8</td><td>62.1</td><td>55.9</td><td>80.3</td><td>75.0</td><td>61.4</td><td>84.5</td><td>69.5</td></tr><tr><td>CDAN + MCC (Jin et al.,2020)</td><td>570</td><td>76.0</td><td>81.6</td><td>64.9</td><td>75.9</td><td>75.4</td><td>63.7</td><td>56.1</td><td>81.2</td><td>74.2</td><td>63.9</td><td>85.4</td><td>71.3</td></tr><tr><td>CDAN + MCC w/ SDAT</td><td>58.2</td><td>77.1</td><td>82.2</td><td>66.3</td><td>77.6</td><td>76.8</td><td>63.3</td><td>57.0</td><td>82.2</td><td>74.9</td><td>64.7</td><td>86.0</td><td>72.2</td></tr></table>
|
| 169 |
+
|
| 170 |
+
We use a ResNet-50 backbone for Office-Home experiments and a ResNet-101 backbone for VisDA2017 and DomainNet experiments. The backbone is initialized with ImageNet weights. We use a learning rate of 0.01 with batch size 32 in all of our experiments. We tune $\rho$ value in SDAT for a particular dataset and use the same value across domains. The $\rho$ value is set to 0.02 for the Office-Home experiments, 0.005 for the VisDA-2017 experiments and 0.05 for the DomainNet experiments. More details are present in supplementary (refer App. F).
|
| 171 |
+
|
| 172 |
+
# 5.4 RESULTS
|
| 173 |
+
|
| 174 |
+
Table 2 shows the results on the large and challenging DomainNet dataset across five domains as done in (Junguang Jiang & Long, 2020). The proposed method improves the performance of CDAN significantly across all source-target pairs. On specific source-target pairs like infograph real, the performance increase is $4 . 5 \%$ . The overall performance of CDAN is improved by nearly $1 . 8 \%$ which is significant considering the large number of classes and images present in DomainNet.
|
| 175 |
+
|
| 176 |
+
For the Office-Home dataset, we compare our methods with other domain adaptation algorithms including DANN, SRDC, MDD and fDAL. The results for the Office-Home dataset are shown in Table 1. We can see that adding
|
| 177 |
+
|
| 178 |
+
Table 2: Results on DomainNet with CDAN w/ SDAT. The number in the parenthesis refers to the increase in accuracy with respect to CDAN.
|
| 179 |
+
|
| 180 |
+
<table><tr><td>Target (→) Source (↓)</td><td>clp</td><td>inf</td><td>pnt</td><td>real</td><td>skt</td><td>Avg</td></tr><tr><td>clp</td><td>-</td><td>22.0 (+1.4)</td><td>41.5 (+2.6)</td><td>57.5 (+1.5)</td><td>47.2 (+2.3)</td><td>42.1 (+2.0)</td></tr><tr><td>inf</td><td>33.9 (+2.3)</td><td>-</td><td>30.3 (+1.0)</td><td>48.1 (+4.5)</td><td>27.9 (1.5)</td><td>35.0 (+2.3)</td></tr><tr><td>pnt</td><td>47.5 (+3.4)</td><td>20.7 (+0.9)</td><td>-</td><td>58.0 (+0.8)</td><td>41.8 (+1.8)</td><td>42.0 (+1.7)</td></tr><tr><td>real</td><td>56.7 (+0.9)</td><td>25.1 (+0.7)</td><td>53.6 (+0.4)</td><td>-</td><td>43.9 (+1.6)</td><td>44.8 (+1.0)</td></tr><tr><td>skt</td><td>58.7 (+2.7)</td><td>21.8 (+1.1)</td><td>48.1 (+2.8)</td><td>57.1 (+2.2)</td><td>-</td><td>46.4 (+2.2)</td></tr><tr><td>Avg</td><td>49.2 (+2.3)</td><td>22.4 (+1.0)</td><td>43.4 (+1.7)</td><td>55.2 (+2.2)</td><td>40.2 (+1.8)</td><td>42.1 (+1.8)</td></tr></table>
|
| 181 |
+
|
| 182 |
+
SDAT improves the performance on both CDAN and $\mathrm { C D A N + M C C }$ across all the transfer tasks. CDAN+MCC w/ SDAT achieves state-of-the-art adversarial adaptation performance on the OfficeHome dataset.
|
| 183 |
+
|
| 184 |
+
The class-wise accuracy on VisDA-2017 are reported in Table 4. CDAN w/ SDAT improves the overall performance of CDAN by more than $1 . 5 \%$ . CDAN w/ SDAT improves the performance of underperforming minority classes like bicycle and car. Additional baselines and results are reported in supplementary (refer App. G) along with a discussion on statistical significance (App. J) .
|
| 185 |
+
|
| 186 |
+
# 6 ADAPTATION FOR OBJECT DETECTION
|
| 187 |
+
|
| 188 |
+
To further validate our approach’s generality and extensibility, we did experiments on DA for object detection. We use the same setting as proposed in DA-Faster (Chen et al., 2018) with all domain adaptation components and use it as our baseline. We use the mean Average Precision at $0 . 5 \ \mathrm { I o U }$ (mAP) as our evaluation metric. In object detection, the smoothness enhancement can be achieved in two ways (empirical comparison in Sec. 6.2) :
|
| 189 |
+
|
| 190 |
+
a) DA-Faster w/ SDAT-Classification: Smoothness enhancement for classification loss. b) DA-Faster w/ SDAT: Smoothness enhancment for the combined classification and regression loss.
|
| 191 |
+
|
| 192 |
+
Table 4: Accuracy $( \% )$ on VisDA-2017 for unsupervised domain adaptation (ResNet-101). The mean column contains mean across all classes. SDAT particularly improves the accuracy in classes that have comparatively low CDAN performance.
|
| 193 |
+
|
| 194 |
+
<table><tr><td>Method</td><td>plane</td><td>bcybl</td><td>bus</td><td>car</td><td>horse</td><td>knife</td><td>mcyle</td><td>persn</td><td>plant sktb</td><td></td><td>train</td><td>truck</td><td>mean</td></tr><tr><td>ResNet (He et al.,2016)</td><td>55.1</td><td>53.3</td><td>61.9</td><td>59.1</td><td>80.6</td><td>17.9</td><td>79.7</td><td>31.2</td><td>81.0</td><td>26.5</td><td>73.5</td><td>8.5</td><td>52.4</td></tr><tr><td>DANN (Ganin et al., 2016)</td><td>81.9</td><td>77.7</td><td>82.8</td><td>44.3</td><td>81.2</td><td>29.5</td><td>65.1</td><td>28.6</td><td>51.9</td><td>54.6</td><td>82.8</td><td>7.8</td><td>57.4</td></tr><tr><td>DAN (Long et al., 2015)</td><td>87.1</td><td>63.0</td><td>76.5</td><td>42.0</td><td>90.3</td><td>42.9</td><td>85.9</td><td>53.1</td><td>49.7</td><td>36.3</td><td>85.8</td><td>20.7</td><td>61.1</td></tr><tr><td>MCD (Saito et al., 2018b)</td><td>87.0</td><td>60.9</td><td>83.7</td><td>64.0</td><td>88.9</td><td>79.6</td><td>84.7</td><td>76.9</td><td>88.6</td><td>40.3</td><td>83.0</td><td>25.8</td><td>71.9</td></tr><tr><td>CDAN (Long et al., 2018)</td><td>85.2</td><td>66.9</td><td>83.0</td><td>50.8</td><td>84.2</td><td>74.9</td><td>88.1</td><td>74.5</td><td>83.4</td><td>76.0</td><td>81.9</td><td>38.0</td><td>73.9</td></tr><tr><td>AFN (Xu et al., 2019)</td><td>93.6</td><td>61.3</td><td>84.1</td><td>70.6</td><td>94.1</td><td>79.0</td><td>91.8</td><td>79.6</td><td>89.9</td><td>55.6</td><td>89.0</td><td>24.4</td><td>76.1</td></tr><tr><td>MCC (Jin et al.,2020)</td><td>88.1</td><td>80.3</td><td>80.5</td><td>71.5</td><td>90.1</td><td>93.2</td><td>85.0</td><td>71.6</td><td>89.4</td><td>73.8</td><td>85.0</td><td>36.9</td><td>78.8</td></tr><tr><td>CDAN*2</td><td>94.9</td><td>72.0</td><td></td><td>83.0 57.3</td><td>91.6</td><td>95.2</td><td>91.6</td><td>79.5</td><td>85.8</td><td>88.8</td><td>87.0</td><td>40.5</td><td>80.6</td></tr><tr><td>CDAN w/ SDAT</td><td>94.8</td><td>77.1</td><td>82.8</td><td>60.9</td><td>92.3</td><td>95.2</td><td>91.7</td><td>79.9</td><td>89.9</td><td>91.2</td><td>88.5</td><td>41.2</td><td>82.1</td></tr><tr><td>CDAN+MCC (Jin et al., 2020)</td><td>95.0</td><td>84.2</td><td>75.0</td><td>66.9</td><td>94.4</td><td>97.1</td><td>90.5</td><td>79.8</td><td>89.4</td><td>89.5</td><td>86.9</td><td>54.4</td><td>83.6</td></tr><tr><td>CDAN+MCC w/ SDAT</td><td>95.8</td><td>85.5</td><td></td><td></td><td>76.9 69.0 93.5</td><td>97.4</td><td>88.5</td><td>78.2</td><td>93.1</td><td>91.6 86.3</td><td></td><td> 55.3</td><td> 84.3</td></tr></table>
|
| 195 |
+
|
| 196 |
+
# 6.1 EXPERIMENTAL SETUP
|
| 197 |
+
|
| 198 |
+
We evaluate our proposed approach on object detection on two different domain shifts:
|
| 199 |
+
|
| 200 |
+
Pascal to Clipart $P C$ ): Pascal (Everingham et al., 2010) is a real-world image dataset which consists images with 20 different object categories. Clipart (Inoue et al., 2018) is a graphical image dataset with complex backgrounds and has the same 20 categories as Pascal. We use Resnet-101 (He et al., 2016) backbone for Faster R-CNN (Ren et al., 2015) following Saito et al. (2019).
|
| 201 |
+
|
| 202 |
+
Cityscapes to Foggy Cityscapes $( C \to F c )$ ): Cityscapes (Cordts et al., 2016) is a street scene dataset for driving, whose images are collected in clear weather. Foggy Cityscapes (Sakaridis et al., 2018) dataset is synthesized from Cityscapes for the foggy weather. We use Resnet-50 (He et al., 2016) as the backbone for Faster R-CNN for experiments on this task. Both domains have the same 8 object categories with instance labels.
|
| 203 |
+
|
| 204 |
+
The training is done via SGD with momentum 0.9 for $7 0 \mathrm { k }$ iterations with the learning rate of $1 0 ^ { - 3 }$ , and then dropped to $1 0 ^ { - 4 }$ after $5 0 \mathrm { k }$ iterations. We split the target data into train and validation sets and report the best mAP on validation data. Additional experimental and implementation details are present in supplementary (refer App. F).
|
| 205 |
+
|
| 206 |
+
# 6.2 RESULTS
|
| 207 |
+
|
| 208 |
+
Table 3 shows the results on two domain shifts with varying batch size $( b s )$ during training. We find that only smoothing w.r.t. classification loss is much more effective (SDAT-Classification) than smoothing w.r.t. combined classification and regression loss (SDAT). On average, SDATClassification produces an mAP gain of $2 . 0 \%$ compared to SDAT, and $2 . 8 \%$ compared to DA-Faster baseline.
|
| 209 |
+
|
| 210 |
+
The proposed SDAT-Classification significantly outperforms DA-Faster baseline and improves mAP by $1 . 3 \%$ on $P C$ and by $2 . 8 \%$ on $C F c$ . It is noteworthy that increase in performance of SDAT-Classification is consis
|
| 211 |
+
|
| 212 |
+
Table 3: Results on DA for object detection.
|
| 213 |
+
|
| 214 |
+
<table><tr><td>Method</td><td>C→Fc (bs=2)</td><td>P→C (bs=2)</td><td>P→C (bs=8)</td></tr><tr><td>DA-Faster (Chen et al.,2018)</td><td>35.21</td><td>29.96</td><td>26.40</td></tr><tr><td>DA-Faster w/SDAT</td><td>37.47</td><td>29.04</td><td>27.64</td></tr><tr><td>DA-Faster w/SDAT-Classification</td><td>38.00</td><td>31.23</td><td>30.74</td></tr></table>
|
| 215 |
+
|
| 216 |
+
tent even after training with higher batch size ( $\ b s = 8$ ) achieving improvement of $4 . 3 \%$ in mAP.
|
| 217 |
+
|
| 218 |
+
Table 3 also shows that even DA-Faster w/ SDAT (i.e. smoothing both classification and regression) outperforms DA-Faster by $0 . 9 \%$ on average across all experiments. The improvement due to SDAT on adaptation for object detection shows the generality of SDAT across techniques that have some form of adversarial component present in the loss formulation.
|
| 219 |
+
|
| 220 |
+
# 7 DISCUSSION
|
| 221 |
+
|
| 222 |
+
How much smoothing is optimal?: Figure 4 (A) shows the ablation on $\rho$ value (higher $\rho$ value corresponds to more smoothing) on the $\mathbf { A r } { \cdot } \mathbf { C l }$ and $\mathrm { C l } { \scriptstyle } \mathrm { P r }$ from Office-Home dataset with CDAN backbone. The performance of the different values of $\rho$ is higher than the baseline with $\rho = 0$ . It can be seen that $\rho = 0 . 0 2$ works best among all the different values and outperforms the baseline by at least $1 . 5 \%$ . We found that the same $\rho$ value usually worked well across domains in a dataset, but different $\rho$ was optimal for different datasets.
|
| 223 |
+
|
| 224 |
+

|
| 225 |
+
Figure 4: Analysis of SDAT for $\mathrm { A r } \mathrm { C l }$ split of Office-Home dataset. A) Variation of target accuracy with maximum perturbation $\rho$ . B) Comparison of accuracy of SDAT with DAT for different ratio of label noise. C) Comparison of accuracy when smoothing is applied to various loss components.
|
| 226 |
+
|
| 227 |
+
Which components benefit from smooth optima?: Figure 4 (C) shows the effect of introducing smoothness enhancement for different components in DAT. For this we use SAM on a) classifier (SDAT) b) discriminator (SDAT w/ adv) c) both classifier and discriminator (SDAT-all). It can be seen that smoothing the adversarial component (SDAT w/ adv) reduces the performance to $5 1 . 0 \%$ , which is significantly lower than even the DAT baseline.
|
| 228 |
+
|
| 229 |
+
Is it Robust to Label Noise?: In practical, real-world scenarios, the labeled datasets are often corrupted with some amount of label noise. Due to this, performing domain adaptation with such data is challenging. We find that smoother minima through SDAT lead to robust models which generalize well on the target domain. Figure 4 (B) provides the comparison of SGD vs. SDAT for different percentages of label noise injected into training data (by flipping the labels).
|
| 230 |
+
|
| 231 |
+
Is it better than other smoothing techniques? To answer this question, we compare SDAT with different smoothing techniques originally proposed for ERM. We specifically compare our method against DAT, Label Smoothing (LS) (Szegedy et al., 2016), and VAT (Miyato et al., 2019). Stutz et al. (2021) recently showed that these techniques produce a significantly smooth loss landscape in comparison to SGD. We also compare with a very recent
|
| 232 |
+
|
| 233 |
+
Table 5: Performance comparison across different loss smoothing techniques on Office-Home. SDAT outperforms other smoothing techniques in each case consistently.
|
| 234 |
+
|
| 235 |
+
<table><tr><td>Method</td><td>Ar>C1</td><td>Cl→Pr</td><td>Rw>Cl</td><td>Pr→Cl</td><td>Avg</td></tr><tr><td>DAT</td><td>54.3</td><td>69.5</td><td>60.1</td><td>55.3</td><td>59.2</td></tr><tr><td>VAT</td><td>54.6</td><td>70.7</td><td>60.8</td><td>54.4</td><td>60.1 (+0.9)</td></tr><tr><td>SWAD</td><td>54.6</td><td>71.0</td><td>60.9</td><td>55.2</td><td>60.4 (+1.2)</td></tr><tr><td>LS</td><td>53.6</td><td>71.6</td><td>59.9</td><td>53.4</td><td>59.6 (+0.4)</td></tr><tr><td>SDAT</td><td>56.0</td><td>73.2</td><td>61.4</td><td>55.9</td><td>61.6 (+2.4)</td></tr></table>
|
| 236 |
+
|
| 237 |
+
SWAD (Cha et al., 2021) technique which is shown effective for domain generalization. For this, we run our experiments on four different splits of the Office-Home dataset and summarize our results in Table 5. We find that techniques for ERM (LS and VAT) fail to provide significant consistent gain in performance which also confirms the requirement of specific smoothing strategies for DAT. We find that SDAT even outperforms SWAD on average by a significant margin of $1 . 2 \%$ . Additional details regarding the specific methods are provided in the supplementary (refer App. H).
|
| 238 |
+
|
| 239 |
+
# 8 CONCLUSION
|
| 240 |
+
|
| 241 |
+
In this work, we analyse the curvature of loss surface of DAT used extensively for Unsupervised Domain Adaptation. We find that converging to a smooth minima w.r.t. task loss (i.e., empirical source risk) leads to better generalization on the target domain. We also theoretically and empirically show that smoothness enhancing for adversarial components of loss lead to sub-optimal results, hence should be avoided in practice. We then introduce our practical and effective method, SDAT, which only increases the smoothness w.r.t. task loss, leading to better generalization on the target domain. SDAT leads to an effective increase even for the state of the art methods for adversarial domain adaptation and can be incorporated with just a few lines of code change. One limitation of SDAT is presence of no automatic way of selecting $\rho$ (determines extent of smoothness) which is a good future direction to explore.
|
| 242 |
+
|
| 243 |
+
# REFERENCES
|
| 244 |
+
|
| 245 |
+
David Acuna, Guojun Zhang, Marc T Law, and Sanja Fidler. f-domain-adversarial learning: Theory and algorithms. arXiv preprint arXiv:2106.11344, 2021. 1, 3, 6, 7, 14, 16
|
| 246 |
+
|
| 247 |
+
Tameem Adel, Isabel Valera, Zoubin Ghahramani, and Adrian Weller. One-network adversarial fairness. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 2412– 2420, 2019. 1
|
| 248 |
+
|
| 249 |
+
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. 3, 6
|
| 250 |
+
|
| 251 |
+
David Berthelot, Rebecca Roelofs, Kihyuk Sohn, Nicholas Carlini, and Alex Kurakin. Adamatch: A unified approach to semi-supervised learning and domain adaptation. arXiv preprint arXiv:2106.04732, 2021. 20
|
| 252 |
+
|
| 253 |
+
Lukas Biewald. Experiment tracking with weights and biases, 2020. URL https://www. wandb.com/. Software available from wandb.com. 17
|
| 254 |
+
|
| 255 |
+
Guanyu Cai, Lianghua He, Mengchu Zhou, Hesham Alhumade, and Die Hu. Learning smooth representation for unsupervised domain adaptation, 2021. 2
|
| 256 |
+
|
| 257 |
+
Yair Carmon, John C Duchi, Oliver Hinder, and Aaron Sidford. Lower bounds for finding stationary points I. Mathematical Programming, 184(1):71–120, 2020. 5, 15
|
| 258 |
+
|
| 259 |
+
Junbum Cha, Sanghyuk Chun, Kyungjae Lee, Han-Cheol Cho, Seunghyun Park, Yunsung Lee, and Sungrae Park. Swad: Domain generalization by seeking flat minima. arXiv preprint arXiv:2102.08604, 2021. 9, 19
|
| 260 |
+
|
| 261 |
+
Xiangning Chen, Cho-Jui Hsieh, and Boqing Gong. When vision transformers outperform resnets without pretraining or strong data augmentations. arXiv preprint arXiv:2106.01548, 2021. 2, 16
|
| 262 |
+
|
| 263 |
+
Yuhua Chen, Wen Li, Christos Sakaridis, Dengxin Dai, and Luc Van Gool. Domain adaptive faster r-cnn for object detection in the wild. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3339–3348, 2018. 7, 8, 18
|
| 264 |
+
|
| 265 |
+
Marius Cordts, Mohamed Omran, Sebastian Ramos, Timo Rehfeld, Markus Enzweiler, Rodrigo Benenson, Uwe Franke, Stefan Roth, and Bernt Schiele. The cityscapes dataset for semantic urban scene understanding. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3213–3223, 2016. 8
|
| 266 |
+
|
| 267 |
+
Gintare Karolina Dziugaite and Daniel M Roy. Computing nonvacuous generalization bounds for deep (stochastic) neural networks with many more parameters than training data. arXiv preprint arXiv:1703.11008, 2017. 2
|
| 268 |
+
|
| 269 |
+
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. 8
|
| 270 |
+
|
| 271 |
+
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. 1, 2, 4, 16
|
| 272 |
+
|
| 273 |
+
Yaroslav Ganin and Victor Lempitsky. Unsupervised domain adaptation by backpropagation. In International conference on machine learning, pp. 1180–1189. PMLR, 2015. 1, 2, 4, 18
|
| 274 |
+
|
| 275 |
+
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. 6, 7, 8, 17
|
| 276 |
+
|
| 277 |
+
Ian Gemp and Brian McWilliams. The unreasonable effectiveness of adam on cycles. In NeurIPS Workshop on Bridging Game Theory and Deep Learning, 2019. 4
|
| 278 |
+
|
| 279 |
+
Behrooz Ghorbani, Shankar Krishnan, and Ying Xiao. An investigation into neural net optimization via hessian eigenvalue density. In International Conference on Machine Learning, pp. 2232– 2241. PMLR, 2019. 4, 16
|
| 280 |
+
|
| 281 |
+
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. 1
|
| 282 |
+
|
| 283 |
+
Haowei He, Gao Huang, and Yang Yuan. Asymmetric valleys: beyond sharp and flat local minima. In Proceedings of the 33rd International Conference on Neural Information Processing Systems, pp. 2553–2564, 2019. 2
|
| 284 |
+
|
| 285 |
+
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. 7, 8
|
| 286 |
+
|
| 287 |
+
Naoto Inoue, Ryosuke Furuta, Toshihiko Yamasaki, and Kiyoharu Aizawa. Cross-domain weaklysupervised object detection through progressive domain adaptation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 5001–5009, 2018. 8
|
| 288 |
+
|
| 289 |
+
Pavel Izmailov, Dmitrii Podoprikhin, Timur Garipov, Dmitry Vetrov, and Andrew Gordon Wilson. Averaging weights leads to wider optima and better generalization. arXiv preprint arXiv:1803.05407, 2018. 19
|
| 290 |
+
|
| 291 |
+
Stanislaw Jastrzebski, Maciej Szymczak, Stanislav Fort, Devansh Arpit, Jacek Tabor, Kyunghyun Cho\*, and Krzysztof Geras\*. The break-even point on optimization trajectories of deep neural networks. In International Conference on Learning Representations, 2020. URL https:// openreview.net/forum?id=r1g87C4KwB. 4
|
| 292 |
+
|
| 293 |
+
Ying Jin, Ximei Wang, Mingsheng Long, and Jianmin Wang. Minimum class confusion for versatile domain adaptation. In European Conference on Computer Vision, pp. 464–480. Springer, 2020. 6, 7, 8, 17, 18
|
| 294 |
+
|
| 295 |
+
Bo Fu Junguang Jiang, Baixu Chen and Mingsheng Long. Transfer-learning-library. https: //github.com/thuml/Transfer-Learning-Library, 2020. 6, 7, 18, 21
|
| 296 |
+
|
| 297 |
+
Minguk Kang and Jaesik Park. ContraGAN: Contrastive Learning for Conditional Image Generation. 2020. 17
|
| 298 |
+
|
| 299 |
+
Nitish Shirish Keskar and Richard Socher. Improving generalization performance by switching from adam to sgd. arXiv preprint arXiv:1712.07628, 2017. 1
|
| 300 |
+
|
| 301 |
+
Nitish Shirish Keskar, Jorge Nocedal, Ping Tak Peter Tang, Dheevatsa Mudigere, and Mikhail Smelyanskiy. On large-batch training for deep learning: Generalization gap and sharp minima. In 5th International Conference on Learning Representations, ICLR 2017, 2017. 2
|
| 302 |
+
|
| 303 |
+
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. 1
|
| 304 |
+
|
| 305 |
+
Alex Krizhevsky et al. Learning multiple layers of features from tiny images. 2009. 17
|
| 306 |
+
|
| 307 |
+
Jogendra Nath Kundu, Naveen Venkat, Ambareesh Revanur, Rahul M V, and R. Venkatesh Babu. Towards inheritable models for open-set domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020a. 2
|
| 308 |
+
|
| 309 |
+
Jogendra Nath Kundu, Naveen Venkat, Rahul M V, and R. Venkatesh Babu. Universal source-free domain adaptation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020b. 2
|
| 310 |
+
|
| 311 |
+
Haoliang Li, Sinno Jialin Pan, Shiqi Wang, and Alex C Kot. Domain generalization with adversarial feature learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5400–5409, 2018. 1
|
| 312 |
+
|
| 313 |
+
Ming-Yu Liu, Thomas Breuel, and Jan Kautz. Unsupervised image-to-image translation networks. In Advances in neural information processing systems, pp. 700–708, 2017. 1
|
| 314 |
+
|
| 315 |
+
Mingsheng Long, Yue Cao, Jianmin Wang, and Michael Jordan. Learning transferable features with deep adaptation networks. In International conference on machine learning, pp. 97–105. PMLR, 2015. 7, 8
|
| 316 |
+
|
| 317 |
+
Mingsheng Long, Han Zhu, Jianmin Wang, and Michael I Jordan. Deep transfer learning with joint adaptation networks. In International conference on machine learning, pp. 2208–2217. PMLR, 2017. 7
|
| 318 |
+
|
| 319 |
+
Mingsheng Long, Zhangjie Cao, Jianmin Wang, and Michael I Jordan. Conditional adversarial domain adaptation. In Advances in Neural Information Processing Systems, pp. 1645–1655, 2018. 1, 2, 3, 4, 6, 7, 8, 17, 18
|
| 320 |
+
|
| 321 |
+
T. Miyato, S. Maeda, M. Koyama, and S. Ishii. Virtual adversarial training: A regularization method for supervised and semi-supervised learning. IEEE Transactions on Pattern Analysis and Machine Intelligence, 41(8):1979–1993, 2019. doi: 10.1109/TPAMI.2018.2858821. 9, 19
|
| 322 |
+
|
| 323 |
+
Takeru Miyato, Toshiki Kataoka, Masanori Koyama, and Yuichi Yoshida. Spectral normalization for generative adversarial networks. In International Conference on Learning Representations, 2018. 5, 17
|
| 324 |
+
|
| 325 |
+
XuanLong Nguyen, Martin J Wainwright, and Michael I Jordan. Estimating divergence functionals and the likelihood ratio by convex risk minimization. IEEE Transactions on Information Theory, 56(11):5847–5861, 2010. 3
|
| 326 |
+
|
| 327 |
+
Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high-performance deep learning library. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alche-Buc, E. Fox, and ´ R. Garnett (eds.), Advances in Neural Information Processing Systems 32, pp. 8024–8035. Curran Associates, Inc., 2019. URL http://papers.neurips.cc/paper/9015-pytorchan-imperative-style-high-performance-deep-learning-library.pdf. 6
|
| 328 |
+
|
| 329 |
+
Xingchao Peng, Ben Usman, Neela Kaushik, Judy Hoffman, Dequan Wang, and Kate Saenko. Visda: The visual domain adaptation challenge, 2017. 6
|
| 330 |
+
|
| 331 |
+
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 International Conference on Computer Vision, pp. 1406–1415, 2019. 6
|
| 332 |
+
|
| 333 |
+
Viraj Prabhu, Shivam Khare, Deeksha Kartik, and Judy Hoffman. Sentry: Selective entropy optimization via committee consistency for unsupervised domain adaptation. arXiv preprint arXiv:2012.11460, 2020. 2
|
| 334 |
+
|
| 335 |
+
Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster R-CNN: Towards real-time object detection with region proposal networks. Advances in neural information processing systems, 28: 91–99, 2015. 8, 18
|
| 336 |
+
|
| 337 |
+
Kuniaki Saito, Yoshitaka Ushiku, Tatsuya Harada, and Kate Saenko. Adversarial dropout regularization. In International Conference on Learning Representations, 2018a. 4
|
| 338 |
+
|
| 339 |
+
Kuniaki Saito, Kohei Watanabe, Yoshitaka Ushiku, and Tatsuya Harada. Maximum classifier discrepancy for unsupervised domain adaptation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3723–3732, 2018b. 8, 17
|
| 340 |
+
|
| 341 |
+
Kuniaki Saito, Yoshitaka Ushiku, Tatsuya Harada, and Kate Saenko. Strong-weak distribution alignment for adaptive object detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6956–6965, 2019. 1, 8
|
| 342 |
+
|
| 343 |
+
Christos Sakaridis, Dengxin Dai, and Luc Van Gool. Semantic foggy scene understanding with synthetic data. International Journal of Computer Vision, 126(9):973–992, 2018. 8
|
| 344 |
+
|
| 345 |
+
Rui Shu, Hung Bui, Hirokazu Narui, and Stefano Ermon. A dirt-t approach to unsupervised domain adaptation. In International Conference on Learning Representations, 2018. 2
|
| 346 |
+
|
| 347 |
+
David Stutz, Matthias Hein, and Bernt Schiele. Relating adversarially robust generalization to flat minima. arXiv preprint arXiv:2104.04448, 2021. 9, 19
|
| 348 |
+
|
| 349 |
+
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. 9, 19
|
| 350 |
+
|
| 351 |
+
Hui Tang, Ke Chen, and Kui Jia. Unsupervised domain adaptation via structurally regularized deep clustering. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 8725–8735, 2020. 7
|
| 352 |
+
|
| 353 |
+
Vladimir Vapnik. The nature of statistical learning theory. Springer science & business media, 2013. 1
|
| 354 |
+
|
| 355 |
+
Hemanth Venkateswara, Jose Eusebio, Shayok Chakraborty, and Sethuraman Panchanathan. Deep hashing network for unsupervised domain adaptation. In (IEEE) Conference on Computer Vision and Pattern Recognition (CVPR), 2017. 6
|
| 356 |
+
|
| 357 |
+
Ximei Wang, Ying Jin, Mingsheng Long, Jianmin Wang, and Michael I Jordan. Transferable normalization: towards improving transferability of deep neural networks. In Proceedings of the 33rd International Conference on Neural Information Processing Systems, pp. 1953–1963, 2019. 2
|
| 358 |
+
|
| 359 |
+
Yuxin Wu, Alexander Kirillov, Francisco Massa, Wan-Yen Lo, and Ross Girshick. Detectron2. https://github.com/facebookresearch/detectron2, 2019. 18
|
| 360 |
+
|
| 361 |
+
Ruijia Xu, Guanbin Li, Jihan Yang, and Liang Lin. Larger norm more transferable: An adaptive feature norm approach for unsupervised domain adaptation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 1426–1435, 2019. 8
|
| 362 |
+
|
| 363 |
+
Zhewei Yao, Amir Gholami, Kurt Keutzer, and Michael W Mahoney. Pyhessian: Neural networks through the lens of the hessian. In 2020 IEEE International Conference on Big Data (Big Data), pp. 581–590. IEEE, 2020. 16
|
| 364 |
+
|
| 365 |
+
Yuchen Zhang, Tianle Liu, Mingsheng Long, and Michael Jordan. Bridging theory and algorithm for domain adaptation. In International Conference on Machine Learning, pp. 7404–7413. PMLR, 2019. 1, 7
|
| 366 |
+
|
| 367 |
+
# APPENDICES
|
| 368 |
+
|
| 369 |
+
# A NOTATION TABLE
|
| 370 |
+
|
| 371 |
+
Table S1 contains all the notations used in the paper and the proofs of theorems.
|
| 372 |
+
|
| 373 |
+
Table S1: The notations used in the paper and the corresponding meaning.
|
| 374 |
+
|
| 375 |
+
<table><tr><td>Notation</td><td>Meaning</td></tr><tr><td>S</td><td>Labeled Source Data</td></tr><tr><td>T</td><td>Unlabelled Target Data</td></tr><tr><td>Ps (or Pr)</td><td>Source (or Target) Distribution</td></tr><tr><td>X</td><td>Input space</td></tr><tr><td>2</td><td>Label space</td></tr><tr><td>y()</td><td>Maps image to labels</td></tr><tr><td>h</td><td>Hypothesis function</td></tr><tr><td>Rs(he) (or R(hθ))</td><td>Source (or Target) risk</td></tr><tr><td>R(he)(or R(hθ))</td><td>Empirical Source (or Target) risk</td></tr><tr><td>H</td><td>Hypothesis space</td></tr><tr><td>D ,H(Psl|Pr) ?</td><td>Discrepancy between two domains Ps and PT</td></tr><tr><td>g</td><td>Feature extractor</td></tr><tr><td>fe</td><td>Classifier</td></tr><tr><td>D</td><td>Domain Discriminator</td></tr><tr><td>T</td><td>Tractable Discrepancy Estimate</td></tr><tr><td>VRg(he) (or H)</td><td></td></tr><tr><td>Tr(H)</td><td>Hessian of classification loss</td></tr><tr><td></td><td>Trace ofHessian</td></tr><tr><td>入max</td><td>Maximum eigenvalue of Hessian</td></tr><tr><td>E</td><td>Perturbation</td></tr><tr><td>p</td><td>Maximum norm of é</td></tr></table>
|
| 376 |
+
|
| 377 |
+
# B CONNECTION OF DISCREPANCY TO $d _ { S , T } ^ { \Phi }$ (EQ. 4) IN MAIN PAPER
|
| 378 |
+
|
| 379 |
+
We refer reader to Appendix C.2 of Acuna et al. (2021) for relation of $d _ { S , T } ^ { \Phi }$ . The $d _ { S , T } ^ { \Phi }$ term defined in Eq. 4 given as:
|
| 380 |
+
|
| 381 |
+
$$
|
| 382 |
+
d _ { S , T } ^ { \Phi } = \mathbb { E } _ { x \sim P _ { S } } [ \log ( \mathcal { D } _ { \Phi } ( g _ { \psi } ( x ) ) ) ] + \mathbb { E } _ { x \sim P _ { T } } [ \log ( 1 - \mathcal { D } _ { \Phi } ( g _ { \psi } ( x ) ) ) ]
|
| 383 |
+
$$
|
| 384 |
+
|
| 385 |
+
The above term is exactly the Eq. C.1 in Acuna et al. (2021) where they show that optimal $d _ { S , T } ^ { \Phi }$ i.e.:
|
| 386 |
+
|
| 387 |
+
$$
|
| 388 |
+
\operatorname* { m a x } _ { \Phi } d _ { S , T } ^ { \Phi } = D _ { J S } ( P _ { S } | | P _ { T } ) - 2 \log ( 2 )
|
| 389 |
+
$$
|
| 390 |
+
|
| 391 |
+
Hence we can say from result in Eq. 4 is a consequence of Lemma 1 and Proposition 1 in (Acuna et al., 2021), assuming that $D _ { \Phi }$ satisfies the constraints in Proposition 1.
|
| 392 |
+
|
| 393 |
+
# C PROOF OF THEOREMS
|
| 394 |
+
|
| 395 |
+
In this section we provide proofs for the theoretical results present in the paper:
|
| 396 |
+
|
| 397 |
+
Theorem 1 (Generalization bound). Suppose $l : \mathcal { V } \times \mathcal { Y } \to [ 0 , 1 ] \subset d o m \phi ^ { * } .$ . Let $h ^ { * }$ be the ideal joint classifier with error $\lambda ^ { * } = R _ { S } ^ { l } ( h ^ { * } ) \dot { + } \mathbf { \bar { \delta } } R _ { T } ^ { l } ( h ^ { * } )$ . We have the following relation between source and target risk:
|
| 398 |
+
|
| 399 |
+
$$
|
| 400 |
+
R _ { T } ^ { l } ( h _ { \theta } ) \leq R _ { S } ^ { l } ( h _ { \theta } ) + D _ { h _ { \theta } , \mathcal { H } } ^ { \phi } ( P _ { S } | | P _ { T } ) + \lambda ^ { * }
|
| 401 |
+
$$
|
| 402 |
+
|
| 403 |
+
Proof. We refer the reader to Theorem 2 in Appendix $\cdot$ of Acuna et al. (2021) for the detailed proof the theorem. □
|
| 404 |
+
|
| 405 |
+
We now introduce a Lemma for smooth functions which we will use in the proofs subsequently:
|
| 406 |
+
|
| 407 |
+
Lemma 1. For an $L$ -smooth function $f ( w )$ the following holds where $w ^ { * }$ is the optimal minima:
|
| 408 |
+
|
| 409 |
+
$$
|
| 410 |
+
f ( w ) - f ( w ^ { * } ) \geq \frac { 1 } { 2 L } | | \nabla f ( w ) | | ^ { 2 }
|
| 411 |
+
$$
|
| 412 |
+
|
| 413 |
+
Proof. The L-smooth function by definition satisfies the following:
|
| 414 |
+
|
| 415 |
+
$$
|
| 416 |
+
f ( w ^ { * } ) \leq f ( v ) \leq f ( w ) + \nabla f ( w ) ( v - w ) + \frac { L } { 2 } | | v - w | | ^ { 2 }
|
| 417 |
+
$$
|
| 418 |
+
|
| 419 |
+
Now we minimize the upper bound wrt $v$ to get a tight bound on $f ( w ^ { \ast } )$ .
|
| 420 |
+
|
| 421 |
+
$$
|
| 422 |
+
D ( v ) = f ( w ) + \nabla f ( w ) ( v - w ) + \frac { L } { 2 } | | v - w | | ^ { 2 }
|
| 423 |
+
$$
|
| 424 |
+
|
| 425 |
+
after doing $\nabla _ { v } D ( v ) = 0$ we get:
|
| 426 |
+
|
| 427 |
+
$$
|
| 428 |
+
v = w - \frac { 1 } { L } \nabla f ( w )
|
| 429 |
+
$$
|
| 430 |
+
|
| 431 |
+
By substituting the value of $v$ in the upper bound we get:
|
| 432 |
+
|
| 433 |
+
$$
|
| 434 |
+
f ( w ^ { * } ) \leq f ( w ) - \frac { 1 } { 2 L } | | \nabla f ( w ) | | ^ { 2 }
|
| 435 |
+
$$
|
| 436 |
+
|
| 437 |
+
Hence rearranging the above term gives the desired result:
|
| 438 |
+
|
| 439 |
+
$$
|
| 440 |
+
f ( w ) - f ( w ^ { * } ) \geq \frac { 1 } { 2 L } | | \nabla f ( w ) | | ^ { 2 }
|
| 441 |
+
$$
|
| 442 |
+
|
| 443 |
+
Theorem 2. For a given classifier $h _ { \theta }$ and one step of (steepest) gradient ascent i.e. $\Phi ^ { \prime } = \Phi + $ $\eta ( \nabla d _ { S , T } ^ { \Phi } / | | \nabla d _ { S , T } ^ { \Phi } | | )$ and $\Phi ^ { \prime \prime } = \stackrel { \sim } { \Phi } + \eta \big ( \nabla d _ { S , T } ^ { \Phi } \big | _ { \Phi + \hat { \epsilon } ( \Phi ) } \big / \big | \big | \nabla d _ { S , T } ^ { \Phi ^ { \prime } } \big | _ { \Phi + \hat { \epsilon } ( \Phi ) } \big | \big | \big )$ for maximizing
|
| 444 |
+
|
| 445 |
+
$$
|
| 446 |
+
d _ { S , T } ^ { \Phi ^ { \prime } } - d _ { S , T } ^ { \Phi ^ { \prime \prime } } \leq \eta ( 1 - \cos \alpha ) \sqrt { 2 L ( d _ { S , T } ^ { \ast } - d _ { S , T } ^ { \Phi } ) }
|
| 447 |
+
$$
|
| 448 |
+
|
| 449 |
+
where $\alpha$ is the angle between $\nabla d _ { S , T } ^ { \Phi }$ and $\nabla d _ { S , T } ^ { \Phi } \big | _ { \Phi + \hat { \epsilon } ( \Phi ) }$
|
| 450 |
+
|
| 451 |
+
Proof of Theorem 2. We assume that the function is $L$ -smooth (the assumption of L-smoothness is the basis of many results in non-convex optimization (Carmon et al., 2020)) in terms of input $x$ . As for a fixed $h _ { \theta }$ as we use a reverse gradient procedure for measuring the discrepancy, only one step analysis is shown. This is because only a single step of gradient is used for estimating discrepancy $\dot { d } _ { S , T } ^ { \Phi }$ i.e. one step of each min and max optimization is performed alternatively for optimization. After this the $h _ { \theta }$ is updated to decrease the discrepancy. Any differential function can be approximated by the linear approximation in case of small $\eta$ :
|
| 452 |
+
|
| 453 |
+
$$
|
| 454 |
+
d _ { S , T } ^ { \Phi + \eta v } \approx d _ { S , T } ^ { \Phi } + \eta \nabla d _ { S , T } ^ { \Phi } { } ^ { T } v
|
| 455 |
+
$$
|
| 456 |
+
|
| 457 |
+
The dot product between two vectors can be written as the following function of norms and angle $\theta$ between those:
|
| 458 |
+
|
| 459 |
+
$$
|
| 460 |
+
\nabla d _ { S , T } ^ { \Phi } { } ^ { T } { \boldsymbol { v } } = | | \nabla d _ { S , T } ^ { \Phi } | | \ | | \boldsymbol { v } | | c o s \theta
|
| 461 |
+
$$
|
| 462 |
+
|
| 463 |
+
The steepest value will be achieved when $\cos \theta = 1$ which is actually $\begin{array} { r } { v = \frac { \nabla d _ { S , T } ^ { \Phi } ( x ) } { | | \nabla d _ { S , T } ^ { \Phi } ( x ) | | } } \end{array}$ . Now we compare the descent in another direction $\begin{array} { r } { v _ { 2 } \ = \ \frac { \nabla d _ { S , T } ^ { \Phi } | _ { w + \epsilon ( w ) } } { | | \nabla d _ { S , T } ^ { \Phi } | _ { w + \epsilon ( w ) } | | } } \end{array}$ from the gradient descent. The difference in value can be characterized by:
|
| 464 |
+
|
| 465 |
+
$$
|
| 466 |
+
d _ { S , T } ^ { \Phi + \eta v } - d _ { S , T } ^ { \Phi + \eta v _ { 2 } } = \eta | | \nabla d _ { S , T } ^ { \Phi } | | ( 1 - \cos \alpha )
|
| 467 |
+
$$
|
| 468 |
+
|
| 469 |
+
As $\alpha$ is an angle between $\nabla d _ { S , T } ^ { \Phi } | _ { w + \epsilon ( w ) } \ ( v _ { 2 } )$ and $\nabla d _ { S , T } ^ { \Phi } ( X ) \left( v \right)$ . The suboptimality is dependent on the gradient magnitude. We use the following result to show that when optimality gap $d _ { S , T } ^ { * } - d _ { S , T } ^ { \Phi } ( x )$ is large the difference between two directions is also large.
|
| 470 |
+
|
| 471 |
+
For an L-smooth function the following holds according to Lemma 1:
|
| 472 |
+
|
| 473 |
+
$$
|
| 474 |
+
f ( w ) - f ( w ^ { * } ) \geq \frac { 1 } { 2 L } | | \nabla f ( w ) | | ^ { 2 }
|
| 475 |
+
$$
|
| 476 |
+
|
| 477 |
+
As we are performing gradient ascent $f ( w ) = - d _ { s , t } ^ { \Phi }$ , we get the following result:
|
| 478 |
+
|
| 479 |
+
$$
|
| 480 |
+
\begin{array} { c } { { ( d _ { S , T } ^ { * } - d _ { S , T } ^ { \Phi } ) \geq \displaystyle \frac 1 { 2 L } | | \nabla d _ { S , T } ^ { \Phi } ( x ) | | ^ { 2 } } } \\ { { { } } } \\ { { 2 L ( d _ { S , T } ^ { * } - d _ { S , T } ^ { \Phi } ) \geq \displaystyle \frac { ( d _ { S , T } ^ { \Phi + \eta v _ { 2 } } - d _ { S , T } ^ { \Phi + \eta v } ) ^ { 2 } } { ( \eta ( 1 - \cos \alpha ) ) ^ { 2 } } } } \\ { { { } } } \\ { { \eta ( 1 - \cos \alpha ) \sqrt { 2 L ( d _ { S , T } ^ { * } - d _ { S , T } ^ { \Phi } ) } \geq ( d _ { S , T } ^ { \Phi ^ { \prime } } - d _ { S , T } ^ { \Phi ^ { \prime \prime } } ) } } \end{array}
|
| 481 |
+
$$
|
| 482 |
+
|
| 483 |
+
This shows that difference in value of by taking a step in direction of gradient $v$ vs taking the step in a different direction $v _ { 2 }$ is upper bounded by the $\bar { d _ { S , T } ^ { * } } - \bar { d _ { S , T } ^ { \Phi } } ( x )$ , hence if we are far from minima the difference can be potentially large. As we are only doing one step of gradient ascent will be potentially large, hence can lead to suboptimal measure of discrepancy. $d _ { S , T } ^ { * } - d _ { S , T } ^ { \Phi }$
|
| 484 |
+
|
| 485 |
+
Theorem 3. Suppose $l$ is the loss function, we denote $\lambda ^ { * } : = R _ { S } ^ { l } ( h ^ { * } ) + R _ { T } ^ { l } ( h ^ { * } )$ and let $h ^ { * }$ be the ideal joint hypothesis:
|
| 486 |
+
|
| 487 |
+
$$
|
| 488 |
+
R _ { T } ^ { l } ( h _ { \theta } ) \leq \operatorname* { m a x } _ { | | \epsilon | | \leq \rho } \hat { R } _ { S } ^ { l } ( h _ { \theta + \epsilon } ) + D _ { h _ { \theta } , H } ^ { \phi } ( P _ { S } | | P _ { T } ) + \gamma ( | | \theta | | _ { 2 } ^ { 2 } / \rho ^ { 2 } ) + \lambda ^ { * } .
|
| 489 |
+
$$
|
| 490 |
+
|
| 491 |
+
where $\gamma : \mathbb { R } ^ { + } \mathbb { R } ^ { + }$ is a strictly increasing function.
|
| 492 |
+
|
| 493 |
+
Proof of Theorem 3: In this case we make use of Theorem 2 in the paper sharpness aware minimization (Foret et al., 2021) which states the following: The source risk $R _ { S } ( h )$ is bounded using the following PAC-Bayes generalization bound for any $\rho$ with probability $1 - \delta$ :
|
| 494 |
+
|
| 495 |
+
$$
|
| 496 |
+
R _ { S } ( h _ { \theta } ) \leq \operatorname* { m a x } _ { | | \epsilon | | \leq \rho } \hat { R } _ { S } ( h _ { \theta } ) + \sqrt { \frac { k \log \left( 1 + \frac { \| \theta \| _ { 2 } ^ { 2 } } { \rho ^ { 2 } } \left( 1 + \sqrt { \frac { \log ( n ) } { k } } \right) ^ { 2 } \right) + 4 \log \frac { n } { \delta } + \tilde { O } ( 1 ) } { n - 1 } }
|
| 497 |
+
$$
|
| 498 |
+
|
| 499 |
+
here $n$ is the training set size used for calculation of empirical risk $\hat { R } _ { S } ( h )$ , $k$ is the number of parameters and $| | \theta | | _ { 2 }$ is the norm of the weight parameters. The second term in equation can be abbreviated as $\gamma ( | | \theta | | _ { 2 } )$ . Hence,
|
| 500 |
+
|
| 501 |
+
$$
|
| 502 |
+
R _ { S } ( h _ { \theta } ) \leq \operatorname* { m a x } _ { | | \epsilon | | \leq \rho } \hat { R } _ { S } ( h _ { \theta } ) + \gamma ( | | \theta | | _ { 2 } ^ { 2 } / \rho ^ { 2 } )
|
| 503 |
+
$$
|
| 504 |
+
|
| 505 |
+
From the generalization bound for domain adaptation for any f-divergence (Acuna et al., 2021) (Theorem 2) we have the following result.
|
| 506 |
+
|
| 507 |
+
$$
|
| 508 |
+
R _ { T } ^ { l } ( h _ { \theta } ) \leq R _ { S } ^ { l } ( h _ { \theta } ) + \mathcal { D } _ { h _ { \theta } , H } ^ { \phi } ( P _ { S } | | P _ { T } ) + \lambda ^ { * }
|
| 509 |
+
$$
|
| 510 |
+
|
| 511 |
+
Combining the above two inequalities gives us the required result we wanted to prove i.e.
|
| 512 |
+
|
| 513 |
+
$$
|
| 514 |
+
R _ { T } ^ { l } ( h _ { \theta } ) \leq \tilde { R } _ { S } ^ { l } ( h _ { \theta } ) + D _ { h _ { \theta } , H } ^ { \phi } ( P _ { S } | | P _ { T } ) + \gamma ( | | \theta | | _ { 2 } ^ { 2 } / \rho ^ { 2 } ) + \lambda ^ { * } .
|
| 515 |
+
$$
|
| 516 |
+
|
| 517 |
+
# D HESSIAN ANALYSIS
|
| 518 |
+
|
| 519 |
+
We use the PyHessian library (Yao et al., 2020) to calculate the Hessian eigenvalues and the Hessian Eigen Spectral Density. All the calculations are performed using $50 \%$ of the source data at the last checkpoint. Only the source class loss is used for calculating to clearly illustrate our point. The partition was selected randomly, and the same partition was used across all the runs. We also made sure to use the same environment to run all the Hessian experiments. A subset of the data was used for Hessian calculation mainly because the hessian calculation is computationally expensive (Yao et al., 2020). This is commonly done in hessian experiments. For example, (Chen et al., 2021) (refer Appendix D) uses $10 \%$ of training data for Hessian Eigenvalue calculation The PyHessian library uses Lanczos algorithm (Ghorbani et al., 2019) for calculating the Eigen Spectral density of the Hessian and uses the Hutchinson method to calculate the trace of the Hessian efficiently.
|
| 520 |
+
|
| 521 |
+
Table S2: Architecture used for feature classifier and Domain classifier. $C$ is the number of classes. Both classifiers will take input from feature generator $\left( g _ { \boldsymbol { \theta } } \right)$ .
|
| 522 |
+
|
| 523 |
+
<table><tr><td rowspan=1 colspan=1>Layer</td><td rowspan=1 colspan=1>Output Shape</td></tr><tr><td rowspan=1 colspan=1>Featu</td><td rowspan=1 colspan=1>Feature Classifier(fe)</td></tr><tr><td rowspan=1 colspan=1>Linear</td><td rowspan=1 colspan=1>Bottleneck DimensionC</td></tr><tr><td rowspan=1 colspan=1>Domai</td><td rowspan=1 colspan=1>Domain Classifier (DΦ)</td></tr><tr><td rowspan=5 colspan=1>LinearBatchNormReLULinearBatchNormReLULinear</td><td rowspan=3 colspan=1>BottleneckDimension102410241024</td></tr><tr><td rowspan=2 colspan=1>1024</td></tr><tr><td rowspan=1 colspan=1>10241024</td></tr><tr><td rowspan=1 colspan=1>10241024</td></tr><tr><td rowspan=1 colspan=1>10241</td></tr></table>
|
| 524 |
+
|
| 525 |
+
Table S3: Accuracy $( \% )$ on VisDA2017 (ResNet-101).
|
| 526 |
+
|
| 527 |
+
<table><tr><td>Method</td><td>Synthetic →Real</td></tr><tr><td>DANN (Ganin et al., 2016) MCD (Saito et al., 2018b)</td><td>57.4 71.4</td></tr><tr><td>CDAN (Long et al., 2018) CDAN*a</td><td>73.7 76.6</td></tr><tr><td>CDAN w/ SDAT</td><td>78.3</td></tr><tr><td>CDAN+MCC (Jin et al., 2020) CDAN+MCC w/ SDAT</td><td>80.4 81.2</td></tr></table>
|
| 528 |
+
|
| 529 |
+
aOur implementation of CDAN. Refer to Section F for more details.
|
| 530 |
+
|
| 531 |
+
# E SMOOTHNESS OF DISCRIMINATOR IN SNGAN
|
| 532 |
+
|
| 533 |
+
We also did the similar experiment of smoothing discriminator in DAT (Sec. 4.1) for SNGAN Miyato et al. (2018) as the adversarial objective in GAN is similar to DAT. We use the same configuration for SNGAN as described in PyTorchStudioGAN (Kang & Park, 2020) for both CIFAR10 (Krizhevsky et al., 2009) and TinyImageNet 3 with batch size of 256 in both cases. We then smooth the discriminator while discriminator is trained by using the same formulation as in Eq. 9. We find that smoothing discriminator leads to higher (suboptimal) Frechet Inception Distance in case of ´ GANs as well, shown in Fig. 3.
|
| 534 |
+
|
| 535 |
+
# F EXPERIMENTAL DETAILS
|
| 536 |
+
|
| 537 |
+
# F.1 IMAGE CLASSIFICATION
|
| 538 |
+
|
| 539 |
+
Office-Home: For CDAN methods, we train the models using mini-batch stochastic gradient descent (SGD) with a batch size of 32 and a learning rate of 0.01. The learning rate schedule is the same as (Ganin et al., 2016). We train it for a total of 30 epochs with 1000 iterations per epoch. The momentum parameter in SGD is set to 0.9 and a weight decay of 0.001 is used. For $\mathrm { C D A N + M C C }$ experiments, we use a temperature parameter (Jin et al., 2020) of 2.5. The bottleneck dimension for the features is set to 2048.
|
| 540 |
+
|
| 541 |
+
VisDA-2017: We use a ResNet-101 backbone initialized with ImageNet weights for VisDA-2017 experiments. Center Crop is also used as an augmentation during training. We use a bottleneck dimension of 256 for both algorithms.
|
| 542 |
+
|
| 543 |
+
For CDAN runs, we train the model for 30 epochs with same optimizer setting as that of OfficeHome. For CDAN+MCC runs, we use a temperature parameter of 3.0 and a learning rate of 0.002.
|
| 544 |
+
|
| 545 |
+
DomainNet: We use a ResNet-101 backbone initialized with ImageNet weights for DomainNet experiments. We run all the experiments for 30 epochs with 2500 iterations per epoch. The other parameters are the same as that of Office-Home.
|
| 546 |
+
|
| 547 |
+
To show the effectiveness of SDAT fairly and promote reproducibility, we run with and without SDAT on the same GPU and environment and with the same seed. All the above experiments were run on Nvidia V100 and RTX 2080 GPUs. We used Wandb (Biewald, 2020) to track our experiments. We will be releasing the code to promote reproducible research.
|
| 548 |
+
|
| 549 |
+
# F.1.1 ARCHITECTURE OF DOMAIN DISCRIMINATOR
|
| 550 |
+
|
| 551 |
+
One of the major reasons for increased accuracy in Office-Home baseline CDAN compared to reported numbers in the paper is the architecture of domain classifier. The main difference is the use
|
| 552 |
+
|
| 553 |
+
Table S5: Accuracy $( \% )$ on DomainNet dataset for unsupervised domain adaptation (ResNet-101) across five distinct domains. The row indicates the source domain and the columns indicate the target domain.
|
| 554 |
+
|
| 555 |
+
<table><tr><td>ADDA</td><td>clp</td><td>inf</td><td>pnt</td><td>rel</td><td>skt</td><td>Avg</td><td>MCD</td><td>clp</td><td>inf</td><td>pnt</td><td>rel</td><td>skt</td><td>Avg</td></tr><tr><td>clp</td><td>-</td><td>11.2</td><td>24.1</td><td>41.9</td><td>30.7</td><td>27.0</td><td>clp</td><td>-</td><td>14.2</td><td>26.1</td><td>45.0</td><td>33.8</td><td>29.8</td></tr><tr><td>inf</td><td>19.1</td><td>-</td><td>16.4</td><td>26.9</td><td>14.6</td><td>19.2</td><td>inf</td><td>23.6</td><td>-</td><td>21.2</td><td>36.7</td><td>18.0</td><td>24.9</td></tr><tr><td>pnt</td><td>31.2</td><td>9.5</td><td>-</td><td>39.1</td><td>25.4</td><td>26.3</td><td>pnt</td><td>34.4</td><td>14.8</td><td>-</td><td>50.5</td><td>28.4</td><td>32.0</td></tr><tr><td>rel</td><td>39.5</td><td>14.5</td><td>29.1</td><td>-</td><td>25.7</td><td>27.2</td><td>rel</td><td>42.6</td><td>19.6</td><td>42.6</td><td>-</td><td>29.3</td><td>33.5</td></tr><tr><td>skt</td><td>35.3</td><td>8.9</td><td>25.2</td><td>37.6</td><td>-</td><td>26.7</td><td>skt</td><td>41.2</td><td>13.7</td><td>27.6</td><td>34.8</td><td>1</td><td>29.3</td></tr><tr><td>Avg</td><td>31.3</td><td>11.0</td><td>23.7</td><td>36.4</td><td>24.1</td><td>25.3</td><td>Avg</td><td>35.4</td><td>15.6</td><td>29.4</td><td>41.7</td><td>27.4</td><td>29.9</td></tr><tr><td>CDAN</td><td>clp</td><td>inf</td><td>pnt</td><td>rel</td><td>skt</td><td>Avg</td><td>CDAN w/ SDAT</td><td>clp</td><td>inf</td><td>pnt</td><td>rel</td><td>skt</td><td>Avg</td></tr><tr><td>clp</td><td>-</td><td>20.6</td><td>38.9</td><td>56.0</td><td>44.9</td><td>40.1</td><td>clp</td><td>-</td><td>22.0</td><td>41.5</td><td>57.5</td><td>47.2</td><td>42.1</td></tr><tr><td>inf</td><td>31.5</td><td>-</td><td>29.3</td><td>43.6</td><td>26.3</td><td>32.7</td><td>inf</td><td>33.9</td><td>-</td><td>30.3</td><td>48.1</td><td>27.9</td><td>35.0</td></tr><tr><td>pnt</td><td>44.1</td><td>19.8</td><td>-</td><td>57.2</td><td>39.9</td><td>40.2</td><td>pnt</td><td>47.5</td><td>20.7</td><td>-</td><td>58.0</td><td>41.8</td><td>42.0</td></tr><tr><td>rel</td><td>55.8</td><td>24.4</td><td>53.2</td><td>-</td><td>42.3</td><td>43.9</td><td>rel</td><td>56.7</td><td>25.1</td><td>53.6</td><td>-</td><td>43.9</td><td>44.8</td></tr><tr><td>skt</td><td>56.0</td><td>20.7</td><td>45.3</td><td>54.9</td><td>-</td><td>44.2</td><td>skt</td><td>58.7</td><td>21.8</td><td>48.1</td><td>57.1</td><td>-</td><td>46.4</td></tr><tr><td>Avg</td><td>46.9</td><td>21.4</td><td>41.7</td><td>52.9</td><td>38.3</td><td>40.2</td><td>Avg</td><td>49.2</td><td>22.4</td><td>43.4</td><td>55.2</td><td>40.2</td><td>42.1</td></tr></table>
|
| 556 |
+
|
| 557 |
+
of batch normalization layer in domain classifier, which was done in the library (Junguang Jiang & Long, 2020). Table S2 shows the architecture of the feature classifier and domain classifier.
|
| 558 |
+
|
| 559 |
+
# F.2 ADDITIONAL IMPLEMENTATIONS DETAILS FOR DA FOR OBJECT DETECTION
|
| 560 |
+
|
| 561 |
+
In SDAT, we modified the loss function present in Chen et al. (2018) by adding classification loss smoothing, i.e. smoothing classification loss of RPN and ROI, used in Faster R-CNN (Ren et al., 2015), by training with source data. Similarly, we applied smoothing to regression loss and found it to be less effective. We implemented SDAT for object detection using Detectron2 (Wu et al., 2019). We fixed $\rho$ to 0.15 for object detection experiments.
|
| 562 |
+
|
| 563 |
+
# G ADDITIONAL RESULTS
|
| 564 |
+
|
| 565 |
+
VisDA-2017: Table S3 shows the overall accuracy on the VisDA-2017 with ResNet-101 backbone. The accuracy reported in this table is the overall accuracy of the dataset, whereas the accuracy reported in the Table 5 of the main paper refers to the mean of the accuracy across classes. CDAN w/ SDAT outperforms CDAN by $1 . 7 \%$ , showing the effectiveness of SDAT in large scale Synthetic Real shifts. With CDAN+MCC as the backbone, adding SDAT improves the performance of the method to $8 1 . 2 \%$ .
|
| 566 |
+
|
| 567 |
+
DomainNet: Table S5 shows the results of the proposed method on DomainNet across five domains. We compare our results with ADDA and MCD and show that CDAN achieves much higher performance on DomainNet compared to other techniques. It can be seen that CDAN w/ SDAT further improves the overall accuracy on DomainNet by $1 . 8 \%$ .
|
| 568 |
+
|
| 569 |
+
Results with DANN (Ganin & Lempitsky, 2015): Domain Adversarial neural networks introduced the concept of adversarial training in domain adaptation and is a seminal paper in the field of domain adaptation. Table S4 shows the results on some splits on Office-Home with DANN and DANN w/ SDAT. DANN w/ SDAT improves upon the performance on DANN specifically in challenging splits like Clipart $ \mathbf { A r t }$ where DANN w/ SDAT gets a $1 \%$ increase over DANN.
|
| 570 |
+
|
| 571 |
+
We have shown results with three different domain adaptation algorithms namely DANN (Ganin & Lempitsky, 2015), CDAN (Long et al., 2018) and $\mathrm { C D A N + M C C }$ (Jin et al., 2020). SDAT has shown to improve the performance of all the three DA methods. This shows that SDAT is a generic method that can applied on top of any domain adversarial training based method to get better performance.
|
| 572 |
+
|
| 573 |
+
Table S4: Results on Office-Home dataset with DANN (Ganin & Lempitsky, 2015). DANN w/ SDAT improves the performance over DANN across the four splits of Office-Home dataset showing the adaptability of the proposed method.
|
| 574 |
+
|
| 575 |
+
<table><tr><td>Method</td><td>Ar>C1</td><td>Cl>Pr</td><td>Rw>Cl</td><td>Pr>C1</td><td>Average</td></tr><tr><td>DANN (Ganin & Lempitsky,2015)</td><td>52.6</td><td>65.4</td><td>60.4</td><td>52.3</td><td>57.7</td></tr><tr><td>DANN w/ SDAT</td><td>53.4</td><td>66.4</td><td>61.3</td><td>53.8</td><td>58.7</td></tr></table>
|
| 576 |
+
|
| 577 |
+
# H DIFFERENT SMOOTHING TECHNIQUES
|
| 578 |
+
|
| 579 |
+
Stochastic Weight Averaging (SWA) (Izmailov et al., 2018): SWA is a widely popular technique to reach a flatter minima. The idea behind SWA is that averaging weights across epochs leads to better generalization because it reaches a wider optima. The recently proposed SWA-Densely (SWAD) (Cha et al., 2021) takes this a step further and proposes to average the weights across iterations instead of epochs. SWAD shows improved performance on domain generalization tasks. We average every 400 iterations in the SWA instead of averaging per epochs. We tried averaging across 800 iterations as well and the performance was comparable.
|
| 580 |
+
|
| 581 |
+
Virtual Adversarial Training (VAT) (Miyato et al., 2019): VAT is regularization technique which makes use of adversarial perturbations. Adversarial perturbations are created using Algo. 1 present in (Miyato et al., 2019). We added VAT by optimizing the following objective:
|
| 582 |
+
|
| 583 |
+
$$
|
| 584 |
+
\operatorname* { m i n } _ { \theta } \mathbb { E } _ { x \sim P _ { S } } \big [ \operatorname* { m a x } _ { | | r | | \leq \epsilon } D _ { K L } ( h _ { \theta } ( x ) | | h _ { \theta } ( x + r ) ) \big ]
|
| 585 |
+
$$
|
| 586 |
+
|
| 587 |
+
This value acts as a negative measure of smoothness and minimizing this will make the model smooth. For training, we set hyperparameters $\epsilon$ to 15.0, $\xi$ to 1e-6, and $\alpha$ as 0.1.
|
| 588 |
+
|
| 589 |
+
Label Smoothing (LS) (Szegedy et al., 2016): The idea behind label smoothing is to have a distribution over outputs instead of one hot vectors. Assuming that there are $\mathrm { k }$ classes, the correct class gets a probability of $1 - \alpha$ and the other classes gets a probability of $\alpha /$ (k-1). (Stutz et al., 2021) mention that label smoothing tends to avoid sharper minima during training. We use a smoothing parameter $( \alpha )$ of 0.1 in all the experiments in Table S6. We also show results with smoothing parameter of 0.2 and observe comparable performance. We observe that label smoothing slightly improves the performance over DAT.
|
| 590 |
+
|
| 591 |
+
Table S6: Different Smoothing techniques. We refer to (Stutz et al., 2021) to compare the proposed SDAT with other techniques to show the efficacy of SDAT. It can be seen that SDAT outperforms the other smoothing techniques significantly. Other smoothing techniques improve upon the performance of DAT showing that smoothing is indeed necessary for better adaptation.
|
| 592 |
+
|
| 593 |
+
<table><tr><td>Method</td><td>Ar>C1</td><td>Cl>Pr Rw>C1</td><td>Pr>C1</td></tr><tr><td>DAT</td><td>54.3 69.5</td><td>60.1</td><td>55.3</td></tr><tr><td>VAT</td><td>54.6 70.7</td><td>60.8</td><td>54.4</td></tr><tr><td>SWAD-400</td><td>54.6 71.0</td><td>60.9</td><td>55.2</td></tr><tr><td>LS (α = 0.1)</td><td>53.6 71.6</td><td>59.9</td><td>53.4</td></tr><tr><td>LS (α = 0.2)</td><td>53.5 71.2</td><td>60.5</td><td>53.2</td></tr><tr><td>SDAT</td><td>55.9 73.2</td><td>61.4</td><td>55.9</td></tr></table>
|
| 594 |
+
|
| 595 |
+
# I OPTIMUM RHO VALUE
|
| 596 |
+
|
| 597 |
+
Table S7 and S8 show that $\rho = 0 . 0 2$ works robustly across experiments providing an increase in performance (although it does not achieve the best result each time) and can be used as a rule of thumb.
|
| 598 |
+
|
| 599 |
+
Table S7: $\rho$ value for DomainNet
|
| 600 |
+
|
| 601 |
+
<table><tr><td>Split</td><td>DAT</td><td>SDAT(p = 0.02)</td><td>SDAT - Reported (p = 0.05)</td></tr><tr><td>clp-skt</td><td>44.9</td><td>46.7</td><td>47.2</td></tr><tr><td>skt>clp</td><td>56.0</td><td>59.0</td><td>58.7</td></tr><tr><td> skt→pnt</td><td>45.3</td><td>47.8</td><td>48.1</td></tr><tr><td>inf→rel</td><td>43.6</td><td>47.3</td><td>48.1</td></tr></table>
|
| 602 |
+
|
| 603 |
+
Table S8: $\rho$ value for VisDA-2017 Synthetic Real
|
| 604 |
+
|
| 605 |
+
<table><tr><td>Backbone</td><td>DAT</td><td>SDAT(p=0.02)</td><td>SDAT Reported(p = 0.005)</td></tr><tr><td>CDAN</td><td>76.6</td><td>78.2</td><td>78.3</td></tr><tr><td>CDAN+MCC</td><td>80.4</td><td>80.9</td><td>81.2</td></tr></table>
|
| 606 |
+
|
| 607 |
+

|
| 608 |
+
Figure S1: Validation Accuracy across epochs on different splits of DomainNet. We run on three different random seeds and plot the error bar indicating standard deviation across runs. CDAN w/ SDAT consistently outperforms CDAN across different splits of DomainNet.
|
| 609 |
+
|
| 610 |
+
# J SIGNIFICANCE AND STABILITY OF EMPIRICAL RESULTS
|
| 611 |
+
|
| 612 |
+
To establish the empirical results’ soundness and reliability, we run a subset of experiments (representative of each different source domain) on DomainNet. The experiments are repeated with three different random seeds leading to overall 36 experimental runs (18 for CDAN w/ SDAT (Our proposed method) and 18 for CDAN baseline). Due to the large computational complexity of each experiment ${ \approx } 2 0$ hrs each), we have presented results for multiple trials on a subset of splits. We find (in Table S9) that our method can outperform the baseline average in each of the 6 cases, establishing significant improvement across all splits. However, we found that due to the large size of DomainNet, the average increase (across three different trials) is close to the reported increase in all cases (Table S9), which also serves as evidence of the soundness of reported results (for remaining splits). We also present additional statistics below for establishing soundness.
|
| 613 |
+
|
| 614 |
+
If the proposed method is unstable, there is a large variance in the validation accuracy across epochs. For analyzing the stability of SDAT, we show the validation accuracy plots in Figure S1 on six different splits of DomainNet. We find that our proposed SDAT improves over baselines consistently across epochs without overlap in confidence intervals in later epochs. This also provides evidence for the authenticity and stability of our results. We also find that in some cases, like when using the Infographic domain as a source, our proposed SDAT also significantly stabilizes the training (Figure S1 Infographic Clipart).
|
| 615 |
+
|
| 616 |
+
One of the other ways of reporting results reliably proposed by the concurrent work (Berthelot et al., 2021) (Section 4.4) involves reporting the median of accuracy across the last few checkpoints. The median is a measure of central tendency which ignores outlier results. We also report the median of validation accuracy for our method across all splits for the last five epochs. It is observed that we observe similar gains for median accuracy (in Table S10) as reported in Table 2.
|
| 617 |
+
|
| 618 |
+
Table S9: DomainNet experiments over 3 different seeds. We report the mean, standard deviation, reported increase and average increase in the accuracy (in $\%$ ).
|
| 619 |
+
|
| 620 |
+
<table><tr><td>Split</td><td>CDAN</td><td>CDAN w/ SDAT</td><td>Reported Increase (Table 2)</td><td>Average Increase</td></tr><tr><td>clp→pnt</td><td>38.9 ± 0.1</td><td>41.5 ± 0.3</td><td>+2.6</td><td>+2.6</td></tr><tr><td>skt>rel</td><td>55.1 ± 0.2</td><td>57.1 ± 0.1</td><td>+2.2</td><td>+2.0</td></tr><tr><td>pnt>clp</td><td>44.5 ± 0.3</td><td>47.1 ± 0.3</td><td>+3.4</td><td>+2.6</td></tr><tr><td>rel>skt</td><td>42.4 ± 0.4</td><td>43.9 ± 0.1</td><td>+1.6</td><td>+1.5</td></tr><tr><td>clp>skt</td><td>44.9 ± 0.2</td><td>47.3 ± 0.1</td><td>+2.3</td><td>+2.4</td></tr><tr><td>inf→clp</td><td>31.4 ± 0.5</td><td>34.2 ± 0.3</td><td>+2.3</td><td>+2.7</td></tr></table>
|
| 621 |
+
|
| 622 |
+
Table S10: Median accuracy of last 5 epochs on DomainNet dataset with CDAN w/ SDAT. The number in the parenthesis indicates the increase in accuracy with respect to CDAN.
|
| 623 |
+
|
| 624 |
+
<table><tr><td>Target (→) Source (↓)</td><td>clp</td><td>inf</td><td>pnt</td><td>real</td><td>skt</td><td>Avg</td></tr><tr><td>clp</td><td></td><td>21.9 (+1.7)</td><td>41.6 (+3.0)</td><td>56.5 (+1.3)</td><td>46.4 (+2.0)</td><td>41.6 (+2.0)</td></tr><tr><td>inf</td><td>32.4 (+7.9)</td><td></td><td>29.8 (+7.0)</td><td>46.7 (+12.7)</td><td>25.6 (+5.4)</td><td>33.6 (+8.2)</td></tr><tr><td>pnt</td><td>47.2 (+2.9)</td><td>21.0 (+1.1)</td><td></td><td>57.6 (+1.0)</td><td>41.5 (+2.4)</td><td>41.8 (+1.8)</td></tr><tr><td>real</td><td>56.5 (+0.7)</td><td>25.5 (+0.9)</td><td>53.9 (+0.5)</td><td></td><td>43.5 (+1.3)</td><td>44.8 (+0.8)</td></tr><tr><td>skt</td><td>59.1 (+3.0)</td><td>22.1 (+1.7)</td><td>48.2 (+3.1)</td><td>56.6 (+2.9)</td><td></td><td>46.5 (+2.7)</td></tr><tr><td>Avg</td><td>48.8 (+3.6)</td><td>22.6 (+1.3)</td><td>43.4 (+3.4)</td><td>54.3 (+4.5)</td><td>39.2 (+2.8)</td><td>41.7 (+3.1)</td></tr></table>
|
| 625 |
+
|
| 626 |
+
As the Office-Home dataset is smaller (i.e., 44 images per class) in comparison to DomainNet we find that there exists some variance in baseline CDAN results (This is also reported in the wellknown benchmark for DA (Junguang Jiang & Long, 2020)). For establishing the empirical soundness, we report results of 4 different dataset splits on three different random seeds. It can be seen in Table S11 that even though there is variance in baseline results, our combination of CDAN w/ SDAT can produce consistent improvement across different random seeds. This further establishes the empirical soundness of our procedure.
|
| 627 |
+
|
| 628 |
+
Table S11: Office-Home experiments over 3 different seeds. We report the mean, standard deviation, reported increase and average increase in the accuracy (in $\%$ ).
|
| 629 |
+
|
| 630 |
+
<table><tr><td>Split</td><td>CDAN</td><td>CDAN w/SDAT</td><td>Reported Increase(Table1)</td><td>Average Increase</td></tr><tr><td>Ar>CI</td><td>53.9± 0.2</td><td>55.5 ± 0.2</td><td>+1.7</td><td>+1.6</td></tr><tr><td>Ar>Pr</td><td>70.6 ± 0.4</td><td>72.1 ± 0.4</td><td>+1.6</td><td>+1.5</td></tr><tr><td>Rw→Cl</td><td>60.7 ± 0.5</td><td>61.8 ± 0.4</td><td>+1.3</td><td>+1.1</td></tr><tr><td>Pr>Cl</td><td>54.7 ± 0.4</td><td>55.5 ± 0.4</td><td>+0.6</td><td>+0.8</td></tr></table>
|
md/dev/I3mLa12s_H/I3mLa12s_H.md
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Point Transformer V2: Grouped Vector Attention and Partition-based Pooling
|
| 2 |
+
|
| 3 |
+
Xiaoyang $\mathbf { W } \mathbf { u } ^ { 1 }$ Yixing Lao2 Li Jiang3 Xihui Liu1 Hengshuang Zhao1∗ 1The University of Hong Kong 2Intel Labs 3Max Planck Institute {xywu3, hszhao}@cs.hku.hk
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
As a pioneering work exploring transformer architecture for 3D point cloud understanding, Point Transformer achieves impressive results on multiple highly competitive benchmarks. In this work, we analyze the limitations of the Point Transformer and propose our powerful and efficient Point Transformer V2 model with novel designs that overcome the limitations of previous work. In particular, we first propose group vector attention, which is more effective than the previous version of vector attention. Inheriting the advantages of both learnable weight encoding and multi-head attention, we present a highly effective implementation of grouped vector attention with a novel grouped weight encoding layer. We also strengthen the position information for attention by an additional position encoding multiplier. Furthermore, we design novel and lightweight partition-based pooling methods which enable better spatial alignment and more efficient sampling. Extensive experiments show that our model achieves better performance than its predecessor and achieves state-of-the-art on several challenging 3D point cloud understanding benchmarks, including 3D point cloud segmentation on ScanNet v2 and S3DIS and 3D point cloud classification on ModelNet40. Our code will be available at https://github.com/Gofinge/PointTransformerV2.
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
Point Transformer (PTv1) [1] introduces the self-attention networks to 3D point cloud understanding. Combining the vector attention [2] with a U-Net style encoder-decoder framework, PTv1 achieves remarkable performance in several 3D point cloud recognition tasks, including shape classification, object part segmentation, and semantic scene segmentation.
|
| 12 |
+
|
| 13 |
+
In this work, we analyze the limitations of Point Transformer (PTv1) [1] and propose a new elegant and powerful backbone named Point Transformer V2 (PTv2). Our PTv2 improves upon PTv1 with several novel designs, including the advanced grouped vector attention with improved position encoding, and the efficient partition-based pooling scheme.
|
| 14 |
+
|
| 15 |
+
The vector attention layers in PTv1 utilize MLPs as the weight encoding to map the subtraction relation of query and key into an attention weight vector that can modulate the individual channels of the value vector. However, as the model goes deeper and the number of channels increases, the number of weight encoding parameters also increases drastically, leading to severe overfitting and limiting the model depth. To address this problem, we present grouped vector attention with a more parameter-efficient formulation, where the vector attention is divided into groups with shared vector attention weights. Meanwhile, we show that the well-known multi-head attention [3] and the vector attention [2, 1] are degenerate cases of our proposed grouped vector attention. Our proposed grouped vector attention inherits the merits of both vector attention and multi-head attention while being more powerful and efficient.
|
| 16 |
+
|
| 17 |
+
Furthermore, point positions provide important geometric information for 3D semantic understanding. Hence, the positional relationship among 3D points is more critical than 2D pixels. However, previous 3D position encoding schemes mostly follow the 2D ones and do not fully exploit the geometric knowledge in 3D coordinates. To this end, we strengthen the position encoding mechanism by applying an additional position encoding multiplier to the relation vector. Such a design strengthens the positional relationship information in the model, and we validate its effectiveness in our experiments.
|
| 18 |
+
|
| 19 |
+
Moreover, it is worth noting that the irregular, non-uniform spatial distributions of points are significant challenges to the pooling modules for point cloud processing. Previous point cloud pooling approaches rely on a combination of sampling methods (e.g. farthest point sampling [4] or grid sampling [5]) and neighbor query methods (e.g. kNN or radius query), which is time-consuming and not spatially well-aligned. To overcome this problem, we go beyond the pooling paradigm of combining sampling and query, and divide the point cloud into non-overlapping partitions to directly fuse points within the same partition. We use uniform grids as partition divider and achieve significant improvement.
|
| 20 |
+
|
| 21 |
+
In conclusion, we propose Point Transformer V2, which improves Point Transformer [1] from several perspectives:
|
| 22 |
+
|
| 23 |
+
• We propose an effective grouped vector attention (GVA) with a novel weight encoding layer that enables efficient information exchange within and among attention groups.
|
| 24 |
+
• We introduce an improved position encoding scheme to utilize point cloud coordinates better and further enhance the spatial reasoning ability of the model.
|
| 25 |
+
• We design the partition-based pooling strategy to enable more efficient and spatially betteraligned information aggregation compared to previous methods.
|
| 26 |
+
|
| 27 |
+
We conducted extensive analysis and controlled experiments to validate our designs. Our results indicate that PTv2 outperforms predecessor works and sets the new state-of-the-art on various 3D understanding tasks.
|
| 28 |
+
|
| 29 |
+
# 2 Related Works
|
| 30 |
+
|
| 31 |
+
Image transformers. With the great success of ViT [6], the absolute dominance of convolution in vision tasks is shaken by Vision Transformer, which becomes a trend in 2D image understanding [7, 8, 9, 10]. ViT introduces the far-reaching scaled dot-product self-attention and multi-head self-attention theory [3] in NLP into vision by considering image patches as tokens. However, operating global attention on the entire image consumes excessive memory. To solve the memory consumption problem, Swin Transformer [7] introduces the grid-based local attention mechanism to operate the transformer block in a sequence of shifted windows.
|
| 32 |
+
|
| 33 |
+
Point cloud understanding. Learning-based methods for processing 3D point clouds can be classified into the following types: projection-based, voxel-based, and point-based networks. An intuitive way to process irregular inputs like point clouds is to transform irregular representations into regular ones. Projection-based methods project 3D point clouds into various image planes and utilize 2D CNN-based backbones to extract feature representations [11, 12, 13, 14]. An alternative approach operates convolutions in 3D by transforming irregular point clouds into regular voxel representations [15, 16]. Those voxel-based methods suffer from inefficiency because of the sparsity of point clouds until the introduction and implementation of sparse convolution [17, 18]. Point-based methods extract features directly from the point cloud rather than projecting or quantizing irregular point clouds onto regular grids in 2D or 3D [19, 4, 20, 5]. The recently proposed transformer-based point cloud understanding approaches, introduced in the next paragraph, are also categorized into point-based methods.
|
| 34 |
+
|
| 35 |
+
Point cloud transformers. Transformer-based networks belong to the category of point-based networks for point cloud understanding. During the research upsurge of vision transformers, at almost the same period, Zhao et al. [1] and Guo et al. [21] published their explorations of applying attention to point cloud understanding, becoming pioneers in this direction. The PCT [21] proposed by Guo et al. performs global attention directly on the point cloud. Their work, similar to ViT, is limited by memory consumption and computational complexity. Meanwhile, based on the vector attention theory proposed in SAN [2], Point Transformer [1] proposed by Zhao et al. directly performs local attention between each point and its adjacent points, which alleviated the memory problem mentioned above. Point Transformer achieves remarkable results in multiple point cloud understanding tasks and state-of-art results for several competitive challenges. In this work, we analyze the limitations of the Point Transformer [1], and propose several novel architecture designs for the attention and pooling module, to improve the effectiveness and efficiency of the Point Transformer. Our proposed model, Point Transformer V2, performs better than the Point Transformer across a variety of 3D scene understating tasks.
|
| 36 |
+
|
| 37 |
+

|
| 38 |
+
Figure 1: Comparison of the attention, position encoding, and pooling mechanisms between PTv1 and PTv2. Top-left: the vector attention (Sec. 3.1) with position encoding (Sec. 3.3) in PTv1 . Bottom-left: our grouped vector attention (Sec. 3.2, denoted by red) with improved position encoding (Sec. 3.3, denoted by blue) in PTv2. Top-right: the sampling-based pooling and interpolation-based unpooling in PTv1. Bottom-right: our partition-based pooling and unpooling in PTv2 (Sec. 3.4).
|
| 39 |
+
|
| 40 |
+
# 3 Point Transformer V2
|
| 41 |
+
|
| 42 |
+
We analyze the limitations of Point Transformer V1 (PTv1) [1] and propose our Point Transformer V2 (PTv2), including several improved modules upon PTv1. We begin by introducing the mathematical formulations and revisiting the vector self-attention used in PTv1 in Sec. 3.1. Based on the observation that the parameters of PTv1 increases drastically with the increased model depth and channel size, we propose our powerful and efficient grouped vector attention in Sec. 3.2. Further, we introduce our improved position encoding in Sec. 3.3 and the new pooling method in Sec. 3.4. We finally describe our network architecture in Sec. 3.5.
|
| 43 |
+
|
| 44 |
+
# 3.1 Problem Formulation and Background
|
| 45 |
+
|
| 46 |
+
Problem formulation. Let $\mathcal { M } = ( \mathcal { P } , \mathcal { F } )$ be a 3D point cloud scene containing a set of points $\pmb { x } _ { i } = ( \pmb { p } _ { i } , \pmb { f } _ { i } ) \in \mathcal { M }$ , where $\pmb { p } _ { i } \in \mathbb { R } ^ { 3 }$ represents the point position, and $\ b { f } _ { i } \in \mathbb { R } ^ { c }$ represents the point features. Point cloud semantic segmentation aims to predict a class label for each point $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ , and the goal of scene classification is to predict a class label for each scene $\mathcal { M }$ . $\mathcal { M } ( \pmb { p } )$ denotes a mapping function that maps the point at position $\pmb { p }$ to a subset of $\mathcal { M }$ denoted as “reference set”. Next, we revisit the self-attention mechanism used in PTv1 [1].
|
| 47 |
+
|
| 48 |
+
Local attention. Conducting the global attention [6, 21] over all points in a scene is computationally heavy and infeasible for large-scale 3D scenes. Therefore, we apply local attention where the attention for each point $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ works within a subset of points, i.e., reference point set, $\mathcal { M } ( \pmb { p } _ { i } )$ .
|
| 49 |
+
|
| 50 |
+
Shifted-grid attention [7], where attention is alternatively applied over two sets of non-overlapping image grids, has become is a common practice [22, 23, 24, 25] for image transformers. Similarly, the 3D space can be split into uniform non-overlapping grid cells, and the reference set is defined as the points within the same grid, i.e., $\mathcal { M } ( \pmb { p } _ { i } ) = \{ ( \pmb { p } _ { j } , \pmb { f } _ { j } ) \ | \ \pmb { p } _ { j }$ in the same grid cell as $\pmb { p } _ { i } \}$ . However, such attention relies on a cumbersome shift grid operation to achieve a global receptive field, and it does not work well on point clouds where the point densities within different grids are not consistent.
|
| 51 |
+
|
| 52 |
+
PTv1 adopts neighborhood attention, where the reference point set is a local neighborhood of the given point, i.e., $\mathcal { M } ( \pmb { p } _ { i } ) = \{ ( \pmb { p } _ { j } , \pmb { f } _ { j } ) \ | \ p _ { j } \in \mathrm { N e i g h b o r h o o d } ( \pmb { p } _ { i } ) \}$ . Specifically, the neighborhood point set $\mathcal { M } ( \pmb { p } _ { i } )$ is defined as the $k$ nearest neighboring (kNN) points of $\mathbf { \nabla } _ { \pmb { p } _ { i } }$ in PTv1. Our experiments (Sec. 4.3) show that neighborhood attention is more effective than shifted-grid attention, so our approach adopts the neighborhood attention.
|
| 53 |
+
|
| 54 |
+
Scalar attention and vector attention. Given a point $\pmb { x } _ { i } = ( \pmb { p } _ { i } , \pmb { f } _ { i } ) \in \mathcal { M }$ , we apply linear projections or MLPs to project the point features $f _ { i }$ to the feature vectors of query $\pmb q _ { i }$ , key $\boldsymbol { k } _ { i }$ , and value ${ \mathbf { } } v _ { i }$ each with $c _ { h }$ channels. The standard scalar attention (SA) operated on the point $x _ { i }$ and its reference point set $\mathcal { M } ( \pmb { p } _ { i } )$ can be represented as follows,
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
w _ { i j } = \langle q _ { i } , k _ { j } \rangle / \sqrt { c _ { h } } , \qquad \mathbf { f } _ { i } ^ { \mathrm { a t t n } } = \sum _ { \substack { \mathbf { x } _ { j } \in \mathcal { M } ( p _ { i } ) } } \operatorname { S o f t m a x } ( \pmb { w } _ { i } ) _ { j } \pmb { v } _ { j } ,
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
The attention weights in the above formulation are scalars computed from the scaled dot-product [3] between the query and key vectors. Multi-head scalar attention (MSA) [3] is an extension of SA which runs several scalar attentions in parallel. MSA is widely applied in transformers, and we will show in Sec. 3.2 that MSA is a degenerate case of our proposed grouped vector attention.
|
| 61 |
+
|
| 62 |
+
Instead of the scalar attention weights, PTv1 applies vector attention, where the attention weights are vectors that can modulate the individual feature channels. In SA, the scalar attention is computed by the scaled dot-product between the query and key vectors. In vector attention, a weight encoding function encodes the relation between query and key to a vector. The vector attention [2] is formulated as follows,
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
{ \pmb w } _ { i j } = \omega ( \gamma ( { \pmb q } _ { i } , { \pmb k } _ { j } ) ) , \qquad f _ { i } ^ { \mathrm { a t t n } } = \sum _ { { \pmb x } _ { j } \in \mathcal { M } ( { \pmb p } _ { i } ) } \mathrm { S o f t m a x } ( { \pmb W } _ { i } ) _ { j } \odot { \pmb v } _ { j } ,
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
where $\odot$ is the Hadamard product. $\gamma$ is a relation function (e.g., subtraction). $\omega : \mathbb { R } ^ { c } \mapsto \mathbb { R } ^ { c }$ is a learnable weight encoding (e.g., MLP) that computes the attention vectors to re-weight ${ \pmb v } _ { j }$ by channels before aggregation. Fig. 2 (a) shows a method using vector attention with linear weight encoding.
|
| 69 |
+
|
| 70 |
+
# 3.2 Grouped Vector Attention
|
| 71 |
+
|
| 72 |
+
In vector attention, as the network goes deeper and there are more feature encoding channels, the number of parameters for the weight encoding layer increases drastically. The large parameter size restricts the efficiency and generalization ability of the model. In order to overcome the limitations of vector attention, we introduce the grouped vector attention, as illustrated in Fig. 1 (left).
|
| 73 |
+
|
| 74 |
+
Attention groups. We divide channels of the value vector $v \in \mathbb { R } ^ { c }$ evenly into $g$ groups $( 1 \leq g \leq c )$ The weight encoding layer outputs a grouped attention vector with $g$ channels instead of $c$ channels. Channels of $\pmb { v }$ within the same attention group share the same scalar attention weight from the grouped attention vector. Mathematically,
|
| 75 |
+
|
| 76 |
+
$$
|
| 77 |
+
{ \pmb w } _ { i j } = \omega ( \gamma ( { \pmb q } _ { i } , { \pmb k } _ { j } ) ) , \qquad { \pmb f } _ { i } ^ { a t t n } = \sum _ { x _ { j } } ^ { \mathcal { M } ( p _ { i } ) } \sum _ { l = 1 } ^ { g } \sum _ { m = 1 } ^ { c / g } { \mathrm { S o f t m a x } ( { \pmb W } _ { i } ) _ { j l } } v _ { j } ^ { l c / g + m } ,
|
| 78 |
+
$$
|
| 79 |
+
|
| 80 |
+
where $\gamma$ is the relation function and $\omega : \mathbb { R } ^ { c } \mapsto \mathbb { R } ^ { g }$ is the learnable grouped weight encoding defined in the next paragraph. The second equation in Eq. 3 is the grouped vector aggregation. Fig. 2 (a) presents a vanilla GVA implemented by a fully connected weight encoding, the number of the grouped weight encoding function parameters reduced compared with the vector attention (Fig. 2 (b)), leading to a more powerful and efficient model.
|
| 81 |
+
|
| 82 |
+

|
| 83 |
+
Figure 2: Comparison of various weight encoding functions. Each square represents a scalar, and each row of them represents a vector. The three rows represent relation vector, weight vector, and value vector from top to bottom. The attention groups are separated by dash lines. For demonstration, we assume the feature dimension is 4 and the number of attention groups (applicable to b, c, d) is 2. Lines with different colors refer to different operations, blue lines represent learnable parameters act on input relation scalar, while red lines represent multiply by the input relation scalar. Orange lines identify which value feature is affected by the input scalar weight.
|
| 84 |
+
|
| 85 |
+
GVA is a generalized formulation of VA and MSA. Our GVA degenerates to vector attention (VA) when $g = c$ , and it degenerates to multi-head self-attention (MSA) if $\omega$ in Eq. 3 is defined as follows,
|
| 86 |
+
|
| 87 |
+
$$
|
| 88 |
+
\omega ( r ) = r \underbrace { \left[ \begin{array} { c c c c } { \mathbf { 1 } _ { 1 \times c _ { g } } } & { \mathbf { 0 } _ { 1 \times c _ { g } } } & { \cdot \cdot \cdot } & { \mathbf { 0 } _ { 1 \times c _ { g } } } \\ { \mathbf { 0 } _ { 1 \times c _ { g } } } & { \mathbf { 1 } _ { 1 \times c _ { g } } } & { \cdot \cdot \cdot } & { \mathbf { 0 } _ { 1 \times c _ { g } } } \\ { \vdots } & { \vdots } & { \ddots } & { \vdots } \\ { \mathbf { 0 } _ { 1 \times c _ { g } } } & { \mathbf { 0 } _ { 1 \times c _ { g } } } & { \cdot \cdot \cdot } & { \mathbf { 1 } _ { 1 \times c _ { g } } } \end{array} \right] ^ { T } } _ { g \times c _ { g } } \frac { 1 } { \sqrt { c _ { g } } } ,
|
| 89 |
+
$$
|
| 90 |
+
|
| 91 |
+
where $c _ { g } = c / g$ and $r \in \mathbb { R } ^ { 1 \times c }$ .
|
| 92 |
+
|
| 93 |
+
Grouped linear. Inspired by the weight encoding function of MSA, we design the grouped linear layer $\zeta ( r ) : \mathbb { R } ^ { c } \mapsto \mathbb { R } ^ { g }$ where different groups of the input vector are projected with different parameters independently. Grouped linear further reduce the number of parameters in the weight encoding function. Our final adopted grouped weight encoding function is composed of the grouped linear layer, normalization layer, activation layer, and a fully connected layer to allow inter-group information exchange. Mathematically,
|
| 94 |
+
|
| 95 |
+
$$
|
| 96 |
+
\zeta ( r ) = r \underbrace { \left[ \begin{array} { c c c c c } { p _ { 1 } } & { \mathbf { 0 } _ { 1 \times c _ { g } } } & { \cdot \cdot \cdot } & { \mathbf { 0 } _ { 1 \times c _ { g } } } \\ { \mathbf { 0 } _ { 1 \times c _ { g } } } & { p _ { 2 } } & { \cdot \cdot \cdot } & { \mathbf { 0 } _ { 1 \times c _ { g } } } \\ { \vdots } & { \vdots } & { \ddots } & { \vdots } \\ { \underbrace { \mathbf { 0 } _ { 1 \times c _ { g } } } } & { \mathbf { 0 } _ { 1 \times c _ { g } } } & { \cdot \cdot \cdot } & { p _ { g } } \end{array} \right] } _ { \mathcal { J } \times \mathcal { C } _ { g } } ,
|
| 97 |
+
$$
|
| 98 |
+
|
| 99 |
+
where $c _ { g } = c / g , p _ { 1 } , \ldots , p _ { g } \in \mathbb { R } _ { g } ^ { c }$ are learnable parameters, and $\circ$ represents function composition.
|
| 100 |
+
|
| 101 |
+
# 3.3 Position Encoding Multipler
|
| 102 |
+
|
| 103 |
+
Different from the discrete, regular-grid pixels in 2D images, points in the 3D point cloud are unevenly distributed in a continuous Euclidean Metric space, making the spatial relationship in 3D point cloud much more complicated than 2D images. In transformers and attention modules, the spatial information is obtained with the position encoding $\delta _ { b i a s } ( \pmb { p } _ { i } - \pmb { p } _ { j } )$ added to the relation vector $\gamma ( q _ { i } , k _ { j } )$ as a bias.
|
| 104 |
+
|
| 105 |
+
Due to the generalization limitation of vector attention in PTv1 mentioned in Sec. 3.2, adding more position encoding capacity to vector attention will not help to improve the performance. In PTv2, the grouped vector attention has an effect of reducing overfitting and enhancing generalization. With grouped vector attention restricting the capacity of the attention mechanism, we strengthen the position encoding with an additional multiplier $\delta _ { m u l } ( \pmb { p } _ { i } - \pmb { p } _ { j } )$ to the relation vector, which focuses on learning complex point cloud positional relations. As shown in Fig. 1 (left), our improved position
|
| 106 |
+
|
| 107 |
+
encoding is as follows,
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
\pmb { w } _ { i j } = \omega \big ( \delta _ { m u l } \big ( \pmb { p } _ { i } - \pmb { p } _ { j } \big ) \odot \gamma \big ( \pmb { q } _ { i } , \pmb { k } _ { j } \big ) + \delta _ { b i a s } \big ( \pmb { p } _ { i } - \pmb { p } _ { j } \big ) \big ) ,
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
where $\odot$ is the Hadamard product. $\delta _ { m u l } , \delta _ { b i a s } : \mathbb { R } ^ { d } \mapsto \mathbb { R } ^ { d }$ are two MLP position encoding functions, which take relative positions as input. Position encoding multiplier compliments group vector attention to achieve a good balance of network capacity.
|
| 114 |
+
|
| 115 |
+
# 3.4 Partition-based Pooling
|
| 116 |
+
|
| 117 |
+
Traditional sampling-based pooling procedures adopted by other point-based methods use a combination of sampling and query methods. In the sampling stage, farthest point sampling [4] or grid sampling [5] is used to sample points reserved for the following encoding stage. For each sampled point, a neighbor query is performed to aggregate information from the neighboring points. In these sampling-based pooling procedures, the query sets of points are not spatially-aligned since the information density and overlap among each query set are not controllable. To address the problem, we propose a more efficient and effective partition-based pooling approach, as shown in Fig. 1.
|
| 118 |
+
|
| 119 |
+
Pooling. Given a point set $\mathcal { M } = ( \mathcal { P } , \mathcal { F } )$ , we partition $\mathcal { M }$ into subsets $[ \mathcal { M } _ { 1 } , \mathcal { M } _ { 2 } , . . . , \mathcal { M } _ { n ^ { \prime } } ]$ by separating the space into non-overlapping partitions. We fusion each subset of points $\mathcal { M } _ { i } = ( \mathcal { P } _ { i } , \mathcal { F } _ { i } )$ from a single partition as follows,
|
| 120 |
+
|
| 121 |
+
$$
|
| 122 |
+
\begin{array} { r } { \pmb { f } _ { i } ^ { \prime } = \pmb { \mathrm { M a x P o o l } } ( \{ f _ { j } U \mid f _ { j } \in \mathscr { F } _ { i } \} ) , \qquad \pmb { p } _ { i } ^ { \prime } = \pmb { \mathrm { M e a n P o o l } } ( \{ p _ { j } \mid p _ { j } \in \mathscr { P } _ { i } \} ) , } \end{array}
|
| 123 |
+
$$
|
| 124 |
+
|
| 125 |
+
where $( p _ { i } ^ { \prime } , f _ { i } ^ { \prime } )$ is the position and features of pooling point aggregated form subset $\mathcal { M } _ { i }$ , and $U \in$ $\mathbb { R } ^ { c \times c ^ { \prime } }$ is the linear projection. Collecting the pooling points from $n ^ { \prime }$ subsets gives us the point set $\mathcal { M } ^ { \prime } = \{ p _ { i } ^ { \prime } , f _ { i } ^ { \prime } \} _ { i = 1 } ^ { n ^ { \prime } }$ for the next stage of encoding. In our implementation, we use uniform grids to partition the point cloud space, and thus our partition-based pooling is also called grid pooling.
|
| 126 |
+
|
| 127 |
+
Unpooling. The common practice of unpooling by interpolation is also applicable to partition-based pooling. Here we introduce a more straightforward and efficient unpooling method. To unpool the fused point set $\mathcal { M } ^ { \prime }$ back to $\mathcal { M }$ , the point locations in $\mathcal { M }$ are record from the pooling process, and we only need to obtain the features for each point in $\mathcal { M }$ . With the help of the grid-based partitioning $[ \mathcal { M } _ { 1 } , \mathcal { M } _ { 2 } , . . . , \mathcal { M } _ { n ^ { \prime } } ]$ during the pooling stage, we can map point feature to all points from the same subset,
|
| 128 |
+
|
| 129 |
+
$$
|
| 130 |
+
\pmb { f } _ { i } ^ { u p } = \pmb { f } _ { j } ^ { \prime } , \qquad \mathrm { i f } \left( \pmb { p } _ { i } , \pmb { f } _ { i } \right) \in \mathcal { M } _ { j } .
|
| 131 |
+
$$
|
| 132 |
+
|
| 133 |
+
# 3.5 Network Architecture
|
| 134 |
+
|
| 135 |
+
Backbone structure. Following previous works [18, 1], we adopt the U-Net architecture with skip connections. There are four stages of encoders and decoders with block depths [2, 2, 6, 2] and [1, 1, 1, 1], respectively. The grid size multipliers for the four stages are $[ \mathrm { x } 3 . 0 , \mathrm { x } 2 . 5 , \mathrm { x } 2 . 5 , \mathrm { x } 2 . 5 ]$ , representing the expansion ratio over the previous pooling stage. The attention is conducted in a local neighborhood, described in “neighborhood attention” in Sec. 3.1. In Sec. 4.3 we compare the neighborhood attention with shift-grid attention.
|
| 136 |
+
|
| 137 |
+
The initial feature dimension is 48, and we first embed the input channels to this number with a basic block with attention groups of 6. Then, we double this feature dimension and attention groups each time entering the next encoding stage. For the four encoding stages, the feature dimensions are [96, 192, 384, 384], and the corresponding attention groups are [12, 24, 48, 48].
|
| 138 |
+
|
| 139 |
+
Output head. For point cloud semantic segmentation, we apply an MLP to map point features produced by the backbone to the final logits for each point in the input point set. For point cloud classification, we apply global average pooling over the point features produced by the encoding stages to obtain a global feature vector, followed by an MLP classifier for prediction.
|
| 140 |
+
|
| 141 |
+
# 4 Experiments
|
| 142 |
+
|
| 143 |
+
To validate the effectiveness of the proposed method, we conduct experimental evaluations on ScanNet v2 [44] and S3DIS [45] for semantic segmentation, and ModelNet40 [46] for shape classification. Implementation details are available in the appendix.
|
| 144 |
+
|
| 145 |
+
Table 1: Semantic segmentation on ScanNet v2.
|
| 146 |
+
|
| 147 |
+
<table><tr><td>Method PointNet++ [4]</td><td>Input</td><td>Val</td><td>Test</td></tr><tr><td>3DMV[26] PanopticFusion [27] PointCNN [28] PointConv [29] JointPointBased [30] PointASNL [31] SegGCN [32] RandLA-Net [33] KPConv [5] JSENet [34] FusionNet [35] SparseConvNet [17]</td><td>point point point point point point point point point point point point voxel</td><td>53.5 1 - = 61.0 69.2 63.5 1 = 69.2 - =</td><td>55.7 48.4 52.9 45.8 66.6 63.4 66.6 58.9 64.5 68.6 69.9 68.8</td></tr><tr><td>MinkUNet [18] PTv1[1] PTv2 (ours)</td><td>voxel point point</td><td>69.3 72.2 70.6 75.4</td><td>72.5 73.6 = 75.2</td></tr></table>
|
| 148 |
+
|
| 149 |
+
Table 2: Semantic segmentation on S3DIS Area 5.
|
| 150 |
+
|
| 151 |
+
<table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>Input</td><td rowspan=1 colspan=1>OA mAcc mIoU</td></tr><tr><td rowspan=2 colspan=1>PointNet [19]SegCloud [36]</td><td rowspan=1 colspan=1>point</td><td rowspan=1 colspan=1>1 49.0 41.1</td></tr><tr><td rowspan=1 colspan=1>point</td><td rowspan=1 colspan=1>- 57.4 48.9</td></tr><tr><td rowspan=1 colspan=1>TanConv [37]</td><td rowspan=1 colspan=1>point</td><td rowspan=1 colspan=1>1 62.2 52.6</td></tr><tr><td rowspan=1 colspan=1>PointCNN [28]</td><td rowspan=1 colspan=1>point</td><td rowspan=1 colspan=1>85.9 63.9 57.3</td></tr><tr><td rowspan=1 colspan=1>PointWeb [20]</td><td rowspan=1 colspan=1>point</td><td rowspan=1 colspan=1>87.0 66.6 60.3</td></tr><tr><td rowspan=1 colspan=1>HPEIN [38]</td><td rowspan=1 colspan=1>point</td><td rowspan=1 colspan=1>87.2 68.3 61.9</td></tr><tr><td rowspan=1 colspan=1>GACNet [39]</td><td rowspan=1 colspan=1>point</td><td rowspan=1 colspan=1>87.8 1 62.9</td></tr><tr><td rowspan=1 colspan=1>PAT [40]</td><td rowspan=1 colspan=1>point</td><td rowspan=1 colspan=1>1 70.8 60.1</td></tr><tr><td rowspan=1 colspan=1>ParamConv [41]</td><td rowspan=1 colspan=1>point</td><td rowspan=1 colspan=1>= 67.0 58.3</td></tr><tr><td rowspan=1 colspan=1>SPGraph [42]</td><td rowspan=1 colspan=1>point</td><td rowspan=1 colspan=1>86.4 66.5 58.0</td></tr><tr><td rowspan=1 colspan=1>SegGCN [32]</td><td rowspan=1 colspan=1>point</td><td rowspan=1 colspan=1>88.2 70.4 63.6</td></tr><tr><td rowspan=1 colspan=1>MinkUNet [18]</td><td rowspan=1 colspan=1>voxel</td><td rowspan=1 colspan=1>1 71.7 65.4</td></tr><tr><td rowspan=2 colspan=1>PAConv [43]KPConv [5]</td><td rowspan=1 colspan=1>point</td><td rowspan=1 colspan=1>1 - 66.6</td></tr><tr><td rowspan=1 colspan=1>point</td><td rowspan=1 colspan=1>1 72.8 67.1</td></tr><tr><td rowspan=2 colspan=1>PTv1[1]PTv2 (ours)</td><td rowspan=1 colspan=1>point</td><td rowspan=1 colspan=1>90.8 76.5 70.4</td></tr><tr><td rowspan=1 colspan=1>point</td><td rowspan=1 colspan=1>91.1 77.9 71.6</td></tr></table>
|
| 152 |
+
|
| 153 |
+
# 4.1 Semantic Segmentation
|
| 154 |
+
|
| 155 |
+
Data and metric. For semantic segmentation, we experiment on ScanNet v2 [44] and S3DIS [45]. The ScanNet v2 dataset contains 1,513 room scans reconstructed from RGB-D frames. The dataset is divided into 1,201 scenes for training and 312 for validation. Point clouds for the model input are sampled from vertices of reconstructed meshes, and each sampled point is assigned a semantic label from 20 categories (wall, floor, table, etc.). The S3DIS dataset for semantic scene parsing consists of 271 rooms in six areas from three different buildings. Following a common protocol [36, 4, 1], area 5 is withheld during training and used for testing. Different from ScanNet v2, points of S3DIS are densely sampled on the mesh surfaces and annotated into 13 categories. Following a standard protocol [4], we use mean class-wise intersection over union (mIoU) as the evaluation metric for validation and test set of ScanNet v2. And we use mean class-wise intersection over union (mIoU), mean of class-wise accuracy (mAcc), and overall point-wise accuracy (OA) for evaluating performance on S3DIS area5.
|
| 156 |
+
|
| 157 |
+
Performance comparison. Table 1 and Table 2 show the results of our PTv2 model compared with previous methods on ScanNet v2 and S3DIS, respectively. Our PTv2 model outperforms prior methods in all evaluation metrics. Notably, PTv2 significantly outperforms PTv1 [1] by $4 . 8 \%$ mIoU on the ScanNet v2 validation set.
|
| 158 |
+
|
| 159 |
+
Visualization. The qualitative results of point cloud semantic segmentation are shown in Fig. 3 and Fig. 4. Our PTv2 model is able to predict semantic segmentation results that are quite close the ground-truth. It is worth noting that our model can capture the detailed structure information and predict the correct semantics for challenging scenarios. For example, in the S3DIS scenes with chairs, PTv2 is able to cleanly predict the chair legs and armrests.
|
| 160 |
+
|
| 161 |
+
# 4.2 Shape Classification
|
| 162 |
+
|
| 163 |
+
Data and metric. We test our proposed PTv2 model for 3D point cloud classification on ModelNet40 dataset. The ModelNet40 [46] dataset consists of 12,311 CAD models belonging to 40 object categories. 9,843 models are split out for training, and the rest 2,468 models are reserved for testing. Following the common practice in the community, we report the class-average accuracy (mAcc) and overall accuracy (OA) on the test set.
|
| 164 |
+
|
| 165 |
+
Performance comparison. We test our PTv2 model and compare it with previous models on the ModelNet40 dataset for shape classification. Results are shown in Table 3, demonstrating that our proposed PTv2 model achieves state-of-the-art performance on ModelNet40 shape classification.
|
| 166 |
+
|
| 167 |
+

|
| 168 |
+
Figure 3: Visualization of semantic segmentation results on ScanNet v2.
|
| 169 |
+
|
| 170 |
+

|
| 171 |
+
Figure 4: Visualization of semantic segmentation results on S3DIS.
|
| 172 |
+
|
| 173 |
+
# 4.3 Ablation Study
|
| 174 |
+
|
| 175 |
+
We conduct ablation studies to examine the effectiveness of each module in our design. The ablation study results are reported on ScanNet v2 validation set.
|
| 176 |
+
|
| 177 |
+
Attention type. We first investigate the effects of different attention designs. We experiment with two types of local attention introduced in Sec. 3.1, namely shifted-grid attention and neighborhood attention [1]. Then, to validate the effectiveness of our proposed grouped vector attention (denoted as “GVA”), we compare it with the commonly-used multi-head self-attention (denoted as “MSA”). We use the vanilla position encoding in PTv1 [1] and our proposed partition-based pooling scheme in all of the experiments in Table 4. It shows neighborhood attention performs significantly better than shiftedgrid attention, indicating that the neighborhood attention is better suited for point clouds which are non-uniformly distributed. Moreover, our proposed grouped vector attention consistently outperforms the commonly-used multi-head self-attention with both shifted-grid attention and neighborhood attention. So our grouped vector attention is not only more efficient, but also more effective, than multi-head self-attention. The comparison between GVA and MSA indicates the effectiveness of the learnable parameters in the grouped linear layer of the grouped weight encoding in Sec. 3.2.
|
| 178 |
+
|
| 179 |
+
Weight encoding. We study the effects of different weight encoding functions $\omega$ in Table 6. The weight encoding functions are introduced in Sec. 3.1 and Sec. 3.2, and different attention mechanisms adopt different weight encoding functions. We use the vanilla position encoding in PTv1 [1] and our proposed grid pooling scheme in all of the experiments in Table 6. We experimented with the following weight encoding functions: (1) The weight encoding for multi-head scalar attention in Eq. 4, denoted as “MSA”. (2) Weight encoding as a linear layer denoted as “L”. (3) The grouped linear layer, which is $\zeta$ in Eq. 5, denoted as “GL”. (4) The linear layer followed by batch normalization, activation, and another linear layer, denoted as $\cdot \mathrm { ^ { \circ } L + N + A + L } ^ { \mathrm { , \circ } }$ . (5) The grouped linear layer, followed by batch normalization, activation, and a linear layer, denoted as $\scriptstyle \mathbf { \ddot { G L + N + A + L } } ^ { }$ . (5) is also the grouped weight encoding function used for our grouped vector attention, introduced as $\omega$ in Eq. 5. Results in Table 6 demonstrate that our grouped weight encoding function outperforms other compared designs. Specifically, comparing (1), (3) and (5), GL slightly outperforms MSA but adding additional inter-group information exchange combined with proper normalization and activation can boost the performance to be better than MSA. Moreover, the comparison between (5) and (4) and the comparison between (3) and (2) both indicate that our grouped linear layer outperforms the naive linear layer, even though the grouped linear layer has $g$ times fewer parameters and requires less computing than the linear layer.
|
| 180 |
+
|
| 181 |
+
Table 3: Shape classification on ModelNet40.
|
| 182 |
+
|
| 183 |
+
<table><tr><td>Method</td><td>mAcc (%)</td><td>OA (%)</td></tr><tr><td>PointNet [19]</td><td>86.0</td><td>89.2</td></tr><tr><td>PointNet++ [4]</td><td>=</td><td>91.9</td></tr><tr><td>PointCNN[28]</td><td>88.1</td><td>92.5</td></tr><tr><td>PointConv [29]</td><td>-</td><td>92.5</td></tr><tr><td>KPConv [5]</td><td>1</td><td>92.9</td></tr><tr><td>DGCNN [47]</td><td>90.2</td><td>92.9</td></tr><tr><td>RS-CNN [48]</td><td>-</td><td>92.9</td></tr><tr><td>PointASNL [31]</td><td>=</td><td>92.9</td></tr><tr><td>DensePoint [49]</td><td></td><td>93.2</td></tr><tr><td>PosPool [50]</td><td>=</td><td>93.2</td></tr><tr><td>GBNet [51]</td><td>91.0</td><td>93.8</td></tr><tr><td>PCT[21]</td><td></td><td>93.2</td></tr><tr><td>PA-DGC [43]</td><td></td><td>93.9</td></tr><tr><td>CurveNet [52]</td><td>=</td><td>94.2</td></tr><tr><td>PTv1[1]</td><td>90.6</td><td>93.7</td></tr><tr><td>PTv2 (ours)</td><td>91.6</td><td>94.2</td></tr></table>
|
| 184 |
+
|
| 185 |
+
Table 4: Attention type ablation.
|
| 186 |
+
|
| 187 |
+
<table><tr><td>Local Type</td><td>Mechanism Type</td><td>mIoU (%)</td></tr><tr><td rowspan="2">Shifted-Grid</td><td>MSA</td><td>71.6</td></tr><tr><td>GVA</td><td>72.5</td></tr><tr><td rowspan="2">Neighborhood</td><td>MSA</td><td>73.9</td></tr><tr><td>GVA</td><td>75.0</td></tr></table>
|
| 188 |
+
|
| 189 |
+
Table 5: Pooling method ablation.
|
| 190 |
+
|
| 191 |
+
<table><tr><td>Pooling Method</td><td>Pooling Ratio</td><td>Grid Size Multipliers</td><td>mIoU (%)</td></tr><tr><td>FPS</td><td>1/4 1/6</td><td>- -</td><td>74.4 72.9</td></tr><tr><td rowspan="3">Grid</td><td>~1/4</td><td>[x3.0,×2.0,×2.0,×2.0]</td><td>75.2</td></tr><tr><td>~1/4</td><td>[x4.0,×2.0,×2.0,×2.0]</td><td>75.0</td></tr><tr><td>~1/6 ~1/6</td><td>[x3.0,×2.5,×2.5,×2.5] [x4.0,×2.5,×2.5,×2.5]</td><td>75.4 74.7</td></tr></table>
|
| 192 |
+
|
| 193 |
+
Table 6: Weight encoding ablation.
|
| 194 |
+
|
| 195 |
+
<table><tr><td>ID</td><td>Weight encoding</td><td>mIoU (%)</td></tr><tr><td>(1)</td><td>MSA</td><td>73.9</td></tr><tr><td>(2)</td><td>L</td><td>73.8</td></tr><tr><td>(3)</td><td>GL</td><td>74.1</td></tr><tr><td>(4)</td><td>L+N+A+L</td><td>74.7</td></tr><tr><td>(5)</td><td>GL+N+A+L (ours)</td><td>75.0</td></tr></table>
|
| 196 |
+
|
| 197 |
+
Table 7: Module design ablation.
|
| 198 |
+
|
| 199 |
+
<table><tr><td>ID</td><td>GVA</td><td>PE Mul</td><td>Grid Pool</td><td>Map Unpool</td><td>mIoU (%)</td></tr><tr><td>I</td><td></td><td></td><td></td><td></td><td>72.3</td></tr><tr><td>II</td><td></td><td></td><td></td><td></td><td>73.8</td></tr><tr><td>Ⅲ</td><td><<>></td><td>三</td><td></td><td></td><td>74.4</td></tr><tr><td>IV</td><td></td><td></td><td>~</td><td></td><td>74.9</td></tr><tr><td>V</td><td></td><td></td><td></td><td>√</td><td>75.4</td></tr></table>
|
| 200 |
+
|
| 201 |
+
Pooling methods. In Sec. 3.4 we discuss the potential limitations of the sampling-based pooling in PTv1 and propose a new pooling and unpooling scheme based on non-overlapping partitions. We also name a simple and effective grid-based implement of our partition-based pooling as grid pooling. To further examine the superiority of our method, we experiment with different pooling-unpooling schemes in Table 5.
|
| 202 |
+
|
| 203 |
+
For our partition-based pooling implemented by a grid, the base grid size is 0.02 meters, which is identical to the voxelization grid size during data pre-processing. The grid size multipliers are the grid size expansion ratio over the previous pooling stage. For example, $[ \times 4 . 0 , \times 2 . 0 , \times 2 . 0 , \times 2 . 0 ]$ means that the grid sizes are: [0.08, 0.16, 0.32, 0.64] meters, respectively. We choose a relatively large value for initial grid sizes $( \times 3 . 0$ and $\times 4 . 0 \dot s$ ) to provide sufficiently large receptive fields, which is analogous to the common practice in image transformers [6]. For subsequent pooling stages, we observe that $\times 2 . 0$ grid size increase results in an approximate pooling ratio of 4 for the point cloud, while $\times 2 . 5$ grid size increase results in an approximate pooling ratio of 6. We choose the same sampling ratio of 4 and 6 for sampling-based pooling to ensure a fair comparison.
|
| 204 |
+
|
| 205 |
+
The results in Table 5 illustrate that our partition-based pooling achieves higher mIoU than the sampling-based method. For sampling-based pooling with farthest point sampling, the performance decreases significantly when the sampling ratio increases from 4 to 6. However, for our partition-based pooling implemented by grid, we observe that initial grid size and subsequent grid size multipliers do not significantly affect the overall performance, so we can use larger grid sizes to reduce the number of points in each stage to save memory.
|
| 206 |
+
|
| 207 |
+
Module design. We ablate different modules introduced in our PTv2: grouped vector attention (VGA), position encoding multiplier (PE Mul), partition-based pooling implemented by grid (Grid Pool), and partition map unpooling (Map Unpool) and the results are illustrated in Table 7. The model adopts in Experiment I is PTv1 [1], which serves as a baseline result of our design. Benefiting from structural parameter adjustments and better data processing, which are also shared with the rest of the experiments, our baseline result increased from $7 0 . 6 \%$ to $7 2 . 3 \%$ . Experiment $\mathrm { I I }$ to $\mathrm { v }$ add each of our proposed components in turns, gradually increasing our baseline result to $7 5 . 4 \%$ . The increasing mIOU indicates the effectiveness of each component.
|
| 208 |
+
|
| 209 |
+
Table 8: Model performance and amortized latency with different pooling methods.
|
| 210 |
+
|
| 211 |
+
<table><tr><td></td><td colspan="2">FPS-kNN [4]</td><td colspan="2">Grid-kNN [5]</td><td colspan="2">Grid pooling (ours)</td></tr><tr><td>Pooling Rate</td><td>1/4</td><td>1/6</td><td>~1/4</td><td>~1/6</td><td>~1/4</td><td>~1/6</td></tr><tr><td>Time (ms)</td><td>1007</td><td>785</td><td>389</td><td>356</td><td>318</td><td>266</td></tr><tr><td>mIoU (%)</td><td>74.4</td><td>72.9</td><td>74.1</td><td>73.4</td><td>75.2</td><td>75.4</td></tr></table>
|
| 212 |
+
|
| 213 |
+
Table 9: Model parameters and amortized latency of several networks.
|
| 214 |
+
|
| 215 |
+
<table><tr><td></td><td>① PTv1</td><td>② ��� + GVA (L)</td><td>③ ① + GVA (GL)</td><td>④ ① + GVA (GL-N-A-L)</td><td>⑤ ④+GP</td><td>⑥ ⑤+PEM</td></tr><tr><td>Params (M)</td><td>11.4</td><td>9.8</td><td>9.6</td><td>9.6</td><td>9.6</td><td>12.8</td></tr><tr><td>Time (ms)</td><td>1023</td><td>991</td><td>951</td><td>971</td><td>220</td><td>266</td></tr><tr><td>mIoU (%)</td><td>72.3</td><td>73.0</td><td>73.2</td><td>74.2</td><td>75.0</td><td>75.4</td></tr></table>
|
| 216 |
+
|
| 217 |
+
# 4.4 Model Complexity and Latency
|
| 218 |
+
|
| 219 |
+
We further conduct model complexity and latency studies to examine the superior efficiency of several design in our work. We record the amortized forward time for each scan in the ScanNet v2 validation set with batch size 4 on a single TITAN RTX.
|
| 220 |
+
|
| 221 |
+
Pooling methods. Table 8 shows the forward time and mIoU of PTv2 with different pooling methods and pooling ratios. We compare our pooling method with two classical sampling-based pooling methods: FPS-kNN and Grid-kNN. FPS-kNN pooling [4, 1] uses farthest point sampling (FPS) to sample a specified number of points and then query $k$ nearest neighbor points for pooling. We call the pooling method in Strided KPConv [5] Grid-kNN pooling, as it uses a uniform grid to sample points and then applies the kNN method to index neighbors. This leads to uncontrollable overlaps of the pooling receptive fields. As shown in the table, our grid pooling method is not only faster but also achieves higher mIoUs.
|
| 222 |
+
|
| 223 |
+
Module design. Table 9 summarizes comparisons of model complexity, time consumption, and evaluation performances on ScanNet v2 validation set. Meanwhile, we drop the first batch of forwarding time for GPU preparation. In Table 9, GVA refers to grouped vector attention. L refers to grouped weight encoding implemented by a single Linear. GL refers to grouped weight encoding implemented by a Grouped Linear. GL-N-A-L refers to the grouped linear layer, followed by batch normalization, activation, and a linear layer as grouped weight encoding function. GP refers to partition-based pooling implemented by grid. PEM refers to the position encoding multiplier. To ensure fair comparison, PTv1 is set to be the same depth and feature dimensions as our model architecture of PTv2. By comparing experiment $\textcircled{1}$ and $\textcircled{2}$ , we can study the effect of GVA. The same spirit goes on for experiment $\textcircled{3}$ , $\textcircled{4}$ , and $\textcircled{5}$ , where each experiments adds one additional module, so that we can study the effect of the added module respectively.
|
| 224 |
+
|
| 225 |
+
Comparing experiments $\textcircled{1}$ , $\textcircled{2}$ , $\textcircled{3}$ , and $\textcircled{4}$ , the introduction of grouped vector attention (GVA) with grouped weight encoding dramatically improves the model performance and slightly reduces execution time. The comparison between $\textcircled{4}$ and $\textcircled{5}$ indicates that the grid pooling strategy can significantly speed up the network and further enhance the generalization ability of our model. Position encoding multiplier is the only design that increases the number of model parameters, but experiment $\textcircled{6}$ demonstrates its effectiveness in improving performance. Meanwhile, our model is still lightweight compared to voxel-based backbones, such as MinkUNet42 [18] with 37.9M parameters.
|
| 226 |
+
|
| 227 |
+
# 5 Conclusion
|
| 228 |
+
|
| 229 |
+
We propose Point Transformer V2 (PTv2), a powerful and efficient transformer-based backbone for 3D point cloud understanding. Our work makes several non-trivial improvements upon Point Transformer V1 [1], including the grouped vector attention, improved position encoding, and partitionbased pooling. Our PTv2 model achieves state-of-the-art performance on point cloud classification and semantic segmentation benchmarks.
|
| 230 |
+
|
| 231 |
+
# Acknowledgements
|
| 232 |
+
|
| 233 |
+
This work is supported in part by HKU Startup Fund and HKU Seed Fund for Basic Research. We also appreciate the supporting of computing resources by SmartMore Corporation.
|
| 234 |
+
|
| 235 |
+
References [1] Hengshuang Zhao, Li Jiang, Jiaya Jia, Philip Torr, and Vladlen Koltun. Point transformer. In ICCV, 2021.
|
| 236 |
+
1, 2, 3, 6, 7, 8, 9, 10, 14, 15, 16 [2] Hengshuang Zhao, Jiaya Jia, and Vladlen Koltun. Exploring self-attention for image recognition. In CVPR,
|
| 237 |
+
2020. 1, 3, 4 [3] 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. 1, 2, 4 [4] Charles R Qi, Li Yi, Hao Su, and Leonidas J Guibas. Pointnet++: Deep hierarchical feature learning on point sets in a metric space. In NeurIPS, 2017. 2, 6, 7, 9, 10, 15, 16 [5] Hugues Thomas, Charles R Qi, Jean-Emmanuel Deschaud, Beatriz Marcotegui, François Goulette, and Leonidas J Guibas. Kpconv: Flexible and deformable convolution for point clouds. In ICCV, 2019. 2, 6, 7,
|
| 238 |
+
9, 10, 15, 16 [6] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. ICLR, 2021.
|
| 239 |
+
2, 4, 9 [7] Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin transformer: Hierarchical vision transformer using shifted windows. ICCV, 2021. 2, 4 [8] Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. In ICCV, 2021. 2 [9] Xiaoyi Dong, Jianmin Bao, Dongdong Chen, Weiming Zhang, Nenghai Yu, Lu Yuan, Dong Chen, and Baining Guo. Cswin transformer: A general vision transformer backbone with cross-shaped windows. arXiv:2107.00652, 2021. 2 [10] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In ECCV, 2020. 2 [11] Hang Su, Subhransu Maji, Evangelos Kalogerakis, and Erik G. Learned-Miller. Multi-view convolutional neural networks for 3d shape recognition. In ICCV, 2015. 2 [12] Bo Li, Tianlei Zhang, and Tian Xia. Vehicle detection from 3d lidar using fully convolutional network. In RSS, 2016. 2 [13] Xiaozhi Chen, Huimin Ma, Ji Wan, Bo Li, and Tian Xia. Multi-view 3d object detection network for autonomous driving. In CVPR, 2017. 2 [14] Alex H Lang, Sourabh Vora, Holger Caesar, Lubing Zhou, Jiong Yang, and Oscar Beijbom. Pointpillars: Fast encoders for object detection from point clouds. In CVPR, 2019. 2 [15] Daniel Maturana and Sebastian Scherer. Voxnet: A 3d convolutional neural network for real-time object recognition. In IROS, 2015. 2 [16] Shuran Song, Fisher Yu, Andy Zeng, Angel X Chang, Manolis Savva, and Thomas Funkhouser. Semantic scene completion from a single depth image. In CVPR, 2017. 2 [17] Benjamin Graham, Martin Engelcke, and Laurens van der Maaten. 3d semantic segmentation with submanifold sparse convolutional networks. In CVPR, 2018. 2, 7 [18] Christopher Choy, JunYoung Gwak, and Silvio Savarese. 4d spatio-temporal convnets: Minkowski convolutional neural networks. In CVPR, 2019. 2, 6, 7, 10 [19] Charles R Qi, Hao Su, Kaichun Mo, and Leonidas J Guibas. Pointnet: Deep learning on point sets for 3d classification and segmentation. In CVPR, 2017. 2, 7, 9 [20] Hengshuang Zhao, Li Jiang, Chi-Wing Fu, and Jiaya Jia. Pointweb: Enhancing local neighborhood features for point cloud processing. In CVPR, 2019. 2, 7 [21] 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, 2021. 2, 4, 9
|
| 240 |
+
[22] Bowen Cheng, Alexander G. Schwing, and Alexander Kirillov. Per-pixel classification is not all you need for semantic segmentation. In NeurIPS, 2021. 4
|
| 241 |
+
[23] Bowen Cheng, Ishan Misra, Alexander G. Schwing, Alexander Kirillov, and Rohit Girdhar. Maskedattention mask transformer for universal image segmentation. In CVPR, 2022. 4
|
| 242 |
+
[24] Zhenda Xie, Zheng Zhang, Yue Cao, Yutong Lin, Jianmin Bao, Zhuliang Yao, Qi Dai, and Han Hu. Simmim: A simple framework for masked image modeling. In CVPR, 2022. 4
|
| 243 |
+
[25] Hao Zhang, Feng Li, Shilong Liu, Lei Zhang, Hang Su, Jun Zhu, Lionel M. Ni, and Heung-Yeung Shum. Dino: Detr with improved denoising anchor boxes for end-to-end object detection. arXiv preprint arXiv:2203.03605, 2022. 4
|
| 244 |
+
[26] Angela Dai and Matthias Nießner. 3dmv: Joint 3d-multi-view prediction for 3d semantic scene segmentation. In ECCV, 2018. 7
|
| 245 |
+
[27] Gaku Narita, Takashi Seno, Tomoya Ishikawa, and Yohsuke Kaji. Panopticfusion: Online volumetric semantic mapping at the level of stuff and things. In IROS, 2019. 7
|
| 246 |
+
[28] Yangyan Li, Rui Bu, Mingchao Sun, Wei Wu, Xinhan Di, and Baoquan Chen. Pointcnn: Convolution on x-transformed points. NeurIPS, 2018. 7, 9
|
| 247 |
+
[29] Wenxuan Wu, Zhongang Qi, and Li Fuxin. Pointconv: Deep convolutional networks on 3d point clouds. In CVPR, 2019. 7, 9
|
| 248 |
+
[30] Hung-Yueh Chiang, Yen-Liang Lin, Yueh-Cheng Liu, and Winston H Hsu. A unified point-based framework for 3d segmentation. In 3DV, 2019. 7
|
| 249 |
+
[31] Xu Yan, Chaoda Zheng, Zhen Li, Sheng Wang, and Shuguang Cui. Pointasnl: Robust point clouds processing using nonlocal neural networks with adaptive sampling. In CVPR, 2020. 7, 9
|
| 250 |
+
[32] Huan Lei, Naveed Akhtar, and Ajmal Mian. Seggcn: Efficient 3d point cloud segmentation with fuzzy spherical kernel. In CVPR, 2020. 7
|
| 251 |
+
[33] Qingyong Hu, Bo Yang, Linhai Xie, Stefano Rosa, Yulan Guo, Zhihua Wang, Niki Trigoni, and Andrew Markham. Randla-net: Efficient semantic segmentation of large-scale point clouds. In CVPR, 2020. 7
|
| 252 |
+
[34] Zeyu Hu, Mingmin Zhen, Xuyang Bai, Hongbo Fu, and Chiew-lan Tai. Jsenet: Joint semantic segmentation and edge detection network for 3d point clouds. In ECCV, 2020. 7
|
| 253 |
+
[35] Feihu Zhang, Jin Fang, Benjamin Wah, and Philip Torr. Deep fusionnet for point cloud semantic segmentation. In ECCV, 2020. 7
|
| 254 |
+
[36] Lyne Tchapmi, Christopher Choy, Iro Armeni, JunYoung Gwak, and Silvio Savarese. Segcloud: Semantic segmentation of 3d point clouds. In 3DV, 2017. 7
|
| 255 |
+
[37] Maxim Tatarchenko, Jaesik Park, Vladlen Koltun, and Qian-Yi Zhou. Tangent convolutions for dense prediction in 3d. In CVPR, 2018. 7
|
| 256 |
+
[38] Li Jiang, Hengshuang Zhao, Shu Liu, Xiaoyong Shen, Chi-Wing Fu, and Jiaya Jia. Hierarchical point-edge interaction network for point cloud semantic segmentation. In ICCV, 2019. 7
|
| 257 |
+
[39] Lei Wang, Yuchun Huang, Yaolin Hou, Shenman Zhang, and Jie Shan. Graph attention convolution for point cloud semantic segmentation. In CVPR, 2019. 7
|
| 258 |
+
[40] Jiancheng Yang, Qiang Zhang, Bingbing Ni, Linguo Li, Jinxian Liu, Mengdie Zhou, and Qi Tian. Modeling point clouds with self-attention and gumbel subset sampling. In CVPR, 2019. 7
|
| 259 |
+
[41] Shenlong Wang, Simon Suo, Wei-Chiu Ma, Andrei Pokrovsky, and Raquel Urtasun. Deep parametric continuous convolutional neural networks. In CVPR, 2018. 7
|
| 260 |
+
[42] Loic Landrieu and Martin Simonovsky. Large-scale point cloud semantic segmentation with superpoint graphs. In CVPR, 2018. 7
|
| 261 |
+
[43] Mutian Xu, Runyu Ding, Hengshuang Zhao, and Xiaojuan Qi. Paconv: Position adaptive convolution with dynamic kernel assembling on point clouds. In CVPR, 2021. 7, 9
|
| 262 |
+
[44] Angela Dai, Angel X. Chang, Manolis Savva, Maciej Halber, Thomas Funkhouser, and Matthias Nießner. Scannet: Richly-annotated 3d reconstructions of indoor scenes. In CVPR, 2017. 6, 7, 14
|
| 263 |
+
[45] Iro Armeni, Ozan Sener, Amir R. Zamir, Helen Jiang, Ioannis Brilakis, Martin Fischer, and Silvio Savarese. 3d semantic parsing of large-scale indoor spaces. In CVPR, 2016. 6, 7, 14
|
| 264 |
+
[46] Zhirong Wu, Shuran Song, Aditya Khosla, Fisher Yu, Linguang Zhang, Xiaoou Tang, and Jianxiong Xiao. 3d shapenets: A deep representation for volumetric shapes. In CVPR, 2015. 6, 7, 14
|
| 265 |
+
[47] Yue Wang, Yongbin Sun, Ziwei Liu, Sanjay E Sarma, Michael M Bronstein, and Justin M Solomon. Dynamic graph cnn for learning on point clouds. TOG, 2019. 9
|
| 266 |
+
[48] Yongcheng Liu, Bin Fan, Shiming Xiang, and Chunhong Pan. Relation-shape convolutional neural network for point cloud analysis. In CVPR, 2019. 9
|
| 267 |
+
[49] Yongcheng Liu, Bin Fan, Gaofeng Meng, Jiwen Lu, Shiming Xiang, and Chunhong Pan. Densepoint: Learning densely contextual representation for efficient point cloud processing. In ICCV, 2019. 9
|
| 268 |
+
[50] Ze Liu, Han Hu, Yue Cao, Zheng Zhang, and Xin Tong. A closer look at local aggregation operators in point cloud analysis. In ECCV, 2020. 9
|
| 269 |
+
[51] Shi Qiu, Saeed Anwar, and Nick Barnes. Geometric back-projection network for point cloud classification. TMM, 2021. 9
|
| 270 |
+
[52] Tiange Xiang, Chaoyi Zhang, Yang Song, Jianhui Yu, and Weidong Cai. Walk in the cloud: Learning curves for point clouds shape analysis. In ICCV, 2021. 9
|
md/dev/Ih2bG6h1r4S/Ih2bG6h1r4S.md
ADDED
|
@@ -0,0 +1,485 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# ATLAS: Universal Function Approximator for Memory Retention
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 Artificial neural networks (ANNs), despite their universal function approximation
|
| 11 |
+
2 capability and practical success, are subject to catastrophic forgetting. Catastrophic
|
| 12 |
+
3 forgetting refers to the abrupt unlearning of a previous task when a new task is
|
| 13 |
+
4 learned. It is an emergent phenomenon that plagues ANNs and hinders continual
|
| 14 |
+
5 learning. Existing universal function approximation theorems for ANNs guarantee
|
| 15 |
+
6 function approximation ability, but seldom touch on the model details and do not
|
| 16 |
+
7 predict catastrophic forgetting. This paper presents a novel universal approximation
|
| 17 |
+
8 theorem for multi-variable functions using only single-variable functions and
|
| 18 |
+
9 exponential functions. Furthermore, we present ATLAS—a novel ANN architecture
|
| 19 |
+
10 based on the exponential approximation theorem and B-splines. It is shown that
|
| 20 |
+
11 ATLAS is a universal function approximator capable of memory retention and,
|
| 21 |
+
12 therefore, continual learning. The memory retention of ATLAS is imperfect,
|
| 22 |
+
13 with some off-target effects during continual learning, but it is well-behaved and
|
| 23 |
+
14 predictable. An efficient implementation of ATLAS is provided. Experiments
|
| 24 |
+
15 are conducted to evaluate both the function approximation and memory retention
|
| 25 |
+
16 capabilities of ATLAS.
|
| 26 |
+
|
| 27 |
+
# 17 1 Introduction
|
| 28 |
+
|
| 29 |
+
18 Catastrophic forgetting [7, 13, 23] is an emergent phenomenon where a machine learning model
|
| 30 |
+
19 such as an artificial neural network (ANN) learns a new task, and the subsequent parameter updates
|
| 31 |
+
20 interfere with the model’s performance on previously learned tasks. Catastrophic forgetting is also
|
| 32 |
+
21 called catastrophic interference [19]. If an ANN cannot effectively learn many tasks, it has limited
|
| 33 |
+
22 utility in the context of continual learning [9, 12]. Catastrophic forgetting is like learning to pick
|
| 34 |
+
23 up a cup, but simultaneously forgetting how to breathe. Even linear functions are susceptible to
|
| 35 |
+
24 catastrophic forgetting, as illustrated in Figure 1
|
| 36 |
+
25 The simple example of a linear regression model being susceptible to catastrophic forgetting might be
|
| 37 |
+
26 due to the non-linearity of the target function, noise, or parameter sharing across the input. Parameter
|
| 38 |
+
27 sharing is avoidable with piece-wise defined functions such as splines [27]. ANNs can be explained
|
| 39 |
+
28 in many ways; a useful analogy is to compare ANNs to very large lookup tables that store information.
|
| 40 |
+
29 Removing and updating values has off-target effects throughout the table or ANN.
|
| 41 |
+
30 Universal function approximation theorems are a cornerstone of machine learning, and prove that
|
| 42 |
+
31 ANNs can approximate any given continuous target function [10, 11, 15] under certain assumptions.
|
| 43 |
+
32 The theorems do not specify how to find an ANN with sufficient performance for problems in
|
| 44 |
+
33 practice. Gradient descent optimisation is the convention for finding/training neural networks, but
|
| 45 |
+
34 other optimisation and learning procedures exist [22]. ATLAS models trained with gradient descent
|
| 46 |
+
35 methods exhibit desirable properties. However, other optimisation techniques like evolutionary
|
| 47 |
+
36 algorithms may not elicit the same properties.
|
| 48 |
+
37 This paper introduces ATLAS—a novel universal function approximator based on B-splines that has
|
| 49 |
+
38 some intrinsic memory retention, even in the absence of other training and regularisation techniques.
|
| 50 |
+
39 ATLAS has well-behaved parameter gradients that are sparse, bounded and orthogonal between
|
| 51 |
+
40 input points that are far enough from each other. The accompanying representation and universal
|
| 52 |
+
41 approximation theorems are also provided.
|
| 53 |
+
|
| 54 |
+

|
| 55 |
+
Figure 1: A linear function is susceptible to catastrophic forgetting.
|
| 56 |
+
|
| 57 |
+
# 42 2 Relevant Studies
|
| 58 |
+
|
| 59 |
+
43 It is conjectured that overlapping representations in ANNs lead to catastrophic forgetting [12].
|
| 60 |
+
44 Catastrophic forgetting occurs when parameters necessary for one task change while training to meet
|
| 61 |
+
45 the objectives of another task [14, 20]. The least desirable strategy to mitigate catastrophic forgetting
|
| 62 |
+
46 is retraining a model over all tasks. Regularisation techniques like elastic weight consolidation (EWC)
|
| 63 |
+
47 have also been employed [14]. Data augmentation approaches such as rehearsal and pseudo-rehearsal
|
| 64 |
+
48 have also been employed [23]. Other ideas from optimal control theory in combination with dynamic
|
| 65 |
+
49 programming have also been applied to counteract catastrophic forgetting, with a cost functional
|
| 66 |
+
50 similar in form to the action integral from physics and Lagrangian mechanics [16].
|
| 67 |
+
51 Orthogonal Gradient Descent (OGD) is a training augmentation or optimisation technique that
|
| 68 |
+
52 modifies the gradient updates of subsequent tasks to be orthogonal to previous tasks [6, 1]. One
|
| 69 |
+
53 can describe data in terms of a distribution defined over the input space, target values, and time (the
|
| 70 |
+
54 order of data or tasks that are presented during training). OGD attempts to make gradient updates
|
| 71 |
+
55 orthogonal to each other over time. ATLAS, in contrast, possesses distal orthogonality, meaning that
|
| 72 |
+
56 if two inputs are far enough from each other in the input space, then corresponding gradient updates
|
| 73 |
+
57 will be orthogonal. A corollary of this is that if the data distribution between tasks shifts in the input
|
| 74 |
+
58 space, then the subsequent gradient updates will tend to be orthogonal. ATLAS does not use external
|
| 75 |
+
59 memory like OGD. Extensions of OGD include PCA-OGD, which compresses gradient updates into
|
| 76 |
+
60 principal components to reduce memory requirements [4]. The Neural Tangent Kernel (NTK) overlap
|
| 77 |
+
61 matrices, as discussed by Doan et al. [4], could be a useful tool for analysing ATLAS models.
|
| 78 |
+
62 The survey by Delange et al. [3] gives an extensive overview of continual learning to address
|
| 79 |
+
63 catastrophic forgetting. ATLAS is a model that implements parameter isolation, because of its use of
|
| 80 |
+
64 piece-wise defined splines. Particularly relevant to ATLAS is the work on scale of initialisation and
|
| 81 |
+
65 extreme memorisation [21]. Increasing the density of basis functions in ATLAS can lead to better
|
| 82 |
+
66 memorisation, and increases the scale of some parameters in ATLAS which may affect generalisation.
|
| 83 |
+
67 Pi-sigma neural networks use nodes that compute products instead of sums [26]. Pi-sigma neural
|
| 84 |
+
68 networks have some similarities with the global structure of ATLAS. B-splines, which form the basis
|
| 85 |
+
69 of ATLAS, have been applied for machine learning [5]. Scardapane et al. [25] investigated trainable
|
| 86 |
+
70 activation functions parameterised by splines. Uniform cubic B-splines have basis functions that are
|
| 87 |
+
71 translates of one another [2]. Uniform cubic B-splines have been tested for memory retention, and
|
| 88 |
+
72 ATLAS is an improvement on existing spline models [27].
|
| 89 |
+
73 B-splines, and by extension ATLAS, can be trained to fit lower frequency components, expanded and
|
| 90 |
+
74 trained again until a network is found with sufficient accuracy and generalisation, similar to other
|
| 91 |
+
75 techniques [17, 18]. It is not necessary to expand the capacity of an ATLAS model to learn new
|
| 92 |
+
76 tasks, as with some other approaches [24]. ATLAS does in practice demonstrate something akin to
|
| 93 |
+
77 "graceful forgetting" as discussed in Golkar et al. [8].
|
| 94 |
+
79 Vector quantities like $\vec { \bf x }$ are clearly indicated with a bar or arrow for legibility. Parameters, inputs,
|
| 95 |
+
80 functions etc. without a bar or arrow are scalar quantities like $S ( x )$ . Some scalar quantities with
|
| 96 |
+
81 indices are the scalar components of a vector like $x _ { j }$ or scalar parameters in the model like $\theta _ { i }$ . The
|
| 97 |
+
82 gradient operator that acts on a scalar function like $\vec { \nabla } _ { \vec { \theta } } A ( \vec { \bf x } )$ yields a vector-valued function $\vec { \nabla } _ { \vec { \theta } } A ( \vec { \bf x } )$
|
| 98 |
+
83 as is typical of multi-variable calculus.
|
| 99 |
+
|
| 100 |
+
# 84 4 Exponential Representation Theorem
|
| 101 |
+
|
| 102 |
+
85 Any continuous multi-variable function on a compact space can be uniformly approximated with
|
| 103 |
+
86 multi-variable polynomials by the Stone-Weierstrass Theorem. Let $\mathcal { T }$ denote an index set of tuples of
|
| 104 |
+
87 natural numbers including zero such that $i _ { j } \in \mathbb { N } ^ { 0 }$ for all $j \in \mathbb N$ with $i = ( i _ { 1 } , . . , i _ { n } ) \in \mathcal { T }$ and $a _ { i } \in \mathbb { R }$ .
|
| 105 |
+
88 Multi-variable polynomials can be represented as:
|
| 106 |
+
|
| 107 |
+
$$
|
| 108 |
+
y ( \vec { \bf x } ) = y ( x _ { 1 } , . . , x _ { n } ) = \sum _ { i \in \mathcal { I } } a _ { i } x _ { 1 } ^ { i _ { 1 } } x _ { 2 } ^ { i _ { 2 } } . . . x _ { n } ^ { i _ { n } } = \sum _ { i \in \mathcal { I } } a _ { i } \Pi _ { j = 1 } ^ { n } x _ { j } ^ { i _ { j } }
|
| 109 |
+
$$
|
| 110 |
+
|
| 111 |
+
89 Each monomial term $a _ { i } \Pi _ { j = 1 } ^ { n } x _ { j } ^ { i _ { j } }$ is a product of single-variable functions in each variable. It is
|
| 112 |
+
90 desirable to rewrite products as sums using exponentials and logarithms.
|
| 113 |
+
|
| 114 |
+
91 Lemma 1. For any $a _ { i } \in \mathbb { R }$ , there exists $\gamma _ { i } > 0$ and $\beta _ { i } > 0$ , such that: $a _ { i } = \gamma _ { i } - \beta _ { i }$
|
| 115 |
+
|
| 116 |
+
92 Theorem 1 (Exponential representation theorem). Any multi-variable polynomial function $y ( \vec { \bf x } )$
|
| 117 |
+
93 of $n$ variables over the positive orthant, can be exactly represented by continuous single-variable
|
| 118 |
+
94 functions $g _ { i , j } ( x _ { j } )$ and $h _ { i , j } ( x _ { j } )$ in the form:
|
| 119 |
+
|
| 120 |
+
$$
|
| 121 |
+
y ( \vec { \bf x } ) = \sum _ { i \in \mathcal { I } } \exp \bigl ( \Sigma _ { j = 1 } ^ { n } g _ { i , j } ( x _ { j } ) \bigr ) - \exp \bigl ( \Sigma _ { j = 1 } ^ { n } h _ { i , j } ( x _ { j } ) \bigr )
|
| 122 |
+
$$
|
| 123 |
+
|
| 124 |
+
Proof. Consider any monomial term 95 $a _ { i } \Pi _ { j = 1 } ^ { n } x _ { j } ^ { i _ { j } }$ with $a _ { i } \in \mathbb { R }$ , then by Lemma 1 there exist strictly 96 positive numbers $\gamma _ { i } > 0$ and $\beta _ { i } > 0$ , such that:
|
| 125 |
+
|
| 126 |
+
$$
|
| 127 |
+
\begin{array} { r l } & { a _ { i } \Pi _ { j = 1 } ^ { n } x _ { j } ^ { i _ { j } } = \gamma _ { i } \Pi _ { j = 1 } ^ { n } x _ { j } ^ { i _ { j } } - \beta _ { i } \Pi _ { j = 1 } ^ { n } x _ { j } ^ { i _ { j } } } \\ & { \phantom { a a a } = \exp \Bigl ( \log \Bigl ( \gamma _ { i } \Pi _ { j = 1 } ^ { n } x _ { j } ^ { i _ { j } } \Bigr ) \Bigr ) - \exp \Bigl ( \log \Bigl ( \beta _ { i } \Pi _ { j = 1 } ^ { n } x _ { j } ^ { i _ { j } } \Bigr ) \Bigr ) } \\ & { \phantom { a a a a } = \exp \Bigl ( \log ( \gamma _ { i } ) + \Sigma _ { j = 1 } ^ { n } \log \Bigl ( x _ { j } ^ { i _ { j } } \Bigr ) \Bigr ) - \exp \Bigl ( \log ( \beta _ { i } ) + \Sigma _ { j = 1 } ^ { n } \log \Bigl ( x _ { j } ^ { i _ { j } } \Bigr ) \Bigr ) } \end{array}
|
| 128 |
+
$$
|
| 129 |
+
|
| 130 |
+
97 The argument of each exponential function is a sum of single-variable functions and constants.
|
| 131 |
+
98 Without loss of generality, a set of single-variable functions can be defined such that:
|
| 132 |
+
|
| 133 |
+
$$
|
| 134 |
+
a _ { i } \Pi _ { j = 1 } ^ { n } x _ { j } ^ { i _ { j } } = \exp \bigl ( \Sigma _ { j = 1 } ^ { n } g _ { i , j } ( x _ { j } ) \bigr ) - \exp \bigl ( \Sigma _ { j = 1 } ^ { n } h _ { i , j } ( x _ { j } ) \bigr )
|
| 135 |
+
$$
|
| 136 |
+
|
| 137 |
+
Since this holds for any 99 $a _ { i } \Pi _ { j = 1 } ^ { n } x _ { j } ^ { i _ { j } }$ and all $i \in \mathcal { T }$ , it follows that:
|
| 138 |
+
|
| 139 |
+
$$
|
| 140 |
+
y ( \vec { \bf x } ) = \sum _ { i \in \mathcal { I } } \exp \bigl ( \Sigma _ { j = 1 } ^ { n } g _ { i , j } ( x _ { j } ) \bigr ) - \exp \bigl ( \Sigma _ { j = 1 } ^ { n } h _ { i , j } ( x _ { j } ) \bigr )
|
| 141 |
+
$$
|
| 142 |
+
|
| 143 |
+
101 This result is fundamental to the paper. Since every continuous function can be approximated with
|
| 144 |
+
102 multi-variable polynomials, it follows that every continuous function can be approximated with
|
| 145 |
+
103 positive and negative exponential functions. Single-variable function approximators are pivotal and
|
| 146 |
+
104 must be reconsidered. Universal function approximation can also be proven with the sub-algebra
|
| 147 |
+
105 formulation of the Stone-Weierstrass theorem, but it’s not as delightful and simple as the first
|
| 148 |
+
106 constructive proof given above.
|
| 149 |
+
108 Splines are piece-wise defined single-variable functions over some interval. Each sub-interval of a
|
| 150 |
+
109 spline is most often locally given by a low degree polynomial, even though the global structure is not
|
| 151 |
+
110 a low degree polynomial. B-splines are polynomial splines that are defined in a way that resembles
|
| 152 |
+
111 other basis function formulations [2]. Each single-variable function in ATLAS is approximated
|
| 153 |
+
112 with uniform cubic B-spline basis functions, shown in Figure 2. B-splines can approximate any
|
| 154 |
+
113 single-variable function, similar to using the Fourier basis. With uniform B-splines, each basis
|
| 155 |
+
114 function is scaled so that the unit interval is uniformly partitioned, as in Figure 2.
|
| 156 |
+
|
| 157 |
+

|
| 158 |
+
Figure 2: If uniformly spaced B-splines are used, then each basis function has the same shape. This makes it possible to use the same activation function by scaling and translating the inputs. This is also true for different densities of uniform cubic B-splines.
|
| 159 |
+
|
| 160 |
+
115 The activation function to implement B-splines is given by:
|
| 161 |
+
|
| 162 |
+
$$
|
| 163 |
+
S ( x ) = \left\{ \begin{array} { l l } { \frac { 1 } { 6 } x ^ { 3 } } & { 0 \leq x < 1 } \\ { \frac { 1 } { 6 } \left[ - 3 ( x - 1 ) ^ { 3 } + 3 ( x - 1 ) ^ { 2 } + 3 ( x - 1 ) + 1 \right] } & { 1 \leq x < 2 } \\ { \frac { 1 } { 6 } \left[ 3 ( x - 2 ) ^ { 3 } - 6 ( x - 2 ) ^ { 2 } + 4 \right] } & { 2 \leq x < 3 } \\ { \frac { 1 } { 6 } ( 4 - x ) ^ { 3 } } & { 3 \leq x < 4 } \\ { 0 } & { o t h e r w i s e } \end{array} \right.
|
| 164 |
+
$$
|
| 165 |
+
|
| 166 |
+
116 The choice was made to use uniform cubic B-splines due to their excellent performance and robustness
|
| 167 |
+
117 to catastrophic forgetting, illustrated in Figure 3. Using uniform B-splines instead of arbitrary sub
|
| 168 |
+
118 interval partitions (also called knots in literature) makes optimisation easier. Optimising partitions is
|
| 169 |
+
119 non-linear, but optimising only coefficient (also called control points) is linear and thus convex.
|
| 170 |
+
120 Each basis function is multiplied by a parameter and summed together. The total number of basis
|
| 171 |
+
121 functions is typically fixed. Cubic B-splines are $3 ^ { \mathrm { r d } }$ order polynomials, and thus require a minimum
|
| 172 |
+
122 of $3 + 1 = 4$ control points or basis functions.
|
| 173 |
+
123 Instead of considering arbitrary densities of uniform cubic B-splines, we look at powers of two times
|
| 174 |
+
124 the minimum number of basis functions, called $\rho$ -density B-spline functions.
|
| 175 |
+
|
| 176 |
+

|
| 177 |
+
Figure 3: Single-variable function
|
| 178 |
+
|
| 179 |
+
125 Definition 1 ( $\rho$ -density B-spline function). A $\rho$ -density B-spline function is a uniform cubic B-spline function with 126 $2 ^ { \rho + 2 }$ basis functions:
|
| 180 |
+
|
| 181 |
+
$$
|
| 182 |
+
f ( x ) = \sum _ { i = 1 } ^ { 2 ^ { { \rho } + 2 } } { { \theta } _ { i } S _ { i } ( x ) } = \sum _ { i = 1 } ^ { 2 ^ { { \rho } + 2 } } { { \theta } _ { i } S ( w _ { i } x + b _ { i } ) } = \sum _ { i = 1 } ^ { 2 ^ { { \rho } + 2 } } { { \theta } _ { i } S ( ( 2 ^ { { \rho } + 2 } - 3 ) x + 4 - i ) }
|
| 183 |
+
$$
|
| 184 |
+
|
| 185 |
+
127 Consider the problem of expanding a single-variable function approximator with more basis functions
|
| 186 |
+
128 to increase its expressive power. Using the Fourier basis makes it trivially easy by adding higher
|
| 187 |
+
129 frequency sines and cosines with coefficients initialised to zero. It is trickier to achieve something
|
| 188 |
+
130 similar with uniform cubic B-splines. There are algorithms for creating new splines from existing
|
| 189 |
+
131 splines with knot insertion, but the intermediate steps result in non-uniform knots and splines. A
|
| 190 |
+
132 simple and practical compromise that we propose is to use mixtures of different $\rho$ -density B-spline
|
| 191 |
+
133 functions, as illustrated in Figure 2.
|
| 192 |
+
134 Definition 2 (mixed-density B-spline function). A mixed-density B-spline function is a single
|
| 193 |
+
135 variable function approximator that is obtained by summing together different $\rho$ -density B-spline
|
| 194 |
+
136 functions. Only the maximum $\rho$ -density $\mathbf { B }$ -spline function has trainable parameters, the others are
|
| 195 |
+
137 constant. Mixed-density B-spline functions are of the form:
|
| 196 |
+
|
| 197 |
+
$$
|
| 198 |
+
f ( x ) = \sum _ { \rho = 0 } ^ { r } \sum _ { i = 1 } ^ { 2 ^ { { \rho } + 2 } } \theta _ { \rho , i } S _ { \rho , i } ( x )
|
| 199 |
+
$$
|
| 200 |
+
|
| 201 |
+
138 Only the maximum $r = \rho$ -density B-spline has trainable coefficients. All lower density $r > \rho$ -
|
| 202 |
+
139 density B-spline have frozen and constant coefficients. The maximum $r = \rho$ -density B-spline has
|
| 203 |
+
140 trainable coefficients with gradient updates that are orthogonal if the distance between two inputs is
|
| 204 |
+
141 large enough.
|
| 205 |
+
142 Similar to increasing the expressiveness of a Fourier basis function approximator by adding higher
|
| 206 |
+
143 frequency terms, one can add larger density cubic B-spline functions. Analytically, we can initialise
|
| 207 |
+
144 all the new scalar parameters $\theta _ { r + 1 , i } = 0 , \forall i \in \mathbf { N }$ such that:
|
| 208 |
+
|
| 209 |
+
$$
|
| 210 |
+
f ( x ) = \sum _ { \rho = 0 } ^ { r } \sum _ { i = 1 } ^ { 2 ^ { { \rho } + 2 } } { \theta _ { \rho , i } } { S _ { \rho , i } } ( x ) = \sum _ { \rho = 0 } ^ { r + 1 } \sum _ { i = 1 } ^ { 2 ^ { { \rho } + 2 } } { \theta _ { \rho , i } } { S _ { \rho , i } } ( x )
|
| 211 |
+
$$
|
| 212 |
+
|
| 213 |
+
145 It is therefore possible to create a minimal model with $r = 0$ initialised at zero, and train the model
|
| 214 |
+
146 until convergence. Then one can create a new model with $r = 1$ , by subsuming the previous model’s
|
| 215 |
+
147 parameters, and train this more expressive model until convergence. This process of training and
|
| 216 |
+
148 expansion can be continued indefinitely, and is shown in Figure 8.
|
| 217 |
+
150 ATLAS is named for carrying the burden of all it must remember, after the Titan god Atlas in Greek
|
| 218 |
+
151 mythology who was tasked with holding the weight of the world. ATLAS is also an acronym for
|
| 219 |
+
152 AddiTive exponentiaL Additive Splines.
|
| 220 |
+
153 Definition 3 (ATLAS). ATLAS is a function approximator of $n$ variables, with mixed-density
|
| 221 |
+
154 B-spline functions $f _ { j } ( x _ { j } ) , g _ { i , j } ( x _ { j } )$ , and $h _ { i , j } ( x _ { j } )$ in the form:
|
| 222 |
+
|
| 223 |
+

|
| 224 |
+
Figure 4: Doubling densities of basis functions before and after training.
|
| 225 |
+
|
| 226 |
+
$$
|
| 227 |
+
A ( { \vec { \mathbf { x } } } ) : = \sum _ { j = 1 } ^ { n } f _ { j } ( x _ { j } ) + \sum _ { k = 1 } ^ { M } { \frac { 1 } { k ^ { 2 } } } \exp { \bigl ( } \Sigma _ { j = 1 } ^ { n } g _ { k , j } ( x _ { j } ) { \bigr ) } - { \frac { 1 } { k ^ { 2 } } } \exp { \bigl ( } \Sigma _ { j = 1 } ^ { n } h _ { k , j } ( x _ { j } ) { \bigr ) }
|
| 228 |
+
$$
|
| 229 |
+
|
| 230 |
+
155 ATLAS is equivalently given by the compact notation:
|
| 231 |
+
|
| 232 |
+
$$
|
| 233 |
+
A ( \vec { \bf x } ) : = F ( \vec { \bf x } ) + \sum _ { k = 1 } ^ { M } \frac { 1 } { k ^ { 2 } } \exp ( G _ { k } ( \vec { \bf x } ) ) - \frac { 1 } { k ^ { 2 } } \exp ( H _ { k } ( \vec { \bf x } ) )
|
| 234 |
+
$$
|
| 235 |
+
|
| 236 |
+
156 The absolutely convergent series of scale factors $k ^ { - 2 }$ was chosen for numerical stability and to ensure
|
| 237 |
+
157 the model is absolutely convergent. Another feature is that the series of scale factors also breaks the
|
| 238 |
+
158 symmetry that would otherwise exist if all mixed-density B-spline functions were initialised to zero.
|
| 239 |
+
159 Initialising all the parameters to be zero is a departure from the conventional approach of random
|
| 240 |
+
160 initialisation. The number of exponential terms can be increased without changing the output of the
|
| 241 |
+
161 model. We can choose to initialise $G _ { M + 1 } ( \vec { \bf x } ) = 0$ and ${ \cal H } _ { M + 1 } ( \vec { \bf x } ) = 0$ , such that the model capacity
|
| 242 |
+
162 can be increased at will.
|
| 243 |
+
163 ATLAS is a universal function approximator with some inherent memory retention. It possesses three
|
| 244 |
+
164 properties atypical of most universal function approximators:
|
| 245 |
+
|
| 246 |
+
1. The activity within ATLAS is sparse – most neural units are zero and inactive. 2. The gradient vector with respect to trainable parameters is bounded regardless of the size and capacity of the model, so training is numerically stable for many possible training hyper-parameters. 3. Inputs that are sufficiently far from each other have orthogonal representations.
|
| 247 |
+
|
| 248 |
+
The proofs of the three properties follows from the single-variable case, the assumption of bounded single-variable functions and parameters, and the absolutely convergent $k ^ { - 2 }$ scale factors.
|
| 249 |
+
|
| 250 |
+
Property 1 (Sparsity). For any 72 ${ \vec { \bf x } } \in D ( A ) \subset R ^ { n }$ and bounded trainable parameters $\theta _ { i }$ with index 173 set $\Theta$ , the gradient vector of trainable parameters (for ATLAS) is sparse:
|
| 251 |
+
|
| 252 |
+
$$
|
| 253 |
+
\left\| \vec { \nabla } _ { \vec { \theta } } A ( \vec { \bf x } ) \right\| _ { 0 } = \sum _ { i \in \Theta } d _ { H a m m i n g } \left( \frac { \partial A } { \partial \theta _ { i } } ( \vec { \bf x } ) , 0 \right) \leq 4 n ( 2 M + 1 )
|
| 254 |
+
$$
|
| 255 |
+
|
| 256 |
+
174 Remark. For a fixed number of variables $n$ , the model has a total of $n 2 ^ { r + 2 } ( 2 M + 1 )$ trainable
|
| 257 |
+
175 parameters. The gradient vector has a maximum of $4 n ( 2 M { + } 1 )$ non-zero entries, which is independent
|
| 258 |
+
176 of $r$ . Recall that only the maximum density $( \rho = r )$ ) cubic $\mathbf { B }$ -spline function has trainable parameters.
|
| 259 |
+
177 The fraction of trainable basis functions that are active is at most $2 ^ { - r }$ . Sparsity entails efficient
|
| 260 |
+
178 implementation, and suggests possible memory retention and robustness to catastrophic forgetting.
|
| 261 |
+
179 Property 2 (Gradient flow attenuation). For any ${ \vec { \bf x } } \in D ( A ) \subset R ^ { n }$ and bounded trainable parameters
|
| 262 |
+
180 $\theta _ { i }$ with index set $\Theta$ : if all the mixed-density $B$ -spline functions are bounded, then the gradient vector
|
| 263 |
+
181 of trainable parameters for ATLAS is bounded:
|
| 264 |
+
|
| 265 |
+
$$
|
| 266 |
+
\left\| { \vec { \nabla } } _ { { \vec { \theta } } } A ( { \vec { \mathbf { x } } } ) \right\| _ { 1 } = \sum _ { i \in \Theta } \left| { \frac { \partial A } { \partial \theta _ { i } } } ( { \vec { \mathbf { x } } } ) \right| < U
|
| 267 |
+
$$
|
| 268 |
+
|
| 269 |
+
182 Remark. For a fixed number of variables $n$ , the model has a total of $n 2 ^ { r + 2 } ( 2 M + 1 )$ trainable
|
| 270 |
+
183 parameters. The factor of $k ^ { - 2 }$ inside the expression for ATLAS is necessary to ensure the sum is
|
| 271 |
+
184 convergent in the limit of infinitely many exponential terms $M \to \infty$ . Only the maximum density
|
| 272 |
+
185 $( \rho = r )$ cubic B-spline function has trainable parameters, so that the gradient vector is bounded in
|
| 273 |
+
186 the limit of arbitrarily large densities $r \infty$ . Smaller densities cannot be trainable, otherwise this
|
| 274 |
+
187 property does not hold. The bounded gradient vector implies that ATLAS is numerically stable during
|
| 275 |
+
188 training, regardless of its size or parameter count.
|
| 276 |
+
189 Property 3 (Distal orthogonality). For any ${ \vec { \mathbf { x } } } , { \vec { \mathbf { y } } } \in D ( A ) \subset R ^ { n }$ and bounded trainable parameters
|
| 277 |
+
190 $\theta _ { i }$ for an ATLAS model $A ( { \vec { \bf x } } )$ :
|
| 278 |
+
|
| 279 |
+
$$
|
| 280 |
+
\operatorname* { m i n } _ { j = 1 , \dots , n } \{ | x _ { j } - y _ { j } | \} > 2 ^ { - r } \implies \langle \vec { \nabla } _ { \vec { \theta } } A ( \vec { \bf x } ) , \vec { \nabla } _ { \vec { \theta } } A ( \vec { \bf y } ) \rangle = 0
|
| 281 |
+
$$
|
| 282 |
+
|
| 283 |
+
191 Remark. Two points that sufficiently differ in each input variable have orthogonal parameter gradients.
|
| 284 |
+
192 Distal orthogonality means ATLAS is reasonably robust to catastrophic forgetting, without other
|
| 285 |
+
193 regularisation and training techniques. However, memory retention can still potentially be improved
|
| 286 |
+
194 when used in conjunction with other techniques.
|
| 287 |
+
195 ATLAS can be implemented with 1D convolution, reshaping, embedding, multiplication and dense
|
| 288 |
+
196 layers. The same basis functions have to be computed for each input variable, hence 1D convolutions.
|
| 289 |
+
197 By correctly scaling, shifting, and rounding inputs one can compute only the non-zero basis functions
|
| 290 |
+
198 with embedding layers. The number of basis functions are chosen from powers of two for convenience,
|
| 291 |
+
199 with the maximum density B-spline function having exactly $\lambda = 4 \times 2 ^ { r }$ basis functions. Summing
|
| 292 |
+
200 over all densities the total number of all basis functions in each input variable is at most $2 \lambda$ , because
|
| 293 |
+
201 a geometric series was used. For every output dimension $p$ , there are $2 M$ exponentials. Each
|
| 294 |
+
202 exponential has $n$ single variable functions, with at most $2 \lambda$ cubic B-spline basis functions each.
|
| 295 |
+
203 ATLAS models have time complexity $\mathcal { O } ( p M n \log \lambda )$ , and $\mathcal { O } ( p M n \lambda )$ space complexity.
|
| 296 |
+
|
| 297 |
+
# 7 Methodology
|
| 298 |
+
|
| 299 |
+
205 The 1-,2- and 8-dimensional models were considered for evaluation, in combination with a chosen
|
| 300 |
+
206 width for the update region in Task 2 from 0.1 to 0.9 in 0.1 increments. 30 trials were performed for
|
| 301 |
+
207 each combination of model dimension and update region width. Mean Absolute Error (MAE) loss
|
| 302 |
+
208 function, the Adam optimiser, and mini batch sizes of 100 are used throughout all experiments.
|
| 303 |
+
209 At the beginning of each trial (for a given dimension and update region width) a random learning rate
|
| 304 |
+
210 was sampled uniformly between $1 0 ^ { = 6 }$ and $0 . 0 1 + 1 0 ^ { - 6 }$ . A random noise level was sampled from an
|
| 305 |
+
211 exponential distribution with scale parameter equal to one. The Task 1 target function is constructed
|
| 306 |
+
212 from 1000 Euclidean radial basis functions (RBFs) with locations chosen uniformly over the entire
|
| 307 |
+
213 input domain, with RBF scale parameters sampled independently from an exponential distribution
|
| 308 |
+
214 (scale parameter equal to 10). The weights of each radial basis function are sampled from a normal
|
| 309 |
+
215 distribution with mean zero and standard deviation equal to one. The Task 2 target function is exactly
|
| 310 |
+
216 the same as the Task 1 target function – except for a square-like region with width equal to update
|
| 311 |
+
217 region width. The location of the update region is chosen uniformly at random, and such that it is
|
| 312 |
+
18 completely inside the domain of the model. The updated region masks the Task 1 target function and
|
| 313 |
+
219 instead replaces the values inside it with another function that is sampled from the same distribution
|
| 314 |
+
220 as the Task 1 target function, but independently from the Task 1 target function.
|
| 315 |
+
221 After the generation of the target functions 10000 data points are sampled for training, validation, and
|
| 316 |
+
222 test sets for Task 1 and Task 2. To simulate the effect of learning unrelated tasks, the training data for
|
| 317 |
+
223 Task 2 is only sampled from update region - with no training data outside of it being presented again,
|
| 318 |
+
224 by contrast the validation and test sets for Task 2 were sampled over the entire input domain. Gaussian
|
| 319 |
+
225 noise with standard deviation equal to the randomly chosen noise level is added to all training data.
|
| 320 |
+
226 An ATLAS model ( $M = 1 0$ positive and $M = 1 0$ negative exponential functions, maximum basis
|
| 321 |
+
227 function density $r = 4$ ) with guaranteed distal orthogonality is trained and evaluated on Task 1
|
| 322 |
+
228 and Task 2. Then a modified ATLAS model ( $M = 1 0$ positive and $M = 1 0$ negative exponential
|
| 323 |
+
229 functions, maximum basis function density $r = 4$ , trainable lower density basis functions) without
|
| 324 |
+
230 guaranteed distal orthogonality is trained and evaluated on Task 1 and Task 2 using the same data sets
|
| 325 |
+
231 as previously mentioned model. The final test errors for Task 2 are presented. A randomly selected
|
| 326 |
+
232 trial of the 2-dimensional case is shown for visual inspection. The experiments presented in the main
|
| 327 |
+
233 body of the paper were performed on Google Colab and the relevant code is provided.
|
| 328 |
+
|
| 329 |
+
# 8 Results
|
| 330 |
+
|
| 331 |
+
235 As shown in Figure 5 the effect of distal orthogonality is clear and crisp boundaries that limit the
|
| 332 |
+
236 effect of Task 2 on the memory of Task 1. Without distal orthogonality there are more off-target
|
| 333 |
+
237 effects that can be visualised.
|
| 334 |
+
238 The effect of distal orthogonality on the averaged MAE for various trials for 1-,2- and 8-dimensional
|
| 335 |
+
239 problems are presented as scatter plots of the averaged MAE over 30 trials for different update region
|
| 336 |
+
240 widths as shown in Figure 9. The expected off-target error depends on the dimension of the problem
|
| 337 |
+
241 and the width of the updated regions.
|
| 338 |
+
242 Analytical results to the expected off-target error require simplification, but a reasonable assumption
|
| 339 |
+
243 in the absence of other evidence is that each input dimension has equal contribution on the unit
|
| 340 |
+
244 hyper-cube. Assume for a fixed input dimension $n$ and some region of width $0 < \delta < 1$ where the
|
| 341 |
+
245 target function $Y$ is changed such that $| \Delta Y | = 1$ is one larger than it was originally. The expected
|
| 342 |
+
246 off-target error depends on $k$ the number of input variables inside the updated region: $\begin{array} { r } { \varepsilon _ { k } \approx \frac { n - k } { n } } \end{array}$ . To
|
| 343 |
+
247 correctly account for all permutations with the same magnitude of change:
|
| 344 |
+
|
| 345 |
+

|
| 346 |
+
(b) No guaranteed distal orthogonality, Off-target effects deviate from Task 2 target.
|
| 347 |
+
Figure 5: A randomly chosen trial is presented for visual inspection.
|
| 348 |
+
|
| 349 |
+

|
| 350 |
+
Figure 6: Distal orthogonality guaranteed: All validation MAE curves for Task 1.
|
| 351 |
+
|
| 352 |
+

|
| 353 |
+
Figure 7: No distal orthogonality: Task 2 validation MAE with update region width $\delta = 0 . 1$ .
|
| 354 |
+
|
| 355 |
+

|
| 356 |
+
Figure 8: Distal orthogonality guaranteed: Task 2 validation MAE with update region width $\delta = 0 . 1$
|
| 357 |
+
|
| 358 |
+

|
| 359 |
+
Figure 9: The effect of distal orthogonality on the final test error on task 2 for the 1-,2- and 8- dimensional input.
|
| 360 |
+
|
| 361 |
+
$$
|
| 362 |
+
p ( \varepsilon _ { k } ) = { \binom { n } { k } } \delta ^ { n - k } \left( 1 - \delta \right) ^ { k }
|
| 363 |
+
$$
|
| 364 |
+
|
| 365 |
+
248 One can calculate expected change values:
|
| 366 |
+
|
| 367 |
+
$$
|
| 368 |
+
\mathbb { E } [ \varepsilon ] = \sum _ { k = 0 } ^ { n } \varepsilon _ { k } p ( \varepsilon _ { k } ) \approx \sum _ { k = 0 } ^ { n } { \binom { n - k } { n } } \binom { n } { k } \delta ^ { n - k } \left( 1 - \delta \right) ^ { k } = \delta
|
| 369 |
+
$$
|
| 370 |
+
|
| 371 |
+
249 However if one assumes that the target function inside the updated region of width $\delta$ is correct, with probability 250 $\delta ^ { n }$ of sampling from the entire input-domain, then the expected off-target error should be:
|
| 372 |
+
|
| 373 |
+
$$
|
| 374 |
+
{ \mathrm { E x p e c t e d ~ o f f - t a r g e t ~ e r r o r } } \approx \delta - \delta ^ { n }
|
| 375 |
+
$$
|
| 376 |
+
|
| 377 |
+
251 This seems consistent with some of the experimental results, but further investigation is needed.
|
| 378 |
+
|
| 379 |
+
# 9 Conclusion
|
| 380 |
+
|
| 381 |
+
The main contribution of the paper is theoretical and technical. A representation theorem is presented that outlines how to approximate multi-variable functions with single-variable functions (splines and exponential functions). ATLAS approximates all arbitrary single-variable functions with mixtures of B-spline functions. ATLAS is constructed in such a way that the gradient vector with respect to trainable parameters is bounded, regardless of how large an ATLAS model is. The activation of units in ATLAS is sparse, and allowed for an efficient implementation that only computes non-zero activation values with the aid of embedding layers. The gradient update vector with respect to trainable parameters is orthogonal for different inputs as long as the inputs are sufficiently different from each other.
|
| 382 |
+
|
| 383 |
+
262 For every output dimension $p$ in an ATLAS model, there are $2 M$ exponentials. Each exponential has
|
| 384 |
+
263 $n$ single variable functions, with at most $2 \lambda$ cubic B-spline basis functions each. ATLAS models
|
| 385 |
+
264 have time complexity $\mathcal { O } ( p M n \log \lambda )$ , and $\mathcal { O } ( p M n \lambda )$ space complexity.
|
| 386 |
+
265 ATLAS was shown to exhibit some memory retention, without the assistance of other techniques.
|
| 387 |
+
266 This is a good indication of the potential for combining it with other techniques and models for
|
| 388 |
+
267 continual learning. The chosen experiments demonstrated the theoretically derived predictions and
|
| 389 |
+
268 contrasted two models, incuding a variant of ATLAS without distal orthogonality guarantees.
|
| 390 |
+
269 As far as societal impacts are concerned: It is possible that ATLAS could allow for the creation of
|
| 391 |
+
270 more powerful machine learning algorithms, that require less resources to train and deploy. Further
|
| 392 |
+
271 testing is needed to make any concrete claim.
|
| 393 |
+
272 References
|
| 394 |
+
273 [1] M. A. Bennani, T. Doan, and M. Sugiyama. Generalisation guarantees for continual learn
|
| 395 |
+
274 ing with orthogonal gradient descent, 2021. URL https://openreview.net/forum?id=
|
| 396 |
+
275 hecuSLbL_vC.
|
| 397 |
+
276 [2] K. Branson. A practical review of uniform b-splines, 2004.
|
| 398 |
+
277 [3] M. Delange, R. Aljundi, M. Masana, S. Parisot, X. Jia, A. Leonardis, G. Slabaugh, and
|
| 399 |
+
278 T. Tuytelaars. A continual learning survey: Defying forgetting in classification tasks. IEEE
|
| 400 |
+
279 Transactions on Pattern Analysis and Machine Intelligence, pages 1–1, 2021. doi: 10.1109/
|
| 401 |
+
280 tpami.2021.3057446. URL https://doi.org/10.1109%2Ftpami.2021.3057446.
|
| 402 |
+
281 [4] T. Doan, M. Abbana Bennani, B. Mazoure, G. Rabusseau, and P. Alquier. A theoretical analysis
|
| 403 |
+
282 of catastrophic forgetting through the ntk overlap matrix. In A. Banerjee and K. Fukumizu, edi
|
| 404 |
+
283 tors, Proceedings of The 24th International Conference on Artificial Intelligence and Statistics,
|
| 405 |
+
284 volume 130 of Proceedings of Machine Learning Research, pages 1072–1080. PMLR, 13–15
|
| 406 |
+
285 Apr 2021. URL https://proceedings.mlr.press/v130/doan21a.html.
|
| 407 |
+
286 [5] A. S. Douzette. B-splines in machine learning. Master’s thesis, Department of Mathematics,
|
| 408 |
+
287 University of Oslo, 2017.
|
| 409 |
+
288 [6] M. Farajtabar, N. Azizan, A. Mott, and A. Li. Orthogonal gradient descent for continual
|
| 410 |
+
289 learning. In S. Chiappa and R. Calandra, editors, Proceedings of the Twenty Third International
|
| 411 |
+
290 Conference on Artificial Intelligence and Statistics, volume 108 of Proceedings of Machine
|
| 412 |
+
291 Learning Research, pages 3762–3773. PMLR, 26–28 Aug 2020. URL https://proceedings.
|
| 413 |
+
292 mlr.press/v108/farajtabar20a.html.
|
| 414 |
+
293 [7] R. M. French. Catastrophic forgetting in connectionist networks. Trends in cognitive sciences,
|
| 415 |
+
294 3(4):128–135, 1999.
|
| 416 |
+
295 [8] S. Golkar, M. Kagan, and K. Cho. Continual learning via neural pruning, 2019. URL https:
|
| 417 |
+
296 //arxiv.org/abs/1903.04476.
|
| 418 |
+
297 [9] R. Hadsell, D. Rao, A. A. Rusu, and R. Pascanu. Embracing change: Continual learning in deep
|
| 419 |
+
298 neural networks. Trends in cognitive sciences, 24(12):1028–1040, 2020.
|
| 420 |
+
299 [10] B. Hanin. Universal function approximation by deep neural nets with bounded width and relu
|
| 421 |
+
300 activations. Mathematics, 7(10):992, 2019.
|
| 422 |
+
301 [11] K. Hornik, M. Stinchcombe, and H. White. Multilayer feedforward networks are universal
|
| 423 |
+
302 approximators. Neural networks, 2(5):359–366, 1989.
|
| 424 |
+
303 [12] P. Kaushik, A. Gain, A. Kortylewski, and A. Yuille. Understanding catastrophic forgetting and
|
| 425 |
+
304 remembering in continual learning with optimal relevance mapping. CoRR, abs/2102.11343,
|
| 426 |
+
305 2021. URL https://arxiv.org/abs/2102.11343.
|
| 427 |
+
306 [13] R. Kemker, M. McClure, A. Abitino, T. Hayes, and C. Kanan. Measuring catastrophic forgetting
|
| 428 |
+
307 in neural networks. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32,
|
| 429 |
+
308 2018.
|
| 430 |
+
309 [14] J. Kirkpatrick, R. Pascanu, N. Rabinowitz, J. Veness, G. Desjardins, A. A. Rusu, K. Milan,
|
| 431 |
+
310 J. Quan, T. Ramalho, A. Grabska-Barwinska, D. Hassabis, C. Clopath, D. Kumaran, and
|
| 432 |
+
311 R. Hadsell. Overcoming catastrophic forgetting in neural networks. Proceedings of the
|
| 433 |
+
312 National Academy of Sciences, 114(13):3521–3526, 2017. ISSN 0027-8424. doi: 10.1073/pnas.
|
| 434 |
+
313 1611835114. URL https://www.pnas.org/content/114/13/3521.
|
| 435 |
+
314 [15] A. Kratsios. The universal approximation property: Characterization, construction, representa
|
| 436 |
+
315 tion, and existence. Annals of Mathematics and Artificial Intelligence, 89(5):435–469, 2021.
|
| 437 |
+
316 doi: 10.1007/s10472-020-09723-1.
|
| 438 |
+
317 [16] R. Krishnan and P. Balaprakash. Meta continual learning via dynamic programming, 2020.
|
| 439 |
+
318 URL https://arxiv.org/abs/2008.02219.
|
| 440 |
+
|
| 441 |
+
[17] S. H. Lane, M. Flax, D. Handelman, and J. Gelfand. Multi-layer perceptrons with b-spline receptive field functions. In Advances in Neural Information Processing Systems, pages 684–692, 1991.
|
| 442 |
+
[18] A. C. Li and D. Pathak. Functional regularization for reinforcement learning via learned fourier features, 2021. URL https://arxiv.org/abs/2112.03257.
|
| 443 |
+
[19] M. McCloskey and N. J. Cohen. Catastrophic interference in connectionist networks: The sequential learning problem. In Psychology of learning and motivation, volume 24, pages 109–165. Elsevier, 1989.
|
| 444 |
+
[20] K. McRae and P. A. Hetherington. Catastrophic interference is eliminated in pretrained networks. In Proceedings of the 15h Annual Conference of the Cognitive Science Society, pages 723–728, 1993.
|
| 445 |
+
[21] H. Mehta, A. Cutkosky, and B. Neyshabur. Extreme memorization via scale of initialization, 2020. URL https://arxiv.org/abs/2008.13363.
|
| 446 |
+
[22] A. Meulemans, F. Carzaniga, J. Suykens, J. a. Sacramento, and B. F. Grewe. A theoretical framework for target propagation. In H. Larochelle, M. Ranzato, R. Hadsell, M. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 20024– 20036. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper/ 2020/file/e7a425c6ece20cbc9056f98699b53c6f-Paper.pdf.
|
| 447 |
+
[23] A. Robins. Catastrophic forgetting, rehearsal and pseudorehearsal. Connection Science, 7(2): 123–146, 1995.
|
| 448 |
+
[24] A. A. Rusu, N. C. Rabinowitz, G. Desjardins, H. Soyer, J. Kirkpatrick, K. Kavukcuoglu, R. Pascanu, and R. Hadsell. Progressive neural networks, 2016. URL https://arxiv.org/ abs/1606.04671.
|
| 449 |
+
[25] S. Scardapane, M. Scarpiniti, D. Comminiello, and A. Uncini. Learning activation functions from data using cubic spline interpolation. In Italian Workshop on Neural Nets, pages 73–83. Springer, 2017.
|
| 450 |
+
[26] Y. Shin and J. Ghosh. The pi-sigma network: an efficient higher-order neural network for pattern classification and function approximation. In IJCNN-91-Seattle International Joint Conference on Neural Networks, volume i, pages 13–18 vol.1, 1991. doi: 10.1109/IJCNN.1991.155142.
|
| 451 |
+
[27] H. van Deventer, P. J. van Rensburg, and A. Bosman. Kasam: Spline additive models for function approximation, 2022. URL https://arxiv.org/abs/2205.06376.
|
| 452 |
+
|
| 453 |
+
# Checklist
|
| 454 |
+
|
| 455 |
+
1. For all authors...
|
| 456 |
+
|
| 457 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 458 |
+
(b) Did you describe the limitations of your work? [Yes]
|
| 459 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes]
|
| 460 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 461 |
+
|
| 462 |
+
2. If you are including theoretical results...
|
| 463 |
+
|
| 464 |
+
(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]
|
| 465 |
+
|
| 466 |
+
3. If you ran experiments...
|
| 467 |
+
|
| 468 |
+
(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]
|
| 469 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
|
| 470 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
|
| 471 |
+
(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)? [TODO]
|
| 472 |
+
|
| 473 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 474 |
+
|
| 475 |
+
(a) If your work uses existing assets, did you cite the creators? [TODO]
|
| 476 |
+
(b) Did you mention the license of the assets? [TODO]
|
| 477 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [TODO]
|
| 478 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 479 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 480 |
+
|
| 481 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 482 |
+
|
| 483 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 484 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 485 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/JavFPcsscd5/JavFPcsscd5.md
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The Effects of Regularization and Data Augmentation are Class Dependent
|
| 2 |
+
|
| 3 |
+
Randall Balestriero Meta AI Research, FAIR NYC, USA rbalestriero@meta.com
|
| 4 |
+
|
| 5 |
+
Leon Bottou
|
| 6 |
+
Meta AI Research, FAIR
|
| 7 |
+
NYC, USA
|
| 8 |
+
leonb@meta.com
|
| 9 |
+
|
| 10 |
+
Yann LeCun Meta AI Research, FAIR, NYU NYC, USA ylecun@meta.com
|
| 11 |
+
|
| 12 |
+
# Abstract
|
| 13 |
+
|
| 14 |
+
Regularization is a fundamental technique to improve a model’s generalization performances by limiting its complexity. Deep Neural Networks (DNNs), which tend to overfit their training data, heavily rely on regularizers such as Data-Augmentation (DA) or weight-decay with hyper-parameters found from structural risk minimization, i.e., cross-validation. In this study, we demonstrate that the optimal regularization’s hyper-parameters found from cross-validation over all classes leads to disastrous model performances on a minority of classes. For example, a resnet50 trained on Imagenet sees its “barn spider” test accuracy falls from $6 8 \%$ to $4 6 \%$ only by introducing random crop DA during training. Even more surprising, such unfair impact of regularization also appears when introducing uninformative regularizers such as weight decay or dropout. Those results demonstrate that our search for ever increasing generalization performance —averaged over all classes and samples— has left us with models and regularizers that silently sacrifice performances on some classes. This scenario can become dangerous when deploying a model on downstream tasks e.g. an Imagenet pre-trained resnet50 deployed on INaturalist sees its performances fall from $7 0 \%$ to $3 0 \%$ on class $\# 8 8 8 9$ when introducing random crop DA during the Imagenet pre-training phase. Those results demonstrate that finding a correct measure of a model’s complexity without class-dependent preference remains an open research question.
|
| 15 |
+
|
| 16 |
+
# 1 Introduction
|
| 17 |
+
|
| 18 |
+
Machine learning and deep learning aim at learning systems to solve as accurately as possible a given task at hand [LeCun et al., 1998, Bishop and Nasrabadi, 2006, Jordan and Mitchell, 2015]. This process often takes the form of (i) being given a finite dataset, a (differentiable) loss function, and a performance measure, (ii) splitting the dataset into train/valid/test sets to optimizing the system’s parameters e.g. from gradient updates of the loss on the train set while cross-validating hyper-parameters using the valid set, and (iii) assessing the system’s performance on the test set. As the training set is finite, and the optimal design of the system is unknown, it is common to employ regularization during the optimization phase to reduce over-fitting [Tikhonov, 1943, Tihonov, 1963] i.e. to decrease the system’s performance gap between train set and test set samples [Simard et al., 1991, Chapelle et al., 2000, Bottou, 2012, Neyshabur et al., 2014]. Central to our study is the fact that hyper-parameter selection is done via cross-validation by maximizing the valid set performance with ad-hoc statistics e.g. the average accuracy over all samples for classes in classification tasks.
|
| 19 |
+
|
| 20 |
+
Cross-validation commonly involves many different types of regularization along with their “strengths” [Goodfellow et al., 2016, He et al., 2021]. Most variants of regularization take one of two forms: Data-Augmentation (DA) and weight-decay. DA is a data-driven and informed regularization strategy that artificially increase the number of training samples [Shorten and Khoshgoftaar, 2019]. As opposed to most explicit regularizers e.g. Tikhonov regularization [Krogh and Hertz, 1991], also denoted as weight decay, DA’s regularization is implicit as it is not a function of a model’s parameter, but a function of the training samples [Neyshabur et al., 2014, Hernández-García and König, 2018, LeJeune et al., 2019]; although some DA strategies can be turned into explicit regularizers Balestriero et al. [2022]. Nevertheless, a key distinction between DA and weight decay is that DA tends to require more domain knowledge to be successful than weight decay. Most —if not all— of current state-of-the-art employ such regularizers [Huang et al., 2018, Chen et al., 2020b, Liu et al., 2021, Tan and Le, 2021, Liu et al., 2022].
|
| 21 |
+
|
| 22 |
+

|
| 23 |
+
Figure 1: Structural risk minimization minimizes the empirical risk of several models of varying complexity, and selects the one offering the best compromise between under-fitting and over-fitting [Vapnik and Chervonenkis, 1974]. In deep learning, one commonly control the model’s complexity by picking different DN architectures and/or by applying different levels and flavors of regularization. The key observation of our study is that when the model complexity is calibrated by DA (see Figs. 2, 5 and 6), or weight-decay (see Fig. 3), the class-conditional empirical risks do not align between classes i.e. cross-validation produces models that perform well on the majority of classes but arbitrarily poorly on a few of them as depicted on the left-hand-side. In an ideal setting where the control of the model’s complexity is well aligned with the task and model, one would observe the right-hand-side ideal scenario where the same model complexity is optimal for all classes.
|
| 24 |
+
|
| 25 |
+
In this paper, we will demonstrate that when cross-validation is employed to select the regularization settings maximizing the validation performance, a significant bias is introduced into the trained model: the regularized model exhibits strong per-class favoritism i.e. while the average test performance is improved, it is at the cost of producing a model with significant performance drop on some of the classes as illustrated in the schematic of Fig. 1. For readers familiar with statistical estimation results e.g. the bias-variance trade-off [Kohavi et al., 1996, Von Luxburg and Schölkopf, 2011] or bayesian estimation e.g. Tikhonov regularization [Box and Tiao, 2011, Gruber, 2017], it should not be surprising that regularization produces bias (more details and background provided in Appendix A). In fact, it is beneficial to introduce bias through regularization if it results in a significant reduction of the estimator variance —when one minimizes the average empirical risk. However, the potentially dangerous effect of regularization that this study brings forward is that the bias introduced by regularization is class-dependent, including on transfer learning tasks.
|
| 26 |
+
|
| 27 |
+
To thoroughly validate this observation, we propose a variety of controlled experiments in Section 2. First, we carefully quantify the impact of DA, weight decay and dropout on the per-class performance of a model in Section 2.1, demonstrating that current deep learning finds itself in the scenario depicted on the left of Fig. 1. Then, we consider the task of transfer learning in Section 2.2 where it is again possible to identify again a per-class bias on the target dataset even though the regularization was applied on a different (source) training set. This latter scenario is particularly relevant in current times where it is common to deploy a large pre-trained model on a variety of tasks and raise an important issue: selecting the —on average— best performing pre-trained model can lead to catastrophic individual class performance even on for different downstream tasks.
|
| 28 |
+
|
| 29 |
+
Our next Section 3 will aim at exploring possible explanations and solutions. First, we will provide a brief theoretical justification on why and when DA can be the cause of model bias (Section 3.1) regardless of the task and data at hand. This will shed light to a first possible issue: the DA parameters that make the transformed input preserve its label information vary depending on the class underlying statistics. In short, DA silently introduces class-imbalance in the training set. We propose a dedicated analysis of the label-preserving property of DA on different classes and models in Section 3.2. We then take on the task of searching for a possible solution by first reviewing known theoretical studies quantifying the interplay between regularization and bias in Section 3.3. Lastly, we propose some solutions of our own in Section 3.4 built from the gained insights of Section 3.2 using label-distillation and adaptive DA. All the codebase used to train the various models and to generate the figures is in the supplementary files.
|
| 30 |
+
|
| 31 |
+

|
| 32 |
+
Figure 2: Varying the random crop DA lower bound $\mathbf { \hat { x } }$ -axis) from $100 \%$ to $8 \%$ provides greater average test accuracy (blue) but makes the per-class performance fall for some of the classes. Images of each class are provided in Fig. 12, in the appendix. See Fig. 8 for the convnext and ViT experiments. Results obtained by averaging over 20 runs, official PyTorch resnet50 implementation trained on Imagenet with horizontal flip and varying random crop lower bound DA.
|
| 33 |
+
|
| 34 |
+
# 2 Maximizing the Average Model Performance by Cross-Validation Silently Produce Poor Final Performances on a Minority of the Classes
|
| 35 |
+
|
| 36 |
+
We now turn to the empirical validation of Fig. 1 i.e. quantifying the amount of class-dependent bias caused by DA, weight decay and dropout in various realistic scenarios (Section 2.1). We then demonstrate how the bias introduced by regularization transfers to downstream tasks e.g. when deploying an Imagenet (source) trained model on the INaturalist (target) dataset in Section 2.2; that scenario is key as it demonstrates the potential harm of selecting the best performing model on the source dataset which could turn out to also be the most biased model against the target dataset class of interest.
|
| 37 |
+
|
| 38 |
+
# 2.1 Precisely Measuring the Per-Class Effect of Data-Augmentation and Uninformed Regularization with Controlled Experiments
|
| 39 |
+
|
| 40 |
+
This section aims at quantifying precisely the amount of downward or upward per-class performance shift that came as a result from using DA or uninformed regularization e.g. weight-decay or dropout. In fact, it is crucial to remember that regularization, or any other form of structural risk minimization, improves generalization performances by increasing the bias of the estimator so that the estimator’s variance is decreased by a greater amount. However, nothing guarantees the fairness of this bias i.e. for it to be equally distributed amongst the dataset classes. We thus propose a sensitivity analysis by training a large collection of models with varying regularization policies to precisely assess their impact on the class-dependent model bias.
|
| 41 |
+
|
| 42 |
+
Data-Augmentation. DA samples have been known to sometimes disregard the semantic information of the original samples [Krizhevsky et al., 2012]. Nevertheless, DA remains applied universally across tasks and datasets [Shorten and Khoshgoftaar, 2019] as it provides significant performance improvements, even in semi-supervised and unsupervised settings Guo et al. [2018], Xie et al. [2020], Misra and Maaten [2020]. To measure the impact of DA onto per-class performances, we propose in Fig. 2 a sensitivity analysis by training the same architecture on Imagenet with varying DA policies. In particular, we consider a given DA (random crop in this case) and we vary the support of the parameter $\alpha$ which represents how much of the original image is kept in the crop (examples at the top of Fig. 5). We train multiple Deep Neural Networks (DNN)s using $\alpha \in [ 1 0 0 , \tau ]$ with $\tau$ varying from 100 to 8 and for each case, we report our metrics averaged over 20 trained models. We observe a clear relation between increase in the strength of the DA, increase in the average test accuracy overall classes, and decrease in some per-class test accuracies. For example, on a resnet50 Imagenet setting, the accuracy on the “academic gown” class goes from $62 \%$ to $40 \%$ steadily as $\tau$ decreases.
|
| 43 |
+
|
| 44 |
+

|
| 45 |
+
Figure 3: Varying the amount of weight decay, an uninformed regularizer employed throughout, surprisingly exhibits similar class-dependent bias as the DA scenario of Fig. 2. Images for each class are provided in Fig. 13, in the appendix. Results obtained by averaging over 20 runs, official PyTorch resnet50 implementation trained on Imagenet with varying weight decay, see Fig. 16 for DenseNet121 results with the same trend and Fig. 8 for the convnext and ViT experiments.
|
| 46 |
+
|
| 47 |
+
Uninformed Regularization. As per the arguments given in Sections 3.1 and 3.2, it would be natural to assume that what makes DA responsible for creating class-dependent bias in DNNs is our misfortune in defining correct augmentation policies. Hence, uninformed weight decay or dropout should behave differently and more fairly. We demonstrate here that such regularizers are also unfair between classes. We thus propose to train multiple models with varying weight-decay and dropout parameters. In our setting, weight-decay is applied to all the DNN parameters except for the ones of batch-normalization layers, as commonly done [Hastie et al., 2009, Leclerc et al., 2022]. We report in Fig. 3 the per-class performance of a resnet50 trained on Imagenet with varying weight decay coefficient $\gamma$ (as was done for DA in Fig. 2) and we observe that different classes have different test accuracy sensitivities to variations in $\gamma$ . Some will see their generalization performance increase, while others will have decreasing generalization performances. We further confirm such findings in Figs. 9 and 10 for dropout where the same per-class trend is observed. In short, even for uninformative regularizers such as weight decay or dropout, a per-class bias is introduced, reducing performances for some of the classes. Although weight-decay is one of the most popular regularizer that is uninformed on the data and task at hand, recent studies have demonstrated that techniques such as model pruning —which can be seen as a post-training model complexity reduction i.e. regularization— also produce increased bias towards under-represented features [Hooker et al., 2019, 2020]. More recently, Balestriero et al. [2022] obtained the close-form explicit regularizer of DA from which it is possible to quantify the sample-dependent aspect of DA’s regularization. From our findings, it seems that classes sharing the same type of features are thus impacted different by DAs.
|
| 48 |
+
|
| 49 |
+
Formal Statistical Test. To further convey our claim, we now propose a formal statistical test [Neyman and Pearson, 1933, Fisher, 1955] on the hypothesis that the per-class accuracy is significantly higher when DA is applied for each class (details provided in Appendix A.2). We obtain that there is enough evidence to reject the hypothesis with $9 5 \%$ confidence for $4 . 5 \%$ of all the classes, and with $9 9 \%$ confidence for $2 . { \dot { 6 } } \%$ of all the classes. Hence there is sufficient evidence to say that the per-class test accuracies is not increased when introducing DA for $4 . 5 \%$ of the 1000 Imagenet classes. We provide in Table 1 the same statistical test but applied on a variety of settings including different architectures (resnet50, densenet121, ViT-small and ConvNext-Tiny) and across the random crop DA and the weight decay controlled experiments. We should highlight however that this is not necessarily a meaningful measure since for example one regularization might not have any negative impact on the classes, but can provide a beneficial gain that is drastically different between classes. Hence, although the per-class performance does not drop by introduce the regularizer, the inter-class performance gap can be increased by it, which is an equally harmful impact.
|
| 50 |
+
|
| 51 |
+
The next Section 2.2 proposes to study the scenario of introducing a pre-trained model, on a different downstream task to show that the class-dependent effect of regularization remains present and unfair towards specific downstream classes.
|
| 52 |
+
|
| 53 |
+
# 2.2 The Class-Dependent Bias Transfers to Other Downstream Tasks
|
| 54 |
+
|
| 55 |
+
The last experiment we propose is to quantify the amount of class-dependent bias that transfers to other downstream tasks, a common situation in transfer learning and in system deployment to the real world [Pan and Yang, 2009]. We thus want to measure how regularization applied during the pre-training phase on a source dataset impacts the per-class accuracy of that model on the target dataset.
|
| 56 |
+
|
| 57 |
+
Table 1: Percentage of Imagenet classes for which the test set performance (per-class) is statistically not greater when applying random crop DA (or weight decay) as measured by the statistical test from Section 2. We observe that although this measure is highly conservative since a regularizer (DA or weight decay) might now have a negative impact on a per-class performance but still increase the performance gap between difference classes, already, a nonzero proportion of classes are negatively impact by introduce random crop DA or weight decay.
|
| 58 |
+
|
| 59 |
+
<table><tr><td>confidencel</td><td>resnet50</td><td>resnet50 random crop|weight decay</td><td>convnext-tinyl random crop</td><td>weight decay</td><td>/|convnext-tiny|ViT random crop|densenet121 random crop</td><td>weight decay</td></tr><tr><td>90%</td><td>5.9</td><td>39.4</td><td>0.1</td><td>85.5</td><td>1.2</td><td>33.8</td></tr><tr><td>95%</td><td>4.5</td><td>30.3</td><td>0.1</td><td>78.8</td><td>1.0</td><td>17.1</td></tr><tr><td>99%</td><td>2.6</td><td>15.3</td><td>0.0</td><td>63.9</td><td>0.7</td><td>3.3</td></tr></table>
|
| 60 |
+
|
| 61 |
+

|
| 62 |
+
Figure 4: Varying the random crop lower-bound during pre-training (Imagenet) also produces unfair per-class biases on the downstream task (INaturalist). Hence, selecting the pre-trained model with best average test accuracy on the source dataset might result in deploying a model with the worst performance on the classes of interest in the target task. Images for each class are provided in Fig. 17, in the appendix. Results obtained by averaging over 20 runs, official PyTorch resnet50 implementation trained on Imagenet with varying random crop lower bound and transferred to INaturalist with frozen backbone parameters.
|
| 63 |
+
|
| 64 |
+
In order to keep the setting similar to Section 2.1, we adopt a resnet50 model with random crop DA. That model is pre-trained on Imagenet dataset (source) with varying value of $\tau$ (random crop lower bound) and then, the trained model is transferred to the INaturalist dataset [Van Horn et al., 2018] (target) that consists of 10,000 classes. When transferring the model to INaturalist, the parameters are kept frozen, and only a linear classifier is trained on top of it. We report in Fig. 4 the performance of the trained models with varying $\tau$ on different INaturalist classes. We observe once again that the best resnet50 —on average— is not necessarily the one that should be deployed as there exists a strong per-class bias that varies with $\tau$ . As a result, picking the best performing model from a source dataset to a target dataset, might leave the pipeline to perform poorly since that model might also be the one that is the most biased against the class of interest in the target dataset.
|
| 65 |
+
|
| 66 |
+
This result should motivate the design of novel regularizers that do not reduce performances between classes at different regimes. Additionally, due to the cost of training multiple models with varying regularization settings, one might wonder on the possible alternative solutions to detect trends such as shown in Fig. 4 only when given a single pre-trained model.
|
| 67 |
+
|
| 68 |
+
# 3 Understanding Why and When Regularization Produces Models With Class-Dependent Preferences
|
| 69 |
+
|
| 70 |
+
The first part of our study (Section 2) empirically validated that DNN regularization produces unfair model complexity control over different classes, resulting in a model performing poorly on a few of the classes although being highly performing on average. We now provide in Sections 3.1 and 3.2 some intuition on why DA can be a source of bias regardless of the task, dataset and model at hand. Then, Section 3.3 reviews existing works trying to confront regularization and model bias, and as we will see, an out-of-the-box solution does not seem to exist when there are only a few classes suffering from regularization (Section 3.4).
|
| 71 |
+
|
| 72 |
+
# 3.1 A Data-Augmentation Policy That is Not Label-Preserving For All Classes Will Create Class-Imbalance Performances
|
| 73 |
+
|
| 74 |
+
To provide a simple explanation on how DA causes bias in a trained model, we propose the following derivation that holds for any signal e.g. timeseries, images, videos. Without loss of generality, we will consider here the $\ell _ { 2 }$ loss which was shown to perform as well as the cross-entropy even on Imagenet [Hui and Belkin, 2020].
|
| 75 |
+
|
| 76 |
+
Dataset notations. Given a sample $\textbf { \em x } \in { \mathcal { X } }$ with $\boldsymbol { \mathcal { X } } \subset \mathbb { R } ^ { D }$ , we consider ${ \pmb y } \triangleq f ^ { * } ( { \pmb x } )$ to be the ground-truth target value. Hence our hope is to learn an approximator $f _ { \theta }$ that is as close as possible to $f ^ { * }$ everywhere in $\mathcal { X }$ , although we only observe a finite training set $\mathbb { X } \triangleq \{ ( \pmb { x } _ { 1 } , \pmb { y } _ { 1 } ) , \dots , ( \pmb { x } _ { N } , \pmb { y } _ { N } ) \}$ . Given an output vector $\textbf { \em u }$ we also define the level-set of a mapping $f$ to be $\{ { \pmb x } \in { \mathcal { X } } : f ( { \pmb x } ) = { \pmb u } \}$ .
|
| 77 |
+
|
| 78 |
+
Data-Augmentation notations. Additionally, one employs a DA policy $\mathcal { T } : \mathbb { R } ^ { D } \times \mathcal { K } \mapsto \mathbb { R } ^ { D }$ such that given a transformation parameter $\alpha \in { \mathcal { K } }$ , ${ \mathcal T } _ { \alpha } ( { \pmb x } )$ produces the transformed view of $_ { \textbf { \em x } }$ . Often, one also defines a density $p$ on $\kappa$ that helps in sampling transformation parameters that are a priori known to be the most useful.
|
| 79 |
+
|
| 80 |
+
Theorem 1. Whenever the transformations produced by $\mathcal { T } _ { \alpha } , \forall \alpha$ do not respect the level-set of $f ^ { * }$ , and whenever the model has enough capacity to minimize the training loss, the DA will create irreducible bias in $f _ { \theta }$ as in
|
| 81 |
+
|
| 82 |
+

|
| 83 |
+
|
| 84 |
+
The main idea of the proof, provided in Appendix $\mathbf { B }$ , is to show that if a transformation does not move samples on the level-set of the true function (left-hand-side of Eq. (1)), then $f _ { \theta }$ will learn a different level-set (since it has 0 training error), and thus $\| f ^ { * } - f _ { \theta } \| > 0$ i.e. $f _ { \theta }$ is biased.
|
| 85 |
+
|
| 86 |
+
Whenever the left-hand-side of Eq. (1) is 0, the DA is denoted as label-preserving [Cui et al., 2015, Taylor and Nitschke, 2018]. From the above, we see that unless the target y associated to ${ \mathcal T } _ { \alpha } ( { \pmb x } )$ is modified accordingly to encode the shift in the target function level-set produced by $\mathcal { T } _ { \alpha }$ , any $D A$ that is not label-preserving will introduce a bias. Some DAs propose to incorporate label transformation i.e. not only $_ { \textbf { \em x } }$ but also $\textbf { { y } }$ is augmented to better inform on the uncertainty that has been added into $\mathcal { T } _ { \boldsymbol { \theta } } ( \mathbf { \mathscr { x } } )$ . This is for example the case for MixUp [Zhang et al., 2017], ManifoldMixUp [Verma et al., 2019], CutMix [Yun et al., 2019] and their extensions.
|
| 87 |
+
|
| 88 |
+
Our goal in the next Section 3.2 is to demonstrate how DAs such as random crop, color jittering, or CutOut are only label preserving for some values of $\alpha$ that vary with the sample class. As a consequence, while the use of the DA improves the average test performance, it is at the cost of a significant reduction in performance for some of the classes.
|
| 89 |
+
|
| 90 |
+
# 3.2 The Same Data-Augmentation can be Label-Preserving or Not Between Different Classes
|
| 91 |
+
|
| 92 |
+
In the previous Section 3.1 we provided a general argument on the sufficient conditions for DA to produce a biased model. We hope in this section to provide a more concrete example that applies to current DNN training. To that end, we will demonstrate that a DA can be label-preserving or not depending on the sample’s class, hence, since the same DA policy is employed for all classes, the augmented dataset will exhibit a class-imbalance in favor of the classes for which the DA is most label-preserving.
|
| 93 |
+
|
| 94 |
+
To measure by how much a given DA, $\mathcal { T } _ { \alpha }$ , is label-preserving, we propose to take 6 popular architectures that are pre-trained on Imagenet [Deng et al., 2009] from the official PyTorch [Paszke et al., 2019] repository, and to evaluate their performances for varying DA settings (top of Fig. 5). We observe that considering the dataset as a whole is not a good indicator of the optimal DA value to employ since per-class accuracy performance (bottom of Fig. 5) vary drastically. For example, for some classes, any level of transformation $\alpha$ can produce augmented samples with enough information to be correctly classified, while for other classes, even a small amount of DA makes the samples unpredictable.
|
| 95 |
+
|
| 96 |
+
To further ensure that the observed relation between label-preservation, sample class, and amount of transformation $\alpha$ is sound, we provide in Fig. 6 the per-class test accuracy on different models, all exhibit the same trends. In short, we identify that when creating an augmented dataset by applying the same DA across classes, the number of per-class samples that actually contain enough information about their true labels will become largely imbalance between classes, even if the original dataset was balanced. Any model trained on the augmented dataset will thus focus on the classes for which the DA is the most label-preserving.
|
| 97 |
+
|
| 98 |
+

|
| 99 |
+
Figure 5: Top: examples of an augmented image of class “bird”. Middle: average accuracy (train set in dashed line and test set in plain) on Imagenet, using 6 popular architectures. Bottom: per-class performances from the middle scenario along with 9 images of the corresponding classes. We observe that the random crop DA seems to loose its label-preserving property on average when less than $30 \%$ of the image is kept in the crop but looking at the per-class performance, we observe that such DA can be label-preserving with only $8 \%$ of the original image for some classes, while for other classes the label information starts to reduce at around $50 \%$ . Results obtained from the official Imagenet pre-trained PyTorch models. CutOut and ColorJitter cases are provided in Figs. 14 and 15 and exhibit the same trend.
|
| 100 |
+
|
| 101 |
+

|
| 102 |
+
Figure 6: Reprise of the bottom left of Fig. 5 for three different DAs (each column) and using the same 6 popular architectures (different lines). We observe that across DAs, different architectures agree on the label-preserving regimes for $\mathcal { T } _ { \alpha }$ i.e. even an ensemble of model would not reduce the class-dependent bias of the final prediction. Results obtained from the official Imagenet pre-trained PyTorch models.
|
| 103 |
+
|
| 104 |
+
Beyond the above intuitive and natural understand we obtained in term of data-augmentation, there exists theoretical studies that we propose to summarize below
|
| 105 |
+
|
| 106 |
+
# 3.3 Do Existing Studies Provide Answers Into the Inter-Play Between Regularization and Class-Dependent Bias?
|
| 107 |
+
|
| 108 |
+
We explored in Section 3.2 a possible explanation of the class-dependent bias we observed in Section 2 hinting at the need to use class-dependent DA. We propose here to summarize existing studies that are attempting to better understand the impact of DA and regularization in general onto a model’s performance and bias. Then, Section 3.4 will explore their application.
|
| 109 |
+
|
| 110 |
+

|
| 111 |
+
Figure 7: Reprise of Fig. 2 but now implementing the class-dependent DA as prescribed in Section 3.3 i.e. we only apply DA (random crop) to the classes that see their per-class accuracy improve when this DA is employed during training.. We observe here that the bias of the model introduced from random crop on the majority of the classes spills-over to the minority of the classes that do not benefit from that DA, even though such classes never received that DA during training. Results are averaged over 5 runs and employ the official resnet50 implementation trained on Imagenet with horizontal flip but a per-class random crop DA.
|
| 112 |
+
|
| 113 |
+
Input independent DA exacerbates the bias already present in a dataset. Especially relevant to our results is a recent result of Xu et al. [2020]. In this work, it was theorized that when the underlying dataset contains inherent biases, training on the original data is more effective than employing an i.i.d. DA policy, i.e. applying the same random augmentation to all samples/classes, to produce an unbiased model. In short, the DA exacerbates the already present biases and makes the trained model further away from the unbiased optimum. The difficulty of this result lies in defining bias for real images. As per our experiments from Section 3, we observe that bias can take many form e.g. one class might naturally represent its object always under the same angle. This is particularly true say for boats which are rarely captured upside-down. Hence, simply having classes with different natural statistics could be enough for Xu et al. [2020] to prohibit the use of DA in current datasets. Furthermore, Raghunathan et al. [2020] obtained a surprising result combining both DA and regularization. In that case, it was found that the minimum norm interpolant on the original $+ \textrm Ḋ \textmu Ḋ Ḍ Ḍ _ { \mathrm { Ḋ } } \textrm Ḋ \textmu Ḍ Ḍ$ dataset could have a larger standard error than the minimum norm interpolant on the original dataset alone, even when using label-preserving DA. However, this phenomenon only occurs as long as the model remains over-parametrized, even when considering the original $+ \mathrm { D A }$ dataset.
|
| 114 |
+
|
| 115 |
+
Input dependent DA can reduce sample/class bias. Recall that Section 3.2 brought forward one possible explanation on how DA can be the source of training-set by introduce class-imbalance due to the same DA being label-preserving for some classes and not for others. From this, a direct solution would be to adapt the “strength”. This solution, formalized in Xu et al. [2020], consists in measuring the bias of a model and adapt the DA policy accordingly to correct it. This has been done in different flavors e.g. in McLaughlin et al. [2015], Iosifidis and Ntoutsi [2018], Jaipuria et al. [2020]. One limitation of this direction is that it requires to estimate a model bias and adapt the DA accordingly which can be challenging for large scale models.
|
| 116 |
+
|
| 117 |
+
Learned DA e.g. from a GAN can produce even more class-dependent bias. One natural extension of the hands-on adaptivity of a DA to a measured model bias would be to learn a DA to maximize a model’s performance, for example. This line of work has led to many learn DA policies e.g. using Generative Adversarial Networks [Hu and Li, 2019]. Yet, it has been shown that learning a DA to maximize some aggregated measure of performance will produce even more bias in a model [Hu and Li, 2019]. In fact, and as per the controlled experiments from Section 2, the learned DA will entirely disregard a minority of the classes if it means that the produced DA can drastically improve performances on all others, effectively maximizing the average performances.
|
| 118 |
+
|
| 119 |
+
Inherent tradeoff between DA and model robustness. In addition to the implication of DA into bias, there exists an intertwined relationship between DA and model robustness. In fact, even assuming the use of perfectly adapted DAs, there exists an inherent tradeoff between accuracy and robustness that holds even in the infinite data limit [Tsipras et al., 2018, Fawzi et al., 2018, Zhang et al., 2019]. For example, Min et al. [2021] proved in the robust linear classification regime that (i) more data improves generalization in a weak adversary regime, (ii) more data can improve generalization up to a point where additional data starts to hurt generalization in a medium adversary regime, and that (iii) more data immediately decreases generalization error in a strong adversary regime.
|
| 120 |
+
|
| 121 |
+
# 3.4 Class-Dependent Data-Augmentation Seems Insufficient for Performance Recovery
|
| 122 |
+
|
| 123 |
+
We observed in Section 2 that DA could lead to disastrous per-class performances on a minority of classes. We now propose to implement one solution from Section 3.3 that consists in simply not applying the harmful DA to the classes suffering from it. As will become clear, applying the DA on all other classes will be enough to skew the training of the model preventing any performing recovery on those classes.
|
| 124 |
+
|
| 125 |
+
To motivate the need for a better control of the per-class performance of a model, we first present an illustrative argument. A standard resnet50 on Imagenet reaches $7 7 . 1 4 \%$ top-1 with a random crop lower bound of $8 \%$ . Using precise cross-validation, one could reach 77.29 by using a random crop lower bound of $1 0 \%$ instead of $8 \%$ on all classes. Yet, and most interestingly, if one were able to get the best per-class performance —as per varying the lower-bound as in Fig. 2 and picking for each class the best per-class performance of any of the models— one could reach 79.37. Beyond pure average test performance, controlling the worst-case per-class performance is of crucial importance for fairness [Du et al., 2020, Veitch et al., 2021]. We thus explore one of the solution that we reviewed in Section 3.3 that consists in only applying the random crop DA to the classes whose test performances increased with the DA’s level. We obtain in Fig. 7 that such class-specific strategy is not sufficient to guarantee that the classes negatively impacted by the random crop DA see their performance to be constant across the DA level applied to all the other classes. This finding is also supported by our weight decay experiment in Figs. 3 and 16 in which the regularization of the DN impacted classes differently. In fact, first notice that applying weight decay only when seeing some specific classes would simply amount (on average) to reducing the weight decay hyper-parameter proportionally to how many classes are considered to be without regularization. In a similar fashion, DA produces an implicit regularizer [Balestriero et al., 2022] and applying a class-specific DA level reduces the impact of the implicit regularizer. But since the amount of classes for which we do not apply random crop is quite small compared to the total number of classes (between $1 \%$ and $5 \%$ ), it means that the DA’s implicit regularizer remains nearly the same and thus the model’s bias is nearly the same regardless if that DA is applied or not onto those classes. This is what we observe, applying the random crop DA to the classes that benefit from it is enough to bias the model and degrade the performances on some classes at the same pace than when applying the DA to all classes unconditionally (compare Figs. 2 and 7).
|
| 126 |
+
|
| 127 |
+
As a result, we observe that no readily and easily implemented solution provides us with a strategy to prevent deep learning to fall into the scenario depicted on the left of Fig. 1. Those findings however motivate the search of novel model complexity controls that is fair among classes. From a more theoretical viewpoint, it might also be possible to better understand if even such a fair per-class model complexity could exist, which is not clear as natural image classes tend to have inherently different statistics.
|
| 128 |
+
|
| 129 |
+
# 4 Conclusions and Limitations
|
| 130 |
+
|
| 131 |
+
We proposed in this study to understand the impact of regularization, in particular data-augmentation and weight decay, into the final performances of a deep network. We obtained that the use of regularization increases the average test performances at the cost of significant performance drops on some specific classes. By focusing on maximizing aggregate performance statistics we have produced learning mechanisms that can be potentially harmful, especially in transfer learning tasks. In fact, we have also observed that varying the amount of regularization employed during pre-training of a specific dataset impacts the per-class performances of that pre-trained model on different downstream tasks e.g. going from Imagenet to INaturalist. Lastly, commonly prescribed solutions e.g. classdependent data-augmentation do not seem to help indicating that the sole use of an augmentation on some classes is enough to bias the model on all classes. Hence, there remains a vast research area to explore in order to turn deep learning model selection from the current regime to a more ideal one (left to right of Fig. 1).
|
| 132 |
+
|
| 133 |
+
The main limitation of this work is its focus on computer vision datasets and models. It is possible that our observation will be further conveyed in other regimes or not, and we leave such analysis for future work.
|
| 134 |
+
|
| 135 |
+
References
|
| 136 |
+
Martin Arjovsky, Léon Bottou, Ishaan Gulrajani, and David Lopez-Paz. Invariant risk minimization. arXiv preprint arXiv:1907.02893, 2019.
|
| 137 |
+
Randall Balestriero, Ishan Misra, and Yann LeCun. A data-augmentation is worth a thousand samples: Exact quantification from analytical augmented sample moments. arXiv preprint arXiv:2202.08325, 2022.
|
| 138 |
+
Dimitri P Bertsekas. Constrained optimization and Lagrange multiplier methods. Academic press, 2014.
|
| 139 |
+
Christopher M Bishop and Nasser M Nasrabadi. Pattern recognition and machine learning, volume 4. Springer, 2006.
|
| 140 |
+
Léon Bottou. Stochastic gradient descent tricks. In Neural networks: Tricks of the trade, pages 421–436. Springer, 2012.
|
| 141 |
+
George EP Box and George C Tiao. Bayesian inference in statistical analysis, volume 40. John Wiley & Sons, 2011.
|
| 142 |
+
Olivier Chapelle, Jason Weston, Léon Bottou, and Vladimir Vapnik. Vicinal risk minimization. Advances in neural information processing systems, 13, 2000.
|
| 143 |
+
Shuxiao Chen, Edgar Dobriban, and Jane Lee. A group-theoretic framework for data augmentation. Advances in Neural Information Processing Systems, 33:21321–21333, 2020a.
|
| 144 |
+
Xinlei Chen, Haoqi Fan, Ross Girshick, and Kaiming He. Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297, 2020b.
|
| 145 |
+
Xiaodong Cui, Vaibhava Goel, and Brian Kingsbury. Data augmentation for deep neural network acoustic modeling. IEEE/ACM Transactions on Audio, Speech, and Language Processing, 23(9):1469–1477, 2015.
|
| 146 |
+
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.
|
| 147 |
+
Mengnan Du, Fan Yang, Na Zou, and Xia Hu. Fairness in deep learning: A computational perspective. IEEE Intelligent Systems, 36(4):25–34, 2020.
|
| 148 |
+
Alhussein Fawzi, Omar Fawzi, and Pascal Frossard. Analysis of classifiers’ robustness to adversarial perturbations. Machine learning, 107(3):481–508, 2018.
|
| 149 |
+
Ronald Fisher. Statistical methods and scientific induction. Journal of the Royal Statistical Society: Series B (Methodological), 17(1):69–78, 1955.
|
| 150 |
+
Ian Goodfellow, Yoshua Bengio, and Aaron Courville. Deep learning. MIT press, 2016.
|
| 151 |
+
Marvin HJ Gruber. Improving efficiency by shrinkage: The James-Stein and ridge regression estimators. Routledge, 2017.
|
| 152 |
+
Xifeng Guo, En Zhu, Xinwang Liu, and Jianping Yin. Deep embedded clustering with data augmentation. In Asian conference on machine learning, pages 550–565. PMLR, 2018.
|
| 153 |
+
Trevor Hastie, Robert Tibshirani, Jerome H Friedman, and Jerome H Friedman. The elements of statistical learning: data mining, inference, and prediction, volume 2. Springer, 2009.
|
| 154 |
+
Xin He, Kaiyong Zhao, and Xiaowen Chu. Automl: A survey of the state-of-the-art. Knowledge-Based Systems, 212:106622, 2021.
|
| 155 |
+
Alex Hernández-García and Peter König. Data augmentation instead of explicit regularization. arXiv preprint arXiv:1806.03852, 2018.
|
| 156 |
+
Sara Hooker, Aaron Courville, Gregory Clark, Yann Dauphin, and Andrea Frome. What do compressed deep neural networks forget? arXiv preprint arXiv:1911.05248, 2019.
|
| 157 |
+
Sara Hooker, Nyalleng Moorosi, Gregory Clark, Samy Bengio, and Emily Denton. Characterising bias in compressed models. arXiv preprint arXiv:2010.03058, 2020.
|
| 158 |
+
Mengxiao Hu and Jinlong Li. Exploring bias in gan-based data augmentation for small samples. arXiv preprint arXiv:1905.08495, 2019.
|
| 159 |
+
|
| 160 |
+
Gao Huang, Shichen Liu, Laurens Van der Maaten, and Kilian Q Weinberger. Condensenet: An efficient densenet using learned group convolutions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2752–2761, 2018.
|
| 161 |
+
|
| 162 |
+
Like Hui and Mikhail Belkin. Evaluation of neural architectures trained with square loss vs cross-entropy in classification tasks. arXiv preprint arXiv:2006.07322, 2020.
|
| 163 |
+
|
| 164 |
+
Maximilian Ilse, Jakub M Tomczak, and Patrick Forré. Selecting data augmentation for simulating interventions. In International Conference on Machine Learning, pages 4555–4562. PMLR, 2021.
|
| 165 |
+
|
| 166 |
+
Vasileios Iosifidis and Eirini Ntoutsi. Dealing with bias via data augmentation in supervised learning scenarios. Jo Bates Paul D. Clough Robert Jäschke, 24, 2018.
|
| 167 |
+
|
| 168 |
+
Nikita Jaipuria, Xianling Zhang, Rohan Bhasin, Mayar Arafa, Punarjay Chakravarty, Shubham Shrivastava, Sagar Manglani, and Vidya N Murali. Deflating dataset bias using synthetic data augmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops, pages 772–773, 2020.
|
| 169 |
+
|
| 170 |
+
Michael I Jordan and Tom M Mitchell. Machine learning: Trends, perspectives, and prospects. Science, 349 (6245):255–260, 2015.
|
| 171 |
+
|
| 172 |
+
Marius Kloft, Ulf Brefeld, Pavel Laskov, Klaus-Robert Müller, Alexander Zien, and Sören Sonnenburg. Efficient and accurate lp-norm multiple kernel learning. In Y. Bengio, D. Schuurmans, J. Lafferty, C. Williams, and A. Culotta, editors, Advances in Neural Information Processing Systems, volume 22. Curran Associates, Inc., 2009. URL https://proceedings.neurips.cc/paper/2009/file/ d516b13671a4179d9b7b458a6ebdeb92-Paper.pdf.
|
| 173 |
+
|
| 174 |
+
Ron Kohavi, David H Wolpert, et al. Bias plus variance decomposition for zero-one loss functions. In ICML, volume 96, pages 275–83, 1996.
|
| 175 |
+
|
| 176 |
+
Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. Advances in neural information processing systems, 25, 2012.
|
| 177 |
+
|
| 178 |
+
Anders Krogh and John Hertz. A simple weight decay can improve generalization. Advances in neural information processing systems, 4, 1991.
|
| 179 |
+
|
| 180 |
+
Guillaume Leclerc, Andrew Ilyas, Logan Engstrom, Sung Min Park, Hadi Salman, and Aleksander Madry. ffcv. https://github.com/libffcv/ffcv/, 2022.
|
| 181 |
+
|
| 182 |
+
Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
|
| 183 |
+
|
| 184 |
+
Daniel LeJeune, Randall Balestriero, Hamid Javadi, and Richard G Baraniuk. Implicit rugosity regularization via data augmentation. arXiv preprint arXiv:1905.11639, 2019.
|
| 185 |
+
|
| 186 |
+
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.
|
| 187 |
+
|
| 188 |
+
Zhuang Liu, Hanzi Mao, Chao-Yuan Wu, Christoph Feichtenhofer, Trevor Darrell, and Saining Xie. A convnet for the 2020s. arXiv preprint arXiv:2201.03545, 2022.
|
| 189 |
+
|
| 190 |
+
Niall McLaughlin, Jesus Martinez Del Rincon, and Paul Miller. Data-augmentation for reducing dataset bias in person re-identification. In 2015 12th IEEE International conference on advanced video and signal based surveillance (AVSS), pages 1–6. IEEE, 2015.
|
| 191 |
+
|
| 192 |
+
Yifei Min, Lin Chen, and Amin Karbasi. The curious case of adversarially robust models: More data can help, double descend, or hurt generalization. In Uncertainty in Artificial Intelligence, pages 129–139. PMLR, 2021.
|
| 193 |
+
|
| 194 |
+
Ishan Misra and Laurens van der Maaten. Self-supervised learning of pretext-invariant representations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 6707–6717, 2020.
|
| 195 |
+
|
| 196 |
+
Jerzy Neyman and Egon Sharpe Pearson. Ix. on the problem of the most efficient tests of statistical hypotheses. Philosophical Transactions of the Royal Society of London. Series A, Containing Papers of a Mathematical or Physical Character, 231(694-706):289–337, 1933.
|
| 197 |
+
|
| 198 |
+
Behnam Neyshabur, Ryota Tomioka, and Nathan Srebro. In search of the real inductive bias: On the role of implicit regularization in deep learning. arXiv preprint arXiv:1412.6614, 2014.
|
| 199 |
+
|
| 200 |
+
Sinno Jialin Pan and Qiang Yang. A survey on transfer learning. IEEE Transactions on knowledge and data engineering, 22(10):1345–1359, 2009.
|
| 201 |
+
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.
|
| 202 |
+
Ekachai Phaisangittisagul. An analysis of the regularization between l2 and dropout in single hidden layer neural network. In 2016 7th International Conference on Intelligent Systems, Modelling and Simulation (ISMS), pages 174–179. IEEE, 2016.
|
| 203 |
+
Aditi Raghunathan, Sang Michael Xie, Fanny Yang, John Duchi, and Percy Liang. Understanding and mitigating the tradeoff between robustness and accuracy. arXiv preprint arXiv:2002.10716, 2020.
|
| 204 |
+
Connor Shorten and Taghi M Khoshgoftaar. A survey on image data augmentation for deep learning. Journal of big data, 6(1):1–48, 2019.
|
| 205 |
+
Patrice Simard, Bernard Victorri, Yann LeCun, and John Denker. Tangent prop-a formalism for specifying selected invariances in an adaptive network. Advances in neural information processing systems, 4, 1991.
|
| 206 |
+
Mingxing Tan and Quoc Le. Efficientnetv2: Smaller models and faster training. In International Conference on Machine Learning, pages 10096–10106. PMLR, 2021.
|
| 207 |
+
Luke Taylor and Geoff Nitschke. Improving deep learning with generic data augmentation. In 2018 IEEE Symposium Series on Computational Intelligence (SSCI), pages 1542–1547. IEEE, 2018.
|
| 208 |
+
Andrei Nikolajevits Tihonov. Solution of incorrectly formulated problems and the regularization method. Soviet Math., 4:1035–1038, 1963.
|
| 209 |
+
Andrey Nikolayevich Tikhonov. On the stability of inverse problems. In Dokl. Akad. Nauk SSSR, volume 39, pages 195–198, 1943.
|
| 210 |
+
Dimitris Tsipras, Shibani Santurkar, Logan Engstrom, Alexander Turner, and Aleksander Madry. Robustness may be at odds with accuracy. arXiv preprint arXiv:1805.12152, 2018.
|
| 211 |
+
Giorgio Valentini and Thomas G Dietterich. Bias-variance analysis of support vector machines for the development of svm-based ensemble methods. Journal of Machine Learning Research, 5(Jul):725–775, 2004.
|
| 212 |
+
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 Proceedings of the IEEE conference on computer vision and pattern recognition, pages 8769–8778, 2018.
|
| 213 |
+
Vladimir N Vapnik and A Ya Chervonenkis. On the uniform convergence of relative frequencies of events to their probabilities. In Measures of complexity, pages 11–30. Springer, 2015.
|
| 214 |
+
VN Vapnik and A Ya Chervonenkis. The method of ordered risk minimization, i. Avtomatika i Telemekhanika, 8:21–30, 1974.
|
| 215 |
+
Victor Veitch, Alexander D’Amour, Steve Yadlowsky, and Jacob Eisenstein. Counterfactual invariance to spurious correlations in text classification. Advances in Neural Information Processing Systems, 34:16196–16208, 2021.
|
| 216 |
+
Vikas Verma, Alex Lamb, Christopher Beckham, Amir Najafi, Ioannis Mitliagkas, David Lopez-Paz, and Yoshua Bengio. Manifold mixup: Better representations by interpolating hidden states. In International Conference on Machine Learning, pages 6438–6447. PMLR, 2019.
|
| 217 |
+
Ulrike Von Luxburg and Bernhard Schölkopf. Statistical learning theory: Models, concepts, and results. In Handbook of the History of Logic, volume 10, pages 651–706. Elsevier, 2011.
|
| 218 |
+
Bernard L Welch. The generalization of ‘student’s’problem when several different population varlances are involved. Biometrika, 34(1-2):28–35, 1947.
|
| 219 |
+
Qizhe Xie, Zihang Dai, Eduard Hovy, Thang Luong, and Quoc Le. Unsupervised data augmentation for consistency training. Advances in Neural Information Processing Systems, 33:6256–6268, 2020.
|
| 220 |
+
Yi Xu, Asaf Noy, Ming Lin, Qi Qian, Hao Li, and Rong Jin. Wemix: How to better utilize data augmentation. arXiv preprint arXiv:2010.01267, 2020.
|
| 221 |
+
|
| 222 |
+
Sangdoo Yun, Dongyoon Han, Seong Joon Oh, Sanghyuk Chun, Junsuk Choe, and Youngjoon Yoo. Cutmix: Regularization strategy to train strong classifiers with localizable features. In Proceedings of the IEEE/CVF international conference on computer vision, pages 6023–6032, 2019.
|
| 223 |
+
|
| 224 |
+
Hongyang Zhang, Yaodong Yu, Jiantao Jiao, Eric Xing, Laurent El Ghaoui, and Michael Jordan. Theoretically principled trade-off between robustness and accuracy. In International conference on machine learning, pages 7472–7482. PMLR, 2019.
|
| 225 |
+
|
| 226 |
+
Hongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. arXiv preprint arXiv:1710.09412, 2017.
|
| 227 |
+
|
| 228 |
+
# Checklist
|
| 229 |
+
|
| 230 |
+
1. For all authors...
|
| 231 |
+
|
| 232 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 233 |
+
(b) Did you describe the limitations of your work? [N/A] We do not propose a novel method that requires such discussion
|
| 234 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] We carefully described why the observations we have made can be dangerous for real world applications
|
| 235 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 236 |
+
|
| 237 |
+
2. If you are including theoretical results...
|
| 238 |
+
|
| 239 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] Our only “theoretical result” consists in a formal statistical test for which we precisely describe our settings and statistics
|
| 240 |
+
(b) Did you include complete proofs of all theoretical results? [N/A] No theoretical result requiring proofs was provided
|
| 241 |
+
|
| 242 |
+
3. If you ran experiments...
|
| 243 |
+
|
| 244 |
+
(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] We include summary statistics in the supplementary material which is enough to validate our claims. The full codebase and all the saved models will be released upon completion of the review process (this includes almost a thousand pre-trained resnet50s)
|
| 245 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] We specify within each caption the key experimental setups, additional training details are provided in the appendix
|
| 246 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] we averaged all of our runs over a significant amount of realizations (20) and perform a formal statistical test on the significance of our results
|
| 247 |
+
(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 provide this in the beginning of the appendix. Note that we will be providing the saved models and summary statistics to make the results easily reproducible even without GPU or computation ressources.
|
| 248 |
+
|
| 249 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 250 |
+
|
| 251 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes] For Imagenet and INaturalist
|
| 252 |
+
(b) Did you mention the license of the assets? [Yes] the full code will be released with a NC by NC license on GitHub
|
| 253 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] we include summary result files that contain all the statistics to reproduce the main claims of the paper in the supplementary material. The full codebase along with pre-trained models will be released upon completion of the review process.
|
| 254 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] We are only using the Imagenet and INaturalist datasets
|
| 255 |
+
|
| 256 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] We are only using the Imagenet and INaturalist datasets
|
| 257 |
+
|
| 258 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 259 |
+
|
| 260 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 261 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 262 |
+
(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/LQnyIk5dUA/LQnyIk5dUA.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/Nayau9fwXU/Nayau9fwXU.md
ADDED
|
@@ -0,0 +1,483 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DIFFUSION-BASED IMAGE TRANSLATION USING DIS-ENTANGLED STYLE AND CONTENT REPRESENTATION
|
| 2 |
+
|
| 3 |
+
Gihyun Kwon1, Jong Chul $\mathbf { Y } \mathbf { e } ^ { 2 , 1 }$
|
| 4 |
+
Department of Bio and Brain Engineering1, Kim Jaechul Graduate School of $\mathsf { A I } ^ { 2 }$ , KAIST
|
| 5 |
+
cyclomon,jong.ye@kaist.ac.kr
|
| 6 |
+
|
| 7 |
+

|
| 8 |
+
Figure 1: Image translation results by DiffuseIT. Our model can generate high-quality translation outputs using both text and image conditions. More results can be found in the experiment section.
|
| 9 |
+
|
| 10 |
+
# ABSTRACT
|
| 11 |
+
|
| 12 |
+
Diffusion-based image translation guided by semantic texts or a single target image has enabled flexible style transfer which is not limited to the specific domains. Unfortunately, due to the stochastic nature of diffusion models, it is often difficult to maintain the original content of the image during the reverse diffusion. To address this, here we present a novel diffusion-based unsupervised image translation method, dubbed as DiffuseIT, using disentangled style and content representation. Specifically, inspired by the slicing Vision Transformer (Tumanyan et al., 2022), we extract intermediate keys of multihead self attention layer from ViT model and used them as the content preservation loss. Then, an image guided style transfer is performed by matching the [CLS] classification token from the denoised samples and target image, whereas additional CLIP loss is used for the text-driven style transfer. To further accelerate the semantic change during the reverse diffusion, we also propose a novel semantic divergence loss and resampling strategy. Our experimental results show that the proposed method outperforms state-of-the-art baseline models in both text-guided and image-guided translation tasks.
|
| 13 |
+
|
| 14 |
+
# 1 INTRODUCTION
|
| 15 |
+
|
| 16 |
+
Image translation is a task in which the model receives an input image and converts it into a target domain. Early image translation approaches (Zhu et al., 2017; Park et al., 2020; Isola et al., 2017) were mainly designed for single domain translation, but soon extended to multi-domain translation (Choi et al., 2018; Lee et al., 2019). As these methods demand large training set for each domain, image translation approaches using only a single image pairs have been studied, which include the one-to-one image translation using multiscale training (Lin et al., 2020), or patch matching strategy (Granot et al., 2022; Kolkin et al., 2019). Most recently, Splicing ViT (Tumanyan et al., 2022) exploits a pre-trained DINO ViT (Caron et al., 2021) to convert the semantic appearance of a given image into a target domain while maintaining the structure of input image.
|
| 17 |
+
|
| 18 |
+
On the other hand, by employing the recent text-to-image embedding model such as CLIP (Radford et al., 2021), several approaches have attempted to generate images conditioned on text prompts (Patashnik et al., 2021; Gal et al., 2021; Crowson et al., 2022; Couairon et al., 2022). As these methods rely on Generative Adversarial Networks (GAN) as a backbone generative model, the semantic changes are not often properly controlled when applied to an out-of-data (OOD) image generation.
|
| 19 |
+
|
| 20 |
+
Recently, score-based generative models (Ho et al., 2020; Song et al., 2020b; Nichol & Dhariwal, 2021) have demonstrated state-of-the-art performance in text-conditioned image generation (Ramesh et al., 2022; Saharia et al., 2022b; Crowson, 2022; Avrahami et al., 2022). However, when it comes to the image translation scenario in which multiple conditions (e.g. input image, text condition) are given to the score based model, disentangling and separately controlling the components still remains as an open problem.
|
| 21 |
+
|
| 22 |
+
In fact, one of the most important open questions in image translation by diffusion models is to transform only the semantic information (or style) while maintaining the structure information (or content) of the input image. Although this could not be an issue with the conditional diffusion models trained with matched input and target domain images (Saharia et al., 2022a), such training is impractical in many image translation tasks (e.g. summer-to-winter, horse-to-zebra translation). On the other hand, existing methods using unconditional diffusion models often fail to preserve content information due to the entanglement problems in which semantic and content change at the same time (Avrahami et al., 2022; Crowson, 2022). DiffusionCLIP (Kim et al., 2022) tried to address this problem using denoising diffusion implicit models (DDIM) (Song et al., 2020a) and pixel-wise loss, but the score function needs to be fine-tuned for a novel target domain, which is computationally expensive.
|
| 23 |
+
|
| 24 |
+
In order to control the diffusion process in such a way that it produces the output that simultaneously retain the content of the input image and follow the semantics of the target text or image, here we introduce a loss function using a pre-trained Vision Transformer (ViT) (Dosovitskiy et al., 2020). Specifically, inspired by the recent idea (Tumanyan et al., 2022), we extract intermediate keys of multihead self attention layer and [CLS] classification tokens of the last layer from the DINO ViT model and used them as our content and style regularization, respectively. More specifically, to preserve the structural information, we use the similarity and contrastive loss between intermediate keys of the input and denoised image during the sampling. Then, an image guided style transfer is performed by matching the [CLS] token between the denoised sample and the target domain, whereas additional CLIP loss is used for the text-driven style transfer. To further improve the sampling speed, we propose a novel semantic divergence loss and resampling strategy.
|
| 25 |
+
|
| 26 |
+
Extensive experimental results including Fig. 1 confirmed that our method provide state-of-the-art performance in both text- and image- guided style transfer tasks quantitatively and qualitatively. To our best knowledge, this is the first unconditional diffusion model-based image translation method that allows both text- and image- guided style transfer without altering input image content.
|
| 27 |
+
|
| 28 |
+
# 2 RELATED WORK
|
| 29 |
+
|
| 30 |
+
Text-guided image synthesis. Thanks to the outstanding performance of text-to-image alignment in the feature space, CLIP has been widely used in various text-related computer vision tasks including object generation (Liu et al., 2021; Wang et al., 2022a), style transfer (Kwon & Ye, 2021; Fu et al., 2021), object segmentation (Luddecke & Ecker, 2022; Wang et al., 2022b), etc. Several recent ¨ approaches also demonstrated state-of-the-art performance in text-guided image manipulation task by combining the CLIP with image generation models. Previous approaches leverage pre-trained StyleGAN (Karras et al., 2020) for image manipulation with a text condition (Patashnik et al., 2021; Gal et al., 2021; Wei et al., 2022). However, StyleGAN-based methods cannot be used in arbitrary natural images since it is restricted to the pre-trained data domain. Pre-trained VQGAN (Esser et al., 2021) was proposed for better generalization capability in the image manipulation, but it often suffers from poor image quality due to limited power of the backbone model.
|
| 31 |
+
|
| 32 |
+
With the advance of score-based generative models such as Denoising Diffusion Probabilistic Model (DDPM) (Ho et al., 2020), several methods (Ramesh et al., 2022; Saharia et al., 2022b) tried to generate photo-realistic image samples with given text conditions. However, these approaches are not adequate for image translation framework as the text condition and input image are not usually disentangled. Although DiffusionCLIP (Kim et al., 2022) partially solves the problem using DDIM sampling and pixelwise regularization during the reverse diffusion, it has major disadvantage in that it requires fine-tuning process of score models. As a concurrent work, DDIB(Su et al., 2022) proposed diffusion model based image translation using deterministic probability flow ODE formulation.
|
| 33 |
+
|
| 34 |
+
Single-shot Image Translation. In image translation using single target image, early models mainly focused on image style transfer (Gatys et al., 2016; Huang & Belongie, 2017; Park & Lee, 2019; Yoo et al., 2019). Afterwards, methods using StyleGAN adaptation (Ojha et al., 2021; Zhu et al., 2021; Kwon & Ye, 2022; Chong & Forsyth, 2021) showed great performance, but there are limitations as the models are domain-specific (e.g. human faces). In order to overcome this, methods for converting unseen image into a semantic of target (Lin et al., 2020; Kolkin et al., 2019; Granot et al., 2022) have been proposed, but these methods often suffer from degraded image quality. Recently, Splicing ViT (Tumanyan et al., 2022) successfully exploited pre-trained DINO ViT(Caron et al., 2021) to convert the semantic appearance of given image into target domain while preserving the structure of input.
|
| 35 |
+
|
| 36 |
+
# 3 PROPOSED METHOD
|
| 37 |
+
|
| 38 |
+
# 3.1 DDPM SAMPLING WITH MANIFOLD CONSTRAINT
|
| 39 |
+
|
| 40 |
+
In DDPMs (Ho et al., 2020), starting from a clean image ${ \pmb x } _ { 0 } \sim { \pmb q } ( { \pmb x } _ { 0 } )$ , a forward diffusion process $q ( { \pmb x } _ { t } | { \pmb x } _ { t - 1 } )$ is described as a Markov chain that gradually adds Gaussian noise at every time steps $t$ :
|
| 41 |
+
|
| 42 |
+
$$
|
| 43 |
+
q ( \pmb { x } _ { T } | \pmb { x } _ { 0 } ) : = \prod _ { t = 1 } ^ { T } q ( \pmb { x } _ { t } | \pmb { x } _ { t - 1 } ) , \quad \mathrm { w h e r e } \quad q ( \pmb { x } _ { t } | \pmb { x } _ { t - 1 } ) : = \mathcal { N } ( \pmb { x } _ { t } ; \sqrt { 1 - \beta _ { t } } \pmb { x } _ { t - 1 } , \beta _ { t } I ) ,
|
| 44 |
+
$$
|
| 45 |
+
|
| 46 |
+
where $\{ \beta \} _ { t = 0 } ^ { T }$ is a variance schedule. By denoting $\alpha _ { t } : = 1 - \beta _ { t }$ and $\textstyle { \bar { \alpha _ { t } } } : = \prod _ { s = 1 } ^ { t } \alpha _ { s }$ , the forward diffused sample at $t$ , i.e. $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ , can be sampled in one step as:
|
| 47 |
+
|
| 48 |
+
$$
|
| 49 |
+
\begin{array} { r } { \pmb { x } _ { t } = \sqrt { \bar { \alpha } _ { t } } \pmb { x } _ { 0 } + \sqrt { 1 - \bar { \alpha } _ { t } } \pmb { \epsilon } , \quad \mathrm { w h e r e } \quad \epsilon \sim \mathcal { N } ( \mathbf { 0 } , I ) . } \end{array}
|
| 50 |
+
$$
|
| 51 |
+
|
| 52 |
+
As the reverse of the forward step $q ( \pmb { x } _ { t - 1 } | \pmb { x } _ { t } )$ is intractable, DDPM learns to maximize the variational lowerbound through a parameterized Gaussian transitions $p _ { \theta } ( \pmb { x } _ { t - 1 } | \pmb { x } _ { t } )$ with the parameter $\theta$ . Accordingly, the reverse process is approximated as Markov chain with learned mean and fixed variance, starting from $p ( { \bf x } _ { T } ) = \mathcal { N } ( { \bf x } _ { T } ; \bar { \bf 0 } , I )$ :
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
p _ { \theta } ( \boldsymbol { x } _ { 0 : T } ) : = p _ { \theta } ( \boldsymbol { x } _ { T } ) \prod _ { t = 1 } ^ { T } p _ { \theta } ( \boldsymbol { x } _ { t - 1 } | \boldsymbol { x } _ { t } ) , \quad \mathrm { w h e r e } \quad p _ { \theta } ( \boldsymbol { x } _ { t - 1 } | \boldsymbol { x } _ { t } ) : = \mathcal { N } ( \boldsymbol { x } _ { t - 1 } ; \boldsymbol { \mu } _ { \theta } ( \boldsymbol { x } _ { t } , t ) , \sigma _ { t } ^ { 2 } I ) .
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
where
|
| 59 |
+
|
| 60 |
+
$$
|
| 61 |
+
\pmb { \mu } _ { \theta } ( \pmb { x } _ { t } , t ) : = \frac { 1 } { \sqrt { \alpha _ { t } } } \bigg ( \pmb { x } _ { t } - \frac { 1 - \alpha _ { t } } { \sqrt { 1 - \bar { \alpha } _ { t } } } \pmb { \epsilon } _ { \theta } ( \pmb { x } _ { t } , t ) \bigg ) ,
|
| 62 |
+
$$
|
| 63 |
+
|
| 64 |
+
Here, $\epsilon _ { \theta } ( x _ { t } , t )$ is the diffusion model trained by optimizing the objective:
|
| 65 |
+
|
| 66 |
+
$$
|
| 67 |
+
\operatorname* { m i n } _ { \theta } L ( \theta ) , \quad \mathrm { w h e r e } \quad L ( \theta ) : = \mathbb { E } _ { t , x _ { 0 } , \epsilon } \Bigl [ \| \epsilon - \epsilon _ { \theta } \bigl ( \sqrt { \bar { \alpha } _ { t } } x _ { 0 } + \sqrt { 1 - \bar { \alpha } _ { t } } \epsilon , t \bigr ) \| ^ { 2 } \Bigr ] .
|
| 68 |
+
$$
|
| 69 |
+
|
| 70 |
+
After the optimization, by plugging learned score function into the generative (or reverse) diffusion process, one can simply sample from $p _ { \theta } ( \pmb { x } _ { t - 1 } | \pmb { x } _ { t } )$ by
|
| 71 |
+
|
| 72 |
+
$$
|
| 73 |
+
{ \pmb x } _ { t - 1 } = { \pmb \mu } _ { \theta } ( { \pmb x } _ { t } , t ) + \sigma _ { t } { \pmb \epsilon } = \frac { 1 } { \sqrt { \alpha _ { t } } } \bigg ( { \pmb x } _ { t } - \frac { 1 - \alpha _ { t } } { \sqrt { 1 - \bar { \alpha } _ { t } } } { \pmb \epsilon } _ { \theta } ( { \pmb x } _ { t } , t ) \bigg ) + \sigma _ { t } { \pmb \epsilon }
|
| 74 |
+
$$
|
| 75 |
+
|
| 76 |
+
In image translation using conditional diffusion models (Saharia et al., 2022a; Sasaki et al., 2021),√ the diffusion model $\epsilon _ { \theta }$ in (5) and (6) should be replaced with $\epsilon _ { \theta } ( { \pmb y } , \sqrt { \bar { \alpha } _ { t } } { \pmb x } _ { 0 } + \sqrt { 1 - \bar { \alpha } _ { t } } { \epsilon } , t )$ where $\textbf { { y } }$ denotes the matched target image. Accordingly, the sample generation is tightly controlled by the matched target in a supervised manner, so that the image content change rarely happen. Unfortunately, the requirement of the matched targets for the training makes this approach impractical.
|
| 77 |
+
|
| 78 |
+
To address this, Dhariwal & Nichol (2021) proposed classifier-guided image translation using the unconditional diffusion model training as in (5) and a pre-trained classifier $p _ { \phi } ( \pmb { y } | \pmb { x } _ { t } )$ . Specifically, $\mu _ { \theta } ( x _ { t } , t )$ in (4) and (6) are supplemented with the gradient of the classifier, i.e. $\hat { \mu } _ { \boldsymbol { \theta } } ( \mathbf { { x } } _ { t } , t ) : =$ $\begin{array} { r } { \pmb { \mu _ { \boldsymbol { \theta } } } ( \pmb { x } _ { t } , t ) + \sigma _ { t } \nabla _ { \pmb { x } _ { t } } \log p _ { \phi } ( \pmb { y } | \pmb { x } _ { t } ) } \end{array}$ . However, most of the classifiers, which should be separately trained, are not usually sufficient to control the content of the samples from the reverse diffusion process.
|
| 79 |
+
|
| 80 |
+

|
| 81 |
+
Figure 2: Given the input image $\pmb { x } _ { s r c }$ , we guide the reverse diffusion process $\{ \pmb { x } _ { t } \} _ { t = T } ^ { 0 }$ using various losses. (a) $\ell _ { c o n t }$ : the structural similarity loss between input and outputs in terms of contrastive loss between extracted keys from ViT. (b) $\ell _ { C L I P }$ : relative distance to the target text $\mathbf { \delta } d _ { t r g }$ in CLIP space in terms of $\mathbf { \delta } _ { \mathbf { \mathcal { X } } _ { s r c } }$ and $\pmb { d } _ { s r c }$ . (c) $\ell _ { s t y }$ : the [CLS] token distances between the outputs and target $\mathbf { \Delta } _ { \pmb { x } _ { t r g } }$ . (d) $\ell _ { s e m }$ : dissimilarity between the [CLS] token from the present and past denoised samples.
|
| 82 |
+
|
| 83 |
+
Inspired by the recent manifold constrained gradient (MCG) for inverse problems (Chung et al., 2022a), here we formulate our content and style guidance problem as an inverse problem, which can be solved by minimizing the following total cost function with respect to the sample $_ { \textbf { \em x } }$ :
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
\begin{array} { r } { \ell _ { t o t a l } ( { \pmb x } ; { \pmb x } _ { t r g } , { \pmb x } _ { s r c } ) , \quad \mathrm { o r } \quad \ell _ { t o t a l } ( { \pmb x } ; { \pmb d } _ { t r g } , { \pmb x } _ { s r c } , { \pmb d } _ { s r c } ) } \end{array}
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
where $\pmb { x } _ { s r c }$ and $\pmb { x } _ { t r g }$ refer to the source and target images, respectively; and $\pmb { d } _ { s r c }$ and $\mathbf { \delta } d _ { t r g }$ refer to the source and target text, respectively. In our paper, the first form of the total loss in (7) is used for image-guided translation, where the second form is for the text-guided translation. Then, the sampling from the reverse diffusion with MCG is given by
|
| 90 |
+
|
| 91 |
+
$$
|
| 92 |
+
\begin{array} { l l l } { \displaystyle { \boldsymbol { x } _ { t - 1 } ^ { \prime } = \frac { 1 } { \sqrt { \alpha _ { t } } } \Big ( \boldsymbol { x } _ { t } - \frac { 1 - \alpha _ { t } } { \sqrt { 1 - \bar { \alpha } _ { t } } } \epsilon _ { \theta } \big ( \boldsymbol { x } _ { t } , t \big ) \Big ) + \sigma _ { t } \epsilon } } \\ { \displaystyle { \boldsymbol { x } _ { t - 1 } = \boldsymbol { x } _ { t - 1 } ^ { \prime } - \nabla _ { \boldsymbol { x } _ { t } } \ell _ { t o t a l } \big ( \hat { \boldsymbol { x } } _ { 0 } \big ( \boldsymbol { x } _ { t } \big ) \big ) } } \end{array}
|
| 93 |
+
$$
|
| 94 |
+
|
| 95 |
+
where $\hat { \pmb { x } } _ { 0 } ( { \pmb x } _ { t } )$ refers to the estimated clean image from the sample $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ using the Tweedie’s formula (Kim & Ye, 2021):
|
| 96 |
+
|
| 97 |
+
$$
|
| 98 |
+
\hat { \pmb { x } } _ { 0 } ( \pmb { x } _ { t } ) : = \frac { \pmb { x } _ { t } } { \sqrt { \bar { \alpha } _ { t } } } - \frac { \sqrt { 1 - \bar { \alpha } _ { t } } } { \sqrt { \bar { \alpha } _ { t } } } \pmb { \epsilon } _ { \theta } ( \pmb { x } _ { t } , t ) .
|
| 99 |
+
$$
|
| 100 |
+
|
| 101 |
+
In the following, we describe how the total loss $\ell _ { t o t a l }$ is defined. For brevity, we notate $\hat { \pmb { x } } _ { 0 } ( { \pmb x } _ { t } )$ as $_ { \textbf { \em x } }$ in the following sections.
|
| 102 |
+
|
| 103 |
+
# 3.2 STRUCTURE LOSS
|
| 104 |
+
|
| 105 |
+
As previously mentioned, the main objective of image translation is maintaining the content structure between output and the input image, while guiding the output to follow semantic of target condition. Existing methods (Couairon et al., 2022; Kim et al., 2022) use pixel-wise loss or the perceptual loss for the content preservation. However, the pixel space does not explicitly discriminate content and semantic components: too strong pixel loss hinders the semantic change of output, whereas weak pixel loss alters the structural component along with semantic changes. To address the problem, we need to separately process the semantic and structure information of the image.
|
| 106 |
+
|
| 107 |
+
Recently, (Tumanyan et al., 2022) demonstrated successful disentanglement of both components using a pre-trained DINO ViT (Caron et al., 2021). They showed that in ViT, the keys $k ^ { l }$ of multi-head self attention (MSA) layer contain structure information, and [CLS] token of last layer contains the semantic information. With above features, they proposed a loss for maintaining structure between input and network output with matching the self similarity matrix $S ^ { l }$ of the keys, which can be represented in the following form for our problem:
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
\ell _ { s s i m } ( \pmb { x } _ { s r c } , \pmb { x } ) = \| S ^ { l } ( \pmb { x } _ { s r c } ) - S ^ { l } ( \pmb { x } ) \| _ { F } , \quad \mathrm { w h e r e } \quad \big [ S ^ { l } ( \pmb { x } ) \big ] _ { i , j } = \cos ( k _ { i } ^ { l } ( \pmb { x } ) , k _ { j } ^ { l } ( \pmb { x } ) ) ,
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
where $k _ { i } ^ { l } ( { \pmb x } )$ and $k _ { j } ^ { l } ( \pmb { x } )$ indicate $i , j$ th key in the $l$ -th MSA layer extracted from ViT with image $_ { \textbf { \em x } }$ . The self-similarity loss can maintain the content information between input and output, but we found that only using this loss results in a weak regularization in our DDPM framework. Since the key $k _ { i }$ contains the spatial information corresponding the $i$ -th patch location, we use additional regularization with contrastive learning as shown in Fig. 2(a), inspired by the idea of using both of relation consistency and contrastive learning(Jung et al., 2022). Specifically, leveraging the idea of patch contrastive loss (Park et al., 2020), we define the infoNCE loss using the DINO ViT keys:
|
| 114 |
+
|
| 115 |
+
$$
|
| 116 |
+
\ L _ { c o n t } ( x _ { s r c } , x ) = - \sum _ { i } ! \log \left( \frac { \exp ( \sin ( k _ { i } ^ { l } ( x ) , k _ { i } ^ { l } ( x _ { s r c } ) ) / \tau ) } { \exp ( \sin ( k _ { i } ^ { l } ( x ) , k _ { i } ^ { l } ( x _ { s r c } ) ) / \tau + \sum _ { j \ne i } \exp ( \sin ( k _ { i } ^ { l } ( x ) , k _ { j } ^ { l } ( x _ { s r c } ) ) / \tau ) } \right) ,
|
| 117 |
+
$$
|
| 118 |
+
|
| 119 |
+
where $\tau$ is temperature, and $\mathrm { s i m } ( \cdot , \cdot )$ represents the normalized cosine similarity. With this loss, we regularize the key of same positions to have closer distance, while maximizing the distances between the keys at different positions.
|
| 120 |
+
|
| 121 |
+
# 3.3 STYLE LOSS
|
| 122 |
+
|
| 123 |
+
CLIP Loss for Text-guided Image Translation Based on the previous work of (Dhariwal & Nichol, 2021), CLIP-guided diffusion (Crowson, 2022) proposed to guide the reverse diffusion using pre-trained CLIP model using the following loss function:
|
| 124 |
+
|
| 125 |
+
$$
|
| 126 |
+
\ell _ { C L I P } ( \boldsymbol { d } _ { t r g } , \boldsymbol { x } ) : = - \mathrm { s i m } \left( E _ { T } ( \boldsymbol { d } _ { t r g } ) , E _ { I } ( \boldsymbol { x } ) \right) ,
|
| 127 |
+
$$
|
| 128 |
+
|
| 129 |
+
where $\mathbf { \delta } d _ { t r g }$ is the target text prompt, and $E _ { I } , E _ { T }$ refer to the image and text encoder of CLIP, respectively. Although this loss can give text-guidance to diffusion model, the results often suffer from poor image quality.
|
| 130 |
+
|
| 131 |
+
Instead, we propose to use input-aware directional CLIP loss (Gal et al. (2021)) which matches the CLIP embedding of the output image to the target vector in terms of $\mathbf { \delta } d _ { t r g }$ , $d _ { s r c }$ , and $\mathbf { \delta } _ { \mathbf { \mathcal { X } } _ { s r c } }$ . More specifically, our CLIP-based semantic loss is described as (see also Fig. 2(b)):
|
| 132 |
+
|
| 133 |
+
$$
|
| 134 |
+
\ell _ { C L I P } ( \pmb { x } ; d _ { t r g } , \pmb { x } _ { s r c } , d _ { s r c } ) : = - \mathrm { s i m } ( \pmb { v } _ { t r g } , \pmb { v } _ { s r c } )
|
| 135 |
+
$$
|
| 136 |
+
|
| 137 |
+
where
|
| 138 |
+
|
| 139 |
+
$$
|
| 140 |
+
\pmb { v } _ { t r g } : = E _ { T } ( d _ { t r g } ) + \lambda _ { i } E _ { I } ( \pmb { x } _ { s r c } ) - \lambda _ { s } E _ { T } ( d _ { s r c } ) , \quad \pmb { v } _ { s r c } : = E _ { I } ( \mathrm { a u g } ( \pmb { x } ) )
|
| 141 |
+
$$
|
| 142 |
+
|
| 143 |
+
where $\mathrm { a u g } ( \cdot )$ denotes the augmentation for preventing adversarial artifacts from CLIP. Here, we simultaneously remove the source domain information $- \lambda _ { s } E _ { T } ( { \pmb d } _ { s r c } )$ and reflect the source image information to output $+ \lambda _ { i } E _ { I } ( { \pmb x } _ { s r c } )$ according to the values of $\lambda _ { s }$ and $\lambda _ { i }$ . Therefore it is possible to obtain stable outputs compared to using the conventional loss.
|
| 144 |
+
|
| 145 |
+
Furthermore, in contrast to the existing methods using only single pre-trained CLIP model (e.g. ViT/B-32), we improve the text-image embedding performance by using the recently proposed CLIP model ensemble method (Couairon et al. (2022)). Specifically, instead of using a single embedding, we concatenate the multiple embedding vectors from multiple pre-trained CLIP models and used the it as our final embedding.
|
| 146 |
+
|
| 147 |
+
Semantic Style Loss for Image-guided Image Translation In the case of image-guide translation, we propose to use [CLS] token of ViT as our style guidance. As explained in the previous part 3.2, the [CLS] token contains the semantic style information of the image. Therefore, we can guide the diffusion process to match the semantic of the samples to that of target image by minimizing the [CLS] token distances as shown in Fig. 2(c). Also, we found that using only [CLS] tokens often results in misaligned color values. To prevent this, we guide the output to follow the overall color statistic of target image with weak MSE loss between the images. Therefore, our loss function is described as follows:
|
| 148 |
+
|
| 149 |
+
$$
|
| 150 |
+
\ell _ { s t y } ( { \pmb x } _ { t r g } , { \pmb x } ) = | | e _ { [ C L S ] } ^ { L } ( { \pmb x } _ { t r g } ) - e _ { [ C L S ] } ^ { L } ( { \pmb x } ) | | _ { 2 } + \lambda _ { m s e } | | { \pmb x } _ { t r g } - { \pmb x } | | _ { 2 } .
|
| 151 |
+
$$
|
| 152 |
+
|
| 153 |
+
where $e _ { [ C L S ] } ^ { L }$ denotes the last layer [CLS] token.
|
| 154 |
+
|
| 155 |
+
# 3.4 ACCELERATION STRATEGY
|
| 156 |
+
|
| 157 |
+
Semantic Divergence Loss With the proposed loss functions, we can achieve text- or imageguided image translation outputs. However, we empirically observed that the generation process requires large steps to reach the the desired output. To solve the problem, we propose a simple approach to accelerate the diffusion process. As explained before, the [CLS] token of ViT contains the overall semantic information of the image. Since our purpose is to make the semantic information as different from the original as possible while maintaining the structure, we conjecture that we can achieve our desired purpose by maximizing the distance between the [CLS] tokens of the previous step and the current output during the generation process as described in Fig. 2(d). Therefore, our loss function at time $t$ is given by
|
| 158 |
+
|
| 159 |
+
$$
|
| 160 |
+
\ell _ { s e m } ( \pmb { x } _ { t } ; \pmb { x } _ { t + 1 } ) = - | | e _ { [ C L S ] } ^ { L } ( \hat { \pmb { x } } _ { 0 } ( \pmb { x } _ { t } ) ) - e _ { [ C L S ] } ^ { L } ( \hat { \pmb { x } } _ { 0 } ( \pmb { x } _ { t + 1 } ) ) | | _ { 2 } ,
|
| 161 |
+
$$
|
| 162 |
+
|
| 163 |
+
Specifically, we maximize the distance between the denoised output of the present time and the previous time, so that next step sample has different semantic from the previous step. One could think of alternatives to maximize pixel-wise or perceptual distance, but we have experimentally found that in these cases, the content structure is greatly harmed. In contrast, our proposed loss has advantages in terms of image quality because it can control only the semantic appearance.
|
| 164 |
+
|
| 165 |
+
Resampling Strategy As shown in CCDF acceleration strategy (Chung et al., 2022b), a better initialization leads to an accelerated reverse diffusion for inverse problem. Empirically, in our image translation problem we also find that finding the good starting point at time step $T$ for the reverse diffusion affects the overall image quality. Specifically, in order to guide the initial estimate $\mathbf { \nabla } _ { \mathbf { x } _ { T } }$ to be sufficiently good, we perform $N$ repetition of one reverse sampling ${ \mathbf { } } { \mathbf { } } { \mathbf { } } x _ { T - 1 }$ followed by one forward step ${ \pmb x } _ { T } = \sqrt { 1 - \beta _ { T - 1 } } { \pmb x } _ { T - 1 } + \beta _ { T - 1 } { \pmb \epsilon }$ to find the $\mathbf { \nabla } _ { \mathbf { x } _ { T } }$ whose gradient for the next step is easily affected by the loss. With this initial resampling strategy, we can empirically found the initial $\mathbf { \nabla } _ { \mathbf { \mathcal { X } } \mathcal { T } }$ that can reduce the number of reverse steps. The overall process is in our algorithm in Appendix.
|
| 166 |
+
|
| 167 |
+
# 3.5 TOTAL LOSS
|
| 168 |
+
|
| 169 |
+
Putting all together, the final loss in (7) for the text-guided reverse diffusion is given by
|
| 170 |
+
|
| 171 |
+
$$
|
| 172 |
+
\ell _ { t o t a l } = \lambda _ { 1 } \ell _ { c o n t } + \lambda _ { 2 } \ell _ { s s i m } + \lambda _ { 3 } \ell _ { C L I P } + \lambda _ { 4 } \ell _ { s e m } + \lambda _ { 5 } \ell _ { r n g } ,
|
| 173 |
+
$$
|
| 174 |
+
|
| 175 |
+
where $\ell _ { r n g }$ is a regularization loss to prevent the irregular step of reverse diffusion process suggested in (Crowson (2022)). If the target style image $\pmb { x } _ { t r g }$ is given instead of text conditions $\pmb { d } _ { s r c }$ and $\mathbf { \delta } d _ { t r g }$ , then $\ell _ { C L I P }$ is simply substituted for $\ell _ { s t y }$ .
|
| 176 |
+
|
| 177 |
+
# 4 EXPERIMENT
|
| 178 |
+
|
| 179 |
+
# 4.1 EXPERIMENTAL DETAILS
|
| 180 |
+
|
| 181 |
+
For implementation, we refer to the official source code of blended diffusion (Avrahami et al. (2022)). All experiments were performed using unconditional score model pre-trained with Imagenet $2 5 6 \times 2 5 6$ resolution datasets (Dhariwal $\&$ Nichol (2021)). In all the experiments, we used diffusion step of $T = 6 0$ and the resampling repetition of $N = 1 0$ ; therefore, the total of 70 diffusion reverse steps are used. The generation process takes 40 seconds per image in single RTX 3090 unit. In $\ell _ { C L I P }$ , we used the ensemble of 5 pre-trained CLIP models (RN50, RN50x4, ViTB/32, RN50x16, ViT-B/16) for the text-guidance, following the setup of Couairon et al. (2022). Our detailed experimental settings are elaborated in Appendix.
|
| 182 |
+
|
| 183 |
+
# 4.2 TEXT-GUIDED SEMANTIC IMAGE TRANSLATION
|
| 184 |
+
|
| 185 |
+
To evaluate the performance of our text-guided image translation, we conducted comparisons with state-of-the-art baseline models. For baseline methods, we selected the recently proposed models which use pre-trained CLIP for text-guided image manipulation: VQGAN-CLIP (Crowson et al. (2022)), CLIP-guided diffusion (CGD) (Crowson (2022)), DiffusionCLIP (Kim et al. (2022)), and FlexIT (Couairon et al. (2022)). For all baseline methods, we referenced the official source codes.
|
| 186 |
+
|
| 187 |
+

|
| 188 |
+
Figure 3: Qualitative comparison of text-guided translation on Animals dataset. Our model generates realistic samples that reflects the text condition, with better perceptual quality than the baselines.
|
| 189 |
+
|
| 190 |
+

|
| 191 |
+
Figure 4: Qualitative comparison of text-guided image translation on Landscape dataset. Our model generates outputs with better perceptual quality than the baselines.
|
| 192 |
+
|
| 193 |
+
Since our framework can be applied to arbitrary text semantics, we tried quantitative and qualitative evaluation on various kinds of natural image datasets. We tested our translation performance using two different datasets: animal faces (Si & Zhu (2012)) and landscapes (Chen et al. (2018)). The animal face dataset contains 14 classes of animal face images, and the landscapes dataset consists of 7 classes of various natural landscape images.
|
| 194 |
+
|
| 195 |
+
Table 1: Quantitative comparison in the text-guided image translation. Our model outperforms baselines in overall scores for both of Animals and Landscapes datasets as well as user study.
|
| 196 |
+
|
| 197 |
+
<table><tr><td rowspan="2">Method</td><td colspan="3">Animals</td><td colspan="3">Landscapes</td><td colspan="3">User Study</td></tr><tr><td>SFID↓</td><td>CSFID↓</td><td>LPIPS↓</td><td>SFID↓</td><td>CSFID↓</td><td>LPIPS↓</td><td>Text个</td><td>Realism↑</td><td>Content</td></tr><tr><td>VQGAN-CLIP</td><td>30.01</td><td>65.51</td><td>0.462</td><td>33.31</td><td>82.92</td><td>0.571</td><td>2.78</td><td>2.05</td><td>2.16</td></tr><tr><td>CLIP-GD</td><td>12.50</td><td>53.05</td><td>0.468</td><td>18.13</td><td>62.19</td><td>0.458</td><td>2.61</td><td>2.24</td><td>2.28</td></tr><tr><td>DiffusionCLIP</td><td>25.09</td><td>66.50</td><td>0.379</td><td>29.85</td><td>76.29</td><td>0.568</td><td>2.50</td><td>2.54</td><td>3.06</td></tr><tr><td>FlexIT</td><td>32.71</td><td>57.87</td><td>0.215</td><td>18.04</td><td>60.04</td><td>0.243</td><td>2.22</td><td>3.15</td><td>3.89</td></tr><tr><td>Ours</td><td>9.98</td><td>41.07</td><td>0.372</td><td>16.86</td><td>54.48</td><td>0.417</td><td>3.68</td><td>4.28</td><td>4.11</td></tr></table>
|
| 198 |
+
|
| 199 |
+
To measure the performance of the generated images, we measured the FID score (Heusel et al. (2017)). However, when using the basic FID score measurement, the output value is not stable because our number of generated images is not large. To compensate for this, we measure the performance using a simplified FID (Kim et al. (2020)) that does not consider the diagonal term of the feature distributions. Also, we additionally showed a class-wise SFID score that measures the SFID for each class of the converted output because it is necessary to measure whether the converted output accurately reflects the semantic information of the target class. Finally, we used the averaged LPIPS score between input and output to verify the content preservation performance of our method. Further experimental settings can be found in our Appendix.
|
| 200 |
+
|
| 201 |
+
In Table 1, we show the quantitative comparison results. In image quality measurement using SFID and CSFID, our model showed the best performance among all baseline methods. Especially for Animals dataset, our SFID value outperformed others in large gain. In the content preservation by LPIPS score, our method scored the second best. In case of FlexIT, it showed the best score in LPIPS since the model is directly trained with LPIPS loss. However, too low value of LPIPS is undesired as it means that the model failed in proper semantic change. This can be also seen in qualitative result of Figs. 3 and 4, where our results have proper semantic features of target texts with content preservation, whereas the results from FlexIT failed in semantic change as it is too strongly confined to the source images. In other baseline methods, most of the methods failed in proper content preservation. Since our method is based on DDPM, our model can generate diverse images as shown in the additional outputs in our Appendix.
|
| 202 |
+
|
| 203 |
+
To further evaluate the perceptual quality of generated samples, we conducted user study. In order to measure the detailed opinions, we used custom-made opinion scoring system. We asked the users in three different parts: 1) Are the output have correct semantic of target text? (Text-match), 2) are the generated images realistic? (Realism), 3) do the outputs contains the content information of source images? (Content). Detailed user-study settings are in our Appendix. In Table 1, our model showed the best performance, which further shows the superiority of our method.
|
| 204 |
+
|
| 205 |
+
# 4.3 IMAGE-GUIDED SEMANTIC IMAGE TRANSLATION
|
| 206 |
+
|
| 207 |
+
Since our method can be easily adapted to the image translation guided by target images, we evaluate the performance of our model with comparison experiments. We compare our model with appearance transfer models of Splicing ViT (Tumanyan et al. (2022)), STROTSS (Kolkin et al. (2019)), and style transfer methods WCT2 (Yoo et al. (2019)) and SANet (Park & Lee (2019)).
|
| 208 |
+
|
| 209 |
+
Fig. 5 is a qualitative comparison result of image guided translation task. Our model successfully generated outputs that follow the semantic styles of the target images while maintaining the content of the source images. In
|
| 210 |
+
|
| 211 |
+
<table><tr><td>Method</td><td>Style↑</td><td>Realism↑</td><td>Content个</td></tr><tr><td>SANet</td><td>2.75</td><td>4.08</td><td>4.37</td></tr><tr><td>WCT2</td><td>2.59</td><td>4.64</td><td>4.90</td></tr><tr><td>STROTSS</td><td>3.92</td><td>2.91</td><td>3.17</td></tr><tr><td>SplicingViT</td><td>3.50</td><td>2.08</td><td>2.15</td></tr><tr><td>Ours</td><td>4.23</td><td>4.25</td><td>4.51</td></tr></table>
|
| 212 |
+
|
| 213 |
+
Table 2: User study comparison of image-guided translation tasks. Our model outperforms baseline methods in overall perceptual quality.
|
| 214 |
+
|
| 215 |
+
the case of other models, we can see that the content was severely deformed or the semantic style was not properly reflected. We also measured the overall perceptual quality through a user study. As with text-guided translation, we investigated user opinion through three different questions. In Table 2, our model obtained the best score in style matching score and the second best in realism and content preservation scores. Baseline WCT2 showed the best in realism and content scores, but it shows the worst score in style matching because the outputs are hardly changed from the inputs except for overall colors. The opinions scores confirm that our model outperforms the baselines. More details are in our Appendix.
|
| 216 |
+
|
| 217 |
+

|
| 218 |
+
Figure 5: Qualitative comparison of image-guided image translation. Our results have better perceptual quality than the baseline outputs.
|
| 219 |
+
|
| 220 |
+

|
| 221 |
+
Figure 6: Qualitative comparison on ablation study. Our full setting shows the best results.
|
| 222 |
+
|
| 223 |
+
# 4.4 ABLATION STUDY
|
| 224 |
+
|
| 225 |
+
To verify the proposed components in our framework, we compare the generation performance with different settings. In Fig. 6, we show that (a) the outputs from our best setting have the correct semantic of target text, with preserving the content of the source; (b) by removing $\ell _ { s e m }$ , the results still have the appearance of source images, suggesting that images are not fully converted to the target domain; (c) without $\ell _ { c o n t }$ , the output images totally failed to capture the content of source images; (d) by using LPIPS perceptual loss instead of proposed $\ell _ { c o n t }$ , the results can only capture the approximate content of source images; (e) using pixel-wise $l _ { 2 }$ maximization loss instead of proposed $\ell _ { s e m }$ , the outputs suffer from irregular artifacts; (f) without using our proposed resampling trick, the results cannot fully reflect the semantic information of target texts. (g) With using VGG16 network instead of DINO ViT, the output structure is severely degraded with artifacts. Overall, we can obtain the best generation outputs by using all of our proposed components. For further evaluation, we will show the quantitative results of ablation study in our Appendix.
|
| 226 |
+
|
| 227 |
+
# 5 CONCLUSION
|
| 228 |
+
|
| 229 |
+
In conclusion, we proposed a novel loss function which utilizes a pre-trained ViT model to guide the generation process of DDPM models in terms of content preservation and semantic changes. We further propose a novel strategy of resampling technique for better initialization of diffusion process. For evaluation, our extensive experimental results show that our proposed framework has superior performance compared to baselines in both of text- and image-guided semantic image translation tasks. Despite the successful results, our method often fails to translate the image styles when there is large domain gap between source and target. With respect to this, we show the failure cases and discussions on limitations in Appendix.
|
| 230 |
+
|
| 231 |
+
# Acknowledgement
|
| 232 |
+
|
| 233 |
+
This research was supported by Field-oriented Technology Development Project for Customs Administration through National Research Foundation of Korea(NRF) funded by the Ministry of Science & ICT and Korea Customs Service(NRF-2021M3I1A1097938), the KAIST Key Research Institute (Interdisciplinary Research Group) Project, and the National Research Foundation of Korea under Grant (NRF-2020R1A2B5B03001980).
|
| 234 |
+
|
| 235 |
+
# REFERENCES
|
| 236 |
+
|
| 237 |
+
Asha Anoosheh, Eirikur Agustsson, Radu Timofte, and Luc Van Gool. Combogan: Unrestrained scalability for image domain translation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops, pp. 783–790, 2018.
|
| 238 |
+
|
| 239 |
+
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, 2022.
|
| 240 |
+
|
| 241 |
+
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.
|
| 242 |
+
|
| 243 |
+
Yang Chen, Yu-Kun Lai, and Yong-Jin Liu. Cartoongan: Generative adversarial networks for photo cartoonization. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 9465–9474, 2018.
|
| 244 |
+
|
| 245 |
+
Yunjey Choi, Minje Choi, Munyoung Kim, Jung-Woo Ha, Sunghun Kim, and Jaegul Choo. Stargan: Unified generative adversarial networks for multi-domain image-to-image translation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 8789–8797, 2018.
|
| 246 |
+
|
| 247 |
+
Min Jin Chong and David Forsyth. Jojogan: One shot face stylization. arXiv preprint arXiv:2112.11641, 2021.
|
| 248 |
+
|
| 249 |
+
Hyungjin Chung, Byeongsu Sim, Dohoon Ryu, and Jong Chul Ye. Improving diffusion models for inverse problems using manifold constraints. arXiv preprint arXiv:2206.00941, 2022a.
|
| 250 |
+
|
| 251 |
+
Hyungjin Chung, Byeongsu Sim, and Jong Chul Ye. Come-closer-diffuse-faster: Accelerating conditional diffusion models for inverse problems through stochastic contraction. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12413–12422, 2022b.
|
| 252 |
+
|
| 253 |
+
Guillaume Couairon, Asya Grechka, Jakob Verbeek, Holger Schwenk, and Matthieu Cord. Flexit: Towards flexible semantic image translation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 18270–18279, 2022.
|
| 254 |
+
|
| 255 |
+
Katherine Crowson. Clip-guided diffusion. 2022. URL https://github.com/afiaka87/ clip-guided-diffusion.
|
| 256 |
+
|
| 257 |
+
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.
|
| 258 |
+
|
| 259 |
+
Jiankang Deng, Jia Guo, Niannan Xue, and Stefanos Zafeiriou. Arcface: Additive angular margin loss for deep face recognition. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 4690–4699, 2019.
|
| 260 |
+
|
| 261 |
+
Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in Neural Information Processing Systems, 34:8780–8794, 2021.
|
| 262 |
+
|
| 263 |
+
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.
|
| 264 |
+
|
| 265 |
+
Patrick Esser, Robin Rombach, and Bjorn Ommer. Taming transformers for high-resolution image synthesis. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 12873–12883, 2021.
|
| 266 |
+
|
| 267 |
+
Tsu-Jui Fu, Xin Eric Wang, and William Yang Wang. Language-driven image style transfer. 2021.
|
| 268 |
+
|
| 269 |
+
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.
|
| 270 |
+
|
| 271 |
+
Leon A Gatys, Alexander S Ecker, and Matthias Bethge. Image style transfer using convolutional neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2414–2423, 2016.
|
| 272 |
+
|
| 273 |
+
Niv Granot, Ben Feinstein, Assaf Shocher, Shai Bagon, and Michal Irani. Drop the gan: In defense of patches nearest neighbors as single image generative models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 13460–13469, 2022.
|
| 274 |
+
|
| 275 |
+
Christopher Hahne and Amar Aggoun. Plenopticam v1.0: A light-field imaging framework. IEEE Transactions on Image Processing, 30:6757–6771, 2021. doi: 10.1109/TIP.2021.3095671.
|
| 276 |
+
|
| 277 |
+
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. pp. 6626– 6637, 2017.
|
| 278 |
+
|
| 279 |
+
Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 33:6840–6851, 2020.
|
| 280 |
+
|
| 281 |
+
Xun Huang and Serge Belongie. Arbitrary style transfer in real-time with adaptive instance normalization. pp. 1501–1510, 2017.
|
| 282 |
+
|
| 283 |
+
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, pp. 1125–1134, 2017.
|
| 284 |
+
|
| 285 |
+
Chanyong Jung, Gihyun Kwon, and Jong Chul Ye. Exploring patch-wise semantic relation for contrastive learning in image-to-image translation tasks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 18260–18269, June 2022.
|
| 286 |
+
|
| 287 |
+
Tero Karras, Samuli Laine, Miika Aittala, Janne Hellsten, Jaakko Lehtinen, and Timo Aila. Analyzing and improving the image quality of stylegan. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 8110–8119, 2020.
|
| 288 |
+
|
| 289 |
+
Chung-Il Kim, Meejoung Kim, Seungwon Jung, and Eenjun Hwang. Simplified frechet distance for ´ generative adversarial nets. Sensors, 20(6), 2020. ISSN 1424-8220. doi: 10.3390/s20061548. URL https://www.mdpi.com/1424-8220/20/6/1548.
|
| 290 |
+
|
| 291 |
+
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.
|
| 292 |
+
|
| 293 |
+
Kwanyoung Kim and Jong Chul Ye. Noise2score: tweedie’s approach to self-supervised image denoising without clean images. Advances in Neural Information Processing Systems, 34:864– 874, 2021.
|
| 294 |
+
|
| 295 |
+
Nicholas Kolkin, Jason Salavon, and Gregory Shakhnarovich. Style transfer by relaxed optimal transport and self-similarity. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10051–10060, 2019.
|
| 296 |
+
|
| 297 |
+
Gihyun Kwon and Jong Chul Ye. Clipstyler: Image style transfer with a single text condition. arXiv preprint arXiv:2112.00374, 2021.
|
| 298 |
+
|
| 299 |
+
Gihyun Kwon and Jong Chul Ye. One-shot adaptation of gan in just one clip. arXiv preprint arXiv:2203.09301, 2022.
|
| 300 |
+
|
| 301 |
+
Dongwook Lee, Junyoung Kim, Won-Jin Moon, and Jong Chul Ye. Collagan: Collaborative gan for missing image data imputation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2487–2496, 2019.
|
| 302 |
+
|
| 303 |
+
Jianxin Lin, Yingxue Pang, Yingce Xia, Zhibo Chen, and Jiebo Luo. Tuigan: Learning versatile image-to-image translation with two unpaired images. In European Conference on Computer Vision, pp. 18–35. Springer, 2020.
|
| 304 |
+
|
| 305 |
+
Xingchao Liu, Chengyue Gong, Lemeng Wu, Shujian Zhang, Hao Su, and Qiang Liu. Fusedream: Training-free text-to-image generation with improved clip+ gan space optimization. arXiv preprint arXiv:2112.01573, 2021.
|
| 306 |
+
|
| 307 |
+
Timo Luddecke and Alexander Ecker. Image segmentation using text and image prompts. In ¨ Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7086– 7096, 2022.
|
| 308 |
+
|
| 309 |
+
Alexander Quinn Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. In International Conference on Machine Learning, pp. 8162–8171. PMLR, 2021.
|
| 310 |
+
|
| 311 |
+
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.
|
| 312 |
+
|
| 313 |
+
Dae Young Park and Kwang Hee Lee. Arbitrary style transfer with style-attentional networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 5880–5888, 2019.
|
| 314 |
+
|
| 315 |
+
Taesung Park, Alexei A. Efros, Richard Zhang, and Jun-Yan Zhu. Contrastive learning for unpaired image-to-image translation. In Andrea Vedaldi, Horst Bischof, Thomas Brox, and Jan-Michael Frahm (eds.), Computer Vision – ECCV 2020, pp. 319–345, Cham, 2020. Springer International Publishing. ISBN 978-3-030-58545-7.
|
| 316 |
+
|
| 317 |
+
Or Patashnik, Zongze Wu, Eli Shechtman, Daniel Cohen-Or, and Dani Lischinski. Styleclip: Textdriven manipulation of stylegan imagery. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 2085–2094, 2021.
|
| 318 |
+
|
| 319 |
+
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.
|
| 320 |
+
|
| 321 |
+
Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical textconditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022.
|
| 322 |
+
|
| 323 |
+
Chitwan Saharia, William Chan, Huiwen Chang, Chris Lee, Jonathan Ho, Tim Salimans, David Fleet, and Mohammad Norouzi. Palette: Image-to-image diffusion models. In ACM SIGGRAPH 2022 Conference Proceedings, pp. 1–10, 2022a.
|
| 324 |
+
|
| 325 |
+
Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily Denton, Seyed Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, S Sara Mahdavi, Rapha Gontijo Lopes, et al. Photorealistic text-to-image diffusion models with deep language understanding. arXiv preprint arXiv:2205.11487, 2022b.
|
| 326 |
+
|
| 327 |
+
Hiroshi Sasaki, Chris G Willcocks, and Toby P Breckon. Unit-ddpm: Unpaired image translation with denoising diffusion probabilistic models. arXiv preprint arXiv:2104.05358, 2021.
|
| 328 |
+
|
| 329 |
+
Zhangzhang Si and Song-Chun Zhu. Learning hybrid image templates (hit) by information projection. IEEE Transactions on Pattern Analysis and Machine Intelligence, 34(7):1354–1367, 2012. doi: 10.1109/TPAMI.2011.227.
|
| 330 |
+
|
| 331 |
+
Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. In International Conference on Learning Representations, 2020a.
|
| 332 |
+
|
| 333 |
+
Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. arXiv preprint arXiv:2011.13456, 2020b.
|
| 334 |
+
|
| 335 |
+
Xu Su, Jiaming Song, Chenlin Meng, and Stefano Ermon. Dual diffusion implicit bridges for imageto-image translation. ArXiv, abs/2203.08382, 2022.
|
| 336 |
+
|
| 337 |
+
Narek Tumanyan, Omer Bar-Tal, Shai Bagon, and Tali Dekel. Splicing vit features for semantic appearance transfer. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10748–10757, 2022.
|
| 338 |
+
|
| 339 |
+
Can Wang, Menglei Chai, Mingming He, Dongdong Chen, and Jing Liao. Clip-nerf: Text-andimage driven manipulation of neural radiance fields. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3835–3844, 2022a.
|
| 340 |
+
|
| 341 |
+
Zhaoqing Wang, Yu Lu, Qiang Li, Xunqiang Tao, Yandong Guo, Mingming Gong, and Tongliang Liu. Cris: Clip-driven referring image segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11686–11695, 2022b.
|
| 342 |
+
|
| 343 |
+
Tianyi Wei, Dongdong Chen, Wenbo Zhou, Jing Liao, Zhentao Tan, Lu Yuan, Weiming Zhang, and Nenghai Yu. Hairclip: Design your hair by text and reference image. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 18072–18081, 2022.
|
| 344 |
+
|
| 345 |
+
Jaejun Yoo, Youngjung Uh, Sanghyuk Chun, Byeongkyu Kang, and Jung-Woo Ha. Photorealistic style transfer via wavelet transforms. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 9036–9045, 2019.
|
| 346 |
+
|
| 347 |
+
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.
|
| 348 |
+
|
| 349 |
+
Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A. Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In Proceedings of the IEEE International Conference on Computer Vision (ICCV), Oct 2017.
|
| 350 |
+
|
| 351 |
+
Peihao Zhu, Rameen Abdal, John Femiani, and Peter Wonka. Mind the gap: Domain gap control for single shot domain adaptation for generative adversarial networks. arXiv preprint arXiv:2110.08398, 2021.
|
| 352 |
+
|
| 353 |
+
# A EXPERIMENTAL DETAILS
|
| 354 |
+
|
| 355 |
+
# A.1 IMPLEMENTATION DETAILS
|
| 356 |
+
|
| 357 |
+
For implementation, in case of using text-guided image manipulation, our initial sampling numbers are set as $T = 1 0 0$ , but we skipped the initial 40 steps to maintain the abstract content of input image. Therefore, the total number of sampling steps is $T = 6 0$ . With resampling step of $N = 1 0$ , we use total of 70 iterations for single image output. We found that using more resampling steps does not show meaningful performance improvement. In image-guided manipulation, we set initial sampling number $T = 2 0 0$ , and skipped the initial 80 steps. We used resampling step $N = 1 0$ . Therefore, we use total of 130 iterations. Although we used more iterations than text-guided translation, it takes about 40 seconds.
|
| 358 |
+
|
| 359 |
+
For hyperparameters, we use $\lambda _ { 1 } = 2 0 0$ , $\lambda _ { 2 } = 1 0 0$ , $\lambda _ { 3 } = 2 0 0 0$ , $\lambda _ { 4 } = 1 0 0 0$ , $\lambda _ { 5 } = 2 0 0$ . For imageguided translation, we set $\lambda _ { m s e } = 1 . 5$ . For our CLIP loss, we set $\lambda _ { s } = 0 . 4$ and $\lambda _ { i } = 0 . 2$ . For our ViT backbone model, we used pre-trained DINO ViT that follows the baseline of Splicing ViT (Tumanyan et al., 2022). For extracting keys of intermediate layer, we use layer of $l = 1 1$ , and for [CLS] token, we used last layer output. Since ViT and CLIP model only take $2 2 4 \times 2 2 4$ resolution images, we resized all images before calculating the losses with ViT and CLIP.
|
| 360 |
+
|
| 361 |
+
To further improve the sample quality of our qualitative results, we used restarting trick in which we check the $\ell _ { r e g }$ loss calculated at initial time step $T$ , and restart the whole process if the loss value is too high. If the initial loss $\ell _ { r e g } > 0 . 0 1$ , we restarted the process. For quantitative result, we did not use the restart trick for fair comparison.
|
| 362 |
+
|
| 363 |
+
For augmentation, we use the same geometrical augmentations proposed in FlexIT(Couairon et al., 2022). Also, following the setting from CLIP-guided diffusion(Crowson, 2022), we included noise augmentation in which we mix the noisy image to $\hat { x } _ { 0 } ( x _ { t } )$ as it further removes the artifacts.
|
| 364 |
+
|
| 365 |
+
In our image-guided image translation on natural landscape images, we matched the color distribution of output image to that of target image with (Hahne & Aggoun, 2021), as it showed better perceptual quality. Our detailed implementation can be found in our official GitHub repository.1
|
| 366 |
+
|
| 367 |
+
For baseline experiments, we followed the official source codes in all of the models2345. For diffusion-based models (DiffusionCLIP, CLIP-guided diffusion), we used unconditional score model pre-trained on $2 5 6 \times 2 5 6$ resolutions. In DiffusionCLIP, we fine-tuned the score model longer than suggested training iteration, as it showed better quality. In CLIP-guided diffusion, we set the CLIP-guided loss as 2000, and also set initial sampling number as $T = 1 0 0$ with skipping initial 40 steps. For VQGAN-based models (FlexIT, VQGAN-CLIP), we used VQGAN trained on imagenet $2 5 6 \times 2 5 6$ resolutions datasets. In VQGAN-CLIP, as using longer iteration results in extremely degraded images, therefore we optimized only 30 iterations, which is smaller than suggested iterations $( \geq 8 0 )$ . In the experiments of FlexIT, we followed the exactly same settings suggested in the original paper.
|
| 368 |
+
|
| 369 |
+
For baselines of image-guided style transfer tasks, we also referenced the original source codes6789.
|
| 370 |
+
In all of the experiments, we followed the suggested settings from the original papers.
|
| 371 |
+
|
| 372 |
+
# A.2 DATASET DETAILS
|
| 373 |
+
|
| 374 |
+
For our quantitative results using text-guided image translation, we used two different datasets Animals and Landscapes. In Animals dataset, the original dataset contains 21 different classes, but we filtered out the images from 14 classes (bear, cat, cow, deer, dog, lion, monkey, mouse, panda, pig, rabbit, sheep, tiger, wolf) which can be classified as mammals. Remaining classes (e.g. human, chicken, etc.) are removed since they have far different semantics from the mammal faces.Therefore we reported quantitative scores only with filtered datasets for fair comparison. The dataset contains 100-300 images per each class, and we selected 4 testing images from each class in order to use them as our content source images. With selected samples, we calculated the metrics using the outputs of translating the 4 images from a source class into all the remaining classes. Therefore, in our animal face dataset, total of 676 generated images are used for evaluation.
|
| 375 |
+
|
| 376 |
+
In Landscapes dataset, we manually classified the images into 7 different classes (beach, desert, forest, grass field, mountain, sea, snow). Each class has 300 different images except for desert class which have 100 different images. Since some classes have not enough number of images, we borrowed images from seasons (Anoosheh et al., 2018) dataset. For metric calculation, we selected 8 testing images from each class, and used them as our content source images. Again, we translated the 8 images from source class into all the remaining classes. Therefore, a total of 336 generated images are used for our quantitative evaluation.
|
| 377 |
+
|
| 378 |
+
For single image guided translation, we selected random images from AFHQ dataset for animal face translation; and for natural image generation, we selected random images from our Landscapes datasets.
|
| 379 |
+
|
| 380 |
+
# A.3 USER STUDY DETAILS
|
| 381 |
+
|
| 382 |
+
For our user study in text-guided image translation task, we generated 130 different images using 13 different text conditions with our proposed and baseline models. Then we randomly selected 65 images and made 6 different questions. More specifically, we asked the participants question about three different parts: 1) Are the outputs have correct semantic of target text? (Text-match), 2) Are the generated images realistic? (Realism), 3) Do the outputs contain the content information of source images (Content). We randomly recruited a total of 30 users, and provided them the questions using Google Form. The 30 different users come from age group 20s and 50s. We set the minimum score as 1, and the maximum score is 5. The users can score among 5 different options : 1-Very Unlikely, 2-Unlikely, 3-Normal, 4-Likely, 5-Very Likely.
|
| 383 |
+
|
| 384 |
+
For the user study on image-guided translation task, we generated 40 different images using 8 different images conditions. Then we followed the same protocol to user study on text-guided image translation tasks, except for the content of questions. We asked the users in three different parts: 1) Are the outputs have correct semantic of target style image? (Style-match), 2) Are the generated images realistic? (Realism), 3) Do the outputs contain the content information of source images (Content).
|
| 385 |
+
|
| 386 |
+
# A.4 ALGORITHM
|
| 387 |
+
|
| 388 |
+
For detailed explanation, we include Algorithm of our proposed image translation mathods in Algorithm 1.
|
| 389 |
+
|
| 390 |
+
# B QUANTITATIVE ABLATION STUDY
|
| 391 |
+
|
| 392 |
+
For more thorough evaluation of our proposed components, we report ablation study on quantitative metrics. In this experiment, we only used Animals dataset due to the time limit. In Table 3, we show the quantitative results on various settings. When we remove one of our acceleration strategies, in setting (b) and (f), we can see that the fid score is degraded as the outputs are not properly changed from the original source images. (e) When we use L2 maximization instead of our proposed $\ell _ { s e m }$ , FID scores are improved from setting (b), but still the performance is not on par with our best settings. (d) When we use weak content regularization using LPIPS, we can see that the overall scores are degraded. When we remove our proposed $\ell _ { c o n t }$ , we can observe that SFID and CSFID scores are lower than other settings. However, we can see that LPIPS score is severely high as the model hardly reflect the content information of original source images. (g) we use pre-trained VGG instead of using ViT for ablation study. Instead of ViT keys for structure loss, we substitute it with features extracted from VGG16 relu3 1 activation layer. Also, we substitute ViT [CLS] token with VGG16 relu5 1 feature as it contains high-level semantic features. We can see that the model
|
| 393 |
+
|
| 394 |
+
Algorithm 1 Semantic image translation: given a diffusion score model $\epsilon _ { \theta } ( \pmb { x } _ { t } , t )$ , CLIP model, and VIT model
|
| 395 |
+
|
| 396 |
+
Input: source image $\pmb { x } _ { s r c }$ , diffusion steps $T$ , resampling steps $N$ , target text $\mathbf { \delta } d _ { t r g }$ , source text $\pmb { d } _ { s r c }$ or target image $\mathbf { \boldsymbol { x } } _ { t r g }$
|
| 397 |
+
|
| 398 |
+
Output: translated image √ $\hat { \pmb x }$ which has semantic of $\mathbf { \delta } d _ { t r g }$ (or $\pmb { x } _ { t r g }$ ) and content of $\mathbf { \delta } _ { \mathbf { \mathcal { X } } _ { s r c } }$
|
| 399 |
+
|
| 400 |
+
1: for all $t$ from $T$ to 0 do
|
| 401 |
+
2: $\begin{array} { r l } & { \epsilon \epsilon _ { \theta } ( x _ { t } , t ) } \\ & { \hat { x } _ { 0 } ( x _ { t } ) \frac { x _ { t } } { \sqrt { \bar { \alpha } _ { t } } } - \frac { \sqrt { 1 - \bar { \alpha } _ { t } } } { \sqrt { \bar { \alpha } _ { t } } } \epsilon } \end{array}$
|
| 402 |
+
3:
|
| 403 |
+
4: if text-guided then
|
| 404 |
+
5: $\nabla _ { t o t a l } \nabla _ { x _ { t } } \ell _ { t o t a l } ( \hat { { \boldsymbol x } } _ { 0 } ( x _ { t } ) ; d _ { t r g } , { \boldsymbol x } _ { s r c } , d _ { s r c } )$
|
| 405 |
+
6: else if image-guided then
|
| 406 |
+
7: $\nabla _ { t o t a l } \mathsf { \bar { V } } _ { \pmb { x } _ { t } } \ell _ { t o t a l } ( \hat { \pmb { x } } _ { 0 } ( \pmb { x } _ { t } ) ; \pmb { x } _ { t r g } , \pmb { x } _ { s r c } )$
|
| 407 |
+
8: end if
|
| 408 |
+
9: $\begin{array} { r l } & { z \sim \mathcal { N } ( 0 , { \bf I } ) } \\ & { { \bf x } _ { t - 1 } ^ { \prime } = \frac { 1 } { \sqrt { \alpha _ { t } } } \Big ( { \bf x } _ { t } - \frac { 1 - \alpha _ { t } } { \sqrt { 1 - \bar { \alpha } _ { t } } } \epsilon \Big ) + \sigma _ { t } z } \\ & { { \bf x } _ { t - 1 } = { \bf x } _ { t - 1 } ^ { \prime } - \nabla _ { t o t a l } } \end{array}$
|
| 409 |
+
10:
|
| 410 |
+
11:
|
| 411 |
+
12: if t = T and $n < N$ then
|
| 412 |
+
13: $\begin{array} { l } { { \pmb x } _ { t } { \mathcal { N } } ( \sqrt { 1 - \beta _ { t - 1 } } { \pmb x } _ { t - 1 } , \beta _ { t - 1 } { \bf I } ) } \\ { { \pmb n } { \ b n } + 1 } \end{array}$
|
| 413 |
+
14:
|
| 414 |
+
15: go to 2
|
| 415 |
+
16: end if
|
| 416 |
+
17: end for
|
| 417 |
+
18: return ${ \pmb x } _ { - 1 }$
|
| 418 |
+
|
| 419 |
+
Table 3: Quantitative comparison of ablation studies.
|
| 420 |
+
|
| 421 |
+
<table><tr><td rowspan="2"> Settings</td><td colspan="3">Animals</td></tr><tr><td>SFID↓</td><td>CSFID↓</td><td>LPIPS↓</td></tr><tr><td>VGG instead of ViT (g)</td><td>9.72</td><td>43.08</td><td>0.518</td></tr><tr><td>No resampling (f)</td><td>11.88</td><td>59.09</td><td>0.316</td></tr><tr><td>L2 Max instead of lsem (e)</td><td>13.18</td><td>49.47</td><td>0.324</td></tr><tr><td>LPIPs instead of lcont (d)</td><td>11.15</td><td>58.67</td><td>0.400</td></tr><tr><td>No lcont (c)</td><td>9.90</td><td>33.07</td><td>0.477</td></tr><tr><td>No lsem (b)</td><td>15.00</td><td>53.43</td><td>0.347</td></tr><tr><td>Ours (a)</td><td>9.98</td><td>41.07</td><td>0.372</td></tr></table>
|
| 422 |
+
|
| 423 |
+
shows decent SFID and CSFID scores, but the LPIPS score is very high. The result show that using VGG does not properly operate as regularization tool, rather it degrades the generation process with damaging the structural consistency. Overall, when using our best setting, we can obtain the best output considering all of the scores.
|
| 424 |
+
|
| 425 |
+
# C ARTISTIC STYLE TRANSFER
|
| 426 |
+
|
| 427 |
+
With our framework, we can easily adapt our method to artistic style transfer. With simply changing the text conditions, or using artistic paintings as our image conditions, we can obtain the artistic style transfer results as shown in Fig. 7.
|
| 428 |
+
|
| 429 |
+
# D FACE IMAGE TRANSLATION
|
| 430 |
+
|
| 431 |
+
Instead of using score mode pre-trained on Imagenet dataset, we can use pre-trained score model on FFHQ human face dataset. In order to keep the face identity between source and output images, we include $\lambda _ { i d } \ell _ { i d }$ which leverage pre-trained face identification model ArcFace(Deng et al., 2019). We calculate identity loss between $\pmb { x } _ { s r c }$ and denoised image $\hat { \pmb { x } } _ { 0 } ( { \pmb x } _ { t } )$ . We use $\lambda _ { i d } = 1 0 0$ .
|
| 432 |
+
|
| 433 |
+

|
| 434 |
+
Figure 7: Various outputs of artistic style transfer. We can translation natural images into artistic style paintings with both of text or image conditions.
|
| 435 |
+
|
| 436 |
+

|
| 437 |
+
Figure 8: Outputs from face image translation models. The outputs from our model successfully translated the human face images with proper target domain semantic information.
|
| 438 |
+
|
| 439 |
+
In Fig. 8, we show that our method also can be used in face image translation tasks. For comparison, we included baseline models of face editing method StyleCLIP (Patashnik et al., 2021), and oneshot face stylization model of JojoGAN (Chong & Forsyth, 2021). The results show that our method can translate the source faces into target domain with proper semantic change. In baseline models, although some images show high quality outputs, in most cases the image failed in translating the images. Also, since the baseline models rely on pre-trained StyleGAN, they require additional GAN inversion process to translate the source image. Therefore, the content information is not perfectly matched to the source image due to the limitation of GAN inversion methods.
|
| 440 |
+
|
| 441 |
+
# E INFERENCE TIME COMPARISON
|
| 442 |
+
|
| 443 |
+
To evaluate the time-efficiency of our method, we calculate the inference times of the various imageguided translation models. All experiments are conducted with single RTX3090 GPU, on the same hardware and software environment. We use the images of resolution $2 5 6 \times 2 5 6$ for experiments. In Table 4, we compare the times taken for single image translation. For single-shot semantic transfer models of Splicing ViT, the inference time is relatively long as we need to optimize large U-Net model for each image translation. In STROTSS, it requires texture matching calculation for single image translation, so it takes long time. For arbitrary style transfer models of WCT2 and SANet, the inference is done with only single-step network forward process, as the model is already trained with large dataset. Our model takes about 40 seconds, which is moderate when compared to the one-shot semantic transfer models (SplicingVit,STROTSS). However, the time is still longer than the style transfer models, as our model need multiple reverse DDPM steps for inference. In the future work, we are planning to improve the inference time with leveraging recent approaches.
|
| 444 |
+
|
| 445 |
+
Table 4: Quantitative comparison on inference times of image-guided translation models.
|
| 446 |
+
|
| 447 |
+
<table><tr><td></td><td>Ours</td><td>Splicing Vit</td><td>STROTSS</td><td>WCT2</td><td>SANET</td></tr><tr><td>time</td><td>37s</td><td>25m 30s</td><td>53s</td><td>0.18s</td><td>0.12s</td></tr></table>
|
| 448 |
+
|
| 449 |
+

|
| 450 |
+
Figure 9: Comparison results on semantic segmentation maps from baseline outputs. When comparing segmentation maps, our model outputs show high structural consistency with the source images.
|
| 451 |
+
|
| 452 |
+
# F SEMANTIC SEGMENTATION OUTPUTS
|
| 453 |
+
|
| 454 |
+
To further verify the structural consistency between output and source images, we compared the semantic segmentation maps from outputs and source images. For experiment, we use semantic segmentation model (Zhou et al., 2017) which is pre-trained on ADE20K dataset. We referenced the official source code10 for segmentation model. Figure 9 shows the comparison results. In case of the baseline models VQGAN-CLIP, CLIP-guided diffusion, we can see that the segmentation maps are not properly aligned to the source maps, which means the model cannot keep the structure of source images. In case of FlexIT, the model outputs maps have high similarity to the source maps, but the semantic change is not properly applied. In our model, we can see the output maps have high similarity to the source maps, while semantic information is properly changed.
|
| 455 |
+
|
| 456 |
+

|
| 457 |
+
Figure 10: Additional comparison on image-guided translation. For fair experiment conditioning, we trained the baseline SANet with ViT-based losses.
|
| 458 |
+
|
| 459 |
+

|
| 460 |
+
Figure 11: Ablation study results on pixel-wise l2 loss. Without pixel loss, the output image color is not matched to the color scale of the target images.
|
| 461 |
+
|
| 462 |
+
# G ADDITIONAL COMPARISON ON IMAGE-GUIDED TRANSLATION
|
| 463 |
+
|
| 464 |
+
For fair comparison with the baseline models, we trained the baseline SANet with our proposed ViTbased loss functions. When we train SANet with replacing the existing style and content loss with our $\ell _ { c o n t }$ and $\ell _ { s t y }$ , we found that the training is not properly working. Therefore, we simultaneously used existing VGG-based style and content loss with our proposed ViT-based losses. In Fig. 10, we can see that when training SANet with ViT, the results still show incomplete semantic transfer results. Although the output seems to contain more complex textures than basic model, the model performance is still confined to simple color transformation.
|
| 465 |
+
|
| 466 |
+

|
| 467 |
+
Figure 12: Failure case outputs. If the semantic distance between source and target conditions are extremely far, semantic translation sometimes fails.
|
| 468 |
+
|
| 469 |
+
To further evaluate the effect of pixel-wixe l2 loss for image-guided translation, we conducted additional experiments in Fig. 11. When we remove the pixel-wise l2 loss in our image-guided translation task, we can see the semantic of output images follow the target images, but the overall color of the output images are slightly unaligned with the target image color. The result show that using weak l2 loss help the model to accurately apply the color of target images to outputs.
|
| 470 |
+
|
| 471 |
+
# H LIMITATION AND FUTURE WORK
|
| 472 |
+
|
| 473 |
+
Although our method has shown successful performance in image conversion, it still has limitations to solve. First, if the semantic distance between the source image and the target domain is too far (e.g building Tiger), the output is not translated properly as shown in Fig. 12. We conjecture that this occurs when the text-image embedding space in the CLIP model is not accurately aligned, therefore it can be solved by using the advanced text-to-image embedding model. Second, our method has limitation that the image generation quality heavily relies on the performance of the pre-trained score model. This can also be solved if we use a diffusion model backbone with better performance. In future work, we plan to improve our proposed method in these two directions.
|
| 474 |
+
|
| 475 |
+
# I ADDITIONAL RESULTS
|
| 476 |
+
|
| 477 |
+
For additional results , in Fig. 13 we show the image translation outputs using text conditions. In Fig. 14, we additionally show the results from our image-guided image translation. We can successfully change the semantic of various natural images with text and image conditions.
|
| 478 |
+
|
| 479 |
+

|
| 480 |
+
Figure 13: Qualitative results of text-guided image translation.
|
| 481 |
+
|
| 482 |
+

|
| 483 |
+
Figure 14: Qualitative results of image-guided image translation.
|
md/dev/NnIaEaBfXD/NnIaEaBfXD.md
ADDED
|
@@ -0,0 +1,228 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Mix-of-Show: Decentralized Low-Rank Adaptation for Multi-Concept Customization of Diffusion Models
|
| 2 |
+
|
| 3 |
+
Yuchao $\mathbf { G u } ^ { 1 }$ , Xintao Wang3, Jay Zhangjie $\mathbf { W } \mathbf { u } ^ { 1 }$ , Yujun $\mathbf { S h i ^ { 2 } }$ , Yunpeng Chen2, Zihan $\mathbf { F a n } ^ { 2 }$ , Wuyou Xiao2, Rui Zhao1, Shuning Chang1, Weijia $\mathbf { W } \mathbf { u } ^ { 1 }$ , Yixiao $\mathbf { G e ^ { 3 } }$ , Ying Shan3, Mike Zheng Shou1∗
|
| 4 |
+
|
| 5 |
+
1Show Lab, 2National University of Singapore 3ARC Lab, Tencent PCG
|
| 6 |
+
|
| 7 |
+
https://showlab.github.io/Mix-of-Show
|
| 8 |
+
|
| 9 |
+
# Abstract
|
| 10 |
+
|
| 11 |
+
Public large-scale text-to-image diffusion models, such as Stable Diffusion, have gained significant attention from the community. These models can be easily customized for new concepts using low-rank adaptations (LoRAs). However, the utilization of multiple concept LoRAs to jointly support multiple customized concepts presents a challenge. We refer to this scenario as decentralized multiconcept customization, which involves single-client concept tuning and center-node concept fusion. In this paper, we propose a new framework called Mix-of-Show that addresses the challenges of decentralized multi-concept customization, including concept conflicts resulting from existing single-client LoRA tuning and identity loss during model fusion. Mix-of-Show adopts an embedding-decomposed LoRA (EDLoRA) for single-client tuning and gradient fusion for the center node to preserve the in-domain essence of single concepts and support theoretically limitless concept fusion. Additionally, we introduce regionally controllable sampling, which extends spatially controllable sampling (e.g., ControlNet and T2I-Adapter) to address attribute binding and missing object problems in multi-concept sampling. Extensive experiments demonstrate that Mix-of-Show is capable of composing multiple customized concepts with high fidelity, including characters, objects, and scenes.
|
| 12 |
+
|
| 13 |
+
# 1 Introduction
|
| 14 |
+
|
| 15 |
+
Open-source text-to-image diffusion models, such as Stable Diffusion [1], empower community users to create customized models by collecting personalized concept images and fine-tuning them with low-rank adaptation (LoRA) [2, 3]. These tailored LoRA models achieve unparalleled quality for specific concepts through meticulous data selection, preprocessing, and hyperparameter tuning. While existing concept LoRAs serve as plug-and-play plugins for pretrained models, there are still challenges in utilizing multiple concept LoRAs to extend the pretrained model and enable joint composition of those concepts. We refer to this
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: Illustration of decentralized multiconcept customization via Mix-of-Show.
|
| 19 |
+
|
| 20 |
+

|
| 21 |
+
Figure 2: How to generate Harry Potter and Thanos, these two (or even more) concepts from different shows, in the same image? Our Mix-of-Show enables complex compositions of multiple customized concepts (e.g., characters, objects, scenes) with individually trained concept LoRAs.
|
| 22 |
+
|
| 23 |
+
scenario as decentralized multi-concept customization. As shown in Fig. 1, it involves two steps: single-client concept tuning and center-node concept fusion. Each client retains their private concept data while sharing the tuned LoRA models. The center node leverages these concept LoRAs to update the pretrained model, enabling joint sampling of these customized concepts. Decentralized multi-concept customization facilitates maximum community engagement in producing high-quality concept LoRAs and offers flexibility in reusing and combining different concept LoRAs.
|
| 24 |
+
|
| 25 |
+
However, the existing LoRA tuning and weight fusion techniques [3] fail to address the challenges of decentralized multi-concept customization. We have identified two main challenges: concept conflict and identity loss. Concept conflict arises because current LoRA tuning methods do not differentiate between the roles of embeddings and LoRA weights. Our research reveals that embeddings effectively capture concepts within the pretrained models’ domain, while LoRA weight assist in capturing outof-domain information (e.g., styles or fine details cannot be directly modeled by the pretrained model). However, existing LoRA tuning methods place excessive emphasis on LoRA weights while overlooking the importance of embeddings. Consequently, the LoRA weights encode a significant portion of the identity of a given concept, resulting in semantically similar embeddings being projected onto concepts with different appearances. This, in turn, leads to conflicts during model fusion. Furthermore, existing weight fusion strategies compromise each concept’s identity and introduce interference from other concepts by performing a weighted average of all concept LoRAs.
|
| 26 |
+
|
| 27 |
+
To overcome the challenges of decentralized multi-concept customization, we propose Mix-of-Show, which involves embedding-decomposed LoRA (ED-LoRA) for single-client tuning and gradient fusion for center-node fusion. In single-client tuning, ED-LoRA is designed to address concept conflicts by preserving more in-domain essence within the embedding. To achieve this, we enhance the expressive ability of the concept embedding by decomposing it into layer-wise embeddings [4] and multi-word representations. At the central node, gradient fusion leverages multiple concept LoRAs to update the pretrained model. Since the diffusion model includes both forward and reverse diffusion processes, we can obtain the input/output features of each layer through sampling, even in the absence of data. Features from multiple concept LoRAs are combined to generate the fused gradient, which is used for layer-wise updating. Compared to weight fusion [3], gradient fusion aligns the inference behavior of each individual concept, significantly reducing identity loss.
|
| 28 |
+
|
| 29 |
+
To demonstrate the capabilities of Mix-of-Show, we introduce regionally controllable sampling for multi-concept generation. Direct multi-concept generation often encounters issues such as missing objects and attribute binding [5, 6]. Recently, spatially controllable sampling (e.g., ControlNet [7], T2I-Adapter [8]) have been introduced to guide diffusion models using spatial hints (e.g., keypose or sketch), which resolve the problem of missing objects but still faces challenges of attribute binding in multi-concept generation. Considering that spatial layout is pre-defined when adopting spatial conditions, we propose injecting region prompts through regional-aware cross-attention. Powered by Mix-of-Show and regionally controllable sampling, we can achieve complex compositions of multiple customized concepts, including characters, objects, and scenes, as illustrated in Fig. 2. In summary, our contributions are as follows: 1) We analyze the challenges of decentralized multiconcept customization. 2) We propose the Mix-of-Show framework, consisting of an embeddingdecomposed LoRA (ED-LoRA) and gradient fusion, to address the concept conflict and identity loss in decentralized multi-concept customization. 3) We introduce regionally controllable sampling to demonstrate the potential of Mix-of-Show in composing multiple customized concepts.
|
| 30 |
+
|
| 31 |
+
# 2 Related Work
|
| 32 |
+
|
| 33 |
+
# 2.1 Concept Customization
|
| 34 |
+
|
| 35 |
+
Concept customization aims to extend pretrained diffusion models to support personalized concepts using only a few images. There are two main types of concept tuning methods: embedding tuning (e.g., Textual Inversion [9] and $\mathrm { P } +$ [4]) and joint embedding-weight tuning (e.g., Dreambooth [10] and Custom Diffusion [11]). Additionally, the community [3] adopts low-rank adapter (LoRA) [2] for concept tuning, which is lightweight and can achieve comparable fidelity to full weight tuning.
|
| 36 |
+
|
| 37 |
+
Although significant progress has been made in single-concept customization, multi-concept customization remains a challenge. Custom Diffusion [11] proposes co-training of multiple concepts or constrained optimization of several existing concept models. Following this, SVDiff [12] introduces data augmentation to prevent concept mixing in co-training multi-concepts, and Cones [13] discovers concept neurons that can be added to support multiple concepts. However, their methods are typically restricted to fuse 2-3 semantically distinct concepts. In contrast, Mix-of-Show can combine theoretically limitless customized concepts, including those within the same semantic category.
|
| 38 |
+
|
| 39 |
+
Another research line in concept customization, as explored in studies by Instantbooth [14], ELITE [15], and Jia et al. [16], focuses on achieving fast test-time customization. These methods involve pretraining an encoder on a large-scale dataset specific to the desired category. During inference, when provided with a few representative concept images from the trained category, the encoder extracts features that complement the pretrained diffusion models and support customized generation. However, these methods require training a separate encoder for each category, typically limited to common categories (e.g., person or cats). This limitation hinders their ability to customize and compose more diverse and open-world subjects.
|
| 40 |
+
|
| 41 |
+
# 2.2 Decentralized Learning
|
| 42 |
+
|
| 43 |
+
Decentralized or federated learning aims to train models collaboratively across different clients without sharing data. The de facto algorithm for federated learning, FedAvg, was proposed by [17]. This method simply averages the weights of each client’s model to obtain the final model. However, we find that directly applying this simple weight averaging is not ideal for fusing LoRAs of different concepts. To improve over FedAvg, previous works have either focused on local client training [18, 19, 20, 21, 22, 23, 24] or global server aggregation [25, 26, 27, 28, 29, 30]. Motivated by this, we explore the optimal design of single-client tuning and center-node fusion for decentralized multi-concept customization.
|
| 44 |
+
|
| 45 |
+
# 2.3 Controllable Multi-Concept Generation
|
| 46 |
+
|
| 47 |
+
Direct multi-concept generation using text prompts alone faces challenges such as missing objects and attribute binding [6, 31, 32, 33, 34]. Previous approaches, like Attend-and-Excite [5] and Structure Diffusion [6], have attempted to address these issues, but the problem still persist, limiting the effectiveness of multi-concept generation. Recent works, such as ControlNet [7] and T2I-Adapter [8], introduce spatial control (e.g., keypose and sketch) and enable more accurate compositions, resolving the problem of missing objects in multi-concept generation. However, attribute binding remains a challenge. In our work, we tackle this challenge through regionally controllable sampling.
|
| 48 |
+
|
| 49 |
+
# 3 Methods
|
| 50 |
+
|
| 51 |
+
In this section, we provide a brief background on text-to-image diffusion models and concept customization in Sec. 3.1. We then introduce the task formulation of decentralized multi-concept customization in Sec. 3.2, followed by a detailed description of our method in Sec. 3.3 and Sec. 3.4.
|
| 52 |
+
|
| 53 |
+
# 3.1 Preliminary
|
| 54 |
+
|
| 55 |
+
Text-to-Image Diffusion Models. Diffusion models [35, 36, 37, 38, 39, 40, 41] belong to a class of generative models that gradually introduce noise into an image during the forward diffusion process and learn to reverse this process to synthesize images. When combined with pretrained text embeddings, text-to-image diffusion models [1, 42, 43, 44, 45, 46] are capable of generating high-fidelity images based on text prompts. In this paper, we conduct experiments using Stable Diffusion [1], which is a variant of the text-to-image diffusion model operating in the latent space. Given a condition $c = \psi ( P ^ { * } )$ , where $P ^ { * }$ is the text prompt and $\psi$ is the pretrained CLIP text encoder [47], the training objective for stable diffusion is to minimize the denoising objective by
|
| 56 |
+
|
| 57 |
+
where $z _ { t }$ is the latent feature at timestep $t$ and $\epsilon _ { \theta }$ is the denoising unet with learnable parameter $\theta$
|
| 58 |
+
|
| 59 |
+
Embedding Tuning for Concept Customization. Textual Inversion [9] represents the input concept using a unique token $V$ . When provided with a few images of the target concept, the embedding of $V$ is tuned using Eq. 1. After tuning, the embedding for $V$ encodes the essence of the target concept and functions like any other text in the pretrained model. To achieve greater disentanglement and control, $\mathrm { P } + [ 4 ]$ introduces layer-wise embeddings for concept tokens, denoted as $V ^ { + }$ in this paper.
|
| 60 |
+
|
| 61 |
+
# Single-Concept
|
| 62 |
+
|
| 63 |
+

|
| 64 |
+
Figure 3: Single- and multi-concept customization between the embedding tuning (i.e., Textual Inversion (TI) [9] and $\mathrm { P } +$ [4]), and joint embedding-weight tuning (i.e., LoRA [3] and our ED-LoRA). $P ^ { * } =$ “Photo of a $V$ , near the beach". $\Phi _ { 0 }$ and $\Delta \Phi$ denotes the pretrained model and LoRA weight.
|
| 65 |
+
|
| 66 |
+
Low-Rank Adaptation. Low-rank adaptation (LoRA) [2] was initially proposed to adapt largelanguage models to downstream tasks. It operates under the assumption that weight changes during adaptation have a low “intrinsic rank" and introduces a low-rank factorization of the weight change to obtain the updated weight $W$ , which is given by $W = W _ { 0 } + \Delta W = W _ { 0 } + B A .$ . Here, $\mathcal { W } _ { 0 } \in \breve { \mathbb { R } } ^ { d \times k }$ represents the original weight in the pretrained model, and $B \in \mathbb { R } ^ { d \times r }$ and $A \in \mathbb { R } ^ { r \times k }$ represent the low-rank factors, with $r \ll \operatorname* { m i n } ( d , k )$ . Recently, the community [3] has adopted LoRA for fine-tuning diffusion models, leading to promising results. LoRA is typically used as a plug-and-play plugin in pretrained models, but the community also employs weight fusion techniques to combine multiple LoRAs:
|
| 67 |
+
|
| 68 |
+
$$
|
| 69 |
+
W = W _ { 0 } + \sum _ { i = 1 } ^ { n } w _ { i } \Delta W _ { i } , \quad { \mathrm { s . t . } } \sum _ { i = 1 } ^ { n } w _ { i } = 1 ,
|
| 70 |
+
$$
|
| 71 |
+
|
| 72 |
+
where $w _ { i }$ denotes the normalized importance of different LoRAs.
|
| 73 |
+
|
| 74 |
+
# 3.2 Task Formulation: Decentralized Multi-Concept Customization
|
| 75 |
+
|
| 76 |
+
While custom diffusion [11] has attempted to merge two tuned concepts models into a pretrained model, their findings suggest that co-training with multiple concepts yields better results. However, considering scalability and reusability, we focus on merging single-concept models to support multi-concept customization. We refer to this setting as decentralized multi-concept customization.
|
| 77 |
+
|
| 78 |
+
Formally, decentralized multi-concept customization involves a two-step process: single-client concept tuning and center-node concept fusion. As shown in Fig. 1, each of the $n$ clients possesses its own private concept data and tunes the concept model $\Delta W _ { i }$ . Here, $\Delta W _ { i }$ represents the changes in network weights, which specifically refers to LoRA weights in our work. We omit discussing the merging of text embeddings, as the tuned embeddings can be seamlessly integrated into the pretrained model without conflicts.
|
| 79 |
+
|
| 80 |
+
After tuning, the center node gathers all LoRAs to obtain the updated pretrained weight $W$ by:
|
| 81 |
+
|
| 82 |
+
where $f$ represents the update rule that operates on the original pretrained model weight $W _ { 0 }$ and the $n$ concept LoRAs $\{ \Delta W _ { i } , i = 1 \cdots n \}$ . One straightforward updating rule $f$ is weight fusion, as illustrated in Eq. 2. Once updated, the new model $W$ should be capable of generating all the concepts introduced in the $n$ LoRAs.
|
| 83 |
+
|
| 84 |
+
# 3.3 Mix-of-Show
|
| 85 |
+
|
| 86 |
+
In this section, we introduce Mix-of-Show, containing ED-LoRA (in Sec. 3.3.1) for single-client concept tuning, gradient fusion (in Sec. 3.3.2) for center-node concept fusion.
|
| 87 |
+
|
| 88 |
+

|
| 89 |
+
Figure 4: Pipeline of Mix-of-Show. In single-client concept tuning, the ED-LoRA adopts the layerwise embedding and multi-word representation. In center node, gradient fusion is adopted to fuse multiple concept LoRAs and then support composing those customized concepts.
|
| 90 |
+
|
| 91 |
+
# 3.3.1 Single-Client Concept Tuning: ED-LoRA
|
| 92 |
+
|
| 93 |
+
Vanilla LoRA [3] is not suitable for decentralized multi-concept customization due to the issue of concept conflict. To better understand this limitation, we start by examining the distinct roles of embeddings and LoRA weights in concept tuning.
|
| 94 |
+
|
| 95 |
+
Single-Concept Tuning Setting. We investigate embedding tuning (i.e., Textual Inversion [9] and $\mathrm { P } +$ [4]) and the joint embedding-weight tuning (i.e., LoRA [3]) on single concept customization. We conduct experiments on both in-domain concept (i.e., directly sampled from the pretrained model), and out-domain concepts. The weights of the pretrained model, including the unet $\theta$ and the text encoder $\psi$ , are denoted as $\Phi _ { 0 } = \{ \theta _ { 0 } , \psi _ { 0 } \}$ . Given a text prompt $P ^ { * }$ containing the concept $V$ , we visualize the tuned embedding of concept $V$ using the pretrained weights $\Phi _ { 0 } ( \bar { P ^ { * } } )$ , and visualize the tuned embedding along with the LoRA weight using $( \Phi _ { 0 } + \Delta \Phi ) ( P ^ { * } )$ .
|
| 96 |
+
|
| 97 |
+
Analysis. Based on the experiment results in Fig. 3, we draw the following two observations regarding existing embedding tuning and joint embedding-weight tuning approaches.
|
| 98 |
+
|
| 99 |
+
Observation 1: The embeddings are capable of capturing concepts within the domain of pretrained models, while the LoRA helps capture out-domain information.
|
| 100 |
+
|
| 101 |
+
In Fig. 3(a, b), we observe that embedding tuning approaches such as Textual Inversion and $\mathrm { P } +$ struggle to capture out-domain concepts. This is because they attempt to encode all out-domain details (e.g., anime styles or details not modeled by the pretrained model $\Phi _ { 0 }$ ) within the embedding, resulting in semantic collapse. However, for in-domain concepts sampled from the model, embedding tuning accurately encodes the concept identity within the embedding, benefiting from the accurate modeling of concept details by the pretrained model weights $\Phi _ { 0 }$ . Furthermore, when jointly tuning the embedding with LoRA, the embedding no longer produces oversaturated outputs. This is because the out-domain information is captured by the pretrained model with LoRA weight shift (i.e., $\Phi _ { 0 } + \Delta \Phi )$ .
|
| 102 |
+
|
| 103 |
+
Observation 2: Existing LoRA weights encode most of the concept identity and project semantically similar embeddings to visually distinct concepts, leading to conflicts during concept fusion.
|
| 104 |
+
|
| 105 |
+
In the joint embedding-LoRA tuning results shown in Fig. 3(c), we observe that directly visualizing the embedding with the pretrained model $\Phi _ { 0 } ( P ^ { * } )$ yields semantically similar results. However, when the LoRA weights are loaded $( \Phi _ { 0 } + \Delta \Phi ) ( P ^ { * } )$ , the target concept can be accurately captured. This suggests that the majority of the concept identity is encoded within the LoRA weights rather than the embedding itself. However, when attempting to support multiple semantically similar concepts within a single model, it becomes problematic to determine which concept to sample based on similar embeddings, resulting in concept conflicts. As shown in Fig. 3(e), when fused into one model, the identity of each individual concept is lost.
|
| 106 |
+
|
| 107 |
+
Our Solution: ED-LoRA. Based on the aforementioned observations, our ED-LoRA is designed to preserve more in-domain essence within the embedding while capturing the remaining details using LoRA weights. To achieve this, we enhance the expressiveness of the embedding through decomposed embedding. As illustrated in Fig. 4, we adopt a layer-wise embedding similar to [4] and create a multi-world representation for the concept token $\mathbf { \bar { \rho } } \mathbf { \bar { V } } = V _ { r a n d } ^ { + } V _ { c l a s s } ^ { + } )$ . Here, $V _ { r a n d } ^ { + }$ is randomly initialized to capture the variance of different concepts, while $V _ { c l a s s } ^ { + }$ is initialized based on its semantic class to maintain semantic meaning. Both tokens are learnable during concept tuning. As shown in Fig. 3(d), the learned embedding of ED-LoRA effectively preserves the essence of the given concept within the domain of the pretrained model, while LoRA helps capture the other details.
|
| 108 |
+
|
| 109 |
+

|
| 110 |
+
Figure 5: Regionally controllable sampling for multi-concept generation.
|
| 111 |
+
|
| 112 |
+
# 3.3.2 Center-Node Concept Fusion: Gradient Fusion
|
| 113 |
+
|
| 114 |
+
At the center node, we have access to all the concept LoRAs and can use these models to update the pretrained model, enabling multi-concept customization. However, the existing weight fusion strategy described in Eq. 2 is insufficient to achieve this goal, as we will discuss further below.
|
| 115 |
+
|
| 116 |
+
Multi-Concept Fusion Setting. In this experiment, we apply the weight fusion described in Eq. 2 to weighted average $n$ concept LoRAs or ED-LoRAs $\{ \Delta \Phi _ { i } , i = 1 \cdots n \}$ into the pretrained model $\Phi _ { 0 }$ , resulting in a new model $\Phi$ . We then use the new model $\Phi ( P _ { i } ^ { * } )$ to sample each concept and compare its identity with the corresponding single-concept sample $( \bar { \Phi _ { 0 } } + \Delta \Phi ) ( P _ { i } ^ { * } )$ .
|
| 117 |
+
|
| 118 |
+
Analysis. Based on the results in Fig. 3, we make the following observation about fusion strategy.
|
| 119 |
+
|
| 120 |
+
Observation 3: Weight fusion leads to identity loss of individual concepts in concept fusion.
|
| 121 |
+
|
| 122 |
+
As shown in Fig. 3 (multi-concept), we can observe that weight fusion in the case of LoRA leads to significant loss of concept identity due to conflicts between concepts. Even when combined with our ED-LoRA, weight fusion still compromises the identity of each individual concept. In theory, if a concept achieves its complete identity through LoRA weight shift $\Delta \Phi ( P ^ { * } )$ , fusing it with $n$ -1 other concept LoRAs requires reducing its weight to $\begin{array} { r } { { \frac { 1 } { n } } \Delta \Phi ( P ^ { * } ) } \\ { . ^ { n } } \end{array}$ and introducing other concept LoRA weights, which ultimately diminishes the concept’s identity.
|
| 123 |
+
|
| 124 |
+
Our Solution: Gradient Fusion. Based on the previous analysis, our objective is to preserve the identity of each concept in the fused model by aligning their single-concept inference behavior. Unlike in federated learning [17, 19], where models are typically single-direction classification models that cannot access gradients without data, text-to-image diffusion models have the inherent capability to decode concepts from text prompts. Leveraging this characteristic, we first decode the individual concepts using their respective LoRA weights, as depicted in Fig. 4(b). We then extract the input and output features associated with each LoRA layer. These input/output features from different concepts ate eac, where yer rep $W$ using the following objective:ents the input activation of the $W = \mathrm { a r g } \mathrm { m i n } _ { W }$ $\begin{array} { r } { \sum _ { i = 1 } ^ { n } | | ( \boldsymbol { W _ { 0 } } + \Delta \boldsymbol { W _ { i } } ) X _ { i } - \boldsymbol { W } X _ { i } | | _ { F } ^ { 2 } } \end{array}$ $X _ { i }$ $i$ -th concept, and $| \cdot | _ { F }$ denotes the Frobenius norm. By adopting this approach, we can fuse different concept LoRAs without accessing the data and without considering their differences during training. The results of our gradient fusion are shown in Fig. 3(f), demonstrating improved preservation of each concept’s identity and consistent stylization across different concepts.
|
| 125 |
+
|
| 126 |
+
# 3.4 Regionally Controllable Sampling
|
| 127 |
+
|
| 128 |
+
Direct multi-concept sampling often encounters challenges of missing objects and attribute binding [6, 31, 32, 33, 34]. While spatially controllable sampling methods (e.g., ControlNet [7] and T2IAdapter [8]) can address the issue of missing objects in multi-concept generation, they cannot accurately bind concepts to specific keyposes or sketches. Merely indicating the desired concept
|
| 129 |
+
|
| 130 |
+

|
| 131 |
+
Figure 6: Qualitative comparison on single- and multi-concept customization.
|
| 132 |
+
|
| 133 |
+
<table><tr><td></td><td>Methods</td><td>Real-Objects Single→Fused</td><td>Real-Characters Single-→Fused</td><td>Real-Scenes Single-→Fused</td><td>Mean Change</td></tr><tr><td rowspan="5">Text-alignment</td><td>Upper Bound</td><td>0.811</td><td>0.767</td><td>0.834</td><td>0.804</td></tr><tr><td>P+ [4]</td><td>0.771-→0.771 (-)</td><td>0.686-→0.686(-)</td><td>0.759-→0.759 (-)</td><td>0.739-→0.739 (-)</td></tr><tr><td>Custom Diffusion [11]</td><td>0.745->0.747(+0.002)</td><td>0.674-0.650 (-0.024)</td><td>0.748-→0.738 (-0.010)</td><td>0.722-0.712(-0.010)</td></tr><tr><td>LoRA [3]</td><td>0.720->0.795 (+0.075)</td><td>0.654->0.700 (+0.046)</td><td>0.717->0.760 (+0.043)</td><td>0.697-→0.752(+0.055)</td></tr><tr><td>Mix-of-Show (Ours)</td><td>0.724-→0.745 (+0.021)</td><td>0.632-→0.662(+0.030)</td><td>0.716-→0.736(+0.020)</td><td>0.691-0.714(+0.024)</td></tr><tr><td rowspan="5">Image-alignment</td><td>Lower Bound</td><td>0.721</td><td>0.471</td><td>0.595</td><td>0.596</td></tr><tr><td>P+ [4]</td><td>0.790→0.790 (-)</td><td>0.670-→0.670 (-)</td><td>0.796→0.796 (-)</td><td>0.752-→0.752(-)</td></tr><tr><td>Custom Diffusion [11]</td><td>0.842-→0.808 (-0.034)</td><td>0.714-→0.694 (-0.020)</td><td>0.804-→0.750 (-0.054)</td><td>0.787-→0.751(-0.036)</td></tr><tr><td>LoRA [3]</td><td>0.864-→0.778 (-0.086)</td><td>0.761-→0.555(-0.206)</td><td>0.824-→0.769 (-0.055)</td><td>0.816-→0.701 (-0.115)</td></tr><tr><td>Mix-of-Show (Ours)</td><td>0.868-→0.846 (-0.022)</td><td>0.802->0.770 (-0.032)</td><td>0.858-→0.838 (-0.020)</td><td>0.843-→0.818(-0.025)</td></tr></table>
|
| 134 |
+
|
| 135 |
+
Table 1: Text-alignment and image-alignment vary between the single-client tuned model and the center-node fused model. The upper bound of text-alignment and the lower bound of image-alignment are computed by replacing the concept’s token (e.g., $V ^ { d o g A ^ { \prime } }$ ) with its class token (e.g., dog) and sampling using the pretrained model.
|
| 136 |
+
|
| 137 |
+
and attribute through a text prompt can lead to attribute binding problems, as in Fig. 5(a), where the identities of three people are mixed, and the "red dress" is incorrectly assigned to other concepts.
|
| 138 |
+
|
| 139 |
+
To address these challenges, we propose a method called regionally controllable sampling. This approach utilizes both a global prompt and multiple regional prompts to describe an image based on spatial conditions. The global prompt provides the overall context, while the regional prompts specify subjects within specific regions, including their attributes and contextual information from the global prompt (e.g., "near a lake"). To achieve this, we introduce region-aware cross-attention. Given a global prompt $P _ { g } ^ { * }$ and $n$ regional prompts $P _ { r _ { i } } ^ { * }$ , we first incorporate the global prompt via cross-attention with the latent $z$ by $\begin{array} { r } { h = \mathrm { s o f t m a x } \left( \frac { Q ( z ) \dot { K } ( P _ { g } ^ { * } ) } { \sqrt { d } } \right) \cdot V ( P _ { g } ^ { * } ) } \end{array}$ . Then, we extract the regional latent feature by $z _ { \mathrm { i } } = z \odot M _ { i }$ , where $M _ { i }$ represents the binary mask associated with the region specified by $P _ { r _ { i } } ^ { * }$ . We obtain regional features using $h _ { i } = \mathrm { s o f t m a x } \left( \frac { Q ( z _ { i } ) K ( P _ { r _ { i } } ^ { * } ) } { \sqrt { d } } \right) \cdot V ( P _ { r _ { i } } ^ { * } )$ . Finally, we replace the features in the global output with the regional features: $h [ M _ { i } ] = h _ { i }$ . As shown in Fig. 5(b), regionally controllable sampling allows for precise assignment of subjects and attributes, while maintaining a harmonious global context.
|
| 140 |
+
|
| 141 |
+
# 4 Experiments
|
| 142 |
+
|
| 143 |
+
# 4.1 Datasets and Implementation Details
|
| 144 |
+
|
| 145 |
+
To conduct evaluation for Mix-of-Show, we collect a dataset containing characters, objects, and scenes. For ED-LoRA tuning, we incorporate LoRA layer into the linear layer in all attention (a) Subject identity preservation (i.e., image-alignment) measured by CLIP score between LoRA $^ +$ weight fusion, ED-LoRA $^ +$ weight fusion, and ED-LoRA $^ +$ gradient fusion. Our ED-LoRA $^ +$ gradient fusion achieves the least loss in image-alignment after multi-concept fusion, preserving the best subject identity.
|
| 146 |
+
|
| 147 |
+

|
| 148 |
+
Figure 7: Qualitative ablation study of Mix-of-Show. $P ^ { * }$ means the text prompt. $\Phi _ { 0 }$ and $\Delta \Phi$ denotes the pretrained model and LoRA weight, respectively.
|
| 149 |
+
|
| 150 |
+
<table><tr><td></td><td>Methods</td><td>Real-Objects Single-→Fused</td><td>Real-Characters Single-→Fused</td><td>Real-Scenes Single-→Fused</td><td>Mean Change</td></tr><tr><td rowspan="4">Image-alignment</td><td>Lower Bound</td><td>0.721</td><td>0.471</td><td>0.595</td><td>0.596</td></tr><tr><td>LoRA+ Weight Fusion</td><td>0.864- 0.778 (-0.086)</td><td>0.761-0.555(-0.206)</td><td>0.824->0.769 (-0.055)</td><td>0.816-→0.701 (-0.115)</td></tr><tr><td>ED-LoRA + Weight Fusion</td><td>0.868-→0.798 (-0.070)</td><td>0.802-→0.634 (-0.168)</td><td>0.858->0.816 (-0.042)</td><td>0.843->0.749 (-0.094)</td></tr><tr><td>ED-LoRA + Gradient Fusions</td><td>0.868-→0.846(-0.022)</td><td>0.802-→0.770 (-0.032)</td><td>0.858-→0.838 (-0.020)</td><td>0.843-0.818 (-0.025)</td></tr></table>
|
| 151 |
+
|
| 152 |
+

|
| 153 |
+
|
| 154 |
+
<table><tr><td>Human Evaluation</td><td>Image Alignment</td><td>Text Alignment</td></tr><tr><td>ED-LoRA+Weight Fusion</td><td>33.5%</td><td>47.5%</td></tr><tr><td>ED-LoRA + Gradient Fusion</td><td>66.5%</td><td>52.5%</td></tr></table>
|
| 155 |
+
|
| 156 |
+
(b) Human preference study interface on Amazon Mechanical Turk.
|
| 157 |
+
|
| 158 |
+
(c) Human preference study between weight fusion and gradient fusion for fusing ED-LoRAs.
|
| 159 |
+
|
| 160 |
+
Table 2: Quantitative ablation study of our main components. (a) Ablation study between the LoRA $^ +$ weight fusion, ED-LoRA $^ +$ weight fusion and our ED-LoRA $^ +$ gradient fusion. (b, c) Human preference study to comparing weight fusion and gradient fusion for fusing our ED-LoRAs.
|
| 161 |
+
|
| 162 |
+
modules of the text encoder and Unet, with a rank of $r = 4$ in all experiments. We use the Adam [48] optimizer with a learning rate of 1e-3, 1e-5 and 1e-4 for tuning text embedding, text encoder and Unet, respectively. For gradient fusion, we use the LBFGS optimizer [49] with 500 and 50 steps to optimize the text encoder and Unet, respectively. More details are provided in the supplementary.
|
| 163 |
+
|
| 164 |
+
# 4.2 Qualitative Comparison
|
| 165 |
+
|
| 166 |
+
Single-Concept Results. We compare our ED-LoRA with LoRA [3], Custom Diffusion [11] and $\mathrm { P } +$ [4] for single-concept customization. The results are shown in Fig. 6 (a). Our ED-LoRA achieves comparable performance to previous methods on customizing objects, while maintaining better identity for character customization. More comparisons are provided in the supplementary.
|
| 167 |
+
|
| 168 |
+
Multi-Concept Results. We compare Mix-of-Show with LoRA [3], Custom Diffusion [11], and $\mathrm { P } +$ [4] for decentralized multi-concept customization. For LoRA,we utilize weight fusion to combine the different concepts. In the case of $\mathrm { P } +$ , we directly incorporate the tuned concept embedding into the pretrained model. And for Custom Diffusion, we follow their approach of constrained optimization to merge the key and value projections in cross-attention. To ensure fair evaluation, we employ the same regionally controllable sampling for multi-concept generation across all models and the results are summarized in Fig. 6 (b).
|
| 169 |
+
|
| 170 |
+
$\mathrm { P } +$ [4] and Custom Diffusion [11] only tunes text-related module (i.e., text embedding, or the key and value projection of cross-attention). In contrast, LoRA and Mix-of-Show add LoRA layers to the entire model. The limited scope of tuned modules in $\mathrm { P } +$ and Custom Diffusion leads to an excessive encoding of out-domain low-level details within the embedding. This leads to unnatural and less desirable outcomes when compared to LoRA and Mix-of-Show. In comparison to LoRA, which loses concept identity after weight fusion, Mix-of-Show effectively preserves the identity of each individual concept.
|
| 171 |
+
|
| 172 |
+
# 4.3 Quantitative Comparison
|
| 173 |
+
|
| 174 |
+
Following Custom Diffusion [11], we utilize the CLIP [47] text/image encoder to assess text alignment and image alignment. We evaluate on different category of concepts on both single-concept tuned model and multi-concept fused model. We include detailed evaluation setting in the supplementary.
|
| 175 |
+
|
| 176 |
+
Based on the results presented in Table. 1, both Mix-of-Show and LoRA exhibit superior image alignment compared to other methods, all the while maintaining comparable text alignment in the single-client tuned model. This achievement stems from their fine-tuning the spatial-related layer in Unet (e.g., linear projection layer in self-attention), a critical aspect for accurately capturing the complex concepts’ identity, such as characters.
|
| 177 |
+
|
| 178 |
+
However, the main difference between LoRA and Mix-of-Show emerges in the context of multiconcept fusion. In the center-node fused model, LoRA experiences a significant decline in image alignment for each concept, progressively deteriorating towards the lower bound. In contrast, our Mix-of-Show method undergoes far less degradation in image alignment after multi-concept fusion.
|
| 179 |
+
|
| 180 |
+
# 4.4 Ablation Study
|
| 181 |
+
|
| 182 |
+
Embedding Expressiveness. In Fig. 7(a), it is evident that our decomposed embeddings better preserve the identity of the specified concept compared to the standard text embeddings used in LoRA. This results in a more robust encoding of concept identity. As shown in the quantitative results in Table. 2(a), when LoRA is replaced with ED-LoRA, the identity loss from weight fusion (measured by mean change of image-alignment) is reduced from 0.115 to 0.094. This result verifies that expressive embeddings help reduce identity loss during multi-concept fusion.
|
| 183 |
+
|
| 184 |
+
Fusion Type. Built with the same ED-LoRAs, we conduct experiments to compare weight fusion and gradient fusion. As shown in Fig. 7(b), gradient fusion effectively preserves concept identity after concept fusion, resulting in superior results for multi-concept sampling. According to the quantitative results in Table. 2(a), gradient fusion significantly reduces the identity loss of weight fusion, decreasing it from 0.094 to 0.025. We also conduct a human evaluation and confirm a clear preference for gradient fusion, as indicated in Table. 2(c).
|
| 185 |
+
|
| 186 |
+
Regionally Controllable Sampling. As shown in Fig. 7(c), direct sampling lead to attribute binding issues, where the concept identities are mixed. However, our regionally controllable sampling overcomes this problem and achieves correct attribute binding in multi-concept generation.
|
| 187 |
+
|
| 188 |
+
# 5 Conclusion
|
| 189 |
+
|
| 190 |
+
In this work, we explore decentralized multi-concept customization and highlight the limitations of existing methods like LoRA tuning and weight fusion, which suffer from concept conflicts and identity loss in this scenario. To overcome these challenges, we propose Mix-of-Show, a framework that combines ED-LoRA for single-client concept tuning and gradient fusion for centernode concept fusion. ED-LoRA preserves individual concept essence in the embedding, avoiding conflicts, while gradient fusion minimizes identity loss during concept fusion. We also introduce regionally controllable sampling to handle attribute binding in multi-concept generation. Experiments demonstrate Mix-of-Show can successfully generate complex compositions of multiple customized concepts, including characters, objects and scenes.
|
| 191 |
+
|
| 192 |
+
# Acknowledgements
|
| 193 |
+
|
| 194 |
+
This project is supported by the National Research Foundation, Singapore under its NRFF Award NRF-NRFF13-2021-0008, and the Ministry of Education, Singapore, under the Academic Research Fund Tier 1 (FY2022).
|
| 195 |
+
|
| 196 |
+
References
|
| 197 |
+
[1] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. Highresolution image synthesis with latent diffusion models. In CVPR, pages 10684–10695, 2022. 1, 4
|
| 198 |
+
[2] Edward J Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. Lora: Low-rank adaptation of large language models. arXiv preprint arXiv:2106.09685, 2021. 1, 3, 5
|
| 199 |
+
[3] Simo Ryu. Low-rank adaptation for fast text-to-image diffusion fine-tuning. https://github. com/cloneofsimo/lora. 1, 3, 5, 6, 8, 9
|
| 200 |
+
[4] Andrey Voynov, Qinghao Chu, Daniel Cohen-Or, and Kfir Aberman. $^ { p + }$ : Extended textual conditioning in text-to-image generation. arXiv preprint arXiv:2303.09522, 2023. 3, 4, 5, 6, 8, 9
|
| 201 |
+
[5] Hila Chefer, Yuval Alaluf, Yael Vinker, Lior Wolf, and Daniel Cohen-Or. Attend-andexcite: Attention-based semantic guidance for text-to-image diffusion models. arXiv preprint arXiv:2301.13826, 2023. 3, 4
|
| 202 |
+
[6] Weixi Feng, Xuehai He, Tsu-Jui Fu, Varun Jampani, Arjun Akula, Pradyumna Narayana, Sugato Basu, Xin Eric Wang, and William Yang Wang. Training-free structured diffusion guidance for compositional text-to-image synthesis. arXiv preprint arXiv:2212.05032, 2022. 3, 4, 7
|
| 203 |
+
[7] Lvmin Zhang and Maneesh Agrawala. Adding conditional control to text-to-image diffusion models. arXiv preprint arXiv:2302.05543, 2023. 3, 4, 7
|
| 204 |
+
[8] Chong Mou, Xintao Wang, Liangbin Xie, Jian Zhang, Zhongang Qi, Ying Shan, and Xiaohu Qie. T2i-adapter: Learning adapters to dig out more controllable ability for text-to-image diffusion models. arXiv preprint arXiv:2302.08453, 2023. 3, 4, 7
|
| 205 |
+
[9] Rinon Gal, Yuval Alaluf, Yuval Atzmon, Or Patashnik, Amit H Bermano, Gal Chechik, and Daniel Cohen-Or. An image is worth one word: Personalizing text-to-image generation using textual inversion. arXiv preprint arXiv:2208.01618, 2022. 3, 4, 5, 6
|
| 206 |
+
[10] Nataniel Ruiz, Yuanzhen Li, Varun Jampani, Yael Pritch, Michael Rubinstein, and Kfir Aberman. Dreambooth: Fine tuning text-to-image diffusion models for subject-driven generation. arXiv preprint arXiv:2208.12242, 2022. 3
|
| 207 |
+
[11] Nupur Kumari, Bingliang Zhang, Richard Zhang, Eli Shechtman, and Jun-Yan Zhu. Multiconcept customization of text-to-image diffusion. arXiv preprint arXiv:2212.04488, 2022. 3, 5, 8, 9, 10
|
| 208 |
+
[12] Ligong Han, Yinxiao Li, Han Zhang, Peyman Milanfar, Dimitris Metaxas, and Feng Yang. Svdiff: Compact parameter space for diffusion fine-tuning. arXiv preprint arXiv:2303.11305, 2023. 3
|
| 209 |
+
[13] Zhiheng Liu, Ruili Feng, Kai Zhu, Yifei Zhang, Kecheng Zheng, Yu Liu, Deli Zhao, Jingren Zhou, and Yang Cao. Cones: Concept neurons in diffusion models for customized generation. arXiv preprint arXiv:2303.05125, 2023. 3
|
| 210 |
+
[14] Jing Shi, Wei Xiong, Zhe Lin, and Hyun Joon Jung. Instantbooth: Personalized text-to-image generation without test-time finetuning. arXiv preprint arXiv:2304.03411, 2023. 4
|
| 211 |
+
[15] Yuxiang Wei, Yabo Zhang, Zhilong Ji, Jinfeng Bai, Lei Zhang, and Wangmeng Zuo. Elite: Encoding visual concepts into textual embeddings for customized text-to-image generation. arXiv preprint arXiv:2302.13848, 2023. 4
|
| 212 |
+
[16] Xuhui Jia, Yang Zhao, Kelvin CK Chan, Yandong Li, Han Zhang, Boqing Gong, Tingbo Hou, Huisheng Wang, and Yu-Chuan Su. Taming encoder for zero fine-tuning image customization with text-to-image diffusion models. arXiv preprint arXiv:2304.02642, 2023. 4
|
| 213 |
+
[17] Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Aguera y Arcas. Communication-efficient learning of deep networks from decentralized data. In Artificial intelligence and statistics, pages 1273–1282. PMLR, 2017. 4, 7
|
| 214 |
+
[18] Qinbin Li, Bingsheng He, and Dawn Song. Model-contrastive federated learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10713–10722, 2021. 4 [19] Tian Li, Anit Kumar Sahu, Manzil Zaheer, Maziar Sanjabi, Ameet Talwalkar, and Virginia Smith. Federated optimization in heterogeneous networks. Proceedings of Machine Learning and Systems, 2:429–450, 2020. 4, 7 [20] Sai Praneeth Karimireddy, Satyen Kale, Mehryar Mohri, Sashank Reddi, Sebastian Stich, and Ananda Theertha Suresh. Scaffold: Stochastic controlled averaging for federated learning. In International Conference on Machine Learning, pages 5132–5143. PMLR, 2020. 4 [21] Durmus Alp Emre Acar, Yue Zhao, Ramon Matas Navarro, Matthew Mattina, Paul N Whatmough, and Venkatesh Saligrama. Federated learning based on dynamic regularization. arXiv preprint arXiv:2111.04263, 2021. 4 [22] Maruan Al-Shedivat, Jennifer Gillenwater, Eric Xing, and Afshin Rostamizadeh. Federated learning via posterior averaging: A new perspective and practical algorithms. arXiv preprint arXiv:2010.05273, 2020. 4 [23] Lixu Wang, Shichao Xu, Xiao Wang, and Qi Zhu. Addressing class imbalance in federated learning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages
|
| 215 |
+
10165–10173, 2021. 4 [24] Yujun Shi, Jian Liang, Wenqing Zhang, Vincent YF Tan, and Song Bai. Towards understanding and mitigating dimensional collapse in heterogeneous federated learning. arXiv preprint arXiv:2210.00226, 2022. 4 [25] Jianyu Wang, Qinghua Liu, Hao Liang, Gauri Joshi, and H Vincent Poor. Tackling the objective inconsistency problem in heterogeneous federated optimization. Advances in neural information processing systems, 33:7611–7623, 2020. 4 [26] Tzu-Ming Harry Hsu, Hang Qi, and Matthew Brown. Measuring the effects of non-identical data distribution for federated visual classification. arXiv preprint arXiv:1909.06335, 2019. 4 [27] Mi Luo, Fei Chen, Dapeng Hu, Yifan Zhang, Jian Liang, and Jiashi Feng. No fear of heterogeneity: Classifier calibration for federated learning with non-iid data. Advances in Neural Information Processing Systems, 34, 2021. 4 [28] Hongyi Wang, Mikhail Yurochkin, Yuekai Sun, Dimitris Papailiopoulos, and Yasaman Khazaeni. Federated learning with matched averaging. arXiv preprint arXiv:2002.06440, 2020. 4 [29] Tao Lin, Lingjing Kong, Sebastian U Stich, and Martin Jaggi. Ensemble distillation for robust model fusion in federated learning. Advances in Neural Information Processing Systems,
|
| 216 |
+
33:2351–2363, 2020. 4 [30] Sashank Reddi, Zachary Charles, Manzil Zaheer, Zachary Garrett, Keith Rush, Jakub Konecnˇ y,\` Sanjiv Kumar, and H Brendan McMahan. Adaptive federated optimization. arXiv preprint arXiv:2003.00295, 2020. 4 [31] Jiahui Yu, Yuanzhong Xu, Jing Yu Koh, Thang Luong, Gunjan Baid, Zirui Wang, Vijay Vasudevan, Alexander Ku, Yinfei Yang, Burcu Karagol Ayan, et al. Scaling autoregressive models for content-rich text-to-image generation. arXiv preprint arXiv:2206.10789, 2022. 4, 7 [32] Kimin Lee, Hao Liu, Moonkyung Ryu, Olivia Watkins, Yuqing Du, Craig Boutilier, Pieter Abbeel, Mohammad Ghavamzadeh, and Shixiang Shane Gu. Aligning text-to-image models using human feedback. arXiv preprint arXiv:2302.12192, 2023. 4, 7 [33] Xiaoshi Wu, Keqiang Sun, Feng Zhu, Rui Zhao, and Hongsheng Li. Better aligning text-toimage models with human preference. arXiv preprint arXiv:2303.14420, 2023. 4, 7 [34] Wan-Duo Kurt Ma, JP Lewis, W Bastiaan Kleijn, and Thomas Leung. Directed diffusion: Direct control of object placement through attention guidance. arXiv preprint arXiv:2302.13153, 2023.
|
| 217 |
+
4, 7 [35] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 33:6840–6851, 2020. 4 [36] Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. arXiv preprint arXiv:2010.02502, 2020. 4 [37] Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in Neural Information Processing Systems, 34:8780–8794, 2021. 4 [38] Jonathan Ho and Tim Salimans. Classifier-free diffusion guidance. arXiv preprint arXiv:2207.12598, 2022. 4
|
| 218 |
+
[39] Kushagra Pandey, Avideep Mukherjee, Piyush Rai, and Abhishek Kumar. Diffusevae: Efficient, controllable and high-fidelity generation from low-dimensional latents. arXiv preprint arXiv:2201.00308, 2022. 4
|
| 219 |
+
[40] Cheng Lu, Yuhao Zhou, Fan Bao, Jianfei Chen, Chongxuan Li, and Jun Zhu. Dpm-solver: A fast ode solver for diffusion probabilistic model sampling in around 10 steps. arXiv preprint arXiv:2206.00927, 2022. 4
|
| 220 |
+
[41] Cheng Lu, Yuhao Zhou, Fan Bao, Jianfei Chen, Chongxuan Li, and Jun Zhu. Dpmsolver $^ { \cdot + + }$ : Fast solver for guided sampling of diffusion probabilistic models. arXiv preprint arXiv:2211.01095, 2022. 4
|
| 221 |
+
[42] Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily L Denton, Kamyar Ghasemipour, Raphael Gontijo Lopes, Burcu Karagol Ayan, Tim Salimans, et al. Photorealistic text-to-image diffusion models with deep language understanding. Advances in Neural Information Processing Systems, 35:36479–36494, 2022. 4
|
| 222 |
+
[43] Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022. 4
|
| 223 |
+
[44] 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. 4
|
| 224 |
+
[45] Shuyang Gu, Dong Chen, Jianmin Bao, Fang Wen, Bo Zhang, Dongdong Chen, Lu Yuan, and Baining Guo. Vector quantized diffusion model for text-to-image synthesis. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10696–10706, 2022. 4
|
| 225 |
+
[46] Yogesh Balaji, Seungjun Nah, Xun Huang, Arash Vahdat, Jiaming Song, Karsten Kreis, Miika Aittala, Timo Aila, Samuli Laine, Bryan Catanzaro, et al. ediffi: Text-to-image diffusion models with an ensemble of expert denoisers. arXiv preprint arXiv:2211.01324, 2022. 4
|
| 226 |
+
[47] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In ICML, pages 8748–8763. PMLR, 2021. 4, 10
|
| 227 |
+
[48] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. 9
|
| 228 |
+
[49] Dong C Liu and Jorge Nocedal. On the limited memory bfgs method for large scale optimization. Mathematical programming, 45(1-3):503–528, 1989. 9
|
md/dev/QYvFUlF19n/QYvFUlF19n.md
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# In-Context Learning Creates Task Vectors
|
| 2 |
+
|
| 3 |
+
Roee Hendel Tel Aviv University roee.hendel@mail.tau.ac.il
|
| 4 |
+
|
| 5 |
+
Mor Geva Google DeepMind pipek@google.com
|
| 6 |
+
|
| 7 |
+
Amir Globerson Tel Aviv University, Google gamir@tauex.tau.ac.il
|
| 8 |
+
|
| 9 |
+
# Abstract
|
| 10 |
+
|
| 11 |
+
In-context learning (ICL) in Large Language Models (LLMs) has emerged as a powerful new learning paradigm. However, its underlying mechanism is still not well understood. In particular, it is challenging to map it to the “standard” machine learning framework, where one uses a training set $S$ to find a best-fitting function $f ( x )$ in some hypothesis class. Here we make progress on this problem by showing that the functions learned by ICL often have a very simple structure: they correspond to the transformer LLM whose only inputs are the query $x$ and a single “task vector” calculated from the training set. Thus, ICL can be seen as compressing $S$ into a single task vector $\pmb \theta ( S )$ and then using this task vector to modulate the transformer to produce the output. We support the above claim via comprehensive experiments across a range of models and tasks.1
|
| 12 |
+
|
| 13 |
+
# 1 Introduction
|
| 14 |
+
|
| 15 |
+
Large language models have improved dramatically over the last several years. One striking property of these models is that they can learn new rules from very few demonstrations. For instance, a model can be prompted with the input $\ddot { \bf \Phi } ^ { \prime \prime } A p p l e R e d _ { \mathrm { \tiny { + } } }$ , Lime Green, $C o r n ^ { \prime \prime }$ and produce the output “Yellow”. The model has thus learned a mapping based on just two examples, which it can apply correctly to new examples. This capability, referred to as InContext Learning (ICL), has been used extensively, yielding impressive empirical results (Brown et al., 2020; Liu et al., 2023; Dong et al., 2022).
|
| 16 |
+
|
| 17 |
+
Given this success, it is natural to ask what is the underlying mechanism behind ICL. Namely, how does the model internally use the demonstrations $S$ and the query $x$ to produce the required output? Here we approach this question by utilizing the concept of a hypothesis class from statistical learning theory (Shalev-Shwartz and Ben-David, 2014). In the learning-theoretic formulation, one typically considers a hypothesis class $\mathcal { H }$ , where every element of $\mathcal { H }$ is a function $h ( x ; \pmb \theta )$ , operating on the input $x$ , and specified by a parameter vector $\pmb \theta$ . For example, if $\boldsymbol { x } \in \mathbb { R } ^ { d }$ then the class $\mathcal { H }$ could be the set of linear classifiers, defined by a coefficient vector $\pmb \theta$ as $h ( x ; \pmb \theta ) = \pmb \theta \cdot \boldsymbol x$ . Learning algorithms seek an element $h \in \mathcal H$ that fits the training set well. This is known as Empirical Risk Minimization.
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: ICL as learning in a Hypothesis Class. In ICL, one provides an LLM with a prompt including demonstrations $S$ of some task, and a query $x$ . The model generates the output for $x$ (here “Yellow”). We show that the underlying process can be broken down into two parts: $\mathcal { A }$ , a “learning algorithm” (marked in blue), computes a query-agnostic vector $\pmb \theta ( S )$ , which we view as a parameter of a function in a hypothesis class. The second part, denoted by $f$ and marked in yellow, is the application of the rule defined by $\pmb \theta$ on the query $x$ , without direct dependence on $S$ .
|
| 21 |
+
|
| 22 |
+
It is unclear whether ICL operates in such a way because the prediction is performed via $T ( [ S , x ] )$ , where $T$ is typically an auto-regressive transformer and $[ S , x ]$ is a concatenation of the tokens in $S$ and $x$ . Thus, in the general case, it can be an arbitrary function that operates on $S$ and $x$ to produce the output. This can include “non-parametric” methods such as nearest-neighbor. Recent work has begun to explore this question. For example, it was shown that when training a transformer from scratch to perform linear regression in context, the emerging learning algorithm is similar to Stochastic Gradient Descent (Akyürek et al., 2022; von Oswald et al., 2022). However, for LLMs performing more complex natural language tasks, it is not at all clear what the hypothesis space may be.
|
| 23 |
+
|
| 24 |
+
In this work, we show that on a wide range of tasks, ICL in LLMs can be viewed as working on a very natural hypothesis space. We argue that, given a training set $S$ , the transformer maps it into a “task vector” $\pmb \theta ( S )$ that essentially represents the mapping/rule described in $S$ .2 Namely, given the transformer $T$ and a vector $\pmb \theta$ , we can construct a new function $f ( x ; \pmb \theta )$ that implements the task. The function $f$ is very similar to the original transformer applied to $x$ without demonstrations but instead modulated by $\pmb \theta$ (see Fig. 2).
|
| 25 |
+
|
| 26 |
+
Our view is also related to soft prompts (Lester et al., 2021), since both approaches modulate the function of the transformer towards a particular task. However, in ICL, task vectors are calculated in the forward pass rather than being fine-tuned.
|
| 27 |
+
|
| 28 |
+
Our contributions include proposing a hypothesis-class based mechanistic view of ICL, and conducting experiments to validate our view on a range of publicly available LLMs and a diverse set of tasks. Our results further the understanding of ICL and may have practical implications for the efficient adaptation of LLMs to perform specific tasks.
|
| 29 |
+
|
| 30 |
+
# 2 A Hypothesis Class View of ICL
|
| 31 |
+
|
| 32 |
+
Motivated by the hypothesis class view of learning theory, our goal is to understand if ICL maps the set of demonstrations $S$ to a function on the query $x$ and how this mapping occurs. Specifically, we seek to see if ICL converts $S$ into $\pmb \theta$ - the “parameters” of a function within a certain hypothesis space. Our empirical findings suggest this view is applicable, shedding light on the structure of the hypothesis space on which ICL can be viewed to operate.
|
| 33 |
+
|
| 34 |
+
# 2.1 Theoretical Framework
|
| 35 |
+
|
| 36 |
+
We use $T$ to denote a decoder-only transformer LLM, $S$ to denote the set of demonstrations (i.e. training examples) used as input to ICL, and $x$ to denote the query that ICL is asked to provide an output for. We use $T ( [ S , x ] )$ to denote the output of ICL on the concatenation of $S$ and $x$ .
|
| 37 |
+
|
| 38 |
+
To demonstrate that ICL operates within a hypothesis space, we aim to show that its underlying mechanism can be broken down into two parts:
|
| 39 |
+
|
| 40 |
+
• A “Learning Algorithm” (denoted by $\mathcal { A }$ ) that maps $S$ into a “task vector” $\underline { { \pmb \theta } }$ , independent of the query $x$ . Given that attention layers can access both $S$ and $x$ , this independence is not trivial. • A “Rule Application” (denoted by $f$ ) which maps the query $x$ to the output, based on $\theta \equiv$ $A ( S )$ , without direct dependence on $S$ . Again, this independence is not trivial.
|
| 41 |
+
|
| 42 |
+
Thus, we consider the following mapping from a set of demonstrations and a query to the predicted output: $T ( [ S , x ] ) = f ( x ; \mathcal { A } ( S ) )$ .
|
| 43 |
+
|
| 44 |
+
If we can break down the forward pass of the LLM into the above two components, we can view ICL as operating on the following hypothesis class: $\mathcal { H } = \{ f ( \cdot ; \pmb { \theta } ) \mid \pmb { \theta } \}$ . In the next section we propose an implementation of such a class.
|
| 45 |
+
|
| 46 |
+
# 2.2 A Proposed Hypothesis Class
|
| 47 |
+
|
| 48 |
+
There are many possible realizations of the above framework, that correspond to different choices of $\mathcal { A }$ and $f$ . We next describe the realization we focus on, which naturally follows from the transformer architecture. We consider an ICL setting as in Fig. 1, where the input ends with a query $x$ (i.e., Corn) followed by an $\ " \ "$ symbol. As mentioned above, we view learning as composed of two steps: calculating a parameter vector $\pmb \theta$ based on the training sample $S$ , and applying the rule defined by this parameter vector to the query $x$ . A presumably simple way for a transformer to do this is for the first $L$ layers of the representations to calculate $\pmb \theta$ and then for the remaining layers to take $\pmb \theta$ and $x$ as input and produce an output. See Fig. 1. Recall that $S$ and $x$ are accessible to the transformer at any layer, presenting a challenge with our view.
|
| 49 |
+
|
| 50 |
+
In the following sections, we address this challenge and present experiments validating our view. Namely, we show that we can isolate our proposed $\mathcal { A }$ and $f$ in the forward pass of LLMs performing ICL. We also show that the $\pmb \theta$ vectors are interpretable and correspond to learned tasks.
|
| 51 |
+
|
| 52 |
+

|
| 53 |
+
Figure 2: Separating $\mathcal { A }$ and $f$ . To make $\pmb { \theta }$ independent of the query $x$ , we use a dummy query $( x ^ { \prime } = { \mathsf { P l u m } } )$ and use the representation of at the $L ^ { t h }$ layer as $\pmb { \theta }$ The vector $\pmb { \theta }$ is then patched at the same layer during a forward pass of a transformer that only takes $x$ and as input, to prevent the direct dependence of $f$ on $S$ .
|
| 54 |
+
|
| 55 |
+
# 3 Validity of the Hypothesis Class View
|
| 56 |
+
|
| 57 |
+
We first show that separating the forward pass into the two distinct components $\mathcal { A }$ and $f$ , defined in $\ S 2 . 2$ , maintains the high accuracy of ICL.
|
| 58 |
+
|
| 59 |
+
# 3.1 Separating $\mathcal { A }$ and $f$
|
| 60 |
+
|
| 61 |
+
We face some challenges in a regular forward pass: first, the initial $L$ layers that correspond to $\mathcal { A }$ , updating the representations of to create $\pmb \theta$ , can attend to the query $x$ . Thus, they may depend on $x$ creating an unwanted dependence of $\pmb \theta$ on $x$ . Second, the remaining layers that correspond to $f$ , may directly access $S$ , instead of using only $x$ and $\pmb \theta$ .
|
| 62 |
+
|
| 63 |
+
We propose the following procedure to tackle these challenges: to solve the first problem, we introduce a “dummy query” $x ^ { \prime }$ and calculate the representations of using that query. We use the representation of after the first $L$ layers, calculated using $x ^ { \prime }$ , as the vector $\pmb \theta$ (as demonstrated on the left side of Fig. 2). An alternative was to block attention to $x$ , but it led to poor performance. To solve the second problem of calculating $f ( x , \pmb \theta )$ without allowing direct dependence on $S$ , we perform a forward pass of the transformer only on $x$ and ,3 and “patch” the $\pmb \theta$ we previously extracted at the $L$ th layer of the (right side of Fig. 2).4
|
| 64 |
+
|
| 65 |
+
Table 1: A representative subset of the tasks used in the study with input output examples.
|
| 66 |
+
|
| 67 |
+
<table><tr><td>Category</td><td>Task</td><td>Example</td></tr><tr><td rowspan="4">Algorithmic</td><td>Next letter</td><td>a→b</td></tr><tr><td>List first</td><td>a,b,c→a</td></tr><tr><td>List last</td><td>a,b,c →c</td></tr><tr><td>To uppercase</td><td>a→A</td></tr><tr><td>Translation</td><td>French to English Spanish to English</td><td>bonjour → hello hola →hello</td></tr><tr><td rowspan="2">Linguistic</td><td>Present to gerund</td><td>go →going</td></tr><tr><td>Singular to plural Antonyms</td><td>cat →cats</td></tr><tr><td rowspan="2">Knowledge</td><td></td><td>happy →sad</td></tr><tr><td>Country to Capital Person to Language</td><td>France→Paris Macron→French</td></tr></table>
|
| 68 |
+
|
| 69 |
+

|
| 70 |
+
Figure 3: Accuracy for each choice of the intermediate layer $L$ , averaged across all tasks. Solid lines show average values, and shaded areas standard deviations.
|
| 71 |
+
|
| 72 |
+
# 3.2 Tasks and Models
|
| 73 |
+
|
| 74 |
+
Tasks We consider a diverse set of 18 tasks across 4 categories: algorithmic, translation, linguistic, and factual knowledge. For simplicity, we limit ourselves to single-token outputs. A representative subset of the tasks is described in Tab. 1. A complete detailed table, as well as more information regarding the data, are provided in $\ S$ A.1.
|
| 75 |
+
|
| 76 |
+
Models We use multiple open LLMs: LLaMA 7B, 13B, and 30B (Touvron et al., 2023), GPT-J 6B (Wang and Komatsuzaki, 2021), and Pythia 2.8B, 6.9B, and 12B (Biderman et al., 2023).
|
| 77 |
+
|
| 78 |
+
# 3.3 Finding $L$
|
| 79 |
+
|
| 80 |
+
The mechanism we described in $\ S 2 . 2$ has a free parameter - the layer $L$ where $\mathcal { A }$ ends and $f$ begins. We use the proposed $( A , f )$ implementation for different choices of $L$ and evaluate the accuracy on a development set to find the best layer.
|
| 81 |
+
|
| 82 |
+
Fig. 3 shows the accuracy on the development set, for different choices of $L$ . We focus here on the LLaMA models and include the rest in $\ S \ A . 2$ . Interestingly, all models exhibit a performance peak at a similar intermediate layer, irrespective of their parameters and layer count differences.
|
| 83 |
+
|
| 84 |
+

|
| 85 |
+
Figure 4: Average accuracy across all tasks for each model, using each of the three procedures: Baseline, Regular and Hypothesis.
|
| 86 |
+
|
| 87 |
+
# 3.4 Accuracy of Hypothesis Based Prediction
|
| 88 |
+
|
| 89 |
+
We next compare the accuracy of the $( A , f )$ mechanism to that of a regular forward pass performing ICL. For each model and task, we evaluate the following three procedures:
|
| 90 |
+
|
| 91 |
+
• Regular An application of the LLM to the demonstrations $S$ and query $x$ . Namely $T ( [ S , x ] )$ , as in regular ICL. • Hypothesis Our proposed procedure from $\ S \ 3 . 1$ where $\mathcal { A }$ generates $\pmb \theta$ using a dummy $x ^ { \prime }$ , and $f ( \cdot ; \pmb \theta )$ is applied to $x$ by running the transformer on $[ x , ]$ with $\pmb \theta$ patched at layer $L$ of . • Baseline A forward pass of the LLM only on $x$ without demonstrations $S$ . That is, $T ( [ x , ] )$ . This is the same as the application of $f$ from our separated procedure, but without patching $\pmb \theta$ .
|
| 92 |
+
|
| 93 |
+
Fig. 4 shows the average accuracy across all tasks of these 3 procedures, for each model. Full results are reported in Tab. 6 in $\ S \ A . 2$ . Across all models, our procedure maintains around $80 \%$ of the accuracy of regular ICL, while the baseline reaches only $10 \%$ . This shows that our proposed separation to $\mathcal { A }$ and $f$ provides a good empirical approximation of the process underlying ICL.
|
| 94 |
+
|
| 95 |
+
# 4 Robustness of Task Vectors
|
| 96 |
+
|
| 97 |
+
In our setting, $\pmb \theta$ is derived from $S$ and a dummy query $x ^ { \prime }$ . It is natural to examine the robustness of $\pmb \theta$ to variations in these inputs. Intuitively, if it represents the task, it should remain stable across different $S$ and $x ^ { \prime }$ values.
|
| 98 |
+
|
| 99 |
+

|
| 100 |
+
Figure 5: A t-SNE plot of task vectors. A 2D t-SNE plot visualizing 50 task vectors for each task, each generated from a different choice of $S$ and $x ^ { \prime }$ using LLaMA 7B. Points are color-coded according to the task. Each task can be seen to form its own distinct cluster.
|
| 101 |
+
|
| 102 |
+
To test this, we use LLaMA 7B to generate 50 task vectors per task with varied $S$ and $x ^ { \prime }$ and conduct two analyses.
|
| 103 |
+
|
| 104 |
+
Geometry of $\pmb \theta$ A t-SNE dimensionality reduction (Fig. 5) reveals that the task vectors form distinct clusters, each containing task vectors of a single task. Fig. 9 further shows proximity between tasks of the same category, strengthening the idea that they encapsulate task understanding.
|
| 105 |
+
|
| 106 |
+
Variability of $\pmb \theta$ Fig. 8 shows histograms of distances within and across tasks. It can be seen that vectors within the same task are closer than those between different tasks, indicating that $\pmb \theta$ is stable within tasks and not highly influenced by $x ^ { \prime }$ or $S$ .
|
| 107 |
+
|
| 108 |
+
# 5 Dominance of $\pmb \theta$ Patching
|
| 109 |
+
|
| 110 |
+
In $\ S 3$ we prevented $f$ from directly accessing $S$ . However, in a regular forward pass during ICL, the last token can attend to $S$ . Here we verify that even in this case, $f$ mainly uses the task vector $\pmb \theta$ , without directly accessing the demonstrations $S$ . To this end, we use a pair of tasks, $A$ and $B$ , sharing the input space but differing on the output. We first use a “Regular” forward pass, where we provide the model with demonstrations $S$ for task $A$ (denoted $S _ { A }$ ), to verify the model can perform this task using ICL. Then, we do a “Conflicting” forward pass, still providing $S _ { A }$ , while injecting $\pmb { \theta } _ { B }$ . For more details, refer to Fig. 6 in $\ S \mathrm { A } . 1$ .
|
| 111 |
+
|
| 112 |
+
Table 2: Conflicting tasks experiment results. The model’s accuracy on the relevant task ( $A$ in “Regular” and $B$ in “Conflicting”) is displayed for both scenarios.
|
| 113 |
+
|
| 114 |
+
<table><tr><td>Task A(S)</td><td>Task B (0)</td><td>Regular Task A</td><td>Conflicting Task B</td></tr><tr><td>Next Letter</td><td>To Upper</td><td>0.92</td><td>0.77</td></tr><tr><td>List Last</td><td>List First</td><td>0.95</td><td>0.78</td></tr><tr><td>Present to Past</td><td> to Gerund</td><td>0.96</td><td>0.95</td></tr></table>
|
| 115 |
+
|
| 116 |
+
In Tab.2, the “Regular” forward pass shows high accuracy on task $A$ $( 9 0 \% + )$ , as anticipated. However, the “Conflicting” forward pass yields high accuracy on task $B$ , corresponding to the injected task vector $\pmb \theta$ . This implies that the model mainly relies on $\pmb \theta$ , largely disregarding the demonstrations $S$ for task $A$ . We note that the accuracy on task $B$ is slightly low, likely consistent with the performance dip seen in Fig. 6, and potentially further affected by the presence of $S$ .
|
| 117 |
+
|
| 118 |
+
# 6 Interpreting $\pmb \theta$
|
| 119 |
+
|
| 120 |
+
The learned vector $\pmb \theta$ intuitively captures information about the task demonstrated by $S$ . Here we provide evidence supporting this interpretation. Since $\pmb \theta$ is an intermediate hidden state of the transformer, we can employ a vocabulary projection method (nostalgebraist, 2020; Dar et al., 2022). Namely, we examine the top tokens in the distribution over the vocabulary induced by the hidden state.
|
| 121 |
+
|
| 122 |
+
Tab. 3 shows the top tokens for three tasks for LLaMA 13B (more models and tasks are provided in Tab. 7 in $\ S \mathbf { A }$ ). In multiple cases, we observe tokens that directly describe the task. Importantly, these terms never explicitly appeared in the context. For example in the task of translation from French to English, we observe tokens such as “English” and “translate”. This supports our view that $\pmb \theta$ carries significant, non-trivial semantic information about the task.
|
| 123 |
+
|
| 124 |
+
# 7 Related Work
|
| 125 |
+
|
| 126 |
+
Emergence of ICL A key question with ICL is how it emerges as a capability from pre-training the LLMs. Levine et al. (2022) provides results in this direction that highlight the importance of training data structure. Xie et al. use probabilistic analysis and model pre-training data using Hidden Markov Models to theoretically explain the emergence of ICL, while Chan et al. (2022) empirically explore the effect of several distributional properties of the pre-training data.
|
| 127 |
+
|
| 128 |
+
<table><tr><td>Task</td><td>Toptokensinthetaskvectorprojection</td></tr><tr><td>Previous Letter</td><td>e,y,unknown,alphabet,preceding,c Cad,zA,dit,bill</td></tr><tr><td>FR-EN</td><td>Mason, gram,immer,Santi,latin, utter,Span,Conc,English,equivalent</td></tr><tr><td>Present Gerund</td><td>cin, thats,gram, Lorenzo, cian, Simple to Isabel,uld,berto,partici,Sah</td></tr><tr><td>Country Capital</td><td>Paris, its,capital, central, Conc, cities, administrative, Los, Madrid, London</td></tr></table>
|
| 129 |
+
|
| 130 |
+
Table 3: The top 10 tokens in the distribution induced by the task vector, for one task per category.
|
| 131 |
+
|
| 132 |
+
Meta-Learning in Transformers Studies by Akyürek et al. (2022); von Oswald et al. (2022); Garg et al. focus on the meta-learning capabilities of transformers. They typically train models from scratch on elementary tasks such as linear regression, drawing theoretical parallels with algorithms like Gradient Descent and demonstrating how transformers could implement them. A key assumption of these works is a known parameter space within which gradient descent operates. Our work focuses on identifying such a parameter space for LLMs.
|
| 133 |
+
|
| 134 |
+
ICL in LLMs Olsson et al. (2022) identify “induction heads” in transformers as a likely main mechanism of ICL. Dai et al. (2022) provide empirical evidence for the connection of ICL to Gradient Descent in LLMs, focusing on classification tasks. Concurrent work by Merullo et al. (2023) also explores a phenomenon similar to the task vectors we study here, where a single vector can encode learned functions. Our findings are complementary to theirs, and future work could explore the relationship between the two more closely.
|
| 135 |
+
|
| 136 |
+
# 8 Conclusions
|
| 137 |
+
|
| 138 |
+
Through this exploration of ICL in LLMs, we have shed light on a new perspective of ICL learning mechanisms. We have revealed a simple and elegant structure: ICL functions by compressing a given training set into a single task vector, which then guides the transformer to generate appropriate outputs given queries. Our work provides a stepping stone towards understanding how LLMs perform ICL. In light of our findings, future work could focus on understanding how the task vector is constructed as well as how it is used to calculate the output.
|
| 139 |
+
|
| 140 |
+
# Limitations
|
| 141 |
+
|
| 142 |
+
We study relatively simple tasks, whereas ICL can learn to perform more complex tasks, such as solving arithmetic reasoning problems. It remains to be seen if and how the mechanisms we observe here will translate to these cases. E.g., our approach focuses on cases where a single task vector suffices, while more complex ICL cases may require more elaborate parameterization. We also focus on tasks where the output is a single token, while some other tasks require multi-token outputs.
|
| 143 |
+
|
| 144 |
+
Finally, as noted above, we do not provide a mechanistic explanation for how the task vector is formed or how it is used. Namely, we do not explain how the transformer performs these calculations using its parameters.
|
| 145 |
+
|
| 146 |
+
# Acknowledgements
|
| 147 |
+
|
| 148 |
+
This project is funded by the European Research Council (ERC) under the European Unions Horizon 2020 research and innovation program (grant ERC HOLI 819080).
|
| 149 |
+
|
| 150 |
+
# References
|
| 151 |
+
|
| 152 |
+
Ekin Akyürek, Dale Schuurmans, Jacob Andreas, Tengyu Ma, and Denny Zhou. 2022. What learning algorithm is in-context learning? investigations with linear models. arXiv preprint arXiv:2211.15661.
|
| 153 |
+
|
| 154 |
+
Stella Biderman, Hailey Schoelkopf, Quentin Anthony, Herbie Bradley, Kyle O’Brien, Eric Hallahan, Mohammad Aflah Khan, Shivanshu Purohit, USVSN Sai Prashanth, Edward Raff, et al. 2023. Pythia: A suite for analyzing large language models across training and scaling. arXiv preprint arXiv:2304.01373.
|
| 155 |
+
|
| 156 |
+
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.
|
| 157 |
+
|
| 158 |
+
Qingxiu Dong, Lei Li, Damai Dai, Ce Zheng, Zhiyong Wu, Baobao Chang, Xu Sun, Jingjing Xu, and Zhifang Sui. 2022. A survey for in-context learning. arXiv preprint arXiv:2301.00234.
|
| 159 |
+
|
| 160 |
+
Shivam Garg, Dimitris Tsipras, Percy Liang, and Gregory Valiant. What can transformers learn incontext? a case study of simple function classes. In Advances in Neural Information Processing Systems.
|
| 161 |
+
|
| 162 |
+
Gabriel Ilharco, Marco Tulio Ribeiro, Mitchell Wortsman, Ludwig Schmidt, Hannaneh Hajishirzi, and Ali Farhadi. 2023. Editing models with task arithmetic. In The Eleventh International Conference on Learning Representations.
|
| 163 |
+
|
| 164 |
+
Stephanie Chan, Adam Santoro, Andrew Lampinen, Jane Wang, Aaditya Singh, Pierre Richemond, James McClelland, and Felix Hill. 2022. Data distributional properties drive emergent in-context learning in transformers. Advances in Neural Information Processing Systems, 35:18878–18891.
|
| 165 |
+
|
| 166 |
+
Brian Lester, Rami Al-Rfou, and Noah Constant. 2021. The power of scale for parameter-efficient prompt tuning. arXiv preprint arXiv:2104.08691.
|
| 167 |
+
|
| 168 |
+
Damai Dai, Yutao Sun, Li Dong, Yaru Hao, Zhifang Sui, and Furu Wei. 2022. Why can gpt learn in-context? language models secretly perform gradient descent as meta optimizers. arXiv preprint arXiv:2212.10559.
|
| 169 |
+
|
| 170 |
+
Yoav Levine, Noam Wies, Daniel Jannai, Dan Navon, Yedid Hoshen, and Amnon Shashua. 2022. The inductive bias of in-context learning: Rethinking pretraining example design. In The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022. OpenReview.net.
|
| 171 |
+
|
| 172 |
+
Guy Dar, Mor Geva, Ankit Gupta, and Jonathan Berant. 2022. Analyzing transformers in embedding space. arXiv preprint arXiv:2209.02535.
|
| 173 |
+
|
| 174 |
+
Pengfei Liu, Weizhe Yuan, Jinlan Fu, Zhengbao Jiang, Hiroaki Hayashi, and Graham Neubig. 2023. Pretrain, prompt, and predict: A systematic survey of prompting methods in natural language processing. ACM Computing Surveys, 55(9):1–35.
|
| 175 |
+
|
| 176 |
+
Kevin Meng, David Bau, Alex Andonian, and Yonatan Belinkov. 2022. Locating and editing factual associations in gpt. Advances in Neural Information Processing Systems, 35:17359–17372.
|
| 177 |
+
|
| 178 |
+
Jack Merullo, Carsten Eickhoff, and Ellie Pavlick. 2023. Language models implement simple word2vec-style vector arithmetic. arXiv preprint arXiv:2305.16130.
|
| 179 |
+
|
| 180 |
+
nostalgebraist. 2020. interpreting gpt: the logit lens. LessWrong.
|
| 181 |
+
|
| 182 |
+
Catherine Olsson, Nelson Elhage, Neel Nanda, Nicholas Joseph, Nova DasSarma, Tom Henighan, Ben Mann, Amanda Askell, Yuntao Bai, Anna Chen, et al. 2022. In-context learning and induction heads. arXiv preprint arXiv:2209.11895.
|
| 183 |
+
|
| 184 |
+
Shai Shalev-Shwartz and Shai Ben-David. 2014. Understanding machine learning: From theory to algorithms. Cambridge university press.
|
| 185 |
+
|
| 186 |
+
Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. 2023. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971.
|
| 187 |
+
|
| 188 |
+
Johannes von Oswald, Eyvind Niklasson, Ettore Randazzo, João Sacramento, Alexander Mordvintsev, Andrey Zhmoginov, and Max Vladymyrov. 2022. Transformers learn in-context by gradient descent. arXiv preprint arXiv:2212.07677.
|
| 189 |
+
|
| 190 |
+
Ben Wang and Aran Komatsuzaki. 2021. GPT-J6B: A 6 Billion Parameter Autoregressive Language Model. https://github.com/kingoflolz/ mesh-transformer-jax.
|
| 191 |
+
|
| 192 |
+
Sang Michael Xie, Aditi Raghunathan, Percy Liang, and Tengyu Ma. An explanation of in-context learning as implicit bayesian inference. In International Conference on Learning Representations.
|
| 193 |
+
|
| 194 |
+
# A Appendix
|
| 195 |
+
|
| 196 |
+
Here we provide additional details and results.
|
| 197 |
+
|
| 198 |
+
# A.1 Additional Details
|
| 199 |
+
|
| 200 |
+
Full Task Descriptions Our study covers 18 tasks in 4 categories: Algorithmic, Translation, Linguistic and Knowledge. A detailed description of all tasks is provided in Tab. 5.
|
| 201 |
+
|
| 202 |
+
Model Details More details on the models used in the study are provided in Tab. 4.
|
| 203 |
+
|
| 204 |
+
Task Data Here we detail the sources of the data for each task. The accompanying GitHub repository contains the data itself as well as the code used to create it.
|
| 205 |
+
|
| 206 |
+
• Algorithmic: Generated programatically. • Translation: For each language pair, the most frequent words in the source language are first retrieved from https://github.com/frekwencja/ most-common-words-multilingual and are then translated to the destination language using the open-source package nltk. • Linguistic: The data for the tenses tasks is parsed from https://github.com/Drulac/ English-Verbs-Conjugates. The data for the plural-singular task is taken from https://github.com/sindresorhus/ irregular-plurals. Finally, the data for the antonyms task is taken from https://github.com/SuzanaK/english_ synonyms_antonyms_list. • Knowledge Data for the knowledge tasks is taken from the counterfactual dataset introduced in (Meng et al., 2022).
|
| 207 |
+
|
| 208 |
+
Conflicting Tasks Experiment In Fig. 6, we provide more details and a visualization of the experiment described in $\ S 5$ .
|
| 209 |
+
|
| 210 |
+
# A.2 Additional Results
|
| 211 |
+
|
| 212 |
+
Finding $\mathcal { A }$ and $f$ Fig. 7 shows results similar to Fig. 3, but for different models. It is interesting to observe that the curves are similar across differentsized models.
|
| 213 |
+
|
| 214 |
+
Detailed results for Fig. 4. Fig. 4 presented results for our $( A , f )$ hypothesis-based approach, averaged across tasks. Table. 6 provides these results for all the specific tasks considered.
|
| 215 |
+
|
| 216 |
+
Dependence of $\mathcal { A }$ on $x$ Fig. 9 and Fig. 8 provide more results on the geometry of the $\pmb \theta$ vectors (see main text for discussion).
|
| 217 |
+
|
| 218 |
+
Inspecting Task Vectors Tab. 7 is an expanded version of Tab. 3, providing more vocabulary projections of $\pmb \theta$ for additional tasks and on multiple LLMs.
|
| 219 |
+
|
| 220 |
+
<table><tr><td>Model</td><td>Parameters</td><td>Dimension</td><td>Layers</td><td>Heads</td></tr><tr><td rowspan="3">LLaMA</td><td>7B</td><td>4096</td><td>32</td><td>32</td></tr><tr><td>13B</td><td>5120</td><td>40</td><td>40</td></tr><tr><td>30B</td><td>6656</td><td>60</td><td>52</td></tr><tr><td>GPT-J</td><td>6B</td><td>4096</td><td>28</td><td>16</td></tr><tr><td rowspan="3">Pythia</td><td>2.8B</td><td>2560</td><td>32</td><td>32</td></tr><tr><td>6.9B</td><td>4096</td><td>32</td><td>32</td></tr><tr><td>12B</td><td>5120</td><td>36</td><td>40</td></tr></table>
|
| 221 |
+
|
| 222 |
+
Table 4: The models used in the study, with architectural information.
|
| 223 |
+
|
| 224 |
+
<table><tr><td>Category</td><td>Task</td><td>Description</td><td>Example</td></tr><tr><td></td><td>List first</td><td>Givena list of letters,output the first letter</td><td>a,b,c→a</td></tr><tr><td rowspan="4">Algorithmic</td><td>List last</td><td>Given a list of letters,output the last letter</td><td>a,b,c →c</td></tr><tr><td>Next letter</td><td>Given a letter in the English alphabet,output the next letter</td><td>a→b</td></tr><tr><td>Previous letter</td><td>Given a letter in the English alphabet,output theb → a previous letter</td><td></td></tr><tr><td>To lowercase</td><td>Given an uppercase letter, output the correspond-A -a ing lowercase letter</td><td></td></tr><tr><td></td><td>To uppercase</td><td>Given a lowercase letter,output the correspond-a→A ing uppercase letter</td><td></td></tr><tr><td rowspan="4">Translation</td><td>French to English</td><td>Given a word in French, translate to English</td><td>bonjour → hello</td></tr><tr><td>Spanish to English English to Spanish</td><td>Given a word in Spanish,translate to English</td><td>hola →hello</td></tr><tr><td></td><td>Given a word in English, translate to Spanish</td><td>hola → hello</td></tr><tr><td>English to Spanish</td><td>Given a word in English,translate to French</td><td>hola →hello</td></tr><tr><td rowspan="4">Linguistic</td><td>Present to gerund</td><td>given an English verb in present simple tense, output the corresponding gerund form</td><td>go →going</td></tr><tr><td>Present to past</td><td>given an English verb in present simple tense, output the corresponding verb in past simple</td><td>go →went</td></tr><tr><td>Singular to plural</td><td>Given an English noun in singular form,output the plural form</td><td>catcats</td></tr><tr><td>Antonyms</td><td>Given an English adjective,output an antonym</td><td>happy →sad</td></tr><tr><td rowspan="4">Knowledge</td><td>Country to Capital</td><td>Given a name of a country,output the name of the capital city</td><td>France→Paris</td></tr><tr><td>Person to Language</td><td>Given a name of a person,output their nativeMacron →French language</td><td></td></tr><tr><td>Location to Continent</td><td>Given a name of a person,output their nativeParis → Europe</td><td></td></tr><tr><td>Religion</td><td>language Given a name of a location or a person,outputMuhammad -→ Islam the associated religion</td><td></td></tr></table>
|
| 225 |
+
|
| 226 |
+
Table 5: The tasks used in the study with input output examples.
|
| 227 |
+
|
| 228 |
+

|
| 229 |
+
Figure 6: Conflicting tasks experiment. In the “Regular” scenario (top), the model is simply provided with demonstrations $S _ { A }$ for Task $A$ (e.g. outputting the previous letter in the alphabet). In the “Conflicting” scenario (bottom), the model is still provided with demonstrations for Task $A$ , but we inject a task vector $\pmb \theta ( S _ { B } )$ from a conflicting Task $B$ (e.g. outputting the next letter in the alphabet).
|
| 230 |
+
|
| 231 |
+

|
| 232 |
+
Figure 7: Accuracy for each choice of $L$ (the intermediate layer where the task vector is injected), averaged across all tasks. The solid line represents the average value, and the shaded area depicts the standard deviation.
|
| 233 |
+
|
| 234 |
+
Table 6: Complete results for Figure 4, reported for all tasks and models.
|
| 235 |
+
|
| 236 |
+
<table><tr><td colspan="3"></td><td rowspan="2">Baseline</td><td rowspan="2">Hypothesis</td><td rowspan="2">Regular</td></tr><tr><td>Model</td><td>method Task type</td><td>Task name</td></tr><tr><td>GPT-J 6B</td><td>Algorithmic</td><td></td><td>0.30</td><td>0.74</td><td>0.98</td></tr><tr><td rowspan="20"></td><td rowspan="4"></td><td>List first List last</td><td>0.24</td><td>0.64</td><td>1.00</td></tr><tr><td>Next letter</td><td>0.16</td><td>1.00</td><td>0.86</td></tr><tr><td>Prev letter</td><td>0.10</td><td>0.36</td><td>0.42</td></tr><tr><td>To lower</td><td>0.00</td><td>0.46</td><td>1.00</td></tr><tr><td rowspan="5">Knowledge</td><td></td><td>0.00</td><td>0.94</td><td>1.00</td></tr><tr><td>To upper</td><td>0.19</td><td>0.72</td><td>0.80</td></tr><tr><td>Country capital</td><td>0.03</td><td>0.58</td><td>0.70</td></tr><tr><td>Location continent</td><td>0.09</td><td>0.68</td><td>0.78</td></tr><tr><td>Location religion</td><td>0.02</td><td>0.82</td><td>0.82</td></tr><tr><td rowspan="5">Linguistic</td><td>Person language</td><td>0.43</td><td>0.68</td><td>0.78</td></tr><tr><td>Antonyms</td><td></td><td>0.90</td><td>0.98</td></tr><tr><td>Plural singular</td><td>0.08 0.00</td><td>0.88</td><td></td></tr><tr><td>Present simple gerund</td><td></td><td>0.76</td><td>0.98 0.96</td></tr><tr><td>Present simple past simple</td><td>0.02 0.14</td><td></td><td>0.56</td></tr><tr><td rowspan="8">LLaMA 13B</td><td>Translation En es En fr</td><td>0.16</td><td>0.34 0.36</td><td>0.54</td></tr><tr><td>Es en</td><td></td><td>0.70</td><td>0.74</td></tr><tr><td>Fr en</td><td>0.06 0.13</td><td>0.66</td><td>0.76</td></tr><tr><td>Algorithmic List first</td><td>0.77</td><td>1.00</td><td>1.00</td></tr><tr><td>List last</td><td>0.07</td><td>0.70</td><td>0.92</td></tr><tr><td>Next letter</td><td>0.31</td><td>1.00</td><td>0.94</td></tr><tr><td>Prev letter</td><td>0.05</td><td>0.34</td><td>0.50</td></tr><tr><td rowspan="5">Knowledge</td><td>To lower</td><td>0.00</td><td>0.94</td><td>1.00</td></tr><tr><td>To upper</td><td>0.00</td><td>0.94</td><td>1.00</td></tr><tr><td>Country capital</td><td>0.17</td><td>0.84</td><td>0.86</td></tr><tr><td>Location continent</td><td>0.01</td><td>0.70</td><td>0.80</td></tr><tr><td>Location religion</td><td>0.10</td><td>0.74</td><td>0.84</td></tr><tr><td rowspan="8"></td><td></td><td></td><td>0.76</td><td>0.88</td></tr><tr><td rowspan="3">Linguistic</td><td>Person language</td><td>0.02 0.19</td><td>0.74</td><td>0.80</td></tr><tr><td>Antonyms Plural singular</td><td>0.24</td><td>0.84</td><td>0.88</td></tr><tr><td>Present simple gerund</td><td>0.00</td><td>0.96</td><td>0.96</td></tr><tr><td rowspan="4">Translation</td><td>Present simple past simple</td><td>0.01</td><td>1.00</td><td>0.98</td></tr><tr><td>En es</td><td>0.05</td><td>0.78</td><td>0.82</td></tr><tr><td>En fr</td><td>0.15</td><td>0.70</td><td>0.84</td></tr><tr><td>Es en</td><td>0.29</td><td>0.76</td><td>0.88</td></tr><tr><td rowspan="6">LLaMA30B</td><td>Fren</td><td>0.25</td><td>0.54</td><td>0.72</td></tr><tr><td>Algorithmic List first</td><td>0.96</td><td>0.98</td><td>1.00</td></tr><tr><td>List last</td><td>0.02</td><td>0.64</td><td>0.96</td></tr><tr><td>Next letter</td><td>0.30</td><td>0.98</td><td>0.96</td></tr><tr><td>Prev letter</td><td>0.02</td><td>0.56</td><td>0.80</td></tr><tr><td>To lower</td><td>0.00</td><td>1.00</td><td>1.00</td></tr><tr><td rowspan="8"></td><td>To upper</td><td>0.00</td><td>0.90</td><td>1.00</td></tr><tr><td>Knowledge Country capital</td><td>0.27</td><td>0.72</td><td>0.88</td></tr><tr><td>Location religion</td><td>Location continent</td><td>0.01 0.70 0.05</td><td>0.86</td></tr><tr><td>Person language</td><td></td><td>0.70 0.72</td><td>0.88</td></tr><tr><td>Linguistic</td><td></td><td>0.01 0.76</td><td>0.90</td></tr><tr><td></td><td>Antonyms</td><td>0.37 0.84</td><td>0.82</td></tr><tr><td></td><td>Plural singular</td><td>0.21</td><td>0.90</td></tr><tr><td rowspan="5">Translation</td><td> Present simple gerund</td><td>0.00</td><td>0.76</td><td>0.98</td></tr><tr><td>Present simple past simple En es</td><td>0.02</td><td>0.98</td><td>1.00</td></tr><tr><td></td><td>0.07</td><td>0.74 0.80</td><td>0.78</td></tr><tr><td>En fr</td><td>0.10</td><td></td><td>0.86</td></tr><tr><td>Es en</td><td>0.24</td><td>0.70</td><td>0.88</td></tr><tr><td rowspan="8">LLaMA7B</td><td rowspan="8">Algorithmic</td><td>Fren</td><td>0.20</td><td>0.62</td><td>0.78</td></tr><tr><td>List first</td><td>0.87</td><td>0.98</td><td>1.00</td></tr><tr><td>List last Next letter</td><td>0.03 0.03</td><td>1.00 0.94</td><td>1.00 0.88</td></tr><tr><td>Prev letter</td><td>0.04</td><td>0.52</td><td>0.58</td></tr><tr><td>To lower</td><td>0.00</td><td>0.74</td><td>1.00</td></tr><tr><td>Toupper</td><td>0.00</td><td>0.60</td><td>1.00</td></tr><tr><td>Knowledge</td><td></td><td>0.82</td><td>0.86</td></tr><tr><td>Country capital</td><td>0.28</td><td></td><td></td></tr><tr><td rowspan="5">Linguistic</td><td>Location continent</td><td>0.02</td><td>0.68</td><td>0.72</td></tr><tr><td>Location religion</td><td>0.12</td><td>0.84</td><td>0.94</td></tr><tr><td>Person language</td><td>0.02</td><td>0.68</td><td>0.78</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td>Antonyms Plural singular</td><td>0.33 0.15</td><td>0.74 0.84</td><td>0.76 0.88</td></tr></table>
|
| 237 |
+
|
| 238 |
+
<table><tr><td rowspan="2">Model</td><td rowspan="2">Task type</td><td rowspan="2">method Task name</td><td rowspan="2">Baseline</td><td rowspan="2">Hypothesis</td><td rowspan="2">Regular</td></tr><tr><td></td></tr><tr><td rowspan="12">Pythia 12B</td><td></td><td>Present simple gerund</td><td>0.00</td><td>0.74</td><td>0.90</td></tr><tr><td></td><td>Present simple past simple</td><td>0.02</td><td>0.94</td><td>0.92</td></tr><tr><td>Translation</td><td>En es</td><td>0.07</td><td>0.78</td><td>0.76</td></tr><tr><td>En fr</td><td></td><td>0.04</td><td>0.78</td><td>0.88</td></tr><tr><td>Es en</td><td></td><td>0.21</td><td>0.68</td><td>0.92</td></tr><tr><td>Fr en</td><td></td><td>0.15</td><td>0.66</td><td>0.70</td></tr><tr><td>Algorithmic</td><td></td><td>0.53</td><td>0.98</td><td>0.96</td></tr><tr><td></td><td>List first List last</td><td>0.09</td><td>0.98</td><td>1.00</td></tr><tr><td></td><td>Next letter</td><td>0.15</td><td>0.96</td><td>0.76</td></tr><tr><td></td><td>Prev letter</td><td>0.00</td><td>0.24</td><td>0.42</td></tr><tr><td></td><td>To lower</td><td>0.02</td><td>1.00</td><td>1.00</td></tr><tr><td></td><td>To upper</td><td>0.00</td><td>0.98</td><td>1.00</td></tr><tr><td></td><td>Knowledge Country capital</td><td></td><td>0.19</td><td>0.58 0.82</td></tr><tr><td></td><td>Location continent</td><td>0.01</td><td>0.68</td><td>0.80</td></tr><tr><td></td><td>Location religion</td><td>0.07</td><td>0.64</td><td>0.78</td></tr><tr><td>Linguistic</td><td>Person language</td><td>0.01</td><td>0.72</td><td>0.86</td></tr><tr><td></td><td>Antonyms</td><td>0.34</td><td>0.72</td><td>0.74</td></tr><tr><td></td><td>Plural singular</td><td>0.18</td><td>0.80</td><td>0.84</td></tr><tr><td></td><td></td><td>Present simple gerund</td><td>0.00</td><td>0.86 0.96</td></tr><tr><td rowspan="4"></td><td>Translation En es</td><td>Present simple past simple 0.01 0.10</td><td>0.76 0.44</td><td>0.94</td></tr><tr><td>En fr</td><td></td><td>0.48</td><td>0.72 0.54</td></tr><tr><td>Es en</td><td>0.16</td><td>0.68</td><td>0.80</td></tr><tr><td>Fr en</td><td>0.05 0.14</td><td>0.68</td><td>0.80</td></tr><tr><td>Pythia 2.8B</td><td>Algorithmic List first</td><td></td><td></td><td></td></tr><tr><td rowspan="6"></td><td rowspan="5"></td><td></td><td>0.69 0.06</td><td>0.96 0.98</td><td>1.00 1.00</td></tr><tr><td>List last Next letter</td><td>0.42</td><td>0.86</td><td>0.90</td></tr><tr><td></td><td></td><td>0.22</td><td>0.48</td></tr><tr><td>Prev letter To lower</td><td>0.01</td><td>1.00</td><td>1.00</td></tr><tr><td>To upper</td><td>0.00</td><td>1.00</td><td>1.00</td></tr><tr><td>Knowledge</td><td>Country capital</td><td>0.00 0.18</td><td>0.70</td><td></td></tr><tr><td rowspan="12"></td><td></td><td>Location continent</td><td>0.01</td><td>0.62</td><td>0.76 0.72</td></tr><tr><td></td><td>Location religion</td><td>0.08</td><td>0.76</td><td>0.82</td></tr><tr><td>Linguistic</td><td>Person language</td><td>0.00</td><td>0.82</td><td>0.82</td></tr><tr><td></td><td>Antonyms</td><td>0.37</td><td>0.68</td><td>0.76</td></tr><tr><td></td><td>Plural singular</td><td>0.13</td><td>0.70</td><td>0.78</td></tr><tr><td>Translation</td><td>Present simple gerund</td><td>0.00</td><td>0.86</td><td>0.96</td></tr><tr><td rowspan="8">Pythia 6.9B</td><td></td><td>Present simple past simple 0.03</td><td>0.80</td><td>0.92</td></tr><tr><td>En es</td><td>0.10</td><td>0.26</td><td>0.76</td></tr><tr><td>En fr</td><td>0.16</td><td>0.28</td><td>0.60</td></tr><tr><td>Es en</td><td>0.08</td><td>0.76</td><td>0.82</td></tr><tr><td>Fr en</td><td>0.10</td><td>0.64</td><td>0.82</td></tr><tr><td>Algorithmic List first</td><td>0.43</td><td>1.00</td><td>0.98</td></tr><tr><td>List last Next letter</td><td>0.08</td><td>0.60</td><td>0.98</td></tr><tr><td rowspan="5"></td><td></td><td>0.01</td><td>0.66</td><td>0.86</td></tr><tr><td>Prev letter</td><td>0.04</td><td>0.28</td><td>0.32</td></tr><tr><td>To lower</td><td>0.00</td><td>1.00</td><td>1.00</td></tr><tr><td>To upper</td><td>0.00</td><td>0.94</td><td>1.00</td></tr><tr><td>Country capital</td><td>0.21</td><td>0.76</td><td>0.82</td></tr><tr><td rowspan="4"></td><td>Knowledge</td><td></td><td></td><td></td><td>0.78</td></tr><tr><td></td><td>Location continent Location religion</td><td>0.01 0.10</td><td>0.62 0.80</td><td>0.80</td></tr><tr><td>Person language</td><td></td><td>0.01</td><td>0.76</td><td>0.80</td></tr><tr><td>Linguistic Antonyms</td><td></td><td>0.33</td><td>0.72</td><td>0.74</td></tr><tr><td rowspan="5">Translation</td><td>Plural singular</td><td>0.14</td><td>0.78</td><td></td><td>0.88</td></tr><tr><td></td><td>Present simple gerund</td><td>0.00</td><td>0.82</td><td>0.94</td></tr><tr><td>Present simple past simple</td><td></td><td>0.02</td><td>0.88</td><td>0.96</td></tr><tr><td>En es</td><td></td><td>0.11</td><td>0.46</td><td>0.70</td></tr><tr><td>En fr</td><td></td><td></td><td>0.36</td><td>0.60</td></tr><tr><td rowspan="5"></td><td></td><td></td><td>0.21</td><td></td><td></td></tr><tr><td>Es en</td><td></td><td>0.06</td><td>0.72</td><td>0.82</td></tr><tr><td>Fr en</td><td></td><td>0.14</td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td>0.66</td><td>0.74</td></tr></table>
|
| 239 |
+
|
| 240 |
+

|
| 241 |
+
Figure 8: Task Vector Variability. For each task, two histograms are shown: (blue) the distribution of distances between different task vectors of this task, created from different $S$ and $x ^ { \prime }$ ; (orange) the distribution of distances between task vectors of the task and of other tasks.
|
| 242 |
+
|
| 243 |
+

|
| 244 |
+
Figure 9: A 2D t-SNE plot, visualizing 50 task vectors for each task, each generated from a different choice of $S$ and $x$ using LLaMA 7B. Points are color-coded according to task category, such as algorithmic or translation. Each task can be seen to form its own distinct cluster. The labels provide the full name of the task in the cluster.
|
| 245 |
+
|
| 246 |
+
<table><tr><td>Model</td><td>Task</td><td>Tokens</td></tr><tr><td rowspan="4">LLaMA 13B</td><td>Prev Letter</td><td>e,y,unknown,alphabet,preceding,c,Cad,zA,dit,bill,closer,etc, Stuart,aa,null,cin,ads,g,ulo,Ku</td></tr><tr><td>FR-EN</td><td>Mason,gram,immer,Santi,latin,utter, Span,Conc,English, equivalent,engl,Usage,none,pron,ulo,translate,adu,Wiel,grammar, ML</td></tr><tr><td>Present Simple to Gerund</td><td>e cin, thats,gram,Lorenzo,cian,Isabel,uld,berto,partici,Sah, reporting,eing,tc,Roberto,habit,Writing,etc,ientos,ores,Dutch</td></tr><tr><td>Country Capital</td><td>Paris,its,capital,central,Conc,cities,administrative,Los,Madrid, London,San,Isabel,exec,Ar,Bel,Wars,name,capit,Battle,History</td></tr><tr><td rowspan="4">Pythia 12B</td><td>Prev Letter</td><td>r,b,a,d,m,e,p,n,t,u,h,f,c,in,g,s,the,ar,l,×</td></tr><tr><td>FR-EN</td><td>in,and,m,d,a,or,out,the,t,o,so,c,con,have,act,e,s,is, all,to</td></tr><tr><td>to Gerund</td><td>Present Simple in,t,m,r,a,and,the,ing,action,d,o,e,current,simple,te,w, not,have,out,what</td></tr><tr><td></td><td>CountryCapital the,in,a,C,N,B,L,M,T,P,S,R,G,and,F,I,K,U,D,H</td></tr><tr><td rowspan="4">GPT-J 6B</td><td>Prev Letter</td><td>b,c,ν,g,s,name,i,ro,n,j,d,t,A,ai,com,m,ust,test, active,k</td></tr><tr><td>FR-EN</td><td>other,name,the,true,is,social,s,active,time,car,type,money, F,force,a,public,heart,one,ms,life</td></tr><tr><td>Present Simple to Gerund</td><td>getting, storing,working,moving,playing,doing,making,driving, shooting,picking, being, sending,putting,selling,watching, changing,taking,collecting,feeding,reading</td></tr><tr><td>Country Capital</td><td>London,Paris,New,West,Berlin,South,Tokyo,San,Chicago,City, Moscow,Jerusalem, Amsterdam,Philadelphia,East, Madrid,Vienna, Beijing,Mexico,Germany</td></tr></table>
|
| 247 |
+
|
| 248 |
+
Table 7: The top 20 tokens in the distribution induced by the task vector, for one task per category.
|
md/dev/Qx8lUU8CzQ/Qx8lUU8CzQ.md
ADDED
|
@@ -0,0 +1,420 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# VECTORMAPNET: END-TO-END VECTORIZED HD MAP LEARNING
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Autonomous driving systems require a good understanding of surrounding environments, including moving obstacles and static High-Definition (HD) semantic map elements. Existing methods approach the semantic map p·roblem by offline manual annotation, which suffers from serious scalability issues. Recent learning-based methods produce dense rasterized segmentation predictions to construct maps. However, these predictions do not include instance information of individual map elements and require heuristic post-processing to obtain vectorized maps. To tackle these challenges, we introduce an end-to-end vectorized HD map learning pipeline, termed VectorMapNet. VectorMapNet takes onboard sensor observations and predicts a sparse set of polylines in the bird’s-eye view. This pipeline can explicitly model the spatial relation between map elements and generate vectorized maps that are friendly to downstream autonomous driving tasks. Extensive experiments show that VectorMapNet achieve strong map learning performance on both nuScenes and Argoverse2 dataset, surpassing previous state-of-the-art methods by $1 4 . 2 \mathrm { m A P }$ and 14.6mAP. Qualitatively, we also show that VectorMapNet is capable of generating comprehensive maps and capturing more fine-grained details of road geometry. To the best of our knowledge, VectorMapNet is the first work designed towards end-to-end vectorized map learning from onboard observations.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Autonomous driving system requires an understanding of map elements on the road, including lanes, pedestrian crossing, and traffic signs, to navigate the world. Such map elements are typically provided by pre-annotated High-Definition (HD) semantic maps in existing pipelines (Rong et al., 2020). These methods suffer from serious scalability issues as human efforts are heavily involved in annotating HD maps. Recent works (Li et al., 2021; Philion & Fidler, 2020; Roddick & Cipolla, 2020) explore the problem of online HD semantic map learning, where the goal is to use onboard sensors (e.g. LiDARs and cameras) to estimate map elements on-the-fly.
|
| 12 |
+
|
| 13 |
+
Most recent methods (Roddick & Cipolla, 2020; Yang et al., 2018; Philion & Fidler, 2020; Zhou & Krähenbühl, 2022) consider HD semantic map learning as a semantic segmentation problem in bird’s-eye view (BEV), which rasterizes map elements into pixels and assigns each pixel with a class label. This formulation makes it straightforward to leverage fully convolutional networks. However, rasterized maps are not an ideal map representation for autonomous driving, for three reasons. First, rasterized maps lack instance information which is necessary to distinguish map elements with the same class label but different semantics, e.g. left boundary and right boundary. Second, it is hard to enforce spatial consistency within the predicted rasterized maps, e.g. nearby pixels might have contradicted semantics or geometries. Third, 2D rasterized maps are incompatible with most autonomous driving systems which consume instance-level 2D/3D vectorized maps for motion forecasting and planning.
|
| 14 |
+
|
| 15 |
+
To alleviate these issues and produce vectorized outputs, HDMapNet (Li et al., 2021) generates semantic, instance, and directional maps and vectorizes these three maps with a hand-designed post-processing algorithm. However, HDMapNet still relies on the rasterized map predictions, and its heuristic post-processing step complicates the pipeline and restricts the model’s scalability and performance.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: An overview of VectorMapNet. Sensor data is encoded to BEV features in the same coordinate as map elements. VectorMapNet detects the locations of map elements from BEV features by leveraging element queries. The vectorized HD map is built upon a sparse set of polylines that are generated from the detection results. Since polylines have encoded direction information, we can infer semantic information (e.g. drivable area) from the polylines. It worth noting that the drivable area is inferred from several disjoint boundaries and is non-trivial to model as one object.
|
| 19 |
+
|
| 20 |
+
In this paper, we propose an end-to-end vectorized HD map learning model named VectorMapNet, which does not involve a dense set of semantic pixels. Instead, it represents map elements as a set of polylines that are closely related to downstream tasks, e.g. motion forecasting (Gao et al., 2020). Therefore, the map learning problem boils down to predicting a sparse set of polylines from sensor observations in our paper. Specifically, we pose it as a detection problem and leverage set detection and sequence generation methods. First, VectorMapNet aggregates features generated from different modalities (e.g. camera images and LiDAR) into a common BEV feature space. Then, it detects map elements’ locations based on learnable element queries and BEV features. Finally, we decode element queries to polylines for every map elements. An overview of VectorMapNet is shown in Figure 1.
|
| 21 |
+
|
| 22 |
+
Our experiments show that VectorMapNet achieves state-of-the-art performance on the public nuScenes dataset (Caesar et al., 2020) and Argoverse2 (Wilson et al., 2021), outperforming HDMapNet and another baseline by at least $1 4 . 2 \mathrm { m A P } .$ Qualitatively, we find that VectorMapNet builds a more comprehensive map compared to previous works and is capable of capturing fine details, e.g. jagged boundaries. Furthermore, we feed our predicted vectorized HD map into a downstream motion forecasting module, and show the compatibility and effectiveness of the predicted map.
|
| 23 |
+
|
| 24 |
+
To summarize, the contributions of the paper are as follows:
|
| 25 |
+
|
| 26 |
+
• VectorMapNet is an end-to-end HD semantic map learning method. Unlike previous works, we pose map learning as an set prediction problem and directly predict vectorized outputs from sensor observations without requiring map rasterization or post-processing.
|
| 27 |
+
• Jointly modeling the geometry and topological relations of map elements is challenging. We leverage polylines as primitives to model complex map shapes and decompose the model into two
|
| 28 |
+
parts to mitigate this difficulty: a map element detector and a polyline generator.
|
| 29 |
+
• VectorMapNet achieves state-of-the-art HD semantic map learning performance on both nuScenes and Argoverse2 datasets. Qualitative results and downstream evaluations also validate our design choices.
|
| 30 |
+
|
| 31 |
+
# 2 VECTORMAPNET
|
| 32 |
+
|
| 33 |
+
Problem formulation. Similar to HDMapNet (Li et al., 2021), our task is to model map elements in a vectorized form using data from onboard sensors, e.g. RGB cameras and/or LiDARs. These map elements include but are not limited to $:$ Road boundaries, boundaries of roads that split roads and sidewalks. Typically, they are curves with irregular shapes and arbitrary lengths; Lane dividers, boundaries of the lanes in the road. Usually they are straight lines; Pedestrian crossings, regions with white markings where pedestrians can legally cross the road. Usually they are quadrilaterals. These elements are critical for autonomous driving, but these elements typically have diverse geometries and semantic meaning. For example, in HD semantic maps, lanes are usually represented as curves, pedestrian crossings are often represented as polygons.
|
| 34 |
+
|
| 35 |
+

|
| 36 |
+
Figure 2: The network architecture of VectorMapNet. The top row is the pipeline of VectorMapNet generating polylines from raw sensor inputs. The bottom row illustrates detailed structures and inference procedures of three primary components of VectorMapNet: BEV feature extractor, map element detector, and polyline generator. Numbers in polyline embeddings indicate predicted vertex indexes.
|
| 37 |
+
|
| 38 |
+
The heterogeneous nature of map elements calls for a unified vectorized representation. We opt to use N polylines Vpoly = {V poly1 , $\mathcal { V } ^ { \mathrm { p o l y } } = \{ V _ { 1 } ^ { \mathrm { p o l y } } , \dots , V _ { N } ^ { \mathrm { p o l y } } \}$ as primitives to represent these map elements in a map $\mathcal { M }$ . Each polyline $V _ { i } ^ { \mathrm { p o l y } } = \{ v _ { i , n } \in \mathbb { R } ^ { 2 } | n = 1 , \ldots , N _ { v } \}$ is a collection of $N _ { v }$ ordered vertices $\boldsymbol { v } _ { i , n }$ In practice, we converts vector HD maps from different public datasets to polylines by applying the Ramer–Douglas–Peucker algorithm (Ramer, 1972).
|
| 39 |
+
|
| 40 |
+
Why Polyline? Using polylines to represent map elements has three main advantages: (1) HD maps are typically composed of a mixture of different geometries, such as points, lines, curves, and polygons. Polylines are a flexible primitive that can represent these geometric elements effectively. (2) The order of polyline vertices is a natural way to encode the direction of map elements, which is vital to driving. (3) The polyline representation has been widely used by downstream autonomous driving modules, such as motion forecasting (Gao et al., 2020).
|
| 41 |
+
|
| 42 |
+
Method overview. We formulate this task as a sparse set detection problem. Specifically, we represent a map $\mathcal { M }$ by a sparse set of polylines, and the task is to learn a model that extracts information from sensors to predict these primitives for representing the semantic map.
|
| 43 |
+
|
| 44 |
+
First, we map sensor data from sensor-view to a canonical BEV representation $\mathcal { F } _ { \mathrm { B E V } }$ . Then the remaining task is to model polylines based on $\mathcal { F } _ { \mathrm { B E V } }$ . However, map elements exhibit complicated and diverse structural and location patterns, learning both of them jointly can be challenging. Thus, we decouple the task into two parts: (1) A scene-level element detection task that locates and classifies all map elements by predicting element keypoints $\mathcal { A } = \{ A _ { i } \in \mathbb { R } ^ { k \times 2 } | i = 1 , \dots , N \}$ and their class labels $\mathcal { L } = \{ l _ { i } \in \mathbb { Z } | i = 1 , \ldots , N \}$ ; (2) An object-level sequence generation task that produces a sequence of polyline vertices for each detected map element $( A _ { i } , l _ { i } )$ . The definition of element keypoint representation $\mathcal { A }$ is described in $\ S 2 . 2$ .
|
| 45 |
+
|
| 46 |
+
Correspondingly, VectorMapNet employs three modules to model these three tasks, as shown in Figure 2. (1) A BEV feature extractor that lifts sensor observations to BEV space $( \ S 2 . 1 )$ ; (2) A map element detector that predicts map element keypoints $\mathcal { A }$ and class labels $\mathcal { L }$ T $\lbrace \lbrace 2 . 2 )$ ; (3) A polyline generator that completes the shapes of the HD map elements conditioned on keypoints and class labels $( \ S 2 . 3 )$ .
|
| 47 |
+
|
| 48 |
+
# 2.1 BEV FEATURE EXTRACTOR
|
| 49 |
+
|
| 50 |
+
The BEV feature extractor lifts various modality inputs into a unified feature space and aggregates these features into a canonical representation termed BEV features $\mathcal { F } _ { \mathrm { B E V } }$ . We consider two common modalities: surrounding camera images $\mathcal { T }$ and LiDAR points $\mathcal { P }$ .
|
| 51 |
+
|
| 52 |
+
Camera branch. We use ResNet to extract features from images, followed by a feature transformation module from image space to BEV space. VectorMapNet does not rely on certain feature transformation approaches and we opt to use a simple but popular variant of IPM, which produces BEV features of $\dot { \mathcal { F } } _ { \mathrm { B E V } } ^ { \mathcal { T } } \in \mathbb { R } ^ { W \times H \times C _ { 1 } ^ { \bullet } }$ . The detailed structure can be found in Appendix C.3.
|
| 53 |
+
|
| 54 |
+
LiDAR branch. For LiDAR data $\mathcal { P }$ , we use a variant of PointPillars (Lang et al., 2019) with dynamic voxelization (Zhou et al., 2020), which divides the 3D space into multiple pillars and uses $\dot { \mathcal { F } } _ { \mathrm { B E V } } ^ { \mathcal { P } } \in \mathbb { R } ^ { \dot { W } \times H \times C _ { 2 } }$ uds to learn pillar-wise feature maps. We denote this feature map in BEV as.
|
| 55 |
+
|
| 56 |
+
For sensor fusion, we obtain the BEV features $\mathcal { F } _ { \mathrm { B E V } } \in \mathbb { R } ^ { W \times H \times \left( C _ { 1 } + C _ { 2 } \right) }$ by concatenating $\mathcal { F } _ { \mathrm { B E V } } ^ { \mathcal { Z } }$ and $\mathcal { F } _ { \mathrm { B E V } } ^ { \mathcal { P } }$ BEV, and then process the concatenated result with a two-layer convolutional network. An overview of the BEV feature extractor is shown at the bottom-left of Figure 2.
|
| 57 |
+
|
| 58 |
+
# 2.2 MAP ELEMENT DETECTOR
|
| 59 |
+
|
| 60 |
+
After obtaining BEV features, the goal of map element detector is to infer element keypoints $a _ { i , j }$ from the BEV features $\mathcal { F } _ { \mathrm { B E V } }$ . We leverage a variant of transformer set prediction detector (Carion et al., 2020) to achieve this goal. This detector represents map elements’ locations and categories by predicting their element keypoints $\mathcal { A }$ and class labels $\mathcal { L }$ .
|
| 61 |
+
|
| 62 |
+
Keypoint representations. In object detection problems, people use bounding box to abstract the shape of an object. Here we use $k$ key point locations $A _ { i } = \bar { \{ a _ { j } \in \mathbb { R } ^ { 2 } | j = 1 , . . . , k \} }$ , to represent the outline of a map element. However, defining keypoints for map elements is not straightforward since their are diverse. We conduct an ablation study to investigate the performance of different choices in $\ S \ 3 . 3$ .
|
| 63 |
+
|
| 64 |
+
Element queries. The query inputs of the detector are learnable element queries $\{ q _ { i } ^ { \mathrm { e l e m } } \in \mathbb { R } ^ { k \times d } | i =$ $1 , \ldots , N _ { \operatorname* { m a x } } \}$ , where $d$ is the hidden embedding size, and the $i$ -th element query $q _ { i } ^ { \mathrm { e l e m } }$ is composed of $k$ keypoint embeddings $q ^ { \mathrm { k p } } \colon q _ { i } ^ { \mathrm { e l e m } } = \{ q _ { i , j } ^ { \mathrm { k p } } \in \mathbb { R } ^ { d } | j = 1 , \ldots , k \}$ .
|
| 65 |
+
|
| 66 |
+
Architecture. The overall architecture of the map element detector includes a transformer decoder (Vaswani et al., 2017) and a prediction head, as shown at the bottom-middle of Figure 2. The decoder transforms the element queries using multi-head self-/cross-attention mechanisms. In particular, we use the deformable attention module (Zhu et al., 2020) as the decoder’s cross attention module, where each element query has a 2D location grounding. It improves interpretability and accelerates training convergence (Li et al., 2022).
|
| 67 |
+
|
| 68 |
+
The prediction head has two MLPs, which decodes element queries into element keypoints $a _ { i , j } =$ $\mathrm { M L P } _ { \mathrm { k p } } ( q _ { i , j } ^ { \mathrm { k p } } )$ and their class labels $l _ { i } = \mathrm { M L P } _ { \mathrm { c l s } } ( [ q _ { i , 1 } ^ { \mathrm { k p } } , \dots , q _ { i , k } ^ { \mathrm { k p } } ] )$ , respectively. $[ \cdot ]$ is a concatenation operator. Each keypoint embedding $q _ { i , j } ^ { \mathrm { k p } }$ in the map element detector consists of two learnable parts. The first parts is a keypoint position embedding $\{ e _ { j } ^ { \mathrm { k p } } \in \mathbb { R } ^ { d } | j = 1 , \dots , k \}$ , indicating which position in an element keypoint the point belongs to. The second embedding $\{ e _ { i } ^ { \mathrm { p } } \in \mathbb { R } ^ { d } | i = 1 , \dots , N _ { \operatorname* { m a x } } \}$ encodes which map element the keypoint belongs to. The keypoint embedding $q _ { i , j } ^ { \mathrm { k p } }$ is the addition of these two embeddings $e _ { i } ^ { \mathrm { p } } + e _ { j } ^ { \mathrm { k p } }$ .
|
| 69 |
+
|
| 70 |
+
# 2.3 POLYLINE GENERATOR
|
| 71 |
+
|
| 72 |
+
Given the label and keypoints of map elements, the goal of polyline generator is to generate detailed geometrical shape of map elements. Specifically, polyline generator models a distribution $p ( V _ { i } ^ { \mathrm { p o l y } } | a _ { i } , l _ { i } , \mathcal { F } _ { \mathrm { B E V } } ^ { f } )$ over the vertices of each polyline, conditioned on the initial layout (i.e., ele-ass labels) and BEV features. To estimate this distribution, we decompose the joint distribution over V polyi as a product of a series of conditional vertex coordinate distributions.
|
| 73 |
+
|
| 74 |
+
Specifically, we transform each polyline $V _ { i } ^ { \mathrm { p o l y } } = \{ v _ { i , n } \in \mathbb { R } ^ { 2 } | n = 1 , \ldots , N _ { v } \}$ into a flattened sequence $\{ v _ { i , n _ { \cdot } } ^ { f } \in \mathbb { R } | n = 1 , \dots , 2 N _ { v } \}$ by concatenating coordinates values of polyline vertices and add an additional End of Sequence token $( E O S )$ at the end of each sequence, and the target distribution turns into:
|
| 75 |
+
|
| 76 |
+
$$
|
| 77 |
+
p ( V _ { i } ^ { \mathrm { p o l y } } | a _ { i } , l _ { i } , \mathcal { F } _ { \mathrm { B E V } } ; \theta ) = \prod _ { n = 1 } ^ { 2 N _ { v } } p ( v _ { i , n } ^ { f } | v _ { i , < n } ^ { f } , a _ { i } , l _ { i } , \mathcal { F } _ { \mathrm { B E V } } ) .
|
| 78 |
+
$$
|
| 79 |
+
|
| 80 |
+
We model this distribution using an autoregressive network that outputs the parameters of a predictive distribution at each step for the next vertex coordinate. This predictive distribution is defined over all possible discrete vertex coordinate values and $E O S$ .
|
| 81 |
+
|
| 82 |
+
Vertices as discrete variables. Using discrete distributions to model polyline vertices has the advantage of representing arbitrary shapes, i.e., categorical distributions can easily represent various polylines, such as multi-modal, skewed, peaked, or long-tailed, that are commonly seen in our task. Thus, we quantize the coordinate values into discrete tokens and model each token with a categorical distribution. We also conduct an ablation study in Appendix D.2 to investigate other modeling choices.
|
| 83 |
+
|
| 84 |
+
Architecture. The autoregressive network we choose is a vanilla transformer (Vaswani et al., 2017) (see the bottom-right of Figure 2). Each polyline’s keypoint coordinates and class label are tokenized and fed in as the query inputs of the transformer decoder. Then a sequence of vertex tokens are fed into the transformer iteratively, integrating BEV features with cross-attention, and decoded as polyline vertices. Note that the generator can generate all polylines in parallel.
|
| 85 |
+
|
| 86 |
+
Following PolyGen (Nash et al., 2020), we use an addition of three learned embeddings as the embedding of each vertex token: Coordinate Embedding, indicating whether the token represents $x$ or $y$ coordinate; Position Embedding, representing which vertex the token belongs to; Value Embedding, expressing the token’s quantized coordinate value.
|
| 87 |
+
|
| 88 |
+
# 2.4 LEARNING
|
| 89 |
+
|
| 90 |
+
We train our model by minimizing the sum of map element detector loss and polyline generator loss:
|
| 91 |
+
|
| 92 |
+
$$
|
| 93 |
+
\mathcal { L } = \mathcal { L } _ { d e t } + \mathcal { L } _ { g e n }
|
| 94 |
+
$$
|
| 95 |
+
|
| 96 |
+
Map element detector loss. Following (Wang et al., 2022; Zhu et al., 2020), the detector is trained with bipartite matching loss, thus avoiding post-processing steps like non-maximum suppression (NMS). We describe the detail of the loss function in Appendix C.4.
|
| 97 |
+
|
| 98 |
+
Polyline generator loss. Polyline generator is trained to maximize the log-probability of the polyline vertices. We use negative log-likelihood as its loss function:
|
| 99 |
+
|
| 100 |
+
$$
|
| 101 |
+
\mathcal { L } _ { g e n } = - \frac { 1 } { 2 N _ { v } } \sum _ { n = 1 } ^ { 2 N _ { v } } \log \hat { p } ( v _ { i , n } ^ { f } | v _ { i , < n } ^ { f } , a _ { i } , l _ { i } , \mathcal { F } _ { \mathrm { B E V } } ^ { f } ) ,
|
| 102 |
+
$$
|
| 103 |
+
|
| 104 |
+
where $\hat { p } ( v _ { i , n } ^ { f } | \ldots )$ is the conditional probability of discr e coordinate value $v _ { i , n } ^ { f }$ , and $\boldsymbol { v } _ { i , < n } ^ { f }$ are ground truth discrete coordinate values with index less than $n$ . The default training strategy is teacher forcing, meaning that we use ground truth keypoints as generator input. To avoid the exposure bias (Bengio et al., 2015), we further experiment with first training with teacher forcing, and then fine-tuning with predicted keypoints.
|
| 105 |
+
|
| 106 |
+
# 3 EXPERIMENTS
|
| 107 |
+
|
| 108 |
+
Experiment protocol. We conduct experiments on the nuScenes (Caesar et al., 2020) and Argoverse2 (Wilson et al., 2021). Following HDMapNet (Li et al., 2021), we assess the quality of a predicted HD map by comparing its components (i.e., polylines) with ground truth, while the only difference is the selection of distance measure for in TP/FP matching. Both HDMapNet [1] and our paper use Chamfer distance for matching (Chamfer AP). Additionally, we also propose another distance metric termed Frechet distance (Fréchet AP), which better measures the distance between polylines by considering the order of vertices. The definitions of Chamfer AP and Fréchet AP are in $\ S \ A . 2$ . The details of dataset settings (§ A.1), implementations $( \ S \mathrm { ~ C ~ } )$ , and metrics (§ A.2) are presented in the Appendix as well.
|
| 109 |
+
|
| 110 |
+
Table 1: Results on nuScenes dataset. Fusion denotes the model using both images and LiDAR points as inputs. Methods with fine-tune means the model is applied two stage training strategy introduced in $\ S \ : 2 . 4$
|
| 111 |
+
|
| 112 |
+
<table><tr><td>Methods</td><td>APped</td><td> APdivider</td><td>APboundary</td><td>mAP</td></tr><tr><td>STSU (Can et al., 2021)</td><td>7.0</td><td>11.6</td><td>16.5</td><td>11.7</td></tr><tr><td>HDMapNet (Camera) (Li et al., 2021)</td><td>14.4</td><td>21.7</td><td>33.0</td><td>23.0</td></tr><tr><td>HDMapNet (LiDAR) (Li et al.,2021)</td><td>10.4</td><td>24.1</td><td>37.9</td><td>24.1</td></tr><tr><td>HDMapNet (Fusion) (Li et al., 2021)</td><td>16.3</td><td>29.6</td><td>46.7</td><td>31.0</td></tr><tr><td>VectorMapNet (Camera)</td><td>36.1</td><td>47.3</td><td>39.3</td><td>40.9</td></tr><tr><td>VectorMapNet (Camera) + fine-tune</td><td>42.5</td><td>51.4</td><td>44.1</td><td>46.0</td></tr><tr><td>VectorMapNet (LiDAR)</td><td>25.7</td><td>37.6</td><td>38.6</td><td>34.0</td></tr><tr><td>VectorMapNet (Fusion)</td><td>37.6</td><td>50.5</td><td>47.5</td><td>45.2</td></tr><tr><td>VectorMapNet (Fusion) + fine-tune</td><td>48.2</td><td>60.1</td><td>53.0</td><td>53.7</td></tr></table>
|
| 113 |
+
|
| 114 |
+
# 3.1 COMPARISON WITH BASELINES
|
| 115 |
+
|
| 116 |
+
Comparison on nuScenes dataset. We choose two closely related models, HDMapNet (Li et al., 2021) and STSU (Can et al., 2021) as our baselines. For HDMapNet, we directly take its vectorized results. STSU uses a transformer module to detect the moving objects and centerline segments. It uses an association head to piece the segments together as the road graph. In order to adapt STSU to our task, we use a two-layer MLP to predict lane segments and only keep its object branch and polyline branch. We report the average precision that uses Chamfer distance as the threshold to determine the positive matches with ground truth. $\{ 0 . 5 , 1 . 0 , 1 . 5 \}$ are the predefined thresholds of Chamfer distance AP.
|
| 117 |
+
|
| 118 |
+
As shown in Table 1, VectorMapNet outperforms HDMapNet by a large margin under all settings $\left( + 1 7 . 9 \mathrm { m A P } \right.$ in Camera, $+ 9 . 9 \mathrm { m A P }$ in LiDAR, and $+ 1 4 . 2 \mathrm { m A P }$ in Fusion). Compared to camera-only and LiDAR-only, sensor fusion introduces $+ 4 . 3 \mathrm { \ m A P }$ improvement and $+ 1 1 . 2$ mAP improvement, respectively. As described in $\ S \ : 2 . 4$ , our two stage training strategy further boosts the performance of both camera-only and sensor fusion methods by $+ 6 . 9$ mAP and $+ 8 . 5 \mathrm { m A P }$ , respectively. STSU is $- 2 9 . 2 \mathrm { m A P }$ lower than VectorMapNet. Since STSU treats all map elements as a set of fixed-size segments, we hypothesize that ignoring the fine geometry of map elements hurts the performance significantly.
|
| 119 |
+
|
| 120 |
+
Results on Argoverse2. We further compare HDMapNet and VectorMapNet on Argoverse2 dataset, shown in Table 2. Since Argoverse2 provides z-axis annotations, we give VectorMapNet results both in 2D and 3D.
|
| 121 |
+
|
| 122 |
+
In many cases of Argoverse2, the annotated boundaries and divider lines overlap with each other, making it difficult for models to separate them. It results in a drop in performance of both methods, especially in $\mathbf { A P } _ { d i v i d e r }$ of HDMapNet (21. $7 ~ \mathrm { A P } _ { d i v i d e r }$ to $5 . 7 \ \mathrm { A P } _ { d i v i d e r } )$ because its rasterized representation fails to handle these cases. In contrast, VectorMapNet remains competent, showing the advantage of using vectorized representation to represent overlapping elements.
|
| 123 |
+
|
| 124 |
+
Table 2: Results on Argoverse2 dataset.
|
| 125 |
+
|
| 126 |
+
<table><tr><td></td><td></td><td colspan="4">Frechet Distance</td><td colspan="4">Chamfer Distance</td></tr><tr><td>Keypoint Representaion</td><td>#dim</td><td>APped</td><td>APdivider</td><td>APboundary</td><td>mAP</td><td>APped</td><td>APdivider</td><td>APboundary</td><td>mAP</td></tr><tr><td>HDMapNet (Camera) Li et al. (2021)</td><td>2</td><td></td><td>-</td><td>1</td><td>-</td><td>13.1</td><td>5.7</td><td>37.6</td><td>18.8</td></tr><tr><td>VectorMapNet (Camera)</td><td>2</td><td>43.2</td><td>45.5</td><td>52.0</td><td>46.9</td><td>38.3</td><td>36.1</td><td>39.2</td><td>37.9</td></tr><tr><td>VectorMapNet (Camera)</td><td>3</td><td>41.7</td><td>42.3</td><td>49.9</td><td>44.6</td><td>36.5</td><td>35.0</td><td>36.2</td><td>35.8</td></tr></table>
|
| 127 |
+
|
| 128 |
+
# 3.2 QUALITATIVE ANALYSIS
|
| 129 |
+
|
| 130 |
+
Benefits of using polylines as primitives. From visualizations, we find that using polylines as primitives has brought us two benefits compared with baselines: First, polylines effectively encode the detailed geometries of map elements, e.g. the corners of boundaries (see the red ellipses in Figure 3). Second, polyline representations prevent VectorMapNet from generating ambiguous results, as it consistently encodes direction information. In contrast, Rasterized methods are prone to falsely generating loopy curves (see the blue ellipses in Figure 3). These ambiguities hinder safe autonomous driving. Therefore, the polyline is a desired primitive for map learning, as it can reflect real-world road layouts and explicitly encode directions.
|
| 131 |
+
|
| 132 |
+
Benefits of posing map learning as a detection problem. VectorMapNet works in a top-down detection manner: it models the topology of the map and the map element locations first, and then generates map element details. Visualizations show that VectorMapNet capture the map elements comprehensively, including the small elements close to edges. The high mAP of VectorMapNet over other baselines further confirms this observation. Surprisingly, Figure 4 shows that VectorMapNet can find the map elements that are not annotated in the HD map provided by the dataset.
|
| 133 |
+
|
| 134 |
+

|
| 135 |
+
Figure 3: Qualitative results generated by VectorMapNet and baselines. We use camera images as inputs for comparisons. The areas enclosed by red and blue ellipses show that VectorMapNet can preserve sharp corners, and polyline representations prevent VectorMapNet from generating ambiguous self-looping results. Since the lack of directional information, HDMapNet and STSU cannot infer drivable areas from their predictions. It worth noting that the drivable area is inferred from several disjoint boundaries and is non-trivial to model as one object.
|
| 136 |
+
|
| 137 |
+
# 3.3 ABLATION STUDIES
|
| 138 |
+
|
| 139 |
+
We list ablation studies for keypoint representation here. For more ablation studies, please refer to Appendix D in the Appendix.
|
| 140 |
+
|
| 141 |
+
Table 3: Ablation study of keypoint representaions. $k$ is the keypoint number of each keypoint representation.
|
| 142 |
+
|
| 143 |
+
<table><tr><td></td><td colspan="5">Fréchet Distance</td><td colspan="4">Chamfer Distance</td></tr><tr><td>Keypoint Representaion</td><td>k</td><td>APped</td><td>APdivider</td><td>APboundary</td><td>mAP</td><td>APped</td><td>APdivider</td><td>APboundary</td><td>mAP</td></tr><tr><td>Bbox</td><td>2</td><td>47.4</td><td>46.9</td><td>62.8</td><td>52.4</td><td>36.1</td><td>47.3</td><td>39.3</td><td>40.9</td></tr><tr><td>SME</td><td>3</td><td>47.0</td><td>47.4</td><td>56.9</td><td>50.4</td><td>27.6</td><td>34.4</td><td>35.4</td><td>32.5</td></tr><tr><td>Extreme</td><td>4</td><td>41.7</td><td>47.3</td><td>59.0</td><td>49.4</td><td>30.4</td><td>33.1</td><td>37.3</td><td>33.6</td></tr></table>
|
| 144 |
+
|
| 145 |
+
Keypoint representations. Since there is no straightforward keypoint design to represent map elements with few fixed number of points, we propose three simple representations as shown in Figure 5: Bounding Box (Bbox), which is the smallest box enclosing a polyline, and its keypoints are defined as the top-right and bottom-left points of the box; Start-Middle-End (SME), which samples the start, middle, and end point from a polyline; Extreme Points, which are the left-most, right-most, top-most, and bottom-most points of a polyline.
|
| 146 |
+
|
| 147 |
+

|
| 148 |
+
Figure 4: An example of VectorMapNet detecting unlabeled map elements. The red ellipses indicate two pedestrian crossings that are missing in ground truth annotations, while VectorMapNet detects it correctly. All the predictions are generated from camera images.
|
| 149 |
+
|
| 150 |
+

|
| 151 |
+
Figure 5: Three different keypoint representations are proposed here: Bounding Box $\scriptstyle ( \mathrm { k } = 2$ ), SME $( \mathbf { k } { = } 3 )$ , and Extreme Points $( \mathrm { k } { = } 4 )$ , where $k$ has the same definition in $\ S \ O 2$ . The arrow line indicates the direction of the example polyline, and the arrow dash lines indicate the vertices order of keypoint representations.
|
| 152 |
+
|
| 153 |
+
We experiment with these representations and list the results in Table 3. Our results show that the bounding box representation leads to the best mean average performance in both metrics, outperforming others by 2.0 Fréchet mAP and 7.3 Chamfer mAP.
|
| 154 |
+
|
| 155 |
+
# 3.4 VECTORIZED HD MAPS FOR MOTION FORECASTING
|
| 156 |
+
|
| 157 |
+
Since predicting future motions in the complex environment heavily relies on the map information, we investigate the effectiveness of our predicted HD map in this downstream motion forecasting task.
|
| 158 |
+
|
| 159 |
+
Task Settings. In our setting, the motion forecasting model aims to predict a target agent’s 6 plausible future trajectories (3 seconds) from past trajectories (1 second) of agents and an HD semantic map which covers an area of $6 0 m \times 3 0 m$ . We generate data by sampling from nuScenes tracking dataset. We first retrieve agents observed in the tracking dataset and then select agents with complete 3-second future observations as the target agents. As a result, the dataset consists of 25,645 training samples and 5,460 test samples. We use three different input settings to investigate the performance of our predicted HD map: past trajectories, past trajectories with the ground truth HD map, and past trajectories with the map predicted by VectorMapNet. The motion forecaster we used is mmTransformer (Liu et al., 2021) which can optionally take vectorized maps and trajectories as inputs.
|
| 160 |
+
|
| 161 |
+
Table 4: Predicted map for motion forecasting. There are three input settings: past trajectories (denoted as Traj.), past trajectories with the human-annotated HD map from the nuScenes (denoted as Traj. $+ \mathrm { G . T }$ . Map), and past trajectories with the predicted map from VectorMapNet (denoted as Traj. $^ +$ Pred. Map). The predicted map greatly improves the prediction performance compared with the model that only use past trajectories.
|
| 162 |
+
|
| 163 |
+
<table><tr><td>Prediction Model Inputs</td><td>minADE↓</td><td>minFDE↓</td><td>MR@2m↓</td></tr><tr><td>Traj.</td><td>0.909</td><td>1.577</td><td>19.6</td></tr><tr><td>Traj. + G.T. Map</td><td>0.779</td><td>1.390</td><td>18.0</td></tr><tr><td>Traj. + Pred. Map</td><td>0.826</td><td>1.477</td><td>18.2</td></tr></table>
|
| 164 |
+
|
| 165 |
+
Results. To evaluate the performance of motion forecasting under different input settings, we report results on three commonly used metrics (Chang et al., 2019): minimum average displacement error (minADE), minimum final displacement error (minFDE) and miss rate (MR). To get the results, these metrics only account for the best trajectory out of 6 predicted trajectories. Results in Table 4 show that the map predicted by VectorMapNet has encoded environment information that greatly helps the motion forecaster, compared with the model that only takes past trajectories as inputs. The gap between the ground-truth map and the predicted map is not big either, especially in terms of MR $( - 0 . 2 \% )$ . We think future research could further close the performance gap.
|
| 166 |
+
|
| 167 |
+
# 4 RELATED WORKS
|
| 168 |
+
|
| 169 |
+
Semantic map learning. Annotating semantic maps attracts plenty of interests thanks to autonomous driving. Recently, semantic map learning is formulated as a semantic segmentation problem (Mattyus et al., 2015) and is solved by using aerial images (Máttyus et al., 2016), LiDAR points (Yang et al., 2018), and HD panorama (Wang et al., 2016). The crowdsourcing tags (Wang et al., 2015) are used to improve the performance of fine-grained segmentation. Instead of using offline data, recent works focus on understanding BEV semantics from onboard camera images (Lu et al., 2019; Yang et al., 2021), and videos (Can et al., 2020). Only using onboard sensors as model input is particularly challenging as the inputs and target map lie in different coordinate systems. Recently, several crossview learning approaches (Philion & Fidler, 2020; Pan et al., 2020; Li et al., 2021; Zhou & Krähenbühl, 2022; Wang et al., 2022; Chen et al., 2022) leverage the geometric structure of scenes to mitigate the mismatch between sensor inputs and BEV representations. Some methods (Casas et al., 2021; Sadat et al., 2020) use pixel-level semantic maps to solve downstream tasks, but the entire downstream pipeline needs to be redesigned to accommodate these rasterized map inputs. Beyond pixel-level semantic maps, our work extracts a consistent vectorized map around vehicles from surrounding cameras or LiDARs, which suits for existing downstream tasks like motion forecasting (Gao et al., 2020; Zhao et al., 2020; Liu et al., 2021) without modifications.
|
| 170 |
+
|
| 171 |
+
Lane detection. Lane detection aims to separate lane segments from road scenes precisely. Most lane detection algorithms (Pan et al., 2018; Neven et al., 2018) use a pixel-level segmentation technique combined with sophisticated post-processing. Another line of work leverages the predefined proposal to achieve high accuracy and fast inference speed. These methods typically involve handcrafted elements such as vanishing points (Lee et al., 2017), polynomial curves (Van Gansbeke et al., 2019), line segments (Li et al., 2019), and Bézier curves (Feng et al., 2022) to model proposals. In addition to using perspective view cameras as inputs, (Homayounfar et al., 2018) and (Liang et al., 2019) extract lane segments from overhead highway cameras and LiDAR imagery with a recurrent neural network. Instead of discovering the road’s topology via boundaries detection, STSU (Can et al., 2021) and LaneGraphNet (Zürn et al., 2021) construct lane graphs from centerline segments that are encoded by Bézier curves and line segments, respectively. To model complex geometries in the urban environment, we leverage polylines to represent all the map elements in perceptual scopes.
|
| 172 |
+
|
| 173 |
+
Geometric data modeling. Another line of work closely related to VectorMapNet is geometric data generation. These methods typically treat geometric elements as a sequence, such as primitive parts of furniture (Li et al., 2017; Mo et al., 2019), states of sketch strokes (Ha & Eck, 2017), vertices of $n$ -gon mesh (Nash et al., 2020) , and parameters of SVG primitives (Carlier et al., 2020). These methods generate these sequences by leveraging autoregressive models (e.g. Transformer). Since the directly modeling sequence is challenging for long-range centerline maps, HDMapGen (Mi et al., 2021) views the map as a two-level hierarchy. It produces a global and local graph separately with a hierarchical graph RNN. Instead of treating geometric elements as a sequence generation problem, LETR (Xu et al., 2021) models line segment as a detection problem and tackle it with a query-based detector. Unlike the above approaches that focus on single-level geometric modelings, such as scene level (e.g. line segments in an image) or object-level (e.g. furniture), VectorMapNet is designed to address both the scene level and object level geometric modeling. Specifically, VectorMapNet constructs a map by modeling the global relationship between map elements in the scene and the local geometric details inside each element.
|
| 174 |
+
|
| 175 |
+
Learning vector representations from images VectorMapNet bears some similarities with predicting vector graphics from raster images. In this field, several recent works (Carlier et al., 2020) and (Reddy et al., 2021) use different vector object representations to define generative models of vector images.
|
| 176 |
+
|
| 177 |
+
(Ganin et al., 2021) converts images to CAD, CanvasVAE (Yamaguchi, 2021) learns vectorized canvas layouts from images, and (Liu et al., 2022) generates vectorized stroke primitives from raster line drawing. The instance segmentation community has also been concerned with a similar task of detecting object contours in a vector form from an image. These methods (Zhang et al., 2022; Acuna et al., 2018; Liang et al., 2020) initialize a contour for every object instance and then refine the vertex positions of the contour. These methods use highly domain-dependent architectures; therefore, it would be a non-trivial task to adapt them for our task that requires detecting and generating different map elements with different semantic information and different geometry from the real-world 3D space.
|
| 178 |
+
|
| 179 |
+
# 5 CONCLUSIONS
|
| 180 |
+
|
| 181 |
+
We present VectorMapNet, an end-to-end model to tackle the HD semantic map learning problem. Unlike existing works, VectorMapNet uses polylines as the primitives to represent vectorized HD map elements. To learn these polylines, we decompose the learning problem into a detection and a generation problem. Our experiments show that VectorMapNet can generate coherent and complex geometries for urban map elements, benefiting from the polyline primitives. We believe that this novel way to learn HD maps provides a new perspective on the HD semantic map learning problem.
|
| 182 |
+
|
| 183 |
+
Reproducibility Statement. We detail the implementation steps and experiment settings in Appendix C.
|
| 184 |
+
|
| 185 |
+
# REFERENCES
|
| 186 |
+
|
| 187 |
+
David Acuna, Huan Ling, Amlan Kar, and Sanja Fidler. Efficient interactive annotation of segmentation datasets with polygon-rnn $^ { + + }$ . 2018.
|
| 188 |
+
|
| 189 |
+
Pankaj K Agarwal, Rinat Ben Avraham, Haim Kaplan, and Micha Sharir. Computing the discrete fréchet distance in subquadratic time. SIAM Journal on Computing, 43(2):429–449, 2014.
|
| 190 |
+
|
| 191 |
+
Samy Bengio, Oriol Vinyals, Navdeep Jaitly, and Noam Shazeer. Scheduled sampling for sequence prediction with recurrent neural networks. Advances in neural information processing systems, 28, 2015.
|
| 192 |
+
|
| 193 |
+
Holger Caesar, Varun Bankiti, Alex H Lang, Sourabh Vora, Venice Erin Liong, Qiang Xu, Anush Krishnan, Yu Pan, Giancarlo Baldan, and Oscar Beijbom. nuscenes: A multimodal dataset for autonomous driving. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 11621–11631, 2020.
|
| 194 |
+
|
| 195 |
+
Yigit Baran Can, Alexander Liniger, Ozan Unal, Danda Paudel, and Luc Van Gool. Understanding bird’s-eye view semantic hd-maps using an onboard monocular camera. arXiv preprint arXiv:2012.03040, 2020.
|
| 196 |
+
|
| 197 |
+
Yigit Baran Can, Alexander Liniger, Danda Pani Paudel, and Luc Van Gool. Structured bird’seye-view traffic scene understanding from onboard images. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 15661–15670, 2021.
|
| 198 |
+
|
| 199 |
+
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, pp. 213–229. Springer, 2020.
|
| 200 |
+
|
| 201 |
+
Alexandre Carlier, Martin Danelljan, Alexandre Alahi, and Radu Timofte. Deepsvg: A hierarchical generative network for vector graphics animation. Advances in Neural Information Processing Systems, 33:16351–16361, 2020.
|
| 202 |
+
|
| 203 |
+
Sergio Casas, Abbas Sadat, and Raquel Urtasun. Mp3: A unified model to map, perceive, predict and plan. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 14403–14412, 2021.
|
| 204 |
+
|
| 205 |
+
Ming-Fang Chang, John Lambert, Patsorn Sangkloy, Jagjeet Singh, Slawomir Bak, Andrew Hartnett, De Wang, Peter Carr, Simon Lucey, Deva Ramanan, et al. Argoverse: 3d tracking and forecasting with rich maps. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8748–8757, 2019.
|
| 206 |
+
|
| 207 |
+
Xuanyao Chen, Tianyuan Zhang, Yue Wang, Yilun Wang, and Hang Zhao. Futr3d: A unified sensor fusion framework for 3d detection. arXiv preprint arXiv:2203.10642, 2022.
|
| 208 |
+
|
| 209 |
+
Thomas Eiter and Heikki Mannila. Computing discrete fréchet distance. 1994.
|
| 210 |
+
|
| 211 |
+
Zhengyang Feng, Shaohua Guo, Xin Tan, Ke Xu, Min Wang, and Lizhuang Ma. Rethinking efficient lane detection via curve modeling. arXiv preprint arXiv:2203.02431, 2022.
|
| 212 |
+
|
| 213 |
+
Yaroslav Ganin, Sergey Bartunov, Yujia Li, Ethan Keller, and Stefano Saliceti. Computer-aided design as language. Advances in Neural Information Processing Systems, 34:5885–5897, 2021.
|
| 214 |
+
|
| 215 |
+
Jiyang Gao, Chen Sun, Hang Zhao, Yi Shen, Dragomir Anguelov, Congcong Li, and Cordelia Schmid. Vectornet: Encoding hd maps and agent dynamics from vectorized representation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11525–11533, 2020.
|
| 216 |
+
|
| 217 |
+
David Ha and Douglas Eck. A neural representation of sketch drawings. arXiv preprint arXiv:1704.03477, 2017.
|
| 218 |
+
|
| 219 |
+
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.
|
| 220 |
+
|
| 221 |
+
Namdar Homayounfar, Wei-Chiu Ma, Shrinidhi Kowshika Lakshmikanth, and Raquel Urtasun. Hierarchical recurrent attention networks for structured online maps. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3417–3426, 2018.
|
| 222 |
+
|
| 223 |
+
Harold W Kuhn. The hungarian method for the assignment problem. Naval research logistics quarterly, 2(1-2):83–97, 1955.
|
| 224 |
+
|
| 225 |
+
Alex H Lang, Sourabh Vora, Holger Caesar, Lubing Zhou, Jiong Yang, and Oscar Beijbom. Pointpillars: Fast encoders for object detection from point clouds. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12697–12705, 2019.
|
| 226 |
+
|
| 227 |
+
Seokju Lee, Junsik Kim, Jae Shin Yoon, Seunghak Shin, Oleksandr Bailo, Namil Kim, Tae-Hee Lee, Hyun Seok Hong, Seung-Hoon Han, and In So Kweon. Vpgnet: Vanishing point guided network for lane and road marking detection and recognition. In Proceedings of the IEEE international conference on computer vision, pp. 1947–1955, 2017.
|
| 228 |
+
|
| 229 |
+
Feng Li, Hao Zhang, Shilong Liu, Jian Guo, Lionel M Ni, and Lei Zhang. Dn-detr: Accelerate detr training by introducing query denoising. arXiv preprint arXiv:2203.01305, 2022.
|
| 230 |
+
|
| 231 |
+
Jun Li, Kai Xu, Siddhartha Chaudhuri, Ersin Yumer, Hao Zhang, and Leonidas Guibas. Grass: Generative recursive autoencoders for shape structures. ACM Transactions on Graphics (TOG), 36 (4):1–14, 2017.
|
| 232 |
+
|
| 233 |
+
Qi Li, Yue Wang, Yilun Wang, and Hang Zhao. Hdmapnet: A local semantic map learning and evaluation framework. arXiv preprint arXiv:2107.06307, 2021.
|
| 234 |
+
|
| 235 |
+
Xiang Li, Jun Li, Xiaolin Hu, and Jian Yang. Line-cnn: End-to-end traffic line detection with line proposal unit. IEEE Transactions on Intelligent Transportation Systems, 21(1):248–258, 2019.
|
| 236 |
+
|
| 237 |
+
Justin Liang, Namdar Homayounfar, Wei-Chiu Ma, Shenlong Wang, and Raquel Urtasun. Convolutional recurrent network for road boundary extraction. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9512–9521, 2019.
|
| 238 |
+
|
| 239 |
+
Justin Liang, Namdar Homayounfar, Wei-Chiu Ma, Yuwen Xiong, Rui Hu, and Raquel Urtasun. Polytransform: Deep polygon transformer for instance segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9131–9140, 2020.
|
| 240 |
+
|
| 241 |
+
Hanyuan Liu, Chengze Li, Xueting Liu, and Tien-Tsin Wong. End-to-end line drawing vectorization. 2022.
|
| 242 |
+
|
| 243 |
+
Yicheng Liu, Jinghuai Zhang, Liangji Fang, Qinhong Jiang, and Bolei Zhou. Multimodal motion prediction with stacked transformers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7577–7586, 2021.
|
| 244 |
+
|
| 245 |
+
Ilya Loshchilov and Frank Hutter. Fixing weight decay regularization in adam. 2018.
|
| 246 |
+
|
| 247 |
+
Chenyang Lu, Marinus Jacobus Gerardus van de Molengraft, and Gijs Dubbelman. Monocular semantic occupancy grid mapping with convolutional variational encoder–decoder networks. IEEE Robotics and Automation Letters, 4(2):445–452, 2019.
|
| 248 |
+
|
| 249 |
+
Hanspeter A Mallot, Heinrich H Bülthoff, JJ Little, and Stefan Bohrer. Inverse perspective mapping simplifies optical flow computation and obstacle detection. Biological cybernetics, 64(3):177–185, 1991.
|
| 250 |
+
|
| 251 |
+
Gellert Mattyus, Shenlong Wang, Sanja Fidler, and Raquel Urtasun. Enhancing road maps by parsing aerial images around the world. In Proceedings of the IEEE international conference on computer vision, pp. 1689–1697, 2015.
|
| 252 |
+
|
| 253 |
+
Gellért Máttyus, Shenlong Wang, Sanja Fidler, and Raquel Urtasun. Hd maps: Fine-grained road segmentation by parsing ground and aerial images. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3611–3619, 2016.
|
| 254 |
+
|
| 255 |
+
Lu Mi, Hang Zhao, Charlie Nash, Xiaohan Jin, Jiyang Gao, Chen Sun, Cordelia Schmid, Nir Shavit, Yuning Chai, and Dragomir Anguelov. Hdmapgen: A hierarchical graph generative model of high definition maps. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 4227–4236, 2021.
|
| 256 |
+
|
| 257 |
+
Kaichun Mo, Paul Guerrero, Li Yi, Hao Su, Peter Wonka, Niloy Mitra, and Leonidas J Guibas. Structurenet: Hierarchical graph networks for 3d shape generation. arXiv preprint arXiv:1908.00575, 2019.
|
| 258 |
+
|
| 259 |
+
Charlie Nash, Yaroslav Ganin, SM Ali Eslami, and Peter Battaglia. Polygen: An autoregressive generative model of 3d meshes. In International Conference on Machine Learning, pp. 7220–7229. PMLR, 2020.
|
| 260 |
+
|
| 261 |
+
Davy Neven, Bert De Brabandere, Stamatios Georgoulis, Marc Proesmans, and Luc Van Gool. Towards end-to-end lane detection: an instance segmentation approach. In 2018 IEEE intelligent vehicles symposium (IV), pp. 286–291. IEEE, 2018.
|
| 262 |
+
|
| 263 |
+
Bowen Pan, Jiankai Sun, Ho Yin Tiga Leung, Alex Andonian, and Bolei Zhou. Cross-view semantic segmentation for sensing surroundings. IEEE Robotics and Automation Letters, 5(3):4867–4873, 2020.
|
| 264 |
+
|
| 265 |
+
Xingang Pan, Jianping Shi, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Spatial as deep: Spatial cnn for traffic scene understanding. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32, 2018.
|
| 266 |
+
|
| 267 |
+
Jonah Philion and Sanja Fidler. Lift, splat, shoot: Encoding images from arbitrary camera rigs by implicitly unprojecting to 3d. In European Conference on Computer Vision, pp. 194–210. Springer, 2020.
|
| 268 |
+
|
| 269 |
+
Charles R Qi, Hao Su, Kaichun Mo, and Leonidas J Guibas. Pointnet: Deep learning on point sets for 3d classification and segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 652–660, 2017.
|
| 270 |
+
|
| 271 |
+
Urs Ramer. An iterative procedure for the polygonal approximation of plane curves. Comput. Graph. Image Process., 1:244–256, 1972.
|
| 272 |
+
|
| 273 |
+
Pradyumna Reddy, Michael Gharbi, Michal Lukac, and Niloy J Mitra. Im2vec: Synthesizing vector graphics without vector supervision. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7342–7351, 2021.
|
| 274 |
+
|
| 275 |
+
Thomas Roddick and Roberto Cipolla. Predicting semantic map representations from images using pyramid occupancy networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11138–11147, 2020.
|
| 276 |
+
|
| 277 |
+
Guodong Rong, Byung Hyun Shin, Hadi Tabatabaee, Qiang Lu, Steve Lemke, Marti ¯ n, š Možeiko, Eric Boise, Geehoon Uhm, Mark Gerow, Shalin Mehta, et al. Lgsvl simulator: A high fidelity simulator for autonomous driving. arXiv preprint arXiv:2005.03778, 2020.
|
| 278 |
+
|
| 279 |
+
Abbas Sadat, Sergio Casas, Mengye Ren, Xinyu Wu, Pranaab Dhawan, and Raquel Urtasun. Perceive, predict, and plan: Safe motion planning through interpretable semantic representations. In European Conference on Computer Vision, pp. 414–430. Springer, 2020.
|
| 280 |
+
|
| 281 |
+
Wouter Van Gansbeke, Bert De Brabandere, Davy Neven, Marc Proesmans, and Luc Van Gool. Endto-end lane detection through differentiable least-squares fitting. In Proceedings of the IEEE/CVF International Conference on Computer Vision Workshops, pp. 0–0, 2019.
|
| 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. Advances in neural information processing systems, 30, 2017.
|
| 284 |
+
|
| 285 |
+
Shenlong Wang, Sanja Fidler, and Raquel Urtasun. Holistic 3d scene understanding from a single geo-tagged image. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3964–3972, 2015.
|
| 286 |
+
|
| 287 |
+
Shenlong Wang, Min Bai, Gellert Mattyus, Hang Chu, Wenjie Luo, Bin Yang, Justin Liang, Joel Cheverie, Sanja Fidler, and Raquel Urtasun. Torontocity: Seeing the world with a million eyes. arXiv preprint arXiv:1612.00423, 2016.
|
| 288 |
+
|
| 289 |
+
Yue Wang, Vitor Campagnolo Guizilini, Tianyuan Zhang, Yilun Wang, Hang Zhao, and Justin Solomon. Detr3d: 3d object detection from multi-view images via 3d-to-2d queries. In Conference on Robot Learning, pp. 180–191. PMLR, 2022.
|
| 290 |
+
|
| 291 |
+
Benjamin Wilson, William Qi, Tanmay Agarwal, John Lambert, Jagjeet Singh, Siddhesh Khandelwal, Bowen Pan, Ratnesh Kumar, Andrew Hartnett, Jhony Kaesemodel Pontes, Deva Ramanan, Peter Carr, and James Hays. Argoverse 2: Next generation datasets for self-driving perception and forecasting. In Proceedings of the Neural Information Processing Systems Track on Datasets and Benchmarks (NeurIPS Datasets and Benchmarks 2021), 2021.
|
| 292 |
+
|
| 293 |
+
Yifan Xu, Weijian Xu, David Cheung, and Zhuowen Tu. Line segment detection using transformers without edges. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 4257–4266, 2021.
|
| 294 |
+
|
| 295 |
+
Kota Yamaguchi. Canvasvae: Learning to generate vector graphic documents. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 5481–5489, 2021.
|
| 296 |
+
|
| 297 |
+
Bin Yang, Ming Liang, and Raquel Urtasun. Hdnet: Exploiting hd maps for 3d object detection. In Conference on Robot Learning, pp. 146–155. PMLR, 2018.
|
| 298 |
+
|
| 299 |
+
Weixiang Yang, Qi Li, Wenxi Liu, Yuanlong Yu, Yuexin Ma, Shengfeng He, and Jia Pan. Projecting your view attentively: Monocular road scene layout estimation via cross-view transformation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 15536–15545, 2021.
|
| 300 |
+
|
| 301 |
+
Tao Zhang, Shiqing Wei, and Shunping Ji. E2ec: An end-to-end contour-based method for highquality high-speed instance segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 4443–4452, 2022.
|
| 302 |
+
|
| 303 |
+
Hang Zhao, Jiyang Gao, Tian Lan, Chen Sun, Benjamin Sapp, Balakrishnan Varadarajan, Yue Shen, Yi Shen, Yuning Chai, Cordelia Schmid, et al. Tnt: Target-driven trajectory prediction. arXiv preprint arXiv:2008.08294, 2020.
|
| 304 |
+
|
| 305 |
+
Brady Zhou and Philipp Krähenbühl. Cross-view transformers for real-time map-view semantic segmentation. arXiv preprint arXiv:2205.02833, 2022.
|
| 306 |
+
|
| 307 |
+
Yin Zhou, Pei Sun, Yu Zhang, Dragomir Anguelov, Jiyang Gao, Tom Ouyang, James Guo, Jiquan Ngiam, and Vijay Vasudevan. End-to-end multi-view fusion for 3d object detection in lidar point clouds. In Conference on Robot Learning, pp. 923–932. PMLR, 2020.
|
| 308 |
+
|
| 309 |
+
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.
|
| 310 |
+
|
| 311 |
+
Jannik Zürn, Johan Vertens, and Wolfram Burgard. Lane graph estimation for scene understanding in urban driving. IEEE Robotics and Automation Letters, 6(4):8615–8622, 2021.
|
| 312 |
+
|
| 313 |
+
# A EXPERIMENT SETUP
|
| 314 |
+
|
| 315 |
+
# A.1 DATASET
|
| 316 |
+
|
| 317 |
+
nuScenes We experiment on nuScenes (Caesar et al., 2020) dataset, which contains 1000 sequences of recordings collected by autonomous driving cars. Each episode is annotated at $2 \mathrm { H z }$ and contains 6 camera images and LiDAR sweeps. Our dataset setup and pre-processing steps are identical to that of HDMapNet (Li et al., 2021), which includes three categories of map elements – pedestrian crossing, divider, and road boundary – from the nuScenes dataset.
|
| 318 |
+
|
| 319 |
+
Argoverse2 We further conduct experiments on Argoverse2 (Wilson et al., 2021) dataset. Like nuScenes, it contains 1000 logs (700, 150, 150 for training, validation and test set). Each episode provides 15s of $2 0 \mathrm { H z }$ camera images, $1 0 \mathrm { H z }$ LiDAR sweeps and a vectorized map. We use the same pre-processing settings as on nuScenes dataset.
|
| 320 |
+
|
| 321 |
+
# A.2 METRICS
|
| 322 |
+
|
| 323 |
+
In contrast to existing methods which generate rasterized results, our method does not require rasterizing curves on grids. Therefore, we opt not to use Intersection-Over-Union (IoU) as a metric. We use a distance-based metric to evaluate the similarity between predicted curves and ground-truth curves. We follow the instance-level evaluation metric proposed by HDMapNet (Li et al., 2021) to compare the instance-level detection performance of our model to baseline methods. The metric is average precision (AP), where positive/negative samples are based on geometric similarity, more concretely, Chamfer distance and Fréchet distance. For clarity, we call the AP based on Chamfer distance and Fréchet distance as Chamfer AP and Fréchet AP, respectively.
|
| 324 |
+
|
| 325 |
+
Chamfer distance. Chamfer distance is a distance measure that quantifies the similarity between two unordered sets. The Chamfer distance is an evaluation metric that quantifies the similarity between two unordered sets by taking into account the distance of each permutation of the elements of set as follows:
|
| 326 |
+
|
| 327 |
+
$$
|
| 328 |
+
D _ { c h a m f e r } ( S _ { 1 } , S _ { 2 } ) = \frac { 1 } { 2 } ( \frac { 1 } { | S _ { 1 } | } \sum _ { p \in S _ { 1 } } \operatorname* { m i n } _ { q \in S _ { 2 } } \| p , q \| _ { 2 } + \frac { 1 } { | S _ { 2 } | } \sum _ { q \in S _ { 2 } } \operatorname* { m i n } _ { p \in S _ { 1 } } \| q , p \| _ { 2 } ) .
|
| 329 |
+
$$
|
| 330 |
+
|
| 331 |
+
In our experiments, we use chamfer distance to calculate the distance between a prediction and a ground truth polyline set, and each polyline set is represented by uniformly sampling a polyline to $N _ { p t s }$ vertices, where $N _ { p t s }$ is set to 100 in our experiments.
|
| 332 |
+
|
| 333 |
+
Fréchet distance. The order of polyline vertices is not measured by Chamfer distance. Therefore, we introduce Fréchet distance as an additional measure. Fréchet distance is a measure of similarity of curves that takes both the positions and the order of the points along the curves into consideration. Our implementation is based on discrete Fréchet distance (Eiter & Mannila, 1994; Agarwal et al., 2014).
|
| 334 |
+
|
| 335 |
+
We use the discrete version of Fréchet distance (Eiter & Mannila, 1994; Agarwal et al., 2014) to evaluate the geometric similarity between two polyline $P$ and $Q$ . We denote $\sigma ( P )$ as a sequence of endpoints of the line segments of $P$ . In particular, $\sigma ( P ) = ( p _ { 1 } , \dots , p _ { m } )$ is a sequence with $m$ vertices that uniformly sampled from the original input polyline $P$ , where each position of $P$ between $p _ { i }$ and $p _ { i + 1 }$ can be approximated by using an affine transformation that is $p _ { i + \lambda } = ( 1 - \lambda ) p _ { i } + \lambda p _ { i + 1 }$ and the $m$ in our experiment is set as 100.
|
| 336 |
+
|
| 337 |
+
Let $P$ and $Q$ be polyline and $\sigma ( P ) = ( u _ { 1 } , \ldots , u _ { p } ) $ and $\sigma ( Q ) = ( v _ { 1 } , . . . , v _ { q } )$ the corresponding sequences. A coupling $L$ is a sequence of distinct pairs between $\sigma ( P )$ and $\sigma ( Q )$ :
|
| 338 |
+
|
| 339 |
+
$$
|
| 340 |
+
( u _ { a _ { 1 } } , v _ { b _ { 1 } } ) , \ldots , ( u _ { a _ { m } } , v _ { b _ { m } } ) .
|
| 341 |
+
$$
|
| 342 |
+
|
| 343 |
+
These indexes $\{ a _ { 1 } , \ldots , a _ { m } \}$ and $\{ b _ { 1 } , \ldots , b _ { m } \}$ are nondecreasing surjection such that $a _ { 1 } ~ = ~ 1$ , $a _ { m } = p , b _ { 1 } = 1 , b _ { m } =$ $b _ { m } = q$ and for all $i < j \in \{ 1 , \ldots , q \} , a _ { i } \leq a _ { j }$ and $b _ { i } \leq b _ { j }$ .
|
| 344 |
+
|
| 345 |
+
We define the norm $\lVert L \rVert$ of the $L$ is the length of the longest pair in $L$ , that is,
|
| 346 |
+
|
| 347 |
+
$$
|
| 348 |
+
\| L \| = \operatorname* { m a x } _ { i = 1 , \ldots , m } d ( u _ { a _ { i } } , v _ { b _ { i } } ) .
|
| 349 |
+
$$
|
| 350 |
+
|
| 351 |
+
The discrete Fréchet distance between polyline $P$ and $Q$ is defined to be
|
| 352 |
+
|
| 353 |
+
This equation indicates that the distance of discrete Fréchet distance is the minimum norm of all possible couplings. To Find the coupling plausible $L$ that has the minimum norm, we use a Dynamic programming-based algorithm that is described in Algorithm 1.
|
| 354 |
+
|
| 355 |
+
# Algorithm 1: The Algorithm of Discrete Fréchet Distance
|
| 356 |
+
|
| 357 |
+
Input: polyline $P = ( u _ { 1 } , \ldots , u _ { p } ) $ and $Q = ( v _ { 1 } , \ldots , v _ { q } )$ .
|
| 358 |
+
Output: $\delta _ { d F } ( P , Q )$
|
| 359 |
+
$c a :$ an 2d array of real with size of $( p \times q )$ ;
|
| 360 |
+
Function $c ( i , j )$ if $c a ( i , j ) > - 1$ then return $c a ( i , j )$ ; else if $i = 1$ and $j = 1$ then $c a ( i , j ) : = d ( u 1 , v 1 )$ ; else if $i > 1$ and $j = 1$ then $c a ( i , j ) : = \operatorname* { m a x } \{ c ( i - 1 , 1 ) , d ( u _ { i } , v _ { 1 } ) \}$ ; else if $i = 1$ and $j > 1$ then $c a ( i , j ) : = \operatorname* { m a x } \{ c ( 1 , j - 1 ) , d ( u _ { 1 } , v _ { j } ) \} ;$ ; else if $i > 1$ and $j > 1$ then $c a ( i , j ) : = \operatorname* { m a x } ^ { } \{ \operatorname* { m i n } ( c ( i - 1 , j ) , c ( i - 1 , j - 1 ) , c ( i , j - 1 ) ) , d ( u _ { i } , v _ { j } ) \} ;$ else $c a ( i , j ) : = \infty$ ; end return $c a ( i , j )$ ;
|
| 361 |
+
end
|
| 362 |
+
begin for $i = 1$ to p do for $j = 1$ to q do $\mathrm { c a ( i , j ) } \mathrel { \mathop : } = - 1 . 0 $ ; end end return $c ( p , q )$ ;
|
| 363 |
+
end
|
| 364 |
+
|
| 365 |
+
B MORE VISUALIZATIONS OF VECTORMAPNET (FUSION)
|
| 366 |
+
|
| 367 |
+
We visualized three cases of VectorMapNet (Fusion) and VectorMapNet (Camera) to demonstrate that LiDAR information can complement visual information to generate more robust map predictions. In the first case, the camera view is constrained by the nearby vehicles, so it can not provide helpful surrounding information. LiDAR sensor bypasses the nearby vehicle and provides some cue for VectorMapNet to generate a better result than its camera-only counterpart (see Figure 6). For the second case (see Figure 7), the model cannot detect the nearby parking gate because it locates in the blind zone of cameras. In contrast, the LiDAR provides depth information and helps the VectorMapNet(Fusion) detect the missing lane boundary. LiDAR points can prevent the model from falsely detecting map elements in bad weather conditions as well. As shown in Figure 8, some puddles are near the intersection. With the light reflection, these puddles visually look like a lane boundary. However, the LiDAR data shows that there does not have any bump in there. Unlike the camera-only model, this depth information from LiDAR helps our fusion model not generate a non existed lane boundary.
|
| 368 |
+
|
| 369 |
+

|
| 370 |
+
Figure 6: When the ego car cameras are occluded by the nearby vehicles, VectorMapNet(Camera) can not precept the surrounding map. With the depth cue from LiDAR, VectorMapNet(Fusion) can generate a more plausible result than its camera counterpart.
|
| 371 |
+
|
| 372 |
+

|
| 373 |
+
Figure 7: The blind area of onboard cameras may cause our model to miss the map elements closed ego vehicle. In contrast, we can easily find that LiDAR data has sensed some obstacles near the ego vehicle in the right-most column. With these cues, our fusion model detects the missed lane boundary by our camera-only model.
|
| 374 |
+
|
| 375 |
+
# C IMPLEMENTATION DETAILS
|
| 376 |
+
|
| 377 |
+
# C.1 OVERALL ARCHITECTURES.
|
| 378 |
+
|
| 379 |
+
BEV feature extractor outputs a feature map with a size of (200, 100, 128). It uses ResNet50 (He et al., 2016) for shared CNN backbone. We use a single layer PointNet (Qi et al., 2017) whose outputs have 64 dimensions as the LiDAR backbone to aggregate LiDAR points into a pillar. We set the number of element queries $N _ { \mathrm { m a x } }$ in map element detector as 100. The transformer decoders we used in map element detector and polyline generator both have 6 decoder layers, and their hidden embeddings’ size is 256. For the output space of polyline generator, we divide the map space (see $\ S \ : 2 . 3 )$ evenly into $2 0 0 \times 1 0 0$ rectangular grids, and each grid has a size of $0 . 3 m \times 0 . 3 m$ .
|
| 380 |
+
|
| 381 |
+

|
| 382 |
+
Figure 8: The qualitative results of VectorMapNet in bad weather conditions. VectorMapNet(Camera) falsely detects these puddles near the intersection as a lane boundary. The fusion result shows that the miss detection issue can be resolved by combining the depth information.
|
| 383 |
+
|
| 384 |
+
# C.2 TRAINING SETTINGS.
|
| 385 |
+
|
| 386 |
+
We train all our models on 8 GTX3090 GPUs for 110 epochs with a total batch size of 32. We use AdamW (Loshchilov & Hutter, 2018) optimizer with a gradient clipping norm of 5.0. For the learning rate schedule, we use a step schedule that multiplies a learning rate by 0.1 at epoch 100 and has a linear warm-up period at the first 5000 steps. The dropout rate for all modules is 0.2, following the transformer’s settings (Vaswani et al., 2017). Data augmentation is only deployed during polyline generator’s training; specifically, two I.I.D. Gaussian noises are added to each input vertex’s $x$ and $y$ coordinates with a probability of 0.3.
|
| 387 |
+
|
| 388 |
+
# C.3 MODEL DETAILS
|
| 389 |
+
|
| 390 |
+
Camera Branch of Map Feature Extractor. For image data $\mathcal { T }$ , we use a shared CNN backbone to obtain each camera’s image features in the camera space, then use the Inverse Perspective Mapping (IPM) (Mallot et al., 1991) technique to transform these features into BEV space. Since the depth information is missing in camera images, we follow one common approach that assumes the ground is mostly planar and transforms the images to BEV via homography. Without knowing the exact height of the ground plane, this homography is not an accurate transformation. To alleviate this issue, we transform the image features into four BEV planes with different heights ( we use $( - 1 m , 0 m , 1 m , 2 m )$ in practice). The camera BEV features $\mathcal { F } _ { \mathrm { B E V } } ^ { \mathcal { Z } } \in \mathbb { R } ^ { W \times H \times C _ { 1 } }$ are the concatenation of these feature maps.
|
| 391 |
+
|
| 392 |
+
# C.4 LOSS
|
| 393 |
+
|
| 394 |
+
Loss settings. The loss function of map element detector is a linear combination of three parts: a negative log-likelihood for element keypoint classification, a smooth L1 loss, and an IoU loss for keypoints regression. The coefficients of these loss components are $2 , 0 . 1 , 1$ . The matching cost of map element detector is the same as the loss combination. The loss function of polyline generator is a negative log-likelihood. We train VectorMapNet by simply summing up these losses.
|
| 395 |
+
|
| 396 |
+
map element detector loss. To get the loss, we first establish a correspondence between the groundtruth $( { \mathcal { A } } , { \mathcal { L } } )$ and the prediction $( \bar { \mathcal { A } } , \hat { \mathcal { L } } )$ . Assuming the number of ground-truth map element keypoints $N$ is smaller than the number of predictions $N _ { m a x }$ , and we pad the set of ground-truth $( { \mathcal { A } } , { \mathcal { L } } )$ with ∅s (no object) up to $N _ { m a x }$ . The correspondence $\sigma$ is a permutation of $N _ { m a x }$ elements $\sigma \in \mathcal { P }$ with the lowest cost: σ∈P PNmaxj=1 −1(lj ̸=∅)pˆσ(j)(lj ) + −1(lj ̸=∅)Lkeypoint(aj , aˆσ(j)), where $\hat { p } _ { \sigma ( j ) } ( l _ { j } )$ is the probability of class label $l _ { j }$ for the prediction with index $\sigma ( j )$ , and the loss of keypoints parameters $\mathcal { L } _ { k e y p o i n t }$ is an addition of a smooth L1 loss and an IoU loss. With these notations we define the loss of detector as:
|
| 397 |
+
|
| 398 |
+
$$
|
| 399 |
+
\mathcal { L } _ { d e t } = \sum _ { j = 1 } ^ { N _ { m a x } } - \log \hat { p } _ { \sigma ^ { * } ( j ) } ( l _ { j } ) + \mathbb { 1 } _ { ( l _ { j } \neq \emptyset ) } \mathcal { L } _ { k e y p o i n t } \big ( a _ { j } , \hat { a } _ { \sigma ^ { * } ( j ) } \big ) ,
|
| 400 |
+
$$
|
| 401 |
+
|
| 402 |
+
where $\sigma ^ { * }$ is the optimal assignment computed by Hungarian algorithm (Kuhn, 1955).
|
| 403 |
+
|
| 404 |
+
# D MORE ABLATION STUDIES
|
| 405 |
+
|
| 406 |
+
# D.1 CURVE SAMPLING STRATEGIES
|
| 407 |
+
|
| 408 |
+
Table 5: Ablation study of curves sampling strategies.
|
| 409 |
+
|
| 410 |
+
<table><tr><td></td><td colspan="4">Frechet Distance</td><td colspan="4">Chamfer Distance</td></tr><tr><td>Vertex Sampling Method</td><td>APped</td><td>APdivider</td><td>APboundary</td><td>mAP</td><td>APped</td><td>APdivider</td><td>APboundary</td><td>mAP</td></tr><tr><td>curvature-based</td><td>47.0</td><td>47.4</td><td>56.9</td><td>50.4</td><td>27.6</td><td>34.4</td><td>35.4</td><td>32.5</td></tr><tr><td>fixed interval</td><td>26.0</td><td>23.6</td><td>37.1</td><td>28.9</td><td>14.6</td><td>17.6</td><td>18.7</td><td>17.0</td></tr></table>
|
| 411 |
+
|
| 412 |
+
We use two approaches to sample polylines. The first is based on the original nuScenes setting (Caesar et al., 2020), which samples vertices at the position where the curvature changes are beyond a certain threshold. The second is to sample the vertices at fixed intervals $( 1 m )$ . We compare our methods under these two sampling strategies and the results are shown in Table 5. The curvature-based sampling outperforms its fixed-sampling counterpart by a large margin and achieves a leading 21.5 Fréchet mAP and 15.5 Chamfer mAP. We hypothesize that the fixed-sampling method involves a large set of redundant vertices that have negligible contributions to the geometry, thus under-weighs the essential vertices (e.g. the vertices at the corner of a polyline) in the learning process.
|
| 413 |
+
|
| 414 |
+
# D.2 VERTEX MODELING METHODS.
|
| 415 |
+
|
| 416 |
+
Table 6: Ablation study of vertex modeling methods.
|
| 417 |
+
|
| 418 |
+
<table><tr><td></td><td colspan="4">Frechet Distance</td><td colspan="4">Chamfer Distance</td></tr><tr><td>Modeling Method</td><td>APped</td><td>APdivider</td><td>APboundary</td><td>mAP</td><td>APped</td><td>APdivider</td><td>APboundary</td><td>mAP</td></tr><tr><td>discrete</td><td>47.0</td><td>47.4</td><td>56.9</td><td>50.4</td><td>27.6</td><td>34.4</td><td>35.4</td><td>32.5</td></tr><tr><td>continuous</td><td>38.0</td><td>41.6</td><td>46.1</td><td>41.9</td><td>26.5</td><td>28.1</td><td>30.1</td><td>26.5</td></tr></table>
|
| 419 |
+
|
| 420 |
+
We investigate both discrete and continuous ways to model polyline vertices. The discrete version of polyline generator is described in $\ S \ : 2 . 3$ . With the same model structure, we follow SketchRNN (Ha & Eck, 2017) and use mixture of Gaussian distributions to model the vertices of polylines as continuous variables. The comparison is shown in Table 6. We find that using discrete embeddings vertex coordinates results in a considerable gain in performance, with Chamfer mAP increasing from 18.2 to 32.5 and the Fréchet mAP increasing from 26.8 to 50.4. These improvements suggest that the nonlocal characteristic of categorical distribution helps our model to capture complex vertex coordinate distributions.
|
md/dev/RwzFNbJ3Ez/RwzFNbJ3Ez.md
ADDED
|
@@ -0,0 +1,484 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SELFCHECKGPT: Zero-Resource Black-Box Hallucination Detection for Generative Large Language Models
|
| 2 |
+
|
| 3 |
+
Potsawee Manakul, Adian Liusie, Mark J. F. Gales ALTA Institute, Department of Engineering, University of Cambridge pm574@cam.ac.uk, al826@cam.ac.uk, mjfg@eng.cam.ac.uk
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Generative Large Language Models (LLMs) such as GPT-3 are capable of generating highly fluent responses to a wide variety of user prompts. However, LLMs are known to hallucinate facts and make non-factual statements which can undermine trust in their output. Existing fact-checking approaches either require access to the output probability distribution (which may not be available for systems such as ChatGPT) or external databases that are interfaced via separate, often complex, modules. In this work, we propose "SelfCheckGPT", a simple sampling-based approach that can be used to fact-check the responses of black-box models in a zero-resource fashion, i.e. without an external database. SelfCheckGPT leverages the simple idea that if an LLM has knowledge of a given concept, sampled responses are likely to be similar and contain consistent facts. However, for hallucinated facts, stochastically sampled responses are likely to diverge and contradict one another. We investigate this approach by using GPT-3 to generate passages about individuals from the WikiBio dataset, and manually annotate the factuality of the generated passages. We demonstrate that SelfCheckGPT can: i) detect non-factual and factual sentences; and ii) rank passages in terms of factuality. We compare our approach to several baselines and show that our approach has considerably higher AUC-PR scores in sentence-level hallucination detection and higher correlation scores in passage-level factuality assessment compared to grey-box methods.1
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
Large Language Models (LLMs) such as GPT-3 (Brown et al., 2020) and PaLM (Chowdhery et al., 2022) are capable of generating fluent and realistic responses to a variety of user prompts. They have been used in many applications such as automatic tools to draft reports, virtual assistants and summarization systems. Despite the convincing and realistic nature of LLM-generated texts, a growing concern with LLMs is their tendency to hallucinate facts. It has been widely observed that models can confidently generate fictitious information, and worryingly there are few, if any, existing approaches to suitably identify LLM hallucinations.
|
| 12 |
+
|
| 13 |
+

|
| 14 |
+
Figure 1: SelfCheckGPT with Prompt. Each LLM-generated sentence is compared against stochastically generated responses with no external database. A comparison method can be, for example, through LLM prompting as shown above.
|
| 15 |
+
|
| 16 |
+
A possible approach of hallucination detection is to leverage existing intrinsic uncertainty metrics to determine the parts of the output sequence that the system is least certain of (Yuan et al., 2021; Fu et al., 2023). However, uncertainty metrics such as token probability or entropy require access to token-level probability distributions, information which may not be available to users for example when systems are accessed through limited external APIs. An alternate approach is to leverage fact-verification approaches, where evidence is retrieved from an external database to assess the veracity of a claim (Thorne et al., 2018; Guo et al., 2022). However, facts can only be assessed relative to the knowledge present in the database. Additionally, hallucinations are observed over a wide range of tasks beyond pure fact verification (Kryscinski et al., 2020; Maynez et al., 2020).
|
| 17 |
+
|
| 18 |
+
In this paper, we propose SelfCheckGPT, a sampling-based approach that can detect whether responses generated by LLMs are hallucinated or factual. To the best of our knowledge, SelfCheckGPT is the first work to analyze model hallucination of general LLM responses, and is the first zero-resource hallucination detection solution that can be applied to black-box systems. The motivating idea of SelfCheckGPT is that when an LLM has been trained on a given concept, the sampled responses are likely to be similar and contain consistent facts. However, for hallucinated facts, stochastically sampled responses are likely to diverge and may contradict one another. By sampling multiple responses from an LLM, one can measure information consistency between the different responses and determine if statements are factual or hallucinated. Since SelfCheckGPT only leverages sampled responses, it has the added benefit that it can be used for black-box models, and it requires no external database. Five variants of SelfCheckGPT for measuring informational consistency are considered: BERTScore, question-answering, $n$ -gram, NLI, and LLM prompting. Through analysis of annotated articles generated by GPT-3, we show that SelfCheckGPT is a highly effective hallucination detection method that can even outperform greybox methods, and serves as a strong first baseline for an increasingly important problem of LLMs.
|
| 19 |
+
|
| 20 |
+
# 2 Background and Related Work
|
| 21 |
+
|
| 22 |
+
# 2.1 Hallucination of Large Language Models
|
| 23 |
+
|
| 24 |
+
Hallucination has been studied in text generation tasks, including summarization (Huang et al., 2021) and dialogue generation (Shuster et al., 2021), as well as in a variety of other natural language generation tasks (Ji et al., 2023). Self-consistency decoding has shown to improve chain-of-thought prompting performance on complex reasoning tasks (Wang et al., 2023). Further, Liu et al. (2022) introduce a hallucination detection dataset, however, texts are obtained by perturbing factual texts and thus may not reflect true LLM hallucination.
|
| 25 |
+
|
| 26 |
+
Recently, Azaria and Mitchell (2023) trained a multi-layer perception classifier where an LLM’s hidden representations are used as inputs to predict the truthfulness of a sentence. However, this approach is a white-box approach that uses the internal states of the LLM, which may not be available through API calls, and requires labelled data for supervised training. Another recent approach is self-evaluation (Kadavath et al., 2022), where an LLM is prompted to evaluate its previous prediction, e.g., to predict the probability that its generated response/answer is true.
|
| 27 |
+
|
| 28 |
+
# 2.2 Sequence Level Uncertainty Estimation
|
| 29 |
+
|
| 30 |
+
Token probabilities have been used as an indication of model certainty. For example, OpenAI’s GPT-3 web interface allows users to display token probabilities (as shown in Figure 2), and further uncertainty estimation approaches based on aleatoric and epistemic uncertainty have been studied for autoregressive generation (Xiao and Wang, 2021; Malinin and Gales, 2021). Additionally, conditional language model scores have been used to evaluate properties of texts (Yuan et al., 2021; Fu et al., 2023). Recently, semantic uncertainty has been proposed to address uncertainty in free-form generation tasks where probabilities are attached to concepts instead of tokens (Kuhn et al., 2023).
|
| 31 |
+
|
| 32 |
+

|
| 33 |
+
Figure 2: Example of OpenAI’s GPT-3 web interface with output token-level probabilities displayed.
|
| 34 |
+
|
| 35 |
+
# 2.3 Fact Verification
|
| 36 |
+
|
| 37 |
+
Existing fact-verification approaches follow a multi-stage pipeline of claim detection, evidence retrieval and verdict prediction (Guo et al., 2022; Zhong et al., 2020). Such methods, however, require access to external databases and can have considerable inference costs.
|
| 38 |
+
|
| 39 |
+
# 3 Grey-Box Factuality Assessment
|
| 40 |
+
|
| 41 |
+
This section will introduce methods that can be used to determine the factuality of LLM responses in a zero-resource setting when one has full access to output distributions.2 We will use ‘factual’ to define when statements are grounded in valid information, i.e. when hallucinations are avoided, and ‘zero-resource’ when no external database is used.
|
| 42 |
+
|
| 43 |
+
# 3.1 Uncertainty-based Assessment
|
| 44 |
+
|
| 45 |
+
To understand how the factuality of a generated response can be determined in a zero-resource setting, we consider LLM pre-training. During pretraining, the model is trained with next-word prediction over massive corpora of textual data. This gives the model a strong understanding of language (Jawahar et al., 2019; Raffel et al., 2020), powerful contextual reasoning (Zhang et al., 2020), as well as world knowledge (Liusie et al., 2023). Consider the input "Lionel Messi is a _". Since Messi is a world-famous athlete who may have appeared multiple times in pre-training, the LLM is likely to know who Messi is. Therefore given the context, the token "footballer" may be assigned a high probability while other professions such as "carpenter" may be considered improbable. However, for a different input such as "John Smith is a _", the system will be unsure of the continuation which may result in a flat probability distribution. During inference, this is likely to lead to a non-factual word being generated.
|
| 46 |
+
|
| 47 |
+
This insight allows us to understand the connection between uncertainty metrics and factuality. Factual sentences are likely to contain tokens with higher likelihood and lower entropy, while hallucinations are likely to come from positions with flat probability distributions with high uncertainty.
|
| 48 |
+
|
| 49 |
+
# Token-level Probability
|
| 50 |
+
|
| 51 |
+
Given the LLM’s response $R$ , let $i$ denote the $i$ -th sentence in $R , j$ denote the $j$ -th token in the $i$ -th sentence, $J$ is the number of tokens in the sentence, and $p _ { i j }$ be the probability of the word generated by the LLM at the $j$ -th token of the $i$ -th sentence. Two probability metrics are used:
|
| 52 |
+
|
| 53 |
+
$$
|
| 54 |
+
\begin{array} { l } { \displaystyle \mathrm { A v g } ( - \log p ) = - \frac { 1 } { J } \sum _ { j } \log p _ { i j } } \\ { \displaystyle \mathrm { M a x } ( - \log p ) = \operatorname* { m a x } _ { j } ( - \log p _ { i j } ) } \end{array}
|
| 55 |
+
$$
|
| 56 |
+
|
| 57 |
+
$\mathbf { M a x } ( - \log p )$ measures the sentence’s likelihood by assessing the least likely token in the sentence.
|
| 58 |
+
|
| 59 |
+
# Entropy
|
| 60 |
+
|
| 61 |
+
The entropy of the output distribution is:
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
\mathcal { H } _ { i j } = - \sum _ { \tilde { w } \in \mathcal { W } } p _ { i j } ( \tilde { w } ) \log p _ { i j } ( \tilde { w } )
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
where $p _ { i j } ( \tilde { w } )$ is the probability of the word $\tilde { w }$ being generated at the $j$ -th token of the $i$ -th sentence, and $\mathcal { W }$ is the set of all possible words in the vocabulary. Similar to the probability-based metrics, two entropy-based metrics are used:
|
| 68 |
+
|
| 69 |
+
$$
|
| 70 |
+
\operatorname { A v g } ( \mathcal { H } ) = \frac { 1 } { J } \sum _ { j } \mathcal { H } _ { i j } ; \quad \operatorname { M a x } ( \mathcal { H } ) = \operatorname* { m a x } _ { j } ( \mathcal { H } _ { i j } )
|
| 71 |
+
$$
|
| 72 |
+
|
| 73 |
+
# 4 Black-Box Factuality Assessment
|
| 74 |
+
|
| 75 |
+
A drawback of grey-box methods is that they require output token-level probabilities. Though this may seem a reasonable requirement, for massive LLMs only available through limited API calls, such token-level information may not be available (such as with ChatGPT). Therefore, we consider black-box approaches which remain applicable even when only text-based responses are available.
|
| 76 |
+
|
| 77 |
+
# Proxy LLMs
|
| 78 |
+
|
| 79 |
+
A simple approach to approximate the grey-box approaches is by using a proxy LLM, i.e. another LLM that we have full access to, such as LLaMA (Touvron et al., 2023). A proxy LLM can be used to approximate the output token-level probabilities of the black-box LLM generating the text. In the next section, we propose SelfCheckGPT, which is also a black-box approach.
|
| 80 |
+
|
| 81 |
+
# 5 SelfCheckGPT
|
| 82 |
+
|
| 83 |
+
SelfCheckGPT is our proposed black-box zeroresource hallucination detection scheme, which operates by comparing multiple sampled responses and measuring consistency.
|
| 84 |
+
|
| 85 |
+
Notation: Let $R$ refer to an LLM response drawn from a given user query. SelfCheckGPT draws a further $N$ stochastic LLM response samples $\{ S ^ { 1 } , S ^ { 2 } , . . . , S ^ { n } , . . . , S ^ { N } \}$ using the same query, and then measures the consistency between the response and the stochastic samples. We design SelfCheckGPT to predict the hallucination score of the $i$ -th sentence, $\boldsymbol { S } ( i )$ , such that $S ( i ) \in [ 0 . 0 , 1 . 0 ]$ where ${ \cal S } ( i ) 0 . 0$ if the $i$ -th sentence is grounded in valid information and ${ \cal S } ( i ) 1 . 0$ if the $i$ -th sentence is hallucinated.3 The following subsections will describe each of the SelfCheckGPT variants.
|
| 86 |
+
|
| 87 |
+
# 5.1 SelfCheckGPT with BERTScore
|
| 88 |
+
|
| 89 |
+
Let $\textstyle B ( . , . )$ denote the BERTScore between two sentences. SelfCheckGPT with BERTScore finds the average BERTScore of the $i$ -th sentence with the most similar sentence from each drawn sample:
|
| 90 |
+
|
| 91 |
+
$$
|
| 92 |
+
S _ { \mathrm { B E R T } } ( i ) = 1 - \frac { 1 } { N } \sum _ { n = 1 } ^ { N } \operatorname* { m a x } _ { k } \left( \mathcal { B } ( r _ { i } , s _ { k } ^ { n } ) \right)
|
| 93 |
+
$$
|
| 94 |
+
|
| 95 |
+
where $r _ { i }$ repr ents the $i$ -th sente e in $R$ and $s _ { k } ^ { n }$ $k$ $n$ $S ^ { n }$ This way if the information in a sentence appears in many drawn samples, one may assume that the information is factual, whereas if the statement appears in no other sample, it is likely a hallucination. In this work, RoBERTa-Large (Liu et al., 2019) is used as the backbone of BERTScore.
|
| 96 |
+
|
| 97 |
+
# 5.2 SelfCheckGPT with Question Answering
|
| 98 |
+
|
| 99 |
+
We also consider using the automatic multiplechoice question answering generation (MQAG) framework (Manakul et al., 2023) to measure consistency for SelfCheckGPT. MQAG assesses consistency by generating multiple-choice questions over the main generated response, which an independent answering system can attempt to answer while conditioned on the other sampled responses. If questions on consistent information are queried, the answering system is expected to predict similar answers. MQAG consists of two stages: question generation G and question answering A. For the sentence $r _ { i }$ in the response $R$ , we draw questions $q$ and options $\mathbf { o }$ :
|
| 100 |
+
|
| 101 |
+
$$
|
| 102 |
+
{ q , \mathbf { o } } \sim P _ { \mathtt { G } } ( q , \mathbf { o } | r _ { i } , R )
|
| 103 |
+
$$
|
| 104 |
+
|
| 105 |
+
The answering stage A selects the answers:
|
| 106 |
+
|
| 107 |
+
$\frac { N _ { \mathrm { n } } } { N _ { \mathrm { m } } + N _ { \mathrm { n } } }$ . To take into account the answerability of generated questions, we show in Appendix B that we can modify the inconsistency score by applying soft-counting, resulting in:
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
\mathcal { S } _ { \mathrm { Q A } } ( i , q ) = \frac { \gamma _ { 2 } ^ { N _ { \mathrm { n } } ^ { \prime } } } { \gamma _ { 1 } ^ { N _ { \mathrm { n } } ^ { \prime } } + \gamma _ { 2 } ^ { N _ { \mathrm { n } } ^ { \prime } } }
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
where $N _ { \mathtt { m } } ^ { \prime } =$ the effective match count, $N _ { \mathbf { n } } ^ { \prime } =$ the effective mismatch count, with $\gamma _ { 1 }$ and $\gamma _ { 2 }$ defined in Appendix B.1. Ultimately, SelfCheckGPT with QA is the average of inconsistency scores across $q$
|
| 114 |
+
|
| 115 |
+
$$
|
| 116 |
+
S _ { \mathrm { Q A } } ( i ) = \mathbb { E } _ { q } \left[ S _ { \mathrm { Q A } } ( i , q ) \right]
|
| 117 |
+
$$
|
| 118 |
+
|
| 119 |
+
# 5.3 SelfCheckGPT with n-gram
|
| 120 |
+
|
| 121 |
+
Given samples $\{ S ^ { 1 } , . . . , S ^ { N } \}$ generated by an LLM, one can use the samples to create a new language model that approximates the LLM. In the limit as $N$ gets sufficiently large, the new language model will converge to the LLM that generated the responses. We can therefore approximate the LLM’s token probabilities using the new language model.
|
| 122 |
+
|
| 123 |
+
In practice, due to time and/or cost constraints, there can only be a limited number of samples $N$ . Consequently, we train a simple $n$ -gram model using the samples $\{ S ^ { 1 } , . . . , S ^ { N } \}$ as well as the main response $R$ (which is assessed), where we note that including $R$ can be considered as a smoothing method where the count of each token in $R$ is increased by 1. We then compute the average of the log-probabilities of the sentence in response $R$ ,
|
| 124 |
+
|
| 125 |
+
$$
|
| 126 |
+
\mathcal { S } _ { n \mathrm { - g r a m } } ^ { \mathrm { A v g } } ( i ) = - \frac { 1 } { J } \sum _ { j } \log \tilde { p } _ { i j }
|
| 127 |
+
$$
|
| 128 |
+
|
| 129 |
+
where $\tilde { p } _ { i j }$ is the probability (of the $j$ -th token of the $i$ -th sentence) computed using the $n$ -gram model. Similar to the grey-box approach, we can also use the maximum of the negative log probabilities,
|
| 130 |
+
|
| 131 |
+
$$
|
| 132 |
+
\begin{array} { r } { a _ { R } = \underset { k } { \arg \operatorname* { m a x } } \left[ P _ { \mathrm { A } } ( o _ { k } | q , R , \mathbf { o } ) \right] } \\ { a _ { S ^ { n } } = \underset { k } { \arg \operatorname* { m a x } } \left[ P _ { \mathrm { A } } ( o _ { k } | q , S ^ { n } , \mathbf { o } ) \right] } \end{array}
|
| 133 |
+
$$
|
| 134 |
+
|
| 135 |
+
We compare whether $a _ { R }$ is equal to $a _ { S ^ { n } }$ for each sample in $\{ S ^ { 1 } , . . . , S ^ { N } \}$ , yielding #matches $N _ { \mathtt { m } }$ and #not-matches $N _ { \mathbf { n } }$ . A simple inconsistency score for the $i$ -th sentence and question $q$ based on the match/not-match counts is defined: $S _ { \mathrm { Q A } } ( i , q ) =$
|
| 136 |
+
|
| 137 |
+
$$
|
| 138 |
+
S _ { n \mathrm { - g r a m } } ^ { \mathrm { M a x } } ( i ) = \operatorname* { m a x } _ { j } ( - \log \tilde { p } _ { i j } )
|
| 139 |
+
$$
|
| 140 |
+
|
| 141 |
+
# 5.4 SelfCheckGPT with NLI
|
| 142 |
+
|
| 143 |
+
Natural Language Inference (NLI) determines whether a hypothesis follows a premise, classified into either entailment/neutral/contradiction. NLI measures have been used to measure faithfulness in summarization, where Maynez et al. (2020) use a textual entailment classifier trained on MNLI (Williams et al., 2018) to determine if a summary contradicts a context or not. Inspired by NLI-based summary assessment, we consider using the NLI contradiction score as a SelfCheckGPT score.
|
| 144 |
+
|
| 145 |
+
For SelfCheck-NLI, we use DeBERTa-v3-large (He et al., 2023) fine-tuned to MNLI as the NLI model. The input for NLI classifiers is typically the premise concatenated to the hypothesis, which for our methodology is the sampled passage $S ^ { n }$ concatenated to the sentence to be assessed $r _ { i }$ Only the logits associated with the ‘entailment’ and ‘contradiction’ classes are considered,
|
| 146 |
+
|
| 147 |
+
$$
|
| 148 |
+
P ( \mathrm { c o n t r a d i c t } | r _ { i } , S ^ { n } ) = \frac { \exp ( z _ { c } ) } { \exp ( z _ { e } ) + \exp ( z _ { c } ) }
|
| 149 |
+
$$
|
| 150 |
+
|
| 151 |
+
where $z _ { e }$ and $z _ { c }$ are the logits of the ‘entailment’ and ‘contradiction’ classes, respectively. This normalization ignores the neutral class and ensures that the probability is bounded between 0.0 and 1.0. The SelfCheckGPT with NLI score for each sample $S ^ { n }$ is then defined as,
|
| 152 |
+
|
| 153 |
+
$$
|
| 154 |
+
\mathcal { S } _ { \mathrm { N L I } } ( i ) = \frac { 1 } { N } \sum _ { n = 1 } ^ { N } P ( \mathrm { c o n t r a d i c t } | r _ { i } , S ^ { n } )
|
| 155 |
+
$$
|
| 156 |
+
|
| 157 |
+
# 5.5 SelfCheckGPT with Prompt
|
| 158 |
+
|
| 159 |
+
LLMs have recently been shown to be effective in assessing information consistency between a document and its summary in zero-shot settings (Luo et al., 2023). Thus, we query an LLM to assess whether the $i$ -th sentence is supported by sample $S ^ { n }$ (as the context) using the following prompt.
|
| 160 |
+
|
| 161 |
+
Context: {}
|
| 162 |
+
Sentence: {}
|
| 163 |
+
Is the sentence supported by the context above?
|
| 164 |
+
Answer Yes or No:
|
| 165 |
+
|
| 166 |
+
Initial investigation showed that GPT-3 (textdavinci-003) will output either Yes or $N o 9 8 \%$ of the time, while any remaining outputs can be set to N/A. The output from prompting when comparing the $i$ -th sentence against sample $S ^ { n }$ is converted to score $\boldsymbol { x } _ { i } ^ { n }$ through the mapping {Yes: 0.0, No: 1.0, N/A: 0.5}. The final inconsistency score is then calculated as:
|
| 167 |
+
|
| 168 |
+
$$
|
| 169 |
+
S _ { \mathrm { { P r o m p t } } } ( i ) = \frac { 1 } { N } \sum _ { n = 1 } ^ { N } x _ { i } ^ { n }
|
| 170 |
+
$$
|
| 171 |
+
|
| 172 |
+
SelfCheckGPT-Prompt is illustrated in Figure 1. Note that our initial investigations found that less capable models such as GPT-3 (text-curie-001) or LLaMA failed to effectively perform consistency assessment via such prompting.
|
| 173 |
+
|
| 174 |
+
# 6 Data and Annotation
|
| 175 |
+
|
| 176 |
+
As, currently, there are no standard hallucination detection datasets available, we evaluate our hallucination detection approaches by 1) generating synthetic Wikipedia articles using GPT-3 on the individuals/concepts from the WikiBio dataset (Lebret et al., 2016); 2) manually annotating the factuality of the passage at a sentence level; 3) evaluating the system’s ability to detect hallucinations.
|
| 177 |
+
|
| 178 |
+
WikiBio is a dataset where each input contains the first paragraph (along with tabular information) of Wikipedia articles of a specific concept. We rank the WikiBio test set in terms of paragraph length and randomly sample 238 articles from the top $20 \%$ of longest articles (to ensure no very obscure concept is selected). GPT-3 (text-davinci-003) is then used to generate Wikipedia articles on a concept, using the prompt "This is a Wikipedia passage about {concept}:". Table 1 provides the statistics of GPT-3 generated passages.
|
| 179 |
+
|
| 180 |
+
Table 1: The statistics of WikiBio GPT-3 dataset where the number of tokens is based on the OpenAI GPT-2 tokenizer.
|
| 181 |
+
|
| 182 |
+
<table><tr><td>#Passages</td><td>#Sentences</td><td>#Tokens/passage</td></tr><tr><td>238</td><td>1908</td><td>184.7±36.9</td></tr></table>
|
| 183 |
+
|
| 184 |
+
We then annotate the sentences of the generated passages using the guidelines shown in Figure 3 such that each sentence is classified as either:
|
| 185 |
+
|
| 186 |
+
• Major Inaccurate (Non-Factual, 1): The sentence is entirely hallucinated, i.e. the sentence is unrelated to the topic.
|
| 187 |
+
|
| 188 |
+
• Minor Inaccurate (Non-Factual, 0.5): The sentence consists of some non-factual information, but the sentence is related to the topic.
|
| 189 |
+
|
| 190 |
+
• Accurate (Factual, 0): The information presented in the sentence is accurate.
|
| 191 |
+
|
| 192 |
+
Of the 1908 annotated sentences, 761 $( 3 9 . 9 \% )$ of the sentences were labelled major-inaccurate, 631 $( 3 3 . 1 \% )$ minor-inaccurate, and 516 $( 2 7 . 0 \% )$ accurate. 201 sentences in the dataset had annotations from two different annotators. To obtain a single label for this subset, if both annotators agree, then the agreed label is used. However, if there is disagreement, then the worse-case label is selected (e.g., {minor inaccurate, major inaccurate} is mapped to major inaccurate). The inter-annotator agreement, as measured by Cohen’s $\kappa$ (Cohen, 1960), has $\kappa$ values of 0.595 and 0.748, indicating moderate and substantial agreement (Viera et al., 2005) for the 3-class and 2-class scenarios, respectively.4
|
| 193 |
+
|
| 194 |
+

|
| 195 |
+
Figure 3: Flowchart of our annotation process
|
| 196 |
+
|
| 197 |
+
Furthermore, passage-level scores are obtained by averaging the sentence-level labels in each passage. The distribution of passage-level scores is shown in Figure 4, where we observe a large peak at $+ 1 . 0$ . We refer to the points at this peak as total hallucination, which occurs when the information of the response is unrelated to the real concept and is entirely fabricated by the LLM.
|
| 198 |
+
|
| 199 |
+

|
| 200 |
+
Figure 4: Document factuality scores histogram plot
|
| 201 |
+
|
| 202 |
+
# 7 Experiments
|
| 203 |
+
|
| 204 |
+
The generative LLM used to generate passages for our dataset is GPT-3 (text-davinci-003), the stateof-the-art system at the time of creating and annotating the dataset. To obtain the main response, we set the temperature to 0.0 and use standard beam search decoding. For the stochastically generated samples, we set the temperature to 1.0 and generate
|
| 205 |
+
|
| 206 |
+
$N { = } 2 0$ samples. For the proxy LLM approach, we use LLaMA (Touvron et al., 2023), one of the bestperforming open-source LLMs currently available. For SelfCheckGPT-Prompt, we consider both GPT3 (which is the same LLM that is used to generate passages) as well as the newly released ChatGPT (gpt-3.5-turbo). More details about the systems in SelfCheckGPT and results using other proxy LLMs can be found in the appendix.
|
| 207 |
+
|
| 208 |
+
# 7.1 Sentence-level Hallucination Detection
|
| 209 |
+
|
| 210 |
+
First, we investigate whether our hallucination detection methods can identify the factuality of sentences. In detecting non-factual sentences, both major-inaccurate labels and minor-inaccurate labels are grouped together into the non-factual class, while the factual class refers to accurate sentences. In addition, we consider a more challenging task of detecting major-inaccurate sentences in passages that are not total hallucination passages, which we refer to as non-factual∗.5 Figure 5 and Table 2 show the performance of our approaches, where the following observations can be made:
|
| 211 |
+
|
| 212 |
+
1) LLM’s probabilities $p$ correlate well with factuality. Our results show that probability measures (from the LLM generating the texts) are strong baselines for assessing factuality. Factual sentences can be identified with an AUC-PR of 53.97, significantly better than the random baseline of 27.04, with the AUC-PR for hallucination detection also increasing from 72.96 to 83.21. This supports the hypothesis that when the LLMs are uncertain about generated information, generated tokens often have higher uncertainty, paving a promising direction for hallucination detection approaches. Also, the probability $p$ measure performs better than the entropy $\mathcal { H }$ measure of top-5 tokens.
|
| 213 |
+
|
| 214 |
+
2) Proxy LLM perform noticeably worse than LLM (GPT-3). The results of proxy LLM (based on LLaMA) show that the entropy $\mathcal { H }$ measures outperform the probability measures. This suggests that using richer uncertainty information can improve factuality/hallucination detection performance, and that previously the entropy of top-5 tokens is likely to be insufficient. In addition, when using other proxy LLMs such as GPT-NeoX or OPT-30B, the performance is near that of the random baseline. We believe this poor performance occurs as different LLMs have different generating patterns, and so even common tokens may have a low probability in situations where the response is dissimilar to the generation style of the proxy LLM. We note that a weighted conditional LM score such as BARTScore (Yuan et al., 2021) could be incorporated in future investigations.
|
| 215 |
+
|
| 216 |
+

|
| 217 |
+
|
| 218 |
+
Figure 5: PR-Curve of detecting non-factual and factual sentences in the GPT-3 generated WikiBio passages.
|
| 219 |
+
Table 2: AUC-PR for sentence-level detection tasks. Passage-level ranking performances are measured by Pearson correlation coefficient and Spearman’s rank correlation coefficient w.r.t. human judgements. The results of other proxy LLMs, in addition to LLaMA, can be found in the appendix. †GPT-3 API returns the top-5 tokens’ probabilities, which are used to compute entropy.
|
| 220 |
+
|
| 221 |
+
<table><tr><td rowspan="2">Method</td><td colspan="3">Sentence-level (AUC-PR)</td><td rowspan="2">Passage-level (Corr.) Pearson Spearman</td></tr><tr><td>NonFact</td><td>NonFact*</td><td>Factual</td></tr><tr><td>Random</td><td>72.96</td><td>29.72</td><td>27.04</td><td></td></tr><tr><td colspan="5"> GPT-3 (text-davinci-003)'s probabilities (LLM, grey-box)</td></tr><tr><td>Avg(-logp)</td><td>83.21</td><td>38.89 53.97</td><td>57.04</td><td>53.93</td></tr><tr><td>Avg(H)t</td><td>80.73</td><td>37.09</td><td>52.07 55.52</td><td>50.87</td></tr><tr><td>Max(-logp)</td><td>87.51</td><td>35.88</td><td>50.46 57.83</td><td>55.69</td></tr><tr><td>Max(H)t</td><td>85.75</td><td>32.43</td><td>50.27 52.48</td><td>49.55</td></tr><tr><td colspan="5"> LLaMA-30B's probabilities (Proxy LLM, black-box)</td></tr><tr><td>Avg(-logp)</td><td>75.43</td><td>30.32 41.29</td><td>21.72</td><td>20.20</td></tr><tr><td>Avg(H)</td><td>80.80</td><td>39.01</td><td>42.97 33.80</td><td>39.49</td></tr><tr><td>Max(-logp)</td><td>74.01</td><td>27.14 31.08</td><td>-22.83</td><td>-22.71</td></tr><tr><td>Max(H)</td><td>80.92</td><td>37.32 37.90</td><td>35.57</td><td>38.94</td></tr><tr><td colspan="5"> SelfCheckGPT (black-box)</td></tr><tr><td>w/BERTScore</td><td>81.96</td><td>45.96</td><td>44.23</td><td>58.18</td><td>55.90</td></tr><tr><td>w/ QA</td><td>84.26</td><td>40.06</td><td>48.14</td><td>61.07</td><td>59.29</td></tr><tr><td>w/ Unigram (max)</td><td>85.63</td><td>41.04</td><td>58.47</td><td>64.71</td><td>64.91</td></tr><tr><td>w/ NLI</td><td>92.50</td><td>45.17</td><td>66.08</td><td>74.14</td><td>73.78</td></tr><tr><td>w/ Prompt</td><td>93.42</td><td>53.19</td><td>67.09</td><td>78.32</td><td>78.30</td></tr></table>
|
| 222 |
+
|
| 223 |
+
3) SelfCheckGPT outperforms grey-box approaches. It can be seen that SelfCheckGPTPrompt considerably outperforms the grey-box approaches (including GPT-3’s output probabilities) as well as other black-box approaches. Even other variants of SelfCheckGPT, including BERTScore, QA, and $n$ -gram, outperform the grey-box approaches in most setups. Interestingly, despite being the least computationally expensive method, SelfCheckGPT with unigram (max) works well across different setups. Essentially, when assessing a sentence, this method picks up the token with the lowest occurrence given all the samples. This suggests that if a token only appears a few times (or once) within the generated samples $( N { = } 2 0 )$ ), it is likely non-factual.
|
| 224 |
+
|
| 225 |
+
4) SelfCheckGPT with $n$ -gram. When investigating the $n$ -gram performance from 1-gram to 5-gram, the results show that simply finding the least likely token/n-gram is more effective than computing the average $n$ -gram score of the sentence, details in appendix Table 7. Additionally, as $n$ increases, the performance of SelfCheckGPT with $n$ -gram (max) drops.
|
| 226 |
+
|
| 227 |
+
5) SelfCheckGPT with NLI. The NLI-based method outperforms all black-box and grey-box baselines, and its performance is close to the performance of the Prompt method. As SelfCheckGPT with Prompt can be computationally heavy, SelfCheckGPT with NLI could be the most practical method as it provides a good trade-off between performance and computation.
|
| 228 |
+
|
| 229 |
+

|
| 230 |
+
Figure 6: Scatter plot of passage-level scores where Y-axis $=$ Method scores, X-axis $=$ Human scores. Correlations are reported in Table 2. The scatter plots of other SelfCheckGPT variants are provided in Figure 10 in the appendix.
|
| 231 |
+
|
| 232 |
+
# 7.2 Passage-level Factuality Ranking
|
| 233 |
+
|
| 234 |
+
Previous results demonstrate that SelfCheckGPT is an effective approach for predicting sentencelevel factuality. An additional consideration is whether SelfCheckGPT can also be used to determine the overall factuality of passages. Passagelevel factuality scores are calculated by averaging the sentence-level scores over all sentences.
|
| 235 |
+
|
| 236 |
+
$$
|
| 237 |
+
S _ { \mathrm { p a s s a g e } } = { \frac { 1 } { | R | } } \sum _ { i } S ( i )
|
| 238 |
+
$$
|
| 239 |
+
|
| 240 |
+
where $s ( i )$ is the sentence-level score, and $| R |$ is the number of sentences in the passage. Since human judgement is somewhat subjective, averaging the sentence-level labels would lead to ground truths with less noise. Note that for $\operatorname { A v g } ( - \log p )$ and $\operatorname { A v g } ( { \mathcal { H } } )$ , we compute the average over all tokens in a passage. Whereas for $\mathbf { M a x } ( - \log p )$ and $\operatorname { M a x } ( \mathcal { H } )$ , we first take the maximum operation over tokens at the sentence level, and we then average over all sentences following Equation 12.
|
| 241 |
+
|
| 242 |
+
Our results in Table 2 and Figure 6 show that all SelfCheckGPT methods correlate far better with human judgements than the other baselines, including the grey-box probability and entropy methods. SelfCheckGPT-Prompt is the best-performing method, achieving the highest Pearson correlation of 78.32. Unsurprisingly, the proxy LLM approach again achieves considerably lower correlations.
|
| 243 |
+
|
| 244 |
+
# 7.3 Ablation Studies
|
| 245 |
+
|
| 246 |
+
# External Knowledge (instead of SelfCheck)
|
| 247 |
+
|
| 248 |
+
If external knowledge is available, one can measure the informational consistency between the LLM response and the information source. In this experiment, we use the first paragraph of each concept that is available in WikiBio.6
|
| 249 |
+
|
| 250 |
+
Table 3: The performance when using SelfCheckGPT samples versus external stored knowledge.
|
| 251 |
+
|
| 252 |
+
<table><tr><td>Method</td><td>Sent-lvl AUC-PR NoFac NoFac*</td><td></td><td>Fact</td><td>Passage-lvl Pear. Spear.</td></tr><tr><td>SelfCk-BERT</td><td>81.96</td><td>45.96</td><td>44.23</td><td>58.18 55.90</td></tr><tr><td>WikiBio+BERT</td><td>81.32</td><td>40.62</td><td>49.15</td><td>58.71 55.80</td></tr><tr><td>SelfCk-QA</td><td>84.26</td><td>40.06</td><td>48.14</td><td>61.07 59.29</td></tr><tr><td>WikiBio+QA</td><td>84.18</td><td>45.40</td><td>52.03</td><td>57.26 53.62</td></tr><tr><td>SelfCk-1gm</td><td>85.63</td><td>41.04</td><td>58.47</td><td>64.71 64.91</td></tr><tr><td>WikiBio+1gm</td><td>80.43</td><td>31.47</td><td>40.53</td><td>28.67 26.70</td></tr><tr><td>SelfCk-NLI</td><td>92.50</td><td>45.17</td><td>66.08</td><td>74.14 73.78</td></tr><tr><td>WikiBio+NLI</td><td>91.18</td><td>48.14</td><td>71.61</td><td>78.84 80.00</td></tr><tr><td>SelfCk-Prompt</td><td>93.42</td><td>53.19</td><td>67.09</td><td>78.30</td></tr><tr><td>WikiBio+Prompt</td><td>93.59</td><td>65.26</td><td>73.11</td><td>78.32 85.90 86.11</td></tr></table>
|
| 253 |
+
|
| 254 |
+
Our findings in Table 3 show the following. First, SelfCheckGPT with BERTScore/QA, using selfsamples, can yield comparable or even better performance than when using the reference passage. Second, SelfCheckGPT with $n$ -gram shows a large performance drop when using the WikiBio passages instead of self-samples. This failure is attributed to the fact that the WikiBio reference text alone is not sufficient to train an $n$ -gram model. Third, in contrast, SelfCheckGPT with NLI/Prompt can benefit considerably when access to retrieved information is available. Nevertheless, in practice, it is infeasible to have an external database for every possible use case of LLM generation.
|
| 255 |
+
|
| 256 |
+
# The Impact of the Number of Samples
|
| 257 |
+
|
| 258 |
+
Although sample-based methods are expected to perform better when more samples are drawn, this has higher computational costs. Thus, we investigate performance as the number of samples is varied. Our results in Figure 7 show that the performance of SelfCheckGPT increases smoothly as more samples are used, with diminishing gains as more samples are generated. SelfCheckGPT with $n$ -gram requires the highest number of samples before its performance reaches a plateau.
|
| 259 |
+
|
| 260 |
+

|
| 261 |
+
Figure 7: The performance of SelfCheckGPT methods on ranking passages (Spearman’s) versus the number of samples.
|
| 262 |
+
|
| 263 |
+
# The Choice of LLM for SelfCheckGPT-Prompt
|
| 264 |
+
|
| 265 |
+
We investigate whether the LLM generating the text can self-check its own text. We conduct this ablation using a reduced set of the samples $( N { = } 4 )$
|
| 266 |
+
|
| 267 |
+
Table 4: Comparison of GPT-3 (text-davinci-003) and ChatGPT (gpt-3.5.turbo) as the prompt-based text evaluator in SelfCheckGPT-Prompt. †Taken from Table 2 for comparison.
|
| 268 |
+
|
| 269 |
+
<table><tr><td>Text-Gen</td><td>SelfCk-Prompt</td><td>N</td><td>Pear.</td><td>Spear.</td></tr><tr><td>GPT-3</td><td>ChatGPT</td><td>20</td><td>78.32</td><td>78.30</td></tr><tr><td>GPT-3</td><td>ChatGPT</td><td>4</td><td>76.47</td><td>76.41</td></tr><tr><td>GPT-3</td><td>GPT-3</td><td>4</td><td>73.11</td><td>74.69</td></tr><tr><td colspan="2">+ SelfCheck w/ unigram (max)</td><td>20</td><td>64.71</td><td>64.91</td></tr><tr><td colspan="2">+ SelfCheck w/ NLI</td><td>20</td><td>74.14</td><td>73.78</td></tr></table>
|
| 270 |
+
|
| 271 |
+
The results in Table 4 show that GPT-3 can selfcheck its own text, and is better than the unigram method even when using only 4 samples. However, ChatGPT shows a slight improvement over GPT-3 in evaluating whether the sentence is supported by the context. More details are in Appendix C.
|
| 272 |
+
|
| 273 |
+
# 8 Conclusions
|
| 274 |
+
|
| 275 |
+
This paper is the first work to consider the task of hallucination detection for general large language model responses. We propose SelfCheckGPT, a zero-resource approach that is applicable to any black-box LLM without the need for external resources, and demonstrate the efficacy of our method. SelfCheckGPT outperforms a range of considered grey-box and black-box baseline detection methods at both the sentence and passage levels, and we further release an annotated dataset for GPT-3 hallucination detection with sentencelevel factuality labels.
|
| 276 |
+
|
| 277 |
+
# Limitations
|
| 278 |
+
|
| 279 |
+
In this study, the 238 GPT-3 generated texts were predominantly passages about individuals in the WikiBio dataset. To further investigate the nature of LLM’s hallucination, this study could be extended to a wider range of concepts, e.g., to also consider generated texts about locations and objects. Further, this work considers factuality at the sentence level, but we note that a single sentence may consist of both factual and non-factual information. For example, the following work by Min et al. (2023) considers a fine-grained factuality evaluation by decomposing sentences into atomic facts. Finally, SelfCheckGPT with Prompt, which was convincingly the best selfcheck method, is quite computationally heavy. This might lead to impractical computational costs, which could be addressed in future work to be made more efficient.
|
| 280 |
+
|
| 281 |
+
# Ethics Statement
|
| 282 |
+
|
| 283 |
+
As this work addresses the issue of LLM’s hallucination, we note that if hallucinated contents are not detected, they could lead to misinformation.
|
| 284 |
+
|
| 285 |
+
# Acknowledgments
|
| 286 |
+
|
| 287 |
+
This work is supported by Cambridge University Press & Assessment (CUP&A), a department of The Chancellor, Masters, and Scholars of the University of Cambridge, and the Cambridge Commonwealth, European & International Trust. We would like to thank the anonymous reviewers for their helpful comments.
|
| 288 |
+
|
| 289 |
+
# References
|
| 290 |
+
|
| 291 |
+
Amos Azaria and Tom Mitchell. 2023. The internal state of an llm knows when its lying. arXiv preprint arXiv:2304.13734.
|
| 292 |
+
|
| 293 |
+
Iz Beltagy, Matthew E. Peters, and Arman Cohan. 2020. Longformer: The long-document transformer.
|
| 294 |
+
|
| 295 |
+
Sidney Black, Stella Biderman, Eric Hallahan, Quentin Anthony, Leo Gao, Laurence Golding, Horace He, Connor Leahy, Kyle McDonell, Jason Phang, Michael Pieler, Usvsn Sai Prashanth, Shivanshu Purohit, Laria Reynolds, Jonathan Tow, Ben Wang, and Samuel Weinbach. 2022. GPT-NeoX-20B: An opensource autoregressive language model. In Proceedings of BigScience Episode #5 – Workshop on Challenges & Perspectives in Creating Large Language Models, pages 95–136, virtual+Dublin. Association for Computational Linguistics.
|
| 296 |
+
|
| 297 |
+
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.
|
| 298 |
+
|
| 299 |
+
Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. 2022. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311.
|
| 300 |
+
|
| 301 |
+
Jacob Cohen. 1960. A coefficient of agreement for nominal scales. Educational and Psychological Measurement, 20:37 – 46.
|
| 302 |
+
|
| 303 |
+
Jinlan Fu, See-Kiong Ng, Zhengbao Jiang, and Pengfei Liu. 2023. Gptscore: Evaluate as you desire.
|
| 304 |
+
|
| 305 |
+
Zhijiang Guo, Michael Schlichtkrull, and Andreas Vlachos. 2022. A survey on automated fact-checking. Transactions of the Association for Computational Linguistics, 10:178–206.
|
| 306 |
+
|
| 307 |
+
Pengcheng He, Jianfeng Gao, and Weizhu Chen. 2023. DeBERTav3: Improving deBERTa using ELECTRAstyle pre-training with gradient-disentangled embedding sharing. In The Eleventh International Conference on Learning Representations.
|
| 308 |
+
|
| 309 |
+
Yichong Huang, Xiachong Feng, Xiaocheng Feng, and Bing Qin. 2021. The factual inconsistency problem in abstractive text summarization: A survey.
|
| 310 |
+
|
| 311 |
+
Ganesh Jawahar, Benoît Sagot, and Djamé Seddah. 2019. What does BERT learn about the structure of language? In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 3651–3657, Florence, Italy. Association for Computational Linguistics.
|
| 312 |
+
|
| 313 |
+
Ziwei Ji, Nayeon Lee, Rita Frieske, Tiezheng Yu, Dan Su, Yan Xu, Etsuko Ishii, Ye Jin Bang, Andrea
|
| 314 |
+
|
| 315 |
+
Madotto, and Pascale Fung. 2023. Survey of hallucination in natural language generation. ACM Comput. Surv., 55(12).
|
| 316 |
+
|
| 317 |
+
Saurav Kadavath, Tom Conerly, Amanda Askell, Tom Henighan, Dawn Drain, Ethan Perez, Nicholas Schiefer, Zac Hatfield Dodds, Nova DasSarma, Eli Tran-Johnson, et al. 2022. Language models (mostly) know what they know. arXiv preprint arXiv:2207.05221.
|
| 318 |
+
|
| 319 |
+
Wojciech Kryscinski, Bryan McCann, Caiming Xiong, and Richard Socher. 2020. Evaluating the factual consistency of abstractive text summarization. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 9332–9346, Online. Association for Computational Linguistics.
|
| 320 |
+
|
| 321 |
+
Lorenz Kuhn, Yarin Gal, and Sebastian Farquhar. 2023. Semantic uncertainty: Linguistic invariances for uncertainty estimation in natural language generation. In The Eleventh International Conference on Learning Representations.
|
| 322 |
+
|
| 323 |
+
Guokun Lai, Qizhe Xie, Hanxiao Liu, Yiming Yang, and Eduard Hovy. 2017. RACE: Large-scale ReAding comprehension dataset from examinations. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 785– 794, Copenhagen, Denmark. Association for Computational Linguistics.
|
| 324 |
+
|
| 325 |
+
Rémi Lebret, David Grangier, and Michael Auli. 2016. Generating text from structured data with application to the biography domain. CoRR, abs/1603.07771.
|
| 326 |
+
|
| 327 |
+
Tianyu Liu, Yizhe Zhang, Chris Brockett, Yi Mao, Zhifang Sui, Weizhu Chen, and Bill Dolan. 2022. A token-level reference-free hallucination detection benchmark for free-form text generation. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 6723–6737, Dublin, Ireland. Association for Computational Linguistics.
|
| 328 |
+
|
| 329 |
+
Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. 2019. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692.
|
| 330 |
+
|
| 331 |
+
Adian Liusie, Vatsal Raina, and Mark Gales. 2023. “world knowledge” in multiple choice reading comprehension. In Proceedings of the Sixth Fact Extraction and VERification Workshop (FEVER), pages 49–57, Dubrovnik, Croatia. Association for Computational Linguistics.
|
| 332 |
+
|
| 333 |
+
Zheheng Luo, Qianqian Xie, and Sophia Ananiadou. 2023. Chatgpt as a factual inconsistency evaluator for abstractive text summarization. arXiv preprint arXiv:2303.15621.
|
| 334 |
+
|
| 335 |
+
Andrey Malinin and Mark Gales. 2021. Uncertainty estimation in autoregressive structured prediction. In International Conference on Learning Representations.
|
| 336 |
+
|
| 337 |
+
Potsawee Manakul, Adian Liusie, and Mark JF Gales. 2023. MQAG: Multiple-choice question answering and generation for assessing information consistency in summarization. arXiv preprint arXiv:2301.12307.
|
| 338 |
+
|
| 339 |
+
Joshua Maynez, Shashi Narayan, Bernd Bohnet, and Ryan McDonald. 2020. On faithfulness and factuality in abstractive summarization. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 1906–1919, Online. Association for Computational Linguistics.
|
| 340 |
+
|
| 341 |
+
Sewon Min, Kalpesh Krishna, Xinxi Lyu, Mike Lewis, Wen-tau Yih, Pang Wei Koh, Mohit Iyyer, Luke Zettlemoyer, and Hannaneh Hajishirzi. 2023. Factscore: Fine-grained atomic evaluation of factual precision in long form text generation. arXiv preprint arXiv:2305.14251.
|
| 342 |
+
|
| 343 |
+
Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text transformer. The Journal of Machine Learning Research, 21(1):5485–5551.
|
| 344 |
+
|
| 345 |
+
Vatsal Raina and Mark Gales. 2022. Answer uncertainty and unanswerability in multiple-choice machine reading comprehension. In Findings of the Association for Computational Linguistics: ACL 2022, pages 1020–1034, Dublin, Ireland. Association for Computational Linguistics.
|
| 346 |
+
|
| 347 |
+
Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. 2016. 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. Association for Computational Linguistics.
|
| 348 |
+
|
| 349 |
+
Kurt Shuster, Spencer Poff, Moya Chen, Douwe Kiela, and Jason Weston. 2021. Retrieval augmentation reduces hallucination in conversation. In Findings of the Association for Computational Linguistics: EMNLP 2021, pages 3784–3803, Punta Cana, Dominican Republic. Association for Computational Linguistics.
|
| 350 |
+
|
| 351 |
+
James Thorne, Andreas Vlachos, Oana Cocarascu, Christos Christodoulopoulos, and Arpit Mittal. 2018. The Fact Extraction and VERification (FEVER) shared task. In Proceedings of the First Workshop on Fact Extraction and VERification (FEVER).
|
| 352 |
+
|
| 353 |
+
Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. 2023. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971.
|
| 354 |
+
|
| 355 |
+
Anthony J Viera, Joanne M Garrett, et al. 2005. Understanding interobserver agreement: the kappa statistic. Fam med, 37(5):360–363.
|
| 356 |
+
|
| 357 |
+
Ben Wang and Aran Komatsuzaki. 2021. GPT-J6B: A 6 Billion Parameter Autoregressive Language Model. https://github.com/kingoflolz/ mesh-transformer-jax.
|
| 358 |
+
|
| 359 |
+
Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc V Le, Ed H. Chi, Sharan Narang, Aakanksha Chowdhery, and Denny Zhou. 2023. Self-consistency improves chain of thought reasoning in language models. In The Eleventh International Conference on Learning Representations.
|
| 360 |
+
|
| 361 |
+
Adina Williams, Nikita Nangia, and Samuel Bowman. 2018. 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. Association for Computational Linguistics.
|
| 362 |
+
|
| 363 |
+
Yijun Xiao and William Yang Wang. 2021. On hallucination and predictive uncertainty in conditional language generation. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, pages 2734–2744, Online. Association for Computational Linguistics.
|
| 364 |
+
|
| 365 |
+
Weizhe Yuan, Graham Neubig, and Pengfei Liu. 2021. Bartscore: Evaluating generated text as text generation. Advances in Neural Information Processing Systems, 34:27263–27277.
|
| 366 |
+
|
| 367 |
+
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.
|
| 368 |
+
|
| 369 |
+
Zhuosheng Zhang, Yuwei Wu, Hai Zhao, Zuchao Li, Shuailiang Zhang, Xi Zhou, and Xiang Zhou. 2020. Semantics-aware bert for language understanding. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 9628–9635.
|
| 370 |
+
|
| 371 |
+
Wanjun Zhong, Jingjing Xu, Duyu Tang, Zenan Xu, Nan Duan, Ming Zhou, Jiahai Wang, and Jian Yin. 2020. Reasoning over semantic-level graph for fact checking. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 6170–6180, Online. Association for Computational Linguistics.
|
| 372 |
+
|
| 373 |
+
# A Models and Implementation
|
| 374 |
+
|
| 375 |
+
# A.1 Entropy
|
| 376 |
+
|
| 377 |
+
The entropy of the output distribution is implemented as follows,
|
| 378 |
+
|
| 379 |
+
$$
|
| 380 |
+
\begin{array} { r } { \mathcal { H } _ { i j } = 2 ^ { - \sum _ { \tilde { w } \in \mathcal { W } } p _ { i j } \left( \tilde { w } \right) \log _ { 2 } p _ { i j } \left( \tilde { w } \right) } } \end{array}
|
| 381 |
+
$$
|
| 382 |
+
|
| 383 |
+
where $\mathcal { W }$ is the set of all possible words in the vocabulary.
|
| 384 |
+
|
| 385 |
+
# A.2 Proxy LLMs
|
| 386 |
+
|
| 387 |
+
The proxy LLMs considered are LLaMA-{7B, 13B, 30B} (Touvron et al., 2023), OPT- $\{ 1 2 5 \mathrm { m }$ , 1.3B, 13B, 30B} (Zhang et al., 2022), GPT-J-6B (Wang and Komatsuzaki, 2021) and GPT-NeoX20B (Black et al., 2022).
|
| 388 |
+
|
| 389 |
+
# A.3 SelfCheckGPT’s Systems
|
| 390 |
+
|
| 391 |
+
Question Answering: The generation systems G1 and G2 are T5-Large fine-tuned to SQuAD (Rajpurkar et al., 2016) and RACE (Lai et al., 2017), respectively. The answering system A is Longformer (Beltagy et al., 2020) fine-tuned to the RACE dataset. The answerability system U is also Longformer, but fine-tuned to SQuAD2.0.
|
| 392 |
+
|
| 393 |
+
LLM for Prompting: We consider two LLMs, GPT-3 (text-davinci-003) and ChatGPT (gpt-3.5- turbo) We note that during the data creation and annotation, GPT-3 (text-davinci-003) was the stateof-the-art LLM available; hence, GPT-3 was used as the main LLM generating WikiBio passages.
|
| 394 |
+
|
| 395 |
+
# B SelfCheckGPT with QA
|
| 396 |
+
|
| 397 |
+
Previous work showed that implementing question generation (in Equation 2) with two generators (G1 generates the question and associated answer, and G2 generates distractors) yields higher-quality distractors (Manakul et al., 2023). Thus, a two-stage generation is adopted in this work as follows:
|
| 398 |
+
|
| 399 |
+
$$
|
| 400 |
+
q , a \sim P _ { \mathtt { G 1 } } ( q , a | r _ { i } ) ; \bullet _ { \mathtt { V } _ { a } } \sim P _ { \mathtt { G 2 } } ( \mathbf { o } _ { \backslash a } | q , a , R )
|
| 401 |
+
$$
|
| 402 |
+
|
| 403 |
+
where $\mathbf { o } = \{ a , \mathbf { o } _ { \backslash a } \} = \{ o _ { 1 } , . . . , o _ { 4 } \}$ . In addition, to filter out bad (unanswerable) questions, we define an answerability score (Raina and Gales, 2022):
|
| 404 |
+
|
| 405 |
+
$$
|
| 406 |
+
\alpha = P _ { \mathrm { U } } ( { \mathrm { a n s w e r a b l e } } | q , { \mathrm { c o n t e x t } } )
|
| 407 |
+
$$
|
| 408 |
+
|
| 409 |
+
where the context is either the response $R$ or sampled passages $S ^ { n }$ , and $\alpha 0 . 0$ for unanswerable and $\alpha 1 . 0$ for answerable. We use $\alpha$ to filter out unanswerable questions which have $\alpha$ lower than a threshold. Next, we derive how Bayes’ theorem can be applied to take into account the number of answerable/unanswerable questions.
|
| 410 |
+
|
| 411 |
+
# B.1 SelfCheckGPT-QA with Bayes
|
| 412 |
+
|
| 413 |
+
Let $P ( \mathrm { F } )$ denote the probability of the $i$ -th sentence being non-factual, and $P ( \mathrm { T } )$ denote the probability of the $i$ -th sentence being factual. For a question $q$ the probability of $i$ -th sentence being non-factual given a set of matched answers $L _ { \mathtt { m } }$ and a set of not-matched answers $L _ { \mathtt { n } }$ is:
|
| 414 |
+
|
| 415 |
+
$$
|
| 416 |
+
\begin{array} { r l r } { { P ( \mathrm { F } | L _ { \mathfrak { n } } , L _ { \mathfrak { n } } ) } } \\ & { = \frac { P ( L _ { \mathfrak { n } } , L _ { \mathfrak { n } } | \mathrm { F } ) P ( \mathrm { F } ) } { P ( L _ { \mathfrak { n } } , L _ { \mathfrak { n } } | \mathrm { F } ) P ( \mathrm { F } ) + P ( L _ { \mathfrak { n } } , L _ { \mathfrak { n } } | \mathrm { T } ) P ( \mathrm { T } ) } } \\ & { = \frac { P ( L _ { \mathfrak { n } } , L _ { \mathfrak { n } } | \mathrm { F } ) } { P ( L _ { \mathfrak { n } } , L _ { \mathfrak { n } } | \mathrm { F } ) + P ( L _ { \mathfrak { n } } , L _ { \mathfrak { n } } | \mathrm { T } ) } } & \end{array}
|
| 417 |
+
$$
|
| 418 |
+
|
| 419 |
+
where we assume the sentence is equally likely to be False or True, i.e. $P ( \mathbf { F } ) = P ( \mathbf { T } )$ . The probability of observing $L _ { \mathtt { m } } , L _ { \mathtt { n } }$ when the sentence is False (non-factual):
|
| 420 |
+
|
| 421 |
+
$$
|
| 422 |
+
\begin{array} { l } { { \displaystyle P ( L _ { \mathfrak { n } } , L _ { \mathfrak { n } } | \mathrm { F } ) } } \\ { { \displaystyle ~ = \prod _ { a \in L _ { \mathfrak { n } } } P ( a = a _ { R } | F ) \prod _ { a ^ { \prime } \in L _ { \mathfrak { n } } } P ( a ^ { \prime } \neq a _ { R } | F ) } } \\ { { \displaystyle ~ = ( 1 - \beta _ { 1 } ) ^ { N _ { \mathfrak { n } } } ( \beta _ { 1 } ) ^ { N _ { \mathfrak { n } } } } } \end{array}
|
| 423 |
+
$$
|
| 424 |
+
|
| 425 |
+
and probability of observing $L _ { \mathtt { m } } , L _ { \mathtt { n } }$ when the sentence is True (factual):
|
| 426 |
+
|
| 427 |
+
$$
|
| 428 |
+
\begin{array} { l } { { \displaystyle P ( L _ { \tt m } , L _ { \tt n } | { \bf T } ) } } \\ { { \displaystyle ~ = \prod _ { a \in L _ { \tt m } } P ( a = a _ { r } | T ) \prod _ { a ^ { \prime } \in L _ { \tt n } } P ( a ^ { \prime } \not = a _ { r } | T ) } } \\ { { \displaystyle ~ = ( \beta _ { 2 } ) ^ { N _ { \tt m } } ( 1 - \beta _ { 2 } ) ^ { N _ { \tt n } } } } \end{array}
|
| 429 |
+
$$
|
| 430 |
+
|
| 431 |
+
where $N _ { \mathtt { m } }$ and $N _ { \mathbf { n } }$ are the number of matched answers and the number of not-matched answers, respectively. Hence, we can simplify Equation 16:
|
| 432 |
+
|
| 433 |
+
$$
|
| 434 |
+
P ( \mathrm { F } | L _ { \mathfrak { m } } , L _ { \mathfrak { n } } ) = \frac { \gamma _ { 2 } ^ { N _ { \mathfrak { n } } } } { \gamma _ { 1 } ^ { N _ { \mathfrak { n } } } + \gamma _ { 2 } ^ { N _ { \mathfrak { n } } } }
|
| 435 |
+
$$
|
| 436 |
+
|
| 437 |
+
where $\begin{array} { r } { \gamma _ { 1 } = \frac { \beta _ { 2 } } { 1 - \beta _ { 1 } } } \end{array}$ and $\begin{array} { r } { \gamma _ { 2 } = \frac { \beta _ { 1 } } { 1 - \beta _ { 2 } } } \end{array}$ . Lastly, instead of rejecting samples having an answerability score below a threshold,7 we find empirically that softcounting (defined below) improves the detection performance. We set both $\beta _ { 1 }$ and $\beta _ { 2 }$ to 0.8.
|
| 438 |
+
|
| 439 |
+
$$
|
| 440 |
+
N _ { \mathfrak { n } } ^ { \prime } = \sum _ { n { \mathrm { ~ s . t . ~ } } a _ { n } \in L _ { \mathfrak { n } } } \alpha _ { n } ; \ N _ { \mathfrak { n } } ^ { \prime } = \sum _ { n { \mathrm { ~ s . t . ~ } } a _ { n } \in L _ { \mathfrak { n } } } \alpha _ { n }
|
| 441 |
+
$$
|
| 442 |
+
|
| 443 |
+
where $\alpha _ { n } = P _ { \mathrm { U } } ( { \mathrm { a n s w e r a b l e } } | q , S ^ { n } )$ . Therefore, the SelfCheckGPT with QA score, ${ \mathcal { S } } _ { \mathrm { Q A } }$ , is:
|
| 444 |
+
|
| 445 |
+
$$
|
| 446 |
+
\mathcal { S } _ { \mathrm { Q A } } = P ( \mathrm { F } | L _ { \mathfrak { n } } , L _ { \mathfrak { n } } ) = \frac { \gamma _ { 2 } ^ { N _ { \mathfrak { n } } ^ { \prime } } } { \gamma _ { 1 } ^ { N _ { \mathfrak { n } } ^ { \prime } } + \gamma _ { 2 } ^ { N _ { \mathfrak { n } } ^ { \prime } } }
|
| 447 |
+
$$
|
| 448 |
+
|
| 449 |
+
In Table 5, we show empically that applying Bayes’ theorem and soft counting $\alpha$ (in Equation 20) improves the performance of the SelfCheckGPT with QA method.
|
| 450 |
+
|
| 451 |
+
Table 5: Performance of SelfCheckGPT-QA’s variants.
|
| 452 |
+
|
| 453 |
+
<table><tr><td rowspan="2">Varaint</td><td colspan="3">Sentence-lvl</td><td colspan="2">Passage-lvl</td></tr><tr><td>NoF</td><td>NoF*</td><td>Fact</td><td>PCC</td><td>SCC</td></tr><tr><td>SimpleCount</td><td>83.97</td><td>40.07</td><td>47.78</td><td>57.39</td><td>55.15</td></tr><tr><td>+ Bayes</td><td>83.04</td><td>38.58</td><td>47.41</td><td>56.43</td><td>55.03</td></tr><tr><td>+ Bayes + α</td><td>84.26</td><td>40.06</td><td>48.14</td><td>61.07</td><td>59.29</td></tr></table>
|
| 454 |
+
|
| 455 |
+
# C SelfCheckGPT with Prompt
|
| 456 |
+
|
| 457 |
+
We use the prompt template provided in the main text (in Section 5.5) for both GPT-3 (text-davinci003) and ChatGPT (gpt-3.5-turbo). For ChatGPT, a standard system message "You are a helpful assistant." is used in setting up the system.
|
| 458 |
+
|
| 459 |
+
At the time of conducting experiments, the API costs per 1,000 tokens are $\$ 0.020$ for GPT-3 and $\$ 0.002$ for ChatGPT. The estimated costs for running the models to answer Yes/No on all 1908 sentences and 20 samples are around $\$ 200$ for GPT-3 and $\$ 20$ for ChatGPT. Given the cost, we conduct the experiments on 4 samples when performing the ablation about LLM choice for SelfCheckGPTPrompt (Section 7.3). Table 6 shows the breakdown of predictions made by GPT-3 and ChatGPT.
|
| 460 |
+
|
| 461 |
+
Table 6: Breakdown of predictions made by GPT-3/ChatGPT when prompted to answer Yes(supported)/No(not-supported).
|
| 462 |
+
|
| 463 |
+
<table><tr><td>ChatGPT</td><td rowspan="2">Yes</td><td rowspan="2">No</td></tr><tr><td>GPT-3</td></tr><tr><td>Yes</td><td>3179</td><td>1038</td></tr><tr><td>No</td><td>367</td><td>3048</td></tr></table>
|
| 464 |
+
|
| 465 |
+
Table 7: The performance using different $n$ -gram models in the SelfCheckGPT with $_ n$ -gram method.
|
| 466 |
+
|
| 467 |
+
<table><tr><td rowspan="2">n-gram</td><td colspan="3">Sent-lvl AUC-PR</td><td colspan="2">Passage-lvl</td></tr><tr><td>NoFac</td><td>NoFac*</td><td>Fact</td><td>Pear.</td><td>Spear.</td></tr><tr><td colspan="6"> Avg(-logp)</td></tr><tr><td>1-gram</td><td rowspan="4">81.52 82.94 83.56</td><td rowspan="4">40.33 44.38</td><td rowspan="4">41.76 53.99</td><td>40.68 58.84</td><td>39.22</td></tr><tr><td>2-gram</td><td>52.81</td><td>58.11</td></tr><tr><td>3-gram</td><td>44.64 43.55</td><td>62.21 63.00</td></tr><tr><td>4-gram 83.80 5-gram 83.45</td><td>54.25 53.98</td><td>61.98 63.64 60.68 62.96</td></tr><tr><td colspan="6">42.31</td></tr><tr><td>Max(-logp) 1-gram</td><td>85.63</td><td>41.04</td><td>58.47</td><td>64.71</td><td>64.91</td></tr><tr><td>2-gram</td><td>85.26</td><td>39.29</td><td>58.29</td><td>62.48</td><td>66.04</td></tr><tr><td>3-gram</td><td>84.97</td><td>37.10</td><td>57.08</td><td>57.34</td><td>60.49</td></tr><tr><td>4-gram</td><td>84.49</td><td>36.37</td><td>55.96</td><td>55.77</td><td>57.25</td></tr><tr><td>5-gram</td><td>84.12</td><td>36.19</td><td>54.89</td><td>54.84</td><td>55.97</td></tr></table>
|
| 468 |
+
|
| 469 |
+

|
| 470 |
+
Figure 8: The performance of SelfCheckGPT methods on sentence-level non-factual detection (AUC-PR) versus the number of samples. This Figure extends the passage-level results in Figure 7.
|
| 471 |
+
|
| 472 |
+

|
| 473 |
+
Figure 9: Passage-level ranking performance of the Avg $\mathcal { H } )$ method using proxy LLM where the sizes are: LLaMA $\scriptstyle = \{ 7 \mathrm { B }$ , 13B, 30B}, $\bar { \mathrm { O P T } } { = } \{ 1 2 5 \mathrm { m }$ , 1.3B, 13B, 30B}, GPT- $\scriptstyle \mathbf { J } = 6 \mathbf { B }$ , $\mathrm { N e o X } { = } 2 0 \mathrm { B }$ . The full results are provided in Table 8.
|
| 474 |
+
|
| 475 |
+
# D Additional Experimental Results
|
| 476 |
+
|
| 477 |
+
Here, we provide experimental results that are complementary to those presented in the main paper.
|
| 478 |
+
|
| 479 |
+

|
| 480 |
+
Figure 10: Scatter plot of passage-level scores where Y-axis $=$ Method scores, X-axis $=$ Human scores. Correlations are reported in Table 2. This figure provides results in addition to Figure 6.
|
| 481 |
+
|
| 482 |
+
Table 8: AUC-PR for Detecting Non-Factual and Factual Sentences in the GPT-3 generated WikiBio passages. Passage-level PCC and SCC with LLMs used to assess GPT-3 responses. This table is an extension to Table 2.
|
| 483 |
+
|
| 484 |
+
<table><tr><td rowspan="2">LLM</td><td rowspan="2">Size</td><td colspan="3">Sentence-level (AUC-PR)</td><td colspan="2">Passage-level (Corr.)</td></tr><tr><td>NonFact</td><td>NonFact*</td><td>Factual</td><td>Pearson</td><td>Spearman</td></tr><tr><td>Random</td><td></td><td>72.96</td><td>29.72</td><td>27.04</td><td></td><td></td></tr><tr><td colspan="7"> Avg(-logp) Method</td></tr><tr><td>LLaMA</td><td>30B</td><td>75.43</td><td>30.32</td><td>41.29</td><td>21.72</td><td>20.20</td></tr><tr><td>LLaMA</td><td>13B</td><td>74.16</td><td>30.01</td><td>37.36</td><td>13.33</td><td>12.89</td></tr><tr><td>LLaMA</td><td>7B</td><td>71.69</td><td>27.87</td><td>31.30</td><td>-2.71</td><td>-2.59</td></tr><tr><td>OPT</td><td>30B</td><td>67.70</td><td>24.43</td><td>25.04</td><td>-32.07</td><td>-31.45</td></tr><tr><td>NeoX</td><td>20B</td><td>69.00</td><td>24.38</td><td>26.18</td><td>-31.79</td><td>-34.15</td></tr><tr><td>OPT</td><td>13B</td><td>67.46</td><td>24.39</td><td>25.20</td><td>-33.05</td><td>-32.79</td></tr><tr><td>GPT-J</td><td>6B</td><td>67.51</td><td>24.28</td><td>24.26</td><td>-38.80</td><td>-40.05</td></tr><tr><td>OPT</td><td>1.3B</td><td>66.19</td><td>24.47</td><td>23.47</td><td>-35.20</td><td>-38.95</td></tr><tr><td>OPT</td><td>125m</td><td>66.63</td><td>25.31</td><td>23.07</td><td>-30.38</td><td>-37.54</td></tr><tr><td colspan="7"> Avg(H) Method</td></tr><tr><td>LLaMA</td><td>30B</td><td>80.80</td><td>39.01</td><td>42.97</td><td>33.80</td><td>39.49</td></tr><tr><td>LLaMA</td><td>13B</td><td>80.63</td><td>38.98</td><td>40.59</td><td>29.43</td><td>33.12</td></tr><tr><td>LLaMA</td><td>7B</td><td>78.67</td><td>37.22</td><td>33.81</td><td>19.44</td><td>21.79</td></tr><tr><td>OPT</td><td>30B</td><td>77.13</td><td>33.67</td><td>29.55</td><td>-0.43</td><td>3.43</td></tr><tr><td>NeoX</td><td>20B</td><td>77.40</td><td>32.78</td><td>30.13</td><td>5.41</td><td>7.43</td></tr><tr><td>OPT</td><td>13B</td><td>76.93</td><td>33.71</td><td>29.68</td><td>0.25</td><td>1.39</td></tr><tr><td>GPT-J</td><td>6B</td><td>76.15</td><td>33.29</td><td>28.30</td><td>-2.50</td><td>-1.37</td></tr><tr><td>OPT</td><td>1.3B</td><td>74.05</td><td>31.91</td><td>26.33</td><td>-10.59</td><td>-10.00</td></tr><tr><td>OPT</td><td>125m</td><td>71.51</td><td>30.88</td><td>25.36</td><td>-14.16</td><td>-13.76</td></tr><tr><td colspan="7">Max(-logp) Method</td></tr><tr><td>LLaMA</td><td>30B</td><td>74.01</td><td>27.14</td><td>31.08</td><td>-22.83</td><td>-22.71</td></tr><tr><td>LLaMA</td><td>13B</td><td>71.12</td><td>26.78</td><td>28.82</td><td>-34.93</td><td>-31.70</td></tr><tr><td>LLaMA</td><td>7B</td><td>69.57</td><td>25.91</td><td>26.54</td><td>-42.57</td><td>-38.24</td></tr><tr><td>OPT</td><td>30B</td><td>67.32</td><td>24.40</td><td>24.32</td><td>-49.51</td><td>-45.50</td></tr><tr><td>NeoX</td><td>20B</td><td>67.51</td><td>23.88</td><td>24.82</td><td>-47.96</td><td>-44.54</td></tr><tr><td>OPT</td><td>13B</td><td>67.36</td><td>24.67</td><td>24.46</td><td>-50.15</td><td>-44.42</td></tr><tr><td>GPT-J</td><td>6B</td><td>67.58</td><td>23.94</td><td>23.93</td><td>-51.23</td><td>-47.68</td></tr><tr><td>OPT</td><td>1.3B</td><td>68.16</td><td>25.85</td><td>24.66</td><td>-45.60</td><td>-42.39</td></tr><tr><td>OPT</td><td>125m</td><td>69.23</td><td>27.66</td><td>24.14</td><td>-39.22</td><td>-37.18</td></tr><tr><td colspan="7">Max(H) Method</td></tr><tr><td>LLaMA</td><td>30B</td><td>80.92</td><td>37.32</td><td>37.90</td><td>35.57</td><td>38.94</td></tr><tr><td>LLaMA</td><td>13B</td><td>80.98</td><td>37.94</td><td>36.01</td><td>32.07</td><td>34.01</td></tr><tr><td>LLaMA</td><td>7B</td><td>79.65</td><td>35.57</td><td>31.32</td><td>22.10</td><td>22.53</td></tr><tr><td>OPT</td><td>30B</td><td>76.58</td><td>33.44</td><td>29.31</td><td>1.63</td><td>6.41</td></tr><tr><td>NeoX</td><td>20B</td><td>76.98</td><td>31.96</td><td>29.13</td><td>5.97</td><td>9.31</td></tr><tr><td>OPT</td><td>13B</td><td>76.26</td><td>32.81</td><td>29.25</td><td>1.42</td><td>2.82</td></tr><tr><td>GPT-J</td><td>6B</td><td>75.30</td><td>32.51</td><td>28.13</td><td>-2.14</td><td>1.41</td></tr><tr><td>OPT</td><td>1.3B</td><td>73.79</td><td>31.42</td><td>26.38</td><td>-9.84</td><td>-9.80</td></tr><tr><td>OPT</td><td>125m</td><td>71.32</td><td>31.65</td><td>25.36</td><td>-18.05</td><td>-17.37</td></tr></table>
|
md/dev/RzXb6a3H3rs/RzXb6a3H3rs.md
ADDED
|
@@ -0,0 +1,290 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# LEARNING TO PROMPT FOR CONTINUAL LEARNING
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
The mainstream learning paradigm behind continual learning has been to adapt the model parameters to non-stationary data distributions, where catastrophic forgetting is the central challenge. This work explores a new paradigm for continual learning – learning to dynamically prompt the model to learn tasks sequentially under different task transitions. Specifically, our method, Learning to Prompt for Continual Learning (L2P), prepends a subset of learnable parameters (called Prompts) from a larger set (called Prompt Pool) to the input embeddings. The training objective is designed to dynamically select and update prompts from the prompt pool to learn tasks sequentially given a pretrained backbone model. Under our new framework, instead of mitigating catastrophic forgetting via adapting large model parameters as in the previous continual learning paradigm, we tackle the problem of learning better small prompt parameters. In this framework, the prompt pool explicitly manages task-invariant and task-specific knowledge while maintaining model plasticity. The proposed L2P outperforms previous work in terms of forgetting on all datasets, including rehearsal-based methods on certain benchmarks, with privacy benefits from not requiring access to the data of previous tasks. Moreover, when L2P is additionally equipped with a rehearsal buffer, it matches the performance of training all tasks together, which is often regarded as an upper bound in continual learning. Source code will be released.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Contrary to ordinary supervised learning that trains on independent and identically distributed (i.i.d.) data, continual learning tackles the problem of training a single model on non-stationary data distributions where different classification tasks are presented sequentially. Mainstream continual learning methods (Parisi et al., 2019; Mai et al., 2021) follow a natural learning paradigm: adapting the entire model continually as the data distribution shifts. However, since the model only has access to the data in an individual phase of the learning cycle, it is prone to overfit on the currently available data and suffers from performance deterioration on the previously trained data. This is commonly known as catastrophic forgetting (McCloskey & Cohen, 1989).
|
| 12 |
+
|
| 13 |
+
In addition to the catastrophic forgetting problem, other challenges in continual learning have recently been receiving increasing attention (Hadsell et al., 2020): (1) knowledge transfer: the model should be able to transfer knowledge between tasks by identifying shared knowledge among tasks; (2) model plasticity: the model should be able to keep learning new tasks effectively by capturing task-specific knowledge; and (3) task-agnosticity: it is desirable that a continual learning algorithm can handle the case where distribution shifts gradually without clear task boundaries.
|
| 14 |
+
|
| 15 |
+
On the other hand, prompt-based learning, or prompting, has recently achieved great success in the field of natural language processing (NLP) as a new transfer learning technique (Liu et al., 2021). Prompting techniques design model inputs with textual prompt tokens containing additional taskspecific information, such that the pretrained language model can process parameterized inputs in order to perform prompt-specific prediction. Several methods (Lester et al., 2021; Shin et al., 2020; Li & Liang, 2021) further make prompts learnable to allow the overall backbone model to extract task-specific information automatically. Intuitively, prompt-based learning reformulates learning downstream tasks from directly adapting model weights to designing prompts that enable the model perform tasks conditionally. A prompt encodes task-specific knowledge and has the ability to utilize pre-trained frozen models more effectively than ordinary fine-tuning (Lester et al., 2021; Raffel et al., 2020). Inspired by these recent advances in prompt learning, we revisit continual learning from a different perspective: Can we encode task-specific information of continual tasks into a shared parameterized prompt space in order to allow a pre-trained model to perform conditional prediction during the continual learning process?
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: Overview of the L2P framework. Compared with typical continual learning methods (left) that adapt model weights to tasks sequentially, L2P (right) uses a single backbone model and learns a prompt pool to adapt tasks.
|
| 19 |
+
|
| 20 |
+
To this end, we propose a new continual learning method called Learning to Prompt for Continual Learning (L2P). Figure 1 gives an overview of our method and demonstrates how it differs from typical continual learning methods. L2P leverages the representative features from pretrained models; however, instead of tuning the parameters during the continual learning process, L2P keeps the pretrained model untouched, and instead learns a set of prompts that dynamically help models solve corresponding tasks, thus mitigating catastrophic forgetting. The prompts are structured in a key-value shared memory space called the prompt pool, and we design a query mechanism to dynamically lookup a subset of task-relevant prompts based on the instance-wise input features. The prompt pool, which is optimized jointly with the supervised loss, ensures that shared prompts encode shared knowledge for knowledge transfer, and unshared prompts encode task-specific knowledge that help maintain model plasticity. The instance-wise query mechanism removes the necessity of knowing the task identity or boundaries, enabling task-agnostic continual learning. The selected prompts are then prepended to the input embeddings (Figure 2), which implicitly add task-relevant guidance to pretrained models, so that the model can use the most useful pretrained features to conduct corresponding tasks. In summary, this work makes the following contributions:
|
| 21 |
+
|
| 22 |
+
1. We propose a novel method, called L2P, that addresses multiple challenges in continual learning: (1) we leverage pretrained models and prompting techniques to mitigate catastrophic forgetting; (2) we design a novel key-value paired prompt pool to achieve knowledge sharing and maintain model plasticity; and (3) we devise an instance-wise query mechanism to enable task-agnostic learning.
|
| 23 |
+
2. We conduct comprehensive experiments to demonstrate the effectiveness of L2P on multiple continual learning benchmarks, including class-incremental, task-agnostic, and domainincremental settings. The proposed L2P outperforms previous works in terms of forgetting on all datasets, beating rehearsal based methods on certain benchmarks and providing practical advantages over them by avoiding privacy issues of task data sharing present in some applications (Delange et al., 2021). Moreover, when equipped with a rehearsal buffer in applications with less strict privacy constraints, L2P matches the performance of training all tasks together, which is often regarded as an upper bound in continual learning.
|
| 24 |
+
3. To the best of our knowledge, we are the first to introduce the idea of prompting in the field of continual learning to address some of the key challenges in continual learning.
|
| 25 |
+
|
| 26 |
+
# 2 RELATED WORK
|
| 27 |
+
|
| 28 |
+
Continual learning. There are three main categories of recent continual learning algorithms: Regularization-based methods (Kirkpatrick et al., 2017; Zenke et al., 2017; Li & Hoiem, 2017; Aljundi et al., 2018) limit the plasticity of the model by limiting the learning rate on important parameters for previous tasks. Although these methods address catastrophic forgetting to some extent, they cannot get satisfactory performance under more challenging settings, e.g., class-incremental setting (Mai et al., 2021). Rehearsal-based methods (Chaudhry et al., 2018; 2019; Hayes et al., 2019) construct a buffer to save samples from older tasks to train with data from the current task. These methods are state-of-the-art on various benchmarks (Parisi et al., 2019; Mai et al., 2021). However, rehearsal-based methods are not applicable to scenarios where data privacy should be taken into account (Shokri & Shmatikov, 2015). Architecture-based methods either expand the network (Rusu et al., 2016; Yoon et al., 2017) or prune the network (Mallya & Lazebnik, 2018; Wang et al., 2020). The former suffers from scalability issue as parameters scale up linearly with the number of tasks, and the latter are sensitive to hyperparameters.
|
| 29 |
+
|
| 30 |
+
Prompting. Prompting, or prompt-based learning, has been widely explored in the field of natural language processing (Kumar et al., 2016; McCann et al., 2018; Radford et al., 2019; Schick & Schutze ¨ , 2020). The high-level idea of prompting is to apply a function to modify the input text, so that the language model gets additional information about the task. However, the design of a prompting function is challenging and requires heuristics. Recent work, including prompt tuning (Lester et al., 2021) and prefix tuning (Li & Liang, 2021), seek to address this problem by applying learnable prompts in a continuous space, achieving satisfactory performance on transfer learning for pretrained language models. Nevertheless, to the best of our knowledge, the idea of prompting has never been studied systematically in continual learning.
|
| 31 |
+
|
| 32 |
+
# 3 PREREQUISITES
|
| 33 |
+
|
| 34 |
+
# 3.1 CONTINUAL LEARNING PROTOCOLS
|
| 35 |
+
|
| 36 |
+
Continual learning is usually defined as training machine learning models on non-stationary data from sequential tasks. We define a sequence of tasks $\mathcal { D } = \{ \mathcal { D } _ { 1 } , \cdot \cdot \cdot , \mathcal { D } _ { T } \}$ , where the $t$ -th task $\mathcal { D } _ { t } = \{ ( \dot { \mathbf { x } } _ { i } ^ { t } , y _ { i } ^ { t } ) \} _ { i = 1 } ^ { n _ { t } }$ contains tuples of the input sample $\boldsymbol { x } _ { i } ^ { t } \in \mathcal { X }$ and its corresponding label $y _ { i } ^ { t } \in \mathcal { V }$ . The goal is to train a single model $f _ { \theta } : \mathcal { X } \mathcal { Y }$ parameterized by $\theta$ , such that it predicts the label $y = f _ { \boldsymbol { \theta } } ( \pmb { x } ) \in \mathcal { y }$ given an unseen test sample $_ { \textbf { \em x } }$ from arbitrary tasks. Data from the previous tasks may not be seen anymore when training future tasks.
|
| 37 |
+
|
| 38 |
+
Depending on the task transition environment, continual learning can be categorized into multiple settings with slightly different challenges. The common task, class, and domain incremental setting assumes task data $\mathcal { D } _ { t }$ arrives in sequence $t = \{ 1 , . . . , T \}$ in a discrete manner. Task-incremental assumes task identity is known at test time while class-incremental does not. Different from the task and class incremental settings where each task has different classes, domain-incremental learning maintains the same set of classes for every task and only changes the distribution of $_ { \textbf { \em x } }$ by task. In the more challenging task-agnostic setting, task data in $\mathcal { D }$ changes smoothly, and the task identity $t$ is unknown. Our paper tackles the more challenging class-incremental, task-agnostic, and domainincremental settings.
|
| 39 |
+
|
| 40 |
+
# 3.2 PROMPT-BASED LEARNING AND BASELINES
|
| 41 |
+
|
| 42 |
+
Prompt-based learning is an emerging technique in NLP. In contrast to traditional supervised finetuning, this type of methods design task-specific prompt functions to enable pre-trained models perform corresponding tasks (Liu et al., 2021). One of recent techniques, Prompt Tuning (PT) (Lester et al., 2021), proposes to simply condition frozen T5-like language models (Raffel et al., 2020) to perform down-streaming NLP tasks by learning prompt parameters that are prepended to the input tokens. While prompt-based learning has demonstrated success in NLP, to the best of our knowledge, the related research in computer vision and its application to continual learning remains under-investigated. Without loss of generality, here we introduce the definition of PT using the image modality given vision transformer-based models (Dosovitskiy et al., 2021; Vaswani et al., 2017). The definition is easy to generalize to other modalities and sequence-based models.
|
| 43 |
+
|
| 44 |
+
Given an input of 2D image $\pmb { x } \in \mathbb { R } ^ { H \times W \times C }$ and a pretrained ViT (excluding the classification head) $f ~ = ~ f _ { r } \circ f _ { e }$ , where $f _ { e }$ is the input embedding layer, and $f _ { r }$ represents a stack of selfattention layers (Dosovitskiy et al., 2021). Images are reshaped to a sequence of flattened 2D patches $\pmb { x } _ { p } \in \mathbb { R } ^ { L \times ( S ^ { 2 } \cdot C ) }$ , where $L$ is the token length, i.e., the number of patches, $S$ is the patch size and $C$ is the original number of channels. To simplify notation, we assume the first token in $\scriptstyle { \pmb { x } } _ { p }$ is the [class] token as part of pre-trained model (Dosovitskiy et al., 2021). The pretrained embedding layer $f _ { e } : \mathbb { R } ^ { L \times ( S ^ { 2 } \cdot C ) } \mathbb { R } ^ { L \times D }$ projects the patched image to the embedding feature $\pmb { x } _ { e } = f _ { e } ( x ) \in \mathbb { R } ^ { L \times D }$ , where $D$ is the embedding dimension. When solving multiple downstreaming tasks, we keep the large-scale pre-trained backbone frozen to maintain its generality following PT. The direct application of PT is to prepend learnable parameters $\boldsymbol { P _ { e } } \in \mathbb { R } ^ { L _ { p } \times D }$ , called a prompt, to the embedding feature $\pmb { x } _ { p } = [ P _ { e } ; \pmb { x } _ { e } ]$ , and feed the extended sequences to the model function $f _ { r } ( { \pmb x } _ { p } )$ for performing classification tasks. Different tasks have independent prompts and share one copy of the large model.
|
| 45 |
+
|
| 46 |
+

|
| 47 |
+
Figure 2: The illustration of L2P at test time. During training time, we follow the same procedure and optimize the model as described in Section 4.3.
|
| 48 |
+
|
| 49 |
+
Compared with ordinary fine-tuning classification heads with a fixed backbone, literature shows that prompt-based learning results in a sequence-based model with higher capacity to learn features (Liu et al., 2021; Lester et al., 2021). PT can be applied to task-incremental continual learning by learning independent prompts for each task. However, in more challenging settings when no task identity is available, choosing a prompt is more difficult.
|
| 50 |
+
|
| 51 |
+
# 4 LEARNING TO PROMPT
|
| 52 |
+
|
| 53 |
+
Our proposed method, Learning to Prompt for Continual Learning (L2P) is depicted in Figure 2. First, we select a subset of prompts from a key-value pair prompt pool based on our proposed instance-wise query mechanism. We then prepend the selected prompts to the input embedding. Finally, we feed the extended input embedding to the model, and optimize the classification loss and the prompt pool jointly. In the remainder of this section, we will introduce the critical designs of our method in detail, and discuss how L2P mitigates catastrophic forgetting and addresses some of the other challenges in continual learning (Hadsell et al., 2020), and describe the training procedure.
|
| 54 |
+
|
| 55 |
+
# 4.1 FROM PROMPT TO PROMPT POOL
|
| 56 |
+
|
| 57 |
+
The motivations of introducing prompt pool are threefold. First, the task index at test time is unknown so training task-independent prompts is not feasible. Second, even if the task-independent prompt can be known at test time, it prevents possible knowledge sharing between similar tasks (Hadsell et al., 2020). Third, while the simple way of learning a single shared prompt for all tasks enables knowledge sharing, it is challenging when tasks are diverse (see Section 5.3). Ideally one would learn a model that is able to share knowledge when tasks are similar, while maintaining knowledge independence otherwise. Thus, we propose using a prompt pool to store encoded knowledge, which can be flexibly grouped as an input to the model. The prompt pool is defined as
|
| 58 |
+
|
| 59 |
+
$$
|
| 60 |
+
\mathbf { P } = \{ P _ { 1 } , P _ { 2 } , \cdot \cdot \cdot , P _ { M } \} , \quad M = \mathrm { t o t a l n u m b e r o f p r o m p t s } ,
|
| 61 |
+
$$
|
| 62 |
+
|
| 63 |
+
where $P _ { j } \in \mathbb { R } ^ { L _ { p } \times D }$ is a single prompt with token length $L _ { p }$ and the same embedding size $D$ as $\pmb { x } _ { e }$ . Following the notations in Section 3.2, we let $_ { \textbf { \em x } }$ and $\pmb { x } _ { e } = \bar { f } _ { e } ( \pmb { x } )$ be the input and its corresponding method is general enough to the task-agnostic setting. Denoting embedding feature, respectively. Note that we omit the task index $\{ s _ { i } \} _ { i = 1 } ^ { N }$ $t$ of as a subset of $_ { \textbf { \em x } }$ in our notation as our $N$ indices from $[ 1 , M ]$ , we can then adapt the input embedding as follows:
|
| 64 |
+
|
| 65 |
+
$$
|
| 66 |
+
\pmb { x } _ { p } = [ P _ { s _ { 1 } } ; \cdot \cdot \cdot ; P _ { s _ { N } } ; \pmb { x } _ { e } ] , \quad 1 \leq N \leq M ,
|
| 67 |
+
$$
|
| 68 |
+
|
| 69 |
+
where ; represents concatenation along the token length dimension. $P$ are free to compose, so they can jointly encode knowledge (e.g. visual features or tasks) for the model to process. Ideally, we
|
| 70 |
+
|
| 71 |
+
want to achieve a more fine-grained knowledge sharing scheme via prompt combinations at the instance-wise level: similar inputs tend to share more common prompts, and vice versa. We next elaborate our prompt selection strategy and training in the following sections.
|
| 72 |
+
|
| 73 |
+
# 4.2 INSTANCE-WISE PROMPT QUERY
|
| 74 |
+
|
| 75 |
+
We design a key-value pair based query strategy to dynamically select suitable prompts for different inputs. This key-valued memory query mechanism shares some design principles with methods in other fields, such as Differentiable Neural Computer (Graves et al., 2016) and VQ-VAE (Oord et al., 2017), which have external memory to maintain, and employs them for a different purpose. With a slight abuse of notation, we associate each prompt as value to a learnable key: $\mathbf { \bar { P } } \overset { ^ { - } } { = } \{ ( k _ { 1 } , P _ { 1 } ) , ( k _ { 2 } , P _ { 2 } ) , \cdots , ( k _ { M } , P _ { M } ) \}$ , where $\pmb { k } \in \mathbb { R } ^ { D _ { k } }$ . Ideally, we would like to let the input instance itself decide which prompts to choose through query-key matching. To this end, we introduce a query function $q : \mathbb { R } ^ { \hat { H } \times W \times \hat { C } } \mathbb { R } ^ { D _ { k } }$ that encodes input $_ { \textbf { \em x } }$ to the same dimension as the key. Moreover, $q$ should be a deterministic function with respect to different tasks and has no learnable parameters. We directly use the whole pretrained model as a frozen feature extractor to get the query features: $q ( { \pmb x } ) = f ( { \pmb x } ) [ 0 , : ]$ (we use the feature vector corresponding to [class]). Other feature extractors like ConvNet are feasible.
|
| 76 |
+
|
| 77 |
+
Denote $\gamma : \mathbb { R } ^ { D _ { k } } \times \mathbb { R } ^ { D _ { k } } \to \mathbb { R }$ as a function to score the match between the query and prompt key (we find cosine distance works well). Given an input $_ { \textbf { \em x } }$ , we use $q ( { \pmb x } )$ to lookup the top- $N$ keys by simply solving the objective:
|
| 78 |
+
|
| 79 |
+
$$
|
| 80 |
+
{ \bf P } _ { { \pmb x } } = \underset { \{ s _ { i } \} _ { i = 1 } ^ { N } \subseteq [ 1 , M ] } { \arg \operatorname* { m i n } } \quad \sum _ { i = 1 } ^ { N } \gamma \left( q ( { \pmb x } ) , { \pmb k } _ { { s } _ { i } } \right) .
|
| 81 |
+
$$
|
| 82 |
+
|
| 83 |
+
Note that the design of this key-value strategy decouples the query mechanism learning and prompt learning processes, which has been experimentally shown to be critical (see Section 5.3). Furthermore, querying prompts is done in an instance-wise fashion, which makes the whole framework task-agnostic, meaning that the method works without needing clear task boundaries during training, nor task identifications at test time.
|
| 84 |
+
|
| 85 |
+
Optionally diversifying prompt-selection. Although our method does not need task boundary information, in real-world scenarios and experimental datasets, it is quite common that the task transition is discrete and so task boundaries are known at train time. We find that adding such a prior into our framework can help the model learn better task-specific prompts, especially when tasks have high diversity. To this end, we propose an additional technique for adding task boundaries which is optional for the L2P framework.
|
| 86 |
+
|
| 87 |
+
During training of task $t$ , we maintain a prompt frequency table $H _ { t } = [ h _ { 1 } , h _ { 2 } , \cdot \cdot \cdot , h _ { M } ]$ , where each entry represents the normalized frequency of prompt $P _ { i }$ being selected up until task $t - 1$ . To encourage the query mechanism select diverse prompts, we modify equation 3 to
|
| 88 |
+
|
| 89 |
+
$$
|
| 90 |
+
\mathbf { P } _ { \pmb { x } } = \operatorname * { a r g m i n } _ { \{ s _ { i } \} _ { i = 1 } ^ { N } \subseteq [ 1 , M ] } \quad \sum _ { i = 1 } ^ { N } \gamma \left( q ( \pmb { x } ) , \pmb { k } _ { s _ { i } } \right) \cdot h _ { s _ { i } } ,
|
| 91 |
+
$$
|
| 92 |
+
|
| 93 |
+
where $h _ { s _ { i } }$ penalizes the frequently-used prompts being selected to encourage diversified selection.
|
| 94 |
+
Equation 4 is only applicable during training; at test time, only equation 3 is needed.
|
| 95 |
+
|
| 96 |
+
# 4.3 OPTIMIZATION OBJECTIVE FOR L2P
|
| 97 |
+
|
| 98 |
+
At every training step, after selecting $N$ prompts following the aforementioned query strategy, the adapted embedding feature $\mathbf { \boldsymbol { x } } _ { p }$ is fed into the rest of the pretrained model $f _ { r }$ and the final classifier $g _ { \phi }$ parametrized by $\phi$ . Overall, we seek to minimize the end-to-end training loss function:
|
| 99 |
+
|
| 100 |
+
$$
|
| 101 |
+
\operatorname* { m i n } _ { \mathbf { P } , \phi } \quad \mathcal { L } \big ( g _ { \phi } \big ( f _ { r } ^ { \mathrm { a v g } } ( x _ { p } ) \big ) , y \big ) + \lambda \sum _ { \mathbf { P } _ { x } } \gamma \left( q ( x ) , k _ { s _ { i } } \right) , \quad s . t . , ~ \mathbf { P } _ { x } \mathrm { ~ i s ~ o b t a i n e d ~ w i t h ~ e q u a t i o n } \ 3 ,
|
| 102 |
+
$$
|
| 103 |
+
|
| 104 |
+
where $f _ { r } ^ { \mathrm { a v g } } = \mathrm { A v g P o o l } ( f _ { r } ( \pmb { x } _ { p } ) [ N \cdot L _ { p } , : ] )$ , i.e., the output hidden vectors corresponding to the $N \cdot L _ { p }$ prompt locations are averaged before the classification head. The first term is the softmax cross-entropy loss, the second term is a surrogate loss to pull selected keys closer to corresponding query features. $\lambda$ is a scalar to weight the loss.
|
| 105 |
+
|
| 106 |
+
# 5 EXPERIMENTS
|
| 107 |
+
|
| 108 |
+
To evaluate the proposed L2P, we closely follow the settings proposed in prior works (Lopez-Paz & Ranzato, 2017; Zeno et al., 2018; Van de Ven & Tolias, 2019), and conduct comprehensive experiments. In particular, we consider (1) the class-incremental setting, where the task identity is unknown during inference; (2) the domain-incremental setting, where the input domain shifts over time; (3) the task-agnostic setting, where there is no clear task boundary. Moreover, we conduct extensive ablation studies to provide a deeper understanding of our method.
|
| 109 |
+
|
| 110 |
+
Evaluation metrics. For settings with task boundaries and where each task has an associated test set, we use two metrics, Average accuracy $( A )$ and Forgetting $( F )$ , which are widely used in previous works (Lopez-Paz & Ranzato, 2017; Chaudhry et al., 2018; Mai et al., 2021). Denoting by $\mathbf { \Psi } _ { a _ { t , i } }$ the accuracy of the $i$ -th task after finishing training on task $t$ , we can compute the corresponding average accuracy $A _ { t }$ and forgetting $F _ { t }$ up until the current task $t$ as follows:
|
| 111 |
+
|
| 112 |
+
$$
|
| 113 |
+
A _ { t } = \frac { 1 } { t } \sum _ { i = 1 } ^ { t } a _ { t , i } , \quad F _ { t } & = \frac { 1 } { t - 1 } \sum _ { i = 1 } ^ { t - 1 } \operatorname* { m a x } _ { i ^ { \prime } \in \{ 1 , \cdots , t - 1 \} } \left( a _ { i ^ { \prime } , i } - a _ { t , i } \right) .
|
| 114 |
+
$$
|
| 115 |
+
|
| 116 |
+
We report the final performance $A _ { T }$ and $F _ { T }$ after training on all $T$ tasks. For settings without task boundary or where there is only a single test set available, we only report the final test accuracy following the protocol in previous work (Lomonaco & Maltoni, 2017; Shanahan et al., 2021).
|
| 117 |
+
|
| 118 |
+
Comparing methods. We compare L2P against several baselines and state-of-the-art continual learning methods. Note that we used the same pretrained ViT-B/16 model (Dosovitskiy et al., 2021) as a starting point for every method to ensure fair comparison. (1) FT-iid is the usual supervised finetuning under the i.i.d. setting, which is the possible upper bound performance a continual learning method could achieve. (2) FT-seq-frozen is the naive sequential fine-tuning approach with the pretrained model frozen. (3) FT-seq is the naive sequential fine-tuning approach (model weights are updated). (4) EWC (Kirkpatrick et al., 2017) is a regularization-based approach aiming at limiting the learning rate of parameters that are important for previous tasks. (5) LwF (Li & Hoiem, 2017) applies the idea of knowledge distillation (Hinton et al., 2015) to preserve knowledge from past tasks. To further demonstrate the effectiveness of our method, we introduce two state-of-the-art rehearsal-based methods, which require additional memory buffer to save samples from past tasks: (6) ER (Chaudhry et al., 2019; Hayes et al., 2019) mixes samples from buffer with samples the from current task in the training process. (7) GDumb (Prabhu et al., 2020) simply constructs the buffer from the sequence of tasks and trains on the buffered samples jointly, so forgetting metric is not applicable to this method. GDumb can outperform many state-of-the-art methods under various settings (Prabhu et al., 2020; Mai et al., 2021). Following the experiment setting in Prabhu et al. (2020), we store an average of 50 samples per class, e.g., a buffer size of 5,000 for CIFAR100, as this is a relatively large choice of buffer size that guarantees SOTA performance.
|
| 119 |
+
|
| 120 |
+
Experiment details. For L2P, we train all models using Adam (Kingma & Ba, 2014) with $\beta _ { 1 } = 0 . 9$ and $\beta _ { 2 } ~ = ~ 0 . 9 9 9$ , a batch size of 128, and a constant learning rate of 0.03 for all settings. Input images are resized to $2 2 4 \times 2 2 4$ and normalized to the range of $[ 0 , 1 ]$ to match the pretraining setting. As pointed out by Buzzega et al. (2020), training multiple epochs for each task disentangles the effects of possible underfitting from forgetting. Thus, we train every task for 5 epochs in the class- and domain-incremental settings. However, in the task-agnostic setting where we don’t have the concept of a task, we follow Shanahan et al. (2021) to train every batch only once. We set $M = 1 0 ^ { - } N = 5 , L _ { p } = 5$ for all CIFAR-100 based datasets and CORe50. For 5-datasets, we use $M = 2 0 , N = 4 , L _ { p } = 5$ . Prompts only add 46, 080 and 92, 160 parameters to the original pretrained model for these two settings, leading to a small $0 . 0 5 \%$ and $0 . 1 1 \%$ total parameter increase, respectively. We find $\lambda$ in equation 5 is not sensitive and works well in a large range, so we set $\lambda = 0 . 5$ consistently for all datasets.
|
| 121 |
+
|
| 122 |
+
# 5.1 RESULTS ON CLASS-INCREMENTAL LEARNING
|
| 123 |
+
|
| 124 |
+
Split CIFAR-100. This dataset randomly splits the original CIFAR-100 dataset (Krizhevsky et al., 2009) into 10 tasks, where each task consist of 10 disjoint classes. Since the tasks are from a single original dataset, they share some similarities and some classes are even from the same superclass.
|
| 125 |
+
|
| 126 |
+
5-datasets. This dataset (Ebrahimi et al., 2020) consists of five image classification datasets: CIFAR-10, MNIST (LeCun, 1998), Fashion-MNIST (Xiao et al., 2017), SVHN (Netzer et al., 2011), and notMNIST (Bulatov, 2011). Although each dataset alone is not hard, the sequential training of them is fairly challenging to even ImageNet pre-trained models, since models are more susceptible to forgetting when the tasks are diverse (Mehta et al., 2021). We apply the optional strategy introduced in 4.2 to enhance prompt selection diversity.
|
| 127 |
+
|
| 128 |
+
Table 1: Results on class-incremental learning. Accuracy and forgetting are reported. All methods start from the same pre-trained ViTB/16 model and train on each task for 5 epochs. Methods are separated based on whether rehearsal is applied. All results are shown in percentage $( \% )$ and are averaged over 3 runs.
|
| 129 |
+
|
| 130 |
+
<table><tr><td rowspan="2">Method</td><td colspan="2">Split CIFAR-100</td><td colspan="2"> 5-datasets</td></tr><tr><td>Average Acc (↑) </td><td>Forgetting (↓)</td><td>Average Acc (↑)</td><td>Forgetting (↓)</td></tr><tr><td colspan="5">Upper bound:</td></tr><tr><td>FT-iid</td><td>90.85±0.12</td><td></td><td>93.93±0.18</td><td></td></tr><tr><td colspan="5">Non-rehearsal based methods:</td></tr><tr><td>FT-seq-frozen</td><td>17.72±0.34</td><td>59.09±0.25</td><td>39.49±0.12</td><td>42.62±0.20</td></tr><tr><td>FT-seq</td><td>33.61±0.85</td><td>86.87±0.20</td><td>20.12±0.42</td><td>94.63±0.68</td></tr><tr><td>EWC LwF</td><td>47.01±0.29</td><td>33.27±1.17</td><td>50.93±0.09</td><td>34.94±0.07</td></tr><tr><td>L2P (ours)</td><td>60.69±0.63</td><td>27.77±2.17</td><td>47.91±0.33</td><td>38.01±0.28</td></tr><tr><td></td><td>83.83±0.04</td><td>7.63±0.30</td><td>81.14 ±0.93</td><td>4.64 ±0.52</td></tr><tr><td colspan="5">Rehearsal based methods:</td></tr><tr><td>ER</td><td>82.53±0.17</td><td>16.46±0.25</td><td>89.30±0.94</td><td>8.08±0.53</td></tr><tr><td>GDumb</td><td>81.67±0.02</td><td>-</td><td>70.76±0.12</td><td>1</td></tr><tr><td>L2P-R (ours)</td><td>86.31±0.59</td><td>5.83±0.61</td><td>91.92±0.78</td><td>3.34±0.71</td></tr></table>
|
| 131 |
+
|
| 132 |
+
Table 2: Results on task-agnostic continual learning, in terms of test accuracy. We use Gaussian scheduled CIFAR-100 as the evaluation benchmark. All results are shown in percentage $( \% )$ and are averaged across 3 runs.
|
| 133 |
+
|
| 134 |
+
<table><tr><td>Category</td><td>Method</td><td>Test Acc (↑)</td></tr><tr><td>Upper bound</td><td>FT-iid</td><td>90.85±0.12</td></tr><tr><td rowspan="2">Rehearsal</td><td>ER</td><td>82.53±0.17</td></tr><tr><td>GDumb</td><td>81.67±0.02</td></tr><tr><td rowspan="3">Non-rehearsal</td><td>EWC</td><td>63.04±0.42</td></tr><tr><td>LwF</td><td>69.46±0.35</td></tr><tr><td>L2P (ours)</td><td>88.34±0.14</td></tr></table>
|
| 135 |
+
|
| 136 |
+
Table 3: Results on domain-incremental learning, in terms of test accuracy. We use CORe50 as the evaluation benchmark. All results are shown in percentage $( \% )$ and are averaged across 3 runs.
|
| 137 |
+
|
| 138 |
+
<table><tr><td>Category</td><td>Method</td><td>Test Acc (↑)</td></tr><tr><td>Upper bound</td><td>FT-iid</td><td>82.15 ±0.37</td></tr><tr><td rowspan="2">Rehearsal</td><td>ER</td><td>80.10±0.56</td></tr><tr><td>GDumb</td><td>74.92±0.25</td></tr><tr><td rowspan="3">Non-rehearsal</td><td>EWC</td><td>74.82±0.60</td></tr><tr><td>LwF</td><td>75.45±0.40</td></tr><tr><td>L2P (ours)</td><td>78.33±0.06</td></tr></table>
|
| 139 |
+
|
| 140 |
+
Table 1 summarizes the results on these two class-incremental benchmarks. Similar to what Mehta et al. (2021) have shown: in the simpler task-incremental setting, pre-trained models can overall improve these benchmarks when integrated with existing methods. However, the forgetting rate remains prominent in the class-incremental setting as we shown, suggesting the importance of innovating technologies in pre-trained models beyond applying existing methods.
|
| 141 |
+
|
| 142 |
+
Our method, L2P, achieves superior performance in terms of both average accuracy and forgetting. In particular, our method: (1) outperforms all non-rehearsal based methods by a large margin, including beating rehearsal-based methods on split CIFAR-100 without rehearsal; and (2) our method improves upon state-of-the-art rehearsal-based methods when incorporating the rehearsal strategy, closing a significant part of the gap to the upper bound performance when doing finetuning under the i.i.d. setting; and (3) compared to the performance of FT-seq-frozen with our method, we can see that naive sequential training is not able to fully take advantage of the pretrained features, further demonstrating the advantages of introducing the prompting strategy.
|
| 143 |
+
|
| 144 |
+
Table 4: Ablation study on 5-datasets. All results are shown in percentage $( \% )$ .
|
| 145 |
+
|
| 146 |
+
<table><tr><td>Method</td><td colspan="2">5-datasets</td></tr><tr><td></td><td>Average Acc (↑)</td><td>Forgetting (↓)</td></tr><tr><td>L2P without prompt pool</td><td>51.96</td><td>26.60</td></tr><tr><td>L2P without key-value pair</td><td>58.33</td><td>20.45</td></tr><tr><td>L2P without diversified prompt selection</td><td>62.26</td><td>17.84</td></tr><tr><td>L2P</td><td>81.14</td><td>4.64</td></tr></table>
|
| 147 |
+
|
| 148 |
+

|
| 149 |
+
Figure 3: Prompt selection histograms for (left) Split CIFAR-100 and (right) 5-datasets. Note that we only show the first 5 tasks for Split CIFAR-100 for better readability.
|
| 150 |
+
|
| 151 |
+
# 5.2 RESULTS ON TASK-AGNOSTIC AND DOMAIN INCREMENTAL SETTINGS
|
| 152 |
+
|
| 153 |
+
Gaussian scheduled CIFAR-100. In this task-agnostic setting, the distribution of data shifts gradually throughout the learning process (Shanahan et al., 2021), the probability that a class is present in a batch follows a Gaussian distribution centered at some time step. There is no explicit task boundaries between batches, thus requiring methods to be able to implicitly adapt to non-stationary data distribution without utilizing any task-specific information during training and inference.
|
| 154 |
+
|
| 155 |
+
Table 2 summarizes the results. L2P achieves the best performance among all methods, including rehearsal based ones. The task-agnostic setting is usually considered more challenging than the class-incremental setting. Since these two benchmarks have the same test test, we can compare them deeper. Interestingly, EWC and LwF both achieve higher accuracy than that on split CIFAR-100, indicating that a well-pretrained model itself may serve as a better starting point for task-agnostic continual learning. Similar observations has been reported on a simpler task-incremental setting in Mehta et al. (2021). Moreover, L2P achieves a test accuracy $8 8 . 3 4 \%$ , which is very close to the upper bound performance $9 0 . 8 5 \%$ shown in Table 1, suggesting strongly reduced forgetting rate.
|
| 156 |
+
|
| 157 |
+
CORe50. This is a dataset specifically designed for continual object recognition (Lomonaco & Maltoni, 2017). It is a collection of 50 objects collected in 11 distinct domains, where 8 of them (120,000 samples) are used for training, and the rest are considered as a single test set (45,000 examples). Methods are trained on each domain sequentially.
|
| 158 |
+
|
| 159 |
+
Table 3 summarizes the results on the domain-incremental setting. Although L2P still achieves better performance than most methods, surprisingly, all methods are quite close to the upper bound performance FT-iid. This indicates that a well pretrained model has the potential to accumulate knowledge from different domains without much interference. However, more comprehensive experiments are required to further confirm this observation, which we leave to future work.
|
| 160 |
+
|
| 161 |
+
# 5.3 EFFECTIVENESS OF CORE DESIGNS
|
| 162 |
+
|
| 163 |
+
We further conduct ablation studies to demonstrate the effectiveness of the core designs of L2P.
|
| 164 |
+
|
| 165 |
+
Prompt pool. To further confirm the importance of the prompt pool, we design a counterpart of our method with only a single prompt instead of the prompt pool. This variation of our method keeps the same prompt capacity as L2P in equation 2. From Table 4 (row 1 and 4), we can see that L2P significantly outperforms its counterpart with a single prompt, suggesting that the prompt pool encodes task-relevant and task-specific knowledge well.
|
| 166 |
+
|
| 167 |
+

|
| 168 |
+
Figure 4: Left-Middle: Average accuracy w.r.t prompt length $L _ { p }$ and prompt selection size $N$ for Split CIFAR-100 and 5-datasets, respectively, given $M = 2 0$ . Right: Average accuracy $( \% )$ w.r.t. prompt pool size $M$ , given $L _ { p } = 5$ , $N = 5$ for Split CIFAR-100 and $L _ { p } = 5$ , $N = 4$ for 5-datasets.
|
| 169 |
+
|
| 170 |
+
Key-value pair design. We remove the learnable key associated with prompts and directly use mean of prompts as keys and the mean of input embedding as query features, as they reside in the same space. From Table 4 (row 2), we can see this results in a significant drop, demonstrating the importance of introducing learnable keys to decouple the query and prompt learning process.
|
| 171 |
+
|
| 172 |
+
Diversified prompt selection. This technique is used by default on 5-dataset only. When we remove it, (Table 4 row 3), we basically allow instances from different tasks to choose prompts freely. The decrease in performance demonstrates that when tasks are diverse, adding the diversified prompt selection strategy can indeed reduce unnecessary knowledge sharing and thus mitigating interference between unrelated tasks.
|
| 173 |
+
|
| 174 |
+
To better understand the prompt selection mechanism, we plot the prompt selection histograms for each task in both split CIFAR-100 and 5-datasets in Figure 3 under the best-performing parameters settings, respectively. From the plot of Split CIFAR-100 (left), the tasks largely share all prompts, meaning that our prompt selection mechanism encourages more knowledge sharing between similar tasks. In contrast, in the plot of 5-datasets (right), diverse tasks tends to choose more task-specific prompts and share less.
|
| 175 |
+
|
| 176 |
+
Effect of hyperparameters for L2P. Recall that there are three key hyperparameters, including the size of the prompt pool $M$ , length of a single prompt $L _ { p }$ , and the selection size $N$ used as model input. Intuitively, $M$ decides the total capacity of learnable prompt parameters. $L _ { p }$ decides capacity of a singe prompt (which jointly encodes certain knowledge), and $L _ { p } \times N$ decides the total size used to prepend the input. From the results on both datasets (Figure 4 (left-middle)), a smaller $L _ { p }$ always negatively affects results. We hypothesize that a reasonable capacity of a single prompt is critical to encode a certain aspect of shared knowledge. Increasing the prompt pool size shows positive effect for performance as shown in Figure 4 (right), especially on 5-datasets, suggesting a large enough pool size is needed to encode task-specific knowledge when tasks are diverse.
|
| 177 |
+
|
| 178 |
+
# 6 CONCLUSION
|
| 179 |
+
|
| 180 |
+
This paper presents a novel method to address some of the key challenges in continual learning with a method that can achieve strong performance without a need for rehearsal and task identity. L2P introduces prompt-based learning to continual learning and proposes a novel technique to enable a single pre-trained model to adapt to sequential tasks via a shared prompt pool, successfully mitigating the catastrophic forgetting problem. The resulting method achieves good results on challenging continual learning problems, including class-incremental, domain-incremental, and task-agnostic settings, demonstrating the effectiveness of the method, as well as its advantages to satisfy the practical data privacy requirement when storing data as rehearsal buffer is prohibited.
|
| 181 |
+
|
| 182 |
+
Although our method is demonstrated on vision models, it does not make any assumption of modalities. We leave exploration on other modalities as future work. Additionally, L2P assumes there are pre-trained sequence-based models. While they have become common assets in advanced communities, how to generalize our framework to ConvNets could another appealing research direction.
|
| 183 |
+
|
| 184 |
+
# 7 ETHICS STATEMENT
|
| 185 |
+
|
| 186 |
+
L2P is a strong continual learning method and has great potential to be applied in various fields. However, there are some ways it could be misused. Our method takes a well-pretrained model as a backbone, thus any bias and fairness issues (Mehrabi et al., 2021) in the original model may be carried over during the continual learning process. We encourage any users to thoroughly check the pretrained model to mitigate any bias and fairness issues. Moreover, the method could be deployed in safety-critical applications, such as autonomous driving systems (Grigorescu et al., 2020), which may present potential security issues in terms of adversarial attacks (Madry et al., 2017). We would recommend testing the robustness of our method in future work and design corresponding defense techniques to deal with potential security concerns.
|
| 187 |
+
|
| 188 |
+
# 8 REPRODUCIBILITY
|
| 189 |
+
|
| 190 |
+
To make the results presented in our work reproducible, we include all experiment setups and details, evaluation metrics, and comparing methods in Section 5. We test our method on multiple publicly available datasets and under different settings. We report the average and corresponding standard deviations over multiple runs using different randoms seeds for our main results (Table 1, 2 and 3). Our results are also verified on different hardwares, including TPU and GPU. We plan to make the code publicly available upon acceptance.
|
| 191 |
+
|
| 192 |
+
# REFERENCES
|
| 193 |
+
|
| 194 |
+
Rahaf Aljundi, Francesca Babiloni, Mohamed Elhoseiny, Marcus Rohrbach, and Tinne Tuytelaars. Memory aware synapses: Learning what (not) to forget. In ECCV, 2018. 2
|
| 195 |
+
|
| 196 |
+
Yaroslav Bulatov. notmnist dataset, 2011. URL http://yaroslavvb.blogspot.com/ 2011/09/notmnist-dataset.html. 7
|
| 197 |
+
|
| 198 |
+
Pietro Buzzega, Matteo Boschini, Angelo Porrello, Davide Abati, and Simone Calderara. Dark experience for general continual learning: a strong, simple baseline. In NeurIPS, 2020. 6
|
| 199 |
+
|
| 200 |
+
Arslan Chaudhry, Marc’Aurelio Ranzato, Marcus Rohrbach, and Mohamed Elhoseiny. Efficient lifelong learning with a-gem. arXiv preprint arXiv:1812.00420, 2018. 3, 6
|
| 201 |
+
|
| 202 |
+
Arslan Chaudhry, Marcus Rohrbach, Mohamed Elhoseiny, Thalaiyasingam Ajanthan, Puneet K Dokania, Philip HS Torr, and Marc’Aurelio Ranzato. On tiny episodic memories in continual learning. arXiv preprint arXiv:1902.10486, 2019. 3, 6
|
| 203 |
+
|
| 204 |
+
Matthias Delange, Rahaf Aljundi, Marc Masana, Sarah Parisot, Xu Jia, Ales Leonardis, Greg Slabaugh, and Tinne Tuytelaars. A continual learning survey: Defying forgetting in classification tasks. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2021. 2
|
| 205 |
+
|
| 206 |
+
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. ICLR, 2021. 3, 6
|
| 207 |
+
|
| 208 |
+
Sayna Ebrahimi, Franziska Meier, Roberto Calandra, Trevor Darrell, and Marcus Rohrbach. Adversarial continual learning. In ECCV, 2020. 6
|
| 209 |
+
|
| 210 |
+
Alex Graves, Greg Wayne, Malcolm Reynolds, Tim Harley, Ivo Danihelka, Agnieszka GrabskaBarwinska, Sergio G ´ omez Colmenarejo, Edward Grefenstette, Tiago Ramalho, John Agapiou, ´ et al. Hybrid computing using a neural network with dynamic external memory. Nature, 538 (7626):471–476, 2016. 5
|
| 211 |
+
|
| 212 |
+
Sorin Grigorescu, Bogdan Trasnea, Tiberiu Cocias, and Gigel Macesanu. A survey of deep learning techniques for autonomous driving. Journal of Field Robotics, 37(3):362–386, 2020. 10
|
| 213 |
+
|
| 214 |
+
Raia Hadsell, Dushyant Rao, Andrei A Rusu, and Razvan Pascanu. Embracing change: Continual learning in deep neural networks. Trends in cognitive sciences, 2020. 1, 4
|
| 215 |
+
|
| 216 |
+
Tyler L Hayes, Nathan D Cahill, and Christopher Kanan. Memory efficient experience replay for streaming learning. In ICRA, 2019. 3, 6
|
| 217 |
+
|
| 218 |
+
Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015. 6
|
| 219 |
+
|
| 220 |
+
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. 6
|
| 221 |
+
|
| 222 |
+
James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, et al. Overcoming catastrophic forgetting in neural networks. PNAS, 114(13):3521–3526, 2017. 2, 6
|
| 223 |
+
|
| 224 |
+
Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009. 6
|
| 225 |
+
|
| 226 |
+
Ankit Kumar, Ozan Irsoy, Peter Ondruska, Mohit Iyyer, James Bradbury, Ishaan Gulrajani, Victor Zhong, Romain Paulus, and Richard Socher. Ask me anything: Dynamic memory networks for natural language processing. In ICML, 2016. 3
|
| 227 |
+
|
| 228 |
+
Yann LeCun. The mnist database of handwritten digits. http://yann. lecun. com/exdb/mnist/, 1998. 6
|
| 229 |
+
|
| 230 |
+
Brian Lester, Rami Al-Rfou, and Noah Constant. The power of scale for parameter-efficient prompt tuning. arXiv preprint arXiv:2104.08691, 2021. 1, 3, 4
|
| 231 |
+
|
| 232 |
+
Xiang Lisa Li and Percy Liang. Prefix-tuning: Optimizing continuous prompts for generation. arXiv preprint arXiv:2101.00190, 2021. 1, 3
|
| 233 |
+
|
| 234 |
+
Zhizhong Li and Derek Hoiem. Learning without forgetting. TPAMI, 40(12):2935–2947, 2017. 2, 6
|
| 235 |
+
|
| 236 |
+
Pengfei Liu, Weizhe Yuan, Jinlan Fu, Zhengbao Jiang, Hiroaki Hayashi, and Graham Neubig. Pretrain, prompt, and predict: A systematic survey of prompting methods in natural language processing. arXiv preprint arXiv:2107.13586, 2021. 1, 3, 4
|
| 237 |
+
|
| 238 |
+
Vincenzo Lomonaco and Davide Maltoni. Core50: a new dataset and benchmark for continuous object recognition. In Conference on Robot Learning, 2017. 6, 8
|
| 239 |
+
|
| 240 |
+
David Lopez-Paz and Marc’Aurelio Ranzato. Gradient episodic memory for continual learning. NeurIPS, 2017. 6
|
| 241 |
+
|
| 242 |
+
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. 10
|
| 243 |
+
|
| 244 |
+
Zheda Mai, Ruiwen Li, Jihwan Jeong, David Quispe, Hyunwoo Kim, and Scott Sanner. Online continual learning in image classification: An empirical survey. arXiv preprint arXiv:2101.10423, 2021. 1, 3, 6
|
| 245 |
+
|
| 246 |
+
Arun Mallya and Svetlana Lazebnik. Packnet: Adding multiple tasks to a single network by iterative pruning. In CVPR, 2018. 3
|
| 247 |
+
|
| 248 |
+
Bryan McCann, Nitish Shirish Keskar, Caiming Xiong, and Richard Socher. The natural language decathlon: Multitask learning as question answering. arXiv preprint arXiv:1806.08730, 2018. 3
|
| 249 |
+
|
| 250 |
+
Michael McCloskey and Neal J Cohen. Catastrophic interference in connectionist networks: The sequential learning problem. In Psychology of learning and motivation, volume 24, pp. 109–165. Elsevier, 1989. 1
|
| 251 |
+
|
| 252 |
+
Ninareh Mehrabi, Fred Morstatter, Nripsuta Saxena, Kristina Lerman, and Aram Galstyan. A survey on bias and fairness in machine learning. ACM Computing Surveys (CSUR), 54(6):1–35, 2021. 10
|
| 253 |
+
|
| 254 |
+
Sanket Vaibhav Mehta, Darshan Patil, Sarath Chandar, and Emma Strubell. An empirical investigation of the role of pre-training in lifelong learning. ICML Workshop on Theory and Foundation of Continual Learning, 2021. 7, 8
|
| 255 |
+
|
| 256 |
+
Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading digits in natural images with unsupervised feature learning. In NIPS, 2011. 6
|
| 257 |
+
|
| 258 |
+
Aaron van den Oord, Oriol Vinyals, and Koray Kavukcuoglu. Neural discrete representation learning. arXiv preprint arXiv:1711.00937, 2017. 5
|
| 259 |
+
|
| 260 |
+
German I Parisi, Ronald Kemker, Jose L Part, Christopher Kanan, and Stefan Wermter. Continual lifelong learning with neural networks: A review. Neural Networks, 113:54–71, 2019. 1, 3
|
| 261 |
+
|
| 262 |
+
Ameya Prabhu, Philip HS Torr, and Puneet K Dokania. Gdumb: A simple approach that questions our progress in continual learning. In ECCV, 2020. 6
|
| 263 |
+
|
| 264 |
+
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. 3
|
| 265 |
+
|
| 266 |
+
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, 21:1–67, 2020. 1, 3
|
| 267 |
+
|
| 268 |
+
Andrei A Rusu, Neil C Rabinowitz, Guillaume Desjardins, Hubert Soyer, James Kirkpatrick, Koray Kavukcuoglu, Razvan Pascanu, and Raia Hadsell. Progressive neural networks. arXiv preprint arXiv:1606.04671, 2016. 3
|
| 269 |
+
|
| 270 |
+
Timo Schick and Hinrich Schutze. Exploiting cloze questions for few shot text classification and ¨ natural language inference. arXiv preprint arXiv:2001.07676, 2020. 3
|
| 271 |
+
|
| 272 |
+
Murray Shanahan, Christos Kaplanis, and Jovana Mitrovic. Encoders and ensembles for task-free ´ continual learning. arXiv preprint arXiv:2105.13327, 2021. 6, 8
|
| 273 |
+
|
| 274 |
+
Taylor Shin, Yasaman Razeghi, Robert L Logan IV, Eric Wallace, and Sameer Singh. Autoprompt: Eliciting knowledge from language models with automatically generated prompts. arXiv preprint arXiv:2010.15980, 2020. 1
|
| 275 |
+
|
| 276 |
+
Reza Shokri and Vitaly Shmatikov. Privacy-preserving deep learning. In Proc SIGSAC conference on computer and communications security, 2015. 3
|
| 277 |
+
|
| 278 |
+
Gido M Van de Ven and Andreas S Tolias. Three scenarios for continual learning. arXiv preprint arXiv:1904.07734, 2019. 6
|
| 279 |
+
|
| 280 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. NeurIPS, 2017. 3
|
| 281 |
+
|
| 282 |
+
Zifeng Wang, Tong Jian, Kaushik Chowdhury, Yanzhi Wang, Jennifer Dy, and Stratis Ioannidis. Learn-prune-share for lifelong learning. In ICDM, 2020. 3
|
| 283 |
+
|
| 284 |
+
Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms. arXiv preprint arXiv:1708.07747, 2017. 6
|
| 285 |
+
|
| 286 |
+
Jaehong Yoon, Eunho Yang, Jeongtae Lee, and Sung Ju Hwang. Lifelong learning with dynamically expandable networks. arXiv preprint arXiv:1708.01547, 2017. 3
|
| 287 |
+
|
| 288 |
+
Friedemann Zenke, Ben Poole, and Surya Ganguli. Continual learning through synaptic intelligence. In ICML, 2017. 2
|
| 289 |
+
|
| 290 |
+
Chen Zeno, Itay Golan, Elad Hoffer, and Daniel Soudry. Task agnostic continual learning using online variational bayes. arXiv preprint arXiv:1803.10123, 2018. 6
|
md/dev/S5wmbQc1We/S5wmbQc1We.md
ADDED
|
@@ -0,0 +1,569 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# The Clock and the Pizza: Two Stories in Mechanistic Explanation of Neural Networks
|
| 2 |
+
|
| 3 |
+
Ziqian Zhong\*, Ziming Liu\*, Max Tegmark, Jacob Andreas Massachusetts Institute of Technology {ziqianz, zmliu, tegmark, jda}@mit.edu
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Do neural networks, trained on well-understood algorithmic tasks, reliably rediscover known algorithms for solving those tasks? Several recent studies, on tasks ranging from group arithmetic to in-context linear regression, have suggested that the answer is yes. Using modular addition as a prototypical problem, we show that algorithm discovery in neural networks is sometimes more complex. Small changes to model hyperparameters and initializations can induce discovery of qualitatively different algorithms from a fixed training set, and even parallel implementations of multiple such algorithms. Some networks trained to perform modular addition implement a familiar Clock algorithm (previously described by Nanda et al. [1]); others implement a previously undescribed, less intuitive, but comprehensible procedure we term the Pizza algorithm, or a variety of even more complex procedures. Our results show that even simple learning problems can admit a surprising diversity of solutions, motivating the development of new tools for characterizing the behavior of neural networks across their algorithmic phase space. 1
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
Mechanistically understanding deep network models—reverse-engineering their learned algorithms and representation schemes—remains a major challenge across problem domains. Several recent studies [2, 3, 4, 5, 1] have exhibited specific examples of models apparently re-discovering interpretable (and in some cases familiar) solutions to tasks like curve detection, sequence copying and modular arithmetic. Are these models the exception or the rule? Under what conditions do neural network models discover familiar algorithmic solutions to algorithmic tasks?
|
| 12 |
+
|
| 13 |
+
In this paper, we focus specifically on the problem of learning modular addition, training networks to compute sums like $8 + 6 = 2$ (mod 12). Modular arithmetic can be implemented with a simple geometric solution, familiar to anyone who has learned to read a clock: every integer is represented as an angle, input angles are added together, and the resulting angle evaluated to obtain a modular sum (Figure 1, left). Nanda et al. [1] show that specific neural network architectures, when trained to perform modular addition, implement this Clock algorithm. In this work, we show that the Clock algorithm is only one part of a more complicated picture of algorithm learning in deep networks. In particular, networks structurally similar to the ones trained by Nanda et al. preferentially implement a qualitatively different approach to modular arithmetic, which we term the Pizza algorithm (Figure 1, right), and sometimes even more complex solutions. Models exhibit sharp algorithmic phase transitions [6] between the Clock and Pizza algorithms as their width and attention strength very, and often implement multiple, imperfect copies of the Pizza algorithm in parallel.
|
| 14 |
+
|
| 15 |
+
Step 1: Embed token a and $b$ to a circle where $w _ { k } = 2 \pi k / p$ for some $k \in [ 1 , 2 ^ { \ldots } , p - 1 ]$
|
| 16 |
+
|
| 17 |
+
$$
|
| 18 |
+
a \mathbf { E } _ { a } \equiv ( \mathbf { E } _ { a , \mathrm { x } } , \mathbf { E } _ { a , \mathrm { y } } ) = ( \cos ( w _ { k } a ) , \sin ( w _ { k } a ) ) , b \mathbf { E } _ { b } \equiv ( \mathbf { E } _ { b , \mathrm { x } } , \mathbf { E } _ { b , \mathrm { y } } ) = ( \cos ( w _ { k } b ) , \sin ( w _ { k } b ) )
|
| 19 |
+
$$
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
|
| 23 |
+
# Clock Algorithm
|
| 24 |
+
|
| 25 |
+
# Pizza Algorithm
|
| 26 |
+
|
| 27 |
+
Step 2: compute the angle sum using multiplication.
|
| 28 |
+
|
| 29 |
+
Step 2.1: compute the vector mean.
|
| 30 |
+
|
| 31 |
+
$\mathbf { E } _ { a b } \equiv { \binom { \mathbf { E } _ { a b , x } } { \mathbf { E } _ { a b , y } } } = { \binom { \mathbf { E } _ { a , x } \mathbf { E } _ { b , x } - \mathbf { E } _ { a , y } \mathbf { E } _ { b , y } } { \mathbf { E } _ { a , x } \mathbf { E } _ { b , y } + \mathbf { E } _ { a , y } \mathbf { E } _ { b , x } } } = { \binom { \cos ( w _ { k } ( a + b ) ) } { \sin ( w _ { k } ( a + b ) ) } }$ Hab = Eab
|
| 32 |
+
|
| 33 |
+
$$
|
| 34 |
+
\mathbf { E } _ { a b } = ( \mathbf { E } _ { a } + \mathbf { E } _ { b } ) / 2 = ( \cos ( w _ { k } a ) + \cos ( w _ { k } b ) , \sin ( w _ { k } a ) + \sin ( w _ { k } b ) ) / 2
|
| 35 |
+
$$
|
| 36 |
+
|
| 37 |
+
Step 2.2: using $\mathbf { E } _ { a b }$ and nonlinearities to compute $\mathbf { H } _ { a b }$
|
| 38 |
+
|
| 39 |
+
$$
|
| 40 |
+
\mathbf { H } _ { a b } = | \cos ( w _ { k } ( a - b ) / 2 ) | ( \cos ( w _ { k } ( a + b ) ) , \sin ( w _ { k } ( a + b ) ) )
|
| 41 |
+
$$
|
| 42 |
+
|
| 43 |
+
Step 3: score possible outputs $c$ using a dot product.
|
| 44 |
+
|
| 45 |
+
$Q _ { a b c } = \mathbf { U } _ { c } \cdot \mathbf { H } _ { a b }$ , Uc ≡ (Ec,x, Ec,y) = (cos(wkc), sin(wkc))
|
| 46 |
+
|
| 47 |
+

|
| 48 |
+
Figure 1: Illustration of the Clock and the Pizza Algorithm.
|
| 49 |
+
|
| 50 |
+
Our results highlight the complexity of mechanistic description in even models trained to perform simple tasks. They point to characterization of algorithmic phase spaces, not just single algorithmic solutions, as an important goal in algorithm-level interpretability.
|
| 51 |
+
|
| 52 |
+
Organization In Section 2, we review the Clock algorithm [1] and show empirical evidence of deviation from it in models trained to perform modular addition. In Section 3, we show that these deviations can be explained by an alternative Pizza algorithm. In Section 4, we define additional metrics to distinguish between these algorithms, and detect phase transitions between these algorithms (and others Non-circular algorithms) when architectures and hyperparameters are varied. We discuss the relationship between these findings and other work on model interpretation in Section 5, and conclude in Section 6.
|
| 53 |
+
|
| 54 |
+
# 2 Modular Arithmetic and the Clock Algorithm
|
| 55 |
+
|
| 56 |
+
Setup We train neural networks to perform modular addition $a + b = c ( \mathrm { m o d } p )$ , where $a , b , c =$ $0 , 1 , \cdots , p - 1$ . We use $p = 5 9$ throughout the paper. In these networks, every integer $t$ has an associated embedding vector $\mathbf { E } _ { t } \in \mathbb { R } ^ { d }$ . Networks take as input embeddings $[ \dot { \mathbf { E } _ { a } } , \mathbf { E } _ { b } ] ^ { \mathbf { ^ { \prime } } } \in \mathbb { R } ^ { 2 d }$ and predict a categorical output $c$ . Both embeddings and network parameters are learned. In preliminary experiments, we train two different network architectures on the modular arithmetic task, which we refer to as: Model A and Model B. Model A is a one-layer ReLU transformer [7] with constant attention, while Model $\mathbf { B }$ is a standard one-layer ReLU transformer (see Appendix F.1 for details). As attention is not involved in Model A, it can also be understood as a ReLU MLP (Appendix G).
|
| 57 |
+
|
| 58 |
+
# 2.1 Review of the Clock Algorithm
|
| 59 |
+
|
| 60 |
+
As in past work, we find that after training both Model A and Model B, embeddings $( \mathbf { E } _ { a } , \mathbf { E } _ { b }$ in Figure 1) usually describe a circle [8] in the plane spanned by the first two principal components of the embedding matrix. Formally, $\mathbf { E } _ { a } \approx [ \cos ( w _ { k } a ) , \bar { \sin ( w _ { k } a ) } ]$ where $w _ { k } = 2 \pi k / p$ , $k$ is an integer in $[ 1 , p - 1 ]$ . Nanda et al. [1] discovered a circuit that uses these circular embeddings to implement an interpretable algorithm for modular arithmetic, which we call the Clock algorithm.
|
| 61 |
+
|
| 62 |
+
Table 1: Different neural algorithms for modular addition
|
| 63 |
+
|
| 64 |
+
<table><tr><td>Algorithm</td><td>Learned Embeddings</td><td>GradientSymmetry</td><td>Required Non-linearity</td></tr><tr><td>Clock</td><td>Circle</td><td>No</td><td>Multiplication</td></tr><tr><td>Pizza</td><td>Circle</td><td>Yes</td><td>Absolute value</td></tr><tr><td>Non-circular</td><td>Line,Lissajous-like curves, etc.</td><td>N/A</td><td>N/A</td></tr></table>
|
| 65 |
+
|
| 66 |
+
"If a meeting starts at 10, and lasts for 3 hours, then it will end at 1." This familiar fact is a description of a modular sum, $1 0 + 3 = 1$ (mod 12), and the movement of a clock describes a simple algorithm for modular arithmetic: the numbers 1 through 12 are arranged on a circle in $3 6 0 ^ { \circ } / 1 2 = 3 0 ^ { \circ }$ increments, angles of $1 0 \times 3 0 ^ { \circ }$ and $3 \times 3 0 ^ { \circ }$ are added together, then this angle is evaluated to determine that it corresponds to $1 \times 3 0 ^ { \circ }$ .
|
| 67 |
+
|
| 68 |
+
Remarkably, Nanda et al. [1] find that neural networks like our Model B implement this Clock algorithm, visualized in Figure 1 (left): they represent tokens $a$ and $b$ as 2D vectors, and adding their polar angles using trigonometric identities. Concretely, the Clock algorithm consists of three steps: In step 1, tokens $a$ and $b$ are embedded as ${ \bf E } _ { a } = [ \cos ( \dot { w _ { k } } a ) , \sin ( w _ { k } a ) \bar { ] }$ and $\mathbf { E } _ { b } = [ \cos ( w _ { k } b ) , \sin ( \bar { w } _ { k } b ) ]$ , respectively, where $w _ { k } = 2 \pi k / p$ (an everyday clock has $p = 1 2$ and $k = 1$ ). Then the polar angles of $\mathbf { E } _ { a }$ and $\mathbf { E } _ { b }$ are added (in step 2) and extracted (in step 3) via trigonometric identities. For each candidate output $c$ , we denote the logit $Q _ { a b c }$ ; the predicted output is $c ^ { * } = \operatorname { a r g m a x } _ { c } Q _ { a b c }$ .
|
| 69 |
+
|
| 70 |
+
Crucial to this algorithm is the fact that the attention mechanism can be leveraged to perform multiplication. What happens in model variants when the attention mechanism is absent, as in Model A? We find two pieces of evidence of deviation from the Clock algorithm in Model A.
|
| 71 |
+
|
| 72 |
+
# 2.2 First Evidence for Clock Violation: Gradient Symmetricity
|
| 73 |
+
|
| 74 |
+
Since the Clock algorithm has logits:
|
| 75 |
+
|
| 76 |
+
$$
|
| 77 |
+
Q _ { a b c } ^ { \mathrm { C l o c k } } = ( { \bf E } _ { a , x } { \bf E } _ { b , x } - { \bf E } _ { a , y } { \bf E } _ { b , y } ) { \bf E } _ { c , x } + ( { \bf E } _ { a , x } { \bf E } _ { b , y } + { \bf E } _ { a , y } { \bf E } _ { b , x } ) { \bf E } _ { c , y } ,
|
| 78 |
+
$$
|
| 79 |
+
|
| 80 |
+
(see Figure 1) the gradients of $Q _ { a b c }$ generically lack permutation symmetry in argument order: $\nabla _ { \mathbf { E } _ { a } } Q _ { a b c } \neq \nabla _ { \mathbf { E } _ { b } } Q _ { a b c }$ . Thus, if learned models exhibit permutation symmetry $( \nabla _ { \mathbf { E } _ { a } } Q _ { a b c } ~ =$ $\nabla _ { \mathbf { E } _ { b } } Q _ { a b c } )$ , they must be implementing some other algorithm.
|
| 81 |
+
|
| 82 |
+
We compute the 6 largest principal components of the input embedding vectors. We then compute the gradients of output logits (unnormalized log-probabilities from the model) with respect to the input embeddings. We then project them onto these 6 principal components (since the angles relevant to the Clock and Pizza algorithms are encoded in the first few principal components). These projections are shown in Figure 2. While Model B demonstrates asymmetry in general, Model A exhibits gradient symmetry.
|
| 83 |
+
|
| 84 |
+

|
| 85 |
+
Figure 2: Gradients on first six principal components of input embeddings. $( a , b , c )$ in the title stands for taking gradients on the output logit $c$ for input $( a , b )$ . x and y axes represent the gradients for embeddings of the first and the second token. The dashed line $y = x$ signals a symmetric gradient.
|
| 86 |
+
|
| 87 |
+
# 2.3 Second Evidence for Clock Violation: Logit Patterns
|
| 88 |
+
|
| 89 |
+
Inspecting models’ outputs, in addition to inputs, reveals further differences. For each input pair $( a , b )$ , we compute the output logit assigned to the correct label $a + b$ . We visualize these correct logits from Models A and B in Figure 3. Notice that the rows are indexed by $a - b$ and the columns by $a + b$ . From Figure 3, we can see that the correct logits of Model A have a clear dependency on $a - b$ in that within each row, the correct logits are roughly the same, while this pattern is not observed in Model B. This suggests that Models A and B are implementing different algorithms.
|
| 90 |
+
|
| 91 |
+

|
| 92 |
+
Figure 3: Correct Logits of Model A & Model B. The correct logits of Model A (left) have a clear dependence on $a - b$ , while those of Model B (right) do not.
|
| 93 |
+
|
| 94 |
+
# 3 An Alternative Solution: the Pizza Algorithm
|
| 95 |
+
|
| 96 |
+
How does Model A perform modular arithmetic? Whatever solution it implements must exhibit gradient symmetricity in Figure 2 and the output patterns in Figure 3. In this section, we describe a new algorithm for modular arithmetic, which we call the Pizza algorithm, and then provide evidence that this is the procedure implemented by Model A.
|
| 97 |
+
|
| 98 |
+
# 3.1 The Pizza Algorithm
|
| 99 |
+
|
| 100 |
+
Unlike the Clock algorithm, the Pizza algorithm operates inside the circle formed by embeddings (just as pepperoni are spread all over a pizza), instead of operating on the circumference of the circle. The basic idea is illustrated in Figure 1: given a fixed label $c$ , for all $( a , b )$ with $a + b = c$ (mod $p$ ), the points ${ \bf E } _ { a b } = ( { \bf E } _ { a } + { \bf E } _ { b } ) / 2$ lie on a line though the origin of a 2D plane, and the points closer to this line than to the lines corresponding to any other $c$ form two out of $2 p$ mirrored “pizza slices”, as shown at the right of the figure. Thus, to perform modular arithmetic, a network can determine which slice pair the average of the two embedding vectors lies in. Concretely, the $P$ izza algorithm also consists of three steps. Step 1 is the same as in the Clock algorithm: the tokens $a$ and $b$ are embedded at $\mathbf { E } _ { a } = ( \cos ( \bar { w } _ { k } a ) , \bar { \sin } ( w _ { k } a ) )$ and $\mathbf { E } _ { b } = ( \cos ( w _ { k } b ) , \sin ( w _ { k } b ) )$ , respectively. Step 2 and Step 3 are different from the Clock algorithm. In Step 2.1, $\mathbf { E } _ { a }$ and $\mathbf { E } _ { b }$ are averaged to produce an embedding $\mathbf { E } _ { a b }$ . In Step 2.2 and Step 3, the polar angle of ${ \bf E } _ { a b }$ is (implicitly) computed by computing the logit $Q _ { a b c }$ for any possible outputs $c$ . While one possibility of doing so is to take the absolute value of the dot product of ${ \bf E } _ { a b }$ with $( \cos ( w _ { k } c / 2 ) , \sin ( w _ { k } c / 2 ) )$ , it is not commonly observed in neural networks (and will result in a different logit pattern). Instead, Step 2.2 transforms ${ \bf E } _ { a b }$ into a vector encoding $| \cos ( w _ { k } ( a - b ) / 2 ) | ( \cos ( w _ { k } ( a + b ) \bar { ) } , \sin ( w _ { k } ( a + b ) ) )$ , which is then dotted with the output embedding $U _ { c } = ( \cos ( w _ { k } c ) , \sin ( w _ { k } c ) )$ . Finally, the prediction is $c ^ { * } = \operatorname { a r g m a x } _ { c } Q _ { a b c }$ . See Appendix A and Appendix $\mathrm { L }$ for a more detailed analysis of a neural circuit that computes ${ \mathbf { H } } _ { a b }$ in a real network.
|
| 101 |
+
|
| 102 |
+
The key difference between the two algorithms lies in what non-linear operations are required: Clock requires multiplication of inputs in Step 2, while Pizza requires only absolute value computation, which is easily implemented by the ReLU layers. If neural networks lack inductive biases toward implementing multiplication, they may be more likely to implement Pizza rather than Clock, as we will verify in Section 4.
|
| 103 |
+
|
| 104 |
+
# 3.2 First Evidence for Pizza: Logit Patterns
|
| 105 |
+
|
| 106 |
+
Both the Clock and Pizza algorithms compute logits $Q _ { a b c }$ in Step 3, but they have different forms, shown in Figure 1. Specifically, $Q _ { a b c } ( P i z z a )$ has an extra multiplicative factor $\vert \cos ( w _ { k } ( a - b ) / 2 ) \vert$ compared to $Q _ { a b c } ( C l o c k )$ . As a result, given $c = a + b$ , $Q _ { a b c } ( P i z z a )$ is dependent on $a - b$ , but $Q _ { a b c } ( C l o c k )$ is not. The intuition for the dependence is that a sample is more likely to be classified correctly if ${ \bf E } _ { a b }$ is longer. The norm of this vector depends on $a - b$ . As we observe in Figure 3, the logits in Model A indeed exhibit a strong dependence on $a - b$ .
|
| 107 |
+
|
| 108 |
+
# 3.3 Second Evidence for Pizza: Clearer Logit Patterns via Circle Isolation
|
| 109 |
+
|
| 110 |
+
To better understand the behavior of this algorithm, we replace the embedding matrix $\mathbf { E }$ with a series of rank-2 approximations: using only the first and second principal components, or only the third and fourth, etc. For each such matrix, embeddings lie in a a two-dimensional subspace. For both Model A and Model B, we find that embeddings form a circle in this subspace (Figure 4 and Figure 5, bottom). We call this procedure circle isolation. Even after this drastic modification to the trained models’ parameters, both Model A and Model B continue to behave in interpretable ways: a subset of predictions remain highly accurate, with this subset determined by the periodicity of the $k$ of the isolated circle. As predicted by the Pizza and Clock algorithms described in Figure 1, Model A’s accuracy drops to zero at specific values of $a - b$ , while Model B’s accuracy is invariant in $a - b$ . Applying circle isolation to Model A on the two principal components (one circle) yields a model with $3 2 . 8 \%$ overall accuracy, while retaining the first six principal components (three circles) yields an overall accuracy of $9 1 . 4 \%$ . See Appendix D for more discussion. By contrast, Model B achieves $1 0 0 \%$ when embeddings are truncated to the first six principal components. Circle isolation thus reveals an error correction mechanism achieved via ensembling: when an algorithm (clock or pizza) exhibits systematic errors on subset of inputs, models can implement multiple algorithm variants in parallel to obtain more robust predictions.
|
| 111 |
+
|
| 112 |
+

|
| 113 |
+
Figure 4: Correct logits of Model A $( P i z z a )$ after circle isolation. The rightmost pizza is accompanying the third pizza (discussed in Section 3.4 and Appendix D). Top: The logit pattern depends on $a - b$ . Bottom: Embeddings for each circle.
|
| 114 |
+
|
| 115 |
+
Using these isolated embeddings, we may additionally calculate the isolated logits directly with formulas in Figure 1 and compare with the actual logits from Model A. Results are displayed in Table 2. We find that $Q _ { a b c } ( P i z z a )$ explains substantially more variance than $Q _ { a b c } ( C l o c k )$ .
|
| 116 |
+
|
| 117 |
+
Why do we only analyze correct logits? The logits from the $P i z z a$ algorithm are given by $Q _ { a b c } ( P i z z a ) = | \cos ( w _ { k } ( a - b ) / 2 ) | \cos ( w _ { k } ( a +$ b − c)). By contrast, the Clock algorithm has logits $Q _ { a b c } ( C l o c k ) = \cos ( w _ { k } ( a + b - c ) )$ . In a word, $Q _ { a b c } ( P i z z a )$ has an extra multiplicative factor $\vert \cos ( w _ { k } ( a - b ) / 2 ) \vert$ compared to $Q _ { a b c } ( C l o c k )$ . By constraining $c = a + b$ (thus $\cos ( w _ { k } ( a + b - c ) ) = 1 \rangle$ , the factor $\vert \cos ( w _ { k } ( a - b ) / 2 ) \vert$ can be identified.
|
| 118 |
+
|
| 119 |
+
(Unexpected) dependence of logits $Q _ { a b c } ( C l o c k )$ on $a + b$ : Although our analysis above expects logits $Q _ { a b c } ( C l o c k )$ not to depend on $a - b$ , they do not predict its dependence on $a + b$ . In Figure 5, we surprisingly find that $Q _ { a b c } ( C l o c k )$ is sensitive to this sum. Our conjecture is that Step 1 and Step 2 of the Clock are implemented (almost) noiselessly, such that same-label samples collapse to the same point after Step 2. However, Step 3 (classification) is imperfect after circle isolation, resulting in fluctuations of logits. Inputs with common sums $a + b$ produce the same logits.
|
| 120 |
+
|
| 121 |
+

|
| 122 |
+
Figure 5: Correct logits of Model B (Clock) after circle isolation. Top: The logit pattern depends on $a + b$ . Bottom: Embeddings for each circle.
|
| 123 |
+
|
| 124 |
+
$$
|
| 125 |
+
\frac { \mathrm { C i r c l e ~ \left| ~ \right.} w _ { k } } { \# 1 } \frac { w _ { k } } { 2 \pi / 5 9 \cdot 1 7 ~ \frac { \ d / { \operatorname { Q } _ { a b c } ( \mathrm { c l o c k } ) } \mathrm { F V E } } { 7 5 . 4 1 \% } \frac { \ d / { Q _ { a b c } ( \mathrm { p i z z a } ) } \mathrm { F V E } } { 9 9 . 1 8 \% } }
|
| 126 |
+
$$
|
| 127 |
+
|
| 128 |
+
Table 2: After isolating circles in the input embedding, fraction of variance explained (FVE) of all Model A’s output logits $( 5 9 \times 5 9 \times 5 9$ of them) by various formulas. Both model output logits and formula results’ are normalized to mean 0 variance 1 before taking FVE. $w _ { k }$ ’s are calculated according to the visualization. For example, distance between 0 and 1 in Circle #1 is 17, so $w _ { k } = 2 \pi / 5 9 \cdot 1 7$ .
|
| 129 |
+
|
| 130 |
+
# 3.4 Third Evidence for Pizza: Accompanied & Accompanying Pizza
|
| 131 |
+
|
| 132 |
+
The Achilles’ heel of the Pizza algorithm is antipodal pairs. If two inputs $( a , b )$ happen to lie antipodally, then their middle point will lie at the origin, where the correct “pizza slice” is difficult to identify. For example in Figure 1 right, antipodal pairs are (1,7), (2,8), (3,9) etc., whose middle points all collapse to the origin, but their class labels are different. Models cannot distinguish between, and thus correctly classify, these pairs. Even for odd $p$ ’s where there are no strict antipodal pairs, approximately antipodal pairs are also more likely to be classified incorrectly than non-antipodal pairs.
|
| 133 |
+
|
| 134 |
+
Intriguingly, neural networks find a clever way to compensate for this failure mode. we find that pizzas usually come with “accompanying pizzas”. An accompanied pizza and its accompanying pizza complement each other in the sense that near-antipodal pairs in the accompanied pizza become adjacent or close (i.e, very non-antipodal) in the accompanying pizza. If we denote the difference between adjacent numbers on the circle as $\delta$ and $\delta _ { 1 }$ , $\delta _ { 2 }$ for accompanied and accompanying pizzas, respectively, then $\delta _ { 1 } = 2 \delta _ { 2 }$ (mod $p$ ). In the experiment, we found that pizzas #1/#2/#3 in Figure 4 all have accompanying pizzas, which we call pizzas #4/#5/#6 (see Appendix D for details). However, these accompanying pizzas do not play a significant role in final model predictions 2. We conjecture that training dynamics are as follows: (1) At initialization, pizzas #1/#2/#3 correspond to three different “lottery tickets” [9]. (2) In early stages of training, to compensate the weaknesses (antipodal pairs) of pizzas #1/#2/#3, pizzas #4/#5/#6 are formed. (3) As training goes on (in the presence of weight decay), the neural network gets pruned. As a result, pizzas #4/#5/#6 are not significantly involved in prediction, although they continue to be visible in the embedding space.
|
| 135 |
+
|
| 136 |
+
# 4 The Algorithmic Phase Space
|
| 137 |
+
|
| 138 |
+
In Section 3, we have demonstrated a typical Clock (Model A) and a typical Pizza (Model B). In this section, we study how architectures and hyperparametes govern the selection of these two algorithmic “phases”. In Section 4.1, we propose quantitative metrics that can distinguish between Pizza and Clock. In Section 4.2, we observe how these metrics behave with different architectures and hyperparameters, demonstrating sharp phase transitions. The results in this section focus Clock and Pizza models, but other algorithmic solutions to modular addition are also discovered, and explored in more detail in Appendix B.
|
| 139 |
+
|
| 140 |
+
# 4.1 Metrics
|
| 141 |
+
|
| 142 |
+
We wish to study the distribution of Pizza and Clock algorithms statistically, which will require us to distinguish between two algorithms automatically. In order to do so, we formalize our observations in Section 2.2 and 2.3, arriving at two metrics: gradient symmetricity and distance irrelevance.
|
| 143 |
+
|
| 144 |
+
# 4.1.1 Gradient Symmetricity
|
| 145 |
+
|
| 146 |
+
To measure the symmetricity of the gradients, we select some input-output group $( a , b , c )$ , compute the gradient vectors for the output logit at position $c$ with respect to the input embeddings, and then compute the cosine similarity. Taking the average over many pairs yields the gradient symmetricity. Definition 4.1 (Gradient Symmetricity). For a fixed set $S \subseteq \mathbb { Z } _ { p } ^ { 3 }$ of input-output pairs3, define gradient-symmetricity of a network $M$ with embedding layer $E$ as
|
| 147 |
+
|
| 148 |
+
$$
|
| 149 |
+
s _ { g } \equiv \frac { 1 } { | S | } \sum _ { ( a , b , c ) \in S } s i m \left( \frac { \partial Q _ { a b c } } { \partial { \bf E } _ { a } } , \frac { \partial Q _ { a b c } } { \partial { \bf E } _ { b } } \right) ,
|
| 150 |
+
$$
|
| 151 |
+
|
| 152 |
+
where $\begin{array} { r } { s i m ( a , b ) = \frac { a \cdot b } { | a | | b | } } \end{array}$ is the cosine-similarity, $Q _ { a b c }$ is the logit for class $c$ given input a and b. It is clear that $s _ { g } \in [ - 1 , 1 ]$ .
|
| 153 |
+
|
| 154 |
+
As we discussed in Section 2.2, the Pizza algorithm has symmetric gradients while the Clock algorithm has asymmetric ones. Model A and Model B in Section 3 have gradient symmetricity $9 9 . 3 \hat { 7 } \%$ and $3 3 . 3 6 \%$ , respectively (Figure 2).
|
| 155 |
+
|
| 156 |
+
# 4.1.2 Distance Irrelevance
|
| 157 |
+
|
| 158 |
+
To measure the dependence of correct logits on differences between two inputs, which reflect the distances of the inputs on the circles, we measure how much of the variance in the correct logit matrix depends on it. We do so by comparing the average standard deviation of correct logits from inputs with the same differences and the standard deviation from all inputs.
|
| 159 |
+
|
| 160 |
+
Definition 4.2 (Distance Irrelevance). For some network $M$ with correct logit matrix $L$ $( L _ { i , j } =$ $Q _ { i j , i + j } )$ , define its distance irrelevance as
|
| 161 |
+
|
| 162 |
+
$$
|
| 163 |
+
q \equiv \frac { \frac { 1 } { p } \sum _ { d \in \mathbb { Z } _ { p } } \operatorname { s t d } \left( L _ { i , i + d } \mid i \in \mathbb { Z } _ { p } \right) } { \operatorname { s t d } \left( L _ { i , j } \mid i , j \in \mathbb { Z } _ { p } ^ { 2 } \right) } ,
|
| 164 |
+
$$
|
| 165 |
+
|
| 166 |
+
where std computes the standard deviation of a set. It is clear that $q \in [ 0 , 1 ]$
|
| 167 |
+
|
| 168 |
+
Model A and Model B in Section 3 give distance irrelevance 0.17 and 0.85, respectively (Figure 3). A typical distance irrelevance from the Pizza algorithm ranges from 0 to 0.4 while a typical distance irrelevance from Clock algorithm ranges from 0.4 to 1.
|
| 169 |
+
|
| 170 |
+
# 4.1.3 Which Metric is More Decisive?
|
| 171 |
+
|
| 172 |
+
When the two metrics have conflicting results, which one is more decisive? We consider distance irrelevance as the decisive factor of the Pizza algorithm, as the output logits being dependent on the distance is highly suggestive of Pizza. On the other hand, gradient symmetricity can be used to rule out the Clock algorithm, as it requires multiplying (transformed) inputs which will result in asymmetric gradients. Figure 6 confirmed that at low distance irrelevance (suggesting pizza) the gradient symmetricity is almost always close to 1 (suggesting non-clock).
|
| 173 |
+
|
| 174 |
+

|
| 175 |
+
Figure 6: Distance irrelevance vs gradient symmetricity over all the main experiments.
|
| 176 |
+
|
| 177 |
+
# 4.2 Identifying algorithmic phase transitions
|
| 178 |
+
|
| 179 |
+
How do models “choose” whether to implement the Clock or Pizza algorithm? We investigate this question by interpolating between Model A (transformer without attention) and Model B (transformer with attention). To do so, we introduce a new hyperparameter $\alpha$ we call the attention rate.
|
| 180 |
+
|
| 181 |
+
For a model with attention rate $\alpha$ , we modify the attention matrix $M$ for each attention head to be $M ^ { \prime } = M \alpha + J ( 1 - \alpha )$ . In other words, we modify this matrix to consist of a linear interpolation between the all-one matrix and the original attention (post-softmax), with the rate $\alpha$ controlling how much of the attention is kept. The transformer with and without attention corresponds to the case where $\alpha = 1$ (attention kept) and $\alpha = 0$ (constant attention matrix). With this parameter, we can control the balance of attention versus linear layers in transformers.
|
| 182 |
+
|
| 183 |
+
We performed the following set of experiments on transformers (see Appendix F.1 for architecture and training details). (1) One-layer transformers with width 128 and attention rate uniformly sampled in $[ 0 , 1 ]$ (Figure 7). (2) One-layer transformers with width log-uniformly sampled in [32, 512] and attention rate uniformly sampled in $[ 0 , 1 ]$ (Figure 7). (3) Transformers with 2 to 4 layers, width 128 and attention rate uniformly sampled in $[ 0 , 1 ]$ (Figure 11).
|
| 184 |
+
|
| 185 |
+
The Pizza and the Clock algorithms are the dominating algorithms with circular embeddings. For circular models, most observed models either have low gradient symmetricity (corresponding to the Clock algorithm) or low distance irrelevance (corresponding to the Pizza algorithm).
|
| 186 |
+
|
| 187 |
+
Two-dimensional phase change observed for attention rate and layer width. For the fixedwidth experiment, we observed a clear phase transition from the Pizza algorithm to the Clock algorithm (characterized by gradient symmetricity and distance irrelevance). We also observe an almost linear phase boundary with regards to both attention rate and layer width. In other words, the attention rate transition point increases as the model gets wider.
|
| 188 |
+
|
| 189 |
+
Dominance of linear layers determines whether the Pizza or the Clock algorithm is preferred. For one-layer transformers, we study the transition point against the attention rate and the width:
|
| 190 |
+
|
| 191 |
+
• The Clock algorithm dominates when the attention rate is higher than the phase change point, and the Pizza algorithm dominates when the attention rate is lower than the point. Our explanation is: At a high attention rate, the attention mechanism is more prominent in the network, giving rise to the clock algorithm. At a low attention rate, the linear layers are more prominent, giving rise to the pizza algorithm. • The phase change point gets higher when the model width increases. Our explanation is: When the model gets wider, the linear layers become more capable while the attention mechanism receive less benefit (attentions remain scalars while outputs from linear layers become wider vectors). The linear layer therefore gets more prominence with a wider model.
|
| 192 |
+
|
| 193 |
+
Possibly hybrid algorithms between the Clock and the Pizza algorithms. The continuous phase change suggests the existence of networks that lie between the Clock and the Pizza algorithms. This is achievable by having some principal components acting as the Clock and some principal components acting as the Pizza.
|
| 194 |
+
|
| 195 |
+

|
| 196 |
+
Figure 7: Training results from 1-layer transformers. Each point in the plots represents a training run reaching circular embeddings and $100 \%$ validation accuracy. See Appendix C for additional plots. Top: Model width fixed to be 128. Bottom: Model width varies. The phase transition lines are calculated by logistic regression (classify the runs by whether gradient symmetricity $> 9 8 \%$ and whether distance irrelevance $< 0 . 6$ ).
|
| 197 |
+
|
| 198 |
+
Existence of non-circular algorithms. Although our presentation focuses on circular algorithms (i.e., whose embeddings are circular), we find non-circular algorithms (i.e., whose embeddings do not form a circle when projected onto any plane) to be present in neural networks. See Appendix B for preliminary findings. We find that deeper networks are more likely to form non-circular algorithms. We also observe the appearance of non-circular networks at low attention rates. Nevertheless, the Pizza algorithm continues to be observed (low distance irrelevance, high gradient symmetricity).
|
| 199 |
+
|
| 200 |
+
# 5 Related Work
|
| 201 |
+
|
| 202 |
+
Mechanistic interpretability aims to mechanically understand neural networks by reverse engineering them [2, 3, 5, 4, 10, 11, 1, 12, 13, 14]. One can either look for patterns in weights and activations by studying single-neuron behavior (superposition [11], monosemantic neurons [15]), or study meaningful modules or circuits grouped by neurons [4, 14]. Mechanistic interpretability is closely related to training dynamics [8, 13, 1].
|
| 203 |
+
|
| 204 |
+
Learning mathematical tasks: Mathematical tasks provide useful benchmarks for neural network interpretability, since the tasks themselves are well understood. The setup could be learning from images [16, 17], with trainable embeddings [18], or with number as inputs [19, 5]. Beyond arithmetic relations, machine learning has been applied to learn other mathematical structures, including geometry [20], knot theory [21] and group theory [22].
|
| 205 |
+
|
| 206 |
+
Algorithmic phase transitions: Phase transitions are present in classical algorithms [23] and in deep learning [6, 24, 25]. Usually the phase transition means that the algorithmic performance sharply changes when a parameter is varied (e.g., amount of data, network capacity etc). However, the phase transition studied in this paper is representational: both clock and pizza give perfect accuracy, but arrive at answers via different interal computations. These model-internal phase transitions are harder to study, but closer to corresponding phenomena in physical systems [24].
|
| 207 |
+
|
| 208 |
+
Algorithm learning in neural networks: Emergent abilities in deep neural networks, especially large language models, have recently attracted significant attention [26]. An ability is “emergent” if the performance on a subtask suddenly increases with growing model sizes, though such claims depend on the choice of metric [27]. It has been hypothesized that the emergence of specific capability in a model corresponds to the emergence of a modular circuit responsible for that capability, and that emergence of some model behaviors thus results from a sequence of quantized circuit discovery steps [5].
|
| 209 |
+
|
| 210 |
+
# 6 Conclusions
|
| 211 |
+
|
| 212 |
+
We have offered a closer look at recent findings that familiar algorithms arise in neural networks trained on specific algorithmic tasks. In modular arithmetic, we have shown that such algorithmic discoveries are not inevitable: in addition to the Clock algorithm reverse-engineered by [1], we find other algorithms (including a Pizza algorithm, and more complicated procedures) to be prevalent in trained models. These different algorithmic phases can be distinguished using a variety of new and existing interpretability techniques, including logit visualization, isolation of principle components in embedding space, and gradient-based measures of model symmetry. These techniques make it possible to automatically classify trained networks according to the algorithms they implement, and reveal algorithmic phase transitions in the space of model hyperparameters. Here we found specifically that the emergence of a Pizza or Clock algorithm depends on the relative strength of linear layers and attention outputs. We additionally showed that these algorithms are not implemented in isolation; instead, networks sometimes ensemble multiple copies of an algorithm in parallel. These results offer exciting new challenges for mechanistic interpretability: (1) How to find, classify, and interpret unfamiliar algorithms in a systematic way? (2) How to disentangle multiple, parallel algorithm implementations in the presence of ensembling?
|
| 213 |
+
|
| 214 |
+
Limitations We have focused on a single learning problem: modular addition. Even in this restricted domain, qualitatively different model behaviors emerge across architectures and seeds. Significant additional work is needed to scale these techniques to the even more complex models used in real-world tasks.
|
| 215 |
+
|
| 216 |
+
Broader Impact We believe interpretability techniques can play a crucial role in creating and improving safe AI systems. However, they may also be used to build more accurate systems, with the attendant risks inherent in all dual-use technologies. It is therefore necessary to exercise caution and responsible decision-making when deploying such techniques.
|
| 217 |
+
|
| 218 |
+
# Acknowledgement
|
| 219 |
+
|
| 220 |
+
We would like to thank Mingyang Deng and anonymous reviewers for valuable and fruitful discussions and MIT SuperCloud for providing computation resources. ZL and MT are supported by the Foundational Questions Institute, the Rothberg Family Fund for Cognitive Science and IAIFI through NSF grant PHY-2019786. JA is supported by a gift from the OpenPhilanthropy Foundation.
|
| 221 |
+
|
| 222 |
+
# References
|
| 223 |
+
|
| 224 |
+
[1] Neel Nanda, Lawrence Chan, Tom Lieberum, Jess Smith, and Jacob Steinhardt. Progress measures for grokking via mechanistic interpretability. In The Eleventh International Conference on Learning Representations, 2023.
|
| 225 |
+
[2] Chris Olah, Nick Cammarata, Ludwig Schubert, Gabriel Goh, Michael Petrov, and Shan Carter. Zoom in: An introduction to circuits. Distill, 2020. https://distill.pub/2020/circuits/zoom-in.
|
| 226 |
+
[3] Catherine Olsson, Nelson Elhage, Neel Nanda, Nicholas Joseph, Nova DasSarma, Tom Henighan, Ben Mann, Amanda Askell, Yuntao Bai, Anna Chen, Tom Conerly, Dawn Drain, Deep Ganguli, Zac Hatfield-Dodds, Danny Hernandez, Scott Johnston, Andy Jones, Jackson Kernion, Liane Lovitt, Kamal Ndousse, Dario Amodei, Tom Brown, Jack Clark, Jared Kaplan, Sam McCandlish, and Chris Olah. In-context learning and induction heads. Transformer Circuits Thread, 2022. https://transformer-circuits.pub/2022/in-context-learning-and-inductionheads/index.html.
|
| 227 |
+
[4] Kevin Ro Wang, Alexandre Variengien, Arthur Conmy, Buck Shlegeris, and Jacob Steinhardt. Interpretability in the wild: a circuit for indirect object identification in GPT-2 small. In The Eleventh International Conference on Learning Representations, 2023.
|
| 228 |
+
[5] Eric J Michaud, Ziming Liu, Uzay Girit, and Max Tegmark. The quantization model of neural scaling. arXiv preprint arXiv:2303.13506, 2023. [6] 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.
|
| 229 |
+
[7] 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.
|
| 230 |
+
[8] Ziming Liu, Ouail Kitouni, Niklas S Nolte, Eric Michaud, Max Tegmark, and Mike Williams. Towards understanding grokking: An effective theory of representation learning. Advances in Neural Information Processing Systems, 35:34651–34663, 2022.
|
| 231 |
+
[9] Jonathan Frankle and Michael Carbin. The lottery ticket hypothesis: Finding sparse, trainable neural networks. In International Conference on Learning Representations, 2019.
|
| 232 |
+
[10] 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.
|
| 233 |
+
[11] Nelson Elhage, Tristan Hume, Catherine Olsson, Nicholas Schiefer, Tom Henighan, Shauna Kravec, Zac Hatfield-Dodds, Robert Lasenby, Dawn Drain, Carol Chen, Roger Grosse, Sam McCandlish, Jared Kaplan, Dario Amodei, Martin Wattenberg, and Christopher Olah. Toy models of superposition. Transformer Circuits Thread, 2022.
|
| 234 |
+
[12] Bilal Chughtai, Lawrence Chan, and Neel Nanda. A toy model of universality: Reverse engineering how networks learn group operations. In The Fortieth International Conference on Machine Learning, 2023.
|
| 235 |
+
[13] Ziming Liu, Eric J Michaud, and Max Tegmark. Omnigrok: Grokking beyond algorithmic data. In The Eleventh International Conference on Learning Representations, 2023.
|
| 236 |
+
[14] Arthur Conmy, Augustine N Mavor-Parker, Aengus Lynch, Stefan Heimersheim, and Adrià Garriga-Alonso. Towards automated circuit discovery for mechanistic interpretability. arXiv preprint arXiv:2304.14997, 2023.
|
| 237 |
+
[15] Wes Gurnee, Neel Nanda, Matthew Pauly, Katherine Harvey, Dmitrii Troitskii, and Dimitris Bertsimas. Finding neurons in a haystack: Case studies with sparse probing. arXiv preprint arXiv:2305.01610, 2023.
|
| 238 |
+
[16] Yedid Hoshen and Shmuel Peleg. Visual learning of arithmetic operation. In Proceedings of the AAAI Conference on Artificial Intelligence, 2016.
|
| 239 |
+
[17] Samuel Kim, Peter Y Lu, Srijon Mukherjee, Michael Gilbert, Li Jing, Vladimir Ceperi ˇ c, and ´ Marin Soljaciˇ c. Integration of neural network-based symbolic regression in deep learning for ´ scientific discovery. IEEE Transactions on Neural Networks and Learning Systems, 32(9):4166– 4177, 2020.
|
| 240 |
+
[18] Alethea Power, Yuri Burda, Harri Edwards, Igor Babuschkin, and Vedant Misra. Grokking: Generalization beyond overfitting on small algorithmic datasets. arXiv preprint arXiv:2201.02177, 2022.
|
| 241 |
+
[19] Boaz Barak, Benjamin Edelman, Surbhi Goel, Sham Kakade, Eran Malach, and Cyril Zhang. Hidden progress in deep learning: SGD learns parities near the computational limit. Advances in Neural Information Processing Systems, 35:21750–21764, 2022.
|
| 242 |
+
[20] Yang-Hui He. Machine-learning mathematical structures. International Journal of Data Science in the Mathematical Sciences, 1(01):23–47, 2023.
|
| 243 |
+
[21] Sergei Gukov, James Halverson, Fabian Ruehle, and Piotr Sułkowski. Learning to unknot. Machine Learning: Science and Technology, 2(2):025035, 2021.
|
| 244 |
+
[22] Alex Davies, Petar Velickovi ˇ c, Lars Buesing, Sam Blackwell, Daniel Zheng, Nenad Tomašev, ´ Richard Tanburn, Peter Battaglia, Charles Blundell, András Juhász, et al. Advancing mathematics by guiding human intuition with ai. Nature, 600(7887):70–74, 2021.
|
| 245 |
+
[23] Alexander K Hartmann and Martin Weigt. Phase transitions in combinatorial optimization problems: basics, algorithms and statistical mechanics. John Wiley & Sons, 2006.
|
| 246 |
+
[24] Lorenza Saitta, Attilio Giordana, and Antoine Cornuejols. Phase transitions in machine learning. Cambridge University Press, 2011.
|
| 247 |
+
[25] Ekdeep Singh Lubana, Eric J Bigelow, Robert P Dick, David Krueger, and Hidenori Tanaka. Mechanistic mode connectivity. In International Conference on Machine Learning, pages 22965–23004. PMLR, 2023.
|
| 248 |
+
[26] Jason Wei, Yi Tay, Rishi Bommasani, Colin Raffel, Barret Zoph, Sebastian Borgeaud, Dani Yogatama, Maarten Bosma, Denny Zhou, Donald Metzler, Ed H. Chi, Tatsunori Hashimoto, Oriol Vinyals, Percy Liang, Jeff Dean, and William Fedus. Emergent abilities of large language models. Transactions on Machine Learning Research, 2022. Survey Certification.
|
| 249 |
+
[27] Rylan Schaeffer, Brando Miranda, and Sanmi Koyejo. Are emergent abilities of large language models a mirage? arXiv preprint arXiv:2304.15004, 2023.
|
| 250 |
+
[28] Michael Hassid, Hao Peng, Daniel Rotem, Jungo Kasai, Ivan Montero, Noah A. Smith, and Roy Schwartz. How much does attention actually attend? questioning the importance of attention in pretrained transformers. In Findings of the Association for Computational Linguistics: EMNLP 2022, pages 1403–1416, Abu Dhabi, United Arab Emirates, December 2022. Association for Computational Linguistics.
|
| 251 |
+
[29] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In International Conference on Learning Representations, 2019.
|
| 252 |
+
|
| 253 |
+
# Supplementary material
|
| 254 |
+
|
| 255 |
+
A Mathematical Analysis and An Example of Pizza Algorithm
|
| 256 |
+
|
| 257 |
+
In the pizza algorithm, we have $E _ { a b } = \cos ( w _ { k } ( a - b ) / 2 ) \cdot ( \cos ( w _ { k } ( a + b ) / 2 ) , \sin ( w _ { k } ( a + b ) / 2 ) )$ , as $\cos x + \cos y = \cos ( ( x - y ) / 2 ) ( 2 \cos ( ( x + y ) / 2 ) )$ and $\sin x + \sin y = \cos ( ( x - y ) / 2 ) ( 2 \sin ( ( x +$ $y ) / 2 )$ ).
|
| 258 |
+
|
| 259 |
+
To get $| \mathrm { c o s } ( w _ { k } ( a - b ) / 2 ) | ( \mathrm { c o s } ( w _ { k } ( a + b ) ) , \mathrm { s i n } ( w _ { k } ( a + b ) ) )$ , we generalize this to $| \cos ( w _ { k } ( a -$ $b ) / 2 ) | \cos ( w _ { k } ( a + b - u ) )$ (the two given cases correspond to $u = 0$ and $u = \pi / 2 / w _ { k }$ ).
|
| 260 |
+
|
| 261 |
+
$$
|
| 262 |
+
\begin{array} { r l r } & { } & { | ( \cos ( w _ { k } u / 2 ) , \sin ( w _ { k } u / 2 ) ) \cdot E _ { a b } | = | \cos ( w _ { k } ( a - b ) / 2 ) \cos ( w _ { k } ( a + b - u ) / 2 ) | } \\ & { } & { | ( - \sin ( w _ { k } u / 2 ) , \cos ( w _ { k } u / 2 ) ) \cdot E _ { a b } | = | \cos ( w _ { k } ( a - b ) / 2 ) \sin ( w _ { k } ( a + b - u ) / 2 ) | } \end{array}
|
| 263 |
+
$$
|
| 264 |
+
|
| 265 |
+
thus their difference will be equal to
|
| 266 |
+
|
| 267 |
+
$$
|
| 268 |
+
| \cos ( w _ { k } ( a - b ) / 2 ) | ( | \cos ( w _ { k } ( a + b - u ) / 2 ) | - | \sin ( w _ { k } ( a + b - u ) / 2 ) | ) .
|
| 269 |
+
$$
|
| 270 |
+
|
| 271 |
+
Now notice $| \cos ( t ) | - | \sin ( t ) | \approx \cos ( 2 t )$ for any $t \in \mathbb { R }$ (Figure 8), so the difference is approximately $| \mathrm { c o s } ( w _ { k } ( a - b ) / 2 ) | \mathrm { c o s } ( w _ { k } ( a + b - u ) )$ .
|
| 272 |
+
|
| 273 |
+

|
| 274 |
+
Figure 8: $| \cos ( t ) | - | \sin ( t ) |$ is approximately $\cos ( 2 t )$ for any $t \in \mathbb { R }$
|
| 275 |
+
|
| 276 |
+
Plugging in $u = 0$ and $u = \pi / 2 / w _ { k }$ as mentioned, we get the following particular implementation of the pizza algorithm.
|
| 277 |
+
|
| 278 |
+
# Algorithm: Pizza, Example
|
| 279 |
+
|
| 280 |
+
Step 1 On given input $a$ and $b$ , circularly embed them to two vectors on the circumference $( \cos ( w _ { k } a ) , \sin ( w _ { k } a ) )$ and $( \cos ( w _ { k } b ) , \sin ( w _ { k } b ) )$ .
|
| 281 |
+
|
| 282 |
+
Step 2 Compute:
|
| 283 |
+
|
| 284 |
+
$$
|
| 285 |
+
\begin{array} { r l } & { \alpha = | \cos ( w _ { k } a ) + \cos ( w _ { k } b ) | / 2 - | \sin ( w _ { k } a ) + \sin ( w _ { k } b ) | / 2 } \\ & { \quad \approx | \cos ( w _ { k } ( a - b ) / 2 ) | \cos ( w _ { k } ( a + b ) ) } \\ & { \beta = | \cos ( w _ { k } a ) + \cos ( w _ { k } b ) + \sin ( w _ { k } a ) + \sin ( w _ { k } b ) | / ( 2 \sqrt { 2 } ) } \\ & { \quad - | \cos ( w _ { k } a ) + \cos ( w _ { k } b ) - \sin ( w _ { k } a ) - \sin ( w _ { k } b ) | / ( 2 \sqrt { 2 } ) } \\ & { \quad = | \cos ( w _ { k } a - \pi / 4 ) + \cos ( w _ { k } b - \pi / 4 ) | / 2 - | \sin ( w _ { k } a - \pi / 4 ) + \sin ( w _ { k } b - \pi / 4 ) | / 2 } \\ & { \quad \approx | \cos ( w _ { k } ( a - b ) / 2 ) | \cos ( w _ { k } ( a + b ) - \pi / 2 ) = | \cos ( w _ { k } ( a - b ) / 2 ) | \sin ( w _ { k } ( a + b ) ) } \end{array}
|
| 286 |
+
$$
|
| 287 |
+
|
| 288 |
+
Step 3 Output of this pizza is computed as a dot product.
|
| 289 |
+
|
| 290 |
+
$$
|
| 291 |
+
Q _ { a b c } ^ { \prime } = \alpha \cos ( w _ { k } c ) + \beta \sin ( w _ { k } c ) \approx | \cos ( w _ { k } ( a - b ) / 2 ) | \cos ( w _ { k } ( a + b - c ) )
|
| 292 |
+
$$
|
| 293 |
+
|
| 294 |
+
Similar circuits are observed in the wild, but instead of the above two-term approximation, a more complicated one is observed. See Appendix $\mathrm { L }$ for details.
|
| 295 |
+
|
| 296 |
+
The extra $\vert \cos ( w _ { k } ( a - b ) / 2 ) \vert$ term is not a coincidence. We can generalize our derivation as the following.
|
| 297 |
+
|
| 298 |
+
Lemma A.1. A symmetric function $f ( x , y )$ that is a linear combination of $\cos x , \sin x , \cos y , \sin y ^ { 4 }$ can always be written as $\cos ( ( x - y ) / 2 ) g ( x + y )$ for some function $g$ .
|
| 299 |
+
|
| 300 |
+
Proof. Notice $\cos x + \cos y = \cos ( ( x - y ) / 2 ) ( 2 \cos ( ( x + y ) / 2 ) )$ ) and $\sin x + \sin y = \cos ( ( x -$ $y ) / 2 ) ( 2 \sin ( ( x + y ) / 2 ) )$ , so $\alpha ( \cos x + \cos y ) + \beta ( \sin x + \sin y ) = \cos ( ( x - y ) / 2 ) ( 2 \alpha \cos ( ( x + \cos y ) 2 ) + \beta ( \sin x + \sin y ) = \cos ( ( x - y ) / 2 )$ $y ) / 2 ) + 2 \beta \sin ( ( x + y ) / 2 ) )$ . □
|
| 301 |
+
|
| 302 |
+
This is why we consider the output pattern with the $\vert \cos ( w _ { k } ( a - b ) / 2 ) \vert$ terms rather than the actual computation circuits as the determinant feature of the pizza algorithm.
|
| 303 |
+
|
| 304 |
+
# B Non-Circular algorithms
|
| 305 |
+
|
| 306 |
+
One thing that further complicates our experiment is the existence of non-circular embeddings. While only circular algorithms are reported in the previous works [8, 1], many non-circular embeddings are found in our experiments, e.g., 1D lines or 3D Lissajous-like curves, as shown in Figure 9. We leave the detailed analysis of these non-circular algorithms for future study. Since circular algorithms are our primary focus of study, we propose the following metric circularity to filter out non-circular algorithms. The metric reaches maximum 1 when the principal components aligns with cosine waves.
|
| 307 |
+
|
| 308 |
+

|
| 309 |
+
Figure 9: Visualization of the principal components of input embeddings for two trained non-circular models. Top: A line-like first principal component. Notice the re-arranged x axis (token id). Bottom: First three principal components forming a three-dimensional non-circular pattern. Each point represents the embedding of a token.
|
| 310 |
+
|
| 311 |
+
Definition B.1 (Circularity). For some network, suppose the l-th principal component of its input embeddings is $v _ { l , 0 } , v _ { l , 1 } , \cdots , v _ { l , p - 1 }$ , define its circularity based on first four components as
|
| 312 |
+
|
| 313 |
+
$$
|
| 314 |
+
c = \frac { 1 } { 4 } \sum _ { l = 1 } ^ { 4 } \left( \operatorname* { m a x } _ { k \in \left[ 1 , 2 , \cdots , p - 1 \right] } \left( \frac { 2 } { p { \sum _ { j = 0 } ^ { p - 1 } { v _ { l , j } ^ { 2 } } } } \left| \sum _ { j = 0 } ^ { p - 1 } v _ { l , j } e ^ { 2 \pi i \cdot j k / p } \right| ^ { 2 } \right) \right)
|
| 315 |
+
$$
|
| 316 |
+
|
| 317 |
+
where i is the imaginary unit. $c \in [ 0 , 1 ]$ by Fourier analysis. $c = 1$ means first four components are Fourier waves.
|
| 318 |
+
|
| 319 |
+
Both Model A and Model B in Section 3 have a circularity around $9 9 . 8 \%$ and we consider models with circularity $\geq 9 9 . 5 \%$ circular.
|
| 320 |
+
|
| 321 |
+
# C More Results from the Main Experiments
|
| 322 |
+
|
| 323 |
+
Here we provide Figure 7 with non-circular networks unfiltered (Figure 10). We can see more noise emerging in the plot. We also provide the training results from multi-layer transformers (Figure 11).
|
| 324 |
+
|
| 325 |
+

|
| 326 |
+
Figure 10: Training results from 1-layer transformers. Each point in the plots represents a training run reaching $100 \%$ validation accuracy. Among all the trained 1-layer transformers, $3 4 . 3 1 \%$ are circular. Top: Model width fixed to be 128. Bottom: Model width varies.
|
| 327 |
+
|
| 328 |
+
# D Pizzas Come in Pairs
|
| 329 |
+
|
| 330 |
+
Cautious readers might notice that the pizza algorithm is imperfect - for near antipodal points, the sum vector will have a very small norm and the result will be noise-sensitive. While the problem is partially elevated by the use of multiple circles instead of one, we also noticed another pattern emerged: accompanying pizzas.
|
| 331 |
+
|
| 332 |
+
The idea is the following: suppose the difference between adjacent points is $2 k$ mod $p$ , then the antipodal points have difference $\pm k$ . Therefore, if we arrange a new circle with a difference $k$ for adjacent points, we will get a pizza that works best for formerly antipodal points.
|
| 333 |
+
|
| 334 |
+
# Algorithm: Accompanying Pizza
|
| 335 |
+
|
| 336 |
+
Step 1 Take $w _ { k }$ as of the accompanied pizza. On given input $a$ and $b$ , circularly embed them to two vectors on the circumference $( \cos ( 2 w _ { k } a ) , \sin ( 2 w _ { k } a ) )$ and $( \cos ( 2 w _ { k } b ) , \sin ( 2 w _ { k } b ) )$ .
|
| 337 |
+
|
| 338 |
+
Step 2 Compute the midpoint:
|
| 339 |
+
|
| 340 |
+
$$
|
| 341 |
+
s = { \frac { 1 } { 2 } } ( \cos ( 2 w _ { k } a ) + \cos ( 2 w _ { k } b ) , \sin ( 2 w _ { k } a ) + \sin ( 2 w _ { k } b ) )
|
| 342 |
+
$$
|
| 343 |
+
|
| 344 |
+
Step 3 Output of this pizza is computed as a dot product.
|
| 345 |
+
|
| 346 |
+
$$
|
| 347 |
+
A _ { c } = - ( \cos ( w _ { k } c ) , \sin ( w _ { k } c ) ) \cdot s
|
| 348 |
+
$$
|
| 349 |
+
|
| 350 |
+
This is exactly what we observed in Model A (Table 3, Figure 13). With the six circles (pizzas and accompanying pizzas) included in the embedding, Model A also gets $100 \%$ accuracy.
|
| 351 |
+
|
| 352 |
+

|
| 353 |
+
Figure 11: Training results from transformers with 2, 3 and 4 layers. Among all the trained transformers with 2, 3 and 4 layers, $9 . 9 5 \%$ , $1 1 . 5 5 \%$ and $6 . 0 8 \%$ are circular, respectively.
|
| 354 |
+
|
| 355 |
+

|
| 356 |
+
Figure 12: An Illustration on the Accompanying Pizza Algorithm
|
| 357 |
+
|
| 358 |
+
<table><tr><td rowspan=1 colspan=1>Circle</td><td rowspan=1 colspan=1>Wk</td><td rowspan=1 colspan=1>Ac FVE</td></tr><tr><td rowspan=1 colspan=1>#4 (accompanying #1)</td><td rowspan=1 colspan=1>2π/59·17</td><td rowspan=1 colspan=1>97.56%</td></tr><tr><td rowspan=1 colspan=1>#5 (accompanying #2)</td><td rowspan=1 colspan=1>2π/59.3</td><td rowspan=1 colspan=1>97.23%</td></tr><tr><td rowspan=1 colspan=1>#6 (accompanying #3)</td><td rowspan=1 colspan=1>2π/59·44</td><td rowspan=1 colspan=1>97.69%</td></tr></table>
|
| 359 |
+
|
| 360 |
+
Table 3: After isolating accompanying circles in the input embedding, fraction of variance explained (FVE) of all Model A’s output logits by various formulas. Both model output logits and formula results’ are normalized to mean 0 variance 1 before taking FVE. Accompanying and accompanied pizza have the same $w _ { k }$ .
|
| 361 |
+
|
| 362 |
+
#
|
| 363 |
+
|
| 364 |
+

|
| 365 |
+
Figure 13: Correct logits of Model A (Pizza) after circle isolation. Only accompanying pizzas are displayed. Notice the complementing logit pattern (Figure 4).
|
| 366 |
+
|
| 367 |
+
# E Results in Other Linear Architectures
|
| 368 |
+
|
| 369 |
+
While this is not the primary focus of our paper, we also ran experiments on the following four different linear model setups (see Section F.2 for setup details).
|
| 370 |
+
|
| 371 |
+
• For all the models, we first encode input tokens $( a , b )$ with a trainable embedding layer $W _ { E }$ : $x _ { 1 } = W _ { E , a }$ , $x _ { 2 } = W _ { E , b }$ (positional embedding removed for simplicity). $L _ { 1 } , L _ { 2 } , L _ { 3 }$ are trainable linear layers. The outmost layers (commonly referred as unembed layers) have no biases and the other layers have biases included for generality.
|
| 372 |
+
• Model $\alpha$ : calculate output logits as $L _ { 2 } ( \mathrm { R e L U } ( L _ { 1 } ( x _ { 1 } + x _ { 2 } ) ) )$ ).
|
| 373 |
+
• Model $\beta$ : calculate output logits as $L _ { 3 } ( \mathrm { R e L U } ( L _ { 2 } ( \mathrm { R e L U } ( L _ { 1 } ( x _ { 1 } + x _ { 2 } ) ) ) ) ) ,$ ).
|
| 374 |
+
• Model $\gamma$ : calculate output logits as $L _ { 3 } ( \mathrm { R e L U } ( L _ { 2 } ( \mathrm { R e L U } ( L _ { 1 } ( x _ { 1 } ) + L _ { 1 } ( x _ { 2 } ) ) ) ) )$ .
|
| 375 |
+
• Model $\delta$ : calculate output logits as $L _ { 2 } \big ( \mathrm { R e L U } ( L _ { 1 } ( [ x _ { 1 } ; x _ { 2 } ] ) ) \big )$ ) $[ x _ { 1 } ; x _ { 2 } ]$ stands for the concatenation of $x _ { 1 }$ and $x _ { 2 }$ )
|
| 376 |
+
|
| 377 |
+
The results are shown in Figure 14. Rather surprisingly, Model $\alpha$ , Model $\beta$ and Model $\delta$ gave radically different results. Model $\beta$ and Model $\gamma$ are very similar, and in general they are more pizza-like than Model $\alpha$ , with lower distance irrelevancy and higher circularity. This could be explained by the addition of an extra linear layer.
|
| 378 |
+
|
| 379 |
+

|
| 380 |
+
Figure 14: Training results from linear models. Each point in the first-row plots represents a training run. The second row are histograms for distance irrelevancy of each model type.
|
| 381 |
+
|
| 382 |
+
However, Model $\delta$ gave very different results from Model $\alpha$ although they are both one-layer linear models. It is more likely to be non-circular and have very high distance irrelevancy in general. In other words, concatenating instead of adding embeddings yields radically different behaviors in one-layer linear model. This result, again, alarmed us the significance of induction biases in neural networks.
|
| 383 |
+
|
| 384 |
+
We also want to note that using different embeddings on two tokens of Model $\alpha$ doesn’t resolve the discrepancy. The following model
|
| 385 |
+
|
| 386 |
+
• Model $\alpha ^ { \prime }$ : calculate output logits as $L _ { 2 } ( \mathrm { R e L U } ( L _ { 1 } ( x _ { 1 } + x _ { 2 } ) ) )$ ) where $x _ { 1 } = W _ { E , a } ^ { A }$ , $x _ { 2 } =$ $W _ { E , b } ^ { B }$ on input $( a , b )$ and $W _ { E } ^ { A } , W _ { E } ^ { B }$ are different embedding layers.
|
| 387 |
+
|
| 388 |
+
gives roughly the same result as of Model $\alpha$ (Figure 14, lower right corner).
|
| 389 |
+
|
| 390 |
+
Figure 15 shows the correct logits after circle isolation (Section 3.3) of a circular model from Model $\beta$ implementing the pizza algorithm. Figure 16 shows the correct logits after circle isolation (Section 3.3) of a circular model from Model $\delta$ . We can see the pattern is similar but different from the one of clock algorithm (Figure 5). We leave the study of such models to future work.
|
| 391 |
+
|
| 392 |
+
# F Architecture and Training Details
|
| 393 |
+
|
| 394 |
+
# F.1 Transformers
|
| 395 |
+
|
| 396 |
+
Here we describe our setup for the main experiments. See Appendix E and Appendix I for experiments on different setups.
|
| 397 |
+
|
| 398 |
+
Architecture We train bidirectional transformers (attention unmasked) to perform modular addition mod $p$ where $p = 5 9$ . To calculate $( a + b )$ mod $p$ , the input is provided to the model as a sequence of two tokens $[ a , b ]$ . The output logit at the last token is considered as the output of the model. For a transformer with “width” $d$ , the input embedding and the residue stream will be $d$ -dimensional, 4 attention heads of $\lfloor d / 4 \rfloor$ dimensions will be employed, and the MLP will be of $4 d$ hidden units. By default $d = 1 2 8$ is chosen. ReLU is used as the activation function and layer normalization isn’t applied. The post-softmax attention matrix is interpolated between an all-one matrix and original as specified by the attention rate (Section 4.2). We want to point out that the setup of constant-attention transformers is also considered in the previous work [28].
|
| 399 |
+
|
| 400 |
+

|
| 401 |
+
Figure 15: Correct logits from Model $\beta$ after circle isolation.
|
| 402 |
+
|
| 403 |
+

|
| 404 |
+
Figure 16: Correct logits from Model $\delta$ after circle isolation.
|
| 405 |
+
|
| 406 |
+
Data Among all possible data points $\gamma ^ { 2 } = 3 4 8 1$ of them), we randomly select $8 0 \%$ as training samples and $2 0 \%$ as validation samples. This choice (small $p$ and high training data fraction) helps accelerating the training.
|
| 407 |
+
|
| 408 |
+
Training We used AdamW optimizer [29] with learning rate $\gamma = 0 . 0 0 1$ and weight decay factor $\beta = 2$ . We do not use minibatches and the shuffled training data is provided as a whole batch in every epoch. For each run, we start the training from scratch and train for 20, 000 epoches. We removed the runs that did not reach $1 0 0 \%$ validation accuracy at the end of the training (majority of the runs reached $1 0 0 \%$ ).
|
| 409 |
+
|
| 410 |
+
# F.2 Linear Models
|
| 411 |
+
|
| 412 |
+
Here we describe our setup for the linear model experiments (Appendix E).
|
| 413 |
+
|
| 414 |
+
Architecture We train several types of linear models to perform modular addition mod $p$ where $p = 5 9$ . The input embedding, residue stream and hidden layer are all $d = 2 5 6$ dimensional. ReLU is used as the activation function. The actual structures of network types are specified in Appendix E.
|
| 415 |
+
|
| 416 |
+
Data & Training Same as in the previous section (Section F.1).
|
| 417 |
+
|
| 418 |
+
# F.3 Computing Resources
|
| 419 |
+
|
| 420 |
+
A total of 226 GPU days of NVidia V100 is spent on this project, although we expect a replication would take significantly fewer resources.
|
| 421 |
+
|
| 422 |
+
# G Mathematical Description of Constant-Attention transformer
|
| 423 |
+
|
| 424 |
+
In this section, we examine the structure of constant-attention transformers loosely following the notation of [10].
|
| 425 |
+
|
| 426 |
+
Denote the weight of embedding layer as $W _ { E }$ , the weight of positional embedding as $W _ { \mathrm { p o s } }$ , the weight of the value and output matrix of the $j$ -th head of the $t { \cdot }$ -th layer as $W _ { V } ^ { t , j }$ and $W _ { O } ^ { t , j }$ , the weights and biases of the input linear map of MLP in the -th layer as $\it { W _ { \mathrm { i n } } ^ { t } }$ and $b _ { \mathrm { i n } } ^ { t }$ , the corresponding weights and biases of the output linear map as $W _ { \mathrm { o u t } } ^ { t }$ and $b _ { \mathrm { o u t } } ^ { t }$ , and the weight of the unembedding layer as $W _ { U }$ . Notice that the query and the key matrices are irrelevant as the attention matrix is replaced with an all-one matrix. Denote $x ^ { j }$ as the value of residue stream vector after the first $j$ layers and denote $c _ { i }$ as the character in the $i$ -th position. We use subscripts like $x _ { t }$ to denote taking a specific element of vector.
|
| 427 |
+
|
| 428 |
+
We can formalize the logit calculation as the following:
|
| 429 |
+
|
| 430 |
+
• Embedding: $x _ { i } ^ { 0 } = W _ { E , c _ { i } } + W _ { \mathrm { p o s } , i }$ .
|
| 431 |
+
• For each layer $t$ from 1 to $n _ { \mathrm { l a y e r } }$ : – Constant Attention: $\begin{array} { r } { \boldsymbol { w } _ { i } ^ { t } = \boldsymbol { x } _ { i } ^ { t - 1 } + \sum _ { j } \boldsymbol { W } _ { O } ^ { t , j } \boldsymbol { W } _ { V } ^ { t , j } \sum _ { k } \boldsymbol { x } _ { k } ^ { t - 1 } . } \end{array}$ – MLP: $x ^ { t } = w ^ { t } + b _ { \mathrm { o u t } } ^ { t } + W _ { \mathrm { o u t } } ^ { t } \mathrm { R e L U } ( b _ { \mathrm { i n } } ^ { t } + W _ { \mathrm { i n } } ^ { t } w ^ { t } )$ .
|
| 432 |
+
• Output: $O = W _ { U } x ^ { n _ { \mathrm { l a y e r } } }$ .
|
| 433 |
+
|
| 434 |
+
In the particular case where the input length is 2, the number of layer is $1$ , and we focus on the logit of the last position, we may restate as the following (denote $z$ as $\dot { x } ^ { 1 }$ and $y$ as $w ^ { 1 }$ ):
|
| 435 |
+
|
| 436 |
+
• Embedding: $x _ { 1 } = W _ { E , c _ { 1 } } + W _ { \mathrm { p o s } , 1 } , x _ { 2 } = W _ { E , c _ { 2 } } + W _ { \mathrm { p o s } , 2 } .$ • Constant Attention: $\begin{array} { r } { y = x _ { 2 } + \sum _ { j } W _ { O } ^ { j } W _ { V } ^ { j } ( x _ { 1 } + x _ { 2 } ) } \end{array}$ . • MLP: $z = y + b _ { \mathrm { o u t } } ^ { t } + W _ { \mathrm { o u t } } ^ { t } \mathrm { R e L U } ( b _ { \mathrm { i n } } ^ { t } + W _ { \mathrm { i n } } ^ { t } y )$ .
|
| 437 |
+
|
| 438 |
+
• Output: $o = W _ { U } z$
|
| 439 |
+
|
| 440 |
+
If we remove the skip connections, the network after embedding could be seen as
|
| 441 |
+
|
| 442 |
+
$$
|
| 443 |
+
o = L _ { U } \left( L _ { \mathrm { o u t } } \left( \operatorname { R e L U } \left( L _ { \mathrm { i n } } \left( \sum _ { j } L _ { O } ^ { j } \left( L _ { V } ^ { j } \left( x _ { 1 } + x _ { 2 } \right) \right) \right) \right) \right) \right)
|
| 444 |
+
$$
|
| 445 |
+
|
| 446 |
+
where $L _ { V } ^ { j } , L _ { O } ^ { j } , L _ { \mathrm { i n } } , L _ { \mathrm { o u t } } , L _ { U }$ are a series of linear layers corresponding to the matrices.
|
| 447 |
+
|
| 448 |
+
# H Pizza with Attention
|
| 449 |
+
|
| 450 |
+
Extrapolating from Figure 7, we trained transformers with width 1024 and attention rate 1 (normal attention). After several tries, we are able to observe a trained circular model with distance irrelevance 0.156 and gradient symmetricity 0.995, which fits our definition of Pizza (Figure 17).
|
| 451 |
+
|
| 452 |
+

|
| 453 |
+
Figure 17: Correct logits of the trained model in Section H after circle isolation (Section 3.3).
|
| 454 |
+
|
| 455 |
+
# I Results on Slightly Different Setups
|
| 456 |
+
|
| 457 |
+
We considered the following variations of our setups (Appendix F.1, Section 4), for which the existence of pizzas and clocks as well as the phase changes are still observed.
|
| 458 |
+
|
| 459 |
+
GeLU instead of ReLU We conducted the same 1-layer transformer experiment with activation function GeLU instead of ReLU. Very similar results are observed (Figure 18).
|
| 460 |
+
|
| 461 |
+
Encode Two Tokens Differently We conducted the 1-layer transformer experiments but with different embedding for the two tokens. Again very similar results are observed (Figure 19). We also discovered that the two tokens’ embeddings are often aligned to implement the Pizza and Clock algorithm (Figure 20).
|
| 462 |
+
|
| 463 |
+
Adding Equal Sign We conducted the 1-layer transformer experiment with an equal sign added.
|
| 464 |
+
Very similar results are observed (Figure 21).
|
| 465 |
+
|
| 466 |
+
# J Pizza Occurs Early in the Clock Training
|
| 467 |
+
|
| 468 |
+
We plotted intermediate states during the training of a model with attention (attention rate 1). Pizzalike pattern was observed early in the training, but the pattern gradually disappeared during the run (Figure 22).
|
| 469 |
+
|
| 470 |
+

|
| 471 |
+
Figure 18: Training results from 1-layer transformers with GeLU instead of ReLU as the activation function. Each point in the plots represents a training run that reached $100 \%$ validation accuracy.
|
| 472 |
+
|
| 473 |
+

|
| 474 |
+
Figure 19: Training results from 1-layer transformers where the two tokens use different embeddings (feed $[ a , b + p ]$ to the model on input $( a , b )$ ; $2 p$ tokens are handled in the embedding layer). Each point in the plots represents a training run that reached $100 \%$ validation accuracy. We did not use circularity to filter the result because it is no longer well-defined.
|
| 475 |
+
|
| 476 |
+

|
| 477 |
+
Figure 20: Correct logits after circle isolation from a trained model where two tokens use different embeddings. The blue points represent the embeddings for the first token and the green points represent the embeddings for the second token. The model is implementing the Pizza algorithm. The correct logit pattern is shifted comparing to the previous patterns because the embeddings of two tokens do not line up exactly. For example, the third circle has near-maximum correct logit for $a = 6 , b = 3$ (the two points lining up on the top) and $( a - b ) / 1 8 \equiv 1 0$ (mod 59). This is the reason that the correct logit pattern appears to be shifted 10 units down.
|
| 478 |
+
|
| 479 |
+

|
| 480 |
+
Figure 21: Training results from 1-layer transformers where an equal sign is added (feed $[ a , b , = ]$ to the model on input $( a , b )$ where $=$ is a special token; $p + 1$ tokens are handled in the embedding layer; context length of the model becomes 3). Each point in the plots represents a training run that reached $100 \%$ validation accuracy. We did not use circularity to filter the result because it is no longer well-defined.
|
| 481 |
+
|
| 482 |
+
# K Accompanying Pizza Occurs Early in the Pizza Training
|
| 483 |
+
|
| 484 |
+
We plotted intermediate states during the training of a model without attention (attention rate 0). We observed the early emergence of a pattern similar to accompanying pizza in training runs (Figure
|
| 485 |
+
|
| 486 |
+

|
| 487 |
+
Figure 22: For a 1-layer transformer with attention, correct logits after principal component (possibly non-circle) isolations at various states during the training. The pizza-like pattern gradually desolved.
|
| 488 |
+
|
| 489 |
+
23) and removing that circle brings accuracy down from $9 9 . 7 \%$ to $9 7 . 9 \%$ . They are less helpful later in the network (removing accompanying pizzas in trained Model A only brings accuracy down to $9 9 . 7 \%$ ).
|
| 490 |
+
|
| 491 |
+

|
| 492 |
+
Figure 23: Immediate state after 600 epochs of training for a 1-layer transformer with constant attention.
|
| 493 |
+
|
| 494 |
+
# L A Closer Look at a Linear Pizza Model
|
| 495 |
+
|
| 496 |
+
In this section, we provide a full picture of the linear model shown in Figure 15 by investigating the actual weights in the model.
|
| 497 |
+
|
| 498 |
+
# L.1 Model Structure
|
| 499 |
+
|
| 500 |
+
As described in Appendix E, on input $( a , b )$ , the output logits of the model is computed as
|
| 501 |
+
|
| 502 |
+
$$
|
| 503 |
+
L _ { 3 } ( \mathrm { R e L U } ( L _ { 2 } ( \mathrm { R e L U } ( L _ { 1 } ( \mathrm { E m b e d } [ a ] + \mathrm { E m b e d } [ b ] ) ) ) ) ) .
|
| 504 |
+
$$
|
| 505 |
+
|
| 506 |
+
Denote the weight of embedding layer as $W _ { E }$ , the weight of the unembedding layer $( L _ { 3 } )$ as $W _ { U }$ , and the weights and biases of $L _ { 1 }$ and $L _ { 2 }$ as $W _ { 1 } , b _ { 1 }$ and $W _ { 2 } , b _ { 2 }$ , respectively, then the output logits on input $( a , b )$ can be written as
|
| 507 |
+
|
| 508 |
+
$$
|
| 509 |
+
W _ { U } \mathrm { R e L U } ( b _ { 2 } + W _ { 2 } \mathrm { R e L U } ( b _ { 1 } + W _ { 1 } ( W _ { E } [ a ] + W _ { E } [ b ] ) ) ) .
|
| 510 |
+
$$
|
| 511 |
+
|
| 512 |
+
# L.2 General Picture
|
| 513 |
+
|
| 514 |
+
We first perform principal component visualizations on the embedding and unembedding matrices. From Figure 24, we can see that the embedding and unembedding matrices formed matching circles (circles with the same gap $\delta$ between adjacent entries).
|
| 515 |
+
|
| 516 |
+
We now give the general overview of the circuit. Each pair of matching circles forms an instance of Pizza and they operate independently (with rather limited interference). Specifically for each pair, • The embedding matrix first places the inputs $a , b$ on the circumference: $W _ { E } ^ { \prime } [ a ] \ \approx$ $( \cos ( w _ { k } a ) , \sin ( w _ { k } a ) )$ and $\bar { W _ { E } ^ { \prime } [ b ] } \approx ( \cos ( \bar { w _ { k } } b ) , \sin ( w _ { k } b ) ) ( w _ { k } = 2 \pi k / p$ for some integer $k \in [ 1 , p - 1 ]$ as in Section 2.1; $W _ { E } ^ { \prime }$ stands for the two currently considered principal components of $W _ { E }$ ; rotation and scaling omitted for brevity).
|
| 517 |
+
|
| 518 |
+
• The embeddings are added to get
|
| 519 |
+
|
| 520 |
+
$$
|
| 521 |
+
\begin{array} { r l } & { \quad ( \cos ( w _ { k } a ) + \cos ( w _ { k } b ) , \sin ( w _ { k } a ) + \sin ( w _ { k } b ) ) } \\ & { = \cos ( w _ { k } ( a - b ) / 2 ) \cdot ( \cos ( w _ { k } ( a + b ) / 2 ) , \sin ( w _ { k } ( a + b ) / 2 ) ) } \end{array}
|
| 522 |
+
$$
|
| 523 |
+
|
| 524 |
+
• It is then passed through the first linear layer $L _ { 1 }$ . Each result entry pre-ReLU will thus be a linear combination of the two dimensions of the aforementioned vectors, i.e. $\cos ( w _ { k } ( a -$ $b ) / 2 ) \cdot ( \alpha \cos ( w _ { k } ( a + b ) / 2 ) + \beta \sin ( w _ { k } ( a + b ) / 2 ) )$ ) for some $\alpha , \beta$ , which will become $\left| \cos ( w _ { k } ( a - b ) / 2 ) \right| | \alpha \cos ( w _ { k } ( a + b ) / 2 ) + \beta \sin ( w _ { k } ( a + b ) / 2 ) ) |$ | after ReLU.
|
| 525 |
+
|
| 526 |
+
• These values are then passed through the second linear layer $L _ { 2 }$ . Empirically the ReLU is not observed to be effective as the majority of values is positive. The output entries are then simply linear combinations of aforementioned outputs of $L _ { 1 }$ .
|
| 527 |
+
|
| 528 |
+
• The unembedding matrix is finally applied. In the principal components we are considering, $W _ { U } ^ { \prime } [ c ] \approx ( \cos ( \bar { w } _ { k } c ) , \sin ( w _ { k } c ) )$ . $( W _ { U } ^ { \prime }$ stands for the two currently considered principal components of $W _ { U }$ ; rotation and scaling omitted for brevity) and these two principal components correspond to a linear combination of the output entries of $L _ { 2 }$ , which then correspond to a linear combination of the outputs of $L _ { 1 }$ (thanks to the non-functional ReLU).
|
| 529 |
+
|
| 530 |
+
• Similar to the formula $| \sin ( t ) | - | \cos ( t ) | \approx \cos ( 2 t )$ discussed in Appendix A, these linear combinations provide good approximations for $| \mathrm { { c o s } } ( w _ { k } ( a - b ) / \bar { 2 } ) \bar { | } \cos ( w _ { k } ( a + b ) )$ and $| \mathrm { c o s } ( w _ { k } ( a - b \bar { ) } / 2 ) | \mathrm { s i n } \bar { ( } w _ { k } ( a \bar { + } b ) )$ . Finally we arrive at
|
| 531 |
+
|
| 532 |
+
$$
|
| 533 |
+
\begin{array} { r l } & { \quad | \cos ( w _ { k } ( a - b ) / 2 ) | ( \cos ( w _ { k } c ) \cos ( w _ { k } ( a + b ) ) + \sin ( w _ { k } c ) \sin ( w _ { k } ( a + b ) ) ) } \\ & { = | \cos ( w _ { k } ( a - b ) / 2 ) | \cos ( w _ { k } ( a + b - c ) ) } \end{array}
|
| 534 |
+
$$
|
| 535 |
+
|
| 536 |
+

|
| 537 |
+
Figure 24: Visualization of the principal components of the embeddings and unembedding matrices.
|
| 538 |
+
|
| 539 |
+
# L.3 Aligning Weight Matrices
|
| 540 |
+
|
| 541 |
+
We first verify that the ReLU from the second layer is not functional. After removing it, the accuracy of the model remains $1 0 0 \%$ and the cross-entropy loss actually decreased from ${ \mathrm { 6 . 2 0 \times 1 0 ^ { - 7 } } }$ to $5 . 8 9 \times 1 0 ^ { - 7 }$ .
|
| 542 |
+
|
| 543 |
+
Therefore, the model output can be approximately written as
|
| 544 |
+
|
| 545 |
+
$$
|
| 546 |
+
W _ { U } ( b _ { 2 } + W _ { 2 } \mathrm { R e L U } ( b _ { 1 } + W _ { 1 } ( W _ { E } [ a ] + W _ { E } [ b ] ) ) ) = W _ { U } b _ { 2 } + W _ { U } W _ { 2 } \mathrm { R e L U } ( b _ { 1 } + W _ { 1 } ( W _ { E } [ a ] + W _ { E } [ b ] ) ) .
|
| 547 |
+
$$
|
| 548 |
+
|
| 549 |
+
We now “align” the weight matrices $W _ { 1 }$ and $W _ { 2 }$ by mapping through the directions of the principal components of the embeddings and unembeddings. That is, we calculate how these matrices act on and onto the principal directions (consider $W _ { 1 } v$ for every principal direction $v$ in $W _ { E }$ and $v ^ { T } W _ { 2 }$ for every principal direction $v$ in $W _ { U }$ ). We call the other dimension of aligned $W _ { 1 }$ and $W _ { 2 }$ output and source dimensions, respectively (Figure 25).
|
| 550 |
+
|
| 551 |
+
In the aligned weight matrices, we can see a clear domino-like pattern: in most output or source dimensions, only two principal components have significant non-zero values, and they correspond to a pair of matching circle, or a pizza. In this way, every immediate dimension serves for exactly one pizza, so the pizzas do not interfere with each other.
|
| 552 |
+
|
| 553 |
+

|
| 554 |
+
Figure 25: Visualization of the aligned $W _ { 1 }$ and $W _ { 2 }$ .
|
| 555 |
+
|
| 556 |
+
# L.4 Approximation
|
| 557 |
+
|
| 558 |
+
Everything becomes much clearer after realigning the matrices. For a pizza and its two corresponding principal embedding / unembedding dimensions, $W _ { E } ^ { \prime } [ a ] + W _ { E } ^ { \prime } [ b ] \approx \bar { \cos } ( w _ { k } ( a - b ) / 2 ) \cdot ( \cos ( w _ { k } ( a +$ $\bar { b } ) / 2$ ), $\sin ( w _ { k } ( a + \bar { b } ) / 2 ) ;$ will be mapped by realigned $W _ { 1 }$ into its corresponding columns (which are different for every pizza), added with $b _ { 1 }$ and apply ReLU. The result will then be mapped by the realigned $W _ { 2 }$ , added with realigned $b _ { 2 }$ , and finally multipled by $( \cos ( w _ { k } c ) , \sin ( w _ { k } c ) )$ .
|
| 559 |
+
|
| 560 |
+
For the first two principal dimensions, realigned $W _ { 1 }$ has 44 corresponding columns (with coefficients of absolute value $> 0 . 1 \AA ,$ ). Let the embedded input be $( x , y ) = W _ { E } ^ { \prime } [ a ] + W _ { E } ^ { \prime } [ b ] \approx \cos ( w _ { k } ( a - b ) / 2 ) \cdot$ · $( \cos ( w _ { k } ( a + b ) / 2 )$ , $\sin ( w _ { k } ( a + b ) / 2 ) )$ ), the intermediate columns are
|
| 561 |
+
|
| 562 |
+
R $\operatorname { e L U } ( [ 0 . 5 3 0 x - 1 . 1 3 5 y + 0 . 2 5 3 , - 0 . 1 6 4 x - 1 . 1 0 0 y + 0 . 2 0 5 , 1 . 2 1 0 x - 0 . 3 7 0 y + 0 . 1 9 8 , - 0 . 4 7 8 x - 0 . 0 9 2 x + 0 . 0 9 2 x + 0 . 0 9 2 x )$ 1.072y $+ ~ 0 . 2 1 5 , - 1 . 0 1 7 x ~ + ~ 0 . 7 9 9 y ~ + ~ 0 . 2 4 9 , 0 . 3 4 2 x$ $+ ~ 0 . 7 9 9 y + 0 . 2 4 9 , 0 . 3 4 2 x ~ - ~ 0 . 0 4 8 y ~ + ~ 0 . 0 8 5$ $0 . 3 4 2 x \mathrm { ~ - ~ } 0 . 0 4 8 y \mathrm { ~ + ~ } 0 . 0 8 5 , 1 . 1 4 9 x \mathrm { ~ - ~ } 0 . 5 9 8 y \mathrm { ~ + ~ }$ $0 . 2 1 2 , - 0 . 4 4 3 x + 1 . 5 5 0 y + 0 . 1 3 9 9 , - 1 . 0 8 0 x - 0 . 0 0 0 y + 0 . 1 5 1 , - 1 . 4 0 5 x + 0 . 4 1 0 y + 0 . 1 ( 8 , 1 . 0 3 8 x + 0 . 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 )$ 0.905y $\mathrm { ~ ~ { ~ \tau ~ } ~ } + 0 . 1 9 0 , 0 . 5 6 8 x + 1 . 1 8 8 y + 0 . 1 2 8 , 0 . 2 3 5 x -$ $y \ + \ 0 . 1 2 8 , 0 . 2 3 5 x \ - \ 1 . 3 3 7 y \ + \ 0 . 1 6 4 , - 1 . 1 8 0 x$ + 1.052y + 0.139, $- 0 . 1 7 3 x + 0 . 9 1 8 u + 0 . 1 4 8 . - 0 . 9 0 0 x + 1 . 0 6 0 u + 0 . 1 7 3 . - 1 . 3 4 9 x + 0 . 3 9 0 u + 0 . 2 5 6 . 0 , 1 0 5 x - 0 . 0 9 8 x + 0 . 2 5 6 . 0 , 0 . 1 2 5 x + 0 . 2 5 6 . 0 , 0 . 1 2 5 x + 0 . 2 5 6 . 0 , 0 . 1 2 5 x + 0 . 2 5 6 . 0 , 0 . 1 2 5 x + 0 . 2 5 6 . 0 , 0 . 2 5 6 . - 0 . 3 2 5 x$ $- 0 . 2 0 0 x + 1 . 0 6 0 y + 0 . 1 7 3 , - 1 . 3 4 2 x + 0 . 3 9 0 y + 0 . 2$ 1 $\ 2 4 6 y \ + \ 0 . 2 0 9 , 0 . 1 1 5 x \ + \ 1 . 2 9 3 y \ + \ 0 . 1 9 7 , 0 . 2 5 2 x \ + \ 1 . 2 4 7 y \ + \ 0 . 1 4 0 , - 0 . 4 9 3 x \ + \ 1 . 2 5 2 y \ +$ $\begin{array} { r } . 1 2 0 x + 0 . 2 6 2 y + 0 . 2 3 9 , 0 . 6 6 8 x + 1 . 0 9 6 y + 0 . 2 0 5 , - 0 . 4 8 ( x - 1 . 3 0 2 y + 0 . 1 4 5 , 1 . 1 3 4 x - 0 . 0 0 0 0 ) x + 0 . 0 0 0 0 x + 0 . 0 0 0 0 x = 1 . 0 0 0 0 x + 0 . 0 0 0 0 x + 0 . 0 0 0 0 x + 0 . 0 0 0 0 x = 1 . 0 0 0 0 x - 0 . 0 0 0 0 x + 0 . 0 0 0 0 x + 0 . 0 0 0 0 x = 1 . 0 0 0 , 0 . 0 0 0 0 x = 1 . 0 0 0 , 0 . 0 0 0 0 x = 1 . 0 0 0 , 0 . 0 0 0 0 x = 1 . 0 0 0 , 0 . 0 0 0 0 x = 1 . 0 0 0 , 0 . 0 0 0 0 x = 1 . 0 0 0 , 0 . 0 0 0 0 x = 1 . 0 0 0 0 x + 0 . 0 0 0 0 , 0 . 0 0 0 0 x = 1 . 0 0 0 0 x = 1 . 0 0 0 0 , 0 . 0 0 0 0 x = 1 . 0 0 0 0 , 0 0 0 = 1 . 0 0 0 0 x = 1 . 0 0 0 0 0 x = 1 . 0 0 0 0 , 0 0 0 = 1 . 0 0 0 0 x = 1 . 0 0 0 0 0 x = 1 . 0 0 0 0 0 x = 1 . 0 0 0 0 0 , 0 0 = 1 . 0 0 0 0 0 x = 1 . 0 0 0 0 0 x = 1 . 0 0 0 0 0 0 x = 1 . 0 0 0 0 0 0 x = 1 . 0 0 0 0 0 0 x = 1 . 0 0 0 0 0 0 x = 1 . 0 0 0 0 0 0 x = 1 . 0 0 0 0 0 0 x = 1 . 0 0 0 0 0 0 x = 1 . 0 0 0 0 0 0 x = 1 . 0 0 0 0 0 0 x = 1 . 0 0 0 0 0 0 x = 1 . 0 0 0 0 0 0 x = 1 . 0 0 0 0 0 0 x = 1 . 0 0 0 0 0 0 x = 1 . 0 0 0 0 0 0 x = 1 . 0 0 0 0 0 0 x = 1 . 0 0 0 0 0 0 x = 1 . 0 0 0 0 0 0 = 1 . 0 0 0 0 0 x = 0 0 . 0 0 0 0 0 = 1 . 0 0 0 0 0 0 x = 0 0 . 0 0 0 0 0 = 1 . 0 0 0 0 0 0 0 x = 0 . 0 0 0 0 0 0 = 0 . 0 0 0 0 0 0 . 0 0 0 0 0 = 0 0 . 0 0 0 0 0 0 . 0 0 0 0 0 0 = 0 0 . 0 0 0 0 0 0 . 0 0 0 0 0 0 . 0 0 0 0 0 0 . 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 . 0 0 0 0 0 0 0 0 . 0 0 0 0 0 \end{array}$ 0 $1 . 8 6 2 y + 0 . 2 7 3 , 1 . 1 4 3 x + 0 . 4 3 5 y + 0 . 1 7 1 , - 1 . 2 8 5 x - 0 . 6 4 4 y + 0 . 1 4 2 , - 1 . 4 5 4 x - 0 . 2 8 5 y + 0 . 2 2 7 , 0 . 2 8 5 y + 0 . 2 2 7 , 0 . 2 2 7 5 + 0 . 2 2 8 5 y + 0 . 2 2 8 5 y$ 0.218, −0 $9 2 4 x + 1 . 0 6 8 y + 0 . 1 4 5 , - 0 . 4 0 1 x + 0 . 1 6 7 y + 0 . 1 0 6$ $. 1 6 7 y + 0 . 1 0 6 , - 0 . 4 1 1 x - 1 . 3 8 9 y + 0 . 2 4 9 , 1 . 4 2 2 x$ − 0.117y $\mathbf { \xi } ^ { \prime } + 0 . 2 2 7 , - 0 . 8 5 9 x - 0 . 7 7 8 y + 0 . 1 2 1 , - 0 . 5 2 8 x$ $x \ : - \ : 0 . 7 7 8 y + 0 . 1 2 1 , - 0 . 5 2 8 x \ : - \ : 0 . 2 1 6 y + 0 . 0 9 \ : \hat $ $- 0 . 5 2 8 x \mathrm { ~ - ~ } 0 . 2 1 6 y + 0 . 0 9 7 , - 0 . 8 8 4 x \mathrm { ~ - ~ } 0 . 7 2 4 y$ + 0 $1 . 1 7 1 , 1 . 1 9 3 x + 0 . 7 2 4 y + 0 . 1 3 1 , 1 . 0 8 6 x + 0 . 6 6 7 y + 0 . 2 1 8 , 0 . 4 0 2 x + 1 . 2 4 0 y + 0 . 2 1 3 , 1 . 0 6 9 x - 0 . 9 0 3 y + 0 . 2 2 5 , 0 . 2 4 0 x + 0 . 2 2 5 , 0 . 3 2 5 , 0 . 4 2 5 , x = 0 . 4 2 5 , x = 0 . 4 2 5 , x = 0 . 4 4 , x = 0 . 5 3 0$ 0 $1 . 1 2 0 , 0 . 5 0 6 x - 1 . 0 4 2 y + 0 . 1 5 3 , 1 . 4 0 4 x - 0 . 0 6 4 y + 0 . 1 5 2 , 0 . 6 9 6 x - 1 . 2 4 9 y + 0 . 1 9 9 , - 0 . 7 5 2 x - 0 . 0 9 6 x + 0 . 0 9 6 x - 0 . 0 9 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 7 6 , 0 . 1 5 . 0 1 5 , 0 . 0 1 5 , 0 . 0 1 5 , 0 . 1 0 . 1 5 , 0 0 . 1 5 , 0 0 . 1 5 , 0 0 . 1 0 . 1 5 0 , 0 . 1 5 0 , 0 . 1 0 0 .$ $0 . 8 8 0 y + 0 . 1 0 6 , - 0 . 9 5 6 x - 0 . 5 8 1 y + 0 . 2 2 3 ] )$ .
|
| 563 |
+
|
| 564 |
+
For the first principal unembedding dimension, it will be taken dot product with [1.326, 0.179, 0.142, −0.458, 1.101, −0.083, 0.621, 1.255, −0.709, 0.123, −1.346, −0.571, 1.016, 1.337, 0.732, 0.839, 0.129, 0.804, 0.377, 0.078, 1.322, −1.021, −0.799, −0.339, 1.117, −1.162, −1.423, −1.157, 1.363, 0.156, $- 0 . 1 6 5$ , $- 0 . 4 5 1$ , −1.101, −0.572, −1.180, −1.386, −1.346, −0.226, $1 . 0 9 1 , 1 . 1 5 9 , - 0 . 5 2 4 , 1 . 4 4 1 , - 0 . 9 4 9 , - 1 . 2 4 8 ] .$
|
| 565 |
+
|
| 566 |
+
Call this function $f ( x , y )$ . When we plug in $x = \cos ( t ) , y = \sin ( t )$ , we get a function that wellapproximated $8 \cos ( 2 t + 2 )$ (Figure 26). Therefore, let $t = w _ { k } ( a + b ) / 2$ , the dot product will be approximately $8 | \cos ( w _ { k } ( a - b ) / 2 ) | \cos ( w _ { k } ( a + b ) + 2 )$ , or $| \mathrm { c o s } ( w _ { k } ( a - b ) / 2 ) | \mathrm { c o s } ( w _ { k } ( a + b ) )$ if we ignore the phase and scaling. This completes the picture we described above.
|
| 567 |
+
|
| 568 |
+

|
| 569 |
+
Figure 26: $f ( \cos ( t ) , \sin ( t ) )$ well-approximates $8 \cos ( 2 t + 2 )$ .
|
md/dev/TVHS5Y4dNvM/TVHS5Y4dNvM.md
ADDED
|
@@ -0,0 +1,277 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CONVOLUTIONS ATTENTION MLPs Patches Are All You Need?
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
Although convolutional networks have been the dominant architecture for vision tasks for many years, recent experiments have shown that Transformer-based models, most notably the Vision Transformer (ViT), may exceed their performance in some settings. However, due to the quadratic runtime of the self-attention layers in Transformers, ViTs require the use of patch embeddings, which group together small regions of the image into single input features, in order to be applied to larger image sizes. This raises a question: Is the performance of ViTs due to the inherently-more-powerful Transformer architecture, or is it at least partly due to using patches as the input representation? In this paper, we present some evidence for the latter: specifically, we propose the ConvMixer, an extremely simple model that is similar in spirit to the ViT and the even-more-basic MLP-Mixer in that it operates directly on patches as input, separates the mixing of spatial and channel dimensions, and maintains equal size and resolution throughout the network. In contrast, however, the ConvMixer uses only standard convolutions to achieve the mixing steps. Despite its simplicity, we show that the ConvMixer outperforms the ViT, MLP-Mixer, and some of their variants for similar parameter counts and data set sizes, in addition to outperforming classical vision models such as the ResNet. Our code is available at https://github.com/tmp-iclr/convmixer.
|
| 8 |
+
|
| 9 |
+
# 1 Introduction
|
| 10 |
+
|
| 11 |
+
For many years, convolutional neural networks have been the dominant architecture for deep learning systems applied to computer vision tasks. But recently, architectures based upon Transformer models, e.g., the so-called Vision Transformer architecture (Dosovitskiy et al., 2020), have demonstrated compelling performance in many of these tasks, often outperforming classical convolutional architectures, especially for large data sets. An understandable assumption, then, is that it is only a matter of time before Transformers become the dominant architecture for vision domains, just as they have for language processing. In order to apply Transformers to images, however, the representation had to be changed: because the computational cost of the self-attention layers used in Transformers would scale quadratically with the number of pixels per image if applied naively at the per-pixel level, the compromise was to first split the image into multiple “patches”, linearly embed them, and then apply the transformer directly to this collection of patches.
|
| 12 |
+
|
| 13 |
+

|
| 14 |
+
Figure 1: Accuracy vs. parameters, trained and evaluated on ImageNet-1k.
|
| 15 |
+
|
| 16 |
+
In this work, we explore the question of whether, fundamentally, the strong performance of vision transformers may result more from this patch-based representation than from the Transformer architecture itself. We develop a very simple convolutional architecture which we dub the “ConvMixer” due to its similarity to the recently-proposed MLP-Mixer (Tolstikhin et al., 2021). This architecture is similar to the Vision Transformer (and MLP-Mixer) in many respects: it directly operates on patches, it maintains an equal-resolution-and-size representation throughout all layers, it does no downsampling of the representation at successive layers, and it separates “channel-wise mixing”
|
| 17 |
+
|
| 18 |
+

|
| 19 |
+
Figure 2: ConvMixer uses “tensor layout” patch embeddings to preserve locality, and then applies $d$ copies of a simple fully-convolutional block consisting of large-kernel depthwise convolution followed by pointwise convolution, before finishing with global pooling and a simple linear classifier.
|
| 20 |
+
Figure 3: Implementation of ConvMixer in PyTorch; see Appendix D for more implementations.
|
| 21 |
+
|
| 22 |
+
def ConvMixer(h, depth, kernel_size $^ { ! = 9 }$ , patch_size $^ { - 7 }$ , n_classes $\scriptstyle \left. = 1 0 0 0 \right|$ ):
|
| 23 |
+
2 Seq, ActBn $= \mathsf { n n }$ .Sequential, lambda x: Seq(x, nn.GELU(), nn.BatchNorm2d(h))
|
| 24 |
+
3 Residual $=$ type('Residual', (Seq,), {'forward': lambda self, x: self[0](x) + x})
|
| 25 |
+
4 return Seq(ActBn(nn.Conv2d(3, h, patch_size, stride=patch_size)),
|
| 26 |
+
5 \*[Seq(Residual(ActBn(nn.Conv2d(h, h, kernel_size, groups=h, padding $=$ "same"))),
|
| 27 |
+
6 ActBn(nn.Conv2d(h, h, 1))) for i in range(depth)],
|
| 28 |
+
7 nn.AdaptiveAvgPool2d((1,1)), nn.Flatten(), nn.Linear(h, n_classes))
|
| 29 |
+
|
| 30 |
+
from the “spatial mixing” of information. But unlike the Vision Transformer and MLP-Mixer, our architecture does all these operations via only standard convolutions.
|
| 31 |
+
|
| 32 |
+
The chief result we show in this paper is that this ConvMixer architecture, despite its extreme simplicity (it can be implemented in $\approx 6$ lines of dense PyTorch code), outperforms both “standard” computer vision models such as ResNets of similar parameter counts and some corresponding Vision Transformer and MLP-Mixer variants, even with a slate of additions intended to make those architectures more performant on smaller data sets. Importantly, this is despite the fact that we did not design our experiments to maximize accuracy nor speed, in contrast to the models we compared against. Our results suggest that, at least to some extent, the patch representation itself may be a critical component to the “superior” performance of newer architectures like Vision Transformers. While these results are naturally just a snapshot, and more experiments are required to exactly disentangle the effect of patch embeddings from other factors, we believe that this provides a strong “convolutionalbut-patch-based” baseline to compare against for more advanced architectures in the future.
|
| 33 |
+
|
| 34 |
+
# 2 A Simple Model: ConvMixer
|
| 35 |
+
|
| 36 |
+
Our model, dubbed ConvMixer, consists of a patch embedding layer followed by repeated applications of a simple fully-convolutional block. We maintain the spatial structure of the patch embeddings, as illustrated in Fig. 2. Patch embeddings with patch size $p$ and embedding dimension $h$ can be implemented as convolution with $c _ { \mathsf { i n } }$ input channels, $h$ output channels, kernel size $p$ , and stride $p$ :
|
| 37 |
+
|
| 38 |
+
$$
|
| 39 |
+
z _ { 0 } = \mathsf { B N } ( \sigma \{ \mathsf { C o n v } _ { c _ { \mathrm { i n } } h } ( X , \mathsf { s t r i d e } { = } p , \mathsf { k e r n e l } _ { - } \mathsf { s i z e } { = } p ) \} )
|
| 40 |
+
$$
|
| 41 |
+
|
| 42 |
+
The ConvMixer block itself consists of depthwise convolution (i.e., grouped convolution with groups equal to the number of channels, $h$ ) followed by pointwise (i.e., kernel size $1 \times 1$ ) convolution. As we will explain in Sec. 3, ConvMixers work best with unusually large kernel sizes for the depthwise convolution. Each of the convolutions is followed by an activation and post-activation BatchNorm:
|
| 43 |
+
|
| 44 |
+
$$
|
| 45 |
+
\begin{array} { r } { z _ { l } ^ { \prime } = \mathsf { B N } \left( \sigma \{ \mathsf { C o n v D e p t h w i s e } ( z _ { l - 1 } ) \} \right) + z _ { l - 1 } } \\ { z _ { l + 1 } = \mathsf { B N } \left( \sigma \{ \mathsf { C o n v P o i n t w i s e } ( z _ { l } ^ { \prime } ) \} \right) } \end{array}
|
| 46 |
+
$$
|
| 47 |
+
|
| 48 |
+
After many applications of this block, we perform global pooling to get a feature vector of size $h$ , which we pass to a softmax classifier. See Fig. 3 for an implementation of ConvMixer in PyTorch.
|
| 49 |
+
|
| 50 |
+
Design parameters. An instantiation of ConvMixer depends on four parameters: (1) the “width” or hidden dimension $h$ (i.e., the dimension of the patch embeddings), (2) the depth $d$ , or the number of repetitions of the ConvMixer layer, (3) the patch size $p$ which controls the internal resolution of the model, (4) the kernel size $k$ of the depthwise convolutional layer. We name ConvMixers after their hidden dimension and depth, like ConvMixer- $h / d$ . We refer to the original input size $n$ divided by the patch size $p$ as the internal resolution; note, however, that ConvMixers support variable-sized inputs.
|
| 51 |
+
|
| 52 |
+
<table><tr><td colspan="8">Current “Most Interesting” ConvMixer Configurations vs. Other Simple Models</td></tr><tr><td>Network</td><td>Patch Size</td><td>Kernel Size</td><td># Params (×106)</td><td>Throughput (img/sec)</td><td>Act. Fn.</td><td>#Epochs</td><td>ImNet top-1 (%)</td></tr><tr><td>ConvMixer-1536/20 ConvMixer-768/32</td><td>7 7</td><td>9 7</td><td>51.6 21.1</td><td>89 203</td><td>G R</td><td>150 300</td><td>81.37 80.16</td></tr><tr><td>ResNet-152</td><td></td><td>3</td><td>60.2</td><td>872</td><td>R</td><td>150</td><td>79.64</td></tr><tr><td>DeiT-B</td><td>1 16</td><td></td><td>86</td><td>703</td><td>G</td><td>300</td><td>81.8</td></tr><tr><td></td><td>8</td><td></td><td>129</td><td>140</td><td>G</td><td>400</td><td>81.0</td></tr><tr><td>ResMLP-B24/8</td><td></td><td>1</td><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 53 |
+
|
| 54 |
+
Table 1: Models trained and evaluated on $2 2 4 \times 2 2 4$ ImageNet-1k only. See more in Appendix A.
|
| 55 |
+
|
| 56 |
+
Motivation. Our architecture is based on the idea of mixing, as in Tolstikhin et al. (2021). In particular, we chose depthwise convolution to mix spatial locations and pointwise convolution to mix channel locations. A key idea from previous work is that MLPs and self-attention can mix distant spatial locations, i.e., they can have an arbitrarily large receptive field. Consequently, we used convolutions with an unusually large kernel size to mix distant spatial locations.
|
| 57 |
+
|
| 58 |
+
While self-attention and MLPs are theoretically more flexible, allowing for large receptive fields and content-aware behavior, the inductive bias of convolution is well-suited to vision tasks and leads to high data efficiency. By using such a standard operation, we also get a glimpse into the effect of the patch representation itself in contrast to the conventional pyramid-shaped, progressivelydownsampling design of convolutional networks.
|
| 59 |
+
|
| 60 |
+
# 3 Experiments
|
| 61 |
+
|
| 62 |
+
Training setup. We primarily evaluate ConvMixers on ImageNet-1k classification without any pretraining or additional data. We added ConvMixer to the timm framework (Wightman, 2019) and trained it with nearly-standard settings: we used RandAugment (Cubuk et al., 2020), mixup (Zhang et al., 2017), CutMix (Yun et al., 2019), random erasing (Zhong et al., 2020), and gradient norm clipping in addition to default timm augmentation. We used the AdamW (Loshchilov & Hutter, 2018) optimizer and a simple triangular learning rate schedule. Due to limited compute, we did absolutely no hyperparameter tuning on ImageNet and trained for fewer epochs than competitors. Consequently, our models could be over- or under-regularized, and the accuracies we report likely underestimate the capabilities of our model.
|
| 63 |
+
|
| 64 |
+
Results. A ConvMixer-1536/20 with 52M parameters can achieve $8 1 . 4 \%$ top-1 accuracy on ImageNet, and a ConvMixer-768/32 with 21M parameters $8 0 . 2 \%$ (see Table 1). Wider ConvMixers seem to converge in fewer epochs, but are memory- and compute-hungry. They also work best with large kernel sizes: ConvMixer- $1 5 3 6 / 2 0 \log \approx 1 \%$ accuracy when reducing the kernel size from $k = 9$ to $k = 3$ (we discuss kernel sizes more in Appendix A & B). ConvMixers with smaller patches are substantially better in our experiments, similarly to Sandler et al. (2019); we believe larger patches require deeper ConvMixers. With everything held equal except increasing the patch size from 7 to 14, ConvMixer-1536/20 achieves $7 8 . 9 \%$ top-1 accuracy but is around $4 \times$ faster. We trained one model with ReLU to demonstrate that GELU (Hendrycks & Gimpel, 2016), which is popular in recent isotropic models, isn’t necessary.
|
| 65 |
+
|
| 66 |
+
Comparisons. Our model and ImageNet1k-only training setup closely resemble that of recent patchbased models like DeiT (Touvron et al., 2020). Due to ConvMixer’s simplicity, we focus on comparing to only the most basic isotropic patch-based architectures adapted to the ImageNet-1k setting, namely DeiT and ResMLP. Attempting a fair comparison with a standard baseline, we trained ResNets using exactly the same parameters as ConvMixers; while this choice of parameters is suboptimal (Wightman et al., 2021), it is likely also suboptimal for ConvMixers, since we did no hyperparameter tuning.
|
| 67 |
+
|
| 68 |
+
Looking at Table 1 and Fig. 1, ConvMixers achieve competitive accuracies for a given parameter budget: ConvMixer-1536/20 outperforms both ResNet-152 and ResMLP-B24 despite having substantially fewer parameters and is competitive with DeiT-B. ConvMixer-768/32 uses just a third of the parameters of ResNet-152, but is similarly accurate. Note that unlike ConvMixer, the DeiT and ResMLP results involved hyperparameter tuning, and when substantial resources are dedicated to tuning ResNets, including training for twice as many epochs, they only outperform an equivalently-sized ConvMixer by $\approx 0 . 2 \%$ (Wightman et al., 2021). However, ConvMixers are substantially slower at inference than the competitors, likely due to their smaller patch size; hyperparameter tuning and optimizations could narrow this gap. For more discussion and comparisons, see Table 2 and Appendix A.
|
| 69 |
+
|
| 70 |
+
CIFAR-10 Experiments. We also performed smaller-scale experiments on CIFAR-10, where ConvMixers achieve over $9 6 \%$ accuracy with as few as $0 . 7 { \bf M }$ parameters, demonstrating the data efficiency of the convolutional inductive bias. Details of these experiments are presented in Appendix B.
|
| 71 |
+
|
| 72 |
+
# 4 Related Work
|
| 73 |
+
|
| 74 |
+
Isotropic architectures. Vision transformers have inspired a new paradigm of “isotropic” architectures, i.e., those with equal size and shape throughout the network, which use patch embeddings for the first layer. These models look similar to repeated transformer-encoder blocks (Vaswani et al., 2017) with different operations replacing the self-attention and MLP operations. For example, MLP-Mixer (Tolstikhin et al., 2021) replaces them both with MLPs applied across different dimensions (i.e., spatial and channel location mixing); ResMLP (Touvron et al., 2021a) is a data-efficient variation on this theme. CycleMLP (Chen et al., 2021), gMLP (Liu et al., 2021a), and vision permutator (Hou et al., 2021), replace one or both blocks with various novel operations. These are all quite performant, which is typically attributed to the novel choice of operations. In contrast, Melas-Kyriazi (2021) proposed an MLP-based isotropic vision model, and also hypothesized patch embeddings could be behind its performance. ResMLP tried replacing its linear interaction layer with (small-kernel) convolution and achieved good performance, but kept its MLP-based cross-channel layer and did not explore convolutions further. As our investigation of ConvMixers suggests, these works may conflate the effect of the new operations (like self-attention and MLPs) with the effect of the use of patch embeddings and the resulting isotropic architecture.
|
| 75 |
+
|
| 76 |
+
A study predating vision transformers investigates isotropic (or “isometric”) MobileNets (Sandler et al., 2019), and even implements patch embeddings under another name. Their architecture simply repeats an isotropic MobileNetv3 block. They identify a tradeoff between patch size and accuracy that matches our experience, and train similarly performant models (see Appendix A, Table 2). However, their block is substantially more complex than ours; simplicity and motivation sets our work apart.
|
| 77 |
+
|
| 78 |
+
Patches aren’t all you need. Several papers have increased vision transformer performance by replacing standard patch embeddings with a different stem: Xiao et al. (2021) and Yuan et al. (2021a) use a standard convolutional stem, while Yuan et al. (2021b) repeatedly combines nearby patch embeddings. However, this conflates the effect of using patch embeddings with the effect of adding convolution or similar inductive biases e.g., locality. We attempt to focus on the use of patches.
|
| 79 |
+
|
| 80 |
+
CNNs meet ViTs. Many efforts have been made to incorporate features of convolutional networks into vision transformers and vice versa. Self-attention can emulate convolution (Cordonnier et al., 2019) and can be initialized or regularized to be like it (d’Ascoli et al., 2021); other works simply add convolution operations to transformers (Dai et al., 2021; Guo et al., 2021), or include downsampling to be more like traditional pyramid-shaped convolutional networks (Wang et al., 2021). Conversely, self-attention or attention-like operations can supplement or replace convolution in ResNet-style models (Bello et al., 2019; Ramachandran et al., 2019; Bello, 2021). While all of these attempts have been successful in one way or another, they are orthogonal to this work, which aims to emphasize the effect of the architecture common to most ViTs by showcasing it with a less-expressive operation.
|
| 81 |
+
|
| 82 |
+
# 5 Conclusion
|
| 83 |
+
|
| 84 |
+
We presented ConvMixers, an extremely simple class of models that independently mixes the spatial and channel locations of patch embeddings using only standard convolutions. We also highlighted that using large kernel sizes, inspired by the large receptive fields of ViTs and MLP-Mixers, provides a substantial performance boost. While neither our model nor our experiments were designed to maximize accuracy or speed, i.e., we did not search for good hyperparameters, ConvMixers outperform the Vision Transformer and MLP-Mixer, and are competitive with ResNets, DeiTs, and ResMLPs.
|
| 85 |
+
|
| 86 |
+
We provided evidence that the increasingly common “isotropic” architecture with a simple patch embedding stem is itself a powerful template for deep learning. Patch embeddings allow all the downsampling to happen at once, immediately decreasing the internal resolution and thus increasing the effective receptive field size, making it easier to mix distant spatial information. Our title, while an exaggeration, points out that attention isn’t the only export from language processing into computer vision: tokenizing inputs, i.e., using patch embeddings, is also a powerful and important takeaway.
|
| 87 |
+
|
| 88 |
+
While our model is not state-of-the-art, we find its simple patch-mixing design to be compelling. We hope that ConvMixers can serve as a baseline for future patch-based architectures with novel operations, or that they can provide a basic template for new conceptually simple and performant models.
|
| 89 |
+
|
| 90 |
+
Future work. We are optimistic that a deeper ConvMixer with larger patches could reach a desirable tradeoff between accuracy, parameters, and throughput after longer training and more regularization and hyperparameter tuning, similarly to how Wightman et al. (2021) enhanced ResNet performance through carefully-designed training regimens. Low-level optimization of large-kernel depthwise convolution could substantially increase throughput, and small enhancements to our architecture like the addition of bottlenecks or a more expressive classifier could trade simplicity for performance.
|
| 91 |
+
|
| 92 |
+
Due to its large internal resolution and isotropic design, ConvMixer may be especially well-suited for semantic segmentation, and it would be useful to run experiments on this task with a ConvMixer-like model and on other tasks such as object detection. More experiments could be designed to more clearly extricate the effect of patch embeddings from other architectural choices. In particular, for a more in-depth comparison to ViTs and MLP-Mixers, which excel when trained on very large data sets, it is important to investigate the performance of ConvMixers in the regime of large-scale pre-training.
|
| 93 |
+
|
| 94 |
+
A note on paper length. Expecting more text in this paper? Wondering if it’s a workshop paper we hastily submitted to ICLR? No. This paper presents a simple idea, one where we genuinely believe that a short paper presentation is more effective. Do we really need exactly 8 (now 9? 10?) pages to describe every machine learning architecture and algorithm in existence? We proposed an incredibly simple architecture and made a very simple point that we think is worth more discussion: patches work well in convolutional architectures. We think that four and a half pages is more than enough space for this. The details of the experiments and architectures are in the appendix for those who want to read through it all.
|
| 95 |
+
|
| 96 |
+
# References
|
| 97 |
+
|
| 98 |
+
Irwan Bello. Lambdanetworks: Modeling long-range interactions without attention. arXiv preprint arXiv:2102.08602, 2021.
|
| 99 |
+
Irwan Bello, Barret Zoph, Ashish Vaswani, Jonathon Shlens, and Quoc V Le. Attention augmented convolutional networks. In Proceedings of the IEEE/CVF international conference on computer vision, pp. 3286–3295, 2019.
|
| 100 |
+
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.
|
| 101 |
+
Jean-Baptiste Cordonnier, Andreas Loukas, and Martin Jaggi. On the relationship between selfattention and convolutional layers. arXiv preprint arXiv:1911.03584, 2019.
|
| 102 |
+
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.
|
| 103 |
+
Zihang Dai, Hanxiao Liu, Quoc V Le, and Mingxing Tan. Coatnet: Marrying convolution and attention for all data sizes. arXiv preprint arXiv:2106.04803, 2021.
|
| 104 |
+
Stéphane d’Ascoli, Hugo Touvron, Matthew Leavitt, Ari Morcos, Giulio Biroli, and Levent Sagun. Convit: Improving vision transformers with soft convolutional inductive biases. arXiv preprint arXiv:2103.10697, 2021.
|
| 105 |
+
|
| 106 |
+
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.
|
| 107 |
+
|
| 108 |
+
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.
|
| 109 |
+
|
| 110 |
+
Dan Hendrycks and Kevin Gimpel. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016.
|
| 111 |
+
|
| 112 |
+
Qibin Hou, Zihang Jiang, Li Yuan, Ming-Ming Cheng, Shuicheng Yan, and Jiashi Feng. Vision permutator: A permutable mlp-like architecture for visual recognition, 2021.
|
| 113 |
+
|
| 114 |
+
Hanxiao Liu, Zihang Dai, David R So, and Quoc V Le. Pay attention to mlps. arXiv preprint arXiv:2105.08050, 2021a.
|
| 115 |
+
|
| 116 |
+
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.
|
| 117 |
+
|
| 118 |
+
Ilya Loshchilov and Frank Hutter. Fixing weight decay regularization in adam. 2018.
|
| 119 |
+
|
| 120 |
+
Luke Melas-Kyriazi. Do you even need attention? a stack of feed-forward layers does surprisingly well on imagenet, 2021.
|
| 121 |
+
|
| 122 |
+
Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high-performance deep learning library. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d’ Alché-Buc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems 32, pp. 8024–8035. Curran Associates, Inc., 2019.
|
| 123 |
+
|
| 124 |
+
Prajit Ramachandran, Niki Parmar, Ashish Vaswani, Irwan Bello, Anselm Levskaya, and Jonathon Shlens. Stand-alone self-attention in vision models. arXiv preprint arXiv:1906.05909, 2019.
|
| 125 |
+
|
| 126 |
+
Mark Sandler, Jonathan Baccash, Andrey Zhmoginov, and Andrew Howard. Non-discriminative data or weak model? on the relative importance of data and model resolution. In Proceedings of the IEEE/CVF International Conference on Computer Vision Workshops, pp. 0–0, 2019.
|
| 127 |
+
|
| 128 |
+
Ilya Tolstikhin, Neil Houlsby, Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Thomas Unterthiner, Jessica Yung, Daniel Keysers, Jakob Uszkoreit, Mario Lucic, et al. Mlp-mixer: An all-mlp architecture for vision. arXiv preprint arXiv:2105.01601, 2021.
|
| 129 |
+
|
| 130 |
+
Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention. arXiv preprint arXiv:2012.12877, 2020.
|
| 131 |
+
|
| 132 |
+
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. arXiv preprint arXiv:2105.03404, 2021a.
|
| 133 |
+
|
| 134 |
+
Hugo Touvron, Matthieu Cord, Alexandre Sablayrolles, Gabriel Synnaeve, and Hervé Jégou. Going deeper with image transformers. arXiv preprint arXiv:2103.17239, 2021b.
|
| 135 |
+
|
| 136 |
+
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.
|
| 137 |
+
|
| 138 |
+
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. arXiv preprint arXiv:2102.12122, 2021.
|
| 139 |
+
|
| 140 |
+
Ross Wightman. Pytorch image models. https://github.com/rwightman/ pytorch-image-models, 2019.
|
| 141 |
+
Ross Wightman, Hugo Touvron, and Hervé Jégou. Resnet strikes back: An improved training procedure in timm, 2021.
|
| 142 |
+
Tete Xiao, Mannat Singh, Eric Mintun, Trevor Darrell, Piotr Dollár, and Ross Girshick. Early convolutions help transformers see better. arXiv preprint arXiv:2106.14881, 2021.
|
| 143 |
+
Kun Yuan, Shaopeng Guo, Ziwei Liu, Aojun Zhou, Fengwei Yu, and Wei Wu. Incorporating convolution designs into visual transformers. arXiv preprint arXiv:2103.11816, 2021a.
|
| 144 |
+
Li Yuan, Yunpeng Chen, Tao Wang, Weihao Yu, Yujun Shi, Zihang Jiang, Francis EH Tay, Jiashi Feng, and Shuicheng Yan. Tokens-to-token vit: Training vision transformers from scratch on imagenet. arXiv preprint arXiv:2101.11986, 2021b.
|
| 145 |
+
Sangdoo Yun, Dongyoon Han, Seong Joon Oh, Sanghyuk Chun, Junsuk Choe, and Youngjoon Yoo. Cutmix: Regularization strategy to train strong classifiers with localizable features. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 6023–6032, 2019.
|
| 146 |
+
Hongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. arXiv preprint arXiv:1710.09412, 2017.
|
| 147 |
+
Zhun Zhong, Liang Zheng, Guoliang Kang, Shaozi Li, and Yi Yang. Random erasing data augmentation. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 13001–13008, 2020.
|
| 148 |
+
|
| 149 |
+
# A Comparison to other models
|
| 150 |
+
|
| 151 |
+
Table 2: Throughputs measured on an RTX8000 GPU using batch size 64 and fp16. ConvMixers and ResNets trained ourselves. Other statistics: DeiT (Touvron et al., 2020), ResMLP (Touvron et al., 2021a), Swin (Liu et al., 2021b), ViT (Dosovitskiy et al., 2020), MLP-Mixer (Tolstikhin et al., 2021), Isotropic MobileNets (Sandler et al., 2019). We think models with matching colored dots $( \bullet )$ are informative to compare with each other. †Throughput tested, but not trained. Activations: ReLU, GELU.
|
| 152 |
+
|
| 153 |
+
<table><tr><td colspan="8">Comparison with other simple models trained on ImageNet-1k only with input size 224.</td></tr><tr><td>Network</td><td>Patch Size</td><td>Kernel Size</td><td># Params (×106)</td><td>Throughput (img/sec)</td><td>Act. Fn.</td><td>#Epochs</td><td>ImNet top-1 (%)</td></tr><tr><td>ConvMixer-1536/20 :</td><td>7</td><td>9</td><td>51.6</td><td>89</td><td>G G</td><td>150 150</td><td>81.37</td></tr><tr><td>ConvMixer-1536/20</td><td>7</td><td>3</td><td>49.4</td><td>136</td><td>G</td><td></td><td>80.43</td></tr><tr><td>ConvMixer-1536/20</td><td>14</td><td>9</td><td>52.3</td><td>334</td><td></td><td>150 300</td><td>78.92</td></tr><tr><td>ConvMixer-768/32·</td><td>7</td><td>7</td><td>21.1</td><td>203</td><td>R</td><td></td><td>80.16</td></tr><tr><td>ConvMixer-1024/16</td><td>7</td><td>9</td><td>19.4</td><td>173</td><td>G</td><td>100</td><td>79.45</td></tr><tr><td>ConvMixer-1024/12</td><td>7</td><td>8</td><td>14.6</td><td>248</td><td>G</td><td>90</td><td>77.75</td></tr><tr><td>ConvMixer-512/16</td><td>7</td><td>8</td><td>5.4</td><td>403</td><td>G</td><td>90</td><td>73.76</td></tr><tr><td>ConvMixer-512/12</td><td>7</td><td>8</td><td>4.2</td><td>532</td><td>G</td><td>90</td><td>72.59</td></tr><tr><td>ConvMixer-768/32</td><td>14</td><td>3</td><td>20.2</td><td>1258</td><td>R</td><td>300</td><td>74.93</td></tr><tr><td>ConvMixer-1024/20 ·</td><td>14</td><td>9</td><td>24.4</td><td>520</td><td>G</td><td>150</td><td>76.94</td></tr><tr><td>ResNet-152 .</td><td>1</td><td>3</td><td>60.2</td><td>872</td><td>R</td><td>150</td><td>79.64</td></tr><tr><td>ResNet-101</td><td></td><td>3</td><td>44.6</td><td>1040</td><td>R</td><td>150</td><td>78.33</td></tr><tr><td>ResNet-50</td><td>1</td><td>3</td><td>25.6</td><td>1942</td><td>R</td><td>150</td><td>76.32</td></tr><tr><td>DeiT-Bt</td><td>7</td><td>1</td><td>86.7</td><td>77</td><td>G</td><td>1</td><td></td></tr><tr><td>DeiT-St</td><td>7</td><td>1</td><td>22.1</td><td>164</td><td>G</td><td></td><td>1</td></tr><tr><td>DeiT-Tit</td><td>7</td><td>1</td><td>5.7</td><td>327</td><td>G</td><td>1</td><td>一</td></tr><tr><td>DeiT-B·</td><td>16</td><td>1</td><td>86</td><td>703</td><td>G</td><td>300</td><td>1 81.8</td></tr><tr><td>DeiT-S·</td><td>16</td><td></td><td>22</td><td>1491</td><td>G</td><td>300</td><td>79.8</td></tr><tr><td>DeiT-Ti·</td><td>16</td><td>一</td><td>5.7</td><td>2727</td><td>G</td><td>300</td><td>72.2</td></tr><tr><td>ResMLP-S12/8·</td><td>8</td><td></td><td>22.1</td><td>638</td><td>G</td><td>400</td><td></td></tr><tr><td>ResMLP-B24/8·</td><td>8</td><td>一</td><td>129</td><td>140</td><td>G</td><td>400</td><td>79.1 81.0</td></tr><tr><td>ResMLP-B24</td><td>16</td><td>一</td><td>116</td><td>1191</td><td>G</td><td>400</td><td>81.0</td></tr><tr><td>Swin-S ·</td><td>4</td><td></td><td>50</td><td>566</td><td>G</td><td>300</td><td>83.0</td></tr><tr><td>Swin-T ·</td><td>4</td><td></td><td>29</td><td>884</td><td>G</td><td>300</td><td>81.3</td></tr><tr><td>ViT-B/16·</td><td>16</td><td></td><td>86</td><td>704</td><td>G</td><td>300</td><td>77.9</td></tr><tr><td></td><td></td><td>一</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Mixer-B/16·</td><td>16</td><td>1</td><td>59</td><td>816</td><td>G</td><td>300</td><td>76.44</td></tr><tr><td>Isotropic MobileNetv3 ·</td><td>8</td><td>3</td><td>20</td><td></td><td>R</td><td>1</td><td>80.6</td></tr><tr><td>Isotropic MobileNetv3 ·</td><td>16</td><td>3</td><td>20</td><td>一</td><td>R</td><td>1</td><td>77.6</td></tr></table>
|
| 154 |
+
|
| 155 |
+
Experiment overview. We did not design our experiments to maximize accuracy: We chose “common sense” parameters for timm and its augmentation settings, found that it worked well for a ConvMixer-1024/12, and stuck with them for the proceeding experiments. We admit this is not an optimal strategy, however, we were aware from our early experiments on CIFAR-10 that results seemed robust to various small changes. We did not have access to sufficient compute to attempt to tune hyperparameters for each model: e.g., larger ConvMixers could probably benefit from more regularization than we chose, and smaller ones from less regularization. Keeping the parameters the same across ConvMixer instances seemed more reasonable than guessing for each.
|
| 156 |
+
|
| 157 |
+
However, to some extent, we changed the number of epochs per model: for earlier experiments, we merely wanted a “proof of concept”, and used only 90–100 epochs. Once we saw potential, we increased this to 150 epochs and trained some larger models, namely ConvMixer-1024/20 with $p = 1 4$ patches and ConvMixer-1536/20 with $p = 7$ patches. Then, believing that we should explore deeper-but-less-wide ConvMixers, and knowing from CIFAR-10 that the deeper models converged more slowly, we trained ConvMixer-768/32s with $p = 1 4$ and $p = 7$ for 300 epochs. Of course, training time was a consideration: ConvMixer-1536/20 took about 9 days to train (on $1 0 \times \mathrm { R T X 8 0 0 0 s } )$ 150 epochs, and ConvMixer-768/32 is over twice as fast, making 300 epochs more feasible.
|
| 158 |
+
|
| 159 |
+
If anything, we believe that in the worst case, the lack of parameter tuning in our experiments resulted in underestimating the accuracies of ConvMixers. Further, due to our limited compute and the fact that large models (particularly ConvMixers) are expensive to train on large data sets, we generally trained our models for fewer epochs than competition like DeiT and ResMLP (see Table 2).
|
| 160 |
+
|
| 161 |
+
A note on throughput. We measured throughput using batches of 64 images in half precision on a single RTX8000 GPU, averaged over 20 such batches. In particular, we measured CUDA execution time rather than “wall-clock” time. We noticed discrepancies in the relative throughputs of models, e.g., Touvron et al. (2020) reports that ResNet-152 is $2 \times$ faster than DeiT-B, but our measurements show that it is only $1 . 2 5 \times$ faster. We therefore speculate that our throughputs may underestimate the performance of ResNets and ConvMixers relative to the transformers. The difference may be due to using RTX8000 rather than V100 GPUs, or other low-level differences. Our throughputs were similar for batch sizes 32 and 128.
|
| 162 |
+
|
| 163 |
+
ResNets. As a simple baseline to which to compare ConvMixers, we trained three standard ResNets using exactly the same training setup and parameters as ConvMixer-1536/20. Despite having fewer parameters and being architecturally much simpler, ConvMixers substantially outperform these ResNets in terms of accuracy. A possible confounding factor is that ConvMixers use GELU, which may boost performance, while ResNets use ReLU. In an attempt to rule out this confound, we used ReLU in a later ConvMixer-768/32 experiment and found that it still achieved competitive accuracy. We also note that the choice of ReLU vs. GELU was not important on CIFAR-10 experiments (see Table 3). However, ConvMixers do have substantially less throughput.
|
| 164 |
+
|
| 165 |
+
DeiTs. We believe that DeiT is the most reasonable comparison in terms of vision transformers: It only adds additional regularization, as opposed to architectural additions in the case of CaiT (Touvron et al., 2021b), and is then essentially a “vanilla” ViT modulo the distillation token (we don’t consider distilled architectures). In terms of a fixed parameter budget, ConvMixers generally outperform DeiTs. For example, ConvMixer-1536/20 is only $0 . 4 3 \%$ less accurate than DeiT-B despite having over 30M fewer parameters; ConvMixer-768/32 is $0 . 3 6 \%$ more accurate than DeiT-S despite having 0.9M fewer parameters; and ConvMixer-512/16 is $0 . 3 9 \%$ more accurate than DeiT-Ti for nearly the same number of parameters. Admittedly, none of the ConvMixers are very competitive in terms of throughput, with the closest being the ConvMixer-512/16 which is $5 \times$ slower than DeiT-Ti.
|
| 166 |
+
|
| 167 |
+
A confounding factor is the difference in patch size between DeiT and ConvMixer; DeiT uses $p = 1 6$ while ConvMixer uses $p = 7$ . This means DeiT is substantially faster. However, ConvMixers using larger patches are not as competitive. While we were not able to train DeiTs with larger patch sizes, it is possible that they would outperform ConvMixers on the parameter count vs. accuracy curve; however, we tested their throughput for $p = 7$ , and they are even slower than ConvMixers. Given the difference between convolution and self-attention, we are not sure it is salient to control for patch size differences.
|
| 168 |
+
|
| 169 |
+
DeiTs were subject to more hyperparameter tuning than ConvMixers, as well as longer training times. They also used stochastic depth while we did not, which can in some cases contribute percent differences in model accuracy (Touvron et al., 2021a). It is therefore possible that further hyperparameter tuning and more epochs for ConvMixers could close the gap between the two architectures for large patches, e.g., $p = 1 6$ .
|
| 170 |
+
|
| 171 |
+
ResMLPs. Similarly to DeiT for ViT, we believe that ResMLP is the most relevant MLP-Mixer variant to compare against. Unlike DeiT, we can compare against instances of ResMLP with similar patch size: ResMLP-B24/8 has $p = 8$ patches, and underperforms ConvMixer-1536/20 by $0 . 3 7 \%$ , despite having over twice the number of parameters; it also has similarly low throughput. ConvMixer-768/32 also outperforms ResMLP-S12/8 for millions fewer parameters, but $3 \times$ less throughput.
|
| 172 |
+
|
| 173 |
+
ResMLP did not significantly improve in terms of accuracy for halving the patch size from 16 to 8, which shows that smaller patches do not always lead to better accuracy for a fixed architecture and regularization strategy (e.g., training a $p = 8$ DeiT may be challenging).
|
| 174 |
+
|
| 175 |
+
Swin Transformers. While we intend to focus on the most basic isotropic, patch-based architectures for fair comparisons with ConvMixer, it is also interesting to compare to a more complicated model that is closer to state-of-the-art. For a similar parameter budget, ConvMixer is around $1 . 2 \mathrm { - } 1 . 6 \%$ less accurate than the Swin Transformer, while also being $4 { - } 6 \times$ slower. However, considering we did not attempt to tune or optimize our model in any way, we find it surprising that an exceedingly simple patch-based model that uses only plain convolution does not lag too far behind Swin Transformer.
|
| 176 |
+
|
| 177 |
+
Isotropic MobileNets. These models are closest in design to ours, despite using a repeating block that is substantially more complex than the ConvMixer one. Despite this, for a similar number of parameters, we can get similar performance. Notably, isotropic MobileNets seem to suffer less from larger patch sizes than ConvMixers, which makes us optimistic that sufficient parameter tuning could lead to more performant large-patch ConvMixers.
|
| 178 |
+
|
| 179 |
+
Other models. We included ViT and MLP-Mixer instances in our table, though they are not competitive with ConvMixer, DeiT, or ResMLP, even though MLP-Mixer has comparable regularization to ConvMixer. That is, ConvMixer seems to outperform MLP-Mixer and ViT, while being closer to complexity to them in terms of design and training regime than the other competitors, DeiT and ResMLP.
|
| 180 |
+
|
| 181 |
+
Kernel size. While we found some evidence that larger kernels are better on CIFAR-10, we wanted to see if this finding transferred to ImageNet. Consequently, we trained our best-performing model, ConvMixer-1536/20, with kernel size $k = 3$ rather than $k = 9$ . This resulted in a decrease of $0 . 9 4 \%$ top-1 accuracy, which we believe is quite significant relative to the mere 2.2M additional parameters. However, $k = 3$ is substantially faster than $k = 9$ for spatial-domain convolution; we speculate that low-level optimizations could close the performance gap to some extent, e.g., by using implicit instead of explicit padding. Since large-kernel convolutions throughout a model are unconventional, there has likely been low demand for such optimizations.
|
| 182 |
+
|
| 183 |
+
# B Experiments on CIFAR-10
|
| 184 |
+
|
| 185 |
+
Residual connections. We experimented with leaving out one, the other, or both residual connections before settling on the current configuration, and consequently chose to leave out the second residual connection. Our baseline model without the connection achieves $9 5 . 8 8 \%$ accuracy, while including the connection reduces it to $9 4 . 7 8 \%$ . Surprisingly, we see only a $0 . 3 1 \%$ decrease in accuracy for removing all residual connections. We acknowledge that these findings for residual connections may not generalize to deeper ConvMixers trained on larger data sets.
|
| 186 |
+
|
| 187 |
+
Table 3: Small ablation study of training a ConvMixer-256/8 on CIFAR-10.
|
| 188 |
+
|
| 189 |
+
<table><tr><td colspan="2">Ablation of ConvMixer-256/8 on CIFAR-10</td></tr><tr><td>Ablation</td><td>CIFAR-10 Acc. (%)</td></tr><tr><td>Baseline</td><td>95.88</td></tr><tr><td>- Residual in Eq. 2</td><td>95.57</td></tr><tr><td>+ Residual in Eq. 3</td><td>94.78</td></tr><tr><td>BatchNorm→LayerNorm GELU→ReLU</td><td>94.44</td></tr><tr><td></td><td>95.51</td></tr><tr><td>- Mixup and CutMix</td><td>95.92</td></tr><tr><td>-Random Erasing</td><td>95.24</td></tr><tr><td>- RandAug</td><td>92.86</td></tr><tr><td>-Random Scaling</td><td>86.24</td></tr><tr><td>- Gradient Norm Clipping</td><td>86.33</td></tr></table>
|
| 190 |
+
|
| 191 |
+
Normalization. Our model is conceptually similar to the vision transformer and MLP-Mixer, both of which use LayerNorm instead of BatchNorm. We attempted to use LayerNorm instead, and saw a decrease in performance of around $1 \%$ as well as slower convergence (see Table 3). However, this was for a relatively shallow model, and we cannot guarantee that LayerNorm would not hinder ImageNet-scale models to an even larger degree. We note that the authors of ResMLP also saw a relatively small increase in accuracy for replacing LayerNorm with BatchNorm, but for a largerscale experiment (Touvron et al., 2021a). We conclude that BatchNorm is no more crucial to our architecture than other regularizations or parameter settings (e.g., kernel size).
|
| 192 |
+
|
| 193 |
+
Having settled on an architecture, we proceeded to adjust its parameters $h , d , p , k$ as well as weight decay on CIFAR-10 experiments. (Initially, we took the unconventional approach of excluding weight decay since we were already using strong regularization in the form of RandAug and mixup.) We acknowledge that tuning our architecture on CIFAR-10 does not necessarily generalize to performance on larger data sets, and that this is a limitation of our study.
|
| 194 |
+
|
| 195 |
+
# B.1 Results
|
| 196 |
+
|
| 197 |
+
ConvMixers are quite performant on CIFAR-10, easily achieving $> 9 1 \%$ accuracy for as little as 100, 000 parameters, or $> 9 6 \%$ accuracy for only 887, 000 parameters (see Table 4). With additional refinements e.g., a more expressive classifier or bottlenecks, we think that ConvMixer could be even more competitive. For all experiments, we trained for 200 epochs on CIFAR-10 with RandAug, mixup, cutmix, random erasing, gradient norm clipping, and the standard augmentations in timm. We remove some of these augmentations in Table 3, finding that RandAug and random scaling (“default” in timm) are very important, each accounting for over $3 \%$ of the accuracy.
|
| 198 |
+
|
| 199 |
+
Scaling ConvMixer. We adjusted the hidden dimension $h$ and the depth $d$ , finding that deeper networks take longer to converge while wider networks converge faster. That said, increasing the width or the depth is an effective way to increase accuracy; a doubling of depth incurs less compute than a doubling of width. The number of parameters in a ConvMixer is given exactly by:
|
| 200 |
+
|
| 201 |
+
$$
|
| 202 |
+
\# \mathsf { p a r a m s } = h [ d ( k ^ { 2 } + h + 6 ) + c _ { \mathsf { i n } } p ^ { 2 } + n _ { \mathsf { c l a s s e s } } + 3 ] + n _ { \mathsf { c l a s s e s } } ,
|
| 203 |
+
$$
|
| 204 |
+
|
| 205 |
+
including affine scaling parameters in BatchNorm layers, convolutional kernels, and the classifier.
|
| 206 |
+
|
| 207 |
+
Kernel size. We initially hypothesized that large kernels would be important for ConvMixers, as they would allow the mixing of distant spatial information similarly to unconstrained MLPs or selfattention layers. We tried to investigate the effect of kernel size on CIFAR-10: we fixed the model to be a ConvMixer-256/8, and increased the kernel size by 2s from 3 to 15.
|
| 208 |
+
|
| 209 |
+
Using a kernel size of 3, the ConvMixer only achieves $9 3 . 6 1 \%$ accuracy. Simply increasing it to 5 gives an additional $1 . 5 0 \%$ accuracy, and further to 7 an additional $0 . 6 1 \%$ . The gains afterwards are relatively marginal, with kernel size 15 giving an additional $0 . 2 8 \%$ accuracy. It could be that with more training iterations or more regularization, the effect of larger kernels would be more pronounced. Nonetheless, we concluded that ConvMixers benefit from larger-than-usual kernels, and thus used kernel sizes 7 or 9 in most of our later experiments.
|
| 210 |
+
|
| 211 |
+
It is conventional wisdom that large-kernel convolutions can be “decomposed” into stacked smallkernel convolutions with activations between them, and it is therefore standard practice to use $k = 3$ convolutions, stacking more of them to increase the receptive field size with additional benefits from nonlinearities. This raises a question: is the benefit of larger kernels in ConvMixer actually better than simply increasing the depth with small kernels? First, we note that deeper networks are generally harder to train, so by increasing the kernel size independently of the depth, we may recover some of the benefits of depth without making it harder for signals to “propagate back” through the network. To test this, we trained a ConvMixer-256/10 with $k = 3$ (698K parameters) in the same setting as a ConvMixer-256/8 with $k = 9$ (707K parameters), i.e., we increased depth in a smallkernel model to roughly match the parameters of a large-kernel model. The ConvMixer-256/10 achieved $9 4 . 2 9 \%$ accuracy ( $1 . 5 \%$ less), which provides more evidence for the importance of larger kernels in ConvMixers. Next, instead of fixing the parameter budget, we tripled the depth (using the intuition that 3 stacked $k = 3$ convolutions have the receptive field of a $k = 9$ convolution), giving a ConvMixer-256/24 with 1670K parameters, and got $9 5 . 1 6 \%$ accuracy, i.e., still less.
|
| 212 |
+
|
| 213 |
+
Patch size. CIFAR-10 inputs are so small that we initially only used $p = 1$ , i.e., the patch embedding layer does little more than compute $h$ linear combinations of the input image. Using $p = 2$ , we see a reduction in accuracy of about $0 . 8 0 \%$ ; this is a worthy tradeoff in terms of training and inference time. Further increasing the patch size leads to rapid decreases in accuracy, with only $9 2 . 6 1 \%$ for $p = 4$ .
|
| 214 |
+
|
| 215 |
+
Since the “internal resolution” is decreased by a factor of $p$ when increasing the patch size, we assumed that larger kernels would be less important for larger $p$ . We investigated this by again increasing the kernel size from 3 to 11 for ConvMixer-256/8 with $p = 2$ : however, this time, the improvement going from 3 to 5 is only $1 . 1 3 \%$ , and larger kernels than 5 provide only marginal benefit.
|
| 216 |
+
|
| 217 |
+
Weight decay. We did many of our initial experiments with minimal weight decay. However, this was not optimal: by tuning weight decay, we can get an additional $0 . 1 5 \%$ of accuracy for no cost. Consequently, we used weight decay (without tuning) for our larger-scale experiments on ImageNet.
|
| 218 |
+
|
| 219 |
+
Table 4: An investigation of ConvMixer design parameters $h , d , p , k$ and weight decay on CIFAR-10
|
| 220 |
+
|
| 221 |
+
<table><tr><td colspan="7">Tiny ConvMixers trained on CIFAR-10.</td></tr><tr><td>Width h</td><td>Depth d</td><td>Patch Size p</td><td>Kernel Size k</td><td># Params (×103)</td><td>Weight Decay</td><td>CIFAR-10 Acc. (%)</td></tr><tr><td>128</td><td>4</td><td>1</td><td>8</td><td>103</td><td>0</td><td>91.26</td></tr><tr><td>128</td><td>8</td><td>1</td><td>8</td><td>205</td><td>0</td><td>93.83</td></tr><tr><td>128</td><td>12</td><td>1</td><td>8</td><td>306</td><td>0</td><td>94.83</td></tr><tr><td>256</td><td>4</td><td>1</td><td>8</td><td>338</td><td>0</td><td>93.37</td></tr><tr><td>256</td><td>8</td><td>1</td><td>8</td><td>672</td><td>0</td><td>95.60</td></tr><tr><td>256</td><td>12</td><td>1</td><td>8</td><td>1006</td><td>0</td><td>96.39</td></tr><tr><td>256</td><td>16</td><td>1</td><td>8</td><td>1339</td><td>0</td><td>96.74</td></tr><tr><td>256</td><td>20</td><td>1</td><td>8</td><td>1673</td><td>0</td><td>96.67</td></tr><tr><td>↓Kernel adjustments</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td colspan="7">256</td></tr><tr><td>256 256</td><td>8 8</td><td>1 1</td><td>3 5</td><td>559 592</td><td>0 0</td><td>93.61 95.19</td></tr><tr><td>256</td><td>8</td><td>1 1</td><td>7</td><td>641</td><td>0</td><td>95.80</td></tr><tr><td>256</td><td>8</td><td>1</td><td>9</td><td>707</td><td>0</td><td>95.88</td></tr><tr><td>256</td><td>8</td><td>1</td><td>11 13</td><td>788</td><td>0</td><td>95.70</td></tr><tr><td>256</td><td>8</td><td></td><td></td><td>887</td><td>0</td><td>96.04</td></tr><tr><td></td><td>8</td><td>1</td><td>15</td><td>1001</td><td>0</td><td>96.08</td></tr><tr><td colspan="7">↓Patch adjustments</td></tr><tr><td>256</td><td>8</td><td>2</td><td>9</td><td>709</td><td>0</td><td>95.00</td></tr><tr><td>256</td><td>8</td><td>4</td><td>9</td><td>718</td><td>0</td><td>92.61</td></tr><tr><td>256</td><td>8</td><td>8</td><td>9</td><td>755</td><td>0</td><td>85.57</td></tr><tr><td colspan="7">↓Weight decay adjustments</td></tr><tr><td>256 256</td><td>8 8</td><td>1 1</td><td>9 9</td><td>707 707</td><td>1×10-1 1×10-2</td><td>95.88 96.03</td></tr><tr><td>256</td><td>8</td><td>1</td><td>9</td><td>707</td><td>1×10-3</td><td>95.76</td></tr><tr><td>256</td><td>8</td><td>1</td><td>9</td><td>707</td><td>1×10-4</td><td>95.63</td></tr><tr><td>256</td><td>8</td><td>1</td><td>9</td><td>707</td><td>1×10-5</td><td>95.88</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td colspan="7">↓Kernel size adjustments when p = 2</td></tr><tr><td>256 256</td><td>8</td><td>2</td><td>3</td><td>561</td><td>0</td><td>94.08 95.21</td></tr><tr><td>256</td><td>8 8</td><td>2</td><td>5</td><td>594</td><td>0</td><td>95.35</td></tr><tr><td>256</td><td>8</td><td>2</td><td>7</td><td>643</td><td>0</td><td></td></tr><tr><td>256</td><td></td><td>2</td><td>9</td><td>709</td><td>0</td><td>95.00</td></tr><tr><td></td><td>8</td><td>2</td><td>11</td><td>791</td><td>0</td><td>95.14</td></tr><tr><td colspan="7">↓ Adding weight decay to the above</td></tr><tr><td>256 256</td><td>8</td><td>2</td><td>3</td><td>561</td><td>1×10-2</td><td>94.69</td></tr><tr><td>256</td><td>8</td><td>2</td><td>5</td><td>594</td><td>1×10-2</td><td>95.26</td></tr><tr><td></td><td>8</td><td>2</td><td>7</td><td>643</td><td>1×10-2</td><td>95.25</td></tr><tr><td>256</td><td>8</td><td>2</td><td>9</td><td>709</td><td>1×10-2</td><td>95.06</td></tr><tr><td>256</td><td>8</td><td>2</td><td>11</td><td>791</td><td>1×10-2</td><td>95.17</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 222 |
+
|
| 223 |
+
# C Weight Visualizations
|
| 224 |
+
|
| 225 |
+

|
| 226 |
+
Figure 4: Patch embedding weights for a ConvMixer-1024/20 with patch size 14 (see Table 2).
|
| 227 |
+
|
| 228 |
+

|
| 229 |
+
Figure 5: Patch embedding weights for a ConvMixer-768/32 with patch size 7 (see Table 2).
|
| 230 |
+
|
| 231 |
+

|
| 232 |
+
Figure 6: Random subsets of 64 depthwise convolutional kernels from progressively deeper layers of ConvMixer-1536/20 (see Table 1).
|
| 233 |
+
|
| 234 |
+
In Figure 4 and 5, we visualize the (complete) weights of the patch embedding layers of a ConvMixer1536/20 with $p = 1 4$ and a ConvMixer-768/32 with $p = 7$ , respectively. Much like Sandler et al. (2019), the layer consists of Gabor-like filters as well as “colorful globs” or rough edge detectors. The filters seem to be more structured than those learned by MLP-Mixer (Tolstikhin et al., 2021); also unlike MLP-Mixer, the weights look much the same going from $p = 1 4$ to $p = 7$ : the latter simply looks like a downsampled version of the former. It is unclear, then, why we see such a drop in accuracy for larger patches. However, some of the filters essentially look like noise, maybe suggesting a need for more regularization or longer training, or even more data. Ultimately, we cannot read too much into the learned representations here.
|
| 235 |
+
|
| 236 |
+
In Figure 6, we plot the hidden convolutional kernels for successive layers of a ConvMixer. Initially, the kernels seem to be relatively small, but make use of their allowed full size in later layers; there is a clear hierarchy of features as one would expect from a standard convolutional architecture. Interestingly, Touvron et al. (2021a) saw a similar effect for ResMLP, where earlier layers look like small-kernel convolution, while later layers were more diffuse, despite these layers being representated by an unconstrained matrix multiplication rather than convolution.
|
| 237 |
+
|
| 238 |
+
# D Implementation
|
| 239 |
+
|
| 240 |
+
import torch.nn as nn
|
| 241 |
+
2
|
| 242 |
+
3 class Residual(nn.Module):
|
| 243 |
+
4 def __init__(self, fn):
|
| 244 |
+
5 super().__init__()
|
| 245 |
+
6 self.fn $=$ fn
|
| 246 |
+
7
|
| 247 |
+
8 def forward(self, x):
|
| 248 |
+
9 return self.fn $( { \bf x } ) ~ + ~ { \bf x }$
|
| 249 |
+
10
|
| 250 |
+
11 def ConvMixer(dim, depth, kernel_size $^ { = 9 }$ , patch_size $^ { - 7 }$ , n_classes=1000):
|
| 251 |
+
12 return nn.Sequential(
|
| 252 |
+
13 nn.Conv2d(3, dim, kernel_size=patch_size, stride=patch_size),
|
| 253 |
+
14 nn.GELU(),
|
| 254 |
+
15 nn.BatchNorm2d(dim),
|
| 255 |
+
16 \*[nn.Sequential(
|
| 256 |
+
17 Residual(nn.Sequential(
|
| 257 |
+
18 nn.Conv2d(dim, dim, kernel_size, groups $=$ dim, padding $=$ "same"),
|
| 258 |
+
19 nn.GELU(),
|
| 259 |
+
20 nn.BatchNorm2d(dim)
|
| 260 |
+
21 )),
|
| 261 |
+
22 nn.Conv2d(dim, dim, kernel_size $^ { = 1 }$ ),
|
| 262 |
+
23 nn.GELU(),
|
| 263 |
+
24 nn.BatchNorm2d(dim)
|
| 264 |
+
25 ) for i in range(depth)],
|
| 265 |
+
26 nn.AdaptiveAvgPool2d((1,1)),
|
| 266 |
+
27 nn.Flatten(),
|
| 267 |
+
28 nn.Linear(dim, n_classes)
|
| 268 |
+
29 )
|
| 269 |
+
|
| 270 |
+
def ConvMixr(h,d,k,p,n):
|
| 271 |
+
2 S,C, $\mathsf { A } \mathop { = }$ Sequential,Conv2d,lambda x:S(x,GELU(),BatchNorm2d(h))
|
| 272 |
+
3 R=type('',(S,),{'forward':lambda s $, \mathbf { x } : \mathbf { s } \left[ \left. \Theta \right] \left( \mathbf { x } \right) + \mathbf { x } \right\} \mathrm { . }$ )
|
| 273 |
+
4 return S(A(C(3,h,p,p)),\*[S(R(A(C(h,h,k,groups $\mathtt { \Gamma } = \mathtt { h }$ ,padding $\mathbf { \tau } _ { | = \mathbf { k } / \mathbf { \Omega } / 2 }$ ))),A(C(h,h,1))) for i $\hookrightarrow$ in range(d)],AdaptiveAvgPool2d((1,1)),Flatten(),Linear $( \mathtt { h } , \mathtt { n } )$ )
|
| 274 |
+
|
| 275 |
+
Figure 8: An implementation of our model in exactly 280 characters, in case you happen to know of any means of disseminating information that could benefit from such a length. All you need to do to run this is from torch.nn import \*.
|
| 276 |
+
|
| 277 |
+
This section presents an expanded (but still quite compact) version of the terse ConvMixer implementation that we presented in the paper. The code is given in Figure 7. We also present an even more terse implementation in Figure 8, which to the best of our knowledge is the first model that achieves the elusive dual goals of $8 0 \% +$ ImageNet top-1 accuracy while also fitting into a tweet.
|
md/dev/TySnJ-0RdKI/TySnJ-0RdKI.md
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
md/dev/UW5A3SweAH/UW5A3SweAH.md
ADDED
|
Binary file (53.5 kB). View file
|
|
|
md/dev/UmvSlP-PyV/UmvSlP-PyV.md
ADDED
|
@@ -0,0 +1,224 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Beyond neural scaling laws: beating power law scaling via data pruning
|
| 2 |
+
|
| 3 |
+
# Ben Sorscher∗1
|
| 4 |
+
|
| 5 |
+
Robert Geirhos∗2
|
| 6 |
+
|
| 7 |
+
Shashank Shekhar3
|
| 8 |
+
|
| 9 |
+
# Surya Ganguli1,3§
|
| 10 |
+
|
| 11 |
+
Ari S. Morcos3§
|
| 12 |
+
|
| 13 |
+
∗equal contribution 1Department of Applied Physics, Stanford University 2University of Tübingen 3Meta AI (FAIR) §Joint senior authors
|
| 14 |
+
|
| 15 |
+
# Abstract
|
| 16 |
+
|
| 17 |
+
Widely observed neural scaling laws, in which error falls off as a power of the training set size, model size, or both, have driven substantial performance improvements in deep learning. However, these improvements through scaling alone require considerable costs in compute and energy. Here we focus on the scaling of error with dataset size and show how in theory we can break beyond power law scaling and potentially even reduce it to exponential scaling instead if we have access to a high-quality data pruning metric that ranks the order in which training examples should be discarded to achieve any pruned dataset size. We then test this improved scaling prediction with pruned dataset size empirically, and indeed observe better than power law scaling in practice on ResNets trained on CIFAR-10, SVHN, and ImageNet. Next, given the importance of finding high-quality pruning metrics, we perform the first large-scale benchmarking study of ten different data pruning metrics on ImageNet. We find most existing high performing metrics scale poorly to ImageNet, while the best are computationally intensive and require labels for every image. We therefore developed a new simple, cheap and scalable self-supervised pruning metric that demonstrates comparable performance to the best supervised metrics. Overall, our work suggests that the discovery of good data-pruning metrics may provide a viable path forward to substantially improved neural scaling laws, thereby reducing the resource costs of modern deep learning.
|
| 18 |
+
|
| 19 |
+
# 1 Introduction
|
| 20 |
+
|
| 21 |
+
Empirically observed neural scaling laws [1, 2, 3, 4, 5, 6, 7, 8] in many domains of machine learning, including vision, language, and speech, demonstrate that test error often falls off as a power law with either the amount of training data, model size, or compute. Such power law scaling has motivated significant societal investments in data collection, compute, and associated energy consumption. However, power law scaling is extremely weak and unsustainable. For example, a drop in error from $3 \%$ to $2 \%$ might require an order of magnitude more data, compute, or energy. In language modeling with large transformers, a drop in cross entropy loss from about 3.4 to $2 . 8 \mathrm { n a t s } ^ { 2 }$ requires $I O$ times more training data (Fig. 1 in [2]). Also, for large vision transformers, an additional 2 billion pre-training data points (starting from 1 billion) leads to an accuracy gain on ImageNet of a few percentage points (Fig. 1 in [7]). Here we ask whether we might be able to do better. For example, can we achieve exponential scaling instead, with a good strategy for selecting training examples? Such vastly superior scaling would mean that we could go from $3 \%$ to $2 \%$ error by only adding a few carefully chosen training examples, rather than collecting $1 0 \times$ more random ones.
|
| 22 |
+
|
| 23 |
+

|
| 24 |
+
Figure 1: Our analytic theory of data pruning predicts that power law scaling of test error with respect to dataset size can be beaten. A: Test error as a function of $\alpha _ { \mathrm { p r u n e } } = f \alpha _ { \mathrm { t o t } }$ with $\theta = 0$ . We observe an excellent match between our analytic theory (solid curves) and numerical simulations (dots) of perceptron learning at parameters ${ \bf N } = 2 0 0$ (here: ${ \bf N } = 2 0 0$ constant throughout figure). The red curve indicates the Pareto optimal test error $\varepsilon$ achievable from a tradeoff between $\alpha _ { \mathrm { t o t } }$ and $f$ at fixed $\alpha _ { \mathrm { p r u n e } }$ B: We find that when data is abundant (scarce) corresponding to large (small) $\alpha _ { \mathrm { t o t } }$ , the better pruning strategy is to keep the hard (easy) examples. C: Color indicates difference in test error in keeping hard versus easy examples, revealing the change in strategy in (B). D: We tested this prediction on a ResNet18 trained on CIFAR-10, finding remarkably the same shift in optimal pruning strategy under the EL2N metric. E: Test accuracy as a function of $f$ and $\alpha _ { \mathrm { p r u n e } }$ . For every fixed $\alpha _ { \mathrm { p r u n e } }$ , there is an optimal $f _ { \mathrm { o p t } }$ (purple curve). F: $I ( \dot { \alpha } _ { \mathrm { p r u n e } } )$ for different $f$ .
|
| 25 |
+
|
| 26 |
+
Focusing on scaling of performance with training dataset size, we demonstrate that exponential scaling is possible, both in theory and practice. The key idea is that power law scaling of error with respect to data suggests that many training examples are highly redundant. Thus one should in principle be able to prune training datasets to much smaller sizes and train on the smaller pruned datasets without sacrificing performance. Indeed some recent works [9, 10, 11] have demonstrated this possibility by suggesting various metrics to sort training examples in order of their difficulty or importance, ranging from easy or redundant examples to hard or important ones, and pruning datasets by retaining some fraction of the hardest examples. However, these works leave open fundamental theoretical and empirical questions: When and why is successful data pruning possible? What are good metrics and strategies for data pruning? Can such strategies beat power law scaling? Can they scale to ImageNet? Can we leverage large unlabeled datasets to successfully prune labeled datasets? We address these questions through both theory and experiment. Our main contributions are:
|
| 27 |
+
|
| 28 |
+
1. Employing statistical mechanics, we develop a new analytic theory of data pruning in the student-teacher setting for perceptron learning, where examples are pruned based on their teacher margin, with large (small) margins corresponding to easy (hard) examples. Our theory quantitatively matches numerical experiments and reveals two striking predictions:
|
| 29 |
+
|
| 30 |
+
(a) The optimal pruning strategy changes depending on the amount of initial data; with abundant (scarce) initial data, one should retain only hard (easy) examples.
|
| 31 |
+
(b) Exponential scaling is possible with respect to pruned dataset size provided one chooses an increasing Pareto optimal pruning fraction as a function of initial dataset size.
|
| 32 |
+
|
| 33 |
+
2. We show that the two striking predictions derived from theory hold also in practice in much more general settings. Indeed we empirically demonstrate signatures of exponential scaling of error with respect to pruned dataset size for ResNets trained from scratch on SVHN, CIFAR-10 and ImageNet, and Vision Transformers fine-tuned on CIFAR-10.
|
| 34 |
+
|
| 35 |
+
3. Motivated by the importance of finding good quality metrics for data pruning, we perform a large scale benchmarking study of 10 different data pruning metrics at scale on ImageNet, finding that most perform poorly, with the exception of the most compute intensive metrics.
|
| 36 |
+
|
| 37 |
+
4. We leveraged self-supervised learning (SSL) to developed a new, cheap unsupervised data pruning metric that does not require labels, unlike prior metrics. We show this unsupervised metric performs comparably to the best supervised pruning metrics that require labels and much more compute. This result opens the door to the exciting possibility of leveraging pre-trained foundation models to prune new datasets even before they are labeled.
|
| 38 |
+
|
| 39 |
+
Overall these results shed theoretical and empirical insights into the nature of data in deep learning and our ability to prune it, and suggest our current practice of collecting extremely large datasets may be highly inefficient. Our initial results in beating power law scaling motivate further studies and investments in not just inefficently collecting large amounts of random data, but rather, intelligently collecting much smaller amounts of carefully selected data, potentially leading to the creation and dissemination of foundation datasets, in addition to foundation models [12].
|
| 40 |
+
|
| 41 |
+
# 2 Background and related work
|
| 42 |
+
|
| 43 |
+
Our work brings together 3 largely disparate strands of intellectual inquiry in machine learning: (1) explorations of different metrics for quantifying differences between individual training examples; (2) the empirical observation of neural scaling laws; and (3) the statistical mechanics of learning.
|
| 44 |
+
|
| 45 |
+
# 2.1 Pruning metrics: not all training examples are created equal
|
| 46 |
+
|
| 47 |
+
Several recent works have explored various metrics for quantifying individual differences between data points. To describe these metrics in a uniform manner, we will think of all of them as ordering data points by their difficulty, ranging from “easiest” to “hardest.” When these metrics have been used for data pruning, the hardest examples are retained, while the easiest ones are pruned away.
|
| 48 |
+
|
| 49 |
+
EL2N scores. For example [10] trained small ensembles (of about 10) networks for a very short time (about 10 epochs) and computed for every training example the average $L _ { 2 }$ norm of the error vector (EL2N score). Data pruning by retaining only the hardest examples with largest error enabled training from scratch on only $5 0 \%$ and $7 5 \%$ of CIFAR-10 and CIFAR-100 respectively without any loss in final test accuracy. However the performance of EL2N on ImageNet has not yet been explored.
|
| 50 |
+
|
| 51 |
+
Forgetting scores and classification margins. [9] noticed that over the entire course of training, some examples are learned early and never forgotten, while others can be learned and unlearned (i.e. forgotten) repeatedly. They developed a forgetting score which measures the degree of forgetting of each example. Intuitively examples with low (high) forgetting scores can be thought of as easy (hard) examples. [9] explored data pruning using these metrics, but not at ImageNet scale.
|
| 52 |
+
|
| 53 |
+
Memorization and influence. [13] defined a memorization score for each example, corresponding to how much the probability of predicting the correct label for the example increases when it is present in the training set relative to when it is absent; a large increase means the example must be memorized (i.e. the remaining training data do not suffice to correctly learn this example). Additionally [13] also considered an influence score that quantifies how much adding a particular example to the training set increases the probability of the correct class label of a test example. Intuitively, low memorization and influence scores correspond to easy examples that are redundant with the rest of the data, while high scores correspond to hard examples that must be individually learned. [13] did not use these scores for data pruning as their computation is expensive. We note since memorization explicitly approximates the increase in test loss due to removing each individual example, it is likely to be a good pruning metric (though it does not consider interactions).
|
| 54 |
+
|
| 55 |
+
Ensemble active learning. Active learning iterates between training a model and selecting new inputs to be labeled [14, 15, 16, 17, 18]. In contrast, we focus on data pruning: one-shot selection of a data subset sufficient to train to high accuracy from scratch. A variety of coreset algorithms (e.g. [19]) have been proposed for this, but their computation is expensive, and so data-pruning has been less explored at scale on ImageNet. An early clustering approach [20] allowed training on $9 0 \%$ of ImageNet without sacrificing accuracy. Notably [11] reduced this to $8 0 \%$ by training a large ensemble of networks on ImageNet and using ensemble uncertainty to define the difficulty of each example, with low (high) uncertainty corresponding to easy (hard) examples. We will show how to achieve similar pruning performance without labels or the need to train a large ensemble.
|
| 56 |
+
|
| 57 |
+
Diverse ensembles (DDD). [21] assigned a score to every ImageNet image, given by the number of models in a diverse ensemble (10 models) that misclassified the image. Intuitively, low (high) scores correspond to easy (hard) examples. The pruning performance of this metric remains unexplored.
|
| 58 |
+
|
| 59 |
+
Summary. We note: (1) only one of these metrics has tested well for its efficacy in data pruning at scale on ImageNet; (2) all of these metrics require label information; (3) there is no theory of when and why data pruning is possible for any of these metrics; and (4) none of these works suggest the possibility of exponential scaling. We thus go beyond this prior work by benchmarking the data pruning efficacy of not only these metrics but also a new unsupervised metric we introduce that does not require label information, all at scale on ImageNet. We also develop an analytic theory for data-pruning for the margin metric that predicts not only the possibility of exponential scaling but also the novel finding that retaining easy instead of hard examples is better when data is scarce.
|
| 60 |
+
|
| 61 |
+
# 2.2 Neural scaling laws and their potential inefficiency
|
| 62 |
+
|
| 63 |
+
Recent work [1, 2, 3, 4, 5, 6, 7, 8] has demonstrated that test loss $\mathcal { L }$ often falls off as a power law with different resources like model parameters $( N )$ , number of training examples $( P )$ , and amount of compute $( C )$ . However, the exponents $\nu$ of these power laws are often close to 0, suggesting potentially inefficient use of resources. For example, for large models with lots of compute, so that the amount of training data constitutes a performance bottleneck, the loss scales as $ { \mathcal { L } } \approx P ^ { - \nu }$ Specifically for a large transformer based language model, $\nu = 0 . 0 9 5$ , which implies an order of magnitude increase in training data drops cross-entropy loss by only about 0.6 nats (Fig. 1 in [2]). In neural machine translation experiments $\nu$ varies across language pairs from 0.35 to 0.48 (Table 1 in [5]). Interestingly, [8] explored a fixed computation budget $C$ and optimized jointly over model size $N$ and training set size $P$ , revealing that scaling both $N$ and $P$ commensurately as $C$ increases is compute optimal, and can yield smaller high performing models (trained on more data) than previous work. Nevertheless, for a transformer based language model, a $1 0 0 \times$ increase in compute, corresponding to $1 0 \times$ increases in both model size and training set size, leads to a drop in cross-entropy loss of only about 0.5 nats (Fig. 2 in [8]). Similar slow scaling holds for large vision transformers where adding 2 billion pre-training images reduces ImageNet performance by a few percentage points (Fig. 1 in [7]). While all of these results constitute significant improvements in performance, they do come at a substantial resource cost whose fundamental origin arises from power law scaling with small exponents. Recent theoretical works [22, 23, 24] have argued that the power law exponent is governed by the dimension of a data manifold from which training examples are uniformly drawn. Here we explore whether we can beat power law scaling through careful data selection.
|
| 64 |
+
|
| 65 |
+
# 2.3 Statistical mechanics of perceptron learning
|
| 66 |
+
|
| 67 |
+
Statistical mechanics has long played a role in analyzing machine learning problems (see e.g. [25, 26, 27, 28] for reviews). One of the most fundamental applications is perceptron learning in the student-teacher setting [29, 30], in which random i.i.d. Gaussian inputs are labeled by a teacher perceptron to construct a training set. The test error for another student perceptron learning from this training set then scales as a power law with exponent $- 1$ for such data. Such perceptrons have also been analyzed in an active learning setting where the learner is free to design any new input to be labeled [31, 32], rather than choose from a fixed set of inputs, as in data-pruning. Recent work [33] has analyzed this scenario but focused on message passing algorithms that are tailored to the case of Gaussian inputs and perceptrons, and are hard to generalize to real world settings. In contrast we analyze margin based pruning algorithms that are used in practice in diverse settings, as in [9, 10].
|
| 68 |
+
|
| 69 |
+
# 3 An analytic theory of data pruning
|
| 70 |
+
|
| 71 |
+
To better understand data pruning, we employed the replica method from statistical mechanics [34] to develop an analytic theory of pruning for the perceptron in the student-teacher setting [25] (see App. A for detailed derivations of all results). Consider a training dataset of $P$ examples $\{ { \bf x } ^ { \mu } , y ^ { \mu } \} _ { \mu = 1 , \dots , P }$ where $\mathbf { x } ^ { \mu } \in \mathbb { R } ^ { N }$ are i.i.d. zero mean unit variance random Gaussian inputs and $y ^ { \mu } = \operatorname { s i g n } ( \mathbf { T } \cdot \mathbf { x } ^ { \mu } )$ are labels generated by a teacher perceptron with weight vector $\mathbf { T } \in \mathbf { \mathbb { R } } ^ { N }$ . We work in the high dimensional statistics limit where $N , P \to \infty$ but the ratio $\begin{array} { r } { \alpha _ { \mathrm { t o t } } = \frac { P } { N } } \end{array}$ of the number of total training examples to parameters remains $O ( 1 )$ . We then consider a pruning algorithm used in [9, 10], namely: (1) train a probe student perceptron for very few epochs on the training data, obtaining weights $\mathbf { J _ { \mathrm { p r o b e } } }$ ; (2) compute the margin $m ^ { \mu } = { \bf J } _ { \mathrm { p r o b e } } \cdot \left( y ^ { \mu } { \bf x } ^ { \mu } \right)$ of each training example, where large (small) margins correspond to easy (hard) examples; (3) construct a pruned dataset of size $P _ { \mathrm { p r u n e } } = f P$ , where $f$ is the fraction of examples kept, by retaining the $P _ { \mathrm { p r u n e } }$ hardest examples, (4) train a new perceptron to completion on the smaller dataset with a smaller ratio $\begin{array} { r } { \alpha _ { \mathrm { p r u n e } } = \frac { P _ { \mathrm { p r u n e } } } { N } } \end{array}$ of examples to parameters.
|
| 72 |
+
|
| 73 |
+
We are interested in the test error $\varepsilon$ of this final perceptron as a function of $\alpha _ { \mathrm { t o t } } , f$ , and the angle $\theta$ between the probe student $\mathbf { J _ { \mathrm { { p r o b e } } } }$ and the teacher $\mathbf { T }$ . Our theory approximates $\mathbf { J _ { \mathrm { { p r o b e } } } }$ as simply a random Gaussian vector conditioned to have angle $\theta$ with the teacher $\mathbf { T }$ . Under this approximation we obtain an analytic theory for $\varepsilon ( \alpha _ { \mathrm { t o t } } , f , \theta )$ that is asymptotically exact in the high dimensional limit (App. A). We first examine results when $\theta = 0$ , so we are pruning training examples according to their veridical margins with respect to the teacher (Fig. 1A). We find two striking phenomena, each of which constitute predictions in real-world settings that we will successfully confirm empirically.
|
| 74 |
+
|
| 75 |
+
The best pruning strategy depends on the amount of initial data. First, we note the test error curve for $f = 1$ in Fig. 1A corresponding to no pruning, or equivalently to randomly pruning a larger dataset of size $\alpha _ { \mathrm { t o t } }$ down to a size $\alpha _ { \mathrm { p r u n e } }$ , exhibits the well known classical perceptron learning power law scaling $\varepsilon \propto \alpha _ { \mathrm { p r u n e } } ^ { - 1 }$ . Interestingly though, for small $\alpha _ { \mathrm { t o t } }$ , keeping the hardest examples performs worse than random pruning (lighter curves above darkest curve for small $\alpha _ { \mathrm { p r u n e } }$ in Fig. 1A). However, for large $\alpha _ { \mathrm { t o t } }$ , keeping the hardest examples performs substantially better than random pruning (lighter curves below darkest curve for large $\alpha _ { \mathrm { p r u n e } }$ in Fig. 1A). It turns out keeping the easiest rather than hardest examples is a better pruning strategy when $\alpha _ { \mathrm { t o t } }$ is small (Fig. 1C). If one does not have much data to start with, it is better to keep the easiest examples with largest margins (i.e. the blue regions of Fig. 1B) to avoid overfitting. The easiest examples provide coarse-grained information about the target function, while the hard examples provide fine-grained information about the target function which can prevent the model from learning if one starts with lots of data. In cases where overfitting is less of an issue, it is best to keep the hardest examples with smallest margin that provide more information about the teacher’s decision boundary (i.e. the green region of Fig. 1B). Intuitively, in the limited data regime, it is challenging to model outliers since the basics are not adequately captured; hence, it is more important to keep easy examples so that the model can get to moderate error. However, with a larger dataset, the easy examples can be learned without difficulty, making modeling outliers the fundamental challenge.
|
| 76 |
+
|
| 77 |
+
Fig. 1C reveals which pruning strategy is best as a joint function of $\alpha _ { \mathrm { t o t } }$ and $f$ . Note the transition between optimal strategies becomes sharper at small fractions $f$ of data kept. This transition between optimal pruning strategies can be viewed as a prediction in more general settings. To test this prediction we trained a ResNet18 on pruned subsets of the CIFAR-10 dataset (Fig. 1D), and observed strikingly similar behavior, indicating the prediction can hold far more generally, beyond perceptron learning. Interestingly, [9, 10] missed this transition, likely because they started pruning from large datasets.
|
| 78 |
+
|
| 79 |
+
Pareto optimal data pruning can beat power law scaling. A second prediction of our theory is that when keeping a fixed fraction $f$ of the hardest examples as $\alpha _ { \mathrm { t o t } }$ increases (i.e. constant color curves in Fig. 1A), the error initially drops exponentially in $\alpha _ { \mathrm { p r u n e } } = f \alpha _ { \mathrm { t o t } }$ , but then settles into the universal power law $\varepsilon \propto \alpha _ { \mathrm { p r u n e } } ^ { - 1 }$ for all fixed $f$ . Thus there is no asymptotic advantage to data pruning at a fixed $f$ . However, by pruning more aggressively (smaller $f$ ) when given more initial data (larger $\alpha _ { \mathrm { t o t . } }$ ), one can achieve a Pareto optimal test error as a function of pruned dataset size $\alpha _ { \mathrm { p r u n e } }$ that remarkably traces out at least an exponential scaling law (Fig. 1A, purple curve). Indeed our theory predicts for each $\alpha _ { \mathrm { p r u n e } }$ a Pareto optimal point in $\alpha _ { \mathrm { t o t } }$ and $f$ (subject to $\alpha _ { \mathrm { p r u n e } } = f \alpha _ { \mathrm { t o t } } )$ , yielding for every fixed $\alpha _ { \mathrm { p r u n e } }$ an optimal $f _ { \mathrm { o p t } }$ , plotted in Fig. 1E. Note $f _ { \mathrm { o p t } }$ decreases with $\alpha _ { \mathrm { p r u n e } }$ indicating more aggressive pruning (smaller $f _ { \mathrm { o p t } } )$ ) of original datasets of larger size $\alpha _ { \mathrm { t o t } }$ is required to obtain larger Pareto optimal pruned datasets of size $\alpha _ { \mathrm { p r u n e } }$ . We will test this striking scaling prediction in Fig. 3.
|
| 80 |
+
|
| 81 |
+

|
| 82 |
+
Figure 2: Data pruning with an imperfect metric. A: Weight vectors and decision boundaries for a teacher (black) and probe student (red) separated by angle $\theta$ . The black point has margin $0 \left( \kappa \right)$ w.r.t. the probe (teacher). B–D: Test error as a function of $\alpha _ { \mathrm { p r u n e } }$ for different $f$ and different $\theta$ .
|
| 83 |
+
|
| 84 |
+
Beating power law scaling: an information-theoretic perspective. Classical randomly selected data generates slow power law error scaling because each extra training example provides less new information about the correct decision boundary than the previous example. More formally, let $S { \left( \alpha _ { \mathrm { t o t } } \right) }$ denote the typical entropy of the posterior distribution over student perceptron weights consistent with a training set of size $\alpha _ { \mathrm { t o t } }$ . The information gain $I ( \alpha _ { \mathrm { t o t } } )$ due to additional examples beyond $\alpha _ { \mathrm { t o t } }$ can be defined as the rate at which the posterior entropy is reduced: $\begin{array} { r } { I ( \alpha _ { \mathrm { t o t } } ) = - \frac { d } { d \alpha _ { \mathrm { t o t } } } S ( \alpha _ { \mathrm { t o t } } ) } \end{array}$ . In classical perceptron learning $I ( \alpha _ { \mathrm { t o t } } )$ decays to zero as a power law in $\alpha _ { \mathrm { t o t } }$ , reflecting a vanishing amount of information per each new example, leading to the slow power law decay of test error $\varepsilon \propto \alpha _ { \mathrm { t o t } } ^ { - 1 }$ . However, data pruning can increase the information gained per example by pruning away the uninformative examples. To show this, we generalized the replica calculation of the posterior entropy $S$ and information gain $I$ from random datasets of size $\alpha _ { \mathrm { t o t } }$ to pruned datasets of size $\alpha _ { \mathrm { p r u n e } }$ (App. A). We plot the resulting information gain $I ( \alpha _ { \mathrm { p r u n e } } )$ for different $f$ in Fig. 1F. For any fixed $f$ $\dot { \mathbf { \rho } } , I ( \alpha _ { \mathrm { p r u n e } } )$ will eventually decay as a power law as $\alpha _ { \mathrm { p r u n e } } ^ { - 1 }$ . However, by more aggressively pruning (smaller $f$ ) datasets of larger size $\alpha _ { \mathrm { t o t } }$ , $I ( \alpha _ { \mathrm { p r u n e } } )$ can converge to a finite value $I ( \infty ) = 1$ nat/example, resulting in larger pruned datasets only adding useful non-redundant information. Since each new example under Pareto optimal data pruning conveys finite information about the target decision boundary, as seen in Fig. 1F, the test error can decay at least exponentially in pruned dataset size as in Fig. 1A. Classical results [30] have shown that training examples chosen by maximizing the disagreement of a committee of student perceptrons can provide an asymptotically finite information rate, leading to exponential decay in test error. Intriguingly, the Pareto-optimal data pruning strategy we study in this work leads to faster than exponential decay, because it includes (partial) information about the target function provided by the probe student (Fig. 11).
|
| 85 |
+
|
| 86 |
+
An imperfect pruning metric yields a cross over from exponential to power law scaling. We next examine the case of nonzero angle $\theta$ between the probe student $\mathbf { J _ { \mathrm { p r o b e } } }$ and the teacher $\mathbf { T }$ , such that the ranking of training examples by margin is no longer completely accurate (Fig. 2A). Retaining the hard examples with smallest margin with respect to the probe student will always result in pruned datasets lying near the probe’s decision boundary. But if $\theta$ is large, such examples might be far from the teacher’s decision boundary, and therefore could be less informative about the teacher (Fig. 2A). As a result our theory, confirmed by simulations, predicts that under nonzero angles $\theta$ , the Pareto optimal lower envelope of test error over both $\alpha _ { \mathrm { t o t } }$ and $f$ initially scales exponentially as a function of $\alpha _ { \mathrm { p r u n e } } = f \alpha _ { \mathrm { t o t } }$ but then crosses over to a power law (Fig. 2BCD). Indeed, at any given nonzero $\theta$ , our theory reveals that as $\alpha _ { \mathrm { t o t } }$ (and therefore $\alpha _ { \mathrm { p r u n e . } }$ ) becomes large, one cannot decrease test error any further by retaining less than a minimum fraction $f _ { \mathrm { m i n } } ( \theta )$ of all available data. For example when $\theta = 1 0 ^ { \circ } \overset { \cdot } { ( } \theta = 2 0 ^ { \circ } )$ one can do no better asymptotically than pruning down to $24 \%$ $( 4 6 \% )$ of the total data (Fig. 2CD). As $\theta$ approaches 0, $f _ { \mathrm { m i n } } ( \theta )$ approaches 0, indicating that one can prune extremely aggressively to arbitrarily small $f$ while still improving performance, leading to at least exponential scaling for arbitrarily large $\alpha _ { \mathrm { p r u n e } }$ in Fig. 2B. However, for nonzero $\theta$ , the lack of improvement for $f < f _ { \mathrm { m i n } } ( \theta )$ at large $\alpha _ { \mathrm { p r u n e } }$ renders aggressive pruning ineffective. This result highlights the importance of finding high quality pruning metrics with $\theta \approx 0$ . Such metrics can delay the cross over from exponential to power law scaling as pruned dataset size $\alpha _ { \mathrm { p r u n e } }$ increases, by making aggressive pruning with very small $f$ highly effective. Strikingly, in App. Fig. 10 we demonstrate this cross-over in a real-world setting by showing that the test error on SVHN is bounded below by a power law when the dataset is pruned by a probe ResNet18 under the EL2N metric, trained for 4 epochs (weak pruning metric) but not a probe ResNet18 trained for 40 epochs (strong pruning metric).
|
| 87 |
+
|
| 88 |
+

|
| 89 |
+
Figure 3: Beating power law scaling in practice. A–D: Curves of test error against pruned dataset size in 4 settings. Pruning scores were EL2N [10] for CIFAR-10 and SVHN and memorization [13] for ImageNet. See App. B for all pruning/training details and App. D for similar ImageNet plots with EL2N. Note solid curves reflect performance with a fixed total dataset size; if we prune more aggressively with even larger datasets, scaling could improve further (e.g., dashed lines in A). Error curves with no data pruning $( f = 1 )$ are labeled with their best-fit power law scaling $\sim \alpha ^ { - \nu }$ . (Note that for SVHN in B an asymptotic constant error $E ( P \infty ) = 1 . \bar { 1 } \%$ is subtracted from each of the curves to visualize the power law scaling more clearly.)
|
| 90 |
+
|
| 91 |
+

|
| 92 |
+
Figure 4: Data pruning improves transfer learning. A: CIFAR-10 performance of a ViT pre-trained on all of ImageNet21K and fine-tuned on different pruned subsets of CIFAR-10 under the EL2N metric. B: CIFAR-10 performance of ResNet50s pretrained on different pruned subsets of ImageNet1K and fine-tuned on all of CIFAR10.
|
| 93 |
+
|
| 94 |
+
# 4 Data pruning can beat power law scaling in practice
|
| 95 |
+
|
| 96 |
+
Our theory of data pruning for the perceptron makes three striking predictions which can be tested in more general settings, such as deep neural networks trained on benchmark datasets: (1) relative to random data pruning, keeping only the hardest examples should help when the initial dataset size is large, but hurt when it is small; (2) data pruning by retaining a fixed fraction $f$ of the hardest examples should yield power law scaling, with exponent equal to that of random pruning, as the initial dataset size increases; (3) the test error optimized over both initial data set size and fraction of data kept can trace out a Pareto optimal lower envelope that beats power law scaling of test error as a function of pruned dataset size, through more aggressive pruning at larger initial dataset size. We verified all three of these predictions on ResNets trained on SVHN, CIFAR-10, and ImageNet using varying amounts of initial dataset size and fractions of data kept under data pruning (compare theory in Fig. 3A with deep learning experiments in Fig. 3BCD). In each experimental setting we see better than power law scaling at larger initial data set sizes and more aggressive pruning. Moreover we would likely see even better scaling with even larger initial datasets (as in Fig.3A dashed lines).
|
| 97 |
+
|
| 98 |
+
Data pruning improves transfer learning. Modern foundation models are pre-trained on a large initial dataset, and then transferred to other downstream tasks by fine-tuning on them. We therefore examined whether data-pruning can be effective for both reducing the amount of fine-tuning data and the amount of pre-training data. To this end, we first analyzed a vision transformer (ViT) pre-trained on ImageNet21K and then fine-tuned on different pruned subsets of CIFAR-10. Interestingly, pre-trained models allow for far more aggressive data pruning; fine-tuning on only $10 \%$ of CIFAR-10 can match or exceed performance obtained by fine tuning on all of CIFAR-10 (Fig. 4A). Furthermore Fig. 4A provides a new example of beating power law scaling in the setting of fine-tuning. Additionally, we examined the efficacy of pruning pre-training data by pre-training ResNet50s on different pruned subsets of ImageNet1K (exactly as in Fig. 3D) and then fine-tuning them on all of CIFAR-10. Fig. 4B demonstrates pre-training on as little as $5 0 \%$ of ImageNet can match or exceed CIFAR-10 performance obtained by pre-training on all of ImageNet. Thus intriguingly pruning pre-training data on an upstream task can still maintain high performance on a different downstream task. Overall these results demonstrate the promise of data pruning in transfer learning for both the pre-training and fine-tuning phases.
|
| 99 |
+
|
| 100 |
+

|
| 101 |
+
Figure 5: Dataset pruning at ImageNet scale. A: Spearman’s rank correlation between all pairs of ImageNet metric scores, along with hierarchical clustering (as provided by seaborn.clustermap). B: Benchmarking existing supervised metrics on ImageNet (top-5 validation accuracy). C: Comparing top-5 performance on ImageNet when pruning according to the best existing supervised metric (memorization) and our supervised and self-supervised prototype metrics. In all 3 cases, training on $80 \%$ of ImageNet approximates training on $100 \%$ . See App. B for pruning and training details.
|
| 102 |
+
|
| 103 |
+
# 5 Benchmarking supervised pruning metrics on ImageNet
|
| 104 |
+
|
| 105 |
+
We note that the majority of data pruning experiments have been performed on small-scale datasets (i.e. variants of MNIST and CIFAR), while the few pruning metrics proposed for ImageNet have rarely been compared against baselines designed on smaller datasets. Therefore, it is currently unclear how most pruning methods scale to ImageNet and which method is best. Motivated by how strongly the quality of a pruning metric can impact performance in theory (Fig. 2), we decided to fill this knowledge gap by performing a systematic evaluation of 8 different supervised pruning metrics on ImageNet: two variants of influence scores [13], two variants of EL2N [10], DDD [21], memorization [13], ensemble active learning [11], and forgetting [9]. See Section 2 for a review of these metrics. Additionally, we include two new prototypicality metrics that we introduce in the next section.
|
| 106 |
+
|
| 107 |
+
We first asked how consistent the rankings induced by different metrics are by computing the Spearman rank correlation between each pair of metrics (Fig. 5A). Interestingly, we found substantial diversity across metrics, though some (EL2N, DDD, and memorization) were fairly similar with rank correlations above 0.7. However, we observed marked performance differences between metrics: Fig 5BC shows test performance when a fraction $f$ of the hardest examples under each metric are kept in the training set. Despite the success of many of these metrics on smaller datasets, only a few still match performance obtained by training on the full dataset, when selecting a significantly smaller training subset (i.e. about $8 0 \%$ of ImageNet). Nonetheless, most metrics continue to beat random pruning, with memorization in particular demonstrating strong performance (Fig. 5C). We note that data pruning on ImageNet may be more difficult than data pruning on other datasets, because ImageNet is already carefully curated to filter out uninformative examples.
|
| 108 |
+
|
| 109 |
+
We found that all pruning metrics amplify class imbalance, which results in degraded performance. To solve this we used a simple $5 0 \%$ class balancing ratio for all ImageNet experiments. Further details and baselines without class balancing are shown in App. H.
|
| 110 |
+
|
| 111 |
+
# 6 Self-supervised data pruning through a prototypicality metric
|
| 112 |
+
|
| 113 |
+
Fig. 5 shows many data pruning metrics do not scale well to ImageNet, while the few that do require substantial amounts of compute. Furthermore, all these metrics require labels, thereby limiting their ability to prune data for large-scale foundation models trained on massive unlabeled datasets [12]. Thus there is a clear need for simple, scalable, self-supervised pruning metrics.
|
| 114 |
+
|
| 115 |
+
To compute a self-supervised pruning metric for ImageNet, we perform $k$ -means clustering in the embedding space of an ImageNet pre-trained self-supervised model (here: SWaV [35]), and define the difficulty of each data point by the Euclidean distance to its nearest cluster centroid, or prototype. Thus easy (hard) examples are the most (least) prototypical. Encouragingly, in Fig. 5C, we find our self-supervised prototype metric matches or exceeds the performance of the best supervised metric, memorization, until only $70 \mathrm { - } 8 0 \%$ of the data is kept, despite the fact that our metric does not use labels and is much simpler and cheaper to compute than many previously proposed supervised metrics. See App. Fig. 9 for further scaling experiments using the self-supervised metric.
|
| 116 |
+
|
| 117 |
+
To assess whether the clusters found by our metric align with ImageNet classes, we compared their overlaps in Fig. 6A. Interestingly, we found alignment for some but not all classes. For example, class categories such as snakes were largely aligned to a small number of unsupervised clusters, while other classes were dispersed across many such clusters. If class information is available, we can enforce alignment between clusters and classes by simply computing a single prototype for each class (by averaging the embeddings of all examples of this class). While originally intended to be an additional baseline metric (called supervised prototypes, light blue in Fig 5C), this metric remarkably outperforms other supervised metrics and largely matches the performance of memorization, which is prohibitively expensive to compute. Moreover, the performance of the best self-supervised and supervised metrics are similar, demonstrating the promise of self-supervised pruning.
|
| 118 |
+
|
| 119 |
+
One important choice for the self-supervised prototype metric is the number of clusters $k$ . We found, reassuringly, our results were robust to this choice: $k$ can deviate one order of magnitude more or less than the true number of classes (i.e. 1000 for ImageNet) without affecting performance (App. F).
|
| 120 |
+
|
| 121 |
+
To better understand example difficulty under various metrics, we visualize extremal images for our self-supervised prototype metric and the memorization metric for one class (Fig 6B,C). Qualitatively, easy examples correspond to highly similar, redundant images, while hard examples look like idiosyncratic outliers. See App. E, Figs. 12,13,14,15,16,17,18,19 for more classes and metrics.
|
| 122 |
+
|
| 123 |
+

|
| 124 |
+
Figure 6: A: Heat map where each row denotes the probability that images in a given cluster come from each ImageNet class. B: The four easiest and hardest images under our self-supervised pruning metric and the best previously published supervised metric (memorization, shown in C) for ImageNet class 100 (black swan).
|
| 125 |
+
|
| 126 |
+
# 7 Discussion
|
| 127 |
+
|
| 128 |
+
Summary. We have shown, both in theory and practice, how to break beyond slow power law scaling of error versus dataset size to faster exponential scaling, through data pruning. Additionally we have developed a simple self-supervised pruning metric that enables us to discard $20 \%$ of ImageNet without sacrificing performance, on par with the best and most compute intensive supervised metric.
|
| 129 |
+
|
| 130 |
+
Limitations. The most notable limitation is that achieving exponential scaling requires a high quality data pruning metric. Since most metrics developed for smaller datasets scale poorly to ImageNet, our results emphasize the importance of future work in identifying high quality, scalable metrics. Our self-supervised metric provides a strong initial baseline. Moreover, a key advantage of data pruning is reduced computational cost due to training on a smaller dataset for the same number of epochs as the full dataset (see App. C). However, we found that performance often increased when training on the pruned dataset for the same number of iterations as on the full dataset, resulting in the same training time, but additional training epochs. However, this performance gain saturated before training time on the pruned dataset approached that on the whole dataset (App. J) thereby still yielding a computational efficiency gain. Overall this tradeoff between accuracy and training time on pruned data is important to consider in evaluating potential gains due to data pruning. Finally, we found that class-balancing was essential to maintain performance on data subsets (App. H). Future work will be required to identify ways to effectively select the appropriate amount of class-balancing.
|
| 131 |
+
|
| 132 |
+
Ethical considerations. A potential negative societal impact could be that data-pruning leads to unfair outcomes for certain groups. We have done a preliminary analysis of how data-pruning affects performance on individual ImageNet classes (App. I), finding no substantial differential effects across classes. However proper fairness tests specific to deployment settings should always be conducted on every model, whether trained on pruned data or not. Additionally, we analyzed the impact of pruning on OOD performance (App. K).
|
| 133 |
+
|
| 134 |
+
Outlook: Towards foundation datasets. We believe the most promising future direction is the further development of scalable, unsupervised data pruning metrics. Indeed our theory predicts that the application of pruning metrics on larger scale datasets should yield larger gains by allowing more aggressive pruning. This makes data pruning especially exciting for use on the massive unlabeled datasets used to train large foundation models (e.g. 400M image-text pairs for CLIP [36], 3.5B Instagram images [37], 650M images for the DALLE-2 encoder [38], 780B tokens for PALM [39]). If highly pruned versions of these datasets can be used to train a large number of different models, one can conceive of such carefully chosen data subsets as foundation datasets in which the initial computational cost of data pruning can be amortized across efficiency gains in training many downstream models, just at the initial computational cost of training foundation models is amortized across the efficiency gains of fine-tuning across many downstream tasks. Together, our results demonstrate the promise and potential of data pruning for large-scale training and pretraining.
|
| 135 |
+
|
| 136 |
+
# References
|
| 137 |
+
|
| 138 |
+
[1] Joel Hestness, Sharan Narang, Newsha Ardalani, Gregory Diamos, Heewoo Jun, Hassan Kianinejad, Md Patwary, Mostofa Ali, Yang Yang, and Yanqi Zhou. Deep learning scaling is predictable, empirically. arXiv preprint arXiv:1712.00409, 2017.
|
| 139 |
+
[2] Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020.
|
| 140 |
+
[3] Tom Henighan, Jared Kaplan, Mor Katz, Mark Chen, Christopher Hesse, Jacob Jackson, Heewoo Jun, Tom B Brown, Prafulla Dhariwal, Scott Gray, et al. Scaling laws for autoregressive generative modeling. arXiv preprint arXiv:2010.14701, 2020.
|
| 141 |
+
[4] Jonathan S. Rosenfeld, Amir Rosenfeld, Yonatan Belinkov, and Nir Shavit. A constructive prediction of the generalization error across scales. International Conference on Learning Representations, 2020.
|
| 142 |
+
[5] Mitchell A Gordon, Kevin Duh, and Jared Kaplan. Data and parameter scaling laws for neural machine translation. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 5915–5922, Online and Punta Cana, Dominican Republic, November 2021. Association for Computational Linguistics.
|
| 143 |
+
[6] Danny Hernandez, Jared Kaplan, Tom Henighan, and Sam McCandlish. Scaling laws for transfer. arXiv preprint arXiv:2102.01293, 2021.
|
| 144 |
+
[7] Xiaohua Zhai, Alexander Kolesnikov, Neil Houlsby, and Lucas Beyer. Scaling vision transformers. arXiv preprint arXiv:2106.04560, 2021.
|
| 145 |
+
[8] Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, Diego de Las Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, et al. Training compute-optimal large language models. arXiv preprint arXiv:2203.15556, 2022.
|
| 146 |
+
[9] Mariya Toneva, Alessandro Sordoni, Remi Tachet des Combes, Adam Trischler, Yoshua Bengio, and Geoffrey J Gordon. An empirical study of example forgetting during deep neural network learning. In ICLR, 2019.
|
| 147 |
+
[10] Mansheej Paul, Surya Ganguli, and Gintare Karolina Dziugaite. Deep learning on a data diet: Finding important examples early in training. Adv. Neural Inf. Process. Syst., 34, December 2021.
|
| 148 |
+
[11] Kashyap Chitta, José M Álvarez, Elmar Haussmann, and Clément Farabet. Training data subset search with ensemble active learning. IEEE Trans. Intell. Transp. Syst., pages 1–12, 2021.
|
| 149 |
+
[12] 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.
|
| 150 |
+
[13] Vitaly Feldman and Chiyuan Zhang. What neural networks memorize and why: Discovering the long tail via influence estimation. Adv. Neural Inf. Process. Syst., 33:2881–2891, 2020.
|
| 151 |
+
[14] Burr Settles. Active learning literature survey. Technical Report, 2009.
|
| 152 |
+
[15] Antoine Bordes, Seyda Ertekin, Jason Weston, Léon Botton, and Nello Cristianini. Fast kernel classifiers with online and active learning. J. Mach. Learn. Res., 6(9), 2005.
|
| 153 |
+
[16] Zeyad Ali Sami Emam, Hong-Min Chu, Ping-Yeh Chiang, Wojciech Czaja, Richard Leapman, Micah Goldblum, and Tom Goldstein. Active learning at the ImageNet scale. arXiv preprint arXiv:2111.12880, 2021.
|
| 154 |
+
[17] Ozan Sener and Silvio Savarese. Active learning for convolutional neural networks: A core-set approach. arXiv preprint arXiv:1708.00489, 2017.
|
| 155 |
+
[18] Siddharth Karamcheti, Ranjay Krishna, Li Fei-Fei, and Christopher D Manning. Mind your outliers! Investigating the negative impact of outliers on active learning for visual question answering. arXiv preprint arXiv:2107.02331, 2021.
|
| 156 |
+
[19] Baharan Mirzasoleiman, Jeff Bilmes, and Jure Leskovec. Coresets for data-efficient training of machine learning models. In Hal Daumé Iii and Aarti Singh, editors, Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pages 6950–6960. PMLR, 2020.
|
| 157 |
+
[20] V Birodkar, H Mobahi, and S Bengio. Semantic redundancies in Image-Classification datasets: The $10 \%$ you don’t need. arXiv preprint arXiv:1901.11409, 2019.
|
| 158 |
+
[21] Kristof Meding, Luca M. Schulze Buschoff, Robert Geirhos, and Felix A. Wichmann. Trivial or impossible—dichotomous data difficulty masks model differences (on ImageNet and beyond). In International Conference on Learning Representations, 2022.
|
| 159 |
+
[22] Utkarsh Sharma and Jared Kaplan. Scaling laws from the data manifold dimension. Journal of Machine Learning Research, 23(9):1–34, 2022.
|
| 160 |
+
[23] Yasaman Bahri, Ethan Dyer, Jared Kaplan, Jaehoon Lee, and Utkarsh Sharma. Explaining neural scaling laws. CoRR, abs/2102.06701, 2021.
|
| 161 |
+
[24] Jonathan S. Rosenfeld. Scaling Laws for Deep Learning. PhD thesis, Massachusetts Institute of Technology, USA, 2021.
|
| 162 |
+
[25] A Engel and C V den Broeck. Statistical Mechanics of Learning. Cambridge Univ. Press, 2001.
|
| 163 |
+
[26] Madhu Advani, Subhaneil Lahiri, and Surya Ganguli. Statistical mechanics of complex neural systems and high dimensional data. J. Stat. Mech: Theory Exp., 2013(03):P03014, 2013.
|
| 164 |
+
[27] Yasaman Bahri, Jonathan Kadmon, Jeffrey Pennington, Sam S Schoenholz, Jascha SohlDickstein, and Surya Ganguli. Statistical mechanics of deep learning. Annual Review of Condensed Matter Physics, March 2020.
|
| 165 |
+
[28] Lenka Zdeborová and Florent Krzakala. Statistical physics of inference: thresholds and algorithms. Adv. Phys., 65(5):453–552, September 2016.
|
| 166 |
+
[29] E Gardner. The space of interactions in neural network models. J. of Physics A, 21:257–270, 1988.
|
| 167 |
+
[30] H S Seung, H Sompolinsky, and N Tishby. Statistical mechanics of learning from examples. Phys. Rev. A, 45(8):6056, 1992.
|
| 168 |
+
[31] Yoav Freund, H Sebastian Seung, Eli Shamir, and Naftali Tishby. Information, prediction, and query by committee. Adv. Neural Inf. Process. Syst., 5, 1992.
|
| 169 |
+
[32] Hai-Jun Zhou. Active online learning in the binary perceptron problem. Commun. Theor. Phys., 71(2):243, February 2019.
|
| 170 |
+
[33] Hugo Cui, Luca Saglietti, and Lenka Zdeborovà. Large deviations in the perceptron model and consequences for active learning, 2021.
|
| 171 |
+
[34] M Mezard, G Parisi, and M A Virasoro. Spin glass theory and beyond. World scientific Singapore, 1987.
|
| 172 |
+
[35] Mathilde Caron, Ishan Misra, Julien Mairal, Priya Goyal, Piotr Bojanowski, and Armand Joulin. Unsupervised learning of visual features by contrasting cluster assignments. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 9912–9924. Curran Associates, Inc., 2020.
|
| 173 |
+
[36] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International Conference on Machine Learning, pages 8748–8763. PMLR, 2021.
|
| 174 |
+
[37] Dhruv Mahajan, Ross Girshick, Vignesh Ramanathan, Kaiming He, Manohar Paluri, Yixuan Li, Ashwin Bharambe, and Laurens Van Der Maaten. Exploring the limits of weakly supervised pretraining. In Proceedings of the European conference on computer vision (ECCV), pages 181–196, 2018.
|
| 175 |
+
[38] Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022.
|
| 176 |
+
[39] 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.
|
| 177 |
+
[40] Priya Goyal, Quentin Duval, Jeremy Reizenstein, Matthew Leavitt, Min Xu, Benjamin Lefaudeux, Mannat Singh, Vinicius Reis, Mathilde Caron, Piotr Bojanowski, Armand Joulin, and Ishan Misra. VISSL. https://github.com/facebookresearch/vissl, 2021.
|
| 178 |
+
[41] 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.
|
| 179 |
+
[42] 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 Proceedings of the 2020 Conference on Fairness, Accountability, and Transparency, pages 547–558, 2020.
|
| 180 |
+
[43] Yuki M Asano, Christian Rupprecht, Andrew Zisserman, and Andrea Vedaldi. PASS: An ImageNet replacement for self-supervised pretraining without humans. arXiv preprint arXiv:2109.13228, 2021.
|
| 181 |
+
[44] Ross Wightman. Pytorch image models. https://github.com/rwightman/ pytorch-image-models, 2019.
|
| 182 |
+
[45] Justin M Johnson and Taghi M Khoshgoftaar. Survey on deep learning with class imbalance. Journal of Big Data, 6(1):1–54, 2019.
|
| 183 |
+
[46] Robert Geirhos, Kantharaju Narayanappa, Benjamin Mitzkus, Tizian Thieringer, Matthias Bethge, Felix A Wichmann, and Wieland Brendel. Partial success in closing the gap between human and machine vision. Advances in Neural Information Processing Systems, 34:23885– 23899, 2021.
|
| 184 |
+
[47] Felix A Wichmann, David HJ Janssen, Robert Geirhos, Guillermo Aguilar, Heiko H Schütt, Marianne Maertens, and Matthias Bethge. Methods and measurements to compare men against machines. Electronic Imaging, Human Vision and Electronic Imaging, 2017(14):36–45, 2017.
|
| 185 |
+
[48] Robert Geirhos, Carlos RM Temme, Jonas Rauber, Heiko H Schütt, Matthias Bethge, and Felix A Wichmann. Generalisation in humans and deep neural networks. In Advances in Neural Information Processing Systems, 2018.
|
| 186 |
+
[49] 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, 2019.
|
| 187 |
+
[50] Haohan Wang, Songwei Ge, Zachary Lipton, and Eric P Xing. Learning robust global representations by penalizing local predictive power. Advances in Neural Information Processing Systems, 32, 2019.
|
| 188 |
+
[51] Robert Geirhos, Kristof Meding, and Felix A Wichmann. Beyond accuracy: quantifying trialby-trial behaviour of CNNs and humans by measuring error consistency. Advances in Neural Information Processing Systems, 33, 2020.
|
| 189 |
+
[52] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Delving deep into rectifiers: Surpassing human-level performance on ImageNet classification. In Proceedings of the IEEE International Conference on Computer Vision, pages 1026–1034, 2015.
|
| 190 |
+
[53] John P Miller, Rohan Taori, Aditi Raghunathan, Shiori Sagawa, Pang Wei Koh, Vaishaal Shankar, Percy Liang, Yair Carmon, and Ludwig Schmidt. Accuracy on the line: on the strong correlation between out-of-distribution and in-distribution generalization. In International Conference on Machine Learning, pages 7721–7735. PMLR, 2021.
|
| 191 |
+
|
| 192 |
+
# Checklist
|
| 193 |
+
|
| 194 |
+
1. For all authors...
|
| 195 |
+
|
| 196 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 197 |
+
(b) Did you describe the limitations of your work? [Yes] See discussion section 7.
|
| 198 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] See discussion section 7 and App. I.
|
| 199 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 200 |
+
|
| 201 |
+
2. If you are including theoretical results...
|
| 202 |
+
|
| 203 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] See App. A (b) Did you include complete proofs of all theoretical results? [Yes] See App. A
|
| 204 |
+
|
| 205 |
+
3. If you ran experiments...
|
| 206 |
+
|
| 207 |
+
(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 code for theory plots and numerical perceptron simulations is packaged in a reproducible colab notebook.
|
| 208 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See App. B.
|
| 209 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] Since we train a very large (order 100) number of models on computationally intensive tasks (e.g. ImageNet), many of our plots contain only results from a single random seed. However, variability due to random seeds can be inferred by the smooth progression of the relevant quantity on each plot.
|
| 210 |
+
(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 App. B
|
| 211 |
+
|
| 212 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 213 |
+
|
| 214 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 215 |
+
(b) Did you mention the license of the assets? [Yes] See App. B
|
| 216 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [No]
|
| 217 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [Yes] See App. B
|
| 218 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [Yes] See App. B
|
| 219 |
+
|
| 220 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 221 |
+
|
| 222 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 223 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 224 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/UpN2wfrLec/UpN2wfrLec.md
ADDED
|
@@ -0,0 +1,316 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Language Is Not All You Need: Aligning Perception with Language Models
|
| 2 |
+
|
| 3 |
+
Shaohan Huang∗, Li Dong∗, Wenhui Wang∗, Yaru Hao∗, Saksham Singhal∗, Shuming Ma∗ Tengchao Lv, Lei Cui, Owais Khan Mohammed, Barun Patra, Qiang Liu, Kriti Aggarwal Zewen Chi, Johan Bjorck, Vishrav Chaudhary, Subhojit Som, Xia Song, Furu Wei† Microsoft https://github.com/microsoft/unilm
|
| 4 |
+
|
| 5 |
+
# Abstract
|
| 6 |
+
|
| 7 |
+
A big convergence of language, multimodal perception, action, and world modeling is a key step toward artificial general intelligence. In this work, we introduce KOSMOS-1, a Multimodal Large Language Model (MLLM) that can perceive general modalities, learn in context (i.e., few-shot), and follow instructions (i.e., zero-shot). Specifically, we train KOSMOS-1 from scratch on web-scale multimodal corpora, including arbitrarily interleaved text and images, image-caption pairs, and text data. We evaluate various settings, including zero-shot, few-shot, and multimodal chain-of-thought prompting, on a wide range of tasks without any gradient updates or finetuning. Experimental results show that KOSMOS-1 achieves impressive performance on (i) language understanding, generation, and even OCR-free NLP (directly fed with document images), (ii) perception-language tasks, including multimodal dialogue, image captioning, visual question answering, and (iii) vision tasks, such as image recognition with descriptions (specifying classification via text instructions). We also show that MLLMs can benefit from cross-modal transfer, i.e., transfer knowledge from language to multimodal, and from multimodal to language. In addition, we introduce a dataset of Raven IQ test, which diagnoses the nonverbal reasoning capability of MLLMs.
|
| 8 |
+
|
| 9 |
+
# 1 Introduction: From LLMs to MLLMs
|
| 10 |
+
|
| 11 |
+
Large language models (LLMs) have successfully served as a general-purpose interface across various natural language tasks [1]. The LLM-based interface can be adapted to a task as long as we are able to transform the input and output into texts. For example, the input of the summarization task is a document and the output is its summary. So we can feed the input document into the language model and then produce the generated summary.
|
| 12 |
+
|
| 13 |
+
Despite the successful applications in natural language processing, it is still struggling to natively use LLMs for multimodal data, such as image, and audio. Being a basic part of intelligence, multimodal perception is a necessity to achieve artificial general intelligence, in terms of knowledge acquisition and grounding to the real world. More importantly, unlocking multimodal input [2, 3, 4, 5, 6, 7] greatly widens the applications of language models to more high-value areas, such as multimodal machine learning, document intelligence, and robotics.
|
| 14 |
+
|
| 15 |
+
In this work, we introduce KOSMOS-1, a Multimodal Large Language Model (MLLM) that can perceive general modalities, follow instructions (i.e., zero-shot learning), and learn in context (i.e., few-shot learning). The goal is to align perception with LLMs, so that the models are able to see and talk. To be specific, we follow METALM [3] to train the KOSMOS-1 model from scratch. As shown in Figure 1, a Transformer-based language model is regarded as the general-purpose interface, and perception modules are docked with the language model. We train the model on web-scale multimodal corpora, i.e., text data, arbitrarily interleaved images and texts, and image-caption pairs. In addition, we calibrate the instruction-following capability across modalities by transferring language-only data.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: KOSMOS-1 is a multimodal large language model (MLLM) that is capable of perceiving multimodal input, following instructions, and performing in-context learning for not only language tasks but also multimodal tasks. In this work, we align vision with large language models (LLMs), advancing the trend of going from LLMs to MLLMs.
|
| 19 |
+
|
| 20 |
+
The KOSMOS-1 model natively supports language, perception-language, and vision tasks. In addition to various natural language tasks, the KOSMOS-1 models natively handle a wide range of perceptionintensive tasks, spanning visual dialogue, visual explanation, visual question answering, image captioning, simple math equation, OCR, and zero-shot image classification with descriptions. We also build an IQ test benchmark following Raven’s Progressive Matrices [8, 9], which evaluates the capability of nonverbal reasoning for MLLMs. The examples show that the native support of multimodal perception enables new opportunities to apply LLMs to new tasks. Moreover, we show that MLLMs achieve better commonsense reasoning performance compared with LLMs, which indicates cross-modal transfer helps knowledge acquisition.
|
| 21 |
+
|
| 22 |
+
The key takeaways are as follows:
|
| 23 |
+
|
| 24 |
+
From LLMs to MLLMs. Properly handling perception is a necessary step toward artificial general intelligence. The capability of perceiving multimodal input is critical to LLMs. First, multimodal perception enables LLMs to acquire commonsense knowledge beyond text descriptions. Second, aligning perception with LLMs opens the door to new tasks, such as robotics, and document intelligence. Third, the capability of perception unifies various APIs, as graphical user interfaces are the most natural and unified way to interact with. For example, MLLMs can directly read the screen or extract numbers from receipts. We train the KOSMOS-1 models on web-scale multimodal corpora, which ensures that the model robustly learns from diverse sources. We not only use a large-scale text corpus but also mine high-quality image-caption pairs and arbitrarily interleaved image and text documents from the web.
|
| 25 |
+
|
| 26 |
+
Language models as general-purpose interfaces. Following the philosophy proposed in METALM [3], we regard language models as a universal task layer. Because of the open-ended output space, we are able to unify various task predictions as texts. Moreover, natural-language instructions and action sequences (such as programming language) can be well handled by language models. LLMs also serve as basic reasoners [10], which is complementary to perception modules on complex tasks. So it is natural to align world, action, and multimodal perception with the general-purpose interface, i.e., language models.
|
| 27 |
+
|
| 28 |
+
New capabilities of MLLMs. Apart from the capabilities found in previous LLMs [1, 11], MLLMs enable new usages and possibilities. First, we can conduct zero- and few-shot multimodal learning by using natural language instructions and demonstration examples. Second, we observe promising signals of nonverbal reasoning by evaluating the Raven IQ test, which measures the fluid reasoning ability of humans. Third, MLLMs naturally support multi-turn interactions for general modalities, such as multimodal dialogue.
|
| 29 |
+
|
| 30 |
+
# 2 KOSMOS-1: A Multimodal Large Language Model
|
| 31 |
+
|
| 32 |
+
KOSMOS-1 is a multimodal language model that can perceive general modalities, follow instructions, learn in context, and generate outputs. Given the previous context, the model learns to generate texts in an auto-regressive manner. Specifically, the backbone of KOSMOS-1 is a Transformer-based causal language model. Apart from text, other modalities are embedded and fed into the language model. The Transformer decoder serves as a general-purpose interface to multimodal input. We train KOSMOS-1 on multimodal corpora, including monomodal data, cross-modal paired data, and interleaved multimodal data. Once the models are trained, we can directly evaluate the models in zero-shot and few-shot settings on both language tasks and multimodal tasks.
|
| 33 |
+
|
| 34 |
+
# 2.1 Input Representation
|
| 35 |
+
|
| 36 |
+
The Transformer decoder perceives general modalities in a unified way. For input format, we flatten input as a sequence decorated with special tokens. Specifically, we use $\mathtt { < s > }$ and $< / { \mathsf { s } } { \mathsf { > } }$ to denote startand end-of-sequence. The special tokens <image> and </image> indicate the beginning and end of encoded image embeddings. For example, $\ " < \mathsf { s } >$ document $< / { \mathsf { s } } > ^ { , , }$ is a text input, and $\ " < \mathsf { s } >$ paragraph <image> Image Embedding </image> paragraph $< / { \mathsf { s } } > ^ { , \mathsf { \curlyeq } }$ is an interleaved image-text input.
|
| 37 |
+
|
| 38 |
+
An embedding module is used to encode both text tokens and other input modalities into vectors. Then the embeddings are fed into the decoder. For text tokens, we use a lookup table to map them into embeddings. For the modalities of continuous signals (e.g., image, and audio), it is also feasible to represent inputs as discrete code and then regard them as “foreign languages” [4, 12]. In this work, following [3], we employ a vision encoder as the embedding module for input images. In addition, Resampler [5] is used as an attentive pooling mechanism to reduce the number of image embeddings.
|
| 39 |
+
|
| 40 |
+
# 2.2 Multimodal Large Language Models (MLLMs)
|
| 41 |
+
|
| 42 |
+
After obtaining the embeddings of an input sequence, we feed them into the Transformer-based decoder. The left-to-right causal model processes the sequence in an auto-regressive manner, which produces the next token by conditioning on past timesteps. The causal masking is used to mask out future information. A softmax classifier upon Transformer is used to generate tokens over the vocabulary.
|
| 43 |
+
|
| 44 |
+
MLLMs serve as general-purpose interfaces [3] that can perform interactions with both natural language and multimodal input. The framework is flexible to handle various data types, as long as we can represent input as vectors. MLLMs combine the best of two worlds. First, the language models naturally inherit the capabilities of in-context learning and instruction following. Second, perception is aligned with language models by training on multimodal corpora.
|
| 45 |
+
|
| 46 |
+
The implementation is based on the library TorchScale [13], which is designed for large-scale model training. Compared with the standard Transformer architecture, we include the following modifications: We use MAGNETO [14], a Transformer variant, as the backbone architecture and XPOS [15] relative position encoding for better long-context modeling.
|
| 47 |
+
|
| 48 |
+
# 2.3 Multimodal Training Data
|
| 49 |
+
|
| 50 |
+
The models are trained on web-scale multimodal corpora. The training datasets consist of text corpora, image-caption pairs, and interleaved data of images and texts.
|
| 51 |
+
|
| 52 |
+
Text Corpora We train our model with The Pile [16] and Common Crawl (CC). The Pile is a massive English text dataset built for training large-scale language models. We exclude data splits from GitHub, arXiv, Stack Exchange, and PubMed Central. We also include the Common Crawl snapshots (2020-50 and 2021-04) datasets, CC-Stories, and RealNews datasets [17, 18].
|
| 53 |
+
|
| 54 |
+
Image-Caption Pairs The image-caption pairs are constructed from several datasets, including English LAION-2B [19], LAION-400M [20], COYO-700M [21], and Conceptual Captions [22, 23].
|
| 55 |
+
|
| 56 |
+
English LAION-2B, LAION-400M, and COYO-700M are collected from web pages of the Common Crawl web data by extracting image sources and the corresponding alt-text. Conceptual Captions are also from internet web pages.
|
| 57 |
+
|
| 58 |
+
Interleaved Image-Text Data We collect interleaved multimodal data from the Common Crawl snapshot, which is a publicly available archive of web pages. We use a filtering process to select about 71 millions web pages from the original 2 billions web pages in the snapshot. We then extract the text and images from the HTML of each selected web page.
|
| 59 |
+
|
| 60 |
+
# 2.4 Training Objective
|
| 61 |
+
|
| 62 |
+
The KOSMOS-1 training is conducted on web-scale multimodal corpora, including monomodal data (e.g., text corpus), cross-modal paired data (e.g., image-caption pairs), and interleaved multimodal data (e.g., documents of arbitrarily interleaved images and texts). To be specific, we use monomodal data for representation learning. For example, language modeling with text data pretrains instruction following, in-context learning, and various language tasks. Moreover, cross-modal pairs and interleaved data learn to align the perception of general modalities with language models. Interleaved data also naturally fit in the multimodal language modeling task. We present more details of training data collection in the supplemental material.
|
| 63 |
+
|
| 64 |
+
The models are trained with the next-token prediction task, i.e., learning to generate the next token depending on the previous context. The training objective is to maximize the log-likelihood of tokens in examples. Notice that only discrete tokens, such as text tokens, are accounted for in the training loss. Multimodal language modeling is a scalable way to train the models. More importantly, the emergence of various capabilities makes the training task favorable for downstream applications.
|
| 65 |
+
|
| 66 |
+
# 3 Experiments
|
| 67 |
+
|
| 68 |
+
# 3.1 Training Setup
|
| 69 |
+
|
| 70 |
+
We train KOSMOS-1 with 1.6 billion parameters using a mix of text corpora, image-caption pairs, and interleaved data. We use Magneto’s initialization for optimization stability and a pretrained CLIP ViT-L/14 model for image representation. The model is trained for $3 0 0 \mathrm { k }$ steps using a batch size of 1.2 million tokens and the AdamW optimizer. We adopt a learning rate warm-up and decay schedule, and use SentencePiece for tokenization.
|
| 71 |
+
|
| 72 |
+
To improve instruction-following capabilities, we perform language-only instruction tuning using Unnatural Instructions [24] and FLANv2 [25] datasets. This tuning process is conducted as language modeling, and improvements transfer across modalities. More details about hyperparameters can be found in the supplemental material.
|
| 73 |
+
|
| 74 |
+
Table 1 summarizes the corresponding datasets and what capabilities we would like to evaluate. We evaluate different capabilities related to language, perception-language and vision.
|
| 75 |
+
|
| 76 |
+
# 3.2 Perception-Language Tasks
|
| 77 |
+
|
| 78 |
+
Image Captioning Table 2a shows the captioning performance on COCO [39] Karpathy test split and Flickr30k [40] test set. KOSMOS-1 achieves remarkable results in zero-shot setting on two image captioning datasets. Specifically, our model achieves a CIDEr score of 67.1 on the Flickr30k dataset, compared to 60.6 and 61.5 for the Flamingo-3B and Flamingo-9B models, respectively. Notably, our model is able to accomplish this feat with a smaller size of 1.6B, compared to Flamingo models. This demonstrates our model’s superiority in zero-shot image captioning.
|
| 79 |
+
|
| 80 |
+
Visual Question Answering Table 2b reports the visual question answering results on VQAv2 [41] and VizWiz [42]. We show that KOSMOS-1 can better handle the diversity and complexity of the VizWiz dataset. KOSMOS-1 achieves higher accuracy and robustness than Flamingo-3B and Flamingo-9B models on zero-shot settings. In addition, our model is competitive with Flamingo on the VQAv2 dataset.
|
| 81 |
+
|
| 82 |
+
<table><tr><td>Dataset</td><td>Task description</td><td>Metric</td><td>Zero-shot</td><td>Few-shot</td></tr><tr><td colspan="5">Language tasks</td></tr><tr><td>StoryCloze [26]</td><td>Commonsense reasoning</td><td>Accuracy</td><td></td><td></td></tr><tr><td>HellaSwag [27]</td><td>Commonsense NLI</td><td>Accuracy</td><td></td><td></td></tr><tr><td>Winograd [28]</td><td>Word ambiguity</td><td>Accuracy</td><td></td><td></td></tr><tr><td>Winogrande [29]</td><td>Word ambiguity</td><td>Accuracy</td><td></td><td></td></tr><tr><td>PIQA [30]</td><td>Physical commonsense</td><td>Accuracy</td><td></td><td></td></tr><tr><td>BoolQ[31]</td><td>Question answering</td><td>Accuracy</td><td></td><td></td></tr><tr><td>CB [32]</td><td>Textual entailment</td><td>Accuracy</td><td></td><td>vvνvvvvv</td></tr><tr><td>COPA [33]</td><td>Causal reasoning</td><td>Accuracy</td><td></td><td></td></tr><tr><td>Rendered SST-2 [34]</td><td>OCR-free sentiment classification</td><td>Accuracy</td><td></td><td></td></tr><tr><td>HatefulMemes [35]</td><td>OCR-free meme classification</td><td>ROC AUC</td><td></td><td></td></tr><tr><td colspan="5">Cross-modal transfer</td></tr><tr><td>RelativeSize [36]</td><td>Commonsense reasoning (object size)</td><td>Accuracy</td><td>√</td><td></td></tr><tr><td>MemoryColor [37]</td><td>Commonsense reasoning (object color)</td><td>Accuracy</td><td>√</td><td></td></tr><tr><td>ColorTerms [38]</td><td>Commonsense reasoning (object color)</td><td>Accuracy</td><td>√</td><td></td></tr><tr><td colspan="5">Nonverbal reasoning tasks</td></tr><tr><td>IQ Test</td><td>Raven's Progressive Matrices</td><td>Accuracy</td><td>√</td><td></td></tr><tr><td colspan="5">Perception-language tasks</td></tr><tr><td>COCO Caption [39]</td><td>Image captioning</td><td>CIDEr, etc.</td><td></td><td></td></tr><tr><td>Flicker30k [40]</td><td>Image captioning</td><td>CIDEr, etc.</td><td></td><td></td></tr><tr><td>VQAv2 [41]</td><td>Visual question answering</td><td>VQA acc.</td><td></td><td><<vv</td></tr><tr><td>VizWiz[42]</td><td>Visual question answering</td><td>VQA acc.</td><td></td><td></td></tr><tr><td>WebSRC[43]</td><td>Web page question answering</td><td>F1 score</td><td></td><td></td></tr><tr><td colspan="5">Vision tasks</td></tr><tr><td>CUB [44]</td><td>Zero-shot image classification with descriptions</td><td>Accuracy</td><td></td><td></td></tr></table>
|
| 83 |
+
|
| 84 |
+
Table 1: We evaluate the capabilities of KOSMOS-1 on language, perception-language, and vision tasks under both zero- and few-shot learning settings.
|
| 85 |
+
|
| 86 |
+
# 3.3 IQ Test: Nonverbal Reasoning
|
| 87 |
+
|
| 88 |
+
Raven’s Progressive Matrices [9, 8] is one of the most common tests to evaluate nonverbal reasoning. The capability of nonverbal reasoning is typically a reflection of an individual’s intelligence quotientWhich option can complete the matrix? (IQ). Figure 2 shows an example. Given eight images, the task is to identify the following elementA B C D E F from six similar candidates.
|
| 89 |
+
|
| 90 |
+

|
| 91 |
+
Figure 2: We append each candidate image to the prompt Table 3: Zero-shot generalization on separately and query the model if it is correct. Raven IQ test.
|
| 92 |
+
|
| 93 |
+
<table><tr><td>Method</td><td>Accuracy</td></tr><tr><td>Random Choice</td><td>17%</td></tr><tr><td>KosMOs-1</td><td>22%</td></tr></table>
|
| 94 |
+
|
| 95 |
+
The models need to conduct zero-shot nonverbal reasoning without explicitly fine-tuning. The Raven IQ test is analogous to in-context learning of language models, where the difference is whether the context is nonverbal or verbal. In order to infer the answers, the models have to recognize abstract concepts and identify the underlying patterns of given images. So the IQ task is a good testbed to benchmark the nonverbal in-context learning capability.
|
| 96 |
+
|
| 97 |
+
Table 3 shows the evaluation results on the IQ test dataset. KOSMOS-1 achieves $5 . 3 \%$ improvement respectively over the random baseline. The results indicate that KOSMOS-1 is able to perceive abstract conceptual patterns in a nonverbal context, and then deduce the following element across multiple choices. To the best of our knowledge, it is the first time that a model can perform such zero-shot Raven IQ tests. Although there is still a large performance gap between the current model and the
|
| 98 |
+
|
| 99 |
+
<table><tr><td>Shot</td><td>Model</td><td>CoCo</td><td>Flickr30k</td></tr><tr><td rowspan="7">0</td><td>ZeroCap45]</td><td>14.6</td><td>1</td></tr><tr><td>VLKD [46]</td><td>58.3</td><td>1</td></tr><tr><td>FewVLM[47]</td><td>-</td><td>31.0</td></tr><tr><td>METALM[3]</td><td>82.2</td><td>43.4</td></tr><tr><td>Flamingo-3B*[5]</td><td>73.0</td><td>60.6</td></tr><tr><td>Flamingo-9B*[5]</td><td>79.4</td><td>61.5</td></tr><tr><td>KOSMOS-1 (1.6B)</td><td>84.7</td><td>67.1</td></tr><tr><td rowspan="2">2</td><td>Flamingo-3B* [5]</td><td>=</td><td>1</td></tr><tr><td>Flamingo-9B*[5] KOSMOS-1 (1.6B)</td><td>- 99.6</td><td>-</td></tr><tr><td rowspan="2">4</td><td>Flamingo-3B* [5]</td><td>85.0</td><td>70.0 72.0</td></tr><tr><td>Flamingo-9B* [5]</td><td>93.1</td><td>72.6</td></tr><tr><td rowspan="2"></td><td>KoSMOS-1 (1.6B)</td><td>101.7</td><td>75.3</td></tr><tr><td>Flamingo-3B* [5]</td><td>90.6</td><td>71.7</td></tr><tr><td rowspan="3">8</td><td>Flamingo-9B* [5]</td><td>99.0</td><td>73.4</td></tr><tr><td>KoSMOS-1 (1.6B)</td><td>96.7</td><td>68.0</td></tr><tr><td></td><td></td><td></td></tr></table>
|
| 100 |
+
|
| 101 |
+
(a) Image captioning results on COCO caption Karpa- (b) Visual question answering results on VQAv2 and thy test and Flickr30k test. We present CIDEr scores. VizWiz. We present VQA accuracy scores.
|
| 102 |
+
|
| 103 |
+
<table><tr><td>Shot</td><td>Model</td><td>VQAv2</td><td>VizWiz</td></tr><tr><td rowspan="6">0</td><td>Frozen</td><td>29.5</td><td></td></tr><tr><td>VLKDViT-B/16</td><td>38.6</td><td>=</td></tr><tr><td>METALM</td><td>41.1</td><td>-</td></tr><tr><td>Flamingo-3B*</td><td>49.2</td><td>28.9</td></tr><tr><td>Flamingo-9B*</td><td>51.8</td><td>28.8</td></tr><tr><td>KoSMOS-1 (1.6B)</td><td>51.0</td><td>29.2</td></tr><tr><td rowspan="2">2</td><td>Flamingo-3B* [5]</td><td></td><td>-</td></tr><tr><td>Flamingo-9B*[5] KoSMOS-1 (1.6B)</td><td>-</td><td>=</td></tr><tr><td rowspan="3">4</td><td></td><td>51.4</td><td>31.4</td></tr><tr><td>Flamingo-3B* [5] Flamingo-9B* [5]</td><td>53.2 56.3</td><td>34.4 34.9</td></tr><tr><td>KoSMOS-1 (1.6B)</td><td>51.8</td><td>35.3</td></tr><tr><td rowspan="3">8</td><td>Flamingo-3B* [5]</td><td>55.4</td><td>38.4</td></tr><tr><td>Flamingo-9B* [5]</td><td>58.0</td><td>39.4</td></tr><tr><td>KOSMOS-1 (1.6B)</td><td>51.4</td><td>39.0</td></tr></table>
|
| 104 |
+
|
| 105 |
+
Table 2: $" * "$ : Flamingo [5] builds the zero-shot prompt with two examples from the downstream tasks where their corresponding images are removed (i.e., similar to few-shot text prompts) while the others evaluate true zero-shot learning.
|
| 106 |
+
|
| 107 |
+
average level of adults, KOSMOS-1 demonstrates the potential of MLLMs to perform zero-shot nonverbal reasoning by aligning perception with language models.
|
| 108 |
+
|
| 109 |
+
# 3.4 OCR-Free Language Understanding
|
| 110 |
+
|
| 111 |
+
OCR-free language understanding is a task that focuses on understanding text and images without relying on Optical Character Recognition (OCR). For example, during the Rendered SST-2 task [34], sentences from the Stanford Sentiment Treebank [48] dataset are rendered as images. The model is asked to predict the sentiment of the text within the images. The task evaluates a model’s ability to read and comprehend the meaning of words and sentences directly from the images.
|
| 112 |
+
|
| 113 |
+
As shown in Table 4a, KOSMOS-1 achieves a ROC AUC of $6 3 . 9 \%$ for the HatefulMemes validation set and a test accuracy of $6 7 . 1 \%$ for the Rendered SST-2 test set. It outperforms CLIP ViT-L and Flamingo-9B, which achieve AUCs of $6 3 . 3 \%$ and $5 7 . 0 \%$ on the HatefulMemes task. Note that Flamingo explicitly provides OCR text into the prompt, while KOSMOS-1 does not access any external tools or resources. This indicates that KOSMOS-1 has built-in abilities to read and comprehend the text in the rendered images.
|
| 114 |
+
|
| 115 |
+
<table><tr><td>Model</td><td>HatefulMemes</td><td>Rendered SST-2</td></tr><tr><td>CLIP ViT-B/32</td><td>57.6</td><td>59.6</td></tr><tr><td>CLIP ViT-B/16</td><td>61.7</td><td>59.8</td></tr><tr><td>CLIP ViT-L/14</td><td>63.3</td><td>64.0</td></tr><tr><td>Flamingo-3B</td><td>53.7</td><td>1</td></tr><tr><td>Flamingo-9B</td><td>57.0</td><td>-</td></tr><tr><td>KOSMOS-1 (1.6B)</td><td>63.9</td><td>67.1</td></tr></table>
|
| 116 |
+
|
| 117 |
+
(a) Zero-shot generalization on OCR-free language understanding. We report accuracy scores.
|
| 118 |
+
|
| 119 |
+
<table><tr><td>Model</td><td>EM F1</td></tr><tr><td>Using extracted text</td><td></td></tr><tr><td>LLM 7.6</td><td>17.9</td></tr><tr><td>KosMOs-1 15.8</td><td>31.3</td></tr><tr><td>Without using extracted text</td><td></td></tr><tr><td>KosMos-1 3.8</td><td>10.6</td></tr></table>
|
| 120 |
+
|
| 121 |
+
(b) Zero-shot performance on WebSRC task. We report exact match (EM) and F1 scores.
|
| 122 |
+
|
| 123 |
+
# 3.5 Web Page Question Answering
|
| 124 |
+
|
| 125 |
+
Web page question answering aims at finding answers to questions from web pages. It requires the model to comprehend both the semantics and the structure of texts (such as tables, lists, and
|
| 126 |
+
|
| 127 |
+

|
| 128 |
+
Figure 3: In-context verbal descriptions can help KOSMOS-1 recognize visual categories better.
|
| 129 |
+
|
| 130 |
+
HTML layout). We compare the performance on the Web-based Structural Reading Comprehension (WebSRC) dataset [43]. For comparisons, we train a language model (LLM) on the same text corpora with the same training setup as in KOSMOS-1.
|
| 131 |
+
|
| 132 |
+
The experimental results are summarized in Table 4b. We observe that KOSMOS-1 outperforms the LLM, indicating that KOSMOS-1 can benefit from the layout and style information of web pages in images. In addition, we evaluate the performance of KOSMOS-1 without the extracted text in the prompt. It shows that extracted text has a contribution of $+ 1 2 . 0 / 2 0 . 7$ EM/F1 to KOSMOS-1, indicating that the benefit from modeling images does not sacrifice its language abilities.
|
| 133 |
+
|
| 134 |
+
# 3.6 Multimodal Chain-of-Thought Prompting
|
| 135 |
+
|
| 136 |
+
Chain-of-thought prompting [10] allows large language models to generate a series of reasoning steps and decompose a multi-step problem into intermediate steps, which can significantly improve the performance in complex tasks. Motivated by chain-of-thought prompting, we investigate a multimodal chain-of-thought prompting using KOSMOS-1. We break down perception-language tasks into two steps. In the first stage, given an image, we use a prompt to guide the model to generate a rationale. The model is then fed the rationale and a task-aware prompt to produce the final results.
|
| 137 |
+
|
| 138 |
+
We conduct experiments to evaluate the performance of the multimodal chain-of-thought prompting. Table 5a shows that multimodal chain-of-thought prompting achieves a score of 72.9, which is 5.8 points higher than the standard prompting. By generating intermediate content, the model can recognize the text in the images and infer the sentiment of the sentences more correctly.
|
| 139 |
+
|
| 140 |
+
<table><tr><td> Setings</td><td>Accuracy</td></tr><tr><td>Without Descriptions</td><td>61.7</td></tr><tr><td>With Descriptions</td><td>90.0</td></tr></table>
|
| 141 |
+
|
| 142 |
+
(b) Results of zero-shot image classification without and with verbal descriptions.
|
| 143 |
+
|
| 144 |
+
<table><tr><td>Model</td><td>Accuracy</td></tr><tr><td>CLIP ViT-B/32</td><td>59.6</td></tr><tr><td>CLIP ViT-B/16</td><td>59.8</td></tr><tr><td>CLIP ViT-L/14</td><td>64.0</td></tr><tr><td>KosMOS-1</td><td>67.1</td></tr><tr><td>w/ multimodal CoT prompting</td><td>72.9</td></tr></table>
|
| 145 |
+
|
| 146 |
+
(a) Multimodal chain-of-thought (CoT) prompting on Rendered SST-2 task.
|
| 147 |
+
|
| 148 |
+
# 3.7 Zero-Shot Image Classification with Descriptions
|
| 149 |
+
|
| 150 |
+
The standard approach of image classification as above is to prompt the model for the specific name of the object depicted in the image. However, there are also some classification rules customized for different users and scenarios, such as the refined classification of complex animal subspecies. We can utilize natural language descriptions to guide KOSMOS-1 to distinguish images in the zero-shot setting, which makes the decision process more interpretable. Following CUB [44], we construct a bird classification dataset that contains images and natural-language descriptions of categories. The evaluation procedure is illustrated in Figure 3.
|
| 151 |
+
|
| 152 |
+
The evaluation results are shown in Table 5b. We observe that providing descriptions in context can significantly improve the accuracy of image classification. The consistent improvements indicate that KOSMOS-1 can perceive the intentions of instructions and well align the concepts in language modality with visual features in vision modality.
|
| 153 |
+
|
| 154 |
+
# 3.8 Language Tasks
|
| 155 |
+
|
| 156 |
+
The models are evaluated on the language tasks given task instructions (i.e., zero-shot) or several demonstration examples (i.e., few-shot). Text inputs are directly fed into the models as in vanilla language models. We train a language model (LLM) baseline with the same text corpora and training setup. We evaluate KOSMOS-1 and the LLM baseline on eight language tasks.
|
| 157 |
+
|
| 158 |
+
Table 6 presents the in-context learning performance of language tasks. KOSMOS-1 achieves comparable or even better performance in cloze completion and commonsense reasoning tasks when compared to LLM. In terms of the average result across all these datasets, LLM performs better in zero-shot and one-shot settings, whereas our model performs better in few-shot $k = 4$ ) settings. In addition, Section 3.9.2 shows that MLLMs learn better visual commonsense knowledge compared with LLMs.
|
| 159 |
+
|
| 160 |
+
<table><tr><td rowspan="2">Task</td><td colspan="2">Zero-shot</td><td colspan="2">One-shot</td><td colspan="2">Few-shot (k = 4)</td></tr><tr><td>LLM</td><td>KosMos-1</td><td>LLM</td><td>KoSMOS-1</td><td>LLM</td><td>KosMos-1</td></tr><tr><td>StoryCloze</td><td>72.9</td><td>72.1</td><td>72.9</td><td>72.2</td><td>73.1</td><td>72.3</td></tr><tr><td>HellaSwag</td><td>50.4</td><td>50.0</td><td>50.2</td><td>50.0</td><td>50.4</td><td>50.3</td></tr><tr><td>Winograd</td><td>71.6</td><td>69.8</td><td>71.2</td><td>68.4</td><td>70.9</td><td>69.8</td></tr><tr><td>Winogrande</td><td>56.7</td><td>54.8</td><td>56.7</td><td>54.5</td><td>57.0</td><td>55.7</td></tr><tr><td>PIQA</td><td>73.2</td><td>72.9</td><td>73.0</td><td>72.5</td><td>72.6</td><td>72.3</td></tr><tr><td>BoolQ</td><td>56.4</td><td>56.4</td><td>55.1</td><td>57.2</td><td>58.7</td><td>59.2</td></tr><tr><td>CB</td><td>39.3</td><td>44.6</td><td>41.1</td><td>48.2</td><td>42.9</td><td>53.6</td></tr><tr><td>COPA</td><td>68.0</td><td>63.0</td><td>69.0</td><td>64.0</td><td>69.0</td><td>64.0</td></tr><tr><td>Average</td><td>61.1</td><td>60.5</td><td>61.2</td><td>60.9</td><td>61.8</td><td>62.2</td></tr></table>
|
| 161 |
+
|
| 162 |
+
Table 6: Performance comparisons of language tasks between KOSMOS-1 and LLM. We use the same textual data and training setup to reimplement a language model. Both models do not use instruction tuning for fair comparisons.
|
| 163 |
+
|
| 164 |
+
# 3.9 Cross-modal Transfer
|
| 165 |
+
|
| 166 |
+
Cross-modal transferability allows a model to learn from one modality (such as text, image, audio, etc.) and transfer the knowledge to the other modalities. This skill can enable a model to perform various tasks across different modalities. In this part, we evaluate the cross-model transferability of KOSMOS-1 on several benchmarks.
|
| 167 |
+
|
| 168 |
+
# 3.9.1 Transfer from Language to Multimodal: Language-Only Instruction Tuning
|
| 169 |
+
|
| 170 |
+
To evaluate the effect of language-only instruction tuning, we conduct an ablation study using four datasets: COCO, Flickr30k, VQAv2, and VizWiz. These datasets consist of image captioning and visual questions anwsering. The evaluation metrics are: CIDEr scores for COCO/Flickr30k and VQA accuracy for VQAv2/VizWiz.
|
| 171 |
+
|
| 172 |
+
Table 7 shows the experimental results. Language-only instruction tuning boosts our model’s performance by 1.9 points on Flickr30k, 4.3 points on VQAv2, and 1.3 points on VizWiz. Our experiments show that language-only instruction tuning can significantly improve the model’s instructionfollowing capabilities across modalities. The results also indicate that our model can transfer the instruction-following capability from language to other modalities.
|
| 173 |
+
|
| 174 |
+
<table><tr><td>Model</td><td>CoCo</td><td>Flickr30k</td><td>VQAv2</td><td>VizWiz</td></tr><tr><td>Kosmos-1</td><td>84.7</td><td>67.1</td><td>51.0</td><td>29.2</td></tr><tr><td>w/o language-only instruction tuning</td><td>87.6</td><td>65.2</td><td>46.7</td><td>27.9</td></tr></table>
|
| 175 |
+
|
| 176 |
+
Table 7: Ablation study on language-only instruction tuning. We report CIDEr scores for COCO and Flickr30k, and VQA accuracy scores for VQAv2 and VizWiz.
|
| 177 |
+
|
| 178 |
+
# 3.9.2 Transfer from Multimodal to Language: Visual Commonsense Reasoning
|
| 179 |
+
|
| 180 |
+
Visual commonsense reasoning tasks require an understanding of the properties of everyday objects in the real world, such as color, size, and shape. These tasks are challenging for language models because they may require more information about object properties than what is available in texts. To investigate the visual commonsense capabilities, we compare the zero-shot performance of KOSMOS-1 and LLM on three object commonsense reasoning datasets, RELATIVESIZE [36], MEMORYCOLOR [37] and COLORTERMS [38] datasets. RELATIVESIZE contains 486 object pairs from 41 physical objects. The model is required to predict the size relation between two objects in a binary question-answering format with “Yes”/“No” answers. MEMORYCOLOR and COLORTERMS require the model to predict the color of objects from a set of 11 color labels in a multiple-choice format.
|
| 181 |
+
|
| 182 |
+
Table 8 presents the zero-shot performance of KOSMOS-1 and LLM on visual commonsense reasoning tasks. KOSMOS-1 significantly outperforms LLM by $1 . 5 \%$ on RELATIVESIZE, $1 4 . 7 \%$ on MEMORYCOLOR, and $9 . 7 \%$ on COLORTERMS dataset. The consistent improvements indicate that KOSMOS-1 benefits from the visual knowledge to complete the corresponding visual commonsense reasoning. The reason for KOSMOS-1’s superior performance is that it has modality transferability, which enables the model to transfer visual knowledge to language tasks. On the contrary, LLM has to rely on textual knowledge and clues to answer visual commonsense questions, which limits its ability to reason about object properties.
|
| 183 |
+
|
| 184 |
+
<table><tr><td>Model</td><td>Size Reasoning RELATIVESIZE</td><td>Color Reasoning MEMORYCOLOR</td><td>COLORTERMS</td></tr><tr><td>Using retrieved images VALM [49]</td><td>85.0</td><td>58.6</td><td>52.7</td></tr><tr><td>Language-only zero-shot evaluation</td><td></td><td></td><td></td></tr><tr><td>LLM</td><td>92.7</td><td>61.4</td><td>63.4</td></tr><tr><td>KosMos-1</td><td>94.2</td><td>76.1</td><td>73.1</td></tr></table>
|
| 185 |
+
|
| 186 |
+
Table 8: Zero-shot visual commonsense reasoning on RELATIVESIZE, MEMORYCOLOR, and COLORTERMS datasets. Accuracy scores are reported.
|
| 187 |
+
|
| 188 |
+
# 4 Related Work
|
| 189 |
+
|
| 190 |
+
In recent years, vision-language learning and representation models has garnered significant attention [2, 3, 4, 34, 50, 51, 52, 53, 54]. Previous vision-language models still exhibit limitations in instruction following, in-context abilities, and generalization capabilities for unseen tasks. Researchers have begun exploring more powerful multimodal large language models. Flamingo [5] trained its model from scratch and made it possible to generate text tokens conditioned on both visual and text inputs. Another category of research focus on learning multimodality abilities based on LLMs [7, 55, 56]. Meanwhile, some work [57, 58, 59] introduce visual instruction tuning to enhance instruction following capabilities.
|
| 191 |
+
|
| 192 |
+
# 5 Conclusion
|
| 193 |
+
|
| 194 |
+
In this work, we introduce KOSMOS-1, a multimodal large language model that can perceive general modalities, follow instructions, and perform in-context learning. The models trained on web-scale multimodal corpora achieve promising results across a wide range of language tasks and multimodal tasks. We show that going from LLMs to MLLMs enables new capabilities and opportunities. In the future, we would like to scale up KOSMOS-1 in terms of model size [13, 14, 60], and integrate the speech [12] capability into KOSMOS-1. In addition, KOSMOS-1 can be used as a unified interface for multimodal learning, e.g., enabling using instructions and examples to control text-to-image generation. We further discuss the limitations and broader societal impacts of KOSMOS-1 in the supplemental material.
|
| 195 |
+
|
| 196 |
+
# References
|
| 197 |
+
|
| 198 |
+
[1] Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In Advances in Neural Information Processing Systems, volume 33, pages 1877–1901. Curran Associates, Inc., 2020.
|
| 199 |
+
|
| 200 |
+
[2] Maria Tsimpoukelli, Jacob Menick, Serkan Cabi, S. M. Ali Eslami, Oriol Vinyals, and Felix Hill. Multimodal few-shot learning with frozen language models. In Neural Information Processing Systems, 2021.
|
| 201 |
+
|
| 202 |
+
[3] Yaru Hao, Haoyu Song, Li Dong, Shaohan Huang, Zewen Chi, Wenhui Wang, Shuming Ma, and Furu Wei. Language models are general-purpose interfaces. ArXiv, abs/2206.06336, 2022.
|
| 203 |
+
|
| 204 |
+
[4] Wenhui Wang, Hangbo Bao, Li Dong, Johan Bjorck, Zhiliang Peng, Qiang Liu, Kriti Aggarwal, Owais Mohammed, Saksham Singhal, Subhojit Som, and Furu Wei. Image as a foreign language: BEiT pretraining for all vision and vision-language tasks. ArXiv, abs/2208.10442, 2022.
|
| 205 |
+
|
| 206 |
+
[5] Jean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech, Iain Barr, Yana Hasson, Karel Lenc, Arthur Mensch, Katherine Millican, Malcolm Reynolds, Roman Ring, Eliza Rutherford, Serkan Cabi, Tengda Han, Zhitao Gong, Sina Samangooei, Marianne Monteiro, Jacob Menick, Sebastian Borgeaud, Andrew Brock, Aida Nematzadeh, Sahand Sharifzadeh, Mikolaj Binkowski, Ricardo Barreira, Oriol Vinyals, Andrew Zisserman, and Karen Simonyan. Flamingo: a visual language model for few-shot learning. In Advances in Neural Information Processing Systems, 2022. URL https://openreview.net/forum?id=EbMuimAbPbs.
|
| 207 |
+
|
| 208 |
+
[6] Armen Aghajanyan, Bernie Huang, Candace Ross, Vladimir Karpukhin, Hu Xu, Naman Goyal, Dmytro Okhonko, Mandar Joshi, Gargi Ghosh, Mike Lewis, and Luke Zettlemoyer. CM3: A causal masked multimodal model of the Internet. ArXiv, abs/2201.07520, 2022.
|
| 209 |
+
|
| 210 |
+
[7] Junnan Li, Dongxu Li, Silvio Savarese, and Steven Hoi. BLIP-2: Bootstrapping language-image pre-training with frozen image encoders and large language models. ArXiv, abs/2301.12597, 2023.
|
| 211 |
+
|
| 212 |
+
[8] John and Jean Raven. Raven Progressive Matrices, pages 223–237. Springer US, Boston, MA, 2003. ISBN 978-1-4615-0153-4. doi: 10.1007/978-1-4615-0153-4_11. URL https: //doi.org/10.1007/978-1-4615-0153-4_11.
|
| 213 |
+
|
| 214 |
+
[9] Patricia A Carpenter, Marcel A Just, and Peter Shell. What one intelligence test measures: a theoretical account of the processing in the raven progressive matrices test. Psychological review, 97(3):404, 1990.
|
| 215 |
+
|
| 216 |
+
[10] 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.
|
| 217 |
+
|
| 218 |
+
[11] Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, Parker Schuh, Kensen Shi, Sasha Tsvyashchenko, Joshua Maynez, Abhishek B Rao, Parker Barnes, Yi Tay, Noam M. Shazeer, Vinodkumar Prabhakaran, Emily Reif, Nan Du, Benton C. Hutchinson, Reiner Pope, James Bradbury, Jacob Austin, Michael Isard, Guy Gur-Ari, Pengcheng Yin, Toju Duke, Anselm Levskaya, Sanjay Ghemawat, Sunipa Dev, Henryk Michalewski, Xavier García, Vedant Misra, Kevin Robinson, Liam Fedus, Denny Zhou, Daphne Ippolito, David Luan, Hyeontaek Lim, Barret Zoph, Alexander Spiridonov, Ryan Sepassi, David Dohan, Shivani Agrawal, Mark Omernick, Andrew M. Dai, Thanumalayan Sankaranarayana Pillai, Marie Pellat, Aitor Lewkowycz, Erica Oliveira Moreira, Rewon Child, Oleksandr Polozov, Katherine Lee, Zongwei Zhou, Xuezhi Wang, Brennan Saeta, Mark Díaz, Orhan Firat, Michele Catasta, Jason Wei, Kathleen S. Meier-Hellstern, Douglas Eck, Jeff Dean, Slav Petrov, and Noah Fiedel. PaLM: Scaling language modeling with pathways. ArXiv, abs/2204.02311, 2022.
|
| 219 |
+
|
| 220 |
+
[12] Chengyi Wang, Sanyuan Chen, Yu Wu, Zi-Hua Zhang, Long Zhou, Shujie Liu, Zhuo Chen, Yanqing Liu, Huaming Wang, Jinyu Li, Lei He, Sheng Zhao, and Furu Wei. Neural codec language models are zero-shot text to speech synthesizers. ArXiv, abs/2301.02111, 2023.
|
| 221 |
+
|
| 222 |
+
[13] Shuming Ma, Hongyu Wang, Shaohan Huang, Wenhui Wang, Zewen Chi, Li Dong, Alon Benhaim, Barun Patra, Vishrav Chaudhary, Xia Song, and Furu Wei. TorchScale: Transformers at scale. CoRR, abs/2211.13184, 2022.
|
| 223 |
+
|
| 224 |
+
[14] Hongyu Wang, Shuming Ma, Shaohan Huang, Li Dong, Wenhui Wang, Zhiliang Peng, Yu Wu, Payal Bajaj, Saksham Singhal, Alon Benhaim, Barun Patra, Zhun Liu, Vishrav Chaudhary, Xia Song, and Furu Wei. Foundation transformers. CoRR, abs/2210.06423, 2022.
|
| 225 |
+
|
| 226 |
+
[15] Yutao Sun, Li Dong, Barun Patra, Shuming Ma, Shaohan Huang, Alon Benhaim, Vishrav Chaudhary, Xia Song, and Furu Wei. A length-extrapolatable transformer. arXiv preprint arXiv:2212.10554, 2022.
|
| 227 |
+
|
| 228 |
+
[16] Leo Gao, Stella Biderman, Sid Black, Laurence Golding, Travis Hoppe, Charles Foster, Jason Phang, Horace He, Anish Thite, Noa Nabeshima, et al. The pile: An $8 0 0 \mathrm { g b }$ dataset of diverse text for language modeling. arXiv preprint arXiv:2101.00027, 2020.
|
| 229 |
+
|
| 230 |
+
[17] 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.
|
| 231 |
+
|
| 232 |
+
[18] Shaden Smith, Mostofa Patwary, Brandon Norick, Patrick LeGresley, Samyam Rajbhandari, Jared Casper, Zhun Liu, Shrimai Prabhumoye, George Zerveas, Vijay Korthikanti, Elton Zhang, Rewon Child, Reza Yazdani Aminabadi, Julie Bernauer, Xia Song, Mohammad Shoeybi, Yuxiong He, Michael Houston, Saurabh Tiwary, and Bryan Catanzaro. Using DeepSpeed and Megatron to train Megatron-Turing NLG 530B, a large-scale generative language model, 2022.
|
| 233 |
+
|
| 234 |
+
[19] Christoph Schuhmann, Romain Beaumont, Richard Vencu, Cade Gordon, Ross Wightman, Mehdi Cherti, Theo Coombes, Aarush Katta, Clayton Mullis, Mitchell Wortsman, et al. Laion5b: An open large-scale dataset for training next generation image-text models. arXiv preprint arXiv:2210.08402, 2022.
|
| 235 |
+
|
| 236 |
+
[20] 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.
|
| 237 |
+
|
| 238 |
+
[21] Minwoo Byeon, Beomhee Park, Haecheon Kim, Sungjun Lee, Woonhyuk Baek, and Saehoon Kim. Coyo-700m: Image-text pair dataset, 2022.
|
| 239 |
+
|
| 240 |
+
[22] Piyush Sharma, Nan Ding, Sebastian Goodman, and Radu Soricut. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, ACL 2018, Melbourne, Australia, July 15-20, 2018, Volume 1: Long Papers, pages 2556–2565. Association for Computational Linguistics, 2018.
|
| 241 |
+
|
| 242 |
+
[23] Soravit Changpinyo, Piyush Sharma, Nan Ding, and Radu Soricut. Conceptual 12m: Pushing web-scale image-text pre-training to recognize long-tail visual concepts. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 3558–3568, 2021.
|
| 243 |
+
|
| 244 |
+
[24] Or Honovich, Thomas Scialom, Omer Levy, and Timo Schick. Unnatural instructions: Tuning language models with (almost) no human labor, 2022. URL https://arxiv.org/abs/2212. 09689.
|
| 245 |
+
|
| 246 |
+
[25] Shayne Longpre, Le Hou, Tu Vu, Albert Webson, Hyung Won Chung, Yi Tay, Denny Zhou, Quoc V Le, Barret Zoph, Jason Wei, et al. The flan collection: Designing data and methods for effective instruction tuning. arXiv preprint arXiv:2301.13688, 2023.
|
| 247 |
+
|
| 248 |
+
[26] Nasrin Mostafazadeh, Michael Roth, Annie Louis, Nathanael Chambers, and James Allen. Lsdsem 2017 shared task: The story cloze test. In Proceedings of the 2nd Workshop on Linking Models of Lexical, Sentential and Discourse-level Semantics, pages 46–51, 2017.
|
| 249 |
+
|
| 250 |
+
[27] Rowan Zellers, Ari Holtzman, Yonatan Bisk, Ali Farhadi, and Yejin Choi. Hellaswag: Can a machine really finish your sentence? In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, 2019.
|
| 251 |
+
|
| 252 |
+
[28] Hector Levesque, Ernest Davis, and Leora Morgenstern. The winograd schema challenge. In Thirteenth International Conference on the Principles of Knowledge Representation and Reasoning, 2012.
|
| 253 |
+
|
| 254 |
+
[29] Keisuke Sakaguchi, Ronan Le Bras, Chandra Bhagavatula, and Yejin Choi. WinoGrande: An adversarial winograd schema challenge at scale. In AAAI, pages 8732–8740, 2020.
|
| 255 |
+
|
| 256 |
+
[30] Yonatan Bisk, Rowan Zellers, Ronan Le Bras, Jianfeng Gao, and Yejin Choi. Piqa: Reasoning about physical commonsense in natural language. In Thirty-Fourth AAAI Conference on Artificial Intelligence, 2020.
|
| 257 |
+
|
| 258 |
+
[31] Christopher Clark, Kenton Lee, Ming-Wei Chang, Tom Kwiatkowski, Michael Collins, and Kristina Toutanova. BoolQ: Exploring the surprising difficulty of natural yes/no questions. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 2924–2936, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1300. URL https://aclanthology.org/N19-1300.
|
| 259 |
+
|
| 260 |
+
[32] Marie-Catherine de Marneffe, Mandy Simons, and Judith Tonhauser. The CommitmentBank: Investigating projection in naturally occurring discourse. Proceedings of Sinn und Bedeutung, 23(2):107–124, Jul. 2019.
|
| 261 |
+
|
| 262 |
+
[33] Melissa Roemmele, Cosmin Adrian Bejan, and Andrew S. Gordon. Choice of plausible alternatives: An evaluation of commonsense causal reasoning. In AAAI Spring Symposium, 2011.
|
| 263 |
+
|
| 264 |
+
[34] 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.
|
| 265 |
+
|
| 266 |
+
[35] Douwe Kiela, Hamed Firooz, Aravind Mohan, Vedanuj Goswami, Amanpreet Singh, Pratik Ringshia, and Davide Testuggine. The hateful memes challenge: Detecting hate speech in multimodal memes. In Advances in Neural Information Processing Systems, volume 33, pages 2611–2624, 2020.
|
| 267 |
+
|
| 268 |
+
[36] Hessam Bagherinezhad, Hannaneh Hajishirzi, Yejin Choi, and Ali Farhadi. Are elephants bigger than butterflies? reasoning about sizes of objects. ArXiv, abs/1602.00753, 2016.
|
| 269 |
+
|
| 270 |
+
[37] Tobias Norlund, Lovisa Hagström, and Richard Johansson. Transferring knowledge from vision to language: How to achieve it and how to measure it? ArXiv, abs/2109.11321, 2021.
|
| 271 |
+
|
| 272 |
+
[38] Elia Bruni, Gemma Boleda, Marco Baroni, and Nam Khanh Tran. Distributional semantics in technicolor. In ACL, 2012.
|
| 273 |
+
|
| 274 |
+
[39] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ECCV, pages 740–755, 2014.
|
| 275 |
+
|
| 276 |
+
[40] Peter Young, Alice Lai, Micah Hodosh, and Julia Hockenmaier. From image descriptions to visual denotations: New similarity metrics for semantic inference over event descriptions. TACL, 2:67–78, 2014.
|
| 277 |
+
|
| 278 |
+
[41] Yash Goyal, Tejas Khot, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. Making the v in vqa matter: Elevating the role of image understanding in visual question answering. In CVPR, pages 6325–6334, 2017.
|
| 279 |
+
|
| 280 |
+
[42] Danna Gurari, Qing Li, Abigale J Stangl, Anhong Guo, Chi Lin, Kristen Grauman, Jiebo Luo, and Jeffrey P Bigham. Vizwiz grand challenge: Answering visual questions from blind people. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 3608–3617, 2018.
|
| 281 |
+
|
| 282 |
+
[43] Xingyu Chen, Zihan Zhao, Lu Chen, JiaBao Ji, Danyang Zhang, Ao Luo, Yuxuan Xiong, and Kai Yu. WebSRC: A dataset for web-based structural reading comprehension. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 4173–4185, Online and Punta Cana, Dominican Republic, November 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.emnlp-main.343. URL https://aclanthology.org/ 2021.emnlp-main.343.
|
| 283 |
+
|
| 284 |
+
[44] Catherine Wah, Steve Branson, Peter Welinder, Pietro Perona, and Serge J. Belongie. The caltech-ucsd birds-200-2011 dataset. 2011.
|
| 285 |
+
|
| 286 |
+
[45] Yoad Tewel, Yoav Shalev, Idan Schwartz, and Lior Wolf. Zerocap: Zero-shot image-to-text generation for visual-semantic arithmetic. 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 17897–17907, 2021.
|
| 287 |
+
|
| 288 |
+
[46] Wenliang Dai, Lu Hou, Lifeng Shang, Xin Jiang, Qun Liu, and Pascale Fung. Enabling multimodal generation on CLIP via vision-language knowledge distillation. In Findings of the Association for Computational Linguistics: ACL 2022, pages 2383–2395, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.findings-acl.187. URL https://aclanthology.org/2022.findings-acl.187.
|
| 289 |
+
|
| 290 |
+
[47] Woojeong Jin, Yu Cheng, Yelong Shen, Weizhu Chen, and Xiang Ren. A good prompt is worth millions of parameters: Low-resource prompt-based learning for vision-language models. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2763–2775, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-long.197. URL https://aclanthology.org/2022.acl-long.197.
|
| 291 |
+
|
| 292 |
+
[48] Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D. Manning, Andrew Ng, and Christopher Potts. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pages 1631–1642, Seattle, Washington, USA, October 2013. Association for Computational Linguistics. URL https://www.aclweb.org/anthology/D13-1170.
|
| 293 |
+
|
| 294 |
+
[49] Weizhi Wang, Li Dong, Hao Cheng, Haoyu Song, Xiaodong Liu, Xifeng Yan, Jianfeng Gao, and Furu Wei. Visually-augmented language modeling. In International Conference on Learning Representations, 2023.
|
| 295 |
+
|
| 296 |
+
[50] Jiahui Yu, Zirui Wang, Vijay Vasudevan, Legg Yeung, Mojtaba Seyedhosseini, and Yonghui Wu. Coca: Contrastive captioners are image-text foundation models, 2022.
|
| 297 |
+
|
| 298 |
+
[51] Rohit Girdhar, Alaaeldin El-Nouby, Zhuang Liu, Mannat Singh, Kalyan Vasudev Alwala, Armand Joulin, and Ishan Misra. Imagebind: One embedding space to bind them all. In CVPR, 2023.
|
| 299 |
+
|
| 300 |
+
[52] Xi Chen, Xiao Wang, Soravit Changpinyo, AJ Piergiovanni, Piotr Padlewski, Daniel Salz, Sebastian Goodman, Adam Grycner, Basil Mustafa, Lucas Beyer, et al. Pali: A jointly-scaled multilingual language-image model. arXiv:2209.06794, 2022.
|
| 301 |
+
|
| 302 |
+
[53] Xi Chen, Josip Djolonga, Piotr Padlewski, Basil Mustafa, Soravit Changpinyo, Jialin Wu, Carlos Riquelme Ruiz, Sebastian Goodman, Xiao Wang, Yi Tay, et al. Pali-x: On scaling up a multilingual vision and language model. arXiv preprint arXiv:2305.18565, 2023.
|
| 303 |
+
|
| 304 |
+
[54] OpenAI. Gpt-4 technical report, 2023.
|
| 305 |
+
|
| 306 |
+
[55] Peng Gao, Jiaming Han, Renrui Zhang, Ziyi Lin, Shijie Geng, Aojun Zhou, Wei Zhang, Pan Lu, Conghui He, Xiangyu Yue, Hongsheng Li, and Yu Qiao. Llama-adapter v2: Parameter-efficient visual instruction model, 2023.
|
| 307 |
+
|
| 308 |
+
[56] Danny Driess, Fei Xia, Mehdi SM Sajjadi, Corey Lynch, Aakanksha Chowdhery, Brian Ichter, Ayzaan Wahid, Jonathan Tompson, Quan Vuong, Tianhe Yu, et al. Palm-e: An embodied multimodal language model. arXiv preprint arXiv:2303.03378, 2023.
|
| 309 |
+
|
| 310 |
+
[57] Haotian Liu, Chunyuan Li, Qingyang Wu, and Yong Jae Lee. Visual instruction tuning. arXiv preprint arXiv:2304.08485, 2023.
|
| 311 |
+
|
| 312 |
+
[58] Deyao Zhu, Jun Chen, Xiaoqian Shen, Xiang Li, and Mohamed Elhoseiny. Minigpt-4: Enhancing vision-language understanding with advanced large language models. arXiv preprint arXiv:2304.10592, 2023.
|
| 313 |
+
[59] Wenliang Dai, Junnan Li, Dongxu Li, Anthony Meng Huat Tiong, Junqi Zhao, Weisheng Wang, Boyang Li, Pascale Fung, and Steven Hoi. Instructblip: Towards general-purpose vision-language models with instruction tuning. arXiv:2305.06500, 2023.
|
| 314 |
+
[60] Zewen Chi, Li Dong, Shaohan Huang, Damai Dai, Shuming Ma, Barun Patra, Saksham Singhal, Payal Bajaj, Xia Song, Xian-Ling Mao, Heyan Huang, and Furu Wei. On the representation collapse of sparse mixture of experts. In Advances in Neural Information Processing Systems, 2022. URL https://openreview.net/forum?id=mWaYC6CZf5.
|
| 315 |
+
[61] Michihiro Yasunaga, Armen Aghajanyan, Weijia Shi, Rich James, Jure Leskovec, Percy Liang, Mike Lewis, Luke Zettlemoyer, and Wen tau Yih. Retrieval-augmented multimodal language modeling. ArXiv, abs/2211.12561, 2022.
|
| 316 |
+
[62] Jing Yu Koh, Ruslan Salakhutdinov, and Daniel Fried. Grounding language models to images for multimodal generation. arXiv preprint arXiv:2301.13823, 2023.
|
md/dev/VBZJ_3tz-t/VBZJ_3tz-t.md
ADDED
|
@@ -0,0 +1,384 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# THE UNREASONABLE EFFECTIVENESS OF RANDOM PRUNING: RETURN OF THE MOST NAIVE BASELINE FOR SPARSE TRAINING
|
| 2 |
+
|
| 3 |
+
Shiwei $\mathbf { L i u ^ { 1 } }$ , Tianlong Chen2, Xiaohan Chen2, Li Shen3 Decebal Constantin Mocanu1,4, Zhangyang Wang2, Mykola Pechenizkiy1,
|
| 4 |
+
|
| 5 |
+
1Eindhoven University of Technology, 2University of Texas at Austin 3JD Explore Academy,4University of Twente, {s.liu3,m.pechenizkiy}@tue.nl, {tianlong.chen,xiaohan.chen,atlaswang}@utexas.edu, d.c.mocanu@utwente.nl, mathshenli@gmail.com
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
Random pruning is arguably the most naive way to attain sparsity in neural networks, but has been deemed uncompetitive by either post-training pruning or sparse training. In this paper, we focus on sparse training and highlight a perhaps counter-intuitive finding, that random pruning at initialization can be quite powerful for the sparse training of modern neural networks. Without any delicate pruning criteria or carefully pursued sparsity structures, we empirically demonstrate that sparsely training a randomly pruned network from scratch can match the performance of its dense equivalent. There are two key factors that contribute to this revival: (i) the network sizes matter: as the original dense networks grow wider and deeper, the performance of training a randomly pruned sparse network will quickly grow to matching that of its dense equivalent, even at high sparsity ratios; (ii) appropriate layer-wise sparsity ratios can be pre-chosen for sparse training, which shows to be another important performance booster. Simple as it looks, a randomly pruned subnetwork of Wide ResNet-50 can be sparsely trained to outperforming a dense Wide ResNet-50, on ImageNet. We also observed such randomly pruned networks outperform dense counterparts in other favorable aspects, such as out-of-distribution detection, uncertainty estimation, and adversarial robustness. Overall, our results strongly suggest there is larger-thanexpected room for sparse training at scale, and the benefits of sparsity might be more universal beyond carefully designed pruning. Our source code can be found at https://github.com/VITA-Group/Random_Pruning.
|
| 10 |
+
|
| 11 |
+
# 1 INTRODUCTION
|
| 12 |
+
|
| 13 |
+
Most recent breakthroughs in deep learning are fairly achieved with the increased complexity of over-parameterized networks (Brown et al., 2020; Raffel et al., 2020; Dosovitskiy et al., 2021; Fedus et al., 2021. arXiv:2101.03961; Jumper et al., 2021; Berner et al., 2019). It is well-known that large models train better (Neyshabur et al., 2019; Novak et al., 2018; Allen-Zhu et al., 2019), generalize better (Hendrycks & Dietterich, 2019; Xie & Yuille, 2020; Zhao et al., 2018), and transfer better (Chen et al., 2020b;a; 2021b). However, the upsurge of large models exacerbates the gap between research and practice since many real-life applications demand compact and efficient networks.
|
| 14 |
+
|
| 15 |
+
Neural network pruning, since proposed by (Mozer & Smolensky, 1989; Janowsky, 1989), has evolved as the most common technique in literature to reduce the computational and memory requirements of neural networks. Over the past few years, numerous pruning criteria have been proposed, including magnitude (Mozer & Smolensky, 1989; Han et al., 2015; Frankle & Carbin, 2019; Mocanu et al., 2018), Hessian (LeCun et al., 1990; Hassibi & Stork, 1993), mutual information (Dai et al., 2018), Taylor expansion (Molchanov et al., 2016), movement (Sanh et al., 2020), connection sensitivity (Lee et al., 2019), etc. Motivated for different scenarios, pruning can occur after training (Han et al., 2015; Frankle & Carbin, 2019; Molchanov et al., 2016; Lee et al., 2021), during training (Zhu & Gupta,
|
| 16 |
+
|
| 17 |
+
2017; Gale et al., 2019; Louizos et al., 2018; You et al., 2020; Chen et al., 2021c;a), and even before training (Mocanu et al., 2018; Lee et al., 2019; Gale et al., 2019; Wang et al., 2020; Tanaka et al., 2020). The last regime can be further categorized into “static sparse training” (Mocanu et al., 2016; Gale et al., 2019; Lee et al., 2019; Wang et al., 2020) and “dynamic sparse training” (Mocanu et al., 2018; Bellec et al., 2018; Evci et al., 2020a; Liu et al., 2021b;a).
|
| 18 |
+
|
| 19 |
+
While random pruning is a universal method that can happen at any stage of training, training a randomly pruned network from scratch is arguably the most appealing way, owing to its “end-to-end” saving potential for the entire training process besides the inference. Due to this reason, we focus on random pruning for sparse training in this paper. When new pruning approaches bloom, random pruning naturally becomes their performance’s empirical “lower bound” since the connections are randomly chosen without any good reasoning. Likely due to the same reason, the results of sparse training with random pruning (as “easy to beat” baselines to support fancier new pruning methods) reported in the literature are unfortunately vague, often inconsistent, and sometimes casual. For instance, it is found in Liu et al. (2020b) that randomly pruned sparse networks can be trained from scratch to match the full accuracy of dense networks with only $20 \%$ parameters, whereas around $80 \%$ parameters are required to do so in Frankle et al. (2021). The differences may arise from architecture choices, training recipes, distribution hyperparameters/layer-wise ratios, and so on.
|
| 20 |
+
|
| 21 |
+
In most pruning literature (Gale et al., 2019; Lee et al., 2019; Frankle et al., 2021; Tanaka et al., 2020), random pruning usually refers to randomly removing the same proportion of parameters per layer, ending up with uniform layer-wise sparsities. Nevertheless, researchers have explored other pre-defined layer-wise sparsities, e.g., uniform $^ +$ (Gale et al., 2019), Erdos-R ˝ enyi ´ random graph (ER) (Mocanu et al., 2018), and Erdos-R ˝ enyi-Kernel ´ (ERK) (Evci et al., 2020a). These layerwise sparsities also fit the category of random pruning, as they require no training to obtain the corresponding sparsity ratios. We assess random pruning for sparse training with these layer-wise sparsity ratios, in terms of various perspectives besides the predictive accuracy.
|
| 22 |
+
|
| 23 |
+
Our main findings during this course of study are summarized below:
|
| 24 |
+
|
| 25 |
+
• We find that the network size matters for the effectiveness of sparse training with random pruning. With small networks, random pruning hardly matches the full accuracy even at mild sparsities $10 \%$ , $20 \%$ ). However, as the networks grow wider and deeper, the performance of training a randomly pruned sparse network will quickly grow to matching that of its dense equivalent, even at high sparsity ratios.
|
| 26 |
+
• We further identify that appropriate layer-wise sparsity ratios can be an important booster for training a randomly pruned network from scratch, particularly for large networks. We investigate several options to pre-define layer-wise sparsity ratios before any training; one of them is able to push the performance of a completely random sparse Wide ResNet-50 over the densely trained Wide ResNet-50 on ImageNet.
|
| 27 |
+
• We systematically assess the performance of sparse training with random pruning, and observe surprisingly good accuracy and robustness. The accuracy achieved by ERK ratio can even surpass the ones learned by complex criteria, e.g., SNIP or GraSP. In addition, randomly pruned and sparsely trained networks are found to outperform conventional dense networks in other favorable aspects, such as out-of-distribution (OoD) detection, adversarial robustness, and uncertainty estimation.
|
| 28 |
+
|
| 29 |
+
# 2 RELATED WORK
|
| 30 |
+
|
| 31 |
+
# 2.1 STATIC SPARSE TRAINING
|
| 32 |
+
|
| 33 |
+
Static sparse training represents a class of methods that aim to train a sparse subnetwork with a fixed sparse connectivity pattern during the course of training. We divide the static sparse training into random pruning and non-random pruning according to whether the connection is randomly selected.
|
| 34 |
+
|
| 35 |
+
Random Pruning. Static sparse training with random pruning samples masks within each layer in a random fashion based on pre-defined layer-wise sparsities. The most naive approach is pruning each layer uniformly with the same pruning ratio, i.e., uniform pruning (Mariet & Sra, 2016; He et al., 2017; Suau et al., 2019; Gale et al., 2019). Mocanu et al. (2016) proposed a non-uniform and scale-free topology, showing better performance than the dense counterpart when applied to restricted
|
| 36 |
+
|
| 37 |
+
Boltzmann machines (RBMs). Later, expander graphs were introduced to build sparse CNNs and showed comparable performance against the corresponding dense CNNs (Prabhu et al., 2018; Kepner & Robinett, 2019). While not initially designed for static sparse training, ER (Mocanu et al., 2018) and ERK (Evci et al., 2020a) are two advanced layer-wise sparsities introduced from the field of graph theory with strong results.
|
| 38 |
+
|
| 39 |
+
Non-Random Pruning. Instead of pre-choosing a sparsity ratio for each layer, many works utilize the proposed saliency criteria to learn the layer-wise sparsity ratios before training, also termed as pruning at initialization (PaI). Lee et al. (2019) first introduced SNIP that chooses structurally important connections at initialization via the proposed connection sensitivity. Following SNIP, many efficient criteria have been proposed to improve the performance of non-random pruning at initialization, including but not limited to gradient flow (GraSP; Wang et al. (2020)), synaptic strengths (SynFlow; Tanaka et al. (2020)), neural tangent kernel (Liu & Zenke, 2020), and iterative SNIP (de Jorge et al., 2021; Verdenius et al., 2020). Su et al. (2020); Frankle et al. (2021) uncovered that the existing PaI methods hardly exploit any information from the training data and are very robust to mask shuffling, whereas magnitude pruning after training learns both, reflecting a broader challenge inherent to pruning at initialization.
|
| 40 |
+
|
| 41 |
+
# 2.2 DYNAMIC SPARSE TRAINING
|
| 42 |
+
|
| 43 |
+
In contrast to static sparse training, dynamic sparse training stems from randomly initialized sparse subnetworks, and meanwhile dynamically explores new sparse connectivity during training. Dynamic sparse training starts from Sparse Evolutionary Training (SET) (Mocanu et al., 2018; Liu et al., 2020a) which initializes the sparse connectivity with Erdos-R ˝ enyi ´ (Erdos & R ˝ enyi ´ , 1959) topology and periodically explores the sparse connectivity via a prune-and-grow scheme during the course of training. While there exist numerous pruning criteria in the literature, simple magnitude pruning typically performs well in the field of dynamic sparse training. On the other hand, the criteria used to grow weights back differs from method to method, including randomness (Mocanu et al., 2018; Mostafa & Wang, 2019), momentum (Dettmers & Zettlemoyer, 2019), gradient (Evci et al., 2020a; Jayakumar et al., 2020; Liu et al., 2021b). Besides the prune-and-grow scheme, layer-wise sparsities are vital to achieving high accuracy. (Mostafa & Wang, 2019; Dettmers & Zettlemoyer, 2019) reallocates weights across layers during training based on reasonable heuristics, demonstrating performance improvement. Evci et al. (2020a) extended ER to CNNs and showed considerable performance gains to sparse CNN training with the Erdos-R ˝ enyi-Kernel ´ (ERK) ratio. Very recently, Liu et al. (2021a) started from a subnetwork at a smaller sparsity and gradually pruned it the target sparsity during training. The denser initial subnetwork provides a larger exploration space for DST at the early training phase and thus leads to a performance improvement, especially for extreme sparsities. Even though dynamic sparse training achieves promising sparse training performance, it changes the sparse connectivity during training and is thus out of the scope of random pruning.
|
| 44 |
+
|
| 45 |
+
While prior works have observed that random pruning can be more competitive in certain cases (Mocanu et al., 2018; Liu et al., 2020b; Su et al., 2020; Frankle et al., 2021), they did not give principled guidelines on when and how it can become that good; nor do they show it can match the performance of dense networks on ImageNet. Standing on the shoulders of those giants, our work summarized principles by more extensive and rigorous studies, and demonstrate the strongest result so far, that randomly pruned sparse Wide ResNet-50 can be sparsely trained to outperform a dense Wide ResNet50, on ImageNet. Moreover, compared with the ad-hoc sparsity ratios used in (Su et al., 2020), we show that ERK (Evci et al., 2020a) and our modified $\mathrm { E R K + }$ are more generally applicable sparsity ratios that consistently demonstrate competitive performance without careful layer-wise sparsity design for every architecture. Specifically, $\mathrm { E R K + }$ ratio achieves similar accuracy with the dense Wide ResNet-50 on ImageNet while being data free, feedforward free, and dense initialization free.
|
| 46 |
+
|
| 47 |
+
# 3 METHODOLOGY
|
| 48 |
+
|
| 49 |
+
We conduct extensive experiments to systematically evaluate the performance of random pruning.
|
| 50 |
+
The experimental settings are described below.
|
| 51 |
+
|
| 52 |
+
# 3.1 LAYER-WISE SPARSITIES RATIOS
|
| 53 |
+
|
| 54 |
+
Denote $s ^ { l }$ as the sparsity of layer $l$ . Random pruning, namely, removes weights or filters in each layer randomly to the target sparsity $s ^ { l }$ . Different from works that learn layer-wise sparsities and model weights together during training using iterative global pruning techniques (Frankle & Carbin, 2019), soft threshold (Kusupati et al., 2020), and dynamic reparameterization (Mostafa & Wang, 2019), etc., the layer-wise sparsities of random pruning is pre-defined before training. Many pre-defined layer-wise sparsity ratios in the literature are suited for random pruning, while they may not initially be designed for random pruning. We choose the following 6 layer-wise sparsity ratios to study. SNIP ratio and GraSP ratio are two layer-wise ratios that we borrow from PaI.
|
| 55 |
+
|
| 56 |
+
ERK. Introduced by Mocanu et al. (2018), Erdos-R ˝ enyi (ER) sparsifies the Multilayer Perceptron ´ (MLP) with a random topology in which larger layers are allocated with higher sparsity then smaller layers. Evci et al. (2020a) further proposed a convolutional variant (Erdos-R ˝ enyi-Kernel (ERK)) that ´ takes the convolutional kernel into consideration. Specifically, the sparsity of the convolutional layer is scaled proportional to $\begin{array} { r } { 1 - \frac { n ^ { l - 1 } + n ^ { l } + w ^ { l } + h ^ { l } } { n ^ { l - 1 } \times n ^ { l } \times w ^ { l } \times h ^ { l } } } \end{array}$ where $n ^ { l }$ refers to the number of neurons/channels in layer $l$ ; $w ^ { l }$ and $h ^ { l }$ are the corresponding width and height.
|
| 57 |
+
|
| 58 |
+
$\mathbf { E R } \mathbf { K } +$ . We modify ERK by forcing the last fully-connected layer as dense if it is not, while keeping the overall parameter count the same. Doing so improves the test accuracy of Wide ResNet-50 on ImageNet1 as shown in Appendix F.
|
| 59 |
+
|
| 60 |
+
Uniform. Each layer is pruned with the same pruning rate so that the pruned network ends up with a uniform sparsity distribution, e.g., Zhu & Gupta (2017).
|
| 61 |
+
|
| 62 |
+
Uniform+. Instead of using a completely uniform sparsity ratio, Gale et al. (2019) keep the first convolutional layer dense and maintain at least $20 \%$ parameters in the last fully-connected layer.
|
| 63 |
+
|
| 64 |
+
SNIP ratio. SNIP is a PaI method that selects important weights based on the connection sensitivity score $\lvert g \odot w \rvert$ , where $w$ and $g$ is the network weight and gradient, respectively. The weights with the lowest scores in one iteration are pruned before training. While not initially designed for random pruning, we adjust SNIP for random pruning by only keeping its layer-wise sparsity ratios, while discarding its mask positions. New mask positions (non-zero elements) are re-sampled through a uniform distribution $\sim \mathrm { U n i f o r m } ( 0 , 1 )$ with a probability of $1 - s ^ { l }$ . Such layer-wise sparsities are obtained in a (slightly) data-driven way, yet very efficiently before training without any weight update. The SNIP ratio is then treated as another pre-defined (i.e., before the training starts) sampling ratio for random pruning.
|
| 65 |
+
|
| 66 |
+
GraSP ratio. GraSP is another state-of-the-art method seeking to pruning at initialization. Specifically, GraSP removes weights that have the least effect on the gradient norm based on the score of $- w \odot H g$ , where $H$ is the Hessian matrix and $g$ is the gradient. Same with SNIP, we keep the layer-wise sparsity ratios of GraSP and re-sample its mask positions.
|
| 67 |
+
|
| 68 |
+
# 3.2 EXPERIMENTAL SETTINGS
|
| 69 |
+
|
| 70 |
+
Table 1: Summary of the architectures, datasets and hyperparameters used in this paper.
|
| 71 |
+
|
| 72 |
+
<table><tr><td>Model</td><td>Mode</td><td>Data</td><td>#Epoch</td><td>Batch Size</td><td>LR</td><td>Momentum</td><td>LR Decay,Epoch</td><td>Weight Decay</td></tr><tr><td rowspan="2">ResNets</td><td>Dense</td><td>CIFAR-10/100</td><td>160</td><td>128</td><td>0.1</td><td>0.9</td><td>10×,[80,120]</td><td>0.0005</td></tr><tr><td>Sparse</td><td>CIFAR-10/100</td><td>160</td><td>128</td><td>0.1</td><td>0.9</td><td>10×,[80,120]</td><td>0.0005</td></tr><tr><td rowspan="2">Wide ResNets</td><td>Dense</td><td>ImageNet</td><td>90</td><td>192*4</td><td>0.4</td><td>0.9</td><td>10×,[30,60,80]</td><td>0.0001</td></tr><tr><td>Sparse</td><td>ImageNet</td><td>100</td><td>192*4</td><td>0.4</td><td>0.9</td><td>10×,[30,60,90]</td><td>0.0001</td></tr></table>
|
| 73 |
+
|
| 74 |
+
Architectures and Datasets. Our main experiments are conducted with the CIFAR version of ResNet (He et al., 2016) with varying depths and widths on CIFAR-10/100 (Krizhevsky et al., 2009), the batch normalization version of VGG (Simonyan & Zisserman, 2014) with varying depths on CIFAR-10/100, and the ImageNet version of ResNet and Wide ResNet-50 (Zagoruyko & Komodakis, 2016) on ImageNet (Deng et al., 2009). For ImageNet, we follow the common setting in sparse training (Dettmers & Zettlemoyer, 2019; Evci et al., 2020b; Liu et al., 2021b) and train sparse models for 100 epochs. All models are trained with stochastic gradient descent (SGD) with momentum. We share the summary of the architectures, datasets, and hyperparameters in Table 1.
|
| 75 |
+
|
| 76 |
+
Measurement Metrics. In most pruning literature, test accuracy is the core quality that researchers consider. However, the evaluation of other perspectives is also important for academia and industry before replacing dense networks with sparse networks on a large scope. Therefore, we thoroughly evaluate sparse training with random pruning from a broader perspective. Specifically, we assess random pruning from perspectives of OoD performance (Hendrycks et al., 2021), adversarial robustness (Goodfellow et al., 2014), and uncertainty estimation (Lakshminarayanan et al., 2016). See Appendix A for full details of the measurements used in this work.
|
| 77 |
+
|
| 78 |
+

|
| 79 |
+
Figure 1: From shallow to deep. Test accuracy of training randomly pruned subnetworks from scratch with different depth on CIFAR-10. ResNet-A refers to a ResNet model with A layers in total.
|
| 80 |
+
|
| 81 |
+

|
| 82 |
+
Figure 2: From narrow to wide. Test accuracy of training randomly pruned subnetworks from scratch with different width on CIFAR-10. ResNet-A-B refers to a ResNet model with A layers in total and B filters in the first convolutional layer.
|
| 83 |
+
|
| 84 |
+
# 4 EXPERIMENTAL RESULTS ON CIFAR
|
| 85 |
+
|
| 86 |
+
In this section, we report the results of sparse training with random pruning on CIFAR-10/100 under various evaluation measurements. For each measurement, the trade-off between sparsity and the corresponding metric is reported. Moreover, we also alter the depth and width of the model to check how the performance alters as the model size alters. The results are averaged over 3 runs. We report the results on CIFAR-10 of ResNet in the main body of this paper. The results on CIFAR-100 of
|
| 87 |
+
|
| 88 |
+
ResNet, and CIFAR-10/100 of VGG are shown in Appendix D and Appendix E, respectively. Unless otherwise stated, all the results are qualitatively similar.
|
| 89 |
+
|
| 90 |
+
# 4.1 PREDICTIVE ACCURACY OF RANDOM PRUNING ON CIFAR-10
|
| 91 |
+
|
| 92 |
+
We first demonstrate the performance of random pruning on the most common metric – test accuracy. To avoid overlapping of multiple curves, we share the results of GraSP in Appendix C. The main observations are as follows:
|
| 93 |
+
|
| 94 |
+
$\textcircled{1}$ Performance of random pruning improves with the size of the network. We vary the depth and width of ResNet and report the test accuracy in Figure 1. When operating on small networks, e.g., ResNet-20 and ResNet-32, we can hardly find matching subnetworks even at mild sparsities, i.e., $10 \%$ , $20 \%$ . With larger networks, e.g., ResNet-56 and ResNet-110, random pruning can match the dense performance at $6 0 \% \sim 7 0 \%$ sparsity. Similar behavior can also be observed when we increase the width of ResNet-20 in Figure 2. See Appendix B for results on deeper models.
|
| 95 |
+
|
| 96 |
+
$\textcircled{2}$ The performance difference between different pruning methods becomes indistinct as the model size increases. Even though uniform sparsities fail to match the accuracy achieved by nonuniform sparsities (ERK and SNIP) with small models, their test accuracy raises to a comparable level as non-uniform sparsities with large models, e.g., ResNet-110 and ResNet-20-56.
|
| 97 |
+
|
| 98 |
+
$\textcircled{3}$ Random pruning with ERK even outperforms pruning with the well-versed methods (SNIP, GraSP). Without using any information, e.g., gradient and magnitude, training a randomly pruned subnetwork with ERK topology leads to expressive accuracy, even better than the ones trained with the delicately designed sparsity ratios, i.e., SNIP, and GraSP (shown in Appendix C).
|
| 99 |
+
|
| 100 |
+
# 4.2 BROADER EVALUATION OF RANDOM PRUNING ON CIFAR-10
|
| 101 |
+
|
| 102 |
+
In general, sparse training with random pruning achieves quite strong results on CIFAR-10 in terms of uncertainty estimation, OoD robustness, and adversarial robustness without any fancy techniques. We summary main observations as below:
|
| 103 |
+
|
| 104 |
+
$\textcircled{1}$ Randomly pruned networks enjoy better uncertainty estimation than their dense counterparts. Figure 3 shows that randomly pruned ResNet-20 matches or even improves the uncertainty estimation of dense networks with a full range of sparsities. ECE of random pruning grows with the model size, in line with the finding of dense networks in Guo et al. (2017). Still, random pruning is capable of sampling matching subnetworks with high sparsities (e.g., $80 \%$ ) except for the largest model, ResNet-110. Results of NLL are presented in Appendix G.2, where randomly pruned networks also match NLL of dense networks at extremely high sparsities.
|
| 105 |
+
|
| 106 |
+
$\textcircled{2}$ Random pruning produces extremely sparse yet robust subnetworks on OoD. Figure 4 plots the results of networks trained on CIFAR-10, tested on CIFAR-100. The results tested on SVHN are reported in Appendix G.1. Large network sizes significantly improve the OoD performance of random pruning. As the model size increases, random pruning can match the OoD performance of dense networks with only $20 \%$ parameters. Again, SNIP ratio and ERK outperform uniform sparsities in this setting.
|
| 107 |
+
|
| 108 |
+
$\textcircled{3}$ Random pruning improves the adversarial robustness of large models. The adversarial robustness of large models (e.g., ResNet-56 and ResNet-110) improves significantly with mild sparsities in Appendix G.3. One explanation here is that, while achieving high clean accuracy, these over-parameterized large models are highly overfitted on CIFAR-10, and thus suffer from poor performance on adversarial examples (shown by Tsipras et al. (2019); Zhang et al. (2019) as well). Sparsity induced by random pruning serves as a cheap type of regularization which possibly mitigates this overfitting problem.
|
| 109 |
+
|
| 110 |
+
# 5 EXPERIMENTAL RESULTS ON IMAGENET
|
| 111 |
+
|
| 112 |
+
We have learned from Section 4 that larger networks result in stronger random subnetworks on CIFAR-10/100. We are also interested in how far we can go with random pruning on ImageNet (Deng et al., 2009), a non-saturated dataset on which deep neural networks are less over-parameterized than on CIFAR-10/100. In this section, we provide a large-scale experiment on ImageNet with various ResNets from ResNet-18 to ResNet-101 and Wide ResNet-50.
|
| 113 |
+
|
| 114 |
+

|
| 115 |
+
Figure 3: Uncertainty estimation (ECE). The experiments are conducted with various models on CIFAR-10. Lower ECE values represent better uncertainty estimation.
|
| 116 |
+
|
| 117 |
+

|
| 118 |
+
Figure 4: Out-of-distribution performance (ROC-AUC). Experiments are conducted with models trained on CIFAR-10, tested on CIFAR-100. Higher ROC-AUC refers to better OoD performance.
|
| 119 |
+
|
| 120 |
+
Same with CIFAR, we evaluate sparse training with random pruning from various perspectives, including the predictive accuracy, OoD detection, adversarial robustness, and uncertainty estimation. We choose SNIP and $\mathrm { E R K + }$ sparsity ratios for Wide ResNet-50, and SNIP ratios for the rest of the architectures. The sparsity of randomly pruned subnetworks is set as [0.7, 0.5, 0.3]. We first show the trade-off between the parameter count and the test accuracy for all architectures in Figure 5-top-left. Moreover, to better understand the computational benefits brought by sparsity, we report the trade-off between test FLOPs and each measurement metric in the rest of Figure 5.
|
| 121 |
+
|
| 122 |
+
Predictive Accuracy. The parameter count-accuracy trade-off and the FLOPs-accuracy trade-off is reported in Figure 5-top-left and Figure 5-top-middle, respectively. Overall, we observe a very similar pattern as the results of CIFAR reported in Section 4. On smaller models like ResNet-18 and ResNet-34, random pruning can not find matching subnetworks. When the model size gets considerably larger (ResNet-101 and Wide ResNet-50), the test accuracy of random pruning quickly improves and matches the corresponding dense models (not only the small-dense models) at $30 \% \sim$ $50 \%$ sparsities. While the performance difference between SNIP ratio and ERK on CIFAR-10/100 is vague, SNIP ratio consistently outperforms $\mathrm { E R K + }$ with Wide Resnet-50 on ImageNet with the same number of parameters (see Appendix F for more details). Besides, we observe that random pruning receives increasingly larger efficiency gains (the difference between $\mathbf { X }$ -axis values of sparse models and dense models) with the increased model size on ImageNet.
|
| 123 |
+
|
| 124 |
+

|
| 125 |
+
Figure 5: Summary of evaluation on ImageNet. Various Evaluation of ResNets on ImageNet, including predictive accuracy on the original ImageNet, adversarial robustness with FGSM, OoD performance on ImageNet-O, and uncertainty (ECE and NLL). The sparsity of randomly pruned subnetworks is set as [0.7, 0.5, 0.3] from left to right for each line.
|
| 126 |
+
|
| 127 |
+
While in Figure 5-top-left, a randomly pruned Wide ResNet-50 with SNIP ratios (purple line) can easily outperform the dense ResNet-50 (blue star) by $2 \%$ accuracy with the same number of parameters, the former requires twice as much FLOPs as the latter in Figure 5-top-middle. This observation highlights the importance of reporting the required FLOPs together with the sparsity when comparing two pruning methods.
|
| 128 |
+
|
| 129 |
+
Broader Evaluation of Random Pruning on ImageNet. As shown in the rest of Figure 5, the performance of the broader evaluation on ImageNet is extremely similar to the test accuracy. Random pruning can not discover matching subnetworks with small models. However, as the model size increases, it receives large performance gains in terms of other important evaluations, including uncertainty estimation, OoD detection performance, and adversarial robustness.
|
| 130 |
+
|
| 131 |
+
# 5.1 UNDERSTANDING RANDOM PRUNING VIA GRADIENT FLOW
|
| 132 |
+
|
| 133 |
+
The performance gap between the ERK and SNIP ratio on ImageNet raises the question – what benefits do the layer-wise sparsities of SNIP provide to sparse training? Since SNIP takes gradients into account when determines the layer-wise sparsities, we turn to gradient flow in the hope of finding some insights on this question. The form of gradient norm we choose is the effective gradient flow (Tessera et al., 2021) which only calculates the gradient norm of active weights. We measure the gradient norm of sparse networks generated by SNIP and ERK2 during the early training phase. The results are depicted in Figure 6.
|
| 134 |
+
|
| 135 |
+
Overall, we see that the SNIP ratio indeed brings benefits to the gradient norm at the initial stage compared with ERK. Considering only SNIP (green lines) and ERK (orange lines), the ones with higher gradient norm at the beginning always achieve higher final accuracy on both CIFAR-10 and ImageNet. This result is on par with prior work (Wang et al., 2020), which claims that increasing the gradient norm at the beginning likely leads to higher accuracy. However, this observation does not hold for dense Wide ResNet-50 on ImageNet (blue lines). Even though dense models have a lower gradient norm than SNIP, they consistently outperform SNIP in accuracy by a large margin.
|
| 136 |
+
|
| 137 |
+

|
| 138 |
+
Figure 6: Gradient norm of randomly pruned networks during training. Top: Comparison between gradient norm of SNIP and ERK with $50 \%$ sparse ResNet-20, ResNet-56, and ResNet-110 on CIFAR-10. Bottom: Comparison between gradient norm of SNIP and ERK with Wide ResNet-50 on ImageNet at various sparsities.
|
| 139 |
+
|
| 140 |
+
Instead of focusing on the initial phase, we note that the gradient norm early in the training (the flat phase after gradient norm drops) could better understand the behaviour of networks trained under different scenarios. We empirically find that final performance gaps between sparse networks and dense networks is highly correlated with gaps of gradient norm early in training. Training with small networks (e.g., ResNet-20) on CIFAR-10 results in large performance and gradient norm gaps between sparse networks and dense networks, whereas these two gaps simultaneously vanish when trained with large networks, e.g., ResNet-56 and ResNet-110. Similar behavior can be observed in Wide ResNet-50 on ImageNet in terms of sparsity. Both the performance and gradient norm gaps decrease gradually as the sparsity level drops from $85 \%$ to $60 \%$ . This actually makes sense, since large networks (either large model size or large number of parameters) are likely to still be overparameterized after pruning, so that all pruning methods (including random pruning) can preserve gradient flow along with test accuracy equally well.
|
| 141 |
+
|
| 142 |
+
Our findings suggest that only considering gradient flow at initialization might not be sufficient for sparse training. More efforts should be invested to study the properties that sparse network training misses after initialization, especially the early stage of training (Liu et al., 2021a). Techniques that change the sparse pattern during training (Mocanu et al., 2018; Evci et al., 2020a) and weight rewinding (Frankle et al., 2020; Renda et al., 2020) could serve as good starting points.
|
| 143 |
+
|
| 144 |
+
# 6 CONCLUSION
|
| 145 |
+
|
| 146 |
+
In this work, we systematically revisit the underrated baseline of sparse training – random pruning. Our results highlight a counter-intuitive finding, that is, training a randomly pruned network from scratch without any delicate pruning criteria can be quite performant. With proper network sizes and layer-wise sparsity ratios, random pruning can match the performance of dense networks even at extreme sparsities. Impressively, a randomly pruned subnetwork of Wide ResNet-50 can be trained to outperforming a strong benchmark, dense Wide ResNet-50 on ImageNet. Moreover, training with random pruning intrinsically brings significant benefits to other desirable aspects, such as out-ofdistribution detection, uncertainty estimation and adversarial robustness. Our paper indicates that in addition to appealing performance, large models also enjoy strong robustness to pruning. Even if we pruning with complete randomness, large models can preserve their performance well.
|
| 147 |
+
|
| 148 |
+
# 7 REPRODUCIBILITY
|
| 149 |
+
|
| 150 |
+
We have shared the architectures, datasets, and hyperparameters used in this paper in Section 3.2. Besides, the different measurements and metrics used in this paper are shared in Appendix A. We have released our code at https://github.com/VITA-Group/Random_Pruning.
|
| 151 |
+
|
| 152 |
+
# 8 ACKNOWLEDGEMENT
|
| 153 |
+
|
| 154 |
+
This work have been done when Shiwei Liu worked as an intern at JD Explore Academy. This work is partially supported by Science and Technology Innovation 2030 – “Brain Science and Brain-like Research” Major Project (No. 2021ZD0201402 and No. 2021ZD0201405). Z. Wang is in part supported by the NSF AI Institute for Foundations of Machine Learning (IFML).
|
| 155 |
+
|
| 156 |
+
# REFERENCES
|
| 157 |
+
|
| 158 |
+
Zeyuan Allen-Zhu, Yuanzhi Li, and Zhao Song. A convergence theory for deep learning via overparameterization. In International Conference on Machine Learning, pp. 242–252. PMLR, 2019.
|
| 159 |
+
|
| 160 |
+
Maximilian Augustin, Alexander Meinke, and Matthias Hein. Adversarial robustness on in-and outdistribution improves explainability. In European Conference on Computer Vision, pp. 228–245. Springer, 2020.
|
| 161 |
+
|
| 162 |
+
Guillaume Bellec, David Kappel, Wolfgang Maass, and Robert Legenstein. Deep rewiring: Training very sparse deep networks. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $_ { \cdot } =$ BJ_wN01C-.
|
| 163 |
+
|
| 164 |
+
Christopher Berner, Greg Brockman, Brooke Chan, Vicki Cheung, Przemyslaw Dkebiak, Christy Dennison, David Farhi, Quirin Fischer, Shariq Hashme, Chris Hesse, et al. Dota 2 with large scale deep reinforcement learning. arXiv preprint arXiv:1912.06680, 2019.
|
| 165 |
+
|
| 166 |
+
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. Curran Associates, Inc., 2020. URL https://proceedings.neurips. cc/paper/2020/file/1457c0d6bfcb4967418bfb8ac142f64a-Paper.pdf.
|
| 167 |
+
|
| 168 |
+
Tianlong Chen, Jonathan Frankle, Shiyu Chang, Sijia Liu, Yang Zhang, Zhangyang Wang, and Michael Carbin. The lottery ticket hypothesis for pre-trained bert networks. Advances in neural information processing systems, 33:15834–15846, 2020a.
|
| 169 |
+
|
| 170 |
+
Tianlong Chen, Yu Cheng, Zhe Gan, Lu Yuan, Lei Zhang, and Zhangyang Wang. Chasing sparsity in vision transformers: An end-to-end exploration. Advances in Neural Information Processing Systems, 34, 2021a.
|
| 171 |
+
|
| 172 |
+
Tianlong Chen, Jonathan Frankle, Shiyu Chang, Sijia Liu, Yang Zhang, Michael Carbin, and Zhangyang Wang. The lottery tickets hypothesis for supervised and self-supervised pre-training in computer vision models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 16306–16316, 2021b.
|
| 173 |
+
|
| 174 |
+
Ting Chen, Simon Kornblith, Kevin Swersky, Mohammad Norouzi, and Geoffrey E Hinton. Big selfsupervised models are strong semi-supervised learners. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 22243–22255. Curran Associates, Inc., 2020b. URL https://proceedings.neurips. cc/paper/2020/file/fcbc95ccdd551da181207c0c1400c655-Paper.pdf.
|
| 175 |
+
|
| 176 |
+
Xiaohan Chen, Yu Cheng, Shuohang Wang, Zhe Gan, Zhangyang Wang, and Jingjing Liu. Earlybert: Efficient bert training via early-bird lottery tickets. 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. 2195–2207, 2021c.
|
| 177 |
+
|
| 178 |
+
Bin Dai, Chen Zhu, Baining Guo, and David Wipf. Compressing neural networks using the variational information bottleneck. In International Conference on Machine Learning, pp. 1135–1144. PMLR, 2018.
|
| 179 |
+
|
| 180 |
+
Pau de Jorge, Amartya Sanyal, Harkirat Behl, Philip Torr, Gregory Rogez, and Puneet K. Dokania. ´ Progressive skeletonization: Trimming more fat from a network at initialization. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum? id $=$ 9GsFOUyUPi.
|
| 181 |
+
|
| 182 |
+
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pp. 248–255. Ieee, 2009.
|
| 183 |
+
|
| 184 |
+
Tim Dettmers and Luke Zettlemoyer. Sparse networks from scratch: Faster training without losing performance. arXiv preprint arXiv:1907.04840, 2019.
|
| 185 |
+
|
| 186 |
+
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.
|
| 187 |
+
|
| 188 |
+
Paul Erdos and Alfr ˝ ed R ´ enyi. On random graphs i. ´ Publicationes Mathematicae (Debrecen), 6: 290–297, 1959.
|
| 189 |
+
|
| 190 |
+
Utku Evci, Trevor Gale, Jacob Menick, Pablo Samuel Castro, and Erich Elsen. Rigging the lottery: Making all tickets winners. In International Conference on Machine Learning, pp. 2943–2952. PMLR, 2020a.
|
| 191 |
+
|
| 192 |
+
Utku Evci, Yani A Ioannou, Cem Keskin, and Yann Dauphin. Gradient flow in sparse neural networks and how lottery tickets win. arXiv preprint arXiv:2010.03533, 2020b.
|
| 193 |
+
|
| 194 |
+
William Fedus, Barret Zoph, and Noam Shazeer. Switch transformers: Scaling to trillion parameter models with simple and efficient sparsity. Advances in Neural Information Processing Systems., 2021. arXiv:2101.03961.
|
| 195 |
+
|
| 196 |
+
Jonathan Frankle and Michael Carbin. The lottery ticket hypothesis: Finding sparse, trainable neural networks. In International Conference on Learning Representations, 2019. URL https: //openreview.net/forum?id $\equiv$ rJl-b3RcF7.
|
| 197 |
+
|
| 198 |
+
Jonathan Frankle, Gintare Karolina Dziugaite, Daniel Roy, and Michael Carbin. Linear mode connectivity and the lottery ticket hypothesis. In International Conference on Machine Learning, pp. 3259–3269. PMLR, 2020.
|
| 199 |
+
|
| 200 |
+
Jonathan Frankle, Gintare Karolina Dziugaite, Daniel Roy, and Michael Carbin. Pruning neural networks at initialization: Why are we missing the mark? In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id $\equiv$ Ig-VyQc-MLK.
|
| 201 |
+
|
| 202 |
+
Jerome Friedman, Trevor Hastie, Robert Tibshirani, et al. The elements of statistical learning, volume 1. Springer series in statistics New York, 2001.
|
| 203 |
+
|
| 204 |
+
Trevor Gale, Erich Elsen, and Sara Hooker. The state of sparsity in deep neural networks. arXiv preprint arXiv:1902.09574, 2019.
|
| 205 |
+
|
| 206 |
+
Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. ICLR, 2014.
|
| 207 |
+
|
| 208 |
+
Shupeng Gui, Haotao Wang, Haichuan Yang, Chen Yu, Zhangyang Wang, and Ji Liu. Model compression with adversarial robustness: A unified optimization framework. Advances in Neural Information Processing Systems, 32, 2019.
|
| 209 |
+
|
| 210 |
+
Chuan Guo, Geoff Pleiss, Yu Sun, and Kilian Q Weinberger. On calibration of modern neural networks. In International Conference on Machine Learning, pp. 1321–1330. PMLR, 2017.
|
| 211 |
+
|
| 212 |
+
Yiwen Guo, Chao Zhang, Changshui Zhang, and Yurong Chen. Sparse dnns with improved adversarial robustness. 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/ 4c5bde74a8f110656874902f07378009-Paper.pdf.
|
| 213 |
+
|
| 214 |
+
Song Han, Huizi Mao, and William J Dally. Deep compression: Compressing deep neural networks with pruning, trained quantization and huffman coding. International Conference on Learning Representations, 2015.
|
| 215 |
+
|
| 216 |
+
Babak Hassibi and David G Stork. Second order derivatives for network pruning: Optimal brain surgeon. Morgan Kaufmann, 1993.
|
| 217 |
+
|
| 218 |
+
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.
|
| 219 |
+
|
| 220 |
+
Yihui He, Xiangyu Zhang, and Jian Sun. Channel pruning for accelerating very deep neural networks. In Proceedings of the IEEE international conference on computer vision, pp. 1389–1397, 2017.
|
| 221 |
+
|
| 222 |
+
Matthias Hein, Maksym Andriushchenko, and Julian Bitterwolf. Why relu networks yield highconfidence predictions far away from the training data and how to mitigate the problem. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 41–50, 2019.
|
| 223 |
+
|
| 224 |
+
Dan Hendrycks and Thomas Dietterich. Benchmarking neural network robustness to common corruptions and perturbations. International Conference on Learning Representations, 2019.
|
| 225 |
+
|
| 226 |
+
Dan Hendrycks, Steven Basart, Norman Mu, Saurav Kadavath, Frank Wang, Evan Dorundo, Rahul Desai, Tyler Zhu, Samyak Parajuli, Mike Guo, et al. The many faces of robustness: A critical analysis of out-of-distribution generalization. arXiv preprint arXiv:2006.16241, ICCV., 2021.
|
| 227 |
+
|
| 228 |
+
Ting-Kuei Hu, Tianlong Chen, Haotao Wang, and Zhangyang Wang. Triple wins: Boosting accuracy, robustness and efficiency together by enabling input-adaptive inference. arXiv preprint arXiv:2002.10025, 2020.
|
| 229 |
+
|
| 230 |
+
Steven A Janowsky. Pruning versus clipping in neural networks. Physical Review A, 39(12):6600, 1989.
|
| 231 |
+
|
| 232 |
+
Siddhant Jayakumar, Razvan Pascanu, Jack Rae, Simon Osindero, and Erich Elsen. Top-kast: Top-k always sparse training. Advances in Neural Information Processing Systems, 33, 2020.
|
| 233 |
+
|
| 234 |
+
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.
|
| 235 |
+
|
| 236 |
+
Jeremy Kepner and Ryan Robinett. Radix-net: Structured sparse matrices for deep neural networks. In 2019 IEEE International Parallel and Distributed Processing Symposium Workshops (IPDPSW), pp. 268–274. IEEE, 2019.
|
| 237 |
+
|
| 238 |
+
Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009.
|
| 239 |
+
|
| 240 |
+
Aditya Kusupati, Vivek Ramanujan, Raghav Somani, Mitchell Wortsman, Prateek Jain, Sham Kakade, and Ali Farhadi. Soft threshold weight reparameterization for learnable sparsity. In International Conference on Machine Learning, pp. 5544–5555. PMLR, 2020.
|
| 241 |
+
|
| 242 |
+
Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. Simple and scalable predictive uncertainty estimation using deep ensembles. arXiv preprint arXiv:1612.01474, 2016.
|
| 243 |
+
|
| 244 |
+
Yann LeCun, John S Denker, and Sara A Solla. Optimal brain damage. In Advances in neural information processing systems, pp. 598–605, 1990.
|
| 245 |
+
|
| 246 |
+
Jaeho Lee, Sejun Park, Sangwoo Mo, Sungsoo Ahn, and Jinwoo Shin. Layer-adaptive sparsity for the magnitude-based pruning. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id $=$ H6ATjJ0TKdf.
|
| 247 |
+
|
| 248 |
+
Namhoon Lee, Thalaiyasingam Ajanthan, and Philip Torr. SNIP: SINGLE-SHOT NETWORK PRUNING BASED ON CONNECTION SENSITIVITY. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $\equiv$ B1VZqjAcYX.
|
| 249 |
+
|
| 250 |
+
Shiwei Liu, Decebal Constantin Mocanu, Amarsagar Reddy Ramapuram Matavalam, Yulong Pei, and Mykola Pechenizkiy. Sparse evolutionary deep learning with over one million artificial neurons on commodity hardware. Neural Computing and Applications, 2020a.
|
| 251 |
+
|
| 252 |
+
Shiwei Liu, TT van der Lee, Anil Yaman, Zahra Atashgahi, D Ferrar, Ghada Sokar, Mykola Pechenizkiy, and DC Mocanu. Topological insights into sparse neural networks. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, ECMLPKDD, 2020b.
|
| 253 |
+
|
| 254 |
+
Shiwei Liu, Tianlong Chen, Xiaohan Chen, Zahra Atashgahi, Lu Yin, Huanyu Kou, Li Shen, Mykola Pechenizkiy, Zhangyang Wang, and Decebal Constantin Mocanu. Sparse training via boosting pruning plasticity with neuroregeneration. Advances in Neural Information Processing Systems (NeurIPs)., 2021a.
|
| 255 |
+
|
| 256 |
+
Shiwei Liu, Lu Yin, Decebal Constantin Mocanu, and Mykola Pechenizkiy. Do we actually need dense over-parameterization? in-time over-parameterization in sparse training. In Proceedings of the 39th International Conference on Machine Learning, pp. 6989–7000. PMLR, 2021b.
|
| 257 |
+
|
| 258 |
+
Tianlin Liu and Friedemann Zenke. Finding trainable sparse networks through neural tangent transfer. In International Conference on Machine Learning, pp. 6336–6347. PMLR, 2020.
|
| 259 |
+
|
| 260 |
+
Christos Louizos, Max Welling, and Diederik P Kingma. Learning sparse neural networks through l 0 regularization. International Conference on Learning Representations, 2018.
|
| 261 |
+
|
| 262 |
+
Zelda Mariet and Suvrit Sra. Diversity networks: Neural network compression using determinantal point processes. In International Conference on Learning Representations, 2016.
|
| 263 |
+
|
| 264 |
+
Alexander Meinke and Matthias Hein. Towards neural networks that provably know when they don’t know. In International Conference on Learning Representations, 2020. URL https: //openreview.net/forum?id $\equiv$ ByxGkySKwH.
|
| 265 |
+
|
| 266 |
+
Decebal Constantin Mocanu, Elena Mocanu, Phuong H. Nguyen, Madeleine Gibescu, and Antonio Liotta. A topological insight into restricted boltzmann machines. Machine Learning, 104(2): 243–270, Sep 2016. ISSN 1573-0565. doi: 10.1007/s10994-016-5570-z. URL https://doi. org/10.1007/s10994-016-5570-z.
|
| 267 |
+
|
| 268 |
+
Decebal Constantin Mocanu, Elena Mocanu, Peter Stone, Phuong H Nguyen, Madeleine Gibescu, and Antonio Liotta. Scalable training of artificial neural networks with adaptive sparse connectivity inspired by network science. Nature communications, 9(1):2383, 2018.
|
| 269 |
+
|
| 270 |
+
Pavlo Molchanov, Stephen Tyree, Tero Karras, Timo Aila, and Jan Kautz. Pruning convolutional neural networks for resource efficient inference. International Conference on Learning Representations, 2016.
|
| 271 |
+
|
| 272 |
+
Hesham Mostafa and Xin Wang. Parameter efficient training of deep convolutional neural networks by dynamic sparse reparameterization. In International Conference on Machine Learning, pp. 4646–4655. PMLR, 2019.
|
| 273 |
+
|
| 274 |
+
Michael C Mozer and Paul Smolensky. Using relevance to reduce network size automatically. Connection Science, 1(1):3–16, 1989.
|
| 275 |
+
|
| 276 |
+
Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y. Ng. Reading digits in natural images with unsupervised feature learning. In NIPS Workshop on Deep Learning and Unsupervised Feature Learning 2011, 2011. URL http://ufldl.stanford.edu/ housenumbers/nips2011_housenumbers.pdf.
|
| 277 |
+
|
| 278 |
+
Behnam Neyshabur, Zhiyuan Li, Srinadh Bhojanapalli, Yann LeCun, and Nathan Srebro. The role of over-parametrization in generalization of neural networks. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $\equiv$ BygfghAcYX.
|
| 279 |
+
|
| 280 |
+
Roman Novak, Yasaman Bahri, Daniel A. Abolafia, Jeffrey Pennington, and Jascha Sohl-Dickstein. Sensitivity and generalization in neural networks: an empirical study. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id= HJC2SzZCW.
|
| 281 |
+
|
| 282 |
+
Nicolas Papernot, Patrick McDaniel, Somesh Jha, Matt Fredrikson, Z Berkay Celik, and Ananthram Swami. The limitations of deep learning in adversarial settings. In 2016 IEEE European symposium on security and privacy (EuroS&P), pp. 372–387. IEEE, 2016.
|
| 283 |
+
|
| 284 |
+
Ameya Prabhu, Girish Varma, and Anoop Namboodiri. Deep expander networks: Efficient deep networks from graph theory. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 20–35, 2018.
|
| 285 |
+
|
| 286 |
+
Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21(140):1–67, 2020. URL http://jmlr.org/papers/v21/20-074.html.
|
| 287 |
+
|
| 288 |
+
Alex Renda, Jonathan Frankle, and Michael Carbin. Comparing rewinding and fine-tuning in neural network pruning. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ S1gSj0NKvB.
|
| 289 |
+
|
| 290 |
+
Victor Sanh, Thomas Wolf, and Alexander Rush. Movement pruning: Adaptive sparsity by fine-tuning. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 20378–20389. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper/2020/file/ eae15aabaa768ae4a5993a8a4f4fa6e4-Paper.pdf.
|
| 291 |
+
|
| 292 |
+
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556. ICLR., 2014.
|
| 293 |
+
|
| 294 |
+
Jingtong Su, Yihang Chen, Tianle Cai, Tianhao Wu, Ruiqi Gao, Liwei Wang, and Jason D Lee. Sanity-checking pruning methods: Random tickets can win the jackpot. Advances in Neural Information Processing Systems. arXiv:2009.11094, 2020.
|
| 295 |
+
|
| 296 |
+
Xavier Suau, Luca Zappella, and Nicholas Apostoloff. NETWORK COMPRESSION USING CORRELATION ANALYSIS OF LAYER RESPONSES, 2019. URL https://openreview. net/forum?id ${ . } = { }$ rkl42iA5t7.
|
| 297 |
+
|
| 298 |
+
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.
|
| 299 |
+
|
| 300 |
+
Hidenori Tanaka, Daniel Kunin, Daniel LK Yamins, and Surya Ganguli. Pruning neural networks without any data by iteratively conserving synaptic flow. Advances in Neural Information Processing Systems. arXiv:2006.05467, 2020.
|
| 301 |
+
|
| 302 |
+
Kale-ab Tessera, Sara Hooker, and Benjamin Rosman. Keep the gradients flowing: Using gradient flow to study sparse network optimization. arXiv preprint arXiv:2102.01670, 2021.
|
| 303 |
+
|
| 304 |
+
Dimitris Tsipras, Shibani Santurkar, Logan Engstrom, Alexander Turner, and Aleksander Madry. Robustness may be at odds with accuracy. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id=SyxAb30cY7.
|
| 305 |
+
|
| 306 |
+
Stijn Verdenius, Maarten Stol, and Patrick Forre. Pruning via iterative ranking of sensitivity statistics. ´ arXiv preprint arXiv:2006.00896, 2020.
|
| 307 |
+
|
| 308 |
+
Chaoqi Wang, Guodong Zhang, and Roger Grosse. Picking winning tickets before training by preserving gradient flow. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id ${ \underline { { \underline { { \mathbf { \Pi } } } } } } =$ SkgsACVKPH.
|
| 309 |
+
|
| 310 |
+
Cihang Xie and Alan Yuille. Intriguing properties of adversarial training at scale. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum? id $=$ HyxJhCEFDS.
|
| 311 |
+
|
| 312 |
+
Shaokai Ye, Kaidi Xu, Sijia Liu, Hao Cheng, Jan-Henrik Lambrechts, Huan Zhang, Aojun Zhou, Kaisheng Ma, Yanzhi Wang, and Xue Lin. Adversarial robustness vs. model compression, or both? In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 111–120, 2019.
|
| 313 |
+
|
| 314 |
+
Haoran You, Chaojian Li, Pengfei Xu, Yonggan Fu, Yue Wang, Xiaohan Chen, Zhangyang Wang, Richard G Baraniuk, and Yingyan Lin. Drawing early-bird tickets: Towards more efficient training of deep networks. In International Conference on Learning Representations 2020 (ICLR 2020), 2020.
|
| 315 |
+
|
| 316 |
+
Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. In Edwin R. Hancock Richard C. Wilson and William A. P. Smith (eds.), Proceedings of the British Machine Vision Conference (BMVC), pp. 87.1–87.12. BMVA Press, September 2016. ISBN 1-901725-59-6. doi: 10.5244/C. 30.87. URL https://dx.doi.org/10.5244/C.30.87.
|
| 317 |
+
|
| 318 |
+
Hongyang Zhang, Yaodong Yu, Jiantao Jiao, Eric Xing, Laurent El Ghaoui, and Michael Jordan. Theoretically principled trade-off between robustness and accuracy. In International Conference on Machine Learning, pp. 7472–7482. PMLR, 2019.
|
| 319 |
+
|
| 320 |
+
Zhengli Zhao, Dheeru Dua, and Sameer Singh. Generating natural adversarial examples. In International Conference on Learning Representations, 2018. URL https://openreview. net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } = \underline { { \underline { { \mathbf { \delta \pi } } } } } ,$ H1BLjgZCb.
|
| 321 |
+
|
| 322 |
+
Michael Zhu and Suyog Gupta. To prune, or not to prune: exploring the efficacy of pruning for model compression. arXiv preprint arXiv:1710.01878, 2017.
|
| 323 |
+
|
| 324 |
+
# A MEASUREMENTS AND METRICS
|
| 325 |
+
|
| 326 |
+
Formally, let’s denote a (sparse) network $f : \mathcal { X } \mathcal { Y }$ trained on samples from distribution $\mathcal { D }$ . $f ( x , \theta )$ and $f ( \dot { x } , \dot { \theta } \odot m )$ refers to the dense network and the pruned network, respectively. The test accuracy of the pruned subnetworks is typically reported as their accuracy on test queries drawn from $\mathcal { D }$ , i.e., $\mathbb { P } _ { ( x , y ) \sim \mathcal { D } } ( f ( x , \theta \odot m ) = y )$ . In addition to the test accuracy, we also evaluate random pruning from the perspective of adversarial robustness (Goodfellow et al., 2014), OoD performance (Hendrycks et al., 2021), and uncertainty estimation (Lakshminarayanan et al., 2016).
|
| 327 |
+
|
| 328 |
+
Adversarial Robustness. Despite of the remarkable ability solving classification problems, the predictions of deep neural networks can often be fooled by small adversarial perturbations (Szegedy et al., 2013; Papernot et al., 2016). Prior works have shown the possibility of finding the sweet point of sparsity and adversarial robustness (Guo et al., 2018; Ye et al., 2019; Gui et al., 2019; Hu et al., 2020). As the arguably most naive method of inducing sparsity, we are also interested in if training a randomly pruned subnetwork can improve the adversarial robustness of deep networks. We follow the classical method proposed in Goodfellow et al. (2014) and generate adversarial examples with Fast Gradient Sign Method (FGSM). Specifically, input data is perturbed with sign $( \nabla _ { x } \bar { \mathcal { L } } ( \theta , x , y ) )$ , where $\epsilon$ refers to the perturbation strength, which is chosen as $\frac { \dot { 8 } } { 2 5 5 }$ in our paper.
|
| 329 |
+
|
| 330 |
+
Out-of-distribution performance. The investigation of out-of-distribution (OoD) generalization is of importance for machine learning in both academic and industry fields. Since the i.i.d. assumption can hardly be satisfied, especially those high-risk scenarios such as healthcare, and military. We evaluate whether random pruning brings benefits to OoD. Following the classic routines (Augustin et al., 2020; Meinke & Hein, 2020), SVHN (Netzer et al., 2011), CIFAR-100, and CIFAR-10 with random Gaussian noise (Hein et al., 2019) are adopted for models trained on CIFAR-10; ImageNet-O as the OoD dataset for models trained on ImageNet.
|
| 331 |
+
|
| 332 |
+
Uncertainty estimation. In the security-critical scenarios, e.g., self-driving, the classifiers not only must be accurate but also should indicate when they are likely to be incorrect (Guo et al., 2017). To test effects of the induced sparsity on uncertainty estimation, we choose two widely-used metrics, expected calibration error (ECE) (Guo et al., 2017) and negative log likelihood (NLL) (Friedman et al., 2001).
|
| 333 |
+
|
| 334 |
+

|
| 335 |
+
B PREDICTIVE ACCURACY OF RESNET WITH VARYING WIDTH
|
| 336 |
+
Figure 7: Test accuracy of training randomly pruned ResNet-20, ResNet-32, and ResNet-44 from scratch with ERK ratios when model width varies on CIFAR-10.
|
| 337 |
+
|
| 338 |
+
# C PREDICTIVE ACCURACY OF RESNET ON CIFAR-10 INCLUDING GRASP
|
| 339 |
+
|
| 340 |
+
To avoid multiple lines overlap with each other, we report the results of GraSP ratio on CIFAR-10 separately in this Appendix. It is surprising to find that random pruning with GraSP ratio (red lines) consistently have lower accuracy than ERK and SNIP, except for extremely high sparsites, i.e., 0.8 and 0.9.
|
| 341 |
+
|
| 342 |
+

|
| 343 |
+
Figure 8: From shallow to deep. Test accuracy of training randomly pruned subnetworks from scratch with different depth on CIFAR-10. ResNet-A refers to a ResNet model with A layers in total.
|
| 344 |
+
|
| 345 |
+

|
| 346 |
+
Figure 9: From narrow to wide. Test accuracy of training randomly pruned subnetworks from scratch with different width on CIFAR-10. ResNet-A-B refers to a ResNet model with A layers in total and B filters in the first convolutional layer.
|
| 347 |
+
|
| 348 |
+

|
| 349 |
+
|
| 350 |
+

|
| 351 |
+
Figure 10: From shallow to deep. Test accuracy of training randomly pruned subnetworks from scratch with different depth on CIFAR-100. ResNet-A refers to a ResNet model with A layers in total.
|
| 352 |
+
Figure 11: From narrow to wide. Test accuracy of training randomly pruned subnetworks from scratch with different width on CIFAR-100. ResNet-A-B refers to a ResNet model with A layers in total and B filters in the first convolutional layer.
|
| 353 |
+
|
| 354 |
+

|
| 355 |
+
E PREDICTIVE ACCURACY OF VGG ON CIFAR-10/100
|
| 356 |
+
|
| 357 |
+

|
| 358 |
+
Figure 12: From shallow to deep. Test accuracy of training randomly pruned VGGs from scratch with different depth on CIFAR-10.
|
| 359 |
+
Figure 13: From shallow to deep. Test accuracy of training randomly pruned VGGs from scratch with different depth on CIFAR-100.
|
| 360 |
+
|
| 361 |
+
# F COMPARING RANDOM PRUNING WITH ITS DENSE EQUIVALENTS WITH VARIOUS RATIOS.
|
| 362 |
+
|
| 363 |
+

|
| 364 |
+
Figure 14: Test accuracy of Wide ResNet-50 on ImageNet. Left: Performance of ERK with various sparsity of the last fully-connected layer. We vary the sparsity of the last fully-connected layer while keeping the overall sparsity fixed as $70 \%$ . Results of the original ERK are indicated with dashed red lines. Right: Performance comparison between randomly pruned Wide ResNet-50 and the corresponding dense equivalents with a similar parameter count.
|
| 365 |
+
|
| 366 |
+
$\mathbf { E R } \mathbf { K } +$ . We demonstrate the performance improvement caused by $\mathrm { E R K + }$ on ImageNet. As mentioned earlier, ERK naturally allocates higher sparsities to the larger layers while allocating lower sparsities to the smaller ones. As a consequence, the last fully-connected layer is very likely to be dense for the datasets with only a few classes, e.g., CIFAR-10. However, for the datasets with a larger number of classes, e.g., ImageNet, the fully-connected layer is usually sparse. We empirically find that allocating more parameters to the last fully-connected layer while keeping the overall parameter count fixed leads to higher accuracy for ERK with Wide ResNet-50 on ImageNet.
|
| 367 |
+
|
| 368 |
+
We vary the last layer’s sparsity of ERK while maintaining the overall sparsity fixed and report the test accuracy achieved by the corresponding sparse Wide ResNet-50 on ImageNet in Figure 14-left. We can observe that the test accuracy consistently increases as the last layer’s sparsity decreases from 0.8 to 0. Consequently, we keep the last fully-connected layer of ERK dense for ImageNet and term this modified variant as $\mathrm { E R K + }$ .
|
| 369 |
+
|
| 370 |
+
Compare random pruning with its dense equivalents. To draw a more solid conclusion, we train large, randomly pruned Wide ResNet-50 on ImageNet and compare it to the dense equivalents with the same number of parameters on ImageNet. As shown in Figure14-right, all randomly pruned networks outperform the dense ResNet-34 with the same number of parameters. $\mathrm { E R K + }$ consistently achieves higher accuracy than ERK, even closely approaching the strong baseline – dense ResNet-50. More interestingly, the layer-wise sparsities discovered by SNIP boost the accuracy of sparse Wide ResNet-50 over dense ResNet-50, highlighting the importance of layer-wise sparsity ratios on sparse training . Given the fact that the performance gap between SNIP ratio and ERK on CIFAR-10 is somehow vague, our results highlight the necessity of evaluating any proposed pruning methods with large-scale models and datasets, e.g., ResNet-50 on ImageNet.
|
| 371 |
+
|
| 372 |
+
# G BROADER EVALUATION OF RANDOM PRUNING ON CIFAR-10
|
| 373 |
+
|
| 374 |
+
# G.1 OUT-OF-DISTRIBUTION PERFORMANCE (ROC-AUC) .
|
| 375 |
+
|
| 376 |
+

|
| 377 |
+
Figure 15: Out-of-distribution performance (ROC-AUC). The experiments are conducted with various models trained on CIFAR-10, tested on SVHN. Higher ROC-AUC refers to better OoD performance.
|
| 378 |
+
|
| 379 |
+

|
| 380 |
+
Figure 16: Uncertainty estimation (NLL). The experiments are conducted with various models on CIFAR-10. Lower NLL values represent better uncertainty estimation.
|
| 381 |
+
|
| 382 |
+

|
| 383 |
+
G.3 ADVERSARIAL ROBUSTNESS
|
| 384 |
+
Figure 17: Adversarial robustness. The experiments are conducted with various models on CIFAR10. Higher values represent better adversarial robustness.
|
md/dev/VNdFPD5wqjh/VNdFPD5wqjh.md
ADDED
|
@@ -0,0 +1,323 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GENERALIZABLE PERSON RE-IDENTIFICATION WITH-OUT DEMOGRAPHICS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Generalizable Person Re-Identification (DG ReID) aims to learn ready-to-use crossdomain representations for direct cross-data evaluation. It typically fully exploit demographics information, e.g., the domain information and camera IDs to learn features that are domain-invariant. However, the protected demographic features are not often accessible due to privacy and regulation issues. Under this more realistic setting, distributionally robust optimization (DRO) provides a promising way for learning robust models that are able to perform well on a collection of possible data distributions (the “uncertainty set”) without demographics. However, the convex condition of KL DRO may not hold for overparameterized neural networks and applying KL DRO fails to generalize under distribution shifts in real scenarios. Instead, by applying the change-of-measure technique and the analytical solution of KL DRO, we propose a simple yet efficient approach, Unit DRO. Unit DRO minimizes the loss over a reweighted dataset where important samples (i.e., samples on which models perform poorly) will be upweighted and others will be downweighted. Empirical results show that Unit DRO achieves superior performance on large-scale DG ReID and cross-domain ReID benchmarks compared to standard baselines.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Person Re-IDentification (ReID) aims at matching person images of the same identity across multiple camera views. In previous work, ReID models mainly follow three settings: (i) As shown in Figure 1a, most ReID models are trained and tested on i.i.d datasets, termed fully-supervised methods (Zhang et al., 2020). Although recent fully-supervised methods have achieved remarkable performance, they are non-robust when tested in out-of-distribution (OOD) settings. (ii) Figure 1b illustrates the settings of unsupervised domain adaptation (UDA) methods and cross-domain (CD) person ReID methods (Luo et al., 2020). However, UDA ReID relies on large amounts of unlabeled data for retraining and CD ReID cannot exploit the benefits brought by multi source domains. These problems severely hinder real-world applications of current person ReID techniques. Recently, (iii) generalizable person ReID methods (DG) (Dai et al., 2021a) are proposed (Figure 1c) in a more realistic setting, where the model is trained on multiple large-scale datasets. The trained model is tested on unseen domains directly without any data collection, annotation, and model updating.
|
| 12 |
+
|
| 13 |
+
However, generalizable person ReID methods come at a serious disadvantage: they require demographics (e.g., domain labels (Choi et al., 2021; Zhao et al., 2021), camera ID (Zhang et al., 2021a; Dai et al., 2021a) and video timestamps (Yuan et al., 2020)) as extra supervision. Such demographics implicitly define variations in training data that the learned models should be invariant or robust to1. However, such demographics usually are not available to use for the following reasons: (i) The collection of demographics inevitably creates privacy risks (Veale & Binns, 2017), e.g., exposing the geographical location and environment information. ReID is often used for high-privacy tasks such as security, on which the privacy disclosure is unacceptable. (ii) domain labels collection are expensive and ethically fraught endeavours (Michel et al., 2021), and (iii) manually collected domain labels may be noisy or suboptimal (Creager et al., 2021) and such coarsed grained labels may exacerbate hidden stratification, which hinders safe-critical applications (Oakden-Rayner et al., 2020). We aim to overcome the difficulty of manual demographics collection by developing a new setting without the need for demographics. Figure 1d depicts the Domain Generalizable Person Re-identification Without Demographics (DGWD) setting, where models are also trained on multiple large-scale datasets while the demographics are unavailable.
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
Figure 1: Universal person ReID settings. (a) Supervised person ReID. (b) CD ReID and UDA ReID. (c)DG ReID. (d) Illustration of our setting for generalizable person ReID without demographics.
|
| 17 |
+
|
| 18 |
+
DRO is a promising paradigm to tackle the problem above by explicitly obtaining prediction functions robust to distribution shifts (Hu et al., 2018). Specifically, DRO considers a minimax game: the inner optimization objective is to shift the training distribution within a pre-specified uncertainty set so as to maximize the expected loss on the test distribution. The outer optimization minimizes the adversarial expected loss (see Section 3.1 for details). DRO with $f$ -divergences has been well studied, which defines the uncertainty set by an $f$ -divergence ball from the training distribution Hu & Hong (2013). However, the convex assumption usually does not hold in real scenarios, which leads to inferior performance in the context of overparameterized neural networks.
|
| 19 |
+
|
| 20 |
+
In this paper, we first solve the inner step optimization problem and obtain a closed-form expression of the optimal objective. Different from previous work that converts the minimax DRO problem into a single minimization problem by the closed-form expression (Hu & Hong, 2013), we implement a change-of-measure technique and reformulate the minimax optimization as an importance sampling problem, termed Unit $ { \mathbf { D } } { \mathbf { R } } \bar { \mathbf { O } } ^ { 2 }$ . Unit DRO avoids the troublesome bi-level optimization in traditional DRO problems and scales well to over-parameterized regimes. Specifically, Unit DRO upweights samples which are prone to be misclassified and downweigts others. It assigns a normalized weight $e ^ { \ell / \tau ^ { \ast } } / \mathbb { E } [ e ^ { \ell / \tau ^ { \ast } } ]$ to each data and label pair $( x , y )$ , where $\ell$ is the error incurred by $( x , y )$ and $\tau ^ { * }$ is a hyperparameter. There are two main challenges here, (i) The optimization parameter $\tau ^ { * }$ is hard to determine and we observe that a constant $\tau ^ { * }$ always achieves inferior performance; (ii) The normalization factor $\mathbb { E } [ e ^ { \ell / \tau ^ { * } } ]$ requires taking an expectation over the training distribution. To tackle the first problem, we propose step $\tau ^ { * }$ to determine the value of $\tau ^ { * }$ by the training step. We then maintain a weights queue which stores historical sample weights to better estimate $\mathbb { E } [ e ^ { \ell / \tau ^ { * } } ]$ over the training distribution. Compared to DG ReID methods, the implementation of Unit DRO is simple yet effective, avoiding the need for meta-learning pipelines or complicated model structure engineering.
|
| 21 |
+
|
| 22 |
+
We empirically evaluate and analyze the proposed implementation. First, we compare Unit DRO with both CD and DG methods. Unit DRO achieves improved performance by a large margin on DG and CD benchmarks even compared to these methods that rely on demographics. Second, we take comprehensive ablation studies of the step $\tau ^ { * }$ and the weights queue, providing justification for these two blocks. Finally, we visualize the learned weight distributions, $t$ -SNE embeddings, and measure the domain divergence and error set to show the invariant learning capability of Unit DRO. Empirical results show that Unit DRO can retrieve valuable samples or subgroups without demographics.
|
| 23 |
+
|
| 24 |
+
# 2 RELATED WORK
|
| 25 |
+
|
| 26 |
+
Domain generalization. Domain/Out-of-distribution generalization (Muandet et al., 2013) aims to learn a model that can extrapolate well in unseen environments. Representative methods like Invariant
|
| 27 |
+
|
| 28 |
+
Risk Minimization (IRM) (Arjovsky et al., 2020) and its variant (Ahuja et al., 2020) are recently proposed to tackle this challenge. IRM center on the objective of extracting data representations that lead to invariant prediction across environments under a multi-environment setting. The main difference here is that we propose to learn invariant representations without demographics.
|
| 29 |
+
|
| 30 |
+
Generalizable Person ReID. Generalizable person ReID methods (Song et al., 2019; Choi et al., 2021) are recently proposed to learn invariant representations that can generalize to unseen domains. Existing methods mainly utilize domain divergence minimization strategies or a meta-learning pipeline. DualNorm(Jia et al., 2019) integrate the Instance Normalization (IN) into the network to filter out style factors, boosting generalization capability. Other works aim to learn domain-invariant features, e.g., (Chen et al., 2021) and (Zhang et al., 2021a). However, neither meta learning-based methods nor domain divergence minimization strategies work properly without demographics.
|
| 31 |
+
|
| 32 |
+
Fairness without demographics. Methods in Fairness (Dwork et al., 2012) aim to develop a model that performs well for worst-case group assignments according to some fairness criteria for addressing the underperformance in minority subgroups. Although there are some works consider fariness without demographics (Liu et al., 2021; Creager et al., 2021), they mostly evaluate their algorithms in datasets with predefined distribution shifts. Note that DGWD-ReID problem is more challenging than the category-level recognition problem considered in the existing fariness w or w/o demographics study. In DGWD-ReID, the target identities are different from source ones and we need to tackle both domain gap and disjoint label space problems at the same time.
|
| 33 |
+
|
| 34 |
+
# 3 METHODOLOGIES
|
| 35 |
+
|
| 36 |
+
Notations and Problem Formulation. Consider current DG setting, where we have access to one labeled dataset which consists of several distinct training3 distributions (domains): $\mathcal { P } = \left\{ P _ { k } \right\} _ { k = 1 } ^ { | \mathcal { P } | } =$ $\{ \{ x _ { i } , y _ { i } \} \} _ { i = 1 } ^ { | P _ { k } | } \} _ { k = 1 } ^ { | \mathcal { P } | }$ , where $| \mathcal { P } |$ is the number of domains, $| P _ { k } |$ is the number of images in domain $P _ { k }$ , $x _ { i } \in \mathcal { X } , y _ { i } \in \mathcal { Y }$ is the image and the corresponding label. In the training phase, we train a DG model using all the aggregated image-label pairs. In the testing phase, we perform a retrieval task on the unseen target domain $G$ without additional model updates. Our goal is to learn a model $f _ { \theta } : \mathcal { X } \mathcal { Y }$ , parameterized by $\theta \in \Theta$ , that minimizes the error in $G$ :
|
| 37 |
+
|
| 38 |
+
$$
|
| 39 |
+
\operatorname* { m i n } _ { \theta \in \Theta } \mathbb { E } _ { ( x , y ) \in G } \left[ \ell ( x , y ; \theta ) \right] .
|
| 40 |
+
$$
|
| 41 |
+
|
| 42 |
+
This objective encodes the goal of learning a model that does not depend on spurious correlations (e.g., domain-specific information). If a model makes decisions according to domain-specific information, it is natural to be brittle in an entirely distinct domain. Previous studies mostly leverage demographics (e.g., domain IDs, camera IDs, video timestamps) to clip the spurious correlations. In this paper, we consider a novel setting where all of these demographics are not known during training, which makes empirical sense that annotating demographics is expensive and likely to expose private information.
|
| 43 |
+
|
| 44 |
+
Baseline Algorithms. Here we describe the learning objectives used in the baseline model. The first is the cross-entropy loss $\mathcal { L } _ { c e }$ , which seeks to minimize the average ID-classification loss over all the training samples. Given $n$ training points $\left\{ \left( x _ { 1 } , y _ { 1 } \right) , . . . , \left( x _ { n } , y _ { n } \right) \right\}$ , $\mathcal { L } _ { c e }$ is defined as follows:
|
| 45 |
+
|
| 46 |
+
$$
|
| 47 |
+
\mathcal { L } _ { c e } = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \ell ( x _ { i } , y _ { i } ; \theta )
|
| 48 |
+
$$
|
| 49 |
+
|
| 50 |
+
The label-smoothing method is applied to prevent our model from overfitting to the training IDs.
|
| 51 |
+
|
| 52 |
+
Besides, following most of ReID methods, we introduce triplet loss to enhance the intra-class compactness and inter-class separability in the Euclidean space. Following (Hermans et al., 2017), given Euclidean distance $d ( \cdot , \cdot )$ and an anchor sample $\boldsymbol { x } _ { i } ^ { a }$ , we select the hardest positive sample $x _ { i } ^ { p }$ and the hardest negative sample $\boldsymbol { x } _ { i } ^ { n }$ within a mini-batch. The triplet loss then can be defined as:
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
\mathcal { L } _ { t r } ( x _ { i } ^ { a } ) = \operatorname* { m a x } \left\{ d ( f _ { \theta } ( x _ { i } ^ { a } ) , f _ { \theta } ( x _ { i } ^ { p } ) - d ( f _ { \theta } ( x _ { i } ^ { a } ) , f _ { \theta } ( x _ { i } ^ { n } ) ) + m , 0 \right\} ,
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
where $m$ is the margin parameter. The BNNeck structure (Luo et al., 2019) is used to maximize the synergy between $\mathcal { L } _ { c e }$ and $\mathcal { L } _ { t r }$ . Meanwhile, we integrate the mixture of Batch Normalization and Instance Normalization with learnable parameters (Choi et al., 2021) in the baseline, which has proved very useful for the DG problem.
|
| 59 |
+
|
| 60 |
+
# 3.1 UNIT DRO
|
| 61 |
+
|
| 62 |
+
We now propose Unit DRO, a novel generalization framework that does not require priors about demographics. We begin from an effective algorithmic framework: distributionally robust optimization (DRO) (Ben-Tal et al., 2009; Rahimian $\&$ Mehrotra, 2019). In DRO, we use the worst-case expected risk over a predefined family of distributions $\mathcal { Q }$ (termed uncertainty set) to replace the expected risk under an unseen target distribution $G$ in equation 1. Hence, the target is as follows,
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
\operatorname* { m i n } _ { \theta \in \Theta } \operatorname* { m a x } _ { q \in \mathcal { Q } } \mathbb { E } _ { ( x , y ) \in q } [ \ell ( x , y ; \theta ) ] .
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
The uncertainty set $\mathcal { Q }$ encodes the possible test distributions that we want our model to perform well on. If $\mathcal { Q }$ contains $G$ , the DRO object can upper bound the expected risk under $G$ . An important question about DRO modeling is how to choose the uncertainty set (see Appendix.A for details). Note that in many practical situations, we can obtain only the empirical (training) data distribution. Then, a reasonable approach is to construct the uncertainty set by requiring the distribution within a certain distance from the training distribution. Previous work chooses a KL-divergence ball (Hu & Hong, 2013)/MMD ball (Sinha et al., 2017) around the training distribution, which confers robustness to a wide set of distributional shifts. However, it can also lead to overly pessimistic models which optimize for implausible worst-case distributions (Duchi et al., 2019). In other words, $\mathcal { Q }$ should be sufficiently large to contain $G$ , but if it is too large it may contain noisy distributions where no model can perform well (Michel et al., 2021). Group DRO (Sagawa et al., 2019) leverages demographics to define the uncertainty set $\mathcal { Q }$ and attains superior OOD performance. Here we consider a natural extension to improve OOD generalization in the DRO framework without demographics.
|
| 69 |
+
|
| 70 |
+
Construction of the uncertainty set based on the KL-divergence ball. In this paper, we construct $\mathcal { Q }$ as a KL-divergence ball around the empirical distribution $\mathcal { P }$ . Given a KL upper bound (radius) $\eta$ , we can formulate the uncertainty set as $\mathbf { \bar { \mathcal { Q } } } = \{ Q : \mathrm { K L } ( Q | | \mathcal { P } ) \leq \eta \} ^ { 4 }$ . Then the min-max problem in equation 4 can be reformulated as
|
| 71 |
+
|
| 72 |
+
$$
|
| 73 |
+
\operatorname* { m i n } _ { \theta \in \Theta } \operatorname* { m a x } _ { Q : \mathrm { K L } \left( Q \vert \vert \mathcal { P } \right) \leq \eta } \mathbb { E } _ { ( x , y ) \in Q } \left[ \ell ( x , y ; \theta ) \right] .
|
| 74 |
+
$$
|
| 75 |
+
|
| 76 |
+
Lemma 1 (Modified from $H u$ & Hong, 2013), Section 2) Assume the model family $\theta \in \Theta$ and $\mathcal { Q } t o$ be convex and compact. The loss $\ell$ is continuous and convex for all $x \in \mathcal { X } , y \in \mathcal { Y }$ . Suppose empirical distribution $\mathcal { P }$ has density $p ( x , y )$ . Then the inner maximum of equation $5$ has a closed-form solution
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
q ^ { * } ( x , y ) = \frac { p ( x , y ) e ^ { \ell ( x , y ; \theta ) / \tau ^ { * } } } { \mathbb { E } _ { P } \left[ e ^ { \ell ( x , y ; \theta ) / \tau ^ { * } } \right] } ,
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
where $\tau ^ { * }$ satisfies $\begin{array} { r } { \mathbb { E } _ { \mathcal { P } } \left[ \frac { e ^ { \ell ( x , y ; \theta ) / \tau ^ { * } } } { \mathbb { E } _ { \mathcal { P } } [ e ^ { \ell ( x , y ; \theta ) / \tau ^ { * } } ] } \left( \frac { \ell ( x , y ; \theta ) } { \tau ^ { * } } - \log \mathbb { E } _ { \mathcal { P } } [ e ^ { \ell ( x , y ; \theta ) / \tau ^ { * } } ] \right) \right] = \eta } \end{array}$ \`(x,y;θ)τ ∗ − log EP [e\`(x,y;θ)/τ ∗ ]i = η and q∗(x, y) is the optimal density of $Q$ . Then the min-max problem in equation $5$ is equivalent to
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
\operatorname* { m i n } _ { \theta \in \Theta , \tau > 0 } \tau \log \mathbb { E } _ { \mathcal { P } } \left[ e ^ { \ell ( x , y ; \theta ) / \tau } \right] + \eta \tau .
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
Reformulate KL DRO to Unit DRO. We name equation ${ } 7 \ \mathbf { K L }$ DRO. Unfortunately, the convex condition of KL DRO is not held for over-parameterized neural networks, such that applying KL DRO often fails to generalize under distribution shifts in real scenarios. Therefore, we do not follow KL DRO that uses the inner maximum directly. Instead, we reformulate equation 5 as follows.
|
| 89 |
+
|
| 90 |
+
$$
|
| 91 |
+
\begin{array} { r l } & { \underset { \theta \in \Theta } { \operatorname* { m i n } } \underset { Q : \mathrm { \tiny { R L } } ( Q | | P ) \leq \eta } { \operatorname* { m a x } } \mathbb { E } _ { ( x , y ) \in Q } [ \ell ( x , y ; \theta ) ] = \underset { \theta \in \Theta } { \operatorname* { m i n } } \underset { Q : \mathrm { \tiny { R L } } ( Q | | P ) \leq \eta } { \operatorname* { m a x } } \ell ( x , y ; \theta ) q ( x , y ) d _ { x } d _ { y } } \\ & { \quad \quad \quad = \underset { \theta \in \Theta } { \operatorname* { m i n } } \underset { Q : \mathrm { \tiny { R L } } ( Q | | P ) \leq \eta } { \operatorname* { m a x } } \int \ell ( x , y ; \theta ) \frac { q ( x , y ) } { p ( x , y ) } p ( x , y ) d _ { x } d _ { y } } \\ & { \quad \quad \quad = \underset { \theta \in \Theta } { \operatorname* { m i n } } \underset { Q : \mathrm { \tiny { R L } } ( Q | | P ) \leq \eta } { \operatorname* { m a x } } \mathbb { E } _ { ( x , y ) \in P } \left[ \frac { q ( x , y ) } { p ( x , y ) } \ell ( x , y ; \theta ) \right] } \\ & { \quad \quad \quad = \underset { \theta \in \Theta } { \operatorname* { m i n } } \mathbb { E } _ { ( x , y ) \in P } \left[ \frac { e ^ { \ell ( x , y ; \theta ) / \tau ^ { * } } } { \mathbb { E } _ { \mathcal { P } } [ \ell ^ { \ell ( x , y ; \theta ) / \tau ^ { * } } ] } \ell ( x , y ; \theta ) \right] } \end{array}
|
| 92 |
+
$$
|
| 93 |
+
|
| 94 |
+
To get the third lines, we apply the change-of-measure technique. The fourth line replaces the inner maximum by its closed-form solution $q ^ { * } ( x , y )$ in equation 6. Note that both the value of $\tau ^ { * }$ and the normalizer $\mathbb { E } _ { \mathcal { P } } [ e ^ { \ell ( x , y ; \theta ) / \tau ^ { * } } ]$ depend on the expectation of losses over the entire training data, which is untrackable at each optimization step. For simplicity, we can serve $\tau ^ { * }$ as a hyper-parameter and take the average over each mini-batch as a preliminary estimator of the normalizer. We term the resulting formulation Unit DRO v1.
|
| 95 |
+
|
| 96 |
+
$$
|
| 97 |
+
\mathcal { L } _ { \mathrm { U n i t } { \bf D } \mathbf { R } { \bf O } { \bf v } 1 } ( \theta , \tau ^ { * } ) = \operatorname* { m i n } _ { \theta \in \Theta } \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \left( \frac { e ^ { \ell ( x , y ; \theta ) / \tau ^ { * } } } { \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \left( e ^ { \ell ( x , y ; \theta ) / \tau ^ { * } } \right) } \ell ( x , y ; \theta ) \right) ,
|
| 98 |
+
$$
|
| 99 |
+
|
| 100 |
+
where $N$ is the batch size. In practice, Unit DRO v1 does not perform very well. The following problems and solutions are depicted point by point.
|
| 101 |
+
|
| 102 |
+
Step $\tau ^ { * }$ . The first problem is that a constant hyper-parameter $\tau ^ { * }$ is sub-optimal for the learning process. We visualize the densities of the weights $e ^ { \ell ( x , y ; \theta ) / \tau ^ { * } } / \mathbb { E } _ { \mathcal { P } } [ e ^ { \ell ( x , y ; \theta ) / \tau ^ { * } } ]$ over different learning steps with constant $\tau ^ { * }$ values in Figure 2 (The detailed experimental setting is in Section 4.3). A small $\tau ^ { * }$ leads to weights distribution with high variance and is sensitive to outliers. So, models cannot converge to a well optimal point. A large $\tau ^ { * }$ is so conservative that the weights for all samples are almost similar. So, the performance is similar to the baselines. To tackle this problem, we propose step $\tau ^ { * }$ , which declines the value of $\tau ^ { * }$ during training. The intuition behind step $\tau ^ { * }$ is that: at the beginning of the training, the model assigns almost similar losses to all samples and cannot identify which sample is more important or not. For this reason, we can allocate a large $\tau ^ { * }$ which hardly affects the training process. After some steps, we decrease the value of $\tau ^ { * }$ and improve the weights for more important (hard-to-distinguish) samples.
|
| 103 |
+
|
| 104 |
+

|
| 105 |
+
Figure 2: Distribution visualization of sample weights at steps [1000, 5000, 10000, 20000] (from left to right). The horizontal axis represents the weight, and the vertical axis represents the density.
|
| 106 |
+
|
| 107 |
+
Weights queue $\mathcal { M }$ . The second problem is that the expectation over each mini-batch is not a good estimator of the normalizer EP [e\`(x,y;θ)/τ ∗ ]. We preserve a queue M = {wi := e\`(xi,yi;θ)/τ ∗ }|M|i=1 that stores historical weights and serve $| { \mathcal { M } } |$ a hyper-parameter. $| { \mathcal { M } } |$ is an integer multiple of batch size $N$ and determines how well $\mathcal { M }$ can estimate $\mathbb { E } _ { \mathcal { P } } [ e ^ { \ell ( x , y ; \theta ) / \tau ^ { * } } ]$ . The detailed analysis is in Section 4.3.
|
| 108 |
+
|
| 109 |
+
The resulting target combining step $\tau ^ { * }$ and weights queue $\mathcal { M }$ is termed Unit DRO v2.
|
| 110 |
+
|
| 111 |
+
$$
|
| 112 |
+
\mathcal { L } _ { \mathrm { U n i t } \mathrm { D R } \mathbf { O } \mathbf { v } \mathbf { 2 } } ( \theta , \tau ^ { * } ( t ) ) = \operatorname* { m i n } _ { \theta \in \Theta } \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \left( \frac { e ^ { \ell ( x , y ; \theta ) / \tau ^ { * } ( t ) } } { \frac { 1 } { | \mathcal { M } | } \sum _ { w _ { i } \in \mathcal { M } } \left( w _ { i } \right) } \ell ( x , y ; \theta ) \right) ,
|
| 113 |
+
$$
|
| 114 |
+
|
| 115 |
+
where $t$ is the training step and $\tau ^ { * } ( t )$ means $\tau ^ { * }$ is a function of $t$ . Algorithm 1 depicts the online optimization algorithm. Note that in group DRO (Algorithm 1 in (Sagawa et al., 2019)), samples in one domain share the same weight, which is actually a special case of Unit DRO (Algorithm 1 here). One key improvement from previous group DRO to (Sagawa et al., 2019) is the implementation trick that the group weights is updated using exponentiated gradient ascent instead of picking the group with worst average loss at each step. (Sagawa et al., 2019) shows such an improvement is important for stability and obtaining convergence guarantees but cannot explain why it works. In contrast, the weights in this work are interpretable: the optimal distribution of DRO with KL constraint is proportional to the empirical distribution composite with the exponential term e\`(x,y;θ)/τ ∗ .
|
| 116 |
+
|
| 117 |
+
# Algorithm 1: Online optimization algorithm for Unit DRO v2
|
| 118 |
+
|
| 119 |
+
Input: $\underline { { \mathcal { P } } } = \{ P _ { g } \} _ { g = 1 } ^ { | \mathcal { P } | }$ , batch size $N$ , learning rate $\eta$ , SGD hyper-parameters $\beta$ , training iterations $T$
|
| 120 |
+
|
| 121 |
+
$\theta ^ { 0 }$ and $\mathcal { M } ^ { 0 } = \{ 1 \} _ { i = 1 } ^ { | \mathcal { M } | }$
|
| 122 |
+
|
| 123 |
+
for $t = 1 , . . . , T$ do $\begin{array} { r l } & { ( x _ { i } , y _ { i } ) _ { i = 1 } ^ { N } \sim \mathcal { P } } \\ & { \mathcal { L } = \frac { 1 } { N } \sum _ { i = 1 } ^ { N } ( \frac { e ^ { \ell ( x , y , \theta ^ { t - 1 } ) / \tau ^ { * } ( t ) } } { \frac { 1 } { \vert M \vert } \sum _ { w _ { i } \in M } ( w _ { i } ) } \ell ( x , y ; \theta ^ { t - 1 } ) ) / / C a l c u l a t e t h e r e w e i g h t e d l o s s } \\ & { \mathcal { M } ^ { t } = [ \mathcal { M } ^ { t - 1 } [ N : ] , \{ e ^ { \ell ( x _ { i } , y _ { i } ; \theta ^ { t - 1 } ) / \tau ^ { * } ( t ) } \} _ { i = 1 } ^ { N } ] / / U p d a t e w e i g h t s q u e u e b y c u r r e n t w e i g h t s } \\ & { \theta ^ { t } \mathrm { S G D } ( \mathcal { L } , \theta ^ { t - 1 } , \eta , \beta ) } \end{array}$
|
| 124 |
+
end
|
| 125 |
+
|
| 126 |
+
# 4 EXPERIMENTS
|
| 127 |
+
|
| 128 |
+
4.1 EXPERIMENTAL SETTINGS.
|
| 129 |
+
|
| 130 |
+
Here we aim to answer the following questions:
|
| 131 |
+
|
| 132 |
+
• Without demographics, how does Unit DRO perform compared to advanced CD and DG methods? • How do hyperparameters in Unit DRO influence the performance? • Why Unit DRO can achieve performance improvements and when Unit DRO will fail?
|
| 133 |
+
|
| 134 |
+
To answer the first question, we compare Unit DRO with baselines of both DG ReID and CD ReID on several benchmarks. We perform detailed ablation studies to answer the second question. Comprehensive analysis are conducted for the third question, e.g., error set analysis, feature visualization and domain divergence measure, etc. The main setups of the experiments are as follows.
|
| 135 |
+
|
| 136 |
+
Dataset and Setting. Following (Song et al., 2019; Jia et al., 2019; Zhang et al., 2021a), we evaluate the DIR-ReID with multiple data sources (MS), where source domains cover five large-scale ReID datasets, including CUHK02 (Li & Wang, 2013), CUHK03 (Li et al., 2014), Market1501 (Zheng et al., 2015), DukeMTMC-ReID (Zheng et al., 2017), and CUHK-SYSU PersonSearch (Xiao et al., 2016). The unseen test domains are VIPeR (Gray et al., 2007), PRID (Hirzer et al., 2011), QMUL GRID (Liu et al., 2012), and i-LIDS (Wei-Shi et al., 2009). We include the detailed illustration of datasets and evaluation protocols in Appendix B.1. In the CD domain setting, we employ Market1501 and DukeMTMC-ReID. We alternately construct the two datasets into source and target domains.
|
| 137 |
+
|
| 138 |
+
Baselines. We compare our model with (i) DG ReID methods, e.g., AugMining (Tamura & Murakami, 2019), DIMN (Song et al., 2019), DualNorm (Jia et al., 2019), SNR (Jin et al., 2020), DDAN (Chen et al., 2021), DIR-ReID (Zhang et al., 2021a), and MetaBIN (Choi et al., 2021). (ii) CD ReID methods, e.g., CrossGrad (Shankar et al., 2018), QAConv (Liao & Shao, 2019), L2A-OT (Zhou et al., 2020), OSNet-AIN (Zhou et al., 2021), SNR (Jin et al., 2020), DIR-ReID (Zhang et al., 2021a), and MetaBIN (Choi et al., 2021).
|
| 139 |
+
|
| 140 |
+
Implementation. Following previous generalizable person ReID methods, we use MobileNetV2 (Sandler et al., 2018) with a multiplier of 1.4 as the backbone network, which is pretrained on ImageNet (Deng et al., 2009). Images are resized to $2 5 6 \times 1 2 8$ and the training batch size $N$ is set to 80. The SGD optimizer is used to train all the components with a learning rate of 0.01, a momentum of 0.9 and a weight decay of $5 \times 1 0 ^ { - 4 }$ . The learning rate is warmed up in the first 10 epochs and decayed to its $0 . 1 \times$ and $0 . 0 1 \times$ at 40 and 70 epochs. The step $\tau ^ { * }$ is initialized with $\tau ^ { * } = 1 0 0$ and decayed to 20, 5 at 40 and 70 epochs. The default size for $\mathcal { M }$ is 800. The training process includes 100 epochs and we use the automatic mixed-precision training to increase memory efficiency in the entire process. For the hyperparameters of losses: the label-smoothing parameter is 0.1 and the margin in the triplet loss is 0.3. We serve $\mathcal { L } _ { c e }$ as the $\ell ( x , y ; \theta )$ in Unit DRO. We compare different normalization methods in Table. 13 of the Appendix and integrate the mixture of BN and IN with learnable balancing parameters (Choi et al., 2021) to the proposed Unit DRO. We conduct all the experiments on a machine with i7-8700K, 32G RAM and four GTX2080ti.
|
| 141 |
+
|
| 142 |
+
Table 1: Comparisons against state-of-the-art DG methods for person ReID, where $^ { \bullet } \dag ^ { \bullet }$ indicates the reported result is simply from the last checkpoint. The $1 ^ { s t }$ highest accuracy is indicated by red bold.
|
| 143 |
+
|
| 144 |
+
<table><tr><td rowspan="2">Methods</td><td colspan="2">Average</td><td colspan="4">VIPeR</td><td colspan="4">PRID</td><td rowspan="2"></td><td colspan="4">GRID</td><td colspan="4">i-LIDS R-5R-10</td></tr><tr><td>R-1</td><td>mAP</td><td>R-1</td><td>R-5</td><td>R-10</td><td>mAP</td><td>R-1</td><td>R-51</td><td>R-10</td><td>mAP</td><td>R-1</td><td>R-5</td><td>R-10</td><td>mAP</td><td>R-1</td><td></td><td></td><td>mAP</td></tr><tr><td>AugMining</td><td>51.8</td><td>-</td><td>49.8</td><td>70.8</td><td>77.0</td><td>-</td><td>34.3</td><td>56.2</td><td>65.7</td><td>-</td><td>46.6</td><td>67.5</td><td>76.1</td><td>-</td><td></td><td>76.3</td><td>93.0</td><td>95.3</td><td>-</td></tr><tr><td>DIMN</td><td>47.5</td><td>57.9</td><td>51.2</td><td>70.2</td><td>76.0</td><td>60.1</td><td></td><td>39.2 67.0</td><td>76.7</td><td></td><td>52.0</td><td>29.3</td><td>53.3</td><td>65.8</td><td>41.1</td><td>70.2</td><td>89.7</td><td>94.5</td><td>78.4</td></tr><tr><td>DualNorm</td><td>57.6</td><td>61.8</td><td>53.9</td><td>62.5</td><td>75.3</td><td>58.0</td><td>60.4</td><td>73.6</td><td>84.8</td><td>64.9</td><td></td><td>41.4 47.4</td><td></td><td>64.7</td><td>45.7</td><td>74.8</td><td>82.0</td><td>91.5</td><td>78.5</td></tr><tr><td>DDAN</td><td>59.0</td><td>63.1</td><td>52.3</td><td>60.6</td><td>71.8</td><td>56.4</td><td>54.5</td><td>62.7</td><td>74.9</td><td>58.9</td><td>50.6</td><td>62.1</td><td>73.8</td><td></td><td>55.7</td><td>78.5</td><td>85.3</td><td>92.5</td><td>81.5</td></tr><tr><td>DDAN w/DualNorm</td><td>60.9</td><td>65.1</td><td>56.5</td><td>65.6</td><td>76.3</td><td>60.8</td><td>62.9</td><td>74.2</td><td>85.3</td><td>67.5</td><td>46.2</td><td>55.4</td><td>68.0</td><td></td><td>50.9</td><td>78.0</td><td>85.7</td><td>93.2</td><td>81.2</td></tr><tr><td>DIR-ReID</td><td>63.8</td><td>71.2</td><td>58.5</td><td>76.9</td><td>83.3</td><td>67.0</td><td>69.7</td><td>85.8</td><td>91.0</td><td>77.1</td><td></td><td>48.2 67.1</td><td></td><td>76.3</td><td>57.6</td><td>79.0</td><td>94.8</td><td>97.2</td><td>83.4</td></tr><tr><td>DIR-ReIDt</td><td>62.3</td><td>70.8</td><td>57.2</td><td>74.1</td><td>80.2</td><td>64.9</td><td>67.6</td><td>87.1</td><td>91.6</td><td>76.6</td><td>47.2</td><td>66.1</td><td></td><td>75.4</td><td>57.0</td><td>77.3</td><td>93.3</td><td>97.2</td><td>84.5</td></tr><tr><td>MetaBIN</td><td>64.7</td><td>72.3</td><td>56.9</td><td>76.7</td><td>82.0</td><td>66.9</td><td>72.5</td><td>88.2</td><td>91.3</td><td>79.8</td><td>49.7</td><td>67.5</td><td>76.8</td><td></td><td>58.1</td><td>79.7</td><td>93.3</td><td>97.0</td><td>85.5</td></tr><tr><td>MetaBINt</td><td>64.2</td><td>71.9</td><td>59.3</td><td>76.8</td><td>81.9</td><td>67.6</td><td>70.6</td><td>86.5</td><td>91.5</td><td>78.2</td><td>47.3</td><td>66.0</td><td>74.0</td><td></td><td>56.4</td><td>79.5</td><td>93.0</td><td>97.5</td><td>85.5</td></tr><tr><td>Group DRO</td><td>57.1</td><td>65.9</td><td>48.5</td><td>68.4</td><td>77.2</td><td>57.8</td><td>66.1</td><td>86.5</td><td>90.6</td><td>74.8</td><td>38.7</td><td>58.8</td><td>66.6</td><td></td><td>48.6</td><td>74.8</td><td>90.8</td><td>96.8</td><td>81.9</td></tr><tr><td>Group DROt</td><td>56.7</td><td>65.6</td><td>48.5</td><td>68.9</td><td>76.6</td><td>58.1</td><td>65.4</td><td>85.4</td><td>89.8</td><td>74.1</td><td>38.4</td><td>58.6</td><td>66.1</td><td></td><td>48.4</td><td>74.5</td><td>91.0</td><td>96.0</td><td>81.7</td></tr><tr><td>Unit DROt</td><td>65.4</td><td>72.8</td><td>60.0</td><td>78.2</td><td>82.8</td><td>68.4</td><td>73.5</td><td>85.3</td><td>91.7</td><td>79.4</td><td>47.5</td><td>69.3</td><td>77.4</td><td></td><td>57.2</td><td>80.7</td><td>94.0</td><td>97.0</td><td>86.2</td></tr></table>
|
| 145 |
+
|
| 146 |
+
Table 2: Performance $( \% )$ comparison with the state-ofthe-arts on the CD ReID problem. All of these methods adopt ResNet50 as the backbone.
|
| 147 |
+
|
| 148 |
+
<table><tr><td rowspan="2">Method</td><td colspan="4">Market-Duke</td><td colspan="4">Duke-Market</td></tr><tr><td>R-1</td><td>R-5</td><td>R-10</td><td>mAP</td><td>R-1</td><td>R-5</td><td>R-10</td><td>mAP</td></tr><tr><td>CrossGrad</td><td>48.5</td><td>63.5</td><td>69.5</td><td>27.1</td><td>56.7</td><td>73.5</td><td>79.5</td><td>26.3</td></tr><tr><td>QAConv</td><td>48.8</td><td>:</td><td>-</td><td>28.7</td><td>58.6</td><td>-</td><td>:</td><td>27.6</td></tr><tr><td>L2A-OT</td><td>50.1</td><td>64.5</td><td>70.1</td><td>29.2</td><td>63.8</td><td>80.2</td><td>84.6</td><td>30.2</td></tr><tr><td>OSNet-AIN</td><td>52.4</td><td>66.1</td><td>71.2</td><td>30.5</td><td>61.0</td><td>77.0</td><td>82.5</td><td>30.6</td></tr><tr><td>SNR</td><td>55.1</td><td>-</td><td>-</td><td>33.6</td><td>66.7</td><td>-</td><td>-</td><td>33.9</td></tr><tr><td>DIR-ReID</td><td>54.5</td><td>66.8</td><td>72.5</td><td>33.0</td><td>68.2</td><td>80.7</td><td>86.0</td><td>35.2</td></tr><tr><td>MetaBIN</td><td>55.2</td><td>69.0</td><td>74.4</td><td>33.1</td><td>69.2</td><td>83.1</td><td>87.8</td><td>35.9</td></tr><tr><td>Unit DRO</td><td>55.5</td><td>70.3</td><td>74.9</td><td>33.8</td><td>69.2</td><td>83.7</td><td>88.0</td><td>36.4</td></tr></table>
|
| 149 |
+
|
| 150 |
+
<table><tr><td>T*</td><td>[M</td><td>R-1</td><td>mAP</td></tr><tr><td>[50,5,3]</td><td>800</td><td>64.2</td><td>72.1</td></tr><tr><td>[100,5,3]</td><td>0</td><td>63.4</td><td>71.6</td></tr><tr><td>[100,5,3]</td><td>800</td><td>65.4</td><td>72.8</td></tr><tr><td>[100,5,3]</td><td>4000</td><td>63.9</td><td>71.9</td></tr><tr><td>[100,10,3]</td><td>800</td><td>64.2</td><td>71.8</td></tr><tr><td>[100,10,3]</td><td>1600</td><td>64.2</td><td>72.0</td></tr><tr><td>[100,20,3]</td><td>800</td><td>64.8</td><td>72.3</td></tr><tr><td>[100,20,5]</td><td>800</td><td>65.4</td><td>72.8</td></tr></table>
|
| 151 |
+
|
| 152 |
+
Table 3: Ablation studies of step $\tau ^ { * }$ . $\tau ^ { * } = [ \tau _ { 1 } , \tau _ { 2 } , \tau _ { 3 } ]$ means $\tau ^ { * } = \tau _ { 1 }$ initially and decayed to $\tau _ { 2 }$ and $\tau _ { 3 }$ at 40 and 70 epochs.
|
| 153 |
+
|
| 154 |
+
# 4.2 NUMERICAL RESULTS
|
| 155 |
+
|
| 156 |
+
To the best of our knowledge, there is no work focusing on DGWD-ReID setting. We first evaluate one representative method under the fairness/OOD setting termed Group DRO (Sagawa et al., 2019) on the DG ReID benchmark. We find $\eta$ for Group DRO within $[ 1 0 ^ { - 3 } , 1 \bar { 0 } ^ { - 1 } ]$ and the optimal value is 0.01. Table. 1 shows that it doesn’t work well. Then we then compare the proposed Unit DRO with the existing methods about DG ReID and CD ReID.
|
| 157 |
+
|
| 158 |
+
Comparison with DG ReID. We observe that current DG ReID methods (Choi et al., 2021; Zhang et al., 2021a; Chen et al., 2021) all apply an utopian model selection method, they all choose the checkpoint with the best performance on the test datasets and report their results. We argue that such a model selection method is inadvisable. Under the DG setting, we should restrict access to the test domain data (Gulrajani & Lopez-Paz, 2020). Instead, we simply use the last checkpoint and report its results as the final performance over all test datasets. Among the competitors, although some methods have achieved advantages sporadically on one or two datasets, the proposed Unit DRO attains the best performance in the average R-1 accuracy and average mAP over most of the test sets. Note that such comparison is unfair because DG methods can utilize demographics. We also report the last checkpoints’ results of other methods. Table 1 shows that, without the utopian model selection method, there is a certain degree of performance decline of these methods, which indicates the effectiveness of Unit DRO again.
|
| 159 |
+
|
| 160 |
+
Comparison with CD ReID. Table 2 shows the comparison under the CD setting, where ‘MarketDuke’ indicates that Market1501 is the labeled source domain and DukeMTMC-ReID is an unseen target domain. Because the style variation within a single dataset is relatively small, previous DG ReID methods must utilize fine-grained demographics,e.g., camera IDs (Zhang et al., 2021a), or tune the hyper-parameters carefully (Choi et al., 2021). Instead, Unit DRO does not require additional data augmentation or any changes to model structures and hyper-parameters. For a fair comparison, we employ the Resnet50 backbone with color jittering and Table 2 shows that Unit DRO outperforms current CD methods. So far, we have verified that the proposed Unit DRO has the potential to improve the generalization ability on both multi-source datasets and single-source dataset settings.
|
| 161 |
+
|
| 162 |
+
Ablation Studies: impact of $\tau ^ { * }$ and $| { \mathcal { M } } |$ in Unit DRO. We conduct ablation studies on various components. Table 4 shows that the results with a constant $\tau ^ { * }$ are not better than the baseline (the results on the first row). Cooperated with a weights queue with a size of $| \mathcal { M } | = 8 0 0$ boosts the performance slightly. However, maintaining a large $\mathcal { M }$ with a size of 5000 is harmful to Unit DRO. Step $\tau ^ { * }$ with no $\mathcal { M }$ or a large $\mathcal { M }$ all behave not well. We perform a careful search for the most suitable $| { \mathcal { M } } |$ and step $\tau ^ { * }$ in Table 3, which brings great performance gain. These empirical results show that both the weights queue $\mathcal { M }$ and the step $\tau ^ { * }$ play an important role in Unit DRO.
|
| 163 |
+
|
| 164 |
+
# 4.3 ANALYSIS
|
| 165 |
+
|
| 166 |
+

|
| 167 |
+
Figure 3: Distribution visualization of sample weights of steps [1000, 5000, 10000, 20000] (from left to right). The horizontal axis represents the weight, and the vertical axis represents the density.
|
| 168 |
+
|
| 169 |
+
Distributions of sample weights on different parameters. We train models in DG benchmarks 100 epochs and each epoch consists of 1850 steps. Per 1000 steps, all the sample weights5 will be saved and the mean and variance of these weights will be calculated. We assume these weights obey Gaussian distribution $\mathcal { N } ( \boldsymbol { \mu } , \delta )$ and plot diagrams based on the mean $\mu$ and variance $\delta$ . The $x$ -coordinate of these diagrams is just the value between $\left[ \mu - 3 * \delta , \mu + 3 * \delta \right]$ , not the real values of weights. Based on the loss values of each sample, we calculate the weights with the following three methods. (i) Sample weights for Unit DRO. In this case, these weights are normalized in their batches, so the mean of all distributions here is 1. Figure 2 shows the results and we had discussed them in Section 3.1. (ii) Sample weights for Unit DRO with different $| { \mathcal { M } } |$ . We plot the sample distribution of steps $[ 1 0 0 0 , 5 0 0 0 , 1 0 0 0 0 , 2 0 0 0 0 ]$ in this case. With an additional queue, Figure 3 indicates that weight distributions have different means during training. Theoretically we need a large $| { \mathcal { M } } |$ to estimate $\bar { \mathbb { E } } _ { \mathcal { P } } [ e ^ { \ell ( x , y ; \theta ) / \tau ^ { * } } ]$ . However, as $| { \mathcal { M } } |$ becomes larger, the estimation will be inaccurate. Consider an extreme case: $| { \mathcal { M } } | = T - 1$ and then the queue absolutely contains all the training data. It is catastrophic to estimate $\stackrel { \cdot } { \mathbb { E } } _ { \mathcal { P } } \left[ e ^ { \ell ( x , y ; \theta ) / \tau ^ { * } } \right]$ in step $T$ by such a queue. The large queue contains very old sample weights which is unsuitable for the current model. Figure 3 depicts the phenomenon, where the distribution with a larger $| { \mathcal { M } } |$ always has smaller $\mu$ . We plot and discuss the distribution diagrams of step $\tau ^ { * }$ in Appendix C.2.
|
| 170 |
+
|
| 171 |
+
Feature visualization using $t$ -SNE. We compare the proposed Unit DRO to MetaBIN and DualNorm through $t$ -SNE visualization. We observe a distinct division of different domains in Figure 4a, which denotes that a domain-specific feature space is learned by the DualNorm. MetaBIN and the proposed Unit DRO tackle this problem well and the overlaps in Figure 4b and Figure 4c between different domains are more prominent. The $t { \cdot }$ -SNE visualization shows that Unit DRO can learn domaininvariant representations while keeping discriminative capability for ReID tasks. However, MetaBIN follows a meta-learning pipeline and needs expensive demographics. In contrast, no demographics is required by Unit DRO and the framework is simpler. We supply more visualization results and further analysis about the discriminative capability in Section C.3 of Appendix.
|
| 172 |
+
|
| 173 |
+
Domain divergence measure using $\mathcal { A }$ -distance and MMD-distance. We study the MMD distance (Tolstikhin et al., 2016) and $\mathcal { A }$ -distance (Long et al., 2015) as measures of domain discrepancy (Ben-David et al., 2010). Detailed implementation is depicted in Section C.4 of Appendix. Table 5 shows that Unit DRO can learn comparable or even more invariant representations compared to MetaBIN, which outperforms DualNorm by a large margin. We also study the correlation between the weights for each dataset and the MMD distance. For each dataset, we calculate the sum of MMD distance between it to all other datasets. Besides, we calculate the average weights of the final model for each dataset. Table 6 shows that for a tough dataset (e.g., , CUHK02) that has a large divergence to other datasets, Unit DRO assigns a relatively higher average weight. This phenomenon depicts that even without demographics, Unit DRO can also find meaningful subgroups and upweight them. We can also see that Unit DRO upweights samples in CUHK-SYSU which has a relatively small MMD distance with other datasets. It is because the generalization ability is not only dependent on domain divergence, but also some other factors. We discuss these influence factors and perform error set analysis in Section C.6 of Appendix. We also plot the MMD-distance of every dataset pair and give further analysis in Section C.5 of Appendix.
|
| 174 |
+
|
| 175 |
+

|
| 176 |
+
Table 4: Ablation study of Unit DRO.
|
| 177 |
+
|
| 178 |
+

|
| 179 |
+
Figure 4: The $t$ -SNE visualization of the embedding vectors of training and test datasets. Query and gallery samples of these unseen datasets are expressed in different shapes. Best viewed in color.
|
| 180 |
+
|
| 181 |
+
# 5 CONCLUSION
|
| 182 |
+
|
| 183 |
+
It is common that traditional DG ReID methods fail to work in cases where domain information, camera ID, or other demographics are difficult to obtain due to privacy issues. To this end, We introduce DGWD-ReID, a new setting that needs to learn domain-invariant representation without demographics. Under DGWD-ReID, we further propose Unit DRO, a new method reformulated from KL constraint DRO. Unit DRO learns domain-invariant features and outperforms previous DG ReID methods that even require demographics. Empirical results and detailed analysis have verified that Unit DRO can find semantically meaningful samples and subgroups without demographics.
|
| 184 |
+
|
| 185 |
+
<table><tr><td></td><td>Cuhk02</td><td>Cuhk03</td><td>Market</td><td>Duke</td><td>SYSU</td></tr><tr><td>Weight</td><td>1.02</td><td>0.99</td><td>0.99</td><td>1.00</td><td>1.01</td></tr><tr><td>MMD</td><td>1.66</td><td>1.17</td><td>1.15</td><td>1.16</td><td>1.04</td></tr></table>
|
| 186 |
+
|
| 187 |
+
Table 5: Divergence measurement on four unseen datasets (U), five training datasets (T) and all of these datasets (A).
|
| 188 |
+
|
| 189 |
+
<table><tr><td>Method</td><td>MMD↓(U)</td><td>MMD↓(T)</td><td>MMD↓(A)</td><td>A↓(U)</td><td>A↓(T)</td><td>A↓(A)</td></tr><tr><td>DualNorm</td><td>0.52</td><td>0.21</td><td>0.41</td><td>1.96</td><td>1.91</td><td>1.88</td></tr><tr><td>MetaBIN</td><td>0.41</td><td>0.19</td><td>0.36</td><td>1.96</td><td>1.89</td><td>1.86</td></tr><tr><td>UnitDRO</td><td>0.41</td><td>0.19</td><td>0.35</td><td>1.95</td><td>1.89</td><td>1.85</td></tr></table>
|
| 190 |
+
|
| 191 |
+
Table 6: Average weight and one-to-all MMD distance for training datasets.
|
| 192 |
+
|
| 193 |
+
# REFERENCES
|
| 194 |
+
|
| 195 |
+
Kartik Ahuja, Karthikeyan Shanmugam, Kush Varshney, and Amit Dhurandhar. Invariant risk minimization games. In International Conference on Machine Learning (ICML), 2020.
|
| 196 |
+
|
| 197 |
+
Martin Arjovsky, Leon Bottou, Ishaan Gulrajani, and David Lopez-Paz. Invariant risk minimization, ´ 2020.
|
| 198 |
+
|
| 199 |
+
Shai Ben-David, John Blitzer, Koby Crammer, Alex Kulesza, Fernando Pereira, and Jennifer Wortman Vaughan. A theory of learning from different domains. Machine learning, 2010.
|
| 200 |
+
|
| 201 |
+
Aharon Ben-Tal, Laurent El Ghaoui, and Arkadi Nemirovski. Robust Optimization. Princeton university press, 2009.
|
| 202 |
+
|
| 203 |
+
Peixian Chen, Pingyang Dai, Jianzhuang Liu, Feng Zheng, Qi Tian, and Rongrong Ji. Dual distribution alignment network for generalizable person re-identification. AAAI Conference on Artificial Intelligence, 2021.
|
| 204 |
+
|
| 205 |
+
Seokeon Choi, Taekyung Kim, Minki Jeong, Hyoungseob Park, and Changick Kim. Meta batchinstance normalization for generalizable person re-identification. In Computer Vision and Pattern Recognition (CVPR), 2021.
|
| 206 |
+
|
| 207 |
+
Elliot Creager, Jorn-Henrik Jacobsen, and Richard Zemel. Environment inference for invariant ¨ learning. In International Conference on Machine Learning (ICML), 2021.
|
| 208 |
+
|
| 209 |
+
Yongxing Dai, Xiaotong Li, Jun Liu, Zekun Tong, and Ling-Yu Duan. Generalizable person reidentification with relevance-aware mixture of experts. In Computer Vision and Pattern Recognition (CVPR), 2021a.
|
| 210 |
+
|
| 211 |
+
Yongxing Dai, Xiaotong Li, Jun Liu, Zekun Tong, and Ling-Yu Duan. Generalizable person reidentification with relevance-aware mixture of experts. In CVPR, 2021b.
|
| 212 |
+
|
| 213 |
+
Erick Delage and Yinyu Ye. Distributionally robust optimization under moment uncertainty with application to data-driven problems. Operations Research, 2010.
|
| 214 |
+
|
| 215 |
+
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Computer Vision and Pattern Recognition (CVPR), 2009.
|
| 216 |
+
|
| 217 |
+
John C Duchi, Tatsunori Hashimoto, and Hongseok Namkoong. Distributionally robust losses against mixture covariate shifts. Under review, 2019.
|
| 218 |
+
|
| 219 |
+
Cynthia Dwork, Moritz Hardt, Toniann Pitassi, Omer Reingold, and Richard Zemel. Fairness through awareness. In Innovations in Theoretical Computer Science (ITCS), 2012.
|
| 220 |
+
|
| 221 |
+
Yixiao Ge, Dapeng Chen, and Hongsheng Li. Mutual mean-teaching: Pseudo label refinery for unsupervised domain adaptation on person re-identification. arXiv preprint arXiv:2001.01526, 2020.
|
| 222 |
+
|
| 223 |
+
D. Gray, S. Brennan, and H. Tao. Evaluating Appearance Models for Recognition, Reacquisition, and Tracking. Proc. IEEE International Workshop on Performance Evaluation for Tracking and Surveillance (PETS), 2007.
|
| 224 |
+
|
| 225 |
+
Ishaan Gulrajani and David Lopez-Paz. In search of lost domain generalization. arXiv preprint arXiv:2007.01434, 2020.
|
| 226 |
+
|
| 227 |
+
Alexander Hermans, Lucas Beyer, and Bastian Leibe. In defense of the triplet loss for person re-identification. arXiv preprint arXiv:1703.07737, 2017.
|
| 228 |
+
|
| 229 |
+
Martin Hirzer, Csaba Beleznai, Peter M Roth, and Horst Bischof. Person re-identification by descriptive and discriminative classification. In Scandinavian Conference on Image Analysis, 2011.
|
| 230 |
+
|
| 231 |
+
Weihua Hu, Gang Niu, Issei Sato, and Masashi Sugiyama. Does distributionally robust supervised learning give robust classifiers? In International Conference on Machine Learning (ICML), 2018.
|
| 232 |
+
|
| 233 |
+
Zhaolin Hu and L Jeff Hong. Kullback-leibler divergence constrained distributionally robust optimization. Available at Optimization Online, 2013.
|
| 234 |
+
|
| 235 |
+
Yukun Huang, Zheng-Jun Zha, Xueyang Fu, Richang Hong, and Liang Li. Real-world person re-identification via degradation invariance learning. In Computer Vision and Pattern Recognition (CVPR), 2020.
|
| 236 |
+
|
| 237 |
+
Jieru Jia, Qiuqi Ruan, and Timothy M Hospedales. Frustratingly easy person re-identification: Generalizing person re-id in practice. arXiv preprint arXiv:1905.03422, 2019.
|
| 238 |
+
|
| 239 |
+
Xin Jin, Cuiling Lan, Wenjun Zeng, Zhibo Chen, and Li Zhang. Style normalization and restitution for generalizable person re-identification. In Computer Vision and Pattern Recognition (CVPR), 2020.
|
| 240 |
+
|
| 241 |
+
Martin Koestinger, Martin Hirzer, Paul Wohlhart, Peter M Roth, and Horst Bischof. Large scale metric learning from equivalence constraints. In Computer Vision and Pattern Recognition (CVPR), 2012.
|
| 242 |
+
|
| 243 |
+
Wei Li and Xiaogang Wang. Locally aligned feature transforms across views. In Computer Vision and Pattern Recognition (CVPR), June 2013.
|
| 244 |
+
|
| 245 |
+
Wei Li, Rui Zhao, Tong Xiao, and Xiaogang Wang. Deepreid: Deep filter pairing neural network for person re-identification. In Computer Vision and Pattern Recognition (CVPR), June 2014.
|
| 246 |
+
|
| 247 |
+
Shengcai Liao and Ling Shao. Interpretable and generalizable person re-identification with queryadaptive convolution and temporal lifting. arXiv preprint arXiv:1904.10424, 2019.
|
| 248 |
+
|
| 249 |
+
Shan Lin, Haoliang Li, Chang Tsun Li, and Alex Chichung Kot. Multi-task mid-level feature alignment network for unsupervised cross-dataset person re-identification. In British Machine Vision Conference (BMVC), 2018.
|
| 250 |
+
|
| 251 |
+
Chunxiao Liu, Shaogang Gong, Chen Change Loy, and Xinggang Lin. Person re-identification: What features are important? In European Conference on Computer Vision (ECCV). Springer, 2012.
|
| 252 |
+
|
| 253 |
+
Evan Z Liu, Behzad Haghgoo, Annie S Chen, Aditi Raghunathan, Pang Wei Koh, Shiori Sagawa, Percy Liang, and Chelsea Finn. Just train twice: Improving group robustness without training group information. In International Conference on Machine Learning (ICML), 2021.
|
| 254 |
+
|
| 255 |
+
Mingsheng Long, Yue Cao, Jianmin Wang, and Michael Jordan. Learning transferable features with deep adaptation networks. In International Conference on Machine Learning (ICML), 2015.
|
| 256 |
+
|
| 257 |
+
Chuanchen Luo, Chunfeng Song, and Zhaoxiang Zhang. Generalizing person re-identification by camera-aware invariance learning and cross-domain mixup. In European Conference on Computer Vision (ECCV), 2020.
|
| 258 |
+
|
| 259 |
+
Hao Luo, Youzhi Gu, Xingyu Liao, Shenqi Lai, and Wei Jiang. Bag of tricks and a strong baseline for deep person re-identification. In Computer Vision and Pattern Recognition (CVPR) Workshops, 2019.
|
| 260 |
+
|
| 261 |
+
Tetsu Matsukawa, Takahiro Okabe, Einoshin Suzuki, and Yoichi Sato. Hierarchical gaussian descriptor for person re-identification. In Computer Vision and Pattern Recognition (CVPR), 2016.
|
| 262 |
+
|
| 263 |
+
Paul Michel, Tatsunori Hashimoto, and Graham Neubig. Modeling the second player in distributionally robust optimization. In International Conference on Learning Representations (ICLR), 2021.
|
| 264 |
+
|
| 265 |
+
K. Muandet, D. Balduzzi, and B. Scholkopf. Domain generalization via invariant feature representa- ¨ tion. In International Conference on Machine Learning (ICML), 2013.
|
| 266 |
+
|
| 267 |
+
Hyeonseob Nam and Hyo-Eun Kim. Batch-instance normalization for adaptively style-invariant neural networks. arXiv preprint arXiv:1805.07925, 2018.
|
| 268 |
+
|
| 269 |
+
Viet Anh Nguyen, Nian Si, and Jose Blanchet. Robust bayesian classification using an optimistic score ratio. In International Conference on Machine Learning (ICML), 2020.
|
| 270 |
+
|
| 271 |
+
Luke Oakden-Rayner, Jared Dunnmon, Gustavo Carneiro, and Christopher Re. Hidden stratification ´ causes clinically meaningful failures in machine learning for medical imaging. In Proceedings of the ACM conference on health, inference, and learning, 2020.
|
| 272 |
+
|
| 273 |
+
Yonatan Oren, Shiori Sagawa, Tatsunori B Hashimoto, and Percy Liang. Distributionally robust language modeling. arXiv preprint arXiv:1909.02060, 2019.
|
| 274 |
+
|
| 275 |
+
Peixi Peng, Tao Xiang, Yaowei Wang, Massimiliano Pontil, Shaogang Gong, Tiejun Huang, and Yonghong Tian. Unsupervised cross-dataset transfer learning for person re-identification. In Computer Vision and Pattern Recognition (CVPR), June 2016.
|
| 276 |
+
|
| 277 |
+
Xingchao Peng, Yichen Li, and Saenko Kate. Domain2vec: Domain embedding for unsupervised domain adaptation. European Conference on Computer Vision (ECCV), 2020.
|
| 278 |
+
|
| 279 |
+
Hamed Rahimian and Sanjay Mehrotra. Distributionally robust optimization: A review. arXiv preprint arXiv:1908.05659, 2019.
|
| 280 |
+
|
| 281 |
+
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. arXiv preprint arXiv:1911.08731, 2019.
|
| 282 |
+
|
| 283 |
+
Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. Mobilenetv2: Inverted residuals and linear bottlenecks. In Computer Vision and Pattern Recognition (CVPR), 2018.
|
| 284 |
+
|
| 285 |
+
Shiv Shankar, Vihari Piratla, Soumen Chakrabarti, Siddhartha Chaudhuri, Preethi Jyothi, and Sunita Sarawagi. Generalizing across domains via cross-gradient training. arXiv preprint arXiv:1804.10745, 2018.
|
| 286 |
+
|
| 287 |
+
Aman Sinha, Hongseok Namkoong, Riccardo Volpi, and John Duchi. Certifying some distributional robustness with principled adversarial training. arXiv preprint arXiv:1710.10571, 2017.
|
| 288 |
+
|
| 289 |
+
Jifei Song, Yongxin Yang, Yi-Zhe Song, Tao Xiang, and Timothy M. Hospedales. Generalizable person re-identification by domain-invariant mapping network. In Computer Vision and Pattern Recognition (CVPR), June 2019.
|
| 290 |
+
|
| 291 |
+
Matthew Staib and Stefanie Jegelka. Distributionally robust optimization and generalization in kernel methods. Advances in Neural Information Processing Systems (NeurIPS), 2019.
|
| 292 |
+
|
| 293 |
+
Masato Tamura and Tomokazu Murakami. Augmented hard example mining for generalizable person re-identification. arXiv preprint arXiv:1910.05280, 2019.
|
| 294 |
+
|
| 295 |
+
Ilya O Tolstikhin, Bharath K Sriperumbudur, and Bernhard Scholkopf. Minimax estimation of ¨ maximum mean discrepancy with radial kernels. Advances in Neural Information Processing Systems (NeurIPS), 2016.
|
| 296 |
+
|
| 297 |
+
Michael Veale and Reuben Binns. Fairer machine learning in the real world: Mitigating discrimination without collecting sensitive data. Big Data & Society, 2017.
|
| 298 |
+
|
| 299 |
+
Jingya Wang, Xiatian Zhu, Shaogang Gong, and Wei Li. Transferable joint attribute-identity deep learning for unsupervised person re-identification. In Computer Vision and Pattern Recognition (CVPR), 2018.
|
| 300 |
+
|
| 301 |
+
Zheng Wei-Shi, Gong Shaogang, and Xiang Tao. Associating groups of people. In British Machine Vision Conference (BMVC), 2009.
|
| 302 |
+
|
| 303 |
+
Tong Xiao, Shuang Li, Bochao Wang, Liang Lin, and Xiaogang Wang. End-to-end deep learning for person search. arXiv preprint arXiv:1604.01850, 2(2), 2016.
|
| 304 |
+
|
| 305 |
+
Ye Yuan, Wuyang Chen, Tianlong Chen, Yang Yang, Zhou Ren, Zhangyang Wang, and Gang Hua. Calibrated domain-invariant learning for highly generalizable large scale re-identification. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, 2020.
|
| 306 |
+
|
| 307 |
+
Yunpeng Zhai, Qixiang Ye, Shijian Lu, Mengxi Jia, Rongrong Ji, and Yonghong Tian. Multiple expert brainstorming for domain adaptive person re-identification. arXiv preprint arXiv:2007.01546, 2020.
|
| 308 |
+
|
| 309 |
+
Yi-Fan Zhang, Hanlin Zhang, Zhang Zhang, Da Li, Zhen Jia, Liang Wang, and Tieniu Tan. Learning domain invariant representations for generalizable person re-identification. arXiv preprint arXiv:2103.15890, 2021a.
|
| 310 |
+
|
| 311 |
+
Zhizheng Zhang, Cuiling Lan, Wenjun Zeng, Xin Jin, and Zhibo Chen. Relation-aware global attention for person re-identification. In Computer Vision and Pattern Recognition (CVPR), June 2020.
|
| 312 |
+
|
| 313 |
+
Zhong Zhang, Haijia Zhang, and Shuang Liu. Person re-identification using heterogeneous local graph attention networks. In Computer Vision and Pattern Recognition (CVPR), 2021b.
|
| 314 |
+
|
| 315 |
+
Yuyang Zhao, Zhun Zhong, Fengxiang Yang, Zhiming Luo, Yaojin Lin, Shaozi Li, and Sebe Nicu. Learning to generalize unseen domains via memory-based multi-source meta-learning for person re-identification. In CVPR, 2021.
|
| 316 |
+
|
| 317 |
+
Liang Zheng, Liyue Shen, Lu Tian, Shengjin Wang, Jingdong Wang, and Qi Tian. Scalable person reidentification: A benchmark. In International Conference on Computer Vision (ICCV), December 2015.
|
| 318 |
+
|
| 319 |
+
Zhedong Zheng, Liang Zheng, and Yi Yang. Unlabeled samples generated by gan improve the person re-identification baseline in vitro. In International Conference on Computer Vision (ICCV), Oct 2017.
|
| 320 |
+
|
| 321 |
+
Kaiyang Zhou, Yongxin Yang, Timothy Hospedales, and Tao Xiang. Learning to generate novel domains for domain generalization. In European Conference on Computer Vision (ECCV), 2020.
|
| 322 |
+
|
| 323 |
+
Kaiyang Zhou, Yongxin Yang, Andrea Cavallaro, and Tao Xiang. Learning generalisable omni-scale representations for person re-identification. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2021.
|
md/dev/Vx1JadlOIt/Vx1JadlOIt.md
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# VisionLLM: Large Language Model is also an Open-Ended Decoder for Vision-Centric Tasks
|
| 2 |
+
|
| 3 |
+
Wenhai Wang∗2 Zhe Chen∗1,3 Xiaokang Chen∗1,4 Jiannan $\mathbf { W _ { u } } ^ { * 1 , 5 }$ Xizhou Zhu1,6 Gang Zeng4 Ping Luo5 Tong $\mathbf { L u ^ { 3 } }$ Jie Zhou6 Yu Qiao1 Jifeng Dai†1,6 1OpenGVLab, Shanghai AI Laboratory 2The Chinese University of Hong Kong 3Nanjing University 4Peking University 5The University of HongKong 6Tsinghua University
|
| 4 |
+
|
| 5 |
+
Code: https://github.com/OpenGVLab/VisionLLM
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
Large language models (LLMs) have notably accelerated progress towards artificial general intelligence (AGI), with their impressive zero-shot capacity for user-tailored tasks, endowing them with immense potential across a range of applications. However, in the field of computer vision, despite the availability of numerous powerful vision foundation models (VFMs), they are still restricted to tasks in a pre-defined form, struggling to match the open-ended task capabilities of LLMs. In this work, we present an LLM-based framework for vision-centric tasks, termed VisionLLM. This framework provides a unified perspective for vision and language tasks by treating images as a foreign language and aligning vision-centric tasks with language tasks that can be flexibly defined and managed using language instructions. An LLM-based decoder can then make appropriate predictions based on these instructions for open-ended tasks. Extensive experiments show that the proposed VisionLLM can achieve different levels of task customization through language instructions, from fine-grained object-level to coarse-grained task-level customization, all with good results. It’s noteworthy that, with a generalist LLMbased framework, our model can achieve over $60 \%$ mAP on COCO, on par with detection-specific models. We hope this model can set a new baseline for generalist vision and language models. The code shall be released.
|
| 10 |
+
|
| 11 |
+
# 1 Introduction
|
| 12 |
+
|
| 13 |
+
The emergence of large language models (LLMs) like ChatGPT [35] has revolutionized the landscape of artificial general intelligence (AGI), showcasing their impressive zero-shot capabilities in addressing various natural language processing (NLP) tasks through user-tailored prompts or language instructions. Despite these advancements, it’s essential to note that the triumph of LLMs does not effortlessly extend to pure vision and vision-language tasks, due to the inherent disparities between modalities and task formats.
|
| 14 |
+
|
| 15 |
+
The field of computer vision presents a unique set of challenges and paradigms that differ from those of NLP. The traditional paradigm of vision foundation models is pre-training followed by fine-tuning [51, 11, 43, 53, 17, 44], which is effective but comes with significant marginal costs when adapting to diverse downstream scenarios. As shown in Figure 1a, while approaches such as multi-task unification [38, 50, 1, 49, 72] have been used to achieve generalist capability, they often struggle to overcome the limitations imposed by pre-defined tasks, resulting in a gap in open-ended task capabilities compared to LLMs. Recently, visual prompt tuning [24, 66, 70, 67, 54] has emerged as a way to flexibly outline some pure vision tasks (see Figure 1b), such as object detection, instance
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
(b) Visual prompt tuning [24, 56, 54] are inconsistent with the format of LLMs.
|
| 21 |
+
|
| 22 |
+
(a) Vision generalist models [51, 53, 74] are constrained by the format of pre-defined tasks.
|
| 23 |
+
|
| 24 |
+

|
| 25 |
+
(c) VisionLLM (ours) can flexibly manage vision-centric tasks using language instructions like LLMs.
|
| 26 |
+
Figure 1: Comparison of our VisionLLM with popular paradigms. Unlike current vision generalist models that depend on pre-defined task formats and visual prompt tuning models that are inconsistent with large language models (LLMs), VisionLLM leverages the power of LLMs for open-ended vision tasks by using language instructions.
|
| 27 |
+
|
| 28 |
+
segmentation, and pose estimation, using visual masking. However, the format of visual prompts considerably deviates from that of language instructions, making it challenging to directly apply the reasoning abilities and world knowledge of LLMs to vision tasks. Therefore, there is an urgent need for a unified generalist framework that can seamlessly integrate the strengths of LLMs with the specific requirements of vision-centric tasks.
|
| 29 |
+
|
| 30 |
+
In this work, we present VisionLLM, a novel framework that aligns the definitions of vision-centric tasks with the methodologies of LLMs. Leveraging the reasoning and parsing capacities of LLMs, VisionLLM is designed to empower open-ended task capabilities for vision-centric tasks. Specifically, it comprises three core components: (1) a unified language instruction designed for vision and vision-language tasks, (2) a language-guided image tokenizer, and (3) an LLM-based open-ended task decoder that orchestrates various tasks using language instructions. With this framework, a wide range of vision-centric tasks can be seamlessly integrated, including object detection, instance segmentation, image captioning, and visual grounding. In addition, the framework also facilitates task customization at different levels of granularity, allowing for the customization of target objects, output formats, task descriptions, etc.
|
| 31 |
+
|
| 32 |
+
Compared to current popular API-based applications [60, 65, 42, 32, 28], our model takes a unified, end-to-end approach to integrate VFMs and LLMs, streamlining and enhancing the overall efficiency of the overall process, and leveraging the strengths and data of both VFMs and LLMs within a single, cohesive system. Furthermore, our model surpasses the limitations of generalist vision models pre-trained on pre-defined tasks. VisionLLM can effectively manage vision-centric tasks through language instructions, embodying a flexible and open-ended approach that is not constrained by pre-set tasks. This versatility makes VisionLLM a robust and powerful generalist model for vision and vision-language tasks, opening up new possibilities for the development of unified generalist models that bridge the domains of vision and language.
|
| 33 |
+
|
| 34 |
+
In summary, our main contributions are as follows:
|
| 35 |
+
|
| 36 |
+
(1) We propose VisionLLM, the first framework that leverages the power of LLMs to address visioncentric tasks in an open-ended and customizable manner. By aligning the definitions of vision-centric tasks with LLM methodologies, VisionLLM breaks new ground in enabling the unified modeling of vision and language, opening up possibilities for advancing the field.
|
| 37 |
+
|
| 38 |
+
(2) We overcome many difficulties when porting LLMs to vision-centric tasks, by designing unified language instruction that matches the format of language models and covers various vision-centric tasks including visual perception. Correspondingly, we develop a language-guided image tokenizer and an LLM-based task decoder that can handle open-ended tasks according to the given language instructions based on the LLMs’ reasoning and parsing capabilities.
|
| 39 |
+
|
| 40 |
+
(3) We construct a series of tasks with different granularities to verify the effectiveness of our models, ranging from easy to hard, and from pre-defined to flexible. Through these validations, we demonstrate the remarkable generality of our models, showcasing their ability to handle diverse
|
| 41 |
+
|
| 42 |
+
Human: “Identify the objects in <image> that belong to {‘What is the child eating?’: <c0>, ‘red gamepad': <c1>} and draw a bounding box around each one. The output should be a list of tuples in
|
| 43 |
+
|
| 44 |
+

|
| 45 |
+
|
| 46 |
+
the format (c, x1, y1, x2, y2), where c is the class label and x1, y1, x2, y2 are the coordinates of the top-left and bottom-right corners of the bounding box. The coordinates should be within the range 1024."
|
| 47 |
+
|
| 48 |
+
VisionLLM: "The bounding boxes are [(<c0>, 226.4, 229.8, 363.1, 347.4), (<c1>, 441.1, 183.5, 538.6, 269.9)]."
|
| 49 |
+
|
| 50 |
+
Human: "For each object in <image> that is a member of {'motorbike': $< \mathsf { c } 0 > \}$ , output a tuple with the class label and the coordinates of a polygon with 16 points that
|
| 51 |
+
|
| 52 |
+

|
| 53 |
+
|
| 54 |
+
encloses the object. The coordinates should be within the range 1024. The output format should be (c, x1, y1, x2, y2, ..., x16, y16)."
|
| 55 |
+
|
| 56 |
+
VisionLLM: "The detected polygons are $I ( < \mathsf { c o } > , 1 3 5 . 3 ,$ 95.7, 123.4, 53.4, 84.9, 57.6, 66.8, 60.5, 60.1, 72.3, 34.2, 71.4, ..., 124.9, 119.3)]."
|
| 57 |
+
|
| 58 |
+
(a) Object Detection with Customized Class Set
|
| 59 |
+
|
| 60 |
+
Human: "Provide a long description of the <image>."
|
| 61 |
+
|
| 62 |
+

|
| 63 |
+
|
| 64 |
+
VisionLLM: "The image features a white dog laying down on a foldable outdoor
|
| 65 |
+
|
| 66 |
+
# cooling pad ,
|
| 67 |
+
|
| 68 |
+
which is placed on top of a wooden table. The dog has its head in the middle of the cooling pad, and a fan is positioned behind it, blowing air onto the pad. The table is outdoors, in a grassy area, and there are two chairs placed around it, one on each side. The scene appears to be set in a sunny weather, with a bright and sunny sky, which contributes to the overall outdoor atmosphere."
|
| 69 |
+
|
| 70 |
+
(b) Object Location with Editable Output Format
|
| 71 |
+
|
| 72 |
+
Human: "With the objects in the <image>, if you feel hot, what will you do?
|
| 73 |
+
|
| 74 |
+

|
| 75 |
+
|
| 76 |
+
VisionLLM: "First, You can also try turning off the computer and other electrical appliances in the
|
| 77 |
+
|
| 78 |
+
room to reduce the heat generated by their operation. As an alternative, you can use the desk fan provided in the image to create a cooling effect in the room. You can plug in the fan and adjust its settings to ensure it blows air in a direction that reaches the room’s occupants effectively."
|
| 79 |
+
|
| 80 |
+
(c) Image Description with Controllable Text Length (d) Visual Question Answer with Complex Reasoning
|
| 81 |
+
|
| 82 |
+
Figure 2: Results and visualizations of our VisionLLM. Guided by language instructions, our unified generalist framework showcases its effectiveness on diverse open-ended vision-centric tasks. The text marked with a gray background indicates the customized instructions and the desired outputs.
|
| 83 |
+
|
| 84 |
+
scenarios, including random object categories, random output formats, and random task descriptions, as shown in Figure 2. The successful outcomes of these validations underscore the tremendous potential of our model in harnessing the capabilities of LLMs to control and guide vision-centric tasks. In addition, with a generalist LLM-based framework, our model also yields promising results on various vision-centric tasks. Notably, our generalist model achieves an impressive mAP score of $60 \%$ on the COCO dataset, surpassing many detection-specific models [73, 6, 20] and approaching the state-of-the-art record.
|
| 85 |
+
|
| 86 |
+
# 2 Related Work
|
| 87 |
+
|
| 88 |
+
# 2.1 Large Language Model
|
| 89 |
+
|
| 90 |
+
Large language models (LLMs) have gained significant attention in the field of natural language processing (NLP) and artificial general intelligence (AGI), due to their impressive capabilities in language generation, in-context learning, world knowledge, and reasoning. The GPT family, including GPT-3 [5], ChatGPT [35], GPT-4 [34], and InstructGPT [36] are most representative works of LLMs. Other LLMs like OPT [69], LLaMA [46], MOSS [14], and GLM [68] have also made substantial contributions to the field. These models achieve high performance and are open-sourced, serving as valuable resources for training large models and as foundations for further fine-tuning for specific purposes. For instance, Alpaca [45] introduces a self-instruct framework that facilitates instruction tuning of the LLaMA model, reducing the reliance on human-written instruction data. Recently, the emergence of these LLMs has also opened up API-based applications for solving vision-centric tasks. These applications have integrated visual APIs with language models to enable decision-making or planning based on visual information, such as Visual ChatGPT [60], MM-REACT [65], HuggingGPT [42], InternGPT [32], and VideoChat [28]. However, despite the convenience of using language-based instructions to define tasks and describe visual elements, these interactive systems [60, 65, 42, 32, 28] still face limitations in capturing fine-grained visual details and understanding complex visual contexts, which hinder their ability to effectively connecting vision and language models. In summary, while LLMs have shown tremendous potential in various NLP applications, their applicability to vision-centric tasks has been limited by the challenges posed by modalities and task formats.
|
| 91 |
+
|
| 92 |
+
# 2.2 Vision Generalist Model
|
| 93 |
+
|
| 94 |
+
The pursuit of generalist models [74, 33, 62], which aim to handle a wide range of tasks using a shared architecture and parameters, has been a long-standing goal in the machine learning community. Inspired by the success of sequence-to-sequence (seq2seq) models in the field of NLP [38], recent advancements such as OFA [50], Flamingo [1], and GIT [49] propose modeling diverse tasks as sequence generation tasks. Unified-IO [33], Pix2Seq v2 [8], and UniTab [63] extend this idea by using discrete coordinate tokens to encode and decode spatial information for more tasks. Gato [39] also incorporates reinforcement learning tasks into the seq2seq framework, while GPV [19] develops a general-purpose vision system by combining a seq2seq module with a DETR-based visual encoder [6]. However, these methods suffer from some limitations, such as slow inference speed and performance degradation due to the non-parallel auto-regressive decoding process. Uni-Perceivers [74, 72, 26] solve these issues by unifying different tasks using the maximum likelihood target for each input based on representation similarity, regardless of their modality, making it possible to support both generation and non-generation tasks in a unified framework. Nevertheless, these generalist models are still restricted by pre-defined tasks and cannot support flexible open-ended task customization based on language instructions like LLMs.
|
| 95 |
+
|
| 96 |
+
# 2.3 Instruction Tuning
|
| 97 |
+
|
| 98 |
+
Language instructions are a powerful way to express various NLP tasks and examples for LLMs, as introduced by GPT-3 [5]. Following this idea, subsequent works, such as InstructGPT [36], FLAN [13, 59], and OPT-IML [23], explore the instruction-tuning method [58, 57] and demonstrate that this simple approach effectively enhances the zero-shot and few-shot capabilities of LLMs. The language instruction paradigm has also been adopted by the computer vision community to define image-to-text tasks. Flamingo [1] is a milestone work that uses vision and language inputs as prompts and achieves remarkable few-shot results in various vision-language tasks, such as image captioning [9] and VQA [2]. BLIP-2 [27] further connects the visual encoder with LLMs through a querying transformer and a linear projection layer to build strong multimodal models. MiniGPT-4 [71] and LLaVA [30] finetune the BLIP-2-style models on synthetic multimodal instruction-following data to unleash the potential of LLMs. However, these models mainly focus on image-to-text tasks and fail to address visual perception, such as object detection, instance segmentation, pose estimation, etc. To tackle image inpainting tasks, Bar et al. [3] introduces the first visual prompting framework that utilizes inpainting with discrete tokens on images. Painter [55] and SegGPT [56] employ masked image modeling on raw pixels for in-context learning with paired images. While these visual prompt models demonstrate good results in segmentation tasks, their applicability to numerous real-world vision tasks is challenging. Moreover, defining the visual prompts as image inpainting is inconsistent with the language instructions in LLMs, hard to leverage the reasoning, parsing ability, and world knowledge of LLMs. In this work, we aim to align vision-centric tasks with language tasks, use language instructions to unifiedly and flexibly define all tasks, and solve them with a shared LLM-based task decoder.
|
| 99 |
+
|
| 100 |
+
# 3 VisionLLM
|
| 101 |
+
|
| 102 |
+
# 3.1 Overall Architecture
|
| 103 |
+
|
| 104 |
+
This work targets to provide a unified generalist framework that can seamlessly integrate the strengths of large language models (LLMs) with the specific requirements of vision-centric tasks. As shown in Figure 3, the overall architecture of VisionLLM consists of three key designs: (1) a unified language instruction that provides a consistent interface for vision-centric task definition and customization; (2) a language-guided image tokenizer, which encodes visual information in alignment with the given language prompt, enabling the model to comprehend and parse the visual content effectively; and (3) an LLM-based open-task decoder, which utilizes the encoded visual information and language instructions to generate satisfactory predictions or outputs. The three designs work together to achieve a flexible and open-ended framework that can handle various vision-centric tasks at different levels of task customization through language instructions.
|
| 105 |
+
|
| 106 |
+
Vision-language example: "Describe the image <image> in details." Language Instructions <text> Vision-only example: "For each object in image <image> that is a member of class set <class>, output a tuple with the class label and the coordinates of a polygon with 16 points that encloses the object. The coordinates should be within range <range>. The output format should be (c, x1, y1, ...)."
|
| 107 |
+
|
| 108 |
+

|
| 109 |
+
Figure 3: Overall architecture of the proposed VisionLLM. It consists of three parts: a unified language instruction designed to accommodate both vision and vision-language tasks, an image tokenizer that encodes visual information guided by language instructions, and an LLM-based openended task decoder that executes diverse tasks defined by language instructions.
|
| 110 |
+
|
| 111 |
+
Different from previous interactive systems [60, 65, 42, 32, 28] that rely on APIs, our VisionLLM presents a more flexible and end-to-end pipeline. Given language instructions that describe the current tasks and an input image, the model first uses a language-guided image tokenizer to encode the image tokens based on the given prompt. Then, the image tokens and language instructions are fed to an LLM-based open-ended task decoder. Finally, it evaluates the generated outputs against the task definition given by the unified language instructions, enabling the model to produce task-specific results. This seamless, end-to-end pipeline enables VisionLLM to effectively combine vision and language, achieving remarkable performance in open-ended and customizable vision-centric tasks.
|
| 112 |
+
|
| 113 |
+
# 3.2 Unified Language Instruction
|
| 114 |
+
|
| 115 |
+
We first introduce unified language instructions to describe vision-centric tasks. This design enables the unification of various vision-only and vision-language task descriptions and allows for flexible task customization.
|
| 116 |
+
|
| 117 |
+
Vision-Language Tasks. The instructions for vision-language tasks such as image captioning and visual question answering (VQA) are straightforward and similar to NLP tasks. Following previous methods [27, 74, 30], we describe the image captioning task like “The image is <image>. Please generate a caption for the image: ”, and the VQA task like “The image is <image>. Please generate an answer for the image according to the question: <question>”. Here, <image> and <question> are the placeholders of the image tokens and the question, respectively. The image tokens are directly placed at the placeholder <image>.
|
| 118 |
+
|
| 119 |
+
Vision-Only Tasks. Designing effective language instructions for vision tasks is a challenging endeavor due to the differences in modality and task format between vision and language. Here, we describe vision tasks by providing a task description and specifying the desired output format via language instructions.
|
| 120 |
+
|
| 121 |
+
(1) The task description conveys the intended task to the language model. Following self-instruct [57], we design a set of seed instructions with placeholders and employ LLMs to generate a large number of related task descriptions and randomly select one of them during training.
|
| 122 |
+
|
| 123 |
+
(2) For conventional visual perception tasks like object detection and instance segmentation, we propose a unified output format represented as a tuple $( C , P )$ , where $C$ denotes the class index in the category set <class>, and $\bar { P } = \{ x _ { i } , y _ { i } \} _ { i = 1 } ^ { N }$ represents $N$ points that locate the object. To align with the format of word tokens, both the class index and the coordinates of points $x _ { i } , y _ { i }$ are transformed into discretized tokens. Specifically, the class index is an integer starting from 0, and the continuous coordinates of the points are uniformly discretized into an integer within the range [-<range>, <range>]. For object detection and visual grounding tasks, the point number $N$ is equal to 2, representing the the top-left and bottom-right points of object’s bounding box. In the case of instance segmentation, we employ multiple $( N > 8 )$ ) points along the object boundary to represent an instance mask [61]. Other perception tasks such as pose estimation (keypoint detection) can also be formulated as language instructions in this way.
|
| 124 |
+
|
| 125 |
+
An example of language instruction for the instance segmentation task is as follows: “Segment all the objects of category set <class> within the <range> of the image and generate a list of the format (c, x1, y1, $x 2$ , y2, ..., x8, y8). Here, c represents the index of the class label starting from $O$ , and $( x I$ , y1, x2, y2, ..., x8, y8) correspond to the offsets of boundary points of the object relative to the center point. The image is: <image>”.
|
| 126 |
+
|
| 127 |
+
# 3.3 Language-Guided Image Tokenizer
|
| 128 |
+
|
| 129 |
+
VisionLLM considers images as a kind of foreign language and converts them into token representations. Unlike previous works [16, 52, 31] that utilize fixed-size patch embeddings to represent images, we introduce the language-guided image tokenizer to flexibly encode visual information that aligns with task-specific language prompts or instructions.
|
| 130 |
+
|
| 131 |
+
Specifically, give an image $\mathbf { X } \in \mathbb { R } ^ { H \times W \times 3 }$ with height $H$ and width $W$ , we first feed it to the image backbones (e.g., ResNet [21]) and extract visual features $F _ { v }$ of four different scales. Additionally, we leverage a text encoder (e.g., BERT [15]) to extract the language features $F _ { l }$ from given prompts. The language features are then injected into each scale of visual features through crossattention [47], yielding multi-scale language-aware visual features, enabling the alignment of features across modalities.
|
| 132 |
+
|
| 133 |
+
Afterward, we propose to adopt a transformer-based network (e.g., Deformable DETR [73]) with $M$ random-initialized queries $Q ^ { \dot { } } = \{ q _ { i } \} _ { i = 1 } ^ { M }$ to capture the high-level information of images. We build the transformer-based network on top of the multi-scale language-aware visual features to extract $M$ image tokens $T = \{ ( e _ { i } , l _ { i } ) \} _ { i = 1 } ^ { M }$ , each of which is represented by an embedding $e _ { i }$ and a location $l _ { i }$ denoting the semantic and positional information of the token. This design not only represents the images independent of input resolution but also extracts the visual representation that is informative with respect to the language prompts.
|
| 134 |
+
|
| 135 |
+
# 3.4 LLM-based Open-Ended Task Decoder
|
| 136 |
+
|
| 137 |
+
We build our decoder on Alpaca [45], an LLM that is adapted from LLaMA [46], to handle various vision-related tasks with language guidance. However, Alpaca has some inherent drawbacks for vision-centric tasks, such as (1) It only has a few digit tokens (e.g., $0 { \sim } 9$ ) in its vocabulary, which restricts its ability to locate objects by numbers; (2) It uses multiple tokens to represent the category name, resulting in an inefficient scheme in object classification; and (3) It is a causal model that is inefficient for visual perception tasks.
|
| 138 |
+
|
| 139 |
+
To tackle these issues, we expand the vocabulary of LLM with additional tokens specially designed for vision-centric tasks. First, we add a set of location tokens, denoted as $\{ < \mathtt { p } - 5 1 2 >$ , ..., $\mathtt { < p 0 > }$ , ..., $\mathsf { < p 5 1 2 > } \}$ , where ${ \tt A p i > }$ represents the discretized offset of $i \in [ - 5 1 2 , 5 1 2 ]$ to the location $l _ { i }$ of the image token, and the relative value to image height or width is equal to $i / 5 1 2$ . These tokens successfully transform the object localization task from continuous variable prediction to more unified discrete bin classification. Second, we introduce semantics-agnostic classification tokens $\{ < \mathsf { c o } > , < \mathsf { c } 1 > , . . . , < \mathsf { c } 5 1 1 > \}$ to replace category name tokens, which overcomes the inefficiency of using multiple tokens to represent categories. The mapping between category names and the classification tokens is flexibly provided in the category set <class> of language instructions, such as $\{ " \mathtt { p e r s o n " } : < \mathtt { c 0 } >$ , "car": ${ < } c 1 >$ , "black cat": $\mathbf { < c } 2 > , \mathbf { \ldots } \}$ . This design allows our model to select the appropriate category name from the provided category set, facilitating efficient and accurate object classification.
|
| 140 |
+
|
| 141 |
+
Moreover, to address the inefficiency caused by the causal framework, we introduce outputformat-as-query decoding. We first use LLMs to parse the structural output format from the task instructions (e.g., “<cls> <x1> <y1> $< \tt x 2 >$ $\mathrm { < y } 2 \mathrm { > } ^ { \mathrm { , } \mathrm { , } }$ for object detection, “<bos>” for image captioning), and then feed the tokens of structural output format as queries to the decoder to generate the desired output according to the queries. This simple method enables our model to not only avoid inefficient token-by-token decoding in visual perception tasks, but also keep a unified framework for vision-language tasks.
|
| 142 |
+
|
| 143 |
+

|
| 144 |
+
Figure 4: Illustration of the “output-format-asquery” decoding process. $\bf \ddot { \sigma } < c l s > < x 1 > < y 1 > \tau . . . \dot { \sigma }$ ” denote the queries of the object’s class index and boundary points, and “<bos>” denotes the beginning of string.
|
| 145 |
+
|
| 146 |
+
Note that, during both the training and inference phases in the object detection task, we input 100 sets of $\mathrm { ^ { * * } { < } x l s > < x l > < y l > < x 2 > < y 2 > " }$ to the decoder, generating 100 object predictions. Those predictions with higher confidence scores will be retained, adhering to a common practice of the object detection task.
|
| 147 |
+
|
| 148 |
+
In this way, the output of object location and classification is formulated as a foreign language, thus unifying these vision-centric tasks into the format of token classification. Therefore, both vision-language and vision-only tasks can be supervised with the cross-entropy loss like language tasks. In addition, for efficient training, we adopt the Low-Rank Adaptation (LoRA) approach [22], which allows us to train and fine-tune the models without excessive computational costs. We set the LoRA rank to 64 and use LoRA on the QKVO (Query, Key, Value, and Output) in the attention layers. It also acts as a bridge between the language and visual tokens, facilitating effective alignment between the two modalities, ensuring better task customization, and improving the convergence of the overall system.
|
| 149 |
+
|
| 150 |
+
# 4 Experiment
|
| 151 |
+
|
| 152 |
+
# 4.1 Implementation Details.
|
| 153 |
+
|
| 154 |
+
We implement two variants of VisionLLM with two image backbones, i.e., ResNet [21] and InternImage-H [51]. For the language-guided image tokenizer, we adopt BERT-Large [4] as the text encoder and Deformable DETR (D-DETR) [73] to capture high-level information. For the LLM, we employ Alpaca-7B [45], a LLaMA [46] model fine-tuned with instructions, and equip it with LoRA [22] for parameter-efficient fine-tuning.
|
| 155 |
+
|
| 156 |
+
The model is trained in two stages. In the first stage, we initialize the model with the pre-trained weights of D-DETR and BERT, and train the visual backbone and language-guided image tokenizer to produce language-aware visual features. In the second stage, we connect the image tokenizer with Alpaca-7B and introduce the unified supervision of multiple tasks. We freeze the visual backbone while freezing most parameters of the LLM except a few LoRA parameters. More details on the experimental setup can be found in Sec. B of the supplementary material.
|
| 157 |
+
|
| 158 |
+
# 4.2 Task-Level Customization
|
| 159 |
+
|
| 160 |
+
We first evaluate the task-level customization capability of VisionLLM. VisionLLM supports coarsegrained task customization, including visual perception tasks and visual-language tasks. Table 1 presents the evaluation results on four standard vision-centric tasks, including object detection, instance segmentation, visual grounding, and image captioning. We compare our model with taskspecific methods as well as recently-proposed vision generalist models. Note that, unless specifically mentioned, the results of our model come from a shared-parameter generalist model and switch different tasks by changing the language instructions only. Detailed instructions could be found in the supplementary material.
|
| 161 |
+
|
| 162 |
+
Object Detection. Object detection is a fundamental computer vision task that involves identifying and localizing objects of interest within an image. Our method achieves comparable or higher results to others, $4 4 . 6 \ \mathrm { m A P } ,$ with a ResNet-50 [21] backbone. With the same backbone i.e. ResNet-50, our method outperforms Pix2Seq [7] by $1 . 4 \mathrm { m A P }$ , which also discretizes the output coordinates to integers. Furthermore, benefiting from the output-format-as-query framework (see Sec. 3.4), we can decode multiple predictions in parallel during inference, making our approach more efficient. Using InternImage-H [51] as the visual backbone, we obtained $6 0 . 2 \%$ mAP, which is close to the current state-of-the-art detection-specific model [51], demonstrating the scalability of our generalist model.
|
| 163 |
+
|
| 164 |
+
Visual Grounding. Visual grounding associates textual descriptions with corresponding regions or objects within an image. Training visual grounding and object detection can potentially conflict with each other, as object detection aims to detect all the objects, while visual grounding should only localize the referred object and suppress other objects. Benefiting from our unified task instructions and the strong instruction comprehension capabilities of LLMs, our model performs both tasks effectively and achieves a result of $8 0 . 6 \ : \mathrm { P } @ 0 . 5$ for visual grounding. With InternImage-H as the backbone, we achieve $8 6 . 7 \ : \mathrm { P } @ 0 . 5$ on the validation set of RefCOCO.
|
| 165 |
+
|
| 166 |
+
Instance Segmentation. Instance segmentation involves identifying and segmenting individual objects within an image. We employ a flexible number of points (i.e., $8 \sim 2 4 )$ along the object boundary to represent an instance mask. Compared to mainstream models specific to instance segmentation, our model has a comparable mask $\mathrm { { A P } _ { 5 0 } }$ ( $6 1 . 2 \%$ with InternImage-H [51]) but relatively low mask $\mathsf { A P } _ { 7 5 }$ . This gap could potentially arise from factors as follows: (1) We discretize the output coordinates to integers for unifying tasks, which introduces information loss; (2) Due to the memory and computational constraint, the number of points in our model is limited, which also results in a performance drop; and (3) Point-based methods typically yield lower results compared to direct mask prediction methods, such as Mask R-CNN [20].
|
| 167 |
+
|
| 168 |
+
Table 1: Results on standard vision-centric tasks. “sep” indicates that the model is separately trained on each task.
|
| 169 |
+
Table 2: Experiments of object-level and output format customization. We conduct these experiments based on VisionLLM-R50, and report the performance of box AP and mask AP on COCO minival for (a) and (b), respectively. “#Classes” and “#Points” indicate the number of classes and boundary points, respectively. “\*” indicates that we report the mean AP of the given classes, e.g., 10 classes.
|
| 170 |
+
|
| 171 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Backbone</td><td rowspan="2">Open- Ended</td><td colspan="2">Detection</td><td colspan="2"></td><td colspan="2">Instance Seg. Grounding</td><td colspan="2">Captioning</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>AP AP50 AP75 AP AP50 AP75P@0.5</td><td>BLEU-4CIDEr</td><td></td></tr><tr><td>Specialist Models</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>FasterR-CNN-FPN[40]</td><td>ResNet-50</td><td>X</td><td>40.3 61.0</td><td></td><td>)44.0</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>DETR-DC5 [6]</td><td>ResNet-50</td><td>×</td><td>43.3 63.1</td><td></td><td>45.9</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Deformable-DETR[73]</td><td>ResNet-50</td><td>X</td><td>45.7 65.0</td><td></td><td>49.1</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Mask R-CNN[20]</td><td>ResNet-50</td><td>X</td><td>41.0 61.7</td><td></td><td></td><td></td><td>44.9 37.1 58.4 40.1</td><td></td><td></td><td></td></tr><tr><td>Polar Mask [61]</td><td>ResNet-50</td><td>X</td><td>=</td><td></td><td></td><td></td><td>30.5 52.0 31.1</td><td></td><td></td><td></td></tr><tr><td>Pix2Seq[7]</td><td>ResNet-50</td><td>X</td><td>43.2 61.0 46.1</td><td></td><td></td><td></td><td>=</td><td></td><td></td><td></td></tr><tr><td>UNITER[10]</td><td>ResNet-101</td><td>X</td><td>-</td><td></td><td>=</td><td></td><td>=</td><td>81.4</td><td></td><td></td></tr><tr><td>VILLA [18]</td><td>ResNet-101</td><td>X</td><td></td><td></td><td></td><td></td><td></td><td>82.4</td><td></td><td></td></tr><tr><td>MDETR[25]</td><td>ResNet-101</td><td>X</td><td></td><td></td><td></td><td></td><td></td><td>86.8</td><td></td><td></td></tr><tr><td>BEiT-3 [53]</td><td>ViT-g</td><td>X</td><td></td><td></td><td></td><td></td><td></td><td>-</td><td></td><td>147.6</td></tr><tr><td>VL-T5 [12]</td><td>T5-B</td><td>X</td><td></td><td></td><td></td><td></td><td></td><td>1</td><td></td><td>116.5</td></tr><tr><td colspan="9">GeneralistModels</td><td></td><td></td></tr><tr><td>UniTab [64]</td><td>ResNet-101</td><td>X</td><td></td><td></td><td></td><td></td><td></td><td>88.6</td><td>=</td><td>115.8</td></tr><tr><td>Uni-Perceiver[74]</td><td>ViT-B</td><td>X</td><td></td><td></td><td></td><td></td><td></td><td>-</td><td>32.0</td><td>=</td></tr><tr><td>Uni-Perceiver-MoE[72]</td><td>ViT-B</td><td>X</td><td></td><td></td><td></td><td></td><td></td><td>=</td><td>33.2</td><td>=</td></tr><tr><td>Uni-Perceiver-V2 [26]</td><td>Swin-B</td><td>X</td><td>58.6</td><td></td><td></td><td>50.6</td><td></td><td>=</td><td>35.4</td><td>116.9</td></tr><tr><td>Pix2Seq v2 [8]</td><td>ViT-B</td><td>X</td><td>46.5</td><td></td><td></td><td>38.2</td><td></td><td>1</td><td>34.9</td><td></td></tr><tr><td>VisionLLM-R50sep</td><td>ResNet-50</td><td>X</td><td>44.8 64.1 48.5 25.2 50.6 22.4</td><td></td><td></td><td></td><td></td><td>84.4</td><td>30.8</td><td>112.4</td></tr><tr><td>VisionLLM-R50</td><td>ResNet-50</td><td></td><td>44.6 64.0 4</td><td></td><td></td><td>48.1 25.1 50.0 22.4</td><td></td><td>80.6</td><td>31.0</td><td>112.5</td></tr><tr><td>VisionLLM-H</td><td>InternImage-H</td><td></td><td>60.2 79.3 65.8 30.6 61.2 27.6</td><td></td><td></td><td></td><td></td><td>86.7</td><td>32.1</td><td>114.2</td></tr></table>
|
| 172 |
+
|
| 173 |
+
(a) Object-level customization.
|
| 174 |
+
|
| 175 |
+
<table><tr><td>#Classes</td><td>AP</td><td>AP50</td><td>AP75 APs</td><td>APM</td><td>APL</td></tr><tr><td>10*</td><td>48.9</td><td>72.6</td><td>51.2</td><td>31.7 47.5</td><td>67.3</td></tr><tr><td>20*</td><td>52.7</td><td>73.6</td><td>56.8</td><td>31.8 53.2</td><td>70.5</td></tr><tr><td>40*</td><td>49.3</td><td>70.7</td><td>53.2</td><td>33.1 53.6</td><td>63.8</td></tr><tr><td>80*</td><td>44.6</td><td>64.0</td><td>48.1</td><td>26.7 47.9</td><td>60.5</td></tr></table>
|
| 176 |
+
|
| 177 |
+
(b) Output format customization.
|
| 178 |
+
|
| 179 |
+
<table><tr><td>#Points</td><td>AP</td><td>AP50</td><td>AP75 APs</td><td>APM</td><td>APL</td></tr><tr><td>8</td><td>18.5</td><td>45.7</td><td>11.6</td><td>9.9 19.7</td><td>28.7</td></tr><tr><td>14</td><td>22.9</td><td>48.3</td><td>19.4</td><td>11.0 25.1</td><td>36.0</td></tr><tr><td>16</td><td>24.2</td><td>49.9</td><td>20.9</td><td>11.5 26.3</td><td>36.8</td></tr><tr><td>24</td><td>25.1</td><td>50.0</td><td>22.4</td><td>12.5 27.4</td><td>38.2</td></tr></table>
|
| 180 |
+
|
| 181 |
+
Image Captioning. We also evaluate our model in a representative vision-language task, i.e. image captioning task, and report the BLEU-4 [37] and CIDEr [48] metrics. Note that we do not adopt the CIDEr optimization [41]. We can observe that VisionLLM achieves competitive performance to previous methods. With ResNet-50, we obtain a BLEU-4 score of 31.0 and a CIDEr score of 112.5. When using InternImage-H as the backbone, our model achieves a comparable BLEU-4 score of 32.1 and a CIDEr score of 114.2. These results demonstrate the effectiveness of VisionLLM in generating descriptive and contextually relevant captions for images.
|
| 182 |
+
|
| 183 |
+
# 4.3 Object-Level & Output Format Customization
|
| 184 |
+
|
| 185 |
+
Our VisionLLM not only allows for customizing the task description, but also for adjusting the target object and the output format using language instructions. Here, we evaluate our model’s fine-grained customization ability on COCO. In particular, to customize the target object, we modify the <class> in language instructions to change the model’s recognition target from 10 classes to 80 classes. Likewise, to customize the output format, we modify the number of points in language instructions to change the task output format. Table 2 shows that our method can perform well for both object-level and output format changes.
|
| 186 |
+
|
| 187 |
+
(a) Effect of text encoder in the language-guided image tokenizer.
|
| 188 |
+
|
| 189 |
+
<table><tr><td>W/BERT</td><td>Freeze</td><td>COCO</td><td>RefCOCO</td></tr><tr><td>1</td><td>1</td><td>44.7</td><td>48.1</td></tr><tr><td>√</td><td></td><td>44.8</td><td>84.1</td></tr><tr><td>√</td><td>√</td><td>1.3</td><td>34.3</td></tr></table>
|
| 190 |
+
|
| 191 |
+
Table 3: Ablation studies on language-guided image tokenizer and hyper-parameters.
|
| 192 |
+
(c) Effect of the number of bins (#Bins).
|
| 193 |
+
|
| 194 |
+
<table><tr><td>#Bins</td><td>AP</td></tr><tr><td>257</td><td>34.9</td></tr><tr><td>513</td><td>40.8</td></tr><tr><td>1025</td><td>44.8</td></tr><tr><td>2049</td><td>44.8</td></tr></table>
|
| 195 |
+
|
| 196 |
+
(b) Effect of image tokenization method.
|
| 197 |
+
|
| 198 |
+
<table><tr><td>Tokenization</td><td>AP</td></tr><tr><td>Average Pooling Ours</td><td>23.1 44.8</td></tr></table>
|
| 199 |
+
|
| 200 |
+
# 4.4 Ablation Study
|
| 201 |
+
|
| 202 |
+
In this section, we analyze the effect of key components and hyper-parameters on VisionLLM. Unless otherwise specified, we use ResNet-50 [21] backbone and perform the ablation experiments for object detection tasks with random classes and task descriptions on COCO2017 [29].
|
| 203 |
+
|
| 204 |
+
Single Task vs. Multiple Tasks. We perform an ablation study to assess the impact of multi-task learning with language instructions on VisionLLM. As shown in Table 1, the single-task trained model VisionLLM- $\cdot \mathrm { R } 5 0 _ { \mathrm { s e p } }$ is slightly better than the jointly trained model VisionLLM-R50 except image captioning. This is due to the multitasking conflicts that also affect previous generalist models [74, 72], and it reflects a trade-off between accuracy and generalization.
|
| 205 |
+
|
| 206 |
+
Text Encoder in Language-Guided Image Tokenizer. We examine the role of text encoder (i.e., BERT) in our language-guided image tokenizer in Table 3a, where we report the results for object detection and visual grounding. The first two rows show that BERT is not essential for object detection but it is crucial for visual grounding. We also investigate the effect of freezing the text encoder during training. The last row indicates that freezing BERT hinders the alignment of vision and language modalities and thus degrades the performance for both tasks.
|
| 207 |
+
|
| 208 |
+
Image Tokenization Method. As a comparison to our query-based tokenization, we employ average pooling on the feature maps from the D-DETR encoder to obtain $M$ patch embeddings, which serve as token representations for the image. Results in Table 3b indicate a clear advantage of our method. This is due to its ability to capture information from objects of various sizes in a more flexible way.
|
| 209 |
+
|
| 210 |
+
Number of Localization Tokens. We vary the number of localization tokens from 257 (i.e., - $1 2 8 \mathrm { \sim } 1 2 8 $ ) to 2049 (i.e., - $- 1 0 2 4 { \sim } 1 0 2 4 )$ , to investigate its impact on visual perception performance. As presented in Table 3c, the model consistently exhibits improvement as the number of localization tokens increases until it reaches a saturation point. Remarkably, a substantial performance boost is observed when the number is raised from 257 to 1025 $+ 9 . 9$ AP). These results indicate that a higher number of localization tokens enables the models to achieve finer localization abilities, thereby improving localization accuracy.
|
| 211 |
+
|
| 212 |
+
# 5 Conclusion
|
| 213 |
+
|
| 214 |
+
In this paper, we have presented VisionLLM, a novel framework that leverages the power of large language models (LLMs) to address vision-centric tasks in an open-ended and customizable manner. We have designed unified language instruction that matches the format of language models and covers various vision-centric tasks including visual perception. We have also developed a language-guided image tokenizer and an LLM-based task decoder that can handle open-ended tasks according to the given language instructions. We have verified the effectiveness of our models on a series of tasks with different granularities, demonstrating their remarkable generality and flexibility.
|
| 215 |
+
|
| 216 |
+
Broader Impact. We envision that this work will promote the fusion of visual and language tasks. In addition, since our work is built on open-source pre-trained vision foundation models and large language models, requiring low training resources, thus reducing the carbon footprint. We do not foresee obvious undesirable ethical/social impacts at this moment.
|
| 217 |
+
|
| 218 |
+
# Acknowledgement
|
| 219 |
+
|
| 220 |
+
The work is supported by the National Key R&D Program of China (NO. 2022ZD0161300), the National Natural Science Foundation of China (Grant No. 62376134, 61672273, 61832008, 62372223), the Shanghai Committee of Science and Technology (Grant No. 21DZ1100100), and the Fundamental Research Funds for the Central Universities (No. XJ2023000701).
|
| 221 |
+
|
| 222 |
+
References
|
| 223 |
+
[1] Jean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech, Iain Barr, Yana Hasson, Karel Lenc, Arthur Mensch, Katie Millican, Malcolm Reynolds, et al. Flamingo: a visual language model for few-shot learning. arXiv preprint arXiv:2204.14198, 2022. 1, 4
|
| 224 |
+
[2] Stanislaw Antol, Aishwarya Agrawal, Jiasen Lu, Margaret Mitchell, Dhruv Batra, C Lawrence Zitnick, and Devi Parikh. Vqa: Visual question answering. In Proceedings of the IEEE International Conference on Computer Vision, 2015. 4
|
| 225 |
+
[3] Amir Bar, Yossi Gandelsman, Trevor Darrell, Amir Globerson, and Alexei Efros. Visual prompting via image inpainting. Advances in Neural Information Processing Systems, 2022. 4
|
| 226 |
+
[4] Gedas Bertasius, Heng Wang, and Lorenzo Torresani. Is space-time attention all you need for video understanding? In International Conference on Machine Learning, 2021. 7
|
| 227 |
+
[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, 2020. 3, 4
|
| 228 |
+
[6] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In European Conference on Computer Vision, 2020. 3, 4, 8
|
| 229 |
+
[7] Ting Chen, Saurabh Saxena, Lala Li, David J Fleet, and Geoffrey Hinton. Pix2seq: A language modeling framework for object detection. arXiv preprint arXiv:2109.10852, 2021. 7, 8
|
| 230 |
+
[8] Ting Chen, Saurabh Saxena, Lala Li, Tsung-Yi Lin, David J Fleet, and Geoffrey Hinton. A unified sequence interface for vision tasks. arXiv preprint arXiv:2206.07669, 2022. 4, 8
|
| 231 |
+
[9] Xinlei Chen, Hao Fang, Tsung-Yi Lin, Ramakrishna Vedantam, Saurabh Gupta, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco captions: Data collection and evaluation server. arXiv preprint arXiv:1504.00325, 2015. 4
|
| 232 |
+
[10] Yen-Chun Chen, Linjie Li, Licheng Yu, Ahmed El Kholy, Faisal Ahmed, Zhe Gan, Yu Cheng, and Jingjing Liu. Uniter: Universal image-text representation learning. In Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part XXX. Springer, 2020. 8
|
| 233 |
+
[11] Zhe Chen, Yuchen Duan, Wenhai Wang, Junjun He, Tong Lu, Jifeng Dai, and Yu Qiao. Vision transformer adapter for dense predictions. In International Conference on Learning Representations, 2023. 1
|
| 234 |
+
[12] Jaemin Cho, Jie Lei, Hao Tan, and Mohit Bansal. Unifying vision-and-language tasks via text generation. In International Conference on Machine Learning, 2021. 8
|
| 235 |
+
[13] Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Eric Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, et al. Scaling instruction-finetuned language models. arXiv preprint arXiv:2210.11416, 2022. 4
|
| 236 |
+
[14] MOSS contributors. Moss. https://github.com/OpenLMLab/MOSS, 2023. 3
|
| 237 |
+
[15] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018. 6
|
| 238 |
+
[16] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations, 2021. 6
|
| 239 |
+
[17] Yuxin Fang, Wen Wang, Binhui Xie, Quan Sun, Ledell Wu, Xinggang Wang, Tiejun Huang, Xinlong Wang, and Yue Cao. Eva: Exploring the limits of masked visual representation learning at scale. arXiv preprint arXiv:2211.07636, 2022. 1
|
| 240 |
+
[18] Zhe Gan, Yen-Chun Chen, Linjie Li, Chen Zhu, Yu Cheng, and Jingjing Liu. Large-scale adversarial training for vision-and-language representation learning. Advances in Neural Information Processing Systems, 2020. 8
|
| 241 |
+
[19] Tanmay Gupta, Amita Kamath, Aniruddha Kembhavi, and Derek Hoiem. Towards general purpose vision systems. arXiv preprint arXiv:2104.00743, 2021. 4
|
| 242 |
+
[20] Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask r-cnn. In Proceedings of the IEEE/CVF International Conference on Computer Vision, 2017. 3, 8
|
| 243 |
+
[21] 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. 6, 7, 9
|
| 244 |
+
[22] Edward J Hu, Yelong Shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. Lora: Low-rank adaptation of large language models. arXiv preprint arXiv:2106.09685, 2021. 7
|
| 245 |
+
[23] Srinivasan Iyer, Xi Victoria Lin, Ramakanth Pasunuru, Todor Mihaylov, Dániel Simig, Ping Yu, Kurt Shuster, Tianlu Wang, Qing Liu, Punit Singh Koura, et al. Opt-iml: Scaling language model instruction meta learning through the lens of generalization. arXiv preprint arXiv:2212.12017, 2022. 4
|
| 246 |
+
[24] Menglin Jia, Luming Tang, Bor-Chun Chen, Claire Cardie, Serge Belongie, Bharath Hariharan, and Ser-Nam Lim. Visual prompt tuning. In European Conference on Computer Vision, 2022. 1, 2
|
| 247 |
+
[25] Aishwarya Kamath, Mannat Singh, Yann LeCun, Gabriel Synnaeve, Ishan Misra, and Nicolas Carion. Mdetr-modulated detection for end-to-end multi-modal understanding. In Proceedings of the IEEE/CVF International Conference on Computer Vision, 2021. 8
|
| 248 |
+
[26] Hao Li, Jinguo Zhu, Xiaohu Jiang, Xizhou Zhu, Hongsheng Li, Chun Yuan, Xiaohua Wang, Yu Qiao, Xiaogang Wang, Wenhai Wang, et al. Uni-perceiver v2: A generalist model for large-scale vision and vision-language tasks. arXiv preprint arXiv:2211.09808, 2022. 4, 8
|
| 249 |
+
[27] Junnan Li, Dongxu Li, Silvio Savarese, and Steven Hoi. Blip-2: Bootstrapping language-image pre-training with frozen image encoders and large language models. arXiv preprint arXiv:2301.12597, 2023. 4, 5
|
| 250 |
+
[28] KunChang Li, Yinan He, Yi Wang, Yizhuo Li, Wenhai Wang, Ping Luo, Yali Wang, Limin Wang, and Yu Qiao. Videochat: Chat-centric video understanding. arXiv preprint arXiv:2305.06355, 2023. 2, 3, 5
|
| 251 |
+
[29] 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. Springer, 2014. 9
|
| 252 |
+
[30] Haotian Liu, Chunyuan Li, Qingyang Wu, and Yong Jae Lee. Visual instruction tuning. arXiv preprint arXiv:2304.08485, 2023. 4, 5
|
| 253 |
+
[31] 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, 2021. 6
|
| 254 |
+
[32] Zhaoyang Liu, Yinan He, Wenhai Wang, Weiyun Wang, Yi Wang, Shoufa Chen, Qinglong Zhang, Yang Yang, Qingyun Li, Jiashuo Yu, et al. Interngpt: Solving vision-centric tasks by interacting with chatbots beyond language. arXiv preprint arXiv:2305.05662, 2023. 2, 3, 5
|
| 255 |
+
[33] Jiasen Lu, Christopher Clark, Rowan Zellers, Roozbeh Mottaghi, and Aniruddha Kembhavi. Unified-io: A unified model for vision, language, and multi-modal tasks. arXiv preprint arXiv:2206.08916, 2022. 4
|
| 256 |
+
[34] OpenAI. Gpt-4 technical report. arXiv, 2023. 3
|
| 257 |
+
[35] TB OpenAI. Chatgpt: Optimizing language models for dialogue. OpenAI, 2022. 1, 3
|
| 258 |
+
[36] Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems, 2022. 3, 4
|
| 259 |
+
[37] Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th annual meeting of the Association for Computational Linguistics, 2002. 8
|
| 260 |
+
[38] Alec Radford, Karthik Narasimhan, Tim Salimans, Ilya Sutskever, et al. Improving language understanding by generative pre-training. 2018. 1, 4
|
| 261 |
+
[39] Scott Reed, Konrad Zolna, Emilio Parisotto, Sergio Gomez Colmenarejo, Alexander Novikov, Gabriel Barth-Maron, Mai Gimenez, Yury Sulsky, Jackie Kay, Jost Tobias Springenberg, et al. A generalist agent. arXiv preprint arXiv:2205.06175, 2022. 4
|
| 262 |
+
[40] 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. 8
|
| 263 |
+
[41] Steven J Rennie, Etienne Marcheret, Youssef Mroueh, Jerret Ross, and Vaibhava Goel. Self-critical sequence training for image captioning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2017. 8
|
| 264 |
+
[42] Yongliang Shen, Kaitao Song, Xu Tan, Dongsheng Li, Weiming Lu, and Yueting Zhuang. Hugginggpt: Solving ai tasks with chatgpt and its friends in huggingface. arXiv preprint arXiv:2303.17580, 2023. 2, 3, 5
|
| 265 |
+
[43] Weijie Su, Xizhou Zhu, Chenxin Tao, Lewei Lu, Bin Li, Gao Huang, Yu Qiao, Xiaogang Wang, Jie Zhou, and Jifeng Dai. Towards all-in-one pre-training via maximizing multi-modal mutual information. In Proceedings of the IEEE/CVF International Conference on Computer Vision, 2023. 1
|
| 266 |
+
[44] Chenxin Tao, Xizhou Zhu, Gao Huang, Yu Qiao, Xiaogang Wang, and Jifeng Dai. Siamese image modeling for self-supervised vision representation learning. arXiv preprint arXiv:2206.01204, 2022. 1
|
| 267 |
+
[45] Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B Hashimoto. Alpaca: A strong, replicable instruction-following model. Stanford Center for Research on Foundation Models. https://crfm. stanford. edu/2023/03/13/alpaca. html, 2023. 3, 6, 7
|
| 268 |
+
[46] Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023. 3, 6, 7
|
| 269 |
+
[47] 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. 6
|
| 270 |
+
[48] Ramakrishna Vedantam, C Lawrence Zitnick, and Devi Parikh. Cider: Consensus-based image description evaluation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2015. 8
|
| 271 |
+
[49] Jianfeng Wang, Zhengyuan Yang, Xiaowei Hu, Linjie Li, Kevin Lin, Zhe Gan, Zicheng Liu, Ce Liu, and Lijuan Wang. Git: A generative image-to-text transformer for vision and language. arXiv preprint arXiv:2205.14100, 2022. 1, 4
|
| 272 |
+
[50] Peng Wang, An Yang, Rui Men, Junyang Lin, Shuai Bai, Zhikang Li, Jianxin Ma, Chang Zhou, Jingren Zhou, and Hongxia Yang. Unifying architectures, tasks, and modalities through a simple sequence-tosequence learning framework. arXiv preprint arXiv:2202.03052, 2022. 1, 4
|
| 273 |
+
[51] Wenhai Wang, Jifeng Dai, Zhe Chen, Zhenhang Huang, Zhiqi Li, Xizhou Zhu, Xiaowei Hu, Tong Lu, Lewei Lu, Hongsheng Li, et al. Internimage: Exploring large-scale vision foundation models with deformable convolutions. In Proceedings of the IEEE/CVF International Conference on Computer Vision, 2023. 1, 2, 7, 8
|
| 274 |
+
[52] Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pvt v2: Improved baselines with pyramid vision transformer. Computational Visual Media, 8(3):415–424, 2022. 6
|
| 275 |
+
[53] Wenhui Wang, Hangbo Bao, Li Dong, Johan Bjorck, Zhiliang Peng, Qiang Liu, Kriti Aggarwal, Owais Khan Mohammed, Saksham Singhal, Subhojit Som, et al. Image as a foreign language: Beit pretraining for all vision and vision-language tasks. arXiv preprint arXiv:2208.10442, 2022. 1, 2, 8
|
| 276 |
+
[54] Xinlong Wang, Wen Wang, Yue Cao, Chunhua Shen, and Tiejun Huang. Images speak in images: A generalist painter for in-context visual learning. arXiv preprint arXiv:2212.02499, 2022. 1, 2
|
| 277 |
+
[55] Xinlong Wang, Wen Wang, Yue Cao, Chunhua Shen, and Tiejun Huang. Images speak in images: A generalist painter for in-context visual learning. arXiv preprint arXiv:2212.02499, 2022. 4
|
| 278 |
+
[56] Xinlong Wang, Xiaosong Zhang, Yue Cao, Wen Wang, Chunhua Shen, and Tiejun Huang. Seggpt: Segmenting everything in context. arXiv preprint arXiv:2304.03284, 2023. 2, 4
|
| 279 |
+
[57] Yizhong Wang, Yeganeh Kordi, Swaroop Mishra, Alisa Liu, Noah A Smith, Daniel Khashabi, and Hannaneh Hajishirzi. Self-instruct: Aligning language model with self generated instructions. arXiv preprint arXiv:2212.10560, 2022. 4, 5
|
| 280 |
+
[58] Yizhong Wang, Swaroop Mishra, Pegah Alipoormolabashi, Yeganeh Kordi, Amirreza Mirzaei, Anjana Arunkumar, Arjun Ashok, Arut Selvan Dhanasekaran, Atharva Naik, David Stap, et al. Benchmarking generalization via in-context instructions on $1 { , } 6 0 0 { + }$ language tasks. arXiv preprint arXiv:2204.07705, 2022. 4
|
| 281 |
+
[59] Jason Wei, Maarten Bosma, Vincent Y Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M Dai, and Quoc V Le. Finetuned language models are zero-shot learners. arXiv preprint arXiv:2109.01652, 2021. 4
|
| 282 |
+
[60] Chenfei Wu, Shengming Yin, Weizhen Qi, Xiaodong Wang, Zecheng Tang, and Nan Duan. Visual chatgpt: Talking, drawing and editing with visual foundation models. arXiv preprint arXiv:2303.04671, 2023. 2, 3, 5
|
| 283 |
+
[61] Enze Xie, Peize Sun, Xiaoge Song, Wenhai Wang, Xuebo Liu, Ding Liang, Chunhua Shen, and Ping Luo. Polarmask: Single shot instance segmentation with polar representation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2020. 5, 8
|
| 284 |
+
[62] Bin Yan, Yi Jiang, Jiannan Wu, Dong Wang, Ping Luo, Zehuan Yuan, and Huchuan Lu. Universal instance perception as object discovery and retrieval. arXiv preprint arXiv:2303.06674, 2023. 4
|
| 285 |
+
[63] Zhengyuan Yang, Zhe Gan, Jianfeng Wang, Xiaowei Hu, Faisal Ahmed, Zicheng Liu, Yumao Lu, and Lijuan Wang. Unitab: Unifying text and box outputs for grounded vision-language modeling. In European Conference on Computer Vision, pages 521–539. Springer, 2022. 4
|
| 286 |
+
[64] Zhengyuan Yang, Zhe Gan, Jianfeng Wang, Xiaowei Hu, Faisal Ahmed, Zicheng Liu, Yumao Lu, and Lijuan Wang. Unitab: Unifying text and box outputs for grounded vision-language modeling. In European Conference on Computer Vision, 2022. 8
|
| 287 |
+
[65] Zhengyuan Yang, Linjie Li, Jianfeng Wang, Kevin Lin, Ehsan Azarnasab, Faisal Ahmed, Zicheng Liu, Ce Liu, Michael Zeng, and Lijuan Wang. Mm-react: Prompting chatgpt for multimodal reasoning and action. arXiv preprint arXiv:2303.11381, 2023. 2, 3, 5
|
| 288 |
+
[66] Yuan Yao, Ao Zhang, Zhengyan Zhang, Zhiyuan Liu, Tat-Seng Chua, and Maosong Sun. Cpt: Colorful prompt tuning for pre-trained vision-language models. arXiv preprint arXiv:2109.11797, 2021. 1
|
| 289 |
+
[67] Yuhang Zang, Wei Li, Kaiyang Zhou, Chen Huang, and Chen Change Loy. Unified vision and language prompt learning. arXiv preprint arXiv:2210.07225, 2022. 1
|
| 290 |
+
[68] Aohan Zeng, Xiao Liu, Zhengxiao Du, Zihan Wang, Hanyu Lai, Ming Ding, Zhuoyi Yang, Yifan Xu, Wendi Zheng, Xiao Xia, et al. Glm-130b: An open bilingual pre-trained model. arXiv preprint arXiv:2210.02414, 2022. 3
|
| 291 |
+
[69] 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. 3
|
| 292 |
+
[70] Yuanhan Zhang, Kaiyang Zhou, and Ziwei Liu. Neural prompt search. arXiv preprint arXiv:2206.04673, 2022. 1
|
| 293 |
+
[71] Deyao Zhu, Jun Chen, Xiaoqian Shen, Xiang Li, and Mohamed Elhoseiny. Minigpt-4: Enhancing visionlanguage understanding with advanced large language models. arXiv preprint arXiv:2304.10592, 2023. 4
|
| 294 |
+
[72] Jinguo Zhu, Xizhou Zhu, Wenhai Wang, Xiaohua Wang, Hongsheng Li, Xiaogang Wang, and Jifeng Dai. Uni-perceiver-moe: Learning sparse generalist models with conditional moes. arXiv preprint arXiv:2206.04674, 2022. 1, 4, 8, 9
|
| 295 |
+
[73] Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, and Jifeng Dai. Deformable detr: Deformable transformers for end-to-end object detection. In International Conference on Learning Representations, 2021. 3, 6, 7, 8
|
| 296 |
+
[74] Xizhou Zhu, Jinguo Zhu, Hao Li, Xiaoshi Wu, Hongsheng Li, Xiaohua Wang, and Jifeng Dai. Uniperceiver: Pre-training unified architecture for generic perception for zero-shot and few-shot tasks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2022. 2, 4, 5, 8, 9
|
md/dev/WLEx3Jo4QaB/WLEx3Jo4QaB.md
ADDED
|
@@ -0,0 +1,473 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# GRAPH CONDENSATION FOR GRAPH NEURAL NETWORKS
|
| 2 |
+
|
| 3 |
+
Wei Jin ∗ Michigan State University jinwei2@msu.edu
|
| 4 |
+
|
| 5 |
+
Lingxiao Zhao Carnegie Mellon University lingxiao@cmu.edu
|
| 6 |
+
|
| 7 |
+
Shichang Zhang
|
| 8 |
+
UCLA
|
| 9 |
+
shichang@cs.ucla.edu Yozen Liu
|
| 10 |
+
Snap Inc.
|
| 11 |
+
yliu2@snap.com
|
| 12 |
+
|
| 13 |
+
Jiliang Tang Michigan State University tangjili@msu.edu
|
| 14 |
+
|
| 15 |
+
Neil Shah
|
| 16 |
+
Snap Inc.
|
| 17 |
+
nshah@snap.com
|
| 18 |
+
|
| 19 |
+
# ABSTRACT
|
| 20 |
+
|
| 21 |
+
Given the prevalence of large-scale graphs in real-world applications, the storage and time for training neural models have raised increasing concerns. To alleviate the concerns, we propose and study the problem of graph condensation for graph neural networks (GNNs). Specifically, we aim to condense the large, original graph into a small, synthetic and highly-informative graph, such that GNNs trained on the small graph and large graph have comparable performance. We approach the condensation problem by imitating the GNN training trajectory on the original graph through the optimization of a gradient matching loss and design a strategy to condense node features and structural information simultaneously. Extensive experiments have demonstrated the effectiveness of the proposed framework in condensing different graph datasets into informative smaller graphs. In particular, we are able to approximate the original test accuracy by $9 5 . 3 \%$ on Reddit, $9 9 . 8 \%$ on Flickr and $9 9 . 0 \%$ on Citeseer, while reducing their graph size by more than $9 9 . 9 \%$ , and the condensed graphs can be used to train various GNN architectures. Code is released at https://github.com/ChandlerBang/GCond.
|
| 22 |
+
|
| 23 |
+
# 1 INTRODUCTION
|
| 24 |
+
|
| 25 |
+
Many real-world data can be naturally represented as graphs such as social networks, chemical molecules, transportation networks, and recommender systems (Battaglia et al., 2018; Wu et al., 2019b; Zhou et al., 2018). As a generalization of deep neural networks for graph-structured data, graph neural networks (GNNs) have achieved great success in capturing the abundant information residing in graphs and tackle various graph-related applications (Wu et al., 2019b; Zhou et al., 2018).
|
| 26 |
+
|
| 27 |
+
However, the prevalence of large-scale graphs in real-world scenarios, often on the scale of millions of nodes and edges, poses significant computational challenges for training GNNs. More dramatically, the computational cost continues to increase when we need to retrain the models multiple times, e.g., under incremental learning settings, hyperparameter and neural architecture search. To address this challenge, a natural idea is to properly simplify, or reduce the graph so that we can not only speed up graph algorithms (including GNNs) but also facilitate storage, visualization and retrieval for associated graph data analysis tasks.
|
| 28 |
+
|
| 29 |
+
There are two main strategies to simplify graphs: graph sparsification (Peleg & Schaffer ¨ , 1989; Spielman & Teng, 2011) and graph coarsening (Loukas & Vandergheynst, 2018; Loukas, 2019) . Graph sparsification approximates a graph with a sparse graph by reducing the number of edges, while graph coarsening directly reduces the number of nodes by replacing the original node set with its subset. However, these methods have some shortcomings: (1) sparsification becomes much less promising in simplifying graphs when nodes are also associated with attributes as sparsification does not reduce the node attributes; (2) the goal of sparsification and coarsening is to preserve some graph properties such as principle eigenvalues (Loukas & Vandergheynst, 2018) that could be not optimal for the downstream performance of GNNs. In this work, we ask if it is possible to significantly reduce the graph size while providing sufficient information to well train GNN models.
|
| 30 |
+
|
| 31 |
+

|
| 32 |
+
Figure 1: We study the graph condensation problem, which seeks to learn a small, synthetic graph, features and labels $\{ { \bf A } ^ { \prime } , { \bf X } ^ { \prime } , { \bf Y } ^ { \prime } \}$ from a large, original dataset $\{ \mathbf { A } , \mathbf { X } , \mathbf { Y } \}$ , which can be used to train GNN models that generalize comparably to the original. Shown: An illustration of our proposed GCOND graph condensation approach’s empirical performance, which exhibits $9 5 . 3 \%$ of original graph test performance with $9 9 . 9 \%$ data reduction.
|
| 33 |
+
|
| 34 |
+
Motivated by dataset distillation (Wang et al., 2018) and dataset condensation (Zhao et al., 2021) which generate a small set of images to train deep neural networks on the downstream task, we aim to condense a given graph through learning a synthetic graph structure and node attributes. Correspondingly, we propose the task of graph condensation1. It aims to minimize the performance gap between GNN models trained on a synthetic, simplified graph and the original training graph. In this work, we focus on attributed graphs and the node classification task. We show that we are able to reduce the number of graph nodes to as low as $0 . 1 \%$ while training various GNN architectures to reach surprisingly good performance on the synthetic graph. For example, in Figure 1, we condense the graph of the Reddit dataset with 153,932 training nodes into only 154 synthetic nodes together with their connections. In essence, we face two challenges for graph condensation: (1) how to formulate the objective for graph condensation tractable for learning; and (2) how to parameterize the to-be-learned node features and graph structure. To address the above challenges, we adapt the gradient matching scheme in (Zhao et al., 2021) and match the gradients of GNN parameters w.r.t. the condensed graph and original graph. In this way, the GNN trained on condensed graph can mimic the training trajectory of that on real data. Further, we carefully design the strategy for parametrizations for the condensed graph. In particular, we introduce the strategy of parameterizing the condensed features as free parameters and model the synthetic graph structure as a function of features, which takes advantage of the implicit relationship between structure and node features, consumes less number of parameters and offers better performance.
|
| 35 |
+
|
| 36 |
+
Our contributions can be summarized as follows:
|
| 37 |
+
|
| 38 |
+
1. We make the first attempt to condense a large-real graph into a small-synthetic graph, such that the GNN models trained on the large graph and small graph have comparable performance. We introduce a proposed framework for graph condensation (GCOND) which parameterizes the condensed graph structure as a function of condensed node features, and leverages a gradient matching loss as the condensation objective.
|
| 39 |
+
2. Through extensive experimentation, we show that GCOND is able to condense different graph datasets and achieve comparable performance to their larger counterparts. For instance, GCOND approximates the original test accuracy by $9 5 . 3 \%$ on Reddit, $9 9 . 8 \%$ on Flickr and $9 9 . 0 \%$ on Citeseer, while reducing their graph size by more than $9 9 . 9 \%$ . Our approach consistently outperforms coarsening, coreset and dataset condensation baselines.
|
| 40 |
+
3. We show that the condensed graphs can generalize well to different GNN test models. Additionally, we observed reliable correlation of performances between condensed dataset training and whole-dataset training in the neural architecture search (NAS) experiments.
|
| 41 |
+
|
| 42 |
+
# 2 RELATED WORK
|
| 43 |
+
|
| 44 |
+
Dataset Distillation & Condensation. Dataset distillation (DD) (Wang et al., 2018; Bohdal et al., 2020; Nguyen et al., 2021) aims to distill knowledge of a large training dataset into a small synthetic dataset, such that a model trained on the synthetic set is able to obtain the comparable performance to that of a model trained on the original dataset. To improve the efficiency of DD, dataset condensation (DC) (Zhao et al., 2021; Zhao & Bilen, 2021) is proposed to learn the small synthetic dataset by matching the gradients of the network parameters w.r.t. large-real and small-synthetic training data. However, these methods are designed exclusively for image data and are not applicable to non-Euclidean graph-structured data where samples (nodes) are interdependent. In this work, we generalize the problem of dataset condensation to graph domain and we seek to jointly learn the synthetic node features as well as graph structure. Additionally, our work relates to coreset methods (Welling, 2009; Sener & Savarese, 2018; Rebuffi et al., 2017), which seek to find informative samples from the original datasets. However, they rely on the presence of representative samples, and tend to give suboptimal performance.
|
| 45 |
+
|
| 46 |
+
Graph Sparsification & Coarsening. Graph sparsification and coarsening are two means of reducing the size of a graph. Sparsification reduces the number of edges while approximating pairwise distances (Peleg & Schaffer ¨ , 1989), cuts (Karger, 1999) or eigenvalues (Spielman & Teng, 2011) while coarsening reduces the number of nodes with similar constraints (Loukas & Vandergheynst, 2018; Loukas, 2019; Deng et al., 2020), typically by grouping original nodes into super-nodes, and defining their connections. Cai et al. (2021) proposes a GNN-based framework to learn these connections to improve coarsening quality. Huang et al. (2021b) adopts coarsening as a preprocessing method to help scale up GNNs. Graph condensation also aims to reduce the number of nodes, but aims to learn synthetic nodes and connections in a supervised way, rather than unsupervised grouping as in these prior works. Graph pooling is also related to our work, but it targets at improving graph-level representation learning (see Appendix D).
|
| 47 |
+
|
| 48 |
+
Graph Neural Networks. Graph neural networks (GNNs) are a modern way to capture the intuition that inferences for individual samples (nodes) can be enhanced by utilizing graph-based information from neighboring nodes (Kipf & Welling, 2017; Hamilton et al., 2017; Klicpera et al., 2019; Velickovic et al., 2018; Wu et al., 2019b;a; Liu et al., 2020; 2021; You et al., 2021; Zhou et al., 2021; Zhao et al., 2022). Due to their prevalence, various real-world applications have been tremendously facilitated including recommender systems (Ying et al., 2018a; Fan et al., 2019), computer vision (Li et al., 2019) and drug discovery (Duvenaud et al., 2015).
|
| 49 |
+
|
| 50 |
+
Graph Structure Learning. Our work is also related to graph structure learning, which explores methods to learn graphs from data. One line of work (Dong et al., 2016; Egilmez et al., 2017) learns graphs under certain structural constraints (e.g. sparsity) based on graph signal processing. Recent efforts aim to learn graphs by leveraging GNNs (Franceschi et al., 2019; Jin et al., 2020; Chen et al., 2020). However, these methods are incapable of learning graphs with smaller size, and are thus not applicable for graph condensation.
|
| 51 |
+
|
| 52 |
+
# 3 METHODOLOGY
|
| 53 |
+
|
| 54 |
+
In this section, we present our proposed graph condensation framework, GCOND. Consider that we have a graph dataset $\mathcal { T } = \{ { \bf A } , { \bf X } , { \bf Y } \}$ , where $\mathbf { A } \in \mathbb { R } ^ { N \times N }$ is the adjacency matrix, $N$ is the number of nodes, $\mathbf { \hat { X } } \in \mathbb { R } ^ { N \times d }$ is the $d$ -dimensional node feature matrix and $\mathbf { Y } \in \{ 0 , \ldots , C - 1 \} ^ { N }$ denotes the node labels over $C$ classes. Graph condensation aims to learn a small, synthetic graph dataset ${ \cal S } = \{ { \bf A } ^ { \prime } , { \bf X } ^ { \prime } , { \bf Y } ^ { \prime } \}$ with $\mathbf { \Psi } _ { \mathbf { A } ^ { \prime } } \in \mathbb { R } ^ { N ^ { \prime } \times \bar { N } ^ { \prime } } , \mathbf { X } ^ { \prime } \in \mathbb { R } ^ { N ^ { \prime } \times D } , \mathbf { Y } ^ { \prime } \in \{ 0 , \dots , C - 1 \} ^ { \bar { N } ^ { \prime } }$ and $N ^ { \prime } \ll N$ , such that a GNN trained on $s$ can achieve comparable performance to one trained on the much larger $\tau$ . Thus, the objective can be formulated as the following bi-level problem,
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
\operatorname* { m i n } _ { \mathcal { S } } \mathcal { L } \left( \mathrm { G N N } _ { \theta _ { \mathcal { S } } } ( \mathbf { A } , \mathbf { X } ) , \mathbf { Y } \right) \quad \mathrm { ~ s . t ~ } \quad \theta _ { \mathcal { S } } = \operatorname* { a r g m i n } _ { \theta } \mathcal { L } ( \mathrm { G N N } _ { \theta } ( \mathbf { A } ^ { \prime } , \mathbf { X } ^ { \prime } ) , \mathbf { Y } ^ { \prime } ) ,
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
where $\mathrm { G N N } _ { \theta }$ denotes the GNN model parameterized with $\pmb \theta$ , $\theta _ { \mathcal { S } }$ denotes the parameters of the model trained on $s$ , and $\mathcal { L }$ denotes the loss function used to measure the difference between model predictions and ground truth, i.e. cross-entropy loss. However, optimizing the above objective can lead to overfitting on a specific model initialization. To generate condensed data that generalizes to a distribution of random initializations $P _ { \theta _ { 0 } }$ , we rewrite the objective as follows:
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
\operatorname* { m i n } _ { \mathcal { S } } \mathrm { E } _ { \theta _ { 0 } \sim P _ { \theta _ { 0 } } } \left[ \mathcal { L } \left( \mathrm { G N N } _ { \theta _ { \mathcal { S } } } ( \mathbf { A } , \mathbf { X } ) , \mathbf { Y } \right) \right] \quad \mathrm { ~ s . t . ~ } \quad \theta _ { \mathcal { S } } = \operatorname* { a r g m i n } _ { \theta } \mathcal { L } \big ( \mathrm { G N N } _ { \theta ( \theta _ { 0 } ) } ( \mathbf { A } ^ { \prime } , \mathbf { X } ^ { \prime } ) , \mathbf { Y } ^ { \prime } \big ) .
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
where $\pmb \theta ( \pmb \theta _ { 0 } )$ indicates that $\pmb { \theta }$ is a function acting on $\pmb { \theta } _ { 0 }$ . Note that the setting discussed above is for inductive learning where all the nodes are labeled and test nodes are unseen during training. We can easily generalize graph condensation to transductive setting by assuming $\mathbf { Y }$ is partially labeled.
|
| 67 |
+
|
| 68 |
+
# 3.1 GRAPH CONDENSATION VIA GRADIENT MATCHING
|
| 69 |
+
|
| 70 |
+
To tackle the optimization problem in Eq. (2), one strategy is to compute the gradient of $\mathcal { L }$ w.r.t $s$ and optimize $s$ via gradient descent, as in dataset distillation (Wang et al., 2018). However, this requires solving a nested loop optimization and unrolling the whole training trajectory of the inner problem, which can be prohibitively expensive. To bypass the bi-level optimization, we follow the gradient matching method proposed in (Zhao et al., 2021) which aims to match the network parameters w.r.t. large-real and small-synthetic training data by matching their gradients at each training step. In this way, the training trajectory on small-synthetic data $s$ can mimic that on the large-real data $\tau$ , i.e., the models trained on these two datasets converge to similar solutions (parameters). Concretely, the parameter matching process for GNNs can be modeled as follows:
|
| 71 |
+
|
| 72 |
+
$$
|
| 73 |
+
\begin{array} { r l } & { \quad \quad \operatorname* { m i n } _ { \mathcal { S } } \mathrm { E } _ { \theta _ { 0 } \sim P _ { \theta _ { 0 } } } \left[ \sum _ { t = 0 } ^ { T - 1 } D \left( \theta _ { t } ^ { S } , \theta _ { t } ^ { T } \right) \right] \quad \mathrm { w i t h } \quad } \\ & { \theta _ { t + 1 } ^ { S } = \mathrm { o p t } _ { \theta } \left( \mathcal { L } \left( \mathrm { G N N } _ { \theta _ { t } ^ { S } } ( \mathbf { A } ^ { \prime } , \mathbf { X } ^ { \prime } ) , \mathbf { Y } ^ { \prime } \right) \right) \mathrm { ~ a n d ~ } \theta _ { t + 1 } ^ { T } = \mathrm { o p t } _ { \theta } \left( \mathcal { L } \left( \mathrm { G N N } _ { \theta _ { t } ^ { T } } ( \mathbf { A } , \mathbf { X } ) , \mathbf { Y } \right) \right) } \end{array}
|
| 74 |
+
$$
|
| 75 |
+
|
| 76 |
+
where $D ( \cdot , \cdot )$ is a distance function, $T$ is the number of steps of the whole training trajectory, $\mathrm { o p t } _ { \theta }$ is the update rule for model parameters, and ${ \boldsymbol { \theta } } _ { t } ^ { S }$ , $\theta _ { t } ^ { \mathcal { T } }$ denote the model parameters trained on $s$ and $\tau$ at time step $t$ , respectively. Since our goal is to match the parameters step by step, we then consider one-step gradient descent for the update rule $\mathrm { o p t } _ { \theta }$ :
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
\begin{array} { r l } { \mathbf { \sigma } _ { t + 1 } ^ { S } \theta _ { t } ^ { S } - \eta \nabla _ { \theta } \mathcal { L } ( \mathrm { G N N } _ { \theta _ { t } ^ { S } } ( \mathbf { A } ^ { \prime } , \mathbf { X } ^ { \prime } ) , \mathbf { Y } ^ { \prime } ) } & { \mathrm { ~ a n d ~ } \theta _ { t + 1 } ^ { T } \theta _ { t } ^ { T } - \eta \nabla _ { \theta } \mathcal { L } ( \mathrm { G N N } _ { \theta _ { t } ^ { T } } ( \mathbf { A } , \mathbf { X } ) , \mathbf { Y } ) } \end{array}
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
where $\eta$ is the learning rate for the gradient descent. Based on the observation made in Zhao et al. (2021) that the distance between ${ \boldsymbol { \theta } } _ { t } ^ { \bar { S } }$ and $\pmb { \theta } _ { t } ^ { \mathcal { T } }$ is typically small, we can simplify the objective as a gradient matching process as follows,
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
\operatorname* { m i n } _ { \mathcal { S } } \mathrm { E } _ { \theta _ { 0 } \sim P _ { \theta _ { 0 } } } \left[ \sum _ { t = 0 } ^ { T - 1 } D \left( \nabla _ { \theta } \mathcal { L } \left( \mathrm { G N N } _ { \theta _ { t } } ( \mathbf { A } ^ { \prime } , \mathbf { X } ^ { \prime } ) , \mathbf { Y } ^ { \prime } \right) , \nabla _ { \theta } \mathcal { L } \left( \mathrm { G N N } _ { \theta _ { t } } ( \mathbf { A } , \mathbf { X } ) , \mathbf { Y } \right) \right) \right]
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
where ${ \boldsymbol { \theta } } _ { t } ^ { S }$ and $\pmb { \theta } _ { t } ^ { \mathcal { T } }$ are replaced by $\theta _ { t }$ , which is trained on the small-synthetic graph. The distance $D$ is further defined as the sum of the distance $d i s$ at each layer. Given two gradients $\mathbf { G } ^ { \mathcal { S } } \in \mathbb { R } ^ { d _ { 1 } \times d _ { 2 } }$ and $\mathbf { G } ^ { \mathcal { T } } \in \mathbb { R } ^ { d _ { 1 } \times d _ { 2 } }$ at a specific layer, the distance $d i s ( \cdot , \cdot )$ used for condensation is defined as follows,
|
| 89 |
+
|
| 90 |
+
$$
|
| 91 |
+
d i s ( \mathbf { G } ^ { S } , \mathbf { G } ^ { T } ) = \sum _ { i = 1 } ^ { d _ { 2 } } \left( 1 - \frac { \mathbf { G } _ { \mathbf { i } } ^ { S } \cdot \mathbf { G } _ { \mathbf { i } } ^ { T } } { \left\| \mathbf { G } _ { \mathbf { i } } ^ { S } \right\| \left\| \mathbf { G } _ { \mathbf { i } } ^ { T } \right\| } \right)
|
| 92 |
+
$$
|
| 93 |
+
|
| 94 |
+
where $\mathbf { G _ { i } ^ { \mathcal { S } } } , \mathbf { G _ { i } ^ { \mathcal { T } } }$ are the $i$ -th column vectors of the gradient matrices. With the above formulations, we are able to achieve parameter matching through an efficient strategy of gradient matching.
|
| 95 |
+
|
| 96 |
+
We note that jointly learning the three variables $\mathbf { A } ^ { \prime } , \mathbf { X } ^ { \prime }$ and $\mathbf { Y } ^ { \prime }$ is highly challenging, as they are interdependent. Hence, to simplify the problem, we fix the node labels $\mathbf { Y } ^ { \prime }$ while keeping the class distribution the same as the original labels $\mathbf { Y }$ .
|
| 97 |
+
|
| 98 |
+
Graph Sampling. GNNs are often trained in a full-batch manner (Kipf & Welling, 2017; Wu et al., 2019b). However, as suggested by previous works that reconstruct data from gradients (Zhu et al., 2019), large batch size tends to make reconstruction more difficult because more variables are involved during optimization. To make things worse, the computation cost of GNNs gets expensive on large graphs as the forward pass of GNNs involves the aggregation of enormous neighboring nodes. To address the above issues, we sample a fixed-size set of neighbors on the original graph in each aggregation layer of GNNs and adopt a mini-batch training strategy. To further reduce memory usage and ease optimization, we calculate the gradient matching loss for nodes from different classes separately, as matching the gradients w.r.t. the data from a single class is easier than that from all classes. Specifically, for a given class $c$ , we sample a batch of nodes of class $c$ together with a portion of their neighbors from large-real data $\tau$ . We denote the process as $( \mathbf { A } _ { c } , \mathbf { \bar { X } } _ { c } , \mathbf { Y } _ { c } ) \sim \mathcal { T }$ . For the condensed graph $\mathbf { A } ^ { \prime }$ , we sample a batch of synthetic nodes of class $c$ but do not sample their neighbors. In other words, we use all of their neighbors, i.e., all other nodes, during the aggregation process, since we need to learn the connections with other nodes. We denote the process as $\mathbf { \bar { \rho } } ( \mathbf { A } _ { c } ^ { 7 } , \mathbf { X } _ { c } ^ { \prime } , \mathbf { \bar { Y } } _ { c } ^ { \prime } ) \sim \mathcal { S }$ .
|
| 99 |
+
|
| 100 |
+
# 3.2 MODELING CONDENSED GRAPH DATA
|
| 101 |
+
|
| 102 |
+
One essential challenge in the graph condensation problem is how to model the condensed graph data and resolve dependency among nodes. The most straightforward way is to treat both $\mathbf { A } ^ { \prime }$ and $\mathbf { X } ^ { \prime }$ as free parameters. However, the number of parameters in $\mathbf { A } ^ { \prime }$ grows quadratically as $N ^ { \prime }$ increases. The increased model complexity can pose challenges in optimizing the framework and increase the risk of overfitting. Therefore, it is desired to parametrize the condensed adjacency matrix in a way where the number of parameters does not grow too fast. On the other hand, treating $\mathbf { A } ^ { \prime }$ and $\mathbf { X } ^ { \prime }$ as independent parameters overlooks the implicit correlations between graph structure and features, which have been widely acknowledged in the literature (III et al., 2014; Shalizi & Thomas, 2011); e.g., in social networks, users interact with others based on their interests, while in e-commerce, users purchase products due to certain product attributes. Hence, we propose to model the condensed graph structure as a function of the condensed node features:
|
| 103 |
+
|
| 104 |
+
$$
|
| 105 |
+
\mathbf { A } ^ { \prime } = g _ { \Phi } ( \mathbf { X } ^ { \prime } ) , \qquad \mathrm { w i t h ~ } \mathbf { A } _ { i j } ^ { \prime } = \mathrm { S i g m o i d } \left( \frac { \mathbf { M } \mathrm { L P } _ { \Phi } ( [ \mathbf { x } _ { i } ^ { \prime } ; \mathbf { x } _ { j } ^ { \prime } ] ) + \mathbf { M } \mathrm { L P } _ { \Phi } ( [ \mathbf { x } _ { j } ^ { \prime } ; \mathbf { x } _ { i } ^ { \prime } ] ) } { 2 } \right)
|
| 106 |
+
$$
|
| 107 |
+
|
| 108 |
+
where $\mathrm { M L P _ { \Phi } }$ is a multi-layer neural network parameterized with $\Phi$ and $[ \cdot ; \cdot ]$ denotes concatenation. In Eq. (7), we intentionally control ${ \bf A } _ { i j } ^ { \prime } = { \bf A } _ { j i } ^ { \prime }$ to make the condensed graph structure symmetric since we are mostly dealing with symmetric graphs. It can also adjust to asymmetric graphs by setting $\mathbf { A } _ { i j } ^ { \prime } = \operatorname { S i g m o i d } ( \mathbf { M L } \mathbf { \bar { P } } _ { \Phi } ( [ \mathbf { x } _ { i } ; \mathbf { \bar { x } } _ { j } ^ { \prime } ] )$ . Then we rewrite our objective as
|
| 109 |
+
|
| 110 |
+
$$
|
| 111 |
+
\underset { { \bf { X } ^ { \prime } } , \Phi } { \operatorname* { m i n } } { \cal { E } } _ { \theta _ { 0 } \sim P _ { \theta _ { 0 } } } [ \sum _ { t = 0 } ^ { T - 1 } D ( \nabla _ { \theta } \mathcal { L } ( { \mathrm { G N N } } _ { \theta _ { t } } ( g _ { \Phi } ( { \bf { X } ^ { \prime } } ) , { \bf { X } ^ { \prime } } ) , { \bf { Y } ^ { \prime } } ) , \nabla _ { \theta } \mathcal { L } ( { \mathrm { G N N } } _ { \theta _ { t } } ( { \bf { A } } , { \bf { X } } ) , { \bf { Y } } ) ) ]
|
| 112 |
+
$$
|
| 113 |
+
|
| 114 |
+
Note that there are two clear benefits of the above formulation over the na¨ıve one (free parameters). Firstly, the number of parameters for modeling graph structure no longer depends on the number of nodes, hence avoiding jointly learning $O ( \bar { N } ^ { \bar { \prime } ^ { 2 } } )$ parameters; as a result, when $N ^ { \prime }$ gets larger, GCOND suffers less risk of overfitting. Secondly, if we want to grow the synthetic graph by adding more synthetic nodes condensed from real graph, the trained $\mathrm { M L P _ { \Phi } }$ can be employed to infer the connections of new synthetic nodes, and hence we only need to learn their features.
|
| 115 |
+
|
| 116 |
+
Alternating Optimization Schema. Jointly optimizing $\mathbf { X } ^ { \prime }$ and $\Phi$ is often challenging as they are directly affecting each other. Instead, we propose to alternatively optimize $\mathbf { X } ^ { \prime }$ and $\Phi$ : we update $\Phi$ for the first $\tau _ { 1 }$ epochs and then update $\mathbf { X } ^ { \prime }$ for $\tau _ { 2 }$ epochs; the process is repeated until the stopping condition is met – we find empirically that this does better as shown in Appendix C.
|
| 117 |
+
|
| 118 |
+
Sparsification. In the learned condensed adjacency matrix $\mathbf { A } ^ { \prime }$ , there can exist some small values which have little effect on the aggregation process in GNNs but still take up a certain amount of storage (e.g. 4 bytes per float). Thus, we remove the entries whose values are smaller than a given threshold $\delta$ to promote sparsity of the learned $\mathbf { A } ^ { \prime }$ . We further justify that suitable choices of $\delta$ for sparsification do not degrade performance a lot in Appendix C.
|
| 119 |
+
|
| 120 |
+
The detailed algorithm can be found in Algorithm 1 in Appendix B. In detail, we first set the condensed label set $\mathbf { Y } ^ { \prime }$ to fixed values and initialize $\mathbf { X } ^ { \prime }$ as node features randomly selected from each class. In each outer loop, we sample a GNN model initialization $\pmb \theta$ from a distribution $P _ { \theta }$ . Then, for each class we sample the corresponding node batches from $\tau$ and $s$ , and calculate the gradient matching loss within each class. The sum of losses from different classes are used to update $\mathbf { X } ^ { \prime }$ or $\Phi$ . After that we update the GNN parameters for $\tau _ { \theta }$ epochs. When finishing the updating of condensed graph parameters, we use $\mathbf { A } ^ { \prime } = \operatorname { R e L U } ( g _ { \Phi } ( \mathbf { X } ^ { \prime } ) - \delta )$ to obtain the final sparsified graph structure.
|
| 121 |
+
|
| 122 |
+
A “Graphless” Model Variant. We now explore another parameterization for the condensed graph data. We provide a model variant named GCOND-X that only learns the condensed node features $\mathbf { X } ^ { \prime }$ without learning the condensed structure $\mathbf { A } ^ { \prime }$ . In other words, we use a fixed identity matrix I as the condensed graph structure. Specifically, this model variant aims to match the gradients of GNN parameters on the large-real data $( \mathbf { A } , \mathbf { X } )$ and small-synthetic data $( \mathbf { I } , \mathbf { X } ^ { \prime } )$ . Although GCOND-X is unable to learn the condensed graph structure which can be highly useful for downstream data analysis, it still shows competitive performance in Table 2 in the experiments because the features are learned to incorporate relevant information from the graph via the matching loss.
|
| 123 |
+
|
| 124 |
+
# 4 EXPERIMENTS
|
| 125 |
+
|
| 126 |
+
In this section, we design experiments to validate the effectiveness of the proposed framework GCOND. We first introduce experimental settings, then compare GCOND against representative baselines with discussions and finally show some advantages of GCOND.
|
| 127 |
+
|
| 128 |
+
# 4.1 EXPERIMENTAL SETUP
|
| 129 |
+
|
| 130 |
+
Datasets. We evaluate the condensation performance of the proposed framework on three transductive datasets, i.e., Cora, Citeseer (Kipf & Welling, 2017) and Ogbn-arxiv (Hu et al., 2020), and two inductive datasets, i.e., Flickr (Zeng et al., 2020) and Reddit (Hamilton et al., 2017). We use the public splits for all the datasets. For the inductive setting, we follow the setup in (Hamilton et al., 2017) where the test graph is not available during training. Dataset statistics are shown in Appendix A.
|
| 131 |
+
|
| 132 |
+
Baselines. We compare our proposed methods to five baselines: (i) one graph coarsening method (Loukas, 2019; Huang et al., 2021b), (ii-iv) three coreset methods (Random, Herding (Welling, 2009) and $K \cdot$ -Center (Farahani & Hekmatfar, 2009; Sener & Savarese, 2018)), and (v) dataset condensation (DC). For the graph coarsening method, we adopt the variation neighborhoods method implemented by Huang et al. (2021b). For coreset methods, we first use them to select nodes from the original dataset and induce a subgraph from the selected nodes to serve as the reduced graph. In Random, the nodes are randomly selected. The Herding method, which is often used in continual learning (Rebuffi et al., 2017; Castro et al., 2018), picks samples that are closest to the cluster center. K-Center selects the center samples to minimize the largest distance between a sample and its nearest center. We use the implementations provided by Zhao et al. (2021) for Herding, K-Center and DC. As vanilla DC cannot leverage any structure information, we develop a variant named DC-Graph, which additionally leverages graph structure during test stage, to replace DC for the following experiments. A comparison between DC, DC-Graph, GCOND and GCOND- $\mathbf { \nabla } \cdot \mathbf { X }$ is shown in Table 1 and their training details can be found in Appendix A.3.
|
| 133 |
+
|
| 134 |
+
Evaluation. We first use the aforementioned baselines to obtain condensed graphs and then evaluate them on GNNs for both transductive and inductive node classification tasks. For transductive datasets, we condense the full graph with $N$ nodes into a synthetic graph with $r N$ $0 < r < 1 \AA$ ) nodes, where $r$ is the ratio of synthetic nodes to original nodes. For inductive datasets, we only condense the training graph since the rest of the full graph is not available during training. The choices of $r ^ { 2 }$ are listed in Table 2. For each $r$ , we generate 5 condensed graphs with different seeds. To evaluate the effectiveness of condensed graphs, we have two stages: (1) a training stage, where we train a GNN model on the condensed graph, and (2) a test stage, where the trained GNN uses the test graph (or full graph in transductive setting) to infer the labels for test nodes. The resulting test performance is compared with that obtained when training on original datasets. All experiments are repeated 10 times, and we report average performance and variance.
|
| 135 |
+
|
| 136 |
+
Hyperparameter settings. As our goal is to generate highly informative synthetic graphs which can benefit GNNs, we choose one representative model, GCN (Kipf & Welling, 2017), for performance evaluation. For the GNN used in condensation, i.e., the $\mathrm { G N N } _ { \theta } ( \cdot )$ in Eq. (8), we adopt SGC (Wu et al., 2019a) which decouples the propagation and transformation process but still shares similar graph filtering behavior as GCN. Unless otherwise stated, we use 2-layer models with 256 hidden units. The weight decay and dropout for the models are set to 0 in condensation process. More details for hyper-parameter tuning can be found in Appendix A.
|
| 137 |
+
|
| 138 |
+
# 4.2 COMPARISON WITH BASELINES
|
| 139 |
+
|
| 140 |
+
In this subsection, we test the performance of a 2-layer GCN on the condensed graphs, and compare the proposed GCOND and GCOND-X with baselines. Notably, all methods produce both structure and node features, i.e. $\mathbf { A } ^ { \prime }$ and $\mathbf { X } ^ { \prime }$ , except DC-Graph and GCOND-X. Since DC-Graph and GCONDX do not produce any structure, we simply use an identity matrix as the adjacency matrix when training GNNs solely on condensed features. However, during inference, we use the full graph (transductive setting) or test graph (inductive setting) to propagate information based on the trained GNNs. This training paradigm is similar to the C&S model (Huang et al., 2021a) which trains an MLP without the graph information and performs label propagation based on MLP predictions. Table 2 reports node classification performance; we make the following observations:
|
| 141 |
+
|
| 142 |
+
Obs 1. Condensation methods achieve promising performance even with extremely large reduction rates. Condensation methods, i.e., GCOND, GCOND- $\mathrm { _ X }$ and DC-Graph, outperform coreset methods and graph coarsening significantly at the lowest ratio $r$ for each dataset. This shows the importance of learning synthetic data using the guidance from downstream tasks. Notably, GCOND achieves $7 9 . 8 \%$ , $8 0 . 1 \%$ and $7 9 . 3 \%$ at $1 . 3 \%$ , $2 . 6 \%$ and $5 . 2 \%$ condensation ratios at Cora, while the whole dataset performance is $8 1 . 2 \%$ . The GCOND variants also show promising performance on Cora, Flickr and Reddit at all coarsening ratios. Although the gap between whole-dataset Ogbn-arxiv and our methods is larger, they still outperform baselines by a large margin.
|
| 143 |
+
|
| 144 |
+
Table 1: Information comparison used during condensation, training and test for reduction methods. $\mathbf { A } ^ { \prime } , \mathbf { X } ^ { \prime }$ and A, X are condensed (original) graph and features, respectively.
|
| 145 |
+
|
| 146 |
+
<table><tr><td></td><td>DC</td><td>DC-Graph</td><td>GCOND-X</td><td>GCOND</td></tr><tr><td>Condensation</td><td>Xtrain</td><td>Xtrain</td><td>Atrain, Xtrain</td><td>Atrain,Xtrain</td></tr><tr><td>Training</td><td>X'</td><td>X</td><td>X'</td><td>A',X'</td></tr><tr><td>Test</td><td>Xtest</td><td>Atest,Xtest</td><td>Atest,Xtest</td><td>Atest,Xtest</td></tr></table>
|
| 147 |
+
|
| 148 |
+
Table 2: GCOND and GCOND- $\mathbf { \delta X }$ achieves promising performance in comparison to baselines even with extremely large reduction rates. We report transductive performance on Citeseer, Cora, Ogbnarxiv; inductive performance on Flickr, Reddit. Performance is reported as test accuracy $( \% )$ .
|
| 149 |
+
|
| 150 |
+
<table><tr><td></td><td></td><td colspan="5">Baselines</td><td colspan="2">Proposed</td><td></td></tr><tr><td>Dataset</td><td>Ratio (r)</td><td>Random (A',X')</td><td>Herding (A',X)</td><td>K-Center (A',X')</td><td>Coarsening (A',X')</td><td>DC-Graph (x)</td><td>GCOND-X (X')</td><td>GCOND (A',X')</td><td>Whole Dataset</td></tr><tr><td rowspan="3">Citeseer</td><td>0.9%</td><td>54.4±4.4</td><td>57.1±1.5</td><td>52.4±2.8</td><td>52.2±0.4</td><td>66.8±1.5</td><td>71.4±0.8</td><td>70.5±1.2</td><td rowspan="3">71.7±0.1</td></tr><tr><td>1.8%</td><td>64.2±1.7</td><td>66.7±1.0</td><td>64.3±1.0</td><td>59.0±0.5</td><td>66.9±0.9</td><td>69.8±1.1</td><td>70.6±0.9</td></tr><tr><td>3.6%</td><td>69.1±0.1</td><td>69.0±0.1</td><td>69.1±0.1</td><td>65.3±0.5</td><td>66.3±1.5</td><td>69.4±1.4</td><td>69.8±1.4</td></tr><tr><td rowspan="3">Cora</td><td>1.3%</td><td>63.6±3.7</td><td>67.0±1.3</td><td>64.0±2.3</td><td>31.2±0.2</td><td>67.3±1.9</td><td>75.9±1.2</td><td>79.8±1.3</td><td rowspan="3">81.2±0.2</td></tr><tr><td>2.6%</td><td>72.8±1.1</td><td>73.4±1.0</td><td>73.2±1.2</td><td>65.2±0.6</td><td>67.6±3.5</td><td>75.7±0.9</td><td>80.1±0.6</td></tr><tr><td>5.2%</td><td>76.8±0.1</td><td>76.8±0.1</td><td>76.7±0.1</td><td>70.6±0.1</td><td>67.7±2.2</td><td>76.0±0.9</td><td>79.3±0.3</td></tr><tr><td rowspan="3">Ogbn-arxiv</td><td>0.05%</td><td>47.1±3.9</td><td>52.4±1.8</td><td>47.2±3.0</td><td>35.4±0.3</td><td>58.6±0.4</td><td>61.3±0.5</td><td>59.2±1.1</td><td rowspan="3">71.4±0.1</td></tr><tr><td>0.25%</td><td>57.3±1.1</td><td>58.6±1.2</td><td>56.8±0.8</td><td>43.5±0.2</td><td>59.9±0.3</td><td>64.2±0.4</td><td>63.2±0.3</td></tr><tr><td>0.5%</td><td>60.0±0.9</td><td>60.4±0.8</td><td>60.3±0.4</td><td>50.4±0.1</td><td>59.5±0.3</td><td>63.1±0.5</td><td>64.0±0.4</td></tr><tr><td rowspan="3">Flickr</td><td>0.1%</td><td>41.8±2.0</td><td>42.5±1.8</td><td>42.0±0.7</td><td>41.9±0.2</td><td>46.3±0.2</td><td>45.9±0.1</td><td>46.5±0.4</td><td rowspan="3">47.2±0.1</td></tr><tr><td>0.5%</td><td>44.0±0.4</td><td>43.9±0.9</td><td>43.2±0.1</td><td>44.5±0.1</td><td>45.9±0.1</td><td>45.0±0.2</td><td>47.1±0.1</td></tr><tr><td>1%</td><td>44.6±0.2</td><td>44.4±0.6</td><td>44.1±0.4</td><td>44.6±0.1</td><td>45.8±0.1</td><td>45.0±0.1</td><td>47.1±0.1</td></tr><tr><td rowspan="3">Reddit</td><td>0.05%</td><td>46.1±4.4</td><td>53.1±2.5</td><td>46.6±2.3</td><td>40.9±0.5</td><td>88.2±0.2</td><td>88.4±0.4</td><td>88.0±1.8</td><td rowspan="3">93.9±0.0</td></tr><tr><td>0.1%</td><td>58.0±2.2</td><td>62.7±1.0</td><td>53.0±3.3</td><td>42.8±0.8</td><td>89.5±0.1</td><td>89.3±0.1</td><td>89.6±0.7</td></tr><tr><td>0.2%</td><td>66.3±1.9</td><td>71.0±1.6</td><td>58.5±2.1</td><td>47.4±0.9</td><td>90.5±1.2</td><td>88.8±0.4</td><td>90.1±0.5</td></tr></table>
|
| 151 |
+
|
| 152 |
+
Obs 2. Learning $\mathbf { X } ^ { \prime }$ instead of $( \mathbf { A } ^ { \prime } , \mathbf { X } ^ { \prime } )$ as the condensed graph can also lead to good results. GCOND- $\mathbf { \nabla } \cdot \mathbf { X }$ achieves close performance to GCOND on 11 of 15 cases. Since our objective in graph condensation is to achieve parameter matching through gradient matching, training a GNN on the learned features $\mathbf { X } ^ { \prime }$ with identity adjacency matrix is also able to mimic the training trajectory of GNN parameters. One reason could be that $\mathbf { X } ^ { \prime }$ has already encoded node features and structural information of the original graph during the condensation process. However, there are many scenarios where the graph structure is essential such as the generalization to other GNN architectures (e.g., GAT) and visualizing the patterns in the data. More details are given in the following subsections.
|
| 153 |
+
|
| 154 |
+
Obs 3. Condensing node features and structural information simultaneously can lead to better performance. In most cases, GCOND and GCOND- $\mathrm { X }$ obtain much better performance than DCGraph. One key reason is that GCOND and GCOND-X can take advantage of both node features and structural information in the condensation process. We notice that DC-Graph achieves a highly comparable result $( 9 0 . 5 \% )$ on Reddit at $0 . 2 \%$ condensation ratio to the whole dataset performance $( 9 3 . 9 \% )$ . This may indicate that the original training graph structure might not be useful. To verify this assumption, we train a GCN on the original Reddit dataset without using graph structure (i.e., setting $\mathbf { A } _ { \mathrm { t r a i n } } = \mathbf { I } )$ , but allow using the test graph structure for inference using the trained model. The obtained performance is $9 2 . 5 \%$ , which is very close to the original performance $9 3 . 9 \%$ , indicating that training without graph structure can still achieve comparable performance. We also note that learning $\mathbf { X } ^ { \prime } , \mathbf { A } ^ { \prime }$ simultaneously creates opportunities to absorb information from graph structure directly into learned features, lessening reliance on distilling graph properties reliably while still achieving good generalization performance from features.
|
| 155 |
+
|
| 156 |
+
Obs 4. Larger condensed graph size does not strictly indicate better performance. Although larger condensed graph sizes allow for more parameters which can potentially encapsulate more information from original graph, it simultaneously becomes harder to optimize due to the increased model complexity. We observe that once the condensation ratio reaches a certain threshold, the performance becomes stable. However, the performance of coreset methods and graph coarsening is much more sensitive to the reduction ratio. Coreset methods only select existing samples while graph coarsening groups existing nodes into super nodes. When the reduction ratio is too low, it becomes extremely difficult to select informative nodes or form representative super nodes by grouping.
|
| 157 |
+
|
| 158 |
+
Table 3: Graph condensation can work well with different architectures. Avg. stands for the average test accuracy of APPNP, Cheby, GCN, GraphSAGE and SGC. SAGE stands for GraphSAGE.
|
| 159 |
+
|
| 160 |
+
<table><tr><td></td><td>Methods</td><td>Data</td><td>MLP</td><td>GAT</td><td>APPNP</td><td>Cheby</td><td>GCN</td><td>SAGE</td><td>SGC</td><td>Avg.</td></tr><tr><td rowspan="3">Citeseer r = 1.8%</td><td>DC-Graph</td><td>X'</td><td>66.2</td><td>-</td><td>66.4</td><td>64.9</td><td>66.2</td><td>65.9</td><td>69.6</td><td>66.6</td></tr><tr><td>GCOND-X</td><td>X'</td><td>69.6</td><td>1</td><td>69.7</td><td>70.6</td><td>69.7</td><td>69.2</td><td>71.6</td><td>70.2</td></tr><tr><td>GCOND</td><td>A',X'</td><td>63.9</td><td>55.4</td><td>69.6</td><td>68.3</td><td>70.5</td><td>66.2</td><td>70.3</td><td>69.0</td></tr><tr><td rowspan="3">Cora r=2.6%</td><td>DC-Graph</td><td>x'</td><td>67.2</td><td>-</td><td>67.1</td><td>67.7</td><td>67.9</td><td>66.2</td><td>72.8</td><td>68.3</td></tr><tr><td>GCOND-X</td><td>X'</td><td>76.0</td><td>-</td><td>77.0</td><td>74.1</td><td>75.3</td><td>76.0</td><td>76.1</td><td>75.7</td></tr><tr><td>GCOND</td><td>A',X'</td><td>73.1</td><td>66.2</td><td>78.5</td><td>76.0</td><td>80.1</td><td>78.2</td><td>79.3</td><td>78.4</td></tr><tr><td rowspan="3">Ogbn-arxiv r = 0.25%</td><td>DC-Graph</td><td>X</td><td>59.9</td><td>1</td><td>60.0</td><td>55.7</td><td>59.8</td><td>60.0</td><td>60.4</td><td>59.2</td></tr><tr><td>GCOND-X</td><td>X'</td><td>64.1</td><td>1</td><td>61.5</td><td>59.5</td><td>64.2</td><td>64.4</td><td>64.7</td><td>62.9</td></tr><tr><td>GCOND</td><td>A',X'</td><td>62.2</td><td>60.0</td><td>63.4</td><td>54.9</td><td>63.2</td><td>62.6</td><td>63.7</td><td>61.6</td></tr><tr><td rowspan="3">Flickr r=0.5%</td><td>DC-Graph</td><td>x'</td><td>43.1</td><td>-</td><td>45.7</td><td>43.8</td><td>45.9</td><td>45.8</td><td>45.6</td><td>45.4</td></tr><tr><td>GCOND-X</td><td>X</td><td>42.1</td><td>1</td><td>44.6</td><td>42.3</td><td>45.0</td><td>44.7</td><td>44.4</td><td>44.2</td></tr><tr><td>GCOND</td><td>A',X'</td><td>44.8</td><td>40.1</td><td>45.9</td><td>42.8</td><td>47.1</td><td>46.2</td><td>46.1</td><td>45.6</td></tr><tr><td rowspan="3">Reddit r=0.1%</td><td>DC-Graph</td><td>x'</td><td>50.3</td><td>1</td><td>81.2</td><td>77.5</td><td>89.5</td><td>89.7</td><td>90.5</td><td>85.7</td></tr><tr><td>GCOND-X</td><td>X</td><td>40.1</td><td>-</td><td>78.7</td><td>74.0</td><td>89.3</td><td>89.3</td><td>91.0</td><td>84.5</td></tr><tr><td>GCOND</td><td>A',x'</td><td>42.5</td><td>60.2</td><td>87.8</td><td>75.5</td><td>89.4</td><td>89.1</td><td>89.6</td><td>86.3</td></tr></table>
|
| 161 |
+
|
| 162 |
+
# 4.3 GENERALIZABILITY OF CONDENSED GRAPHS
|
| 163 |
+
|
| 164 |
+
Next, we illustrate the generalizability of condensed graphs from the following three perspectives.
|
| 165 |
+
|
| 166 |
+
Different Architectures. Next, we show the generalizability of the graph condensation procedure. Specifically, we show test performance when using a graph condensed by one GNN model to train different GNN architectures. Specifically, we choose APPNP (Klicpera et al., 2019), GCN, SGC (Wu et al., 2019a), GraphSAGE (Hamilton et al., 2017), Cheby (Defferrard et al., 2016) and GAT (Velickovic et al., 2018). We also include MLP and report the results in Table 3. From the table, we find that the condensed graphs generated by GCOND show good generalization on different architectures. We may attribute such transferability across different architectures to similar filtering behaviors of those GNN models, which have been studied in Ma et al. (2020); Zhu et al. (2021).
|
| 167 |
+
|
| 168 |
+
Versatility of GCOND. The proposed GCOND is highly composable in that we can adopt various GNNs inside the condensation network. We investigate the performances of various GNNs when using different GNN models in the condensation process, i.e., $\mathrm { G N N } _ { \theta } ( \cdot )$ in Eq. (8). We choose APPNP, Cheby, GCN, GraphSAGE and SGC to serve as the models used in condensation and evaluation. Note that we omit GAT due to its deterioration under large neighborhood sizes (Ma et al., 2021). We choose Cora and Ogbn-arxiv to report the performance in Table 4 where C and T denote condensation and test models, respectively. The graphs condensed by different GNNs all show strong transfer performance on other architectures.
|
| 169 |
+
|
| 170 |
+
Neural Architecture Search. We also perform experiments on neural architecture search, detailed in Appendix C.2. We search 480 architectures of APPNP and perform the search process on Cora, Citeseer and Ogbn-arxiv. Specifically, we train each architecture on the reduced graph for epochs on as the model converges faster on the smaller graph. We observe reliable correlation of performances between condensed dataset training and whole-dataset training as shown in Table 9: 0.76/0.79/0.64 for Cora/Citeseer/Ogbn-arxiv.
|
| 171 |
+
|
| 172 |
+
# 4.4 ANALYSIS ON CONDENSED DATA
|
| 173 |
+
|
| 174 |
+
Statistics of Condensed Graphs. In Table 5, we compare several properties between condensed graphs and original graphs. Note that a widely used homophily measure is defined in (Zhu et al., 2020) but it does not apply to weighted graphs. Hence, when computing homophily, we binarize the graphs by removing edges whose weights are smaller than 0.5. We make the following observations. First, while achieving similar performance for downstream tasks, the condensed graphs contain fewer nodes and take much less storage. Second, the condensed graphs are less sparse than their larger counterparts. Since the condensed graph is on extremely small scale, there would be almost no connections between nodes if the condensed graph maintains the original sparsity. Third, for Citeseer, Cora and Flickr, the homophily information are well preserved in the condensed graphs.
|
| 175 |
+
|
| 176 |
+
Table 4: Cross-architecture performance is shown in test accuracy $( \% )$ . SAGE: GraphSAGE. Graphs condensed by different GNNs all show strong transfer performance on other architectures.
|
| 177 |
+
|
| 178 |
+
<table><tr><td colspan="5">(a) Cora, r=2.6%</td></tr><tr><td>C\T</td><td>APPNP</td><td>Cheby</td><td>GCN</td><td>SAGE</td></tr><tr><td>APPNP</td><td></td><td></td><td>72.1±2.6 60.8±6.4 73.5±2.4 72.3±3.5 73.1±3.1</td><td></td></tr><tr><td>Cheby</td><td></td><td></td><td>75.3±2.9 71.8±1.1 76.8±2.1 76.4±2.0 75.5±3.5</td><td></td></tr><tr><td>GCN</td><td></td><td></td><td>69.8±4.0 53.2±3.4 70.6±3.7 60.2±1.9 68.7±5.4</td><td></td></tr><tr><td>SAGE</td><td></td><td></td><td>77.1±1.1 69.3±1.7 77.0±0.7 76.1±0.7 77.7±1.8</td><td></td></tr><tr><td>SGC</td><td></td><td></td><td>78.5±1.0 76.0±1.1 80.1±0.6 78.2±0.9 79.3±0.7</td><td></td></tr></table>
|
| 179 |
+
|
| 180 |
+
<table><tr><td colspan="5">(b) Ogbn-arxiv,r=0.05%</td></tr><tr><td>C\T</td><td>APPNP</td><td>Cheby</td><td>GCN</td><td>SAGE SGC</td></tr><tr><td>APPNP</td><td></td><td></td><td></td><td>60.3±0.2 51.8±0.5 59.9±0.4 59.0±1.1 61.2±0.4</td></tr><tr><td>Cheby</td><td>57.4±0.4 53.5±0.5</td><td>57.4±0.8</td><td>57.1±0.8 58.2±0.6</td><td></td></tr><tr><td>GCN</td><td>59.3±0.4 51.8±0.76</td><td>60.3±0.36</td><td>60.2±0.4 59.2±0.7</td><td></td></tr><tr><td>SAGE</td><td>57.6±0.8 53.9±0.6</td><td>58.1±0.6</td><td></td><td>57.8±0.7 59.0±1.1</td></tr><tr><td>SGC</td><td>59.7±0.5 49.5±0.8</td><td></td><td>59.2±1.1</td><td>58.9±1.6 60.5±0.6</td></tr></table>
|
| 181 |
+
|
| 182 |
+
Table 5: Comparison between condensed graphs and original graphs. The condensed graphs have fewer nodes and are more dense.
|
| 183 |
+
|
| 184 |
+
<table><tr><td rowspan="2"></td><td colspan="2">Citeseer,r=0.9%</td><td colspan="2">Cora, r=1.3%</td><td colspan="2">|Ogbn-arxiv,r=0.25%|</td><td colspan="2">Flickr,r=0.5%</td><td colspan="2">Reddit, r=0.1%</td></tr><tr><td>Whole</td><td>GCOND</td><td>Whole</td><td>GCOND</td><td>Whole</td><td>GCOND</td><td>Whole</td><td>GCOND</td><td>Whole</td><td>GCOND</td></tr><tr><td>Accuracy</td><td>70.7</td><td>70.5</td><td>81.5</td><td>79.8</td><td>71.4</td><td>63.2</td><td>47.1</td><td>47.1</td><td>94.1</td><td>89.4</td></tr><tr><td>#Nodes</td><td>3,327</td><td>60</td><td>2,708</td><td>70</td><td>169,343</td><td>454</td><td>44,625</td><td>223</td><td>153,932</td><td>153</td></tr><tr><td>#Edges</td><td>4,732</td><td>1,454</td><td>5,429</td><td>2,128</td><td>1,166,243</td><td>3,354</td><td>218,140</td><td>3,788</td><td>10,753,238</td><td>301</td></tr><tr><td>Sparsity</td><td>0.09%</td><td>80.78%</td><td>0.15%</td><td>86.86%</td><td>0.01%</td><td>3.25%</td><td>0.02%</td><td>15.23%</td><td>0.09%</td><td>2.57%</td></tr><tr><td>Homophily</td><td>0.74</td><td>0.65</td><td>0.81</td><td>0.79</td><td>0.65</td><td>0.07</td><td>0.33</td><td>0.28</td><td>0.78</td><td>0.04</td></tr><tr><td>Storage</td><td>47.1 MB</td><td>0.9MB</td><td>14.9 MB</td><td>0.4MB</td><td>100.4MB</td><td>0.3MB</td><td>86.8MB</td><td>0.5MB</td><td>435.5MB</td><td>0.4MB</td></tr></table>
|
| 185 |
+
|
| 186 |
+

|
| 187 |
+
Figure 2: Condensed graphs sometimes exhibit structure mimicking the original (a, b, d). Other times (c, e), learned features absorb graph properties and create less explicit graph reliance.
|
| 188 |
+
|
| 189 |
+
Visualization. We present the visualization results for all datasets in Figure 4, where nodes with the same color are from the same class. Notably, as the learned condensed graphs are weighted graphs, we use black lines to denote the edges with weights larger than 0.5 and gray lines to denote the edges with weights smaller than 0.5. From Figure 4, we can observe some patterns in the condensed graphs, e.g., the homophily patterns on Cora and Citeseer are well preserved. Interestingly, the learned graph for Reddit is very close to a star graph where almost all the nodes only have connections with very few center nodes. Such a structure can be meaningless for GNNs because almost all the nodes receive the information from their neighbors. In this case, the learned features $\mathbf { X } ^ { \prime }$ play a major role in training GNN parameters, indicating that the original training graph of Reddit is not very informative, aligning with our observations in Section 4.2.
|
| 190 |
+
|
| 191 |
+
# 5 CONCLUSION
|
| 192 |
+
|
| 193 |
+
The prevalence of large-scale graphs poses great challenges in training graph neural networks. Thus, we study a novel problem of graph condensation which targets at condensing a large-real graph into a small-synthetic one while maintaining the performances of GNNs. Through our proposed framework, we are able to significantly reduce the graph size while approximating the original performance. The condensed graphs take much less space of storage and can be used to efficiently train various GNN architectures. Future work can be done on (1) improving the transferability of condensed graphs for different GNNs, (2) studying graph condensation for other tasks such as graph classification and (3) designing condensation framework for multi-label datasets.
|
| 194 |
+
|
| 195 |
+
# ACKNOLWEDGEMENT
|
| 196 |
+
|
| 197 |
+
Wei Jin and Jiliang Tang are supported by the National Science Foundation (NSF) under grant numbers IIS1714741, CNS1815636, IIS1845081, IIS1907704, IIS1928278, IIS1955285, IOS2107215, and IOS2035472, the Army Research Office (ARO) under grant number W911NF-21-1-0198, the Home Depot, Cisco Systems Inc. and SNAP Inc.
|
| 198 |
+
|
| 199 |
+
ETHICS STATEMENT
|
| 200 |
+
|
| 201 |
+
To the best of our knowledge, there are no ethical issues with this paper.
|
| 202 |
+
|
| 203 |
+
# REPRODUCIBILITY STATEMENT
|
| 204 |
+
|
| 205 |
+
To ensure reproducibility of our experiments, we provide our source code at https://github.
|
| 206 |
+
com/ChandlerBang/GCond. The hyper-parameters are described in details in the appendix.
|
| 207 |
+
We also provide a pseudo-code implementation of our framework in the appendix.
|
| 208 |
+
|
| 209 |
+
# REFERENCES
|
| 210 |
+
|
| 211 |
+
Peter W Battaglia, Jessica B Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinicius Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, et al. Relational inductive biases, deep learning, and graph networks. ArXiv preprint, 2018.
|
| 212 |
+
|
| 213 |
+
Ondrej Bohdal, Yongxin Yang, and Timothy Hospedales. Flexible dataset distillation: Learn labels instead of images. ArXiv preprint, 2020.
|
| 214 |
+
|
| 215 |
+
Chen Cai, Dingkang Wang, and Yusu Wang. Graph coarsening with neural networks. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021, 2021.
|
| 216 |
+
|
| 217 |
+
Francisco M Castro, Manuel J Mar´ın-Jimenez, Nicol ´ as Guil, Cordelia Schmid, and Karteek Alahari.´ End-to-end incremental learning. In Proceedings of the European conference on computer vision (ECCV), 2018.
|
| 218 |
+
|
| 219 |
+
Yu Chen, Lingfei Wu, and Mohammed J. Zaki. Iterative deep graph learning for graph neural networks: Better and robust node embeddings. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020.
|
| 220 |
+
|
| 221 |
+
Michael Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks ¨ on graphs with fast localized spectral filtering. In Advances in Neural Information Processing Systems 29: Annual Conference on Neural Information Processing Systems 2016, December 5- 10, 2016, Barcelona, Spain, 2016.
|
| 222 |
+
|
| 223 |
+
Chenhui Deng, Zhiqiang Zhao, Yongyu Wang, Zhiru Zhang, and Zhuo Feng. Graphzoom: A multilevel spectral approach for accurate and scalable graph embedding. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020, 2020.
|
| 224 |
+
|
| 225 |
+
Xiaowen Dong, Dorina Thanou, Pascal Frossard, and Pierre Vandergheynst. Learning laplacian matrix in smooth graph signal representations. IEEE Transactions on Signal Processing, (23), 2016.
|
| 226 |
+
|
| 227 |
+
David Duvenaud, Dougal Maclaurin, Jorge Aguilera-Iparraguirre, Rafael Gomez-Bombarelli, Timo- ´ thy Hirzel, Alan Aspuru-Guzik, and Ryan P. Adams. Convolutional networks on graphs for learn- ´ ing molecular fingerprints. In Advances in Neural Information Processing Systems 28: Annual Conference on Neural Information Processing Systems 2015, December 7-12, 2015, Montreal, Quebec, Canada, 2015.
|
| 228 |
+
|
| 229 |
+
Hilmi E Egilmez, Eduardo Pavez, and Antonio Ortega. Graph learning from data under laplacian and structural constraints. IEEE Journal of Selected Topics in Signal Processing, (6), 2017.
|
| 230 |
+
|
| 231 |
+
Wenqi Fan, Yao Ma, Qing Li, Yuan He, Yihong Eric Zhao, Jiliang Tang, and Dawei Yin. Graph neural networks for social recommendation. In The World Wide Web Conference, WWW 2019, San Francisco, CA, USA, May 13-17, 2019, 2019.
|
| 232 |
+
|
| 233 |
+
Reza Zanjirani Farahani and Masoud Hekmatfar. Facility location: concepts, models, algorithms and case studies. 2009.
|
| 234 |
+
|
| 235 |
+
Matthias Fey and Jan Eric Lenssen. Fast graph representation learning with pytorch geometric. ArXiv preprint, 2019.
|
| 236 |
+
|
| 237 |
+
Luca Franceschi, Mathias Niepert, Massimiliano Pontil, and Xiao He. Learning discrete structures for graph neural networks. In Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, Proceedings of Machine Learning Research, 2019.
|
| 238 |
+
|
| 239 |
+
Hongyang Gao and Shuiwang Ji. Graph u-nets. In Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, Proceedings of Machine Learning Research, 2019.
|
| 240 |
+
|
| 241 |
+
William L. Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. In Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, 2017.
|
| 242 |
+
|
| 243 |
+
Weihua Hu, Matthias Fey, Marinka Zitnik, Yuxiao Dong, Hongyu Ren, Bowen Liu, Michele Catasta, and Jure Leskovec. Open graph benchmark: Datasets for machine learning on graphs. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020.
|
| 244 |
+
|
| 245 |
+
Qian Huang, Horace He, Abhay Singh, Ser-Nam Lim, and Austin R. Benson. Combining label propagation and simple models out-performs graph neural networks. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021, 2021a.
|
| 246 |
+
|
| 247 |
+
Zengfeng Huang, Shengzhong Zhang, Chong Xi, Tang Liu, and Min Zhou. Scaling up graph neural networks via graph coarsening. In In Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery and Data Mining (KDD ’21), 2021b.
|
| 248 |
+
|
| 249 |
+
Joseph J. Pfeiffer III, Sebastian Moreno, Timothy La Fond, Jennifer Neville, and Brian Gallagher. ´ Attributed graph models: modeling network structure with correlated attributes. In 23rd International World Wide Web Conference, WWW ’14, Seoul, Republic of Korea, April 7-11, 2014, 2014.
|
| 250 |
+
|
| 251 |
+
Wei Jin, Yao Ma, Xiaorui Liu, Xianfeng Tang, Suhang Wang, and Jiliang Tang. Graph structure learning for robust graph neural networks. In KDD ’20: The 26th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, Virtual Event, CA, USA, August 23-27, 2020, 2020.
|
| 252 |
+
|
| 253 |
+
David R Karger. Random sampling in cut, flow, and network design problems. Mathematics of Operations Research, (2), 1999.
|
| 254 |
+
|
| 255 |
+
Thomas N. Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings, 2017.
|
| 256 |
+
|
| 257 |
+
Johannes Klicpera, Aleksandar Bojchevski, and Stephan Gunnemann. Predict then propagate: ¨ Graph neural networks meet personalized pagerank. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019, 2019.
|
| 258 |
+
|
| 259 |
+
Guohao Li, Matthias Muller, Ali K. Thabet, and Bernard Ghanem. Deepgcns: Can gcns go as deep ¨ as cnns? In 2019 IEEE/CVF International Conference on Computer Vision, ICCV 2019, Seoul, Korea (South), October 27 - November 2, 2019, 2019.
|
| 260 |
+
|
| 261 |
+
Meng Liu, Hongyang Gao, and Shuiwang Ji. Towards deeper graph neural networks. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining. ACM, 2020.
|
| 262 |
+
|
| 263 |
+
Xiaorui Liu, Wei Jin, Yao Ma, Yaxin Li, Hua Liu, Yiqi Wang, Ming Yan, and Jiliang Tang. Elastic graph neural networks. In Proceedings of the 38th International Conference on Machine Learning, ICML 2021, 18-24 July 2021, Virtual Event, Proceedings of Machine Learning Research, 2021.
|
| 264 |
+
|
| 265 |
+
Andreas Loukas. Graph reduction with spectral and cut guarantees. J. Mach. Learn. Res., (116), 2019.
|
| 266 |
+
|
| 267 |
+
Andreas Loukas and Pierre Vandergheynst. Spectrally approximating large graphs with smaller graphs. In Proceedings of the 35th International Conference on Machine Learning, ICML 2018, Stockholmsmassan, Stockholm, Sweden, July 10-15, 2018 ¨ , Proceedings of Machine Learning Research, 2018.
|
| 268 |
+
|
| 269 |
+
Xiaojun Ma, Ziyao Li, Lingjun Xu, Guojie Song, Yi Li, and Chuan Shi. Learning discrete adaptive receptive fields for graph convolutional networks, 2021.
|
| 270 |
+
|
| 271 |
+
Yao Ma, Xiaorui Liu, Tong Zhao, Yozen Liu, Jiliang Tang, and Neil Shah. A unified view on graph neural networks as graph signal denoising. ArXiv preprint, 2020.
|
| 272 |
+
|
| 273 |
+
Timothy Nguyen, Zhourong Chen, and Jaehoon Lee. Dataset meta-learning from kernel ridgeregression. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021, 2021.
|
| 274 |
+
|
| 275 |
+
David Peleg and Alejandro A Schaffer. Graph spanners. ¨ Journal of graph theory, (1), 1989.
|
| 276 |
+
|
| 277 |
+
Sylvestre-Alvise Rebuffi, Alexander Kolesnikov, Georg Sperl, and Christoph H. Lampert. icarl: Incremental classifier and representation learning. In 2017 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2017, Honolulu, HI, USA, July 21-26, 2017, 2017.
|
| 278 |
+
|
| 279 |
+
Ozan Sener and Silvio Savarese. Active learning for convolutional neural networks: A core-set approach. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings, 2018.
|
| 280 |
+
|
| 281 |
+
Cosma Rohilla Shalizi and Andrew C Thomas. Homophily and contagion are generically confounded in observational social network studies. Sociological methods & research, (2), 2011.
|
| 282 |
+
|
| 283 |
+
Daniel A Spielman and Shang-Hua Teng. Spectral sparsification of graphs. SIAM Journal on Computing, (4), 2011.
|
| 284 |
+
|
| 285 |
+
Laurens Van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, (11), 2008.
|
| 286 |
+
|
| 287 |
+
Petar Velickovic, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua \` Bengio. Graph attention networks. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings, 2018.
|
| 288 |
+
|
| 289 |
+
Tongzhou Wang, Jun-Yan Zhu, Antonio Torralba, and Alexei A Efros. Dataset distillation. ArXiv preprint, 2018.
|
| 290 |
+
|
| 291 |
+
Max Welling. Herding dynamical weights to learn. In Proceedings of the 26th Annual International Conference on Machine Learning, ICML 2009, Montreal, Quebec, Canada, June 14-18, 2009, ACM International Conference Proceeding Series, 2009.
|
| 292 |
+
|
| 293 |
+
Felix Wu, Amauri H. Souza Jr., Tianyi Zhang, Christopher Fifty, Tao Yu, and Kilian Q. Weinberger. Simplifying graph convolutional networks. In Proceedings of the 36th International Conference on Machine Learning, ICML 2019, 9-15 June 2019, Long Beach, California, USA, Proceedings of Machine Learning Research, 2019a.
|
| 294 |
+
|
| 295 |
+
Zonghan Wu, Shirui Pan, Fengwen Chen, Guodong Long, Chengqi Zhang, and Philip S Yu. A comprehensive survey on graph neural networks. ArXiv preprint, 2019b.
|
| 296 |
+
|
| 297 |
+
Rex Ying, Ruining He, Kaifeng Chen, Pong Eksombatchai, William L. Hamilton, and Jure Leskovec. Graph convolutional neural networks for web-scale recommender systems. In Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, KDD 2018, London, UK, August 19-23, 2018, 2018a.
|
| 298 |
+
|
| 299 |
+
Zhitao Ying, Jiaxuan You, Christopher Morris, Xiang Ren, William L. Hamilton, and Jure Leskovec. Hierarchical graph representation learning with differentiable pooling. In Advances in Neural Information Processing Systems 31: Annual Conference on Neural Information Processing Systems 2018, NeurIPS 2018, December 3-8, 2018, Montreal, Canada´ , 2018b.
|
| 300 |
+
|
| 301 |
+
Yuning You, Tianlong Chen, Yang Shen, and Zhangyang Wang. Graph contrastive learning automated. In Proceedings of the 38th International Conference on Machine Learning, ICML 2021, 18-24 July 2021, Virtual Event, Proceedings of Machine Learning Research, 2021.
|
| 302 |
+
|
| 303 |
+
Hanqing Zeng, Hongkuan Zhou, Ajitesh Srivastava, Rajgopal Kannan, and Viktor K. Prasanna. Graphsaint: Graph sampling based inductive learning method. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020, 2020.
|
| 304 |
+
|
| 305 |
+
Muhan Zhang, Zhicheng Cui, Marion Neumann, and Yixin Chen. An end-to-end deep learning architecture for graph classification. In Proceedings of the Thirty-Second AAAI Conference on Artificial Intelligence, (AAAI-18), the 30th innovative Applications of Artificial Intelligence (IAAI18), and the 8th AAAI Symposium on Educational Advances in Artificial Intelligence (EAAI-18), New Orleans, Louisiana, USA, February 2-7, 2018, 2018.
|
| 306 |
+
|
| 307 |
+
Bo Zhao and Hakan Bilen. Dataset condensation with differentiable siamese augmentation. In Proceedings of the 38th International Conference on Machine Learning, ICML 2021, 18-24 July 2021, Virtual Event, Proceedings of Machine Learning Research, 2021.
|
| 308 |
+
|
| 309 |
+
Bo Zhao, Konda Reddy Mopuri, and Hakan Bilen. Dataset condensation with gradient matching. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021, 2021.
|
| 310 |
+
|
| 311 |
+
Lingxiao Zhao, Wei Jin, Leman Akoglu, and Neil Shah. From stars to subgraphs: Uplifting any GNN with local structure awareness. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id $\bar { }$ Mspk_WYKoEH.
|
| 312 |
+
|
| 313 |
+
Jie Zhou, Ganqu Cui, Zhengyan Zhang, Cheng Yang, Zhiyuan Liu, Lifeng Wang, Changcheng Li, and Maosong Sun. Graph neural networks: A review of methods and applications. ArXiv preprint, 2018.
|
| 314 |
+
|
| 315 |
+
Kaixiong Zhou, Ninghao Liu, Fan Yang, Zirui Liu, Rui Chen, Li Li, Soo-Hyun Choi, and Xia Hu. Adaptive label smoothing to regularize large-scale graph training. arXiv preprint arXiv:2108.13555, 2021.
|
| 316 |
+
|
| 317 |
+
Jiong Zhu, Yujun Yan, Lingxiao Zhao, Mark Heimann, Leman Akoglu, and Danai Koutra. Beyond homophily in graph neural networks: Current limitations and effective designs. In Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020.
|
| 318 |
+
|
| 319 |
+
Ligeng Zhu, Zhijian Liu, and Song Han. Deep leakage from gradients. In Advances in Neural Information Processing Systems 32: Annual Conference on Neural Information Processing Systems 2019, NeurIPS 2019, December 8-14, 2019, Vancouver, BC, Canada, 2019.
|
| 320 |
+
|
| 321 |
+
Meiqi Zhu, Xiao Wang, Chuan Shi, Houye Ji, and Peng Cui. Interpreting and unifying graph neural networks with an optimization framework. In Proceedings of the Web Conference 2021, 2021.
|
| 322 |
+
|
| 323 |
+
# A DATASETS AND HYPER-PARAMETERS
|
| 324 |
+
|
| 325 |
+
# A.1 DATASETS
|
| 326 |
+
|
| 327 |
+
We evaluate the proposed framework on three transductive datasets, i.e., Cora, Citeseer (Kipf & Welling, 2017) and Ogbn-arxiv (Hu et al., 2020), and two inductive datasets, i.e., Flickr (Zeng et al., 2020) and Reddit (Hamilton et al., 2017). Since all the datasets have public splits, we download them from PyTorch Geometric (Fey & Lenssen, 2019) and use those splits throughout the experiments. Dataset statistics are shown in Table 6.
|
| 328 |
+
|
| 329 |
+
Table 6: Dataset statistics. The first three are transductive datasets and the last two are inductive datasets.
|
| 330 |
+
|
| 331 |
+
<table><tr><td>Dataset</td><td>#Nodes</td><td>#Edges</td><td>#Classes</td><td>#Features</td><td>Training/Validation/Test</td></tr><tr><td>Cora</td><td>2,708</td><td>5,429</td><td>7</td><td>1,433</td><td>140/500/1000</td></tr><tr><td>Citeseer</td><td>3,327</td><td>4,732</td><td>6</td><td>3,703</td><td>120/500/1000</td></tr><tr><td>Ogbn-arxiv</td><td>169,343</td><td>1,166,243</td><td>40</td><td>128</td><td>90,941/29,799/48,603</td></tr><tr><td>Flickr</td><td>89,250</td><td>899,756</td><td>7</td><td>500</td><td>44,625/22312/22313</td></tr><tr><td>Reddit</td><td>232,965</td><td>57,307,946</td><td>210</td><td>602</td><td>15,3932/23,699/55,334</td></tr></table>
|
| 332 |
+
|
| 333 |
+
# A.2 HYPER-PARAMETER SETTING
|
| 334 |
+
|
| 335 |
+
Condensation Process. For DC, we tune the number of hidden layers in a range of $\{ 1 , 2 , 3 \}$ and fix the number of hidden units to 256. We further tune the number of epochs for training DC in a range of $\{ 1 0 0 , 2 0 0 , 4 0 0 \}$ . For GCOND, without specific mention, we adopt a 2-layer SGC (Wu et al., 2019a) with 256 hidden units as the GNN used for gradient matching. The function $g _ { \Phi }$ that models the relationship between $\mathbf { A } ^ { \prime }$ and $\mathbf { X } ^ { \prime }$ is implemented as a multi-layer perceptron (MLP). Specifically, we adopt a 3-layer MLP with 128 hidden units for small graphs (Cora and Citeseer) and 256 hidden units for large graphs (Flickr, Reddit and Ogbn-arxiv). We tune the training epoch for GCOND in a range of $\{ 4 0 0 , 6 0 0 , 1 0 0 0 \}$ . For GCOND- $\mathbf { \nabla } \cdot \mathbf { X }$ , we tune the number of hidden layers in a range of $\{ 1 , 2 , 3 \}$ and fix the number of hidden units to 256. We further tune the number of epochs for training GCOND-X in a range of $\{ 1 0 0 , 2 0 0 , 4 0 0 \}$ . We tune the learning rate for all the methods in a range of $\{ 0 . 1 , 0 . 0 1 , 0 . 0 0 1 , 0 . 0 0 0 1 \}$ . Furthermore, we set $\delta$ to be $0 . 0 5 , 0 . 0 5 , 0 . 0 1 , 0 . 0 1 , 0 . 0 1$ for Citeseer, Cora, Ogbn-arxiv, Flickr and Reddit, respectively.
|
| 336 |
+
|
| 337 |
+
For the choices of condensation ratio $r$ , we divide the discussion into two parts. The first part is about transductive datasets. For Cora and Citeseer, since their labeling rates are very small $5 . 2 \%$ and $3 . 6 \%$ , respectively), we choose $r$ to be $\{ 2 5 \% , 5 0 \% , 1 0 0 \% \}$ of the labeling rate. Thus, we finally choose $\{ 1 . 3 \% , 2 . 6 \% , 5 . 2 \% \}$ for Cora and $\left\{ 0 . 9 \% , 1 . 8 \% , 3 . 6 \% \right\}$ for Citeseer. For Ogbn-arxiv, we choose $r$ to be $\{ 0 . 1 \% , 0 . 5 \% , 1 \% \}$ of its labeling rate $( 5 3 \% )$ , thus being $\{ 0 . 0 5 \% , 0 . 2 5 \% , 0 . 5 \% \}$ . The second part is about inductive datasets. As the nodes in the training graphs are all labeled in inductive datasets, we simply choose $\{ 0 . 1 \% , 0 . 5 \% , 0 . 1 \% \}$ for Flickr and $0 . 0 5 \%$ , $0 . 1 \%$ , $0 . 2 \%$ for Reddit.
|
| 338 |
+
|
| 339 |
+
Evaluation Process. During the evaluation process, we set dropout rate to be 0 and weight decay to be 0.0005 when training various GNNs. The number of epochs is set to 3000 for GAT while it is set to 600 for other models. The initial learning rate is set to 0.01.
|
| 340 |
+
|
| 341 |
+
Settings for Table 3 and Table 4. In both condensation stage and evaluation stage, we set the depth of GNNs to 2. During condensation stage, we set weight decay to 0, dropout to 0 and training epochs to 1000. During evaluation stage, we set weight decay to 0.0005, dropout to 0 and training epochs to 600.
|
| 342 |
+
|
| 343 |
+
# A.3 TRAINING DETAILS OF DC-GRAPH, GCOND-X AND GCOND
|
| 344 |
+
|
| 345 |
+
DC-Graph: During the condensation stage, DC-Graph only leverages the node features to produce condensed node features $\mathbf { X } ^ { \prime }$ . During the training stage of evaluation, DC-Graph takes the condensed features $\mathbf { X } ^ { \prime }$ together with an identity matrix as the graph structure to train a GNN. In the later test stage of evaluation, the GNN takes both test node features and test graph structure as input to make predictions for test nodes.
|
| 346 |
+
|
| 347 |
+
GCOND-X: During the condensation stage, GCOND- $\mathrm { X }$ leverages both the graph structure and node features to produce condensed node features $\mathbf { X } ^ { \prime }$ . During the training stage of evaluation, GCOND-X takes the condensed features $\mathbf { X } ^ { \prime }$ together with an identity matrix as the graph structure to train a GNN. In the later test stage of evaluation, the GNN takes both test node features and test graph structure as input to make predictions for test nodes.
|
| 348 |
+
|
| 349 |
+
GCOND: During the condensation stage, GCOND leverages both the graph structure and node features to produce condensed graph data $( \mathbf { A } ^ { \prime } , \mathbf { X } ^ { \prime } )$ . During the training stage of evaluation, GCOND takes the condensed data $( \mathbf { A } ^ { \prime } , \mathbf { X } ^ { \prime } )$ to train a GNN. In the later test stage of evaluation, the GNN takes both test node features and test graph structure as input to make predictions for test nodes.
|
| 350 |
+
|
| 351 |
+
# B ALGORITHM
|
| 352 |
+
|
| 353 |
+
We show the detailed algorithm of GCOND in Algorithm 1. In detail, we first set the condensed label set $\mathbf { Y } ^ { \prime }$ to fixed values and initialize $\mathbf { X } ^ { \prime }$ as node features randomly selected from each class. In each outer loop, we sample a GNN model initialization $\pmb \theta$ from a distribution $P _ { \theta }$ . Then, for each class we sample the corresponding node batches from $\tau$ and $s$ , and calculate the gradient matching loss within each class. The sum of losses from different classes are used to update $\mathbf { X } ^ { \prime }$ or $\Phi$ . After that we update the GNN parameters for $\tau _ { \pmb { \theta } }$ epochs. When finishing the updating of condensed graph parameters, we use $\mathbf { A } ^ { \prime } = \operatorname { R e L U } ( g _ { \Phi } ( \mathbf { X } ^ { \prime } ) - \delta )$ to obtain the final sparsified graph structure.
|
| 354 |
+
|
| 355 |
+
# Algorithm 1: GCOND for Graph Condensation
|
| 356 |
+
|
| 357 |
+
1 Input: Training data $\boldsymbol { \mathcal { T } } = ( \mathbf { A } , \mathbf { X } , \mathbf { Y } )$ , pre-defined condensed labels $\mathbf { Y } ^ { \prime }$
|
| 358 |
+
2 Initialize $\mathbf { X } ^ { \prime }$ as node features randomly selected from each class
|
| 359 |
+
3 for $k = 0 , \ldots , K - 1$ do
|
| 360 |
+
4 Initialize $\theta _ { 0 } \sim P _ { \theta _ { 0 } }$
|
| 361 |
+
5 for $t = 0 , \ldots , T - 1$ do
|
| 362 |
+
6 $D ^ { \prime } = 0$
|
| 363 |
+
7 for $c = 0 , \ldots , C - 1$ do
|
| 364 |
+
8 Compute ${ \bf A } ^ { \prime } = g _ { \Phi } ( { \bf X } ^ { \prime } )$ ; then ${ \cal S } = \{ { \bf A } ^ { \prime } , { \bf X } ^ { \prime } , { \bf Y } ^ { \prime } \}$
|
| 365 |
+
9 Sample $\left( \mathbf { A } _ { c } , \mathbf { X } _ { c } , \mathbf { Y } _ { c } \right) \sim \mathcal { T }$ and $\left( \mathbf { A } _ { c } ^ { \prime } , \mathbf { X } _ { c } ^ { \prime } , \mathbf { Y } _ { c } ^ { \prime } \right) \sim \mathcal { S }$ $\vartriangleright$ detailed in Section 3.1
|
| 366 |
+
10 Compute $\begin{array} { r } { \mathcal { L } ^ { \mathcal { T } } = \mathcal { L } \left( \mathrm { G N N } _ { \theta _ { t } } ( \mathbf { A } _ { c } , \mathbf { X } _ { c } ) , \mathbf { Y } _ { c } \right) } \end{array}$ and $\begin{array} { r } { \boldsymbol { \mathcal { L } ^ { S } } = \mathcal { L } \left( \mathrm { G N N } _ { \theta _ { t } } ( \mathbf { A } _ { c } ^ { \prime } , \mathbf { X } _ { c } ^ { \prime } ) , \mathbf { Y } _ { c } ^ { \prime } \right) } \end{array}$
|
| 367 |
+
11 $D ^ { \prime } \gets D ^ { \prime } + D ( \nabla _ { \pmb { \theta } _ { t } } \mathcal { L } ^ { T } , \nabla _ { \pmb { \theta } _ { t } } \mathcal { L } ^ { S } )$
|
| 368 |
+
12 if $t \% ( \tau _ { 1 } + \tau _ { 2 } ) < \tau _ { 1 }$ then
|
| 369 |
+
13 Update $\mathbf { X } ^ { \prime } \mathbf { X } ^ { \prime } - \eta _ { 1 } \nabla _ { \mathbf { X } ^ { \prime } } D ^ { \prime }$
|
| 370 |
+
14 else
|
| 371 |
+
15 Update $\Phi \Phi - \eta _ { 2 } \nabla _ { \Phi } D ^ { \prime }$
|
| 372 |
+
16 Update $\pmb { \theta } _ { t + 1 } \mathrm { o p t } _ { \pmb { \theta } } ( \pmb { \theta } _ { t } , \pmb { S } , \tau _ { \pmb { \theta } } )$ $\triangleright \tau _ { \theta }$ is the number of steps for updating $\pmb \theta$
|
| 373 |
+
17 $\mathbf { A } ^ { \prime } = \mathrm { R e L U } ( g _ { \Phi } ( \mathbf { X } ^ { \prime } ) - \delta )$
|
| 374 |
+
18 Return: $( { \bf A } ^ { \prime } , { \bf X } ^ { \prime } , { \bf Y } ^ { \prime } )$
|
| 375 |
+
|
| 376 |
+
# C MORE EXPERIMENTS
|
| 377 |
+
|
| 378 |
+
# C.1 ABLATION STUDY
|
| 379 |
+
|
| 380 |
+
Different Parameterization. We study the effect of different parameterizations for modeling $\mathbf { A } ^ { \prime }$ and compare GCOND with modeling $\mathbf { A } ^ { \prime }$ as free parameters in Table 7. From the table, we observe a significant improvement by taking into account the relationship between $\mathbf { A } ^ { \prime }$ and $\mathbf { X } ^ { \prime }$ . This suggests that directly modeling the structure as a function of features can ease the optimization and lead to better condensed graph data.
|
| 381 |
+
|
| 382 |
+
Joint optimization versus alternate optimization. We perform the ablation study on joint optimization and alternate optimization when updating $\Phi$ and $\mathbf { X } ^ { \prime }$ . The results are shown in Table 8. From the table, we can observe that joint optimization always gives worse performance and the standard deviation is much higher than alternate optimization.
|
| 383 |
+
|
| 384 |
+
Table 7: Ablation study on different parametrizations.
|
| 385 |
+
|
| 386 |
+
<table><tr><td>Parameters</td><td>Citeseer, r=1.8%</td><td>Cora, r=2.6%</td><td>Ogbn-arxiv,r=0.25%</td></tr><tr><td>A',X'</td><td>62.2±4.8</td><td>75.5±0.6</td><td>63.0±0.5</td></tr><tr><td>,X'</td><td>70.6±0.9</td><td>80.1±0.6</td><td>63.2±0.3</td></tr></table>
|
| 387 |
+
|
| 388 |
+
Table 8: Ablation study on different optimization strategies.
|
| 389 |
+
|
| 390 |
+
<table><tr><td></td><td>Citeseer, r=1.8%</td><td>Cora,r=2.6%</td><td>Ogbn-arxiv,r=0.25%</td><td>Flickr, r=0.5%</td><td>Reddit,r=0.1%</td></tr><tr><td>Joint</td><td>68.2±3.0</td><td>79.9±1.6</td><td>62.8±1.1</td><td>45.4±0.4</td><td>87.5±1.8</td></tr><tr><td>Alternate</td><td>70.6±0.9</td><td>80.1±0.6</td><td>63.2±0.3</td><td>47.1±0.1</td><td>89.5±0.8</td></tr></table>
|
| 391 |
+
|
| 392 |
+
# C.2 NEURAL ARCHITECTURE SEARCH
|
| 393 |
+
|
| 394 |
+
We focus on APPNP instead of GCN since the architecture of APPNP involves more hyperparameters regarding its architecture setup. The detailed search space is shown as follows:
|
| 395 |
+
|
| 396 |
+
(a) Number of propagation $K$ : we search the number of propagation $K$ in the range of $\{ 2 , 4 , 6 , 8 , 1 0 \}$ .
|
| 397 |
+
(b) Residual coefficient $\alpha$ : for the residual coefficient in APPNP, we search it in the range of $\{ 0 . 1 , 0 . 2 \}$ .
|
| 398 |
+
(c) Hidden dimension: We collect the set of dimensions that are widely adopted by existing work as the candidates, i.e., $\left\{ 1 6 , 3 2 , 6 4 , 1 2 8 , 2 5 6 , 5 1 2 \right\}$ .
|
| 399 |
+
(d) Activation function: The set of available activation functions is listed as follows: {Sigmoid, Tanh, ReLU, Linear, Softplus, LeakyReLU, ReLU6, ELU}
|
| 400 |
+
|
| 401 |
+
In total, for each dataset we search 480 architectures of APPNP and we perform the search process on Cora, Citeseer and Ogbn-arxiv. Specifically, we train each architecture on the reduced graph for epochs on as the model converges faster on the smaller graph. We use the best validation accuracy to choose the final architecture. We report (1) the Pearson correlation between validation accuracies obtained by architectures trained on condensed graphs and those trained on original graphs, and (2) the average test accuracy of the searched architecture over 20 runs.
|
| 402 |
+
|
| 403 |
+
Table 9: Neural Architecture Search. Methods are compared in validation accuracy correlation and test accuracy obtained by searched architecture. Whole means the architecture is searched using whole dataset.
|
| 404 |
+
|
| 405 |
+
<table><tr><td rowspan="2"></td><td colspan="3">Pearson Correlation</td><td colspan="4">Test Accuracy</td></tr><tr><td>Random</td><td>Herding</td><td>GCOND</td><td>Random</td><td>Herding</td><td>GCOND</td><td>Whole</td></tr><tr><td>Cora</td><td>0.40</td><td>0.21</td><td>0.76</td><td>82.9</td><td>82.9</td><td>83.1</td><td>82.6</td></tr><tr><td>Citeseer</td><td>0.56</td><td>0.29</td><td>0.79</td><td>71.4</td><td>71.3</td><td>71.3</td><td>71.6</td></tr><tr><td>Ogbn-arxiv</td><td>0.63</td><td>0.60</td><td>0.64</td><td>71.1</td><td>71.2</td><td>71.2</td><td>71.9</td></tr></table>
|
| 406 |
+
|
| 407 |
+
# C.3 TIME COMPLEXITY AND RUNNING TIME
|
| 408 |
+
|
| 409 |
+
Time Complexity. We start from analyzing the time complexity of calculating gradient matching loss, i.e., line 8 to line 11 in Algorithm 1. Let the number of MLP layers in $g _ { \Phi }$ be $L$ and $r$ be the number of sampled neighbors per node. For simplicity, we assume all the hidden units are $d$ for all layers and we use $L$ -layer GCN for the analysis. The forward process of $g _ { \Phi }$ has a complexity of $\dot { O ( N ^ { \prime } { } ^ { 2 } d ^ { 2 } ) }$ . The forward process of GCN on the original graph has a complexity of $O ( r ^ { L } N d ^ { 2 } )$ and that on condensed graph has a complexity of $O ( L N ^ { \prime } { } ^ { 2 } d + \mathbf { \bar { } { } } L \bar { N } ^ { \prime } d )$ . The complexity of calculating the second-order derivatives in backward propagation has an additional factor of $O ( | \pmb { \theta } _ { t } | | \mathbf { A } ^ { \prime } | + | \pmb { \theta } _ { t } | | \mathbf { X } ^ { \prime } | )$ , which can be reduced to $O ( | \theta _ { t } | + | \mathbf { A } ^ { \prime } | + \mathbf { \bar { | } } \mathbf { \bar { X ^ { \prime } } } | )$ with finite difference approximation. Although there are $C$ iterations in line 7-11, we note that the process is easily parallelizable. Furthermore, the process of updating $\theta _ { t }$ in line 16 has a complexity of $\tau _ { \pmb { \theta } } ( L N ^ { \prime 2 } \dot { d } \dot { } + L N ^ { \prime } d )$ . Considering there are $T$ iterations and $K$ different initializations, we multiply the aforementioned complexity by $K T$ . To sum up, we can see that the time complexity linearly increases with number of nodes in the original graph.
|
| 410 |
+
|
| 411 |
+
Running Time. We now report the running time of the proposed GCOND for different condensation rates. Specifically, we vary the condensation rates in the range of $\{ 0 . 1 \% , 0 . 5 \% , 1 \% \}$ on Ogbn-arxiv and $\{ 1 \bar { \% } , 5 \% , 1 \bar { 0 } \% \}$ on Cora. The running time of 50 epochs on one single A100-SXM4 GPU is reported in Table 10.The whole condensation process (1000 epochs) for generating $0 . 5 \%$ condensed graph of Ogbn-arxiv takes around 2.4 hours, which is an acceptable cost given the huge benefits of the condensed graph.
|
| 412 |
+
|
| 413 |
+
Table 10: Running time of GCOND for 50 epochs.
|
| 414 |
+
|
| 415 |
+
<table><tr><td>r</td><td>0.1%</td><td>0.5%</td><td>1%</td><td>r</td><td>1%</td><td>5%</td><td>10%</td></tr><tr><td>Ogbn-arxiv</td><td>348.6s</td><td>428.2s</td><td>609.8s</td><td>Cora</td><td>37.4s</td><td>43.9s</td><td>64.8s</td></tr></table>
|
| 416 |
+
|
| 417 |
+
# C.4 SPARSIFICATION
|
| 418 |
+
|
| 419 |
+
In this subsection, we investigate the effect of threshold $\delta$ on the test accuracy and sparsity. In detail, we vary the values of the threshold $\delta$ used for truncating adjacency matrix in a range of $\{ 0 . 0 1 , 0 . 0 5 , 0 . 1 , 0 . 2 , 0 . 4 , 0 . 6 , 0 . 8 \}$ , and report the corresponding test accuracy and sparsity in Figure 3. From the figure, we can see that increasing $\delta$ can effectively increase the sparsity of the obtained adjacency matrix without affecting the performance too much.
|
| 420 |
+
|
| 421 |
+

|
| 422 |
+
Figure 3: Test accuracy and sparsity under different values of $\delta$ .
|
| 423 |
+
|
| 424 |
+
# C.5 DIFFERENT DEPTH AND HIDDEN UNITS.
|
| 425 |
+
|
| 426 |
+
Depth Versus Hidden Units. We vary the number of model layers (GCN) in a range of $\{ 1 , 2 , 3 , 4 \}$ and the number of hidden units in a range of $\{ 1 6 , 3 2 , 6 4 , 1 2 8 , 2 5 6 \}$ , and test them on the condensed graphs of Cora and Citeseer. The results are reported in Table 11. From the table, we can observe that changing the number of layers impacts the model performance a lot while changing the number of units does not.
|
| 427 |
+
|
| 428 |
+
Table 11: Test accuracy on different numbers of hidden units (H) and layers (L). When $_ \mathrm { L = 1 }$ , there is no hidden layer so the number of hidden units is meaningless.
|
| 429 |
+
|
| 430 |
+
<table><tr><td colspan="5">(a) Cora,r=2.6%</td></tr><tr><td>H\L</td><td>1</td><td>2</td><td>3</td><td>4</td></tr><tr><td>16</td><td>74.8±0.5</td><td>76.8±1.0</td><td>68.0±3.0</td><td>50.9±9.5</td></tr><tr><td>32</td><td>=</td><td>79.2±0.7</td><td>70.4±3.2</td><td>61.1±7.2</td></tr><tr><td>64</td><td></td><td>79.2±1.0</td><td>72.0±3.3</td><td>64.5±2.2</td></tr><tr><td>128</td><td></td><td>79.9±0.3</td><td>76.6±1.8</td><td>61.8±3.8</td></tr><tr><td>256</td><td></td><td>80.1±0.6</td><td>75.9±1.6</td><td>65.6±2.9</td></tr></table>
|
| 431 |
+
|
| 432 |
+
(b) Citeseer, $r { = } 1 . 8 \%$
|
| 433 |
+
|
| 434 |
+
<table><tr><td>H\L</td><td>1</td><td>2</td><td>3</td><td>4</td></tr><tr><td>16</td><td>58.6±12.1</td><td>69.2±1.3</td><td>56.9±8.4</td><td>40.4±1.2</td></tr><tr><td>32</td><td></td><td>69.4±1.3</td><td>59.9±10.2</td><td>42.6±3.6</td></tr><tr><td>64</td><td></td><td>69.7±1.5</td><td>62.3±10.3</td><td>43.6±3.7</td></tr><tr><td>128</td><td></td><td>70.2±1.4</td><td>63.3±9.7</td><td>51.6±1.8</td></tr><tr><td>256</td><td></td><td>70.6±0.9</td><td>63.5±10.0</td><td>52.9±5.5</td></tr></table>
|
| 435 |
+
|
| 436 |
+
Table 12: Cross-depth accuracy on Cora, $r { = } 2 . 6 \%$
|
| 437 |
+
|
| 438 |
+
<table><tr><td>C\T</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td></tr><tr><td>2</td><td>80.30</td><td>80.70</td><td>79.46</td><td>76.06</td><td>71.23</td></tr><tr><td>3</td><td>40.62</td><td>72.37</td><td>40.14</td><td>67.19</td><td>35.02</td></tr><tr><td>4</td><td>74.24</td><td>72.56</td><td>76.26</td><td>71.70</td><td>65.12</td></tr><tr><td>5</td><td>71.31</td><td>75.73</td><td>70.95</td><td>73.13</td><td>67.12</td></tr><tr><td>6</td><td>75.20</td><td>75.18</td><td>75.67</td><td>76.16</td><td>75.00</td></tr></table>
|
| 439 |
+
|
| 440 |
+
Propagation Versus Transformation. We further study the effect of propagation and transformation on the condensed graph. We use Cora as an example and use SGC as the test model due to its decoupled architecture. Specifically, we vary both the propagation layers and transformation layers of SGC in the range of $\{ \bar { 1 } , 2 , 3 , 4 , \bar { 5 } \}$ , and report the performance in Table 13. As can be seen, the condensed graph still achieves good performance with 3 and 4 layers of propagation. Although the condensed graph is generated under 2-layer SGC, it is able to generalize to 3-layer and 4-layer SGC. When increasing the propagation to 5, the performance degrades a lot which could be the cause of the oversmoothing issue. On the other hand, stacking more transformation layers can first help boost the performance but then hurt. Given the small scale of the graph, SGC suffers the overfitting issue in this case.
|
| 441 |
+
|
| 442 |
+
Cross-depth Performance. We show the cross-depth performance in Table 12. Specifically, we use SGC of different depth in the condensation to generate condensed graphs and then use them to test on SGC of different depth. Note that in this table, we set weight decay to 0 and dropout to 0.5. We can observe that usgin a deeper GNN is not always helpful. Stacking more layers do not necessarily mean we can learn better condensed graphs since more nodes are involved during the optimization, and this makes optimization more difficult.
|
| 443 |
+
|
| 444 |
+
Table 13: Test accuracy of SGC on different transformations and propagations for Cora, $r { = } 2 . 6 \%$
|
| 445 |
+
|
| 446 |
+
<table><tr><td>Trans\Prop</td><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td></tr><tr><td>1</td><td>77.09±0.43</td><td>79.02±1.17</td><td>78.12±2.13</td><td>74.04±3.60</td><td>61.19±7.73</td></tr><tr><td>2</td><td>76.94±0.50</td><td>79.01±0.57</td><td>79.11±1.15</td><td>77.57±1.03</td><td>72.37±4.25</td></tr><tr><td>3</td><td>75.28±0.58</td><td>77.95±0.67</td><td>74.16±1.50</td><td>70.58±3.71</td><td>58.28±8.90</td></tr><tr><td>4</td><td>66.87±0.73</td><td>66.54±0.82</td><td>59.24±1.60</td><td>43.94±6.33</td><td>30.45±9.67</td></tr><tr><td>5</td><td>46.44±0.91</td><td>37.29±3.23</td><td>16.05±2.74</td><td>15.33±2.79</td><td>15.33±2.79</td></tr></table>
|
| 447 |
+
|
| 448 |
+
# C.6 VISUALIZATION OF NODE FEATURES.
|
| 449 |
+
|
| 450 |
+
In addition, we provide the t-SNE (Van der Maaten & Hinton, 2008) plots of condensed node features to further understand the condensed graphs. In Cora and Citeseer, the condensed node features are well clustered. For Ogbn-arxiv and Reddit, we also observe some clustered pattern for the nodes within the same class. In contrast, the condensed features are less discriminative in Flickr, which indicates that the condensed structure information can be essential in training GNN.
|
| 451 |
+
|
| 452 |
+

|
| 453 |
+
Figure 4: The t-SNE plots of node features in condensed graphs.
|
| 454 |
+
|
| 455 |
+
# C.7 PERFORMANCES ON ORIGINAL GRAPHS
|
| 456 |
+
|
| 457 |
+
We show the performances of various GNNs on original graphs in Table 14 to serve as references.
|
| 458 |
+
|
| 459 |
+
Table 14: Performances of various GNNs on original graphs. SAGE: GraphSAGE.
|
| 460 |
+
|
| 461 |
+
<table><tr><td></td><td>GAT</td><td>Cheby</td><td>SAGE</td><td>SGC</td><td>APPNP</td><td>GCN</td></tr><tr><td>Cora</td><td>83.1</td><td>81.4</td><td>81.2</td><td>81.4</td><td>83.1</td><td>81.2</td></tr><tr><td>Citeseer</td><td>70.8</td><td>70.2</td><td>70.1</td><td>71.3</td><td>71.8</td><td>71.7</td></tr><tr><td>Ogbn-arxiv</td><td>71.5</td><td>71.4</td><td>71.5</td><td>71.4</td><td>71.2</td><td>71.7</td></tr><tr><td>Flickr</td><td>44.3</td><td>47.0</td><td>46.1</td><td>46.2</td><td>47.3</td><td>47.1</td></tr><tr><td>Reddit</td><td>91.0</td><td>93.1</td><td>93.0</td><td>93.5</td><td>94.3</td><td>93.9</td></tr></table>
|
| 462 |
+
|
| 463 |
+
# C.8 EXPERIMENTS ON PUBMED.
|
| 464 |
+
|
| 465 |
+
We also show the experiments for Pubmed with condensation ratio of $0 . 3 \%$ in Table 15. From the table, we can observe that GCOND approximates the original performance very well $( 7 7 . 9 2 \%$ vs. $7 9 . 3 2 \%$ on GCN). It also generalizes well to different architectures and outperforms GCOND-X and DC-Graph, indicating that it is important to leverage the graph structure information and learn a condensed structure.
|
| 466 |
+
|
| 467 |
+
Table 15: Performance of different GNNs on Pubmed $\scriptstyle { r = 0 . 3 \% }$ ).
|
| 468 |
+
|
| 469 |
+
<table><tr><td></td><td>APPNP</td><td>Cheby</td><td>GCN</td><td>GraphSage</td><td>SGC</td></tr><tr><td>DC-Graph</td><td>72.76±1.39</td><td>72.66±0.59</td><td>72.44±2.90</td><td>71.96±2.50</td><td>75.43±0.65</td></tr><tr><td>GCOND-X</td><td>73.91±0.41</td><td>74.57±1.00</td><td>71.81±0.94</td><td>73.10±2.08</td><td>76.72±0.65</td></tr><tr><td>GCOND</td><td>76.77±1.17</td><td>75.48±0.82</td><td>77.92±0.42</td><td>71.12±3.10</td><td>75.91±1.38</td></tr></table>
|
| 470 |
+
|
| 471 |
+
# D MORE RELATED WORK
|
| 472 |
+
|
| 473 |
+
Graph pooling. Graph pooling (Zhang et al., 2018; Ying et al., 2018b; Gao & Ji, 2019) also generates a coarsened graph with smaller size. Zhang et al. (2018) is one the first to propose an end-to-end architecture for graph classification by incorporating graph pooling. Later, DiffPool (Ying et al., 2018b) proposes to use GNNs to parameterize the process of node grouping. However, those methods are majorly tailored for the graph classification task and the coarsened graphs are a byproduct graph during the representation learning process.
|
md/dev/azCKuYyS74/azCKuYyS74.md
ADDED
|
@@ -0,0 +1,347 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# WHAT DO SELF-SUPERVISED VISION TRANSFORMERS LEARN?
|
| 2 |
+
|
| 3 |
+
Namuk $\mathbf { P a r k } ^ { 1 * }$ Wonjae $\mathbf { K i m ^ { 2 } }$ Byeongho Heo2 Taekyung $\mathbf { K i m ^ { 2 } }$ Sangdoo Yun2 1Prescient Design, Genentech 2NAVER AI Lab park.namuk@gene.com {wonjae.kim,bh.heo,taekyung.k,sangdoo.yun}@navercorp.com
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
We present a comparative study on how and why contrastive learning (CL) and masked image modeling (MIM) differ in their representations and in their performance of downstream tasks. In particular, we demonstrate that self-supervised Vision Transformers (ViTs) have the following properties: (1) CL trains selfattentions to capture longer-range global patterns than MIM, such as the shape of an object, especially in the later layers of the ViT architecture. This CL property helps ViTs linearly separate images in their representation spaces. However, it also makes the self-attentions collapse into homogeneity for all query tokens and heads. Such homogeneity of self-attention reduces the diversity of representations, worsening scalability and dense prediction performance. (2) CL utilizes the lowfrequency signals of the representations, but MIM utilizes high-frequencies. Since low- and high-frequency information respectively represent shapes and textures, CL is more shape-oriented and MIM more texture-oriented. (3) CL plays a crucial role in the later layers, while MIM mainly focuses on the early layers. Upon these analyses, we find that CL and MIM can complement each other and observe that even the simplest harmonization can help leverage the advantages of both methods.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Contrastive Learning (CL) (He et al., 2020; Chen et al., 2020a;b; 2021) has been the most popular self-supervised learning methods until recently. It aims to learn the invariant semantics of two random views (Tian et al., 2020a;b) by making global projections of representations similar for positive samples and dissimilar for negative samples. Since CL exploits the globally projected representations to contrast each other, it can be deemed as an “image-level” self-supervised learning approach.
|
| 12 |
+
|
| 13 |
+
Deviating from CL, masked image modeling (MIM) (Bao et al., 2022; Xie et al., 2022b; He et al., 2022) has risen as a strong competitor of CL in the era of Vision Transformers (ViTs) (Dosovitskiy et al., 2021) with its impressive performances of downstream tasks. MIM trains ViTs by reconstructing the correct semantics of masked input patches. Unlike CL, it learns the semantics of patch tokens and this can be deemed as a “token-level” self-supervised learning approach. Since MIM outperforms CL in fine-tuning accuracy, it may appear prima facie as a more effective pre-training method than CL. However, a different trend is observed for linear probing accuracy with CL outperforming MIM (See Figure 1). For further exposition on CL and MIM, we refer the reader to Appendix B.
|
| 14 |
+
|
| 15 |
+
Then, which method—CL or MIM—should we use for the self-supervised learning of ViTs? Although both methods are widely used, little is known about what they learn. This paper sheds light on their nature by showing that ViTs trained through CL and MIM learn opposite knowledge. In particular, we raise questions to better understand self-supervised learning, and then find the answers that can potentially affect future improvements. The questions posed can be divided into the following properties of Vision Transformers: the behavior of self-attentions, the transformation of the representations, and the position of lead role components. Our key questions and findings are elaborated below.
|
| 16 |
+
|
| 17 |
+
How do self-attentions behave? (Section 2) We find that CL primarily captures global relationships, while MIM captures local relationships. This implies that the representations of CL contain more global patterns, such as object shapes, than those of MIM. On the one hand, this property helps
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: CL outperforms MIM in linear probing and small model regimes. In contrast, MIM excels in fine-tuning, large model regimes, and dense prediction. Red squares $\mathbf { \eta } ( \equiv )$ denote CL, and blue triangles $\left( \mathbf { \Omega } _ { \blacktriangle } \right)$ denote MIM. By default, we report the performance of ViT-B trained or pretrained on ImageNet-1K. We use the results from original papers and He et al. (2022) for object detection. Regarding the scaling experiment, we report the results that we reproduced based on official configurations except with 100 epochs, marking them as $\mathbf { M o C o ^ { \dagger } }$ and $\bar { \mathrm { S i m M I M ^ { \dag } } }$ . Left: CL outperforms MIM in linear probing but underperforms in fine-tuning. Middle: CL outperforms MIM in small model regimes (ViT-Ti and ViT-S), and MIM shows superior scalability in large model regimes (ViT-L and ViT-H). Right: MIM outperforms CL in the dense prediction downstream tasks, such as object detection with Mask R-CNN (He et al., 2017) on COCO (Lin et al., 2014).
|
| 21 |
+
|
| 22 |
+
CL recognize objects and distinguish images. On the other hand, however, it also suggests that CL struggles to preserve local information. In particular, we observe that self-attentions of CL in the later layers for all query tokens and heads collapse into homogeneous attention maps. In such cases, most self-attention maps focus on object boundaries, meaning that they can capture object shapes but may lose interaction diversity between tokens. Consequently, CL and MIM each have advantages over different tasks: CL works well for linear probing and classification tasks with smaller models, whereas MIM outperforms CL in fine-tuning and dense prediction tasks with larger models.
|
| 23 |
+
|
| 24 |
+
How are representations transformed? (Section 3) CL transforms representations mainly based on image-level information, and its self-attentions collect information on object shape over entire tokens. This process makes tokens similar rather than diversifying them. As a result, CL distinguishes images well but has difficulty distinguishing tokens. On the contrary, MIM preserves and amplifies token-level information. Thus, the self-attentions for each token are substantially different and prohibit each token from including redundant information. We observe the consistent property from our Fourier analysis: CL primarily utilizes the low-frequency signals, but MIM utilizes high-frequencies. This observation suggests that CL is shape-biased and MIM is texture-biased. In sum, self-supervised models trained with CL and MIM learn the representations in different levels of detail.
|
| 25 |
+
|
| 26 |
+
Which components play an important role? (Section 4) Analyses of the importance of each CL and MIM layer demonstrate that the later layers in CL and early layers in MIM play a key role. We interpret this as a consistent observation since early layers are usually known to capture low-level features—e.g., local patterns, high-frequency signals, and texture information—and later layers capture global patterns, low-frequency signals, and shape information (Dosovitskiy et al., 2021; Raghu et al., 2021; d’Ascoli et al., 2021; Graham et al., 2021; Dai et al., 2021; Park & Kim, 2022b).
|
| 27 |
+
|
| 28 |
+
From the above analyses and insights, we find that CL and MIM can complement each other and show in Section 5 that even the simplest implementation, such as a linear combination of CL and MIM objectives, can take advantage of both methods. Surprisingly, the hybrid models outperform those pre-trained with either CL or MIM both in terms of fine-tuning and linear probing accuracy.
|
| 29 |
+
|
| 30 |
+
# 2 HOW DO SELF-ATTENTIONS BEHAVE?
|
| 31 |
+
|
| 32 |
+
We point out that CL and MIM may not be silver bullets for all tasks, as shown in Figure 1. CL generally outperforms MIM in linear probing, while MIM dominates CL in the fine-tuning scheme. However, when we dissect the size of the model, CL outperforms MIM after fine-tuning for small models (cf. (Wang et al., 2022)), while MIM performs better on large models. Also, MIM yields effective representations for dense prediction tasks, such as object detection, but CL falls short on those tasks. This section explains these phenomena by investigating the behavior of self-attentions.
|
| 33 |
+
|
| 34 |
+

|
| 35 |
+
Figure 2: Self-attentions of CL (MoCo) capture global relationships, but they collapse into homogeneous attention maps for all query tokens and heads. Self-attentions of MIM (SimMIM) mainly focus on local areas. We visualize the attention maps for two different query tokens in the beginning through the end layers. We omit the results for self-attention heads, which show mostly consistent results. Left: Self-attentions of CL capture global patterns and the shape of an object. However, all attention maps capture the same shape information regardless of the query tokens. Right: Self-attentions of MIM capture local patterns and are correlated with query tokens.
|
| 36 |
+
|
| 37 |
+
Our analyses mainly compare ViT-B/16 pre-trained on ImageNet-1K (Russakovsky et al., 2015) with MoCo v3 (Chen et al., 2021) and SimMIM (Xie et al., 2022b). We use the ImageNet validation images for our experiments. We observe that other methods, e.g., DINO (Caron et al., 2021), BEiT (Bao et al., 2022), and MAE (He et al., 2022), have consistent properties (See Figure C.1).
|
| 38 |
+
|
| 39 |
+
CL mainly captures global relationships. We measure the ranges of self-attentions via attention distance (Dosovitskiy et al., 2021). Attention distance is defined as the average distance between the query tokens and key tokens considering their self-attention weights. Therefore, it conceptually corresponds to the size of the receptive fields in CNNs.
|
| 40 |
+
|
| 41 |
+
Figure 3 shows that the attention distance of CL (MoCo) is significantly higher than that of MIM (SimMIM), especially in the later layers. As seen in Figure 2, the qualitative visualization, this implies that the representations of CL contain global patterns and shape information, so CL can help ViTs distinguish between objects of images. Conversely, the self-attentions of MIM mainly capture local relationships; i.e., MIM may have difficulty recognizing whole objects and their shapes. Section 3 also discuss this claim from a representational perspective.
|
| 42 |
+
|
| 43 |
+

|
| 44 |
+
Figure 3: Effective receptive fields of CL are global, but those of MIM are local. This is particularly evident in the later layers.
|
| 45 |
+
|
| 46 |
+
Self-attentions of CL collapse into homogeneity. We observe an interesting behavior of CL in Figure 2, which shows the attention maps for query tokens from two different spatial locations. The self-attentions of CL surprisingly indicate almost identical object shapes for the two query tokens, compared to that of MIM. We describe this phenomenon as an attention collapse into homogeneity. This collapsing trend in the selfattentions of CL is observed across all the heads and query tokens. In contrast, the self-attentions of MIM are more faithful to the two query tokens, as expected.
|
| 47 |
+
|
| 48 |
+
We use normalized mutual information (NMI) (Strehl & Ghosh, 2002) to measure the attention collapse. Let $p ( q )$ be a distribution of query tokens, and assume that these query tokens are uniformly distributed since a single query token is given for each spatial coordinate, i.e., $p ( q ) = 1 / N$ where $N$ is the number of the tokens. Then the joint distribution of query and key tokens is $p ( q , k ) = \pi ( k | q ) p ( q )$ where $\pi ( k | q )$ is the softmax-normalized self-attention matrix. Thus, the normalized mutual information is $\frac { I ( \boldsymbol { q } , \boldsymbol { k } ) } { \sqrt { H ( \boldsymbol { q } ) H ( \boldsymbol { k } ) } }$ where $I ( \cdot , \cdot )$ is the mutual information and $H ( \cdot )$ is the marginal entropy. Low mutual information values show that attention maps are less dependent on the query tokens, implying an attention collapse into homogeneity. Conversely, high mutual information means that the attention maps strongly depend on the query tokens.
|
| 49 |
+
|
| 50 |
+

|
| 51 |
+
Figure 4: Self-attentions of CL have little to do with query tokens. Normalized MI of CL is significantly lower than that of MIM in the later layers.
|
| 52 |
+
|
| 53 |
+

|
| 54 |
+
Figure 5: CL lacks representational diversity in the later layers. We measure cosine similarities of representations in the self-attentions between the heads (left), depths (middle), and spatial coordinates (right). All of the results show that the representational similarity of later self-attentions of CL is higher than that of MIM. Increasing heads or depths of CL is not effective in improving the diversity. Left: The similarity of representations from two heads in self-attention. Middle: The similarity between representations before and after self-attentions transform them. Right: The similarities of representations at two spatial coordinates. ViT- $\{ \boldsymbol { \mathbf { } } \boldsymbol { \mathbf { } } , \boldsymbol { \mathbf { } } \mathbf { \boldsymbol { L } } \}$ is trained with 100 epochs.
|
| 55 |
+
|
| 56 |
+
Figure 4 shows the degree of attention collapse in terms of the normalized mutual information (NMI). Results show that the mutual information of CL is significantly lower than that of MIM in the later layers, suggesting that the self-attentions of CL tend to collapse into homogeneous distributions.
|
| 57 |
+
|
| 58 |
+
Attention collapse reduces representational diversity. We conjecture that the self-attention collapse into homogeneity eventually leads to homogeneous token representations. To support this argument, we measure representational cosine similarities. In particular, we design three similarities: between different self-attention heads (heads), between the before and after self-attention layers (depths), and between different tokens (tokens).
|
| 59 |
+
|
| 60 |
+
Figure 5 shows the results, reporting the representation similarities for heads, depths, and tokens. As expected, the similarities of CL are notably higher than those of MIM in the later layers, indicating that the representations of CL have significant homogeneity. Even increasing the model size does not solve the problem CL has and may rather worsen it. Increasing the number of heads (ViT-S to ViT-B; Figure 5a) improves the representational diversity of MIM, but hardly improves the diversity of CL. Increasing the depth of CL (ViT-B to ViT-L; Figure 5b) only adds redundant modules.
|
| 61 |
+
|
| 62 |
+
Implications of the behaviors we observed. In conclusion, the self-attention of CL captures global patterns and shapes of objects. However, CL suffers from the problem of attention collapse into homogeneity, which reduces the diversity of token representations. On the other hand, MIM primarily captures local patterns and thus does not suffer from the attention collapse problem.
|
| 63 |
+
|
| 64 |
+
The behaviors mentioned above can explain the phenomena we observed in Figure 1:
|
| 65 |
+
|
| 66 |
+
• CL outperforms MIM in linear probing tasks because it captures shapes, which helps recognize objects and distinguish images. Although MIM preserves the texture and diversity of representations, their correlation with objects or content may not be as strong as shapes do.
|
| 67 |
+
• The attention collapse prohibits CL from fully exploiting heads, depths, and tokens of ViTs. Since homogeneous representations are not very helpful in improving token representations, ViTs trained with CL waste a large part of network capability. Therefore, the fine-tuning accuracy of MIM is significantly higher than CL in large models.
|
| 68 |
+
• CL is not suitable for dense prediction since the token features are homogeneous with respect to their spatial coordinates.
|
| 69 |
+
|
| 70 |
+

|
| 71 |
+
Figure 6: Self-attention layers of CL and MIM transform representations differently. We visualize 196 spatial representation tokens for an example validation image in a representation space. The blue (•) and red (•) data points denote the tokens before and after the self-attention transformation. Left: The self-attentions of CL (e.g., MoCo) translate all the tokens equally, so the distances between the tokens of an image do not increase. Middle: However, CL moves the “centers of representations (represented by $\times ) ^ { \dag }$ away from each other. Therefore, the images are linearly separable. The circle $( \bullet )$ and triangle $( \triangle )$ data represent tokens from different images. Right: The self-attentions of MIM (e.g., SimMIM) transform representations differently according to query tokens, thus increasing the distances between tokens. See Figure 7 for quantitative analyses.
|
| 72 |
+
|
| 73 |
+
We further investigate the self-attention’s behavior with restricted receptive fields in Figure D.1. As shown in the experiment, locally restricted self-attentions lead to lower linear probing but higher fine-tuning accuracy, which is consistent with our observations.
|
| 74 |
+
|
| 75 |
+
# 3 HOW ARE REPRESENTATIONS TRANSFORMED?
|
| 76 |
+
|
| 77 |
+
In this section, we analyze the token representations of ViTs pre-trained with CL and MIM to demonstrate how the properties of self-attentions we observed in Section 2 affect the representations differently. We use the same pre-trained ViT-B/16 models by default default just as we did in Section 2.
|
| 78 |
+
|
| 79 |
+
CL transforms all tokens in unison, while MIM does so individually. To show how CL and MIM transform token representations, we visualize them in representation space. Figure 6 shows 196 ( $1 4 \times 1 4$ patches) tokens before and after self-attention modules from a single image sample of the ImageNet validation set. We use the three large singular vectors obtained via singular value decomposition (SVD) as the bases of the space. To better visualize this, we display the representation of MoCo and SimMIM in their crucial layers—the last layer and the first layer, respectively.
|
| 80 |
+
|
| 81 |
+
Figure 6a visualizes the changes that occur in the tokens of CL when transformed by self-attention module; it indicates that the self-attentions of CL translate all tokens in unison. This phenomenon occurs because the self-attention maps of CL are homogeneous, i.e., self-attention is almost independent of the spatial coordinates and query tokens. Therefore, the modules add near-constant to all the token representations. As a result, the inter-representation distance and the volume of representations do not increase, which implies that CL cares less about individual tokens.
|
| 82 |
+
|
| 83 |
+
Nevertheless, self-attentions are essential for the discriminative power of CL. As shown in Figure 6b, they help distinguish images by moving “the centers of the representation distribution” away from each other. In short, this figure suggests that CL makes the image linearly separable even though it loses the ability to distinguish tokens.
|
| 84 |
+
|
| 85 |
+
In contrast, MIM applies a different transformation to individual tokens, as shown in Figure 6c, because different self-attentions are assigned to the individual spatial tokens. Thus, MIM alters the distance between tokens of a single image as well as the volume of the representation distribution.
|
| 86 |
+
|
| 87 |
+
We find consistent results in quantitative analysis. Inspired by Jing et al. (2022), Figure 7 visualizes singular value spectra for tokens and images. A singular value spectrum provides singular values of a representation distribution obtained by SVD, so we can use it to represent the effective volume of distributions in a representation space. The higher the singular value in a spectrum, the larger the volume of a representation distribution. To calibrate the scale, we use the relative log singular value ( $\Delta$ Log singular value), the difference with the (second) largest singular value for a depth.
|
| 88 |
+
|
| 89 |
+

|
| 90 |
+
Figure 7: CL barely changes or even decreases the distribution volume of tokens from a single image, implying that it hardly distinguishes between token. Instead, it significantly increases the distribution volume of images. To demonstrate these properties, we visualize singular value spectra, the singular values of the distribution of representations sorted by the magnitude. The higher a singular value, the larger the volume of a distribution. The right of this figure shows the $6 4 ^ { \mathrm { { \bar { t h } } } }$ and $1 2 8 ^ { \mathrm { { \bar { t h } } } }$ highest singular value for depth. Top: Singular value spectra of tokens from a single image. CL decreases the singular values of the tokens, but MIM increases. Bottom: Singular value spectra of images. CL significantly increases the volumes occupied by images, but MIM hardly does so.
|
| 91 |
+
|
| 92 |
+
Figure 7a shows singular value spectra of tokens from a single image. We calculate them for each image in the ImageNet validation set and report averaged singular values over the dataset. In this figure, the CL layers hardly increase or even decrease the singular value; consistent with the explanation above, this implies that CL hardly distinguishes tokens. In contrast, MIM increases the singular value, meaning that it changes the volume of tokens and can distinguish tokens. Another interesting observation is that a few later layers of MIM decrease the volume, even though they capture local patterns as shown in Figures 3 and 4. This is because they behave like decoders. Section 4 discusses this in detail.
|
| 93 |
+
|
| 94 |
+
Figure 7b shows the singular value spectra of images. We average all tokens in an image to build an image-level representation vector and conduct a singular value spectrum over the collection of representations in the validation set. As opposed to the previous case, the representational volume of CL is larger than that of MIM, which implies that CL makes the image-level representation separable.
|
| 95 |
+
|
| 96 |
+
CL exploits low-frequencies, and MIM exploits high-frequencies. We hypothesize that CL captures low-frequency and MIM captures high-frequency information in spatial dimensions since CL provides image-level self-supervision to capture global patterns, while MIM provides token-level self-supervision to exploit local patterns. To support this argument from a frequency perspective, we conduct a Fourier analysis of the representations as following Park & Kim (2022b). In particular, we report the relative log amplitude of Fourier-transformed representations by calculating the amplitude difference between the highest and lowest frequencies of representations.
|
| 97 |
+
|
| 98 |
+
Figure 9 visualizes the relative amplitudes of CL and MIM. It shows that the high-frequency amplitude of CL is significantly smaller than that of MIM, suggesting that CL mainly utilizes low-frequency spatial information such as global structures and shapes. On the contrary, MIM usually uses highfrequency spatial information such as narrow structures and fine textures.
|
| 99 |
+
|
| 100 |
+

|
| 101 |
+
Figure 8: CL is biased toward shape, whereas MIM is biased toward texture. We report the predictive results of models for linear probing tasks. However, we observe consistent results in finetuned models (See Figure F.2). Left: Result of classification on Stylized ImageNet. It shows that CL is more shape-biased than MIM and even than the supervised pre-trained model. Vertical lines represent averaged results for the shape categories. We also report the results of supervised ViT with ImageNet1K class labels for comparison. Right: Accuracy drops on images with frequency-based random noises. MIM shows a more significant amount of accuracy drop than CL with high-frequency noises, demonstrating MIM’s texture-biased property. The frequency window size of the frequency-based noise is $0 . 1 \pi$ .
|
| 102 |
+
|
| 103 |
+
Another interesting finding is that the last few layers of MIM reduce the high frequencies even though they only focus on local areas (See Figure 3). We conjecture that MIM implicitly divides ViTs into the encoder-decoder structure and allows intermediate layers to have linearly separable information. In contrast, CL allows the last layer to have such information. This is further elaborated in Figure 11.
|
| 104 |
+
|
| 105 |
+
CL is shape-biased, but MIM is texture-biased. Based on the results of the Fourier analysis, we assume that CL and MIM each have a bias toward shapes and textures, respectively. To demonstrate this claim, we use Stylized ImageNet (Geirhos et al., 2019), a texture-altered dataset, by using AdaIN (Huang & Belongie, 2017). Figure 8a reports the linear probing results on Stylized ImageNet to evaluate the shape and texture biases of pre-trained models. Compared to the model pre-trained with supervised learning, CL depends more on the shape and MIM depends on texture of images to classify images. In other words, CL is robust to texture changes, and MIM is vulnerable to them.
|
| 106 |
+
|
| 107 |
+

|
| 108 |
+
Figure 9: CL exploits low-frequency, but MIM exploits high-frequency. Moreover, a few last layers of CL reduce high-frequency by capturing global patterns. MIM also reduces it even though they capture local patterns, because the later layers behave like decoders. See also Figure 11.
|
| 109 |
+
|
| 110 |
+
Figure 8b shows the consistent results. In this experiment, we follow Park & Kim (2022a;b) and measure the decrease in accuracy on the ImageNet dataset with frequency-based random noise. The results suggest that CL is robust to high-frequency noises, but MIM is significantly more vulnerable to them. Since high-frequency noises harm the fine details of images, we arrive at the same conclusion that CL is more shape-biased and MIM is texture-biased. This can explain the robustness of CL against adversarial perturbations (Bordes et al., 2022).
|
| 111 |
+
|
| 112 |
+
# 4 WHICH COMPONENTS PLAY AN IMPORTANT ROLE?
|
| 113 |
+
|
| 114 |
+
The previous sections consistently show through various perspectives that CL exploits image-level global patterns while MIM captures token-level local patterns. This section analyzes pre-trained ViTs from an architectural perspective and shows that the key components in CL and MIM are different.
|
| 115 |
+
|
| 116 |
+

|
| 117 |
+
Figure 10: The explicit decoder architecture of MAE helps ViTs effectively leverage the advantages of MIM. We analyze the encoder and decoder of a pre-trained model with a masking ratio of zero. The left side of each figure represents the encoder and the right side the decoder. Left: The mutual information of MAE is lower than that of SimMIM in the encoder but higher in the decoder. Right: The decoder of MAE captures low-frequency information, and its encoder captures high-frequency information. Moreover, the later layers (excluding the last layer) of MAE do not reduce high-frequency information, while those of SimMIM do.
|
| 118 |
+
|
| 119 |
+
Later layers of CL and early layers of MIM are important. According to studies on ViT (Graham et al., 2021; Dai et al., 2021; Park & Kim, 2022b), the later layers use high-level information, and the early layers exploit low-level information. Since CL and MIM each exploit global and local patterns, we expect that the later layers of CL and early layers of MIM play a key role.
|
| 120 |
+
|
| 121 |
+
To evaluate the importance of each layer, we measure the linear probing accuracy using intermediate representations with the configuration of Table A.1. In Figure 11, we observe the following properties: First, the linear probing accuracy of MIM is higher than that of CL at the beginning. Conversely, CL outperforms MIM at the end of the model. Such result indicates that the later layers of CL and early layers of MIM play an important role in making linearly separable representations. Second, the accuracy of CL increases with increasing depth as expected, but the accuracy of MIM surprisingly decreases at the end of the model, i.e., the later layers of MIM are not very helpful in separating representations. We explain this observation as a phenomenon in which MIM methods with shallow prediction heads, e.g., SimMIM, use later layers of the backbone as a decoder. Therefore, MIM with a deep self-attention decoder, e.g., MAE (He et al., 2022), can be useful for linear probing performance. Moreover, it also explains why SimMIM’s high-frequency component and representational volumes drop in the later layers as shown in Figures 7 and 9. Third, even the highest linear probing accuracy of MIM is lower than that of CL.
|
| 122 |
+
|
| 123 |
+

|
| 124 |
+
Figure 11: Later layers of CL and early layers of MIM play a key role. We report linear probing accuracies by using the representations of the intermediate layers. CL outperforms MIM in later layers, and MIM outperforms CL in early layers.
|
| 125 |
+
|
| 126 |
+
The explicit decoder helps ViTs further leverage the advantages of MIM. Several previous observations find that the implicit decoder of MIM with a shallow prediction head, such as SimMIM, can impair performance. MAE (He et al., 2022) addresses this problem by introducing deep explicit ViT decoders and reconstructing masked tokens only in the separate decoders.
|
| 127 |
+
|
| 128 |
+
In Figure 10, we analyze MAE to understand the properties of decoders more deeply. Figure 10a shows the self-attention behaviors. The results indicate that the mutual information of MAE is lower than that of SimMIM in the later layers of the encoder but higher in the decoder, implying that the decoder reconstructs masked tokens based on its neighborhood tokens.
|
| 129 |
+
|
| 130 |
+
Figure 10b shows the results of the Fourier analysis. As explained in Figure 9, the last four layers of SimMIM reduce the high-frequency components. In contrast, the later layers (excluding the last layer) of MAE do not reduce them. Instead, the decoder of MAE prioritizes low-frequency information compared with the encoder, allowing the backbone to efficiently utilize high-frequency information.
|
| 131 |
+
|
| 132 |
+

|
| 133 |
+
Figure 12: The simple linear combination of CL (MoCo) and MIM (SimMIM) objectives outperforms the vanilla CL and MIM. $\lambda$ is the importance weight of CL, so $\lambda = 0$ means SimMIM and $\lambda = 1$ means MoCo. Left: $\mathrm { ^ { * } C L } + \mathrm { M I M ^ { 3 } }$ outperforms CL and MIM in both linear probing and fine-tuning accuracy. Middle: Mutual information of $\mathrm { ^ { * } C L } + \mathrm { M I M ^ { \mathrm { * } } }$ decreases at the end of the model, suggesting that the self-attentions of later layers collapse into homogeneity and capture the same object shape information. Right: Fourier analysis shows that $\mathbf { \dot { C } L } + \mathbf { M I M } ^ { \prime }$ amplifies high frequencies at the beginning and reduces them at the end. It implies that $\mathrm { ^ { * } C L } + \mathrm { M I M ^ { 3 } }$ exploits high-frequency information at the beginning and low-frequency information at the end.
|
| 134 |
+
|
| 135 |
+
# 5 ARE THE TWO METHODS COMPLEMENTARY TO EACH OTHER?
|
| 136 |
+
|
| 137 |
+
We present comparative analyses on CL and MIM from three perspectives: self-attentions, representation transforms, and the position of important layers. All of our results indicate that CL and MIM train ViTs differently. These differences naturally imply that combining CL and MIM to train a backbone may help leverage the advantages of both methods.
|
| 138 |
+
|
| 139 |
+
To show that CL and MIM are complementary, we introduce the simplest way to harmonize CL and MIM by linearly combining two losses, i.e., $\mathcal { L } = ( 1 - \lambda ) \mathcal { L } _ { \mathrm { M I M } } + \bar { \lambda } \mathcal { L } _ { \mathrm { C L } }$ where ${ \mathcal { L } } _ { \mathrm { M I M } }$ and ${ \mathcal { L } } _ { \mathrm { C L } }$ each indicate the losses of MIM and CL, and $\lambda$ is the importance weight of CL. We find that this simple hybrid model trained with combined losses efficiently exploits the strengths of both methods. Figure 12a shows linear probing and fine-tuning accuracy on ImageNet with varying $\lambda$ . Surprisingly, the hybrid models outperform MIM $\lambda = 0$ ) and CL $\lambda = 1$ ) in both aspects. Figure 12b and Figure 12c can provide insights on how hybrid models behave by analyzing the model with $\lambda = 0 . 2$ in terms of self-attentions in Section 2 and Fourier analysis in Section 3, respectively; both results show that the hybrid model exploits MIM properties in the early layers and CL properties in the later layers. In particular, Figure 12b indicates that the self-attentions of the early layers are changed according to the query token but those of the later layers are not. Likewise, Figure 12c shows that the early layers exploit high-frequency, while the later layers try to exploit low-frequency.
|
| 140 |
+
|
| 141 |
+
# 6 CONCLUSION
|
| 142 |
+
|
| 143 |
+
We conducted a comparative study highlighting various facets of two widely used self-supervised learning methods for vision transformers: contrastive learning (CL) and masked image modeling (MIM). The study demonstrated many opposing properties of the two methods: image information (image-level vs. token-level; as in Section 2), feature representations (low-frequency vs. highfrequency; as in Section 3), and lead role components (later layers vs. early layers; as in Section 4). Furthermore, we suggested a possible application that exploits only the benefits from both methods and showed how a combined model can outperform individual methods.
|
| 144 |
+
|
| 145 |
+
Future directions. Various future directions can be explored based on our study. We believe that there are better ways than a simple linear combination of CL and MIM objectives. For example, a novel self-supervised learning approach, in which CL is applied in the later layers and MIM in the early layers, can be considered. Moreover, we may extend our findings on self-supervision for multi-stage ViTs, such as PiT (Heo et al., 2021) and Swin (Liu et al., 2021). Another interesting direction is to enhance the individual properties of CL and MIM. Techniques that help CL or MIM learn shapes or textures, respectively, may also improve performance.
|
| 146 |
+
|
| 147 |
+
# REFERENCES
|
| 148 |
+
|
| 149 |
+
Hangbo Bao, Li Dong, and Furu Wei. Beit: Bert pre-training of image transformers. In International Conference on Learning Representations, 2022.
|
| 150 |
+
|
| 151 |
+
Florian Bordes, Randall Balestriero, and Pascal Vincent. High fidelity visualization of what your self-supervised representation knows about. Transactions on Machine Learning Research, 2022.
|
| 152 |
+
|
| 153 |
+
Mathilde Caron, Hugo Touvron, Ishan Misra, Hervé Jégou, Julien Mairal, Piotr Bojanowski, and Armand Joulin. Emerging properties in self-supervised vision transformers. In International Conference on Computer Vision, 2021.
|
| 154 |
+
|
| 155 |
+
Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In International Conference on Machine Learning, 2020a.
|
| 156 |
+
|
| 157 |
+
Xinlei Chen and Kaiming He. Exploring simple siamese representation learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2021.
|
| 158 |
+
|
| 159 |
+
Xinlei Chen, Haoqi Fan, Ross Girshick, and Kaiming He. Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297, 2020b.
|
| 160 |
+
|
| 161 |
+
Xinlei Chen, Saining Xie, and Kaiming He. An empirical study of training self-supervised vision transformers. In International Conference on Computer Vision, 2021.
|
| 162 |
+
|
| 163 |
+
Ekin D Cubuk, Barret Zoph, Jonathon Shlens, and Quoc V Le. Randaugment: Practical automated data augmentation with a reduced search space. In Advances in Neural Information Processing Systems, 2020.
|
| 164 |
+
|
| 165 |
+
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, 2021.
|
| 166 |
+
|
| 167 |
+
Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations, 2021.
|
| 168 |
+
|
| 169 |
+
Stéphane d’Ascoli, Hugo Touvron, Matthew L Leavitt, Ari S Morcos, Giulio Biroli, and Levent Sagun. Convit: Improving vision transformers with soft convolutional inductive biases. In International Conference on Machine Learning, 2021.
|
| 170 |
+
|
| 171 |
+
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, 2019.
|
| 172 |
+
|
| 173 |
+
Benjamin Graham, Alaaeldin El-Nouby, Hugo Touvron, Pierre Stock, Armand Joulin, Hervé Jégou, and Matthijs Douze. Levit: a vision transformer in convnet’s clothing for faster inference. In International Conference on Computer Vision, 2021.
|
| 174 |
+
|
| 175 |
+
Jean-Bastien Grill, Florian Strub, Florent Altché, Corentin Tallec, Pierre Richemond, Elena Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Guo, Mohammad Gheshlaghi Azar, et al. Bootstrap your own latent-a new approach to self-supervised learning. Advances in neural information processing systems, 2020.
|
| 176 |
+
|
| 177 |
+
Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask r-cnn. In Proceedings of the IEEE international conference on computer vision, 2017.
|
| 178 |
+
|
| 179 |
+
Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2020.
|
| 180 |
+
|
| 181 |
+
Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollár, and Ross Girshick. Masked autoencoders are scalable vision learners. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2022.
|
| 182 |
+
|
| 183 |
+
Byeongho Heo, Sangdoo Yun, Dongyoon Han, Sanghyuk Chun, Junsuk Choe, and Seong Joon Oh. Rethinking spatial dimensions of vision transformers. In International Conference on Computer Vision, 2021.
|
| 184 |
+
|
| 185 |
+
Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Q Weinberger. Deep networks with stochastic depth. In European Conference on Computer Vision, 2016.
|
| 186 |
+
|
| 187 |
+
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.
|
| 188 |
+
|
| 189 |
+
Li Jing, Pascal Vincent, Yann LeCun, and Yuandong Tian. Understanding dimensional collapse in contrastive self-supervised learning. In International Conference on Learning Representations, 2022.
|
| 190 |
+
|
| 191 |
+
Hanjoo Kim, Minkyu Kim, Dongjoo Seo, Jinwoong Kim, Heungseok Park, Soeun Park, Hyunwoo Jo, KyungHyun Kim, Youngil Yang, Youngkwan Kim, et al. Nsml: Meet the mlaas platform with a real-world case study. arXiv preprint arXiv:1810.09957, 2018.
|
| 192 |
+
|
| 193 |
+
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, 2014.
|
| 194 |
+
|
| 195 |
+
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 International Conference on Computer Vision, 2021.
|
| 196 |
+
|
| 197 |
+
Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
|
| 198 |
+
|
| 199 |
+
Namuk Park and Songkuk Kim. Blurs behave like ensembles: Spatial smoothings to improve accuracy, uncertainty, and robustness. In International Conference on Machine Learning, 2022a.
|
| 200 |
+
|
| 201 |
+
Namuk Park and Songkuk Kim. How do vision transformers work? In International Conference on Learning Representations, 2022b.
|
| 202 |
+
|
| 203 |
+
Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. In Advances in Neural Information Processing Systems, 2019.
|
| 204 |
+
|
| 205 |
+
Maithra Raghu, Thomas Unterthiner, Simon Kornblith, Chiyuan Zhang, and Alexey Dosovitskiy. Do vision transformers see like convolutional neural networks? Advances in Neural Information Processing Systems, 2021.
|
| 206 |
+
|
| 207 |
+
Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, Alexander C. Berg, and Li Fei-Fei. ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision (IJCV), 2015.
|
| 208 |
+
|
| 209 |
+
Alexander Strehl and Joydeep Ghosh. Cluster ensembles—a knowledge reuse framework for combining multiple partitions. Journal of machine learning research, 2002.
|
| 210 |
+
|
| 211 |
+
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, 2016.
|
| 212 |
+
|
| 213 |
+
Yonglong Tian, Dilip Krishnan, and Phillip Isola. Contrastive multiview coding. In European Conference on Computer Vision, 2020a.
|
| 214 |
+
|
| 215 |
+
Yonglong Tian, Chen Sun, Ben Poole, Dilip Krishnan, Cordelia Schmid, and Phillip Isola. What makes for good views for contrastive learning? Advances in Neural Information Processing Systems, 33:6827–6839, 2020b.
|
| 216 |
+
|
| 217 |
+
Yuandong Tian, Xinlei Chen, and Surya Ganguli. Understanding self-supervised learning dynamics without contrastive pairs. In International Conference on Machine Learning, 2021.
|
| 218 |
+
|
| 219 |
+
Laurens Van der Maaten and Geoffrey Hinton. Visualizing data using t-sne. Journal of machine learning research, 2008.
|
| 220 |
+
|
| 221 |
+
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 Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 8769–8778, 2018.
|
| 222 |
+
|
| 223 |
+
Shaoru Wang, Jin Gao, Zeming Li, Jian Sun, and Weiming Hu. A closer look at self-supervised lightweight vision transformers. arXiv preprint arXiv:2205.14443, 2022.
|
| 224 |
+
|
| 225 |
+
Xinlong Wang, Rufeng Zhang, Chunhua Shen, Tao Kong, and Lei Li. Dense contrastive learning for self-supervised visual pre-training. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2021.
|
| 226 |
+
|
| 227 |
+
Chen Wei, Haoqi Fan, Saining Xie, Chao-Yuan Wu, Alan Yuille, and Christoph Feichtenhofer. Masked feature prediction for self-supervised visual pre-training. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2022a.
|
| 228 |
+
|
| 229 |
+
Yixuan Wei, Han Hu, Zhenda Xie, Zheng Zhang, Yue Cao, Jianmin Bao, Dong Chen, and Baining Guo. Contrastive learning rivals masked image modeling in fine-tuning via feature distillation. arXiv preprint arXiv:2205.14141, 2022b.
|
| 230 |
+
|
| 231 |
+
Zhenda Xie, Zigang Geng, Jingcheng Hu, Zheng Zhang, Han Hu, and Yue Cao. Revealing the dark secrets of masked image modeling. arXiv preprint arXiv:2205.13543, 2022a.
|
| 232 |
+
|
| 233 |
+
Zhenda Xie, Zheng Zhang, Yue Cao, Yutong Lin, Jianmin Bao, Zhuliang Yao, Qi Dai, and Han Hu. Simmim: A simple framework for masked image modeling. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, 2022b.
|
| 234 |
+
|
| 235 |
+
Jiahui Yu, Zirui Wang, Vijay Vasudevan, Legg Yeung, Mojtaba Seyedhosseini, and Yonghui Wu. Coca: Contrastive captioners are image-text foundation models. arXiv preprint arXiv:2205.01917, 2022.
|
| 236 |
+
|
| 237 |
+
Sangdoo Yun, Dongyoon Han, Seong Joon Oh, Sanghyuk Chun, Junsuk Choe, and Youngjoon Yoo. Cutmix: Regularization strategy to train strong classifiers with localizable features. In International Conference on Computer Vision, 2019.
|
| 238 |
+
|
| 239 |
+
Hongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. In International Conference on Learning Representations, 2018.
|
| 240 |
+
|
| 241 |
+
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.
|
| 242 |
+
|
| 243 |
+
Jinghao Zhou, Chen Wei, Huiyu Wang, Wei Shen, Cihang Xie, Alan Yuille, and Tao Kong. ibot: Image bert pre-training with online tokenizer. International Conference on Learning Representations, 2022.
|
| 244 |
+
|
| 245 |
+
# A SETUP
|
| 246 |
+
|
| 247 |
+
We build the configurations based on Xie et al. (2022b) for fine-tuning and Caron et al. (2021) for linear probing. Table A.1 summarizes the configurations. Most analyzes of ViTs use the official ViT-B pre-trained models, and some analyzes use ViT-{S, L} pre-trained with official configurations but epochs of 100. Due to memory limitations, ViT-L is pre-trained with a quarter batch size of the other models. The hybrid model introduced in Section 5 uses the ViT backbone architecture of Xie et al. (2022b) and employes a configureation based on their work for pre-training as shown in Table A.1. For data augmentation and regularization, we adopt widely used settings, e.g., Randaugment (Cubuk et al., 2020), label smoothing (Szegedy et al., 2016), mixup (Zhang et al., 2018), cutmix (Yun et al., 2019), stochastic depth (Huang et al., 2016). Layer decay (Bao et al., 2022) is also used for fine-tuning. Neural network models are implemented in PyTorch (Paszke et al., 2019). The code for analysis is available at https://github.com/naver-ai/cl-vs-mim. All experiments use {1, 4, 8} NVIDIA A100 Tensor Core GPU. NSML (Kim et al., 2018) has been used for experiments.
|
| 248 |
+
|
| 249 |
+
Table A.1: Training settings.
|
| 250 |
+
|
| 251 |
+
<table><tr><td>CONFIGURATION</td><td>Linear Probing</td><td>Fine-tuning</td><td>Pre-training</td></tr><tr><td>optimizer</td><td>sgd</td><td>adamw</td><td>adamw</td></tr><tr><td>base learning rate</td><td>1.0e-0</td><td>1.25e-3</td><td>1.0e-4</td></tr><tr><td>weight decay</td><td>0.05</td><td>0.05</td><td>0.05</td></tr><tr><td>batch size</td><td>1k</td><td>2k</td><td>1k</td></tr><tr><td>training epoch</td><td>50</td><td>100</td><td>100</td></tr><tr><td>learning rate schedule</td><td>cosine</td><td>cosine</td><td>multistep</td></tr><tr><td>warmup epoch</td><td>0</td><td>20</td><td>10</td></tr><tr><td>warmup schedule</td><td>:</td><td>linear</td><td>linear</td></tr><tr><td>randaugment</td><td></td><td>9,0.5</td><td>9,0.5</td></tr><tr><td>label smoothing</td><td></td><td>0.1</td><td>0.1</td></tr><tr><td>mixup</td><td></td><td>0.8</td><td>0.8</td></tr><tr><td>cutmix</td><td>·</td><td>1.0</td><td>1.0</td></tr><tr><td>stochastic depth</td><td>:</td><td>0.1</td><td>0.1</td></tr><tr><td>layer decay</td><td></td><td>0.65</td><td>1.0</td></tr><tr><td>gradient clip</td><td>·</td><td>5.0</td><td>5.0</td></tr></table>
|
| 252 |
+
|
| 253 |
+
# B RELATED WORK
|
| 254 |
+
|
| 255 |
+
CL is a method based on comparing the global projection of two different random views. However, this approach usually suffers from the collapsing problem, where all representations collapse into constant solutions. To solve this problem, various methods such as negative samples and InfoNCE (Oord et al., 2018) have been proposed. Negative samples is an effective technique to avoid the collapsing problems, but they cause dimensional collapse (Jing et al., 2022) and require extra large batches (Chen et al., 2020a) or memory queues (He et al., 2020; Chen et al., 2020b) to retrieve them. We mainly analyze MoCo v3 (Chen et al., 2021), since the method includes these de facto standard components—global projection, random views, and negative samples.
|
| 256 |
+
|
| 257 |
+
Some SSL methods, e.g. Grill et al. (2020); Caron et al. (2021), do not use negative samples and use the projections of their Siamese representations as the positives. Such self-distillation has been explored theoretically and empirically (Chen & He, 2021; Tian et al., 2021) to prevent the collapsing problem, but we do not discuss the distillation scheme in this paper. Wei et al. (2022b) shows that feature distillation improves the fine-tuning performance of CL by diversifying attention ranges; this observation is consistent with our findings. While they focus on distillation to improve CL, we reveal the fundamental nature of self-supervised learning by rigorously comparing CL and MIM.
|
| 258 |
+
|
| 259 |
+

|
| 260 |
+
Figure C.1: MIM and CL methods each have consistent properties. To show this, we visualize selfattention behaviors in terms of attention distance and normalized mutual information (MI). $\mathrm { S i m C L R ^ { \star } }$ , which was introduced in Chen et al. (2021), stands for MoCo with a momentum coefficient of 0. Left: The attention distance of CL methods (namely MoCo, $\operatorname { S i m C L R } ^ { \star }$ , and DINO) is higher than that of MIM methods (namely SimMIM, BEiT, and MAE). This suggests that CL methods consistently capture global patterns. Right: The normalized mutual information of MIM is higher than that of CL; i.e., the self-attentions of MIM are more correlated with query tokens than CL.
|
| 261 |
+
|
| 262 |
+

|
| 263 |
+
Figure C.2: ViTs exhibit consistent self-attention patterns, regardless of their size. To better understand these patterns, we visualize the self-attention behaviors of three ViTs—ViT-{Ti, S, B}—using two metrics: attention distance and normalized mutual information (MI). Left: All selfattentions of MoCo capture global patterns in the later layers. In contrast, the self-attentions of SimMIM capture local patterns. Right: Likewise, all self-attention maps of MoCo collapse into homogeneity in the later layers.
|
| 264 |
+
|
| 265 |
+
Compared with CL, MIM has been rarely explored in vision tasks. Various methods, such as histograms of oriented gradients (Wei et al., 2022a) and tokenization (Bao et al., 2022), have been proposed as part of porting masked language models to the image domain with ViTs. Among them, SimMIM (Xie et al., 2022b) and MAE (He et al., 2022) are simple yet effective methods to reconstruct masked tokens without complicated pretext tasks. Because of its simplicity and superior performance in downstream operations, MIM is attracting attention as a promising technique in image processing.
|
| 266 |
+
|
| 267 |
+
Nevertheless, we find hints suggesting that CL and MIM utilize different aspects of the data, making them complementary. For example, Zhou et al. (2022); Wang et al. (2021); Yu et al. (2022) achieve high predictive performance by harmonizing the image-level and the token-level self-supervised learning. Xie et al. (2022a) also observe that, unlike supervised pre-trained models or CL, selfattentions in SimMIM focus locally; this is a consistent result with our findings.
|
| 268 |
+
|
| 269 |
+
# C OUR INSIGHTS ARE GENERALIZABLE TO VARIOUS MODELS
|
| 270 |
+
|
| 271 |
+
In the main text, we analyze ViT-B pre-trained using MoCo and SimMIM. We observe consistent characteristics across various sizes of ViTs that have been pre-trained using other self-supervised learning methods. To support this claim, we delve into the properties of self-attentions.
|
| 272 |
+
|
| 273 |
+

|
| 274 |
+
Figure E.1: The presence of an outlier head in MoCo raises the average of normalized mutual information. This observation explains how the normalized mutual information in a couple of MoCo’s self-attention layers is similar to or even surpasses that in SimMIM. Left: We present the standard deviation of the normalized mutual information. As depicted in this figure, the standard deviation in SimMIM remains relatively consistent across different depths. In contrast, the standard deviation in MoCo’s $3 ^ { \mathrm { r d } }$ or $4 ^ { \mathrm { t h } }$ self-attention layer is notably higher than that in SimMIM. Right: Distribution of mutual information for the third self-attention layer head. The visualization of this kernel density estimation shows that MoCo has an outlier head with mutual information close to 1.0. The red rectangles $\left( \sqsubseteq \right)$ and blue triangles $( \triangle )$ refer to the mutual information of heads in MoCo and SimMIM, respectively.
|
| 275 |
+
|
| 276 |
+
Figure C.1 visualizes the self-attention behaviors of different self-supervised learning methods in terms of attention distance and normalized mutual information. As depicted in the figure, all CLs and MIMs exhibit consistent properties. Similarly, Figure C.2 demonstrates that various sizes of models also demonstrate consistent properties.
|
| 277 |
+
|
| 278 |
+
# D LOCALITY INDUCTIVE BIAS IMPROVES FINE-TUNING ACCURACY OF CL
|
| 279 |
+
|
| 280 |
+
In Section 2, we demonstrate that the homogeneity of selfattention map, i.e., attention collapse of CL, helps ViT distinguish images but harms fine-tuning accuracy. As a result, we anticipate that incorporating a locality inductive bias into CL will improve fine-tuning accuracy but degrade linear probing accuracy. One simple method to inject locality into self-attentions is to limit the receptive field of self-attention by using attention masks.
|
| 281 |
+
|
| 282 |
+
Figure D.1 shows the predictive performance of MoCo with restricted local self-attentions. As expected, the results are similar to the performance of MIM; As the kernel size decreases, the linear probing accuracy decreases but the finetuning accuracy increases. These results are consistent with our findings.
|
| 283 |
+
|
| 284 |
+

|
| 285 |
+
Figure D.1: Locality inductive bias harms linear probing but improves fine-tuning. We report the linear probing and fine-tuning accuracy of MoCo with restricted self-attentions via attention masks.
|
| 286 |
+
|
| 287 |
+
# E A CLOSER LOOK AT THE ROLE OF SELF-SUPERVISED VIT LAYERS
|
| 288 |
+
|
| 289 |
+
The main text provides the key characteristics of CL and MIM. This section delves deeper into the details not covered in the main text to provide a more comprehensive understanding of the subjects.
|
| 290 |
+
|
| 291 |
+
The role of the early modules. Figures 3 and 4 suggest that most layers of MoCo capture global patterns and have only a weak correlation with query tokens. However, one or two of MoCo layers exhibit unusual behavior. For example, the $3 ^ { \mathrm { r d } }$ layer of MoCo focuses on local areas and its selfattention map is dependent on the query. We explore this property in more detail.
|
| 292 |
+
|
| 293 |
+

|
| 294 |
+
Figure E.2: The tokens of MoCo form a cluster for each image, while those of SimMIM are intermingled. This aligns with the finding that, compared to SimMIM, MoCo is linearly separable. To demonstrate this property, we visualize 3,528 tokens (196 tokens $\times 1 8$ images) from the representations of the last layer via t-SNE, and find that a consistent pattern is observed even in the representations of the intermediate layers. The colors represent three different classes. See also Figures 6 and 7.
|
| 295 |
+
|
| 296 |
+
Figure E.1a provides the variance of normalized mutual information with respect of heads. As the results show, the variance of SimMIM is consistent across all depths whereas that of MoCo is not. In particular, the $3 ^ { \mathrm { r d } }$ layer of MoCo has high variance even though other layers do not. This suggests that, while most of MoCo’s self-attention heads capture global patterns and have weak correlation with query tokens, some heads deviate from this behavior and exhibit a different pattern.
|
| 297 |
+
|
| 298 |
+
Figure E.1b shows the distribution of normalized mutual information among heads in the $3 ^ { \mathrm { r d } }$ layer to analyse this phenomenon. In this figure, we use kernel density estimation with Gaussian kernel to visualize the distribution. The results reveal several outlier heads in MoCo with mutual information close to 1.0. As a result, these outliers significantly raises the average value of normalized mutual information.
|
| 299 |
+
|
| 300 |
+
A comprehensive view through visualization of tokens from multiple images. Figure 6 visualizes how self-attention layers transform tokens from one or two images in representation space. The figure demonstrates that MoCo transforms all tokens in union while SimMIM transforms them individually. As a result, MoCo separates the representations at the image-level and SimMIM separates them at the token-level.
|
| 301 |
+
|
| 302 |
+
The t-SNE visualization (Van der Maaten & Hinton, 2008) in Figure E.2 provides consistent results and offers even a more comprehensive perspective. In this figure, we visualize the last representations of 3528 tokens from 18 images that belong to three different classes. The visualization demonstrates that MoCo separates the representations into distinct classes and even images, while maintaining the tokens close together in compact image clusters. On the other hand, SimMIM separates tokens from images, resulting in a wide representation space for each image, but the images or even classes may be challenging to linearly distinguish.
|
| 303 |
+
|
| 304 |
+
The first layer of MoCo aggregates tokens into compact clusters. Figures 6 and 7 shows that all modules, except the first module, in MoCo behave consistently. However, we observe that MoCo’s first module behaves differently and unusually than the others. We elaborate the behaviour of the first layer of module.
|
| 305 |
+
|
| 306 |
+
Figure E.3a shows the qualitative visualization of tokens for a sample image, similar to Figure 6. This visualization shows that the first MoCo layer aggregates tokens into compact clusters. Although this figure only uses a single image, the layer aggregates all images into a small representation space as well. In terms of singular values, we observe consistent results. Similar to Figure 7, Figures E.3b and E.3c report the second largest log singular value, instead of the relative log singular value, to investigate the absolute volume of the representations. As expected, most layers in both MoCo and SimMIM increase the singular value, but surprisingly, the first layer of MoCo reduces the singular value, meaning that the volumes of representations are decreased at both the token-level and imagelevel. Based on these observations, we conjecture that the first module of MoCo behaves like an embedding component.
|
| 307 |
+
|
| 308 |
+

|
| 309 |
+
Figure E.3: The first layer of MoCo clumps tokens together. We demonstrate this property from two perspectives: qualitative visualization and singular value of token distribution. Left: Similar to Figure 6, we visualize tokens of a sample image in a representation space. The blue and red data points represent the tokens before and after the self-attention transformation. As shown in this figure, the first self-attention layer clumps tokens into a compact cluster. Middle and Right: Similar to Figure 7, we visualize the second largest log singular value (not $\Delta$ log singular value) for depth. The singular value spectra demonstrate consistent results; the first layer of MoCo (gray area) not only clumps tokens but also images into a compact cluster.
|
| 310 |
+
|
| 311 |
+

|
| 312 |
+
Figure F.1: Self-attentions and representations in fine-tuned models exhibit consistency with those of pre-trained models. Similar to Figures 4 and 9, we present the normalized mutual information and the Fourier analysis results of fine-tuned models. The abbreviation “ft” stands for “fine-tuned model.” Left: Similar to pre-trained models, the mutual information of MoCo’s self-attention maps is generally lower compared to that of SimMIM. However, it is noteworthy that the mutual information of the later self-attention maps in SimMIM decreases significantly. This is because the later layers of a model trained with supervision or fine-tuning tend to capture global information. Right: Similarly, SimMIM utilizes higher frequency information than MoCo.
|
| 313 |
+
|
| 314 |
+
# F FINE-TUNED MODELS INHERIT THE PROPERTIES OF PRE-TRAINEDMODELS
|
| 315 |
+
|
| 316 |
+
The main text focuses on highlighting the key properties of pre-trained models. This section demonstrates that these properties are also utilized by fine-tuned models. As a result, we can safely apply the insights gained from the main text to various situations.
|
| 317 |
+
|
| 318 |
+
Consistent results in self-attention and Fourier analysis. Figures 3 and 4 demonstrate that MoCo captures global areas and that its self-attentions are less related to the query tokens, compared with SimMIM. In addition, Figure 9 shows that MoCo captures low-frequency information as opposite to SimMIM. These results are consistent in the fine-tuning scheme.
|
| 319 |
+
|
| 320 |
+
Figure F.1a reveals the self-attention behaviours of fine-tuned MoCo and SimMIM in terms of normalized mutual information. Similar to pre-trained models, the fine-tuned self-attention maps of
|
| 321 |
+
|
| 322 |
+

|
| 323 |
+
Figure F.2: Fine-tuned ViTs inherit the robustness against frequency-based noise. Similar to Figure 8b, we measure the decrease in the accuracy of ViTs fine-tuned with MoCo and SimMIM. Left: Even with fine-tuned ViTs, MoCo is relatively shape-biased and SimMIM relatively texturebiased. This bias is just less apparent than in linear probing models. Right: The robustness against frequency-based random noise also suggests the same: MoCo is robust against high-frequency noise, but SimMIM is not. In conclusion, fine-tuned models inherit the properties of linear probing models.
|
| 324 |
+
|
| 325 |
+
MoCo have generally lower mutual information compared to those of SimMIM. The only significant difference is that the mutual information of the later self-attention maps in fine-tuned SimMIM decreases significantly, as later layers in models trained with supervision or fine-tuning tend to capture more global information. As a result, the gap between the two methods is reduced. This is also reflected in the consistent results of Fourier analysis as shown in Figure F.1b. In this analysis, SimMIM captures higher-frequency information compared to MoCo in fine-tuning scheme as well. However, the later layers of SimMIM attempt to capture low-frequency information. Therefore, the gap of fine-tuned models is smaller than that of pre-trained models.
|
| 326 |
+
|
| 327 |
+
CL is shape-biased and MIM is texture-biased in fine-tuning scheme. In Figure 8, we demonstrate that linear probing model with CL (MoCo) is more shape-biased and that with MIM (SimMIM) is texture-biased, compared with each other. As in the experiment, we calculate the classification results of ImageNet fine-tuned MoCo and SimMIM on Stylized-ImageNet, and measure the decrease in accuracy against frequency-based random noise. As we would expected, Figure F.2 shows that the property also extends to the fine-tuned model. Even though we still observe the difference between MoCo and SimMIM, the performance gap between MoCo and SimMIM is quite reduced compared to the gap between the linear probing models.
|
| 328 |
+
|
| 329 |
+
Later layers of CL and early layers of MIM are important in find-tuning phases. As shown in Figure 11, the later layers of the CL and the early layers of the MIM are linearly separable. This finding suggests that these layers are significant, however, it does not provide direct evidence that such properties are preserved during fine-tuning phases. We demonstrate that these layers play a crucial role in fine-tuning phases as well.
|
| 330 |
+
|
| 331 |
+
To support this claim, we conduct a study to measure the accuracy drop of fine-tuned models using pretrained models with a few blocks initialized. As shown in Figure F.3a, the results indicate that the initializing a few early blocks in the pre-training models of SimMIM significantly harms the fine-tuning accuracy, compared to MoCo. These observations suggest that early layers of SimMIM play an important role in fine-tuning. Conversely, Figure F.3b shows that initializing later blocks in the pre-training models of SimMIM does not significantly harms the fine-tuning accuracy, suggesting that they are not important in fine-tuning compared with MoCo.
|
| 332 |
+
|
| 333 |
+

|
| 334 |
+
Figure F.3: The later layers of CL and early layers of MIM play a key role in the fine-tuning scheme. To show this, we initialize a few blocks and measure the decrease in the fine-tuning accuracy of pretrained models.
|
| 335 |
+
|
| 336 |
+
One limitation of this experiment is the evaluation of the accuracy drop in a single run. Since the accuracy drop of MoCo is marginally higher than that of SimMIM at the first initialization depth in Figure F.3b, additional experiments may improve the results. In this experiment, we utilized the same fine-tuning settings for both MoCo and SimMIM; but experiments with fine-tuning settings tailored to each method may provide further insight.
|
| 337 |
+
|
| 338 |
+
# G HYBRID MODELS OUTPERFORM CL AND MIM IN DOWNSTREAM TASKS
|
| 339 |
+
|
| 340 |
+
The claim that CL and MIM are complementary is demonstrated only on ImageNet in Section 5. To validate this claim in tasks beyond ImageNet, we evaluated the pre-trained models of the hybrid method introduced in Section 5 for another classification task and a semantic segmentation task. In particluar, we measured the accuracy on iNaturalist 2018 (Van Horn et al., 2018) and the mIoU on ADE20K (Zhou et al., 2019). As shown in Table G.1, the hybrid
|
| 341 |
+
|
| 342 |
+
Table G.1: Hybrid models of CL and MIM outperform both CL and MIM in various tasks.
|
| 343 |
+
|
| 344 |
+
<table><tr><td>入 (IMPORTANCE OF CL)</td><td>iNat-18</td><td>ADE20k</td></tr><tr><td>0.0 (SimMIM)</td><td>62.1</td><td>35.4</td></tr><tr><td>0.2 (SimMIM + MoCo)</td><td>68.8</td><td>42.2</td></tr><tr><td>1.0 (MoCo)</td><td>66.2</td><td>39.7</td></tr></table>
|
| 345 |
+
|
| 346 |
+
model of SimMIM and MoCo outperforms both SimMIM and MoCo in various downstream tasks.
|
| 347 |
+
Therefore, we conclude that the effectiveness of this claim extends beyond ImageNet.
|
md/dev/bgAS1ZvveZ/bgAS1ZvveZ.md
ADDED
|
@@ -0,0 +1,411 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# FASTER REINFORCEMENT LEARNING WITH VALUE TARGET LOWER BOUNDING
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
We show that an arbitrary lower bound of the optimal value function can be used to improve the Bellman value target during value learning. In the tabular case, value learning using the lower bounded Bellman operator converges to the same optimal value as using the original Bellman operator, at a potentially faster speed. In practice, discounted episodic return from the training experience or discounted goal return from hindsight relabeling can serve as the value lower bound when the environment is deterministic. We experiment on Atari games, FetchEnv tasks and a challenging physically simulated car push and reach task. We show that in most cases, simply lower bounding with the discounted episodic return performs better or as well as common baselines such as TD3, SAC and Hindsight Experience Replay (HER). It learns much faster than TD3 or HER on some of the harder continuous control tasks, requiring minimal additional computation and no parameter tuning. We are not the first to introduce this simple yet effective technique, but the first to demonstrate its optimality in theory and effectiveness in a wide range of tasks and related baseline methods.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
In temporal difference (TD) learning, the value function is adjusted toward its Bellman target, which is the reward of the current step plus the discounted value of the next state. This forms the basis of many state of the art reinforcement learning (RL) algorithms such as DQN (Mnih et al., 2013), DDPG (Lillicrap et al., 2015), TD3 (Fujimoto et al., 2018), and SAC (Haarnoja et al., 2018).
|
| 12 |
+
|
| 13 |
+
The value of the next state is typically estimated using a “bootstrapped value” based on the value function itself, which is being actively learned during training. The bootstrapped values can be random or very inaccurate, especially at the initial stage of training. Consequently, the Bellman value targets as well as the learned value are usually far away from the optimal value.
|
| 14 |
+
|
| 15 |
+
Naturally, this leads to the following idea: If we can make the value target closer to the optimal value, we may speedup TD learning. For example, we know that the optimal value is just the expected discounted return of the optimal policy, which always upper bounds the expected return of any policy. For episodic RL tasks, we could use the observed discounted return up to episode end from the training trajectories to lower bound the value target. This makes the new value target closer to the optimal value, when the empirical return is higher than the Bellman target.
|
| 16 |
+
|
| 17 |
+
Will such a way of lower bounding the value target work: Will it still converge? Will it converge to the optimal value? Will it speed up value learning?
|
| 18 |
+
|
| 19 |
+
# 2 THEORETICAL RESULTS FOR THE TABULAR CASE
|
| 20 |
+
|
| 21 |
+
For the tabular case, value target lower bounding converges to the same optimal value as the original Bellman value learning, and the proof is also straightforward.
|
| 22 |
+
|
| 23 |
+
# 2.1 BACKGROUND
|
| 24 |
+
|
| 25 |
+
In finite MDPs with a limited number of states and actions, a table can be used to keep track of the value of each state. Using dynamic programming algorithms such as value iteration, values
|
| 26 |
+
|
| 27 |
+
are guaranteed to converge to the optimal through Bellman updates (Chapter 4.4 (Sutton & Barto, 2018)).
|
| 28 |
+
|
| 29 |
+
# Algorithm 1: Bellman value iteration with value target lower bounding
|
| 30 |
+
|
| 31 |
+
Data: Finite MDP $p ( s ^ { \prime } , r | s , g , a )$ , convergence threshold $\theta$
|
| 32 |
+
Result: State value $v ( s )$
|
| 33 |
+
1 $v ( s ) \gets 0$ ;
|
| 34 |
+
2 repeat
|
| 35 |
+
3 $\Delta 0$ ;
|
| 36 |
+
4 for each state s do
|
| 37 |
+
5 $v v ( s )$ ;
|
| 38 |
+
6 $\begin{array} { r } { v ( s ) \gets \operatorname* { m a x } ( f , \operatorname* { m a x } _ { a } \sum _ { s ^ { \prime } , r } p ( s ^ { \prime } , r | s , g , a ) [ r + \gamma v ( s ^ { \prime } ) ] ) ; } \end{array}$
|
| 39 |
+
7 $\Delta \gets \operatorname* { m a x } ( \Delta , | v ( s ) - v | )$ ;
|
| 40 |
+
8 end
|
| 41 |
+
9 until $\Delta < \theta$ ;
|
| 42 |
+
|
| 43 |
+
The core of the algorithm is the Bellman update of the value function, $B ( v )$ :
|
| 44 |
+
|
| 45 |
+
$$
|
| 46 |
+
\mathcal { B } ( v ) ( s ) : = \operatorname* { m a x } _ { a } \sum _ { s ^ { \prime } , r } p ( s ^ { \prime } , r | s , g , a ) [ r + \gamma v ( s ^ { \prime } ) ]
|
| 47 |
+
$$
|
| 48 |
+
|
| 49 |
+
It is well known that the Bellman operator, $\boldsymbol { B }$ , is a contraction mapping over value functions (Denardo, 1967). That is, for any two value functions $v _ { 1 }$ and $v _ { 2 }$ , $| \mathcal { B } ( \bar { v _ { 1 } } ) - \mathcal { B } ( v _ { 2 } ) | \leq \gamma | v _ { 1 } - v _ { 2 } |$ for the discount factor $\gamma \in \ [ 0 , 1 )$ . This guarantees that any value function under the algorithm converges to the optimal value.1
|
| 50 |
+
|
| 51 |
+
# 2.2 VALUE TARGET LOWER BOUNDING CONVERGENCE THEOREM
|
| 52 |
+
|
| 53 |
+
Theorem 1. Suppose the optimal value under the Bellman operator is $B ^ { \infty } ( v )$ . For any value function $f$ that lower bounds the optimal value, i.e. $\forall s$ $' s , f ( s ) \leq B ^ { \bar { \infty } } ( v ) ( s )$ , if we define the lower bounded Bellman operator as $\mathcal M _ { f } \circ \mathcal B ( v ) : = \operatorname* { m a x } ( \mathcal B ( v ) , f )$ , then $( \mathcal { M } _ { f } \circ B ) ^ { \infty } ( v )$ converges to $B ^ { \infty } ( v )$ .
|
| 54 |
+
|
| 55 |
+
A few things to note about the proof (see Appendix A.1).
|
| 56 |
+
|
| 57 |
+
First, this only proves convergence, not contraction under the original $\lvert \lvert v _ { 1 } - v _ { 2 } \rvert \rvert _ { \infty }$ metric. In the case of the Bellman operator, contraction shows that $\forall v _ { 1 } , v _ { 2 }$ value functions, $| | B ( \boldsymbol { v } _ { 1 } ) - B ( \boldsymbol { v } _ { 2 } ) | | _ { \infty } \leq$ $\gamma | | \boldsymbol { v } _ { 1 } - \boldsymbol { v } _ { 2 } | | _ { \infty }$ . Here, for value target lower bounding, there can be counter examples where ${ \mathcal { M } } _ { f } \circ B$ does not always contract in the original metric space for value functions. Here, convergence relies on the convergence of the Bellman value iteration and the existence of the fixed point $v ^ { * }$ . One difficulty caused by this change is that the stopping criterion in Algorithm 1 $\Delta < \theta _ { , }$ ) no longer works, as we do not have access to the converged value during learning. This is perhaps not a serious concern in practice, as people often train algorithms for a fixed number of iterations or time steps.
|
| 58 |
+
|
| 59 |
+
Second, based on the proof, the new algorithm is at least as fast as the original. When the lower bound actually improves the value target, i.e. $f ( s ) > B ( v _ { 1 } ) ( s )$ , there is a chance for the convergence to be faster. Convergence is strictly faster when the lower bound $f$ has an impact on the $L _ { \infty }$ distance between the current value and the optimal value, i.e. it increases the value target for the states where the differences between the value target and the optimal value are the largest.
|
| 60 |
+
|
| 61 |
+
Third, the lower bound function doesn’t have to be static during training. As long as there is a single $f$ during each iteration, convergence property is preserved.
|
| 62 |
+
|
| 63 |
+
Fourth, the theory works even when the underlying MDP is stochastic. Only the lower bounds based on empirical return introduced below require the MDP to be deterministic.
|
| 64 |
+
|
| 65 |
+
# 3 EXAMPLE LOWER BOUND FUNCTIONS
|
| 66 |
+
|
| 67 |
+
We show a few cases where lower bound functions can be readily obtained from the training experience. Future work may investigate alternative lower bounds.
|
| 68 |
+
|
| 69 |
+
# 3.1 EPISODIC TASKS
|
| 70 |
+
|
| 71 |
+
In episodic tasks, discounted return is only accumulated up to the last step of an episode. In this case, we can wait until an episode ends, and compute future discounted returns of all time steps inside the episode. This discounted return is guaranteed to be a lower bound of the optimal value, if the environment is deterministic, i.e. the reward sequence can be repeated using the exact same sequence of actions. (The behavior policy need not be deterministic, as long as the policy class contains the deterministic optimal policy.) To make training efficient, we can compute and store such discounted returns into the replay buffer for each time step, and simply read them out during training.
|
| 72 |
+
|
| 73 |
+
We call this variant lb-DR, short for lower bounding with discounted return.
|
| 74 |
+
|
| 75 |
+
# 3.1.1 EPISODIC WITH HINDSIGHT RELABELED GOALS
|
| 76 |
+
|
| 77 |
+
In goal conditioned tasks, one helpful technique is hindsight goal relabeling (Andrychowicz et al., 2017). It takes a future state that is $d$ time steps away from the current state as the hindsight $/$ relabeled goal for the current state. When the goal is reached, a reward of 0 is given, otherwise a -1 reward is given for each time step.
|
| 78 |
+
|
| 79 |
+
In this case, we know it took $d$ steps to reach the hindsight goal, so the discounted future return is:
|
| 80 |
+
|
| 81 |
+
$$
|
| 82 |
+
\begin{array} { c } { { R _ { d } = \displaystyle \sum _ { i = 0 , . . , d - 1 } - 1 \gamma ^ { i } } } \\ { { = - \displaystyle 1 ( 1 - \gamma ^ { d } ) / ( 1 - \gamma ) } } \end{array}
|
| 83 |
+
$$
|
| 84 |
+
|
| 85 |
+
This calculation can be done on the fly as hindsight relabeling happens, requiring no extra space and very little computation.
|
| 86 |
+
|
| 87 |
+
We call this variant lb-GD, short for lower bounding with goal distance based return.
|
| 88 |
+
|
| 89 |
+
Additionally, we can also apply lb-DR and lb-GD together, with discounted return lower bounding (lb-DR) on the original experience and goal distance return lower bounding (lb-GD) on the hindsight experience, giving the lb-DR $^ +$ GD variant, which was used by Fujita et al. (2020) independently.
|
| 90 |
+
|
| 91 |
+
# 3.2 NON-EPISODIC TASKS WITH POSITIVE REWARDS
|
| 92 |
+
|
| 93 |
+
When the task is continuing, without an episode end, discounted return needs to be accumulated all the way to infinity. This makes it difficult to lower bound the value if rewards can be negative. When rewards are always non-negative, one can still use the discounted return of the future n-steps to lower bound the value. Chapter 3.3 of Sutton & Barto (2018) has more details on episodic vs continuing tasks.
|
| 94 |
+
|
| 95 |
+
# 4 INTEGRATION INTO RL ALGORITHMS
|
| 96 |
+
|
| 97 |
+
# 4.1 BACKGROUND
|
| 98 |
+
|
| 99 |
+
The value target lower bounds can be readily plugged into RL algorithms that regresses value to a target, e.g. DQN, DDPG or SAC.
|
| 100 |
+
|
| 101 |
+
In these algorithms, the action value $\boldsymbol { q } ( s , a )$ is learned through a squared loss with the target value $y$ . In one step TD return, for a batch $\mathbf { B }$ of experience $\{ s , a r , s ^ { \prime } \}$ , the loss is:
|
| 102 |
+
|
| 103 |
+
$$
|
| 104 |
+
\mathcal { L } _ { q } : = \sum _ { ( s , a , r , s ^ { \prime } ) \in \mathbf { B } } | q ( s , a ) - y | ^ { 2 }
|
| 105 |
+
$$
|
| 106 |
+
|
| 107 |
+
In one step TD return, $y$ is the one step TD return $\hat { q } ( s , a , r , s ^ { \prime } )$ :
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
\hat { q } ( s , a , r , s ^ { \prime } ) : = r ( s , a ) + \gamma q ^ { \prime } ( s ^ { \prime } , \mu ^ { \prime } ( s ^ { \prime } ) )
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
Here, $q ^ { \prime }$ and $\mu ^ { \prime }$ are the bootstrap value and policy functions, typically following the value and policy functions in a delayed schedule during training. (They are also called “target value” and “target policy”, and are very different from the “value target” $y$ in this paper.)
|
| 114 |
+
|
| 115 |
+
# 4.2 VALUE TARGET LOWER BOUNDING
|
| 116 |
+
|
| 117 |
+
With lower bounding, we replace the value target $y$ with the lower bounded target:
|
| 118 |
+
|
| 119 |
+
$$
|
| 120 |
+
y \gets \operatorname* { m a x } ( f , \hat { q } ( s , a , r , s ^ { \prime } ) ) = \operatorname* { m a x } ( f , r + \gamma q ^ { \prime } ( s ^ { \prime } , \mu ^ { \prime } ( s ^ { \prime } ) ) )
|
| 121 |
+
$$
|
| 122 |
+
|
| 123 |
+
This is subtly but importantly different from lower bounding the $q$ value directly (Oh et al., 2018;
|
| 124 |
+
Tang, 2020): $q ( s , a ) \bar { } \operatorname* { m a x } \dot { ( } f , q ( s , a ) )$ , which stays overestimated if $\boldsymbol { q } ( s , a )$ initially overestimates.
|
| 125 |
+
This is the same as was done by Fujita et al. (2020) (confirmed via personal communication).
|
| 126 |
+
|
| 127 |
+
This way of simply lower bounding the value target does not require any tuning parameter, but one can always interpolate between these two value targets using a mixing weight $\alpha$ :
|
| 128 |
+
|
| 129 |
+
$$
|
| 130 |
+
y \gets ( 1 - \alpha ) \hat { q } ( s , a ) + \alpha \operatorname* { m a x } ( f , \hat { q } ( s , a ) )
|
| 131 |
+
$$
|
| 132 |
+
|
| 133 |
+
A small $\alpha$ dampens the effect of the new value target, and may be desirable in practice when assumptions of the theorem can be violated, e.g. for non-deterministic tasks.
|
| 134 |
+
|
| 135 |
+
See Appendix A.2 for an illustrative example of how value target lower bounding works in practice.
|
| 136 |
+
|
| 137 |
+
# 5 EXPERIMENTS
|
| 138 |
+
|
| 139 |
+
The goal is to demonstrate the sample efficiency of lower bounding the value target over baseline such as DDPG, TD3, SAC and HER. Because the lower bounded value target can now look potentially many steps into the future, we suspect it to be best suited for long horizon, sparse reward tasks. Hence, we choose to experiment on the following tasks.
|
| 140 |
+
|
| 141 |
+
# 5.1 ENVIRONMENTS AND TASKS
|
| 142 |
+
|
| 143 |
+
We experiment on three sets of tasks with different input characteristics and control difficulty. Some of the tasks are not goal conditioned, so only lower bounding with empirical discounted return is available. Some of them are goal conditioned, so both empirical discounted return and hindsight relabeling with discounted goal return as lower bound are available.
|
| 144 |
+
|
| 145 |
+
# 5.1.1 ATARI GAMES
|
| 146 |
+
|
| 147 |
+
We experiment on the classical Atari games with image input to test using discounted episodic return to lower bound value target. We picked the popular games Breakout, Seaquest, Space Invaders, Atlantis, Frostbite and $\boldsymbol { \mathrm { Q } } ^ { * } \boldsymbol { \mathrm { b e r t } }$ , and only experimented on them. As with prior work (Oh et al., 2018), we evaluate on the deterministic versions of the games, NoFrameskip-v4 with actions repeated for a fixed (four) frames.
|
| 148 |
+
|
| 149 |
+
# 5.1.2 EPISODIC FETCH PUSH, SLIDE AND PICKANDPLACE
|
| 150 |
+
|
| 151 |
+
The FetchEnv tasks (Plappert et al., 2018) are goal conditioned tasks with a robotic arm moving objects on a table. Robot states and object position serve as input. The agent outputs continuous actions taking the form of relative positions to move to. A PID controller translates the relative position actions into the exact torque applied at each joint. Rewards are sparse and goal-conditioned, with -1 for non-goal states and 0 for goal states.
|
| 152 |
+
|
| 153 |
+
By default the FetchEnv tasks are non-episodic. They reset every 50 steps, but all steps including the step right before task reset have the same positive discount (Andrychowicz et al., 2017). As explained in Section 3.1, to allow reliable estimates of return lower bounds to be calculated from past experience, we make them episodic by adding a gym wrapper around the environment to end an episode after its goal is achieved, and reset the task. When a goal is not reached within 50 steps, we just reset the task without ending the episode, as is done in the original FetchEnv, and such experience is not used in value target lower bounding.2 This also changes the nature of the tasks, so the agent does not have to stay at the goal state indefinitely, but instead only needs to reach the goal position as fast as possible. This makes the episodic FetchEnv tasks slightly easier to train than the original tasks, because the agent only needs to reach the goal state quickly, instead of having to reach and stay at the goal position indefinitely. (There are ways to avoid changing the desired behavior by e.g. including agent��s speed into the goal state or requiring the agent to stay at the goal position for several time steps before ending the episode. This seems orthogonal to the main idea here, and is not included in this work.)
|
| 154 |
+
|
| 155 |
+
Compared with the Atari games, the inputs are simpler, no longer image based, but the control task is continuous, under realistic physical simulation and harder.
|
| 156 |
+
|
| 157 |
+
# 5.1.3 PIONEER PUSH AND REACH TASKS
|
| 158 |
+
|
| 159 |
+

|
| 160 |
+
Figure 1: The Pioneer Push task and the Push and Reach task.
|
| 161 |
+
|
| 162 |
+
This is a set of challenging goal reaching and object pushing tasks for the physically simulated car Pioneer 2dx. The car is 0.4 meter long. Objects and goal positions are randomly initialized between 0.5 meter to 1 meter of each other inside a 10 meter by 10 meter flat space. Inputs are the car and object states and the goal positions, and actions are the forces applied on the two driving wheels.
|
| 163 |
+
|
| 164 |
+
For the Pioneer Push task, the car has to push a block to within 0.5 meter of the 2 dimensional goal position indicated by a small red dot on the ground. For the Pioneer Push and Reach task, the car has to first push the object to the goal location (red dot) and then drive to a separate goal position (red ball in the air); the goal is achieved when the concatenation of the two goal locations (for Push and for Reach) is within 0.5 of the concatenated achieved positions (of the block and the car) in $L _ { 2 }$ -distance.
|
| 165 |
+
|
| 166 |
+
Similar to FetchEnv, we make the tasks episodic with sparse goal reward.
|
| 167 |
+
|
| 168 |
+
These tasks take longer time to accomplish, and also take longer time to train than the FetchEnv tasks. Some of the reasons are the force based wheel control instead of the higher level position control, and the arena space being much larger than just a tabletop.
|
| 169 |
+
|
| 170 |
+
# 5.2 BASELINES
|
| 171 |
+
|
| 172 |
+
Baselines include DDPG (Lillicrap et al., 2015), TD3 (Fujimoto et al., 2018), SAC (Haarnoja et al., 2018) and HER (Andrychowicz et al., 2017). Implementations are based on open sourced repositories, and baseline performance is verified against published results under similar settings.
|
| 173 |
+
|
| 174 |
+
# 5.3 HYPERPARAMETERS
|
| 175 |
+
|
| 176 |
+
The value target lower bounding method itself does not have any hyperparameter, the only hyperparameters come from the baseline method. Hyperparameters for the baselines follow published work as much as possible. When tuning baseline hyperparameters, we searched for the best performance in totoal episodic reward, on one set of random seeds. Optimal hyperparameters are then fixed and evaluated on a separate set of random seeds never seen during development. For the treatment, we just used the optimal parameters from the baseline tuning, except for the Atari games where we found the treatment to benefit from more (eight) minibatch updates of size 250 per training iteration (instead of four updates of 500) and from skipping reward clipping. Hyperparameter values are detailed in Appendix A.3.
|
| 177 |
+
|
| 178 |
+
# 5.4 RESULTS
|
| 179 |
+
|
| 180 |
+
We show evaluation performance averaged across separate training runs (five for the less stable Atari games and three for the others). Each run uses a random seed never seen during development.
|
| 181 |
+
|
| 182 |
+
# 5.4.1 LB-DR VS BASELINE SAC/DDPG
|
| 183 |
+
|
| 184 |
+
Figure 2 compares lower bounding with discounted return (lb-DR) against SAC or DDPG baseline on Atari games and the episodic FetchEnv tasks.
|
| 185 |
+
|
| 186 |
+
For most tasks, lower bounding with episodic discounted return (lb-DR) performs similarly or better than the baselines. On Atari Breakout, Atlantis, Frostbite and Q\*bert, and FetchPush and FetchPickAndPlace the gains are quite large. On Atari Seaquest, there is still a significant sample efficiency gain initially.
|
| 187 |
+
|
| 188 |
+
The lb-DR method is effective, but is it really due to improvements to the value targets? Figure 5 (Appendix A.4) looks at the fraction of training experience where lower bounded value target is actually higher than the baseline Bellman value target over the course of training. For the episodic FetchEnv tasks, as training progresses, a meaningful fraction of experience start to benefit from better value targets, and the average return performance also starts to improve over the baseline, although a large fraction of experience benefiting from higher value targets does not always mean a much higher average return (see FetchSlide). For most Atari games, improved value target does lead to significant performance gains, the only exception being Breakout, where value improvement does not immediately lead to performance gain.
|
| 189 |
+
|
| 190 |
+
# 5.4.2 LB-GD AND LB-DR $^ +$ GD VS HER
|
| 191 |
+
|
| 192 |
+
Figure 3 compares lower bounding with goal distance return (lb-GD) and lower bounding with both goal distance and discounted return combined (l ${ \mathsf { b } } { \mathsf { - D R } } { \mathsf { + G D } }$ ) against the much stronger HER baseline, on the goal conditioned episodic FetchEnv and Pioneer tasks.
|
| 193 |
+
|
| 194 |
+
It seems on the easier FetchEnv tasks, lower bounding isn’t able to outperform HER, but on the more challenging Pioneer Push and Reach tasks, lower bounding is able to achieve over $70 \%$ more sample efficiency. It seems the more complex the task, the wider the margin of gain.
|
| 195 |
+
|
| 196 |
+
We also looked at the fraction of experience where the lower bounding goal return is higher than the Bellman target (see Appendix A.4). It quickly grows to $1 \%$ and then slowly drops, matching the region where the new method outperforms the baselines in average return.
|
| 197 |
+
|
| 198 |
+

|
| 199 |
+
Figure 2: Evaluated average return of value target lower bounding with discounted return (lb-DR) vs SAC or DDPG on Atari games and episodic FetchEnv tasks. Solid curves are the mean across five (for Atari) or three (others) seeds, and shaded areas are $+ / -$ one standard deviation.
|
| 200 |
+
|
| 201 |
+

|
| 202 |
+
Figure 3: Value target lower bounding with goal distance return (lb-GD) and lb- $. { \mathrm { D R } } { + } { \mathrm { G D } }$ vs HER on episodic FetchEnv and Pioneer tasks. Solid curves are the mean across three seeds, and shaded areas are $+ / -$ one standard deviation.
|
| 203 |
+
|
| 204 |
+
# 6 RELATED WORK
|
| 205 |
+
|
| 206 |
+
Prior works (Fujita et al., 2020; Hoppe & Toussaint, 2020; He et al., 2016; Oh et al., 2018; Tang, 2020) employed several different ways of computing future returns and using that as a lower bound to improve value learning. It is quite easy to introduce biases and inefficiencies into the process and end up with a suboptimal or inefficient algorithm. Our work is the first to point out that one efficient way of doing it, namely value target lower bounding, converges to the optimal value in the tabular case. We are the first to point out that the theory works generally, even for stochastic environments. We list several possible ways of computing the lower bound from training experience, which are true lower bounds only for deterministic environments, and demonstrate the effectiveness of such lower bounds in illustrative examples and experiments on a variety of tasks.
|
| 207 |
+
|
| 208 |
+
Fujita et al. (2020) used a method very similar to the lb- $\mathrm { . D R + G D }$ variant, noted the limitation to deterministic tasks, and showed that value target lower bounding improved sample efficiency for a goal conditioned robotic grasping task. Hoppe & Toussaint (2020) similarly proposed to bound the value target using a simplified MDP with a subset of actions of the original MDP. Neither work gave any theoretical guarantee.
|
| 209 |
+
|
| 210 |
+
He et al. (2016) used empirical return with bootstrap to improve value learning. They integrate the lower (and upper) bounds as constraints when optimizing the Q function. Their method is more difficult to use due to an additional loss and hyperparameters to tune, and is more expensive to compute than directly lower bounding the value target. Their method needs to evaluate the value function on all future time steps. This severely limits how many time steps it can look ahead when computing discounted return. They evaluated on Atari games, showing higher sample efficiency than DQN, but appears worse than value target lower bounding on Breakout, probably due to looking ahead only four time steps. The limitation to deterministic tasks wasn’t mentioned in the paper, (but is actually present due to the use of empirical return in computing the lower bound), and neither any convergence analysis. Appendix A.5 offers more discussions related to this method and n-step returns.
|
| 211 |
+
|
| 212 |
+
Our work is subtly but importantly different from the prior works on lower bound Q learning or Self Imitation Learning (SIL) (Oh et al., 2018; Tang, 2020). SIL uses empirical return $R$ to lower bound the value function itself (instead of the valueloss during on-policy (AC or PPO) trainingfunction overestimates, the SIL value loss b $( L _ { v a l u e } ^ { s \breve { i } } = \textstyle { \frac { 1 } { 2 } } | v ( s ) - \operatorname* { m a x } ( \bar { v } ( s ) , R ) | ^ { 2 } )$ n off policy value. When the valueg. Mixing the SIL loss with the loss from the baseline algorithms probably helped to correct the overestimation, but no theoretical guarantee was given. In evaluation, SIL was often compared to on-policy Actor Critic or PPO baselines, so it was not clear how much of the gain was due to lower bounding and how much due to off-policy value learning. In this work, we bound the Bellman value target (Equation 5), so overestimates are automatically corrected via Bellman updates, and convergence is guaranteed in the tabular case. We also use off-policy algorithms as baselines for a cleaner comparison.
|
| 213 |
+
|
| 214 |
+
Kumar et al. (2020) (DisCor) also recognized that bootstrapped value targets can be inaccurate. It impacts learning adversely under function approximation, while we handle the general case. DisCor uses distribution correction to sample experience with accurate bootstrap targets more frequently.
|
| 215 |
+
|
| 216 |
+
Interestingly, it is common practice to lower and upper bound the returns to the possible region, e.g.
|
| 217 |
+
Andrychowicz et al. (2017) bounds value between $[ - \frac { 1 } { 1 - \gamma } , 0 ]$ .
|
| 218 |
+
|
| 219 |
+
# 7 CONCLUSIONS
|
| 220 |
+
|
| 221 |
+
In theory, value target lower bounding converges to the same optimal solution as the original Bellman value iteration. In practice, several ways of finding value lower bounds using empirical discounted return for deterministic episodic tasks are examined.
|
| 222 |
+
|
| 223 |
+
Precomputing discounted future return and storing into the replay buffer allows efficient lower bound computation, and can achieve much higher sample efficiency than baselines such as SAC, DDPG or TD3 in most tasks. The Appendix A.5 also includes comparisons against related methods such as td-lambda and Retrace.
|
| 224 |
+
|
| 225 |
+
Simple goal distance based return, requiring little extra space or compute, achieves large gains in certain long horizon tasks over HER, and performs similarly as HER in the simpler tasks.
|
| 226 |
+
|
| 227 |
+
# 7.1 FUTURE WORK
|
| 228 |
+
|
| 229 |
+
There are probably better ways of finding value lower bounds that speed up training even more. There may be ways of using bootstrapped value in computing the lower bound, for n-step return targets or for non-episodic tasks.
|
| 230 |
+
|
| 231 |
+
Estimating value lower bound for environments with stochastic transitions or rewards may be possible, e.g. by learning a reward function to help average out the randomness in the empirical return. Extending to partially observable environments would be harder but probably still doable.
|
| 232 |
+
|
| 233 |
+
Other ways of bounding the value target, e.g. upper bounding, may be worth investigating as well, e.g. to reduce overestimation in regions of poor reward.
|
| 234 |
+
|
| 235 |
+
# REPRODUCIBILITY STATEMENT
|
| 236 |
+
|
| 237 |
+
Our code change is based on a publicly available RL library, with strong baselines already implemented. Our relatively small code change is committed to a private github repository, which we plan to open source upon publication. When running experiments, the snapshot of the code used to run each experiment is stored together with the results. Experiment parameters are gin-configured and controlled by our automation script, with each experiment label corresponding to the set of configurations used for that experiment, so there is little room for manual error when running many experiments across different tasks, methods and hyperparameters.
|
| 238 |
+
|
| 239 |
+
Experiments are done in simulation with pseudo randomness. We’ve run our code on different machines with different GPU hardware using the same docker image, and the results are reproducible up to every float number using the same random seed. In a few cases, we’ve also run our code on different hardware and software (CUDA and pytorch), and the results are similar though not the same at the float number level.
|
| 240 |
+
|
| 241 |
+
# REFERENCES
|
| 242 |
+
|
| 243 |
+
Marcin Andrychowicz, Filip Wolski, Alex Ray, Jonas Schneider, Rachel Fong, Peter Welinder, Bob McGrew, Josh Tobin, OpenAI Pieter Abbeel, and Wojciech Zaremba. Hindsight experience replay. In Advances in Neural Information Processing Systems, volume 30, 2017.
|
| 244 |
+
|
| 245 |
+
Eric V. Denardo. Contraction mappings in the theory underlying dynamic programming. SIAM Review, 9(2):165–177, 1967. ISSN 00361445. URL http://www.jstor.org/stable/ 2027440.
|
| 246 |
+
|
| 247 |
+
Scott Fujimoto, Herke van Hoof, and David Meger. Addressing function approximation error in actor-critic methods. CoRR, 2018. URL http://arxiv.org/abs/1802.09477.
|
| 248 |
+
|
| 249 |
+
Yasuhiro Fujita, Kota Uenishi, Avinash Ummadisingu, Prabhat Nagarajan, Shimpei Masuda, and Mario Ynocente Castro. Distributed reinforcement learning of targeted grasping with active vision for mobile manipulators, 2020.
|
| 250 |
+
|
| 251 |
+
Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor, 2018.
|
| 252 |
+
|
| 253 |
+
Frank S. He, Yang Liu, Alexander G. Schwing, and Jian Peng. Learning to play in a day: Faster deep reinforcement learning by optimality tightening, 2016.
|
| 254 |
+
|
| 255 |
+
Sabrina Hoppe and Marc Toussaint. Qgraph-bounded q-learning: Stabilizing model-free off-policy deep reinforcement learning, 2020.
|
| 256 |
+
|
| 257 |
+
Aviral Kumar, Abhishek Gupta, and Sergey Levine. Discor: Corrective feedback in reinforcement learning via distribution correction. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 18560–18572. Curran Associates, Inc., 2020. URL https://proceedings.neurips. cc/paper/2020/file/d7f426ccbc6db7e235c57958c21c5dfa-Paper.pdf.
|
| 258 |
+
|
| 259 |
+
Timothy P Lillicrap, Jonathan J Hunt, Alexander Pritzel, Nicolas Heess, Tom Erez, Yuval Tassa, David Silver, and Daan Wierstra. Continuous control with deep reinforcement learning. arXiv preprint arXiv:1509.02971, 2015.
|
| 260 |
+
|
| 261 |
+
Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Alex Graves, Ioannis Antonoglou, Daan Wierstra, and Martin A. Riedmiller. Playing atari with deep reinforcement learning. CoRR, abs/1312.5602, 2013. URL http://arxiv.org/abs/1312.5602.
|
| 262 |
+
|
| 263 |
+
Remi Munos, Tom Stepleton, Anna Harutyunyan, and Marc G. Bellemare. Safe and efficient off- ´ policy reinforcement learning, 2016.
|
| 264 |
+
|
| 265 |
+
Junhyuk Oh, Yijie Guo, Satinder Singh, and Honglak Lee. Self-imitation learning. CoRR, abs/1806.05635, 2018. URL http://arxiv.org/abs/1806.05635.
|
| 266 |
+
|
| 267 |
+
Matthias Plappert, Marcin Andrychowicz, Alex Ray, Bob McGrew, Bowen Baker, Glenn Powell, Jonas Schneider, Josh Tobin, Maciek Chociej, Peter Welinder, Vikash Kumar, and Wojciech Zaremba. Multi-goal reinforcement learning: Challenging robotics environments and request for research. CoRR, abs/1802.09464, 2018. URL http://arxiv.org/abs/1802.09464.
|
| 268 |
+
|
| 269 |
+
Richard S. Sutton and Andrew G. Barto. Reinforcement Learning: An Introduction. A Bradford Book, Cambridge, MA, USA, 2018. ISBN 0262039249.
|
| 270 |
+
|
| 271 |
+
Yunhao Tang. Self-imitation learning via generalized lower bound q-learning. CoRR, abs/2006.07442, 2020. URL https://arxiv.org/abs/2006.07442.
|
| 272 |
+
|
| 273 |
+
Hado van Hasselt, Arthur Guez, and David Silver. Deep reinforcement learning with double qlearning. CoRR, abs/1509.06461, 2015. URL http://arxiv.org/abs/1509.06461.
|
| 274 |
+
|
| 275 |
+
# A APPENDIX
|
| 276 |
+
|
| 277 |
+
# A.1 PROOF OF THEOREM 1
|
| 278 |
+
|
| 279 |
+
We want to prove that under the new operator $\mathcal { M } _ { f } \circ B$ , the value function converges to the same optimal value function given by the Bellman operator $\boldsymbol { B }$ .
|
| 280 |
+
|
| 281 |
+
Proof. Let $v ^ { * }$ be the fixed point and optimal value of the original Bellman operator: $v ^ { * } : = B ^ { \infty } ( v )$ , $v _ { 1 }$ be any value function, and $s$ any state,
|
| 282 |
+
|
| 283 |
+
$$
|
| 284 |
+
{ \begin{array} { r l } & { \ | { \mathcal { M } } _ { f } \circ { \mathcal { B } } ( v _ { 1 } ) ( s ) - v ^ { * } ( s ) | } \\ & { = | \operatorname* { m a x } ( { \mathcal { B } } ( v _ { 1 } ) ( s ) , f ( s ) ) - v ^ { * } ( s ) | } \\ & { \ { \mathrm { ~ } } ^ { { \forall } s { \mathrm { ~ w h e r e ~ } } f ( s ) > { \mathcal { B } } ( v _ { 1 } ) ( s ) : } } \\ & { { \mathrm { ~ a b o v e ~ } } = | f ( s ) - v ^ { * } ( s ) | = v ^ { * } ( s ) - f ( s ) < v ^ { * } ( s ) - { \mathcal { B } } ( v _ { 1 } ) ( s ) = | { \mathcal { B } } ( v _ { 1 } ) ( s ) - v ^ { * } ( s ) | } \end{array} }
|
| 285 |
+
$$
|
| 286 |
+
|
| 287 |
+
$$
|
| 288 |
+
\begin{array} { r l } & { \mathrm { ~ a b o v e = } | \mathcal { B } ( v _ { 1 } ) ( s ) - v ^ { * } ( s ) | } \\ & { { \le } | \mathcal { B } ( v _ { 1 } ) ( s ) - v ^ { * } ( s ) | } \\ & { { = } | \mathcal { B } ( v _ { 1 } ) ( s ) - \mathcal { B } ( v ^ { * } ) ( s ) | } \\ & { { \le } \gamma | | v _ { 1 } - v ^ { * } | | _ { \infty } } \end{array}
|
| 289 |
+
$$
|
| 290 |
+
|
| 291 |
+
The last line above is because the Bellman operator $\boldsymbol { B }$ contracts at rate $\gamma$ .
|
| 292 |
+
|
| 293 |
+
$$
|
| 294 |
+
\begin{array} { r } { \vert \vert \mathcal { M } _ { f } \circ \mathcal { B } ( v _ { 1 } ) - v ^ { * } \vert \vert _ { \infty } = \operatorname* { m a x } _ { s } \vert \mathcal { M } _ { f } \circ \mathcal { B } ( v _ { 1 } ) ( s ) - v ^ { * } ( s ) \vert \leq \gamma \vert \vert v _ { 1 } - v ^ { * } \vert \vert _ { \infty } . } \end{array}
|
| 295 |
+
$$
|
| 296 |
+
|
| 297 |
+
According to the definition of convergence to $v ^ { * }$ , we need to find an $N$ , such that $\forall \epsilon > 0 , \forall v _ { 1 } \neq v ^ { * }$ , $\forall n > N , \bar { | } | ( \mathcal { M } _ { f } \circ \mathcal { B } ) ^ { n } ( v _ { 1 } ) - v ^ { * } | | _ { \infty } \bar { < } \epsilon .$ .
|
| 298 |
+
|
| 299 |
+
We can easily calculate that N = logγ ||v1−v∗|| (note, $\gamma \ < \ 1 $ ) satisfies the condition, which concludes the proof that any value function $v _ { 1 }$ will converge to $v ^ { * }$ under the lower bounded Bellman operator $\mathcal { M } _ { f } \circ B$ .
|
| 300 |
+
|
| 301 |
+
This proof works for action values as well, by simply replacing the value function above $v ( s )$ with the action value $\boldsymbol { q } ( s , a )$ , and the value lower bound $f ( s )$ with the action value lower bound $\dot { f } ( s , a )$ .
|
| 302 |
+
|
| 303 |
+
# A.2 AN ILLUSTRATIVE EXAMPLE
|
| 304 |
+
|
| 305 |
+
Figure 4 includes a fairly general example showing how value target lower bounding would improve value learning. Suppose we enhance an off policy algorithm such as DDPG with value target lower bounding (lb-DR), when there is no training experience hitting the target state, no meaningful training happens for the baseline or lb-DR. However, when there is one trajectory hitting the target state, all states along the trajectory will soon be propagated with meaningful return, and nearby states will also enjoy faster learning. As the state space becomes larger and the time horizon longer, a successful trajectory will likely speed up learning quite a bit.
|
| 306 |
+
|
| 307 |
+
# A.3 HYPERPARAMETERS
|
| 308 |
+
|
| 309 |
+
Hyperparameters of the baseline algorithms follow published work in the case of FetchEnv (Plappert et al., 2018). For Atari and Pioneer Push and Reach tasks, they are tuned using one set of random seeds and after keeping the hyperparameters fixed, trained with a different set of random seeds and evaluated. We avoided tuning of the parameters of the baseline method for value target lower bounding, except for the Atari games where value target lower bounding learned a bit faster with slightly more frequent training updates (8 updates of 250 transitions per training iteration) than the baseline (4 updates of 500 transitions) and without reward clipping. For Atari Atlantis, Frostbite and Q\*bert, we report results with reward clipping as it did not affect performance much.
|
| 310 |
+
|
| 311 |
+

|
| 312 |
+
Figure 4: Illustration of value target lower bounding speeding up value learning as training progresses from stages 0 to 3. The task is to navigate in the state space from start state S to end state T, with sparse reward 1 at $\mathrm { T }$ and 0 elsewhere. The curve from S to $\mathrm { T }$ denotes a training experience that reaches the target. The shaded areas denote roughly states whose value has been significantly improved during training up to that stage.
|
| 313 |
+
|
| 314 |
+
Baseline parameters reported below are tuned using development random seeds and fixed during evaluation with a separate set of random seeds.
|
| 315 |
+
|
| 316 |
+
For the Atari games, DQN with only one training environment takes too long to train so we instead use SAC as baseline. There are no strong reported results, so we tuned the hyperparameters a bit and found it to outperform published Actor-Critic results on Atari Breakout (Oh et al., 2018). We use 30 environments, unrolling 8 time steps every training iteration, with each iteration containing 4 updates each with a minibatch of 500 transitions sampled from the 1 million time step replay buffer. 500 time steps are collected before training starts. Target networks are updated every 20 training updates. Discount $\gamma = 0 . 9 9$ . The SAC target entropy is set to the entropy of uniformly distributing 0.1 probability mass across all but one actions. Actions are repeated deterministically for 4 frames (even for Space Invaders, despite 3 being used by Mnih et al. (2013)), and the latest 4 frames are stacked and rescaled to [-1, 1] to form the $8 4 \mathrm { x } 8 4 \mathrm { x } 4$ input tensor. Rewards are clipped between -1 and 1. Network structures are the same as Double DQN (van Hasselt et al., 2015) with 3 convolution layers, with input layer 32 filters of size 8 stride 4, then 64 filters of size 4 stride 2 and 64 filters with size 3 stride 1, 1 fully connected of size 512 before output. We train for 12 million steps (48 million frames) for each task (except for Atlantis where episodes are very long and we only train for 6 million steps) and evaluate every 1000 iterations averaging across 100 episodes using $\epsilon$ -greedy policy with $5 \%$ random actions.
|
| 317 |
+
|
| 318 |
+
For FetchEnv tasks, DDPG and HER learn faster than their TD3 variants and are reported here. Hyperparameters are the same as used by Plappert et al. (2018), with 38 parallel environments unrolling 50 time steps per train iteration, training 40 updates per iteration, targets are updated once every 40 updates. For each update, a minibatch of 5000 transitions are sampled from the replay buffer of size 2 million. Discount $\gamma = 0 . 9 8$ . Actions are $\epsilon$ -greedy with $30 \%$ random actions. $80 \%$ hindsight experience. Observations are normalized to have zero mean and unit variance based on the statistics of the recent observations.3 Networks are 3 fully connected layers of size 256. Length of the episodes are capped at 50. We train for 2 million frames and evaluate every 40 iterations averaging across 200 episodes.
|
| 319 |
+
|
| 320 |
+
For Pioneer Push and Reach tasks, TD3 is used, (we simply equip DDPG with two critics for clipped double Q learning(Fujimoto et al., 2018)), which works better than DDPG with one critic. Parameters are mostly the same as in FetchEnv, except for using 30 parallel environments, 100 steps of unroll per training iteration, 6 million time step replay buffer, $50 \%$ hindsight experience, discount $\gamma = 0 . 9 9$ and not using observation normalization. Length of the episodes are capped at 100 for Push and 200 for Push and Reach. We train for 5 million frames for Push and 14 million for PushReach and evaluate every 200 iterations averaging across 100 episodes.
|
| 321 |
+
|
| 322 |
+
For FetchEnv and Pioneer tasks, the target networks are updated every 40 train updates softly, with weight 0.95 on the existing target network parameters and 0.05 on the incoming.
|
| 323 |
+
|
| 324 |
+
We use Adam optimizer with learning rate $5 e ^ { - 4 }$ for the Atari games and $1 e ^ { - 3 }$ for all others, and $\hat { \epsilon } = 1 e ^ { - 7 }$ for all tasks.
|
| 325 |
+
|
| 326 |
+

|
| 327 |
+
A.4 PLOTS
|
| 328 |
+
Figure 5: Fraction of training experience where lb-DR value target is greater than the Bellman target, on Atari games and episodic FetchEnv tasks, plotted against the number of training iterations. Solid curves are the mean across five (for Atari) or three (others) seeds, and shaded areas are $+ / -$ one standard deviation.
|
| 329 |
+
|
| 330 |
+
Figure 5 shows the fraction of training experience where lb-DR value target is greater than the Bellman target from SAC/DDPG. They correlate well with actual performance (Figure 2) and with how value is learning (Figure 6). For Atari Breakout the converged value is much higher than that of the baseline. It is unlike an overestimation, and is actually close to the average discounted return that we also summarized in tensorboard (omitted here).4 The baseline value of 2 is actually very far away from its average discounted return of 25, even though its policy is already getting a reward of
|
| 331 |
+
|
| 332 |
+
200 per episode. This is likely due to the inaccurate bootstrap values of the baseline method, and will probably take much longer to converge.
|
| 333 |
+
|
| 334 |
+

|
| 335 |
+
Figure 6: Learned values of lb-DR and SAC (for Atari games) and DDPG (for FetchEnv tasks), evaluated on the training experience and plotted against the number of training iterations. Solid curves are the mean across five (for Atari) or three (others) seeds, and shaded areas are $+ / -$ one standard deviation.
|
| 336 |
+
|
| 337 |
+
Figure 7 shows the fraction of training experience where the lb-GD is higher than the Bellman value target from HER, in the goal conditioned (episodic FetchEnv and Pioneer) tasks. It seems, for FetchEnv tasks, where lb-GD only performs slightly better than HER, the fraction of experience with improved value target is quite small (less than $1 \%$ ). Hindsight relabeling is probably already producing fairly high value targets. For Pioneer Push and Reach tasks, lb-GD performs much better in average return, and the fraction of experience with higher value target is also much larger (peaking around $2 \%$ ).
|
| 338 |
+
|
| 339 |
+
This again correlates well with the value learned, shown in Figure 8.
|
| 340 |
+
|
| 341 |
+

|
| 342 |
+
Figure 7: Fraction of training experience where lb-GD or l ${ \bf \Lambda } _ { \mathrm { 3 - D R + G D } }$ value target is greater than the Bellman target, on episodic FetchEnv and Pioneer tasks, plotted against the number of training iterations. Solid curves are the mean across three seeds, and shaded areas are $+ / -$ one standard deviation.
|
| 343 |
+
|
| 344 |
+
# A.5 N-STEP RETURN BASED METHODS
|
| 345 |
+
|
| 346 |
+
# A.5.1 N-STEP RETURN METHODS
|
| 347 |
+
|
| 348 |
+
We also experimented with n-step return, td-lambda return and Retrace (Munos et al., 2016) but decided to give up on the direction due to the following reasons:
|
| 349 |
+
|
| 350 |
+
1) We compared DDPG one-step return against DDPG with n-step return, td-lambda and Retrace on FetchPush, and found that a small n works similarly as the baseline one-step DDPG, and a larger n hurts training. This is likely due to the off-policy bias in n-step return causing the n-step estimate to be potentially worse than the one-step estimate, for example, when off-policy low return experiences are used to compute value targets. Introducing importance sampling weights (Retrace) would help reduce the bias, but at the same time significantly downweight the off-policy high return experiences, making an ineffective use of such experiences. The overall benefit of n-step methods is limited.
|
| 351 |
+
|
| 352 |
+
None of these issues are present in value target lower bounding: (a) It does not incur any off-policy bias, and (b) as long as an experience renders high reward, being off-policy does not affect its ability to improve the value target.
|
| 353 |
+
|
| 354 |
+
2) Computing n-step td-lambda return requires more computation due to evaluating value networks on all n-steps of the experience, and slows down training time significantly with a large n.
|
| 355 |
+
|
| 356 |
+
On the other hand, value target lower bounding precomputes and stores discounted return in the replay buffer, and incurs very little additional computation.
|
| 357 |
+
|
| 358 |
+
3) Tuning n-step return involves many hyperparameters like the number of steps n, the td-lambda parameter, replay buffer size and prioritized replay to expire old experiences and sample recent ones more frequently, target network update parameters to reduce potential overestimation, and parameters for importance sampling. But still, after all the tuning, it only slightly outperform onestep DDPG on FetchPush or SAC on Breakout, and is below the lower bounding method. For tdlambda and Retrace, the best performance comes from 3-step td with $\lambda = 0 . 9 5$ , replay buffer length $4 0 0 \mathrm { k }$ and all other parameters the same as the baseline DDPG or SAC. Retrace underperforming the baseline in Breakout is similarly observed in the original paper (Munos et al., 2016).
|
| 359 |
+
|
| 360 |
+

|
| 361 |
+
Figure 8: Learned values of lb-DR, lb- $. { \mathrm { D R } } { + } { \mathrm { G D } }$ and HER on episodic FetchEnv and Pioneer tasks, evaluated on the training experience and plotted against the number of training iterations. Solid curves are the mean across three seeds, and shaded areas are $+ / -$ one standard deviation.
|
| 362 |
+
|
| 363 |
+
On the other hand, value target lower bounding requires no hyperparameter tuning, learns faster on most tasks and converges higher on some of the more difficult tasks.
|
| 364 |
+
|
| 365 |
+
4) Value target lower bounding can be applied on top of n-step return methods as well, so is more of an orthogonal problem.
|
| 366 |
+
|
| 367 |
+
Overall, n-step methods are much more expensive and difficult to use, and the much simpler and effective lower bounding method still maintains an advantage in effectiveness and performance. We show the performance comparison in Figure 9 with learned values in Figure 10.
|
| 368 |
+
|
| 369 |
+
# A.5.2 OPTIMALITY TIGHTENING WITH N-STEP RETURNS
|
| 370 |
+
|
| 371 |
+
He et al. (2016) use bootstrapped n-step return to lower and upper bound the value during training. They frame the problem as a constrained optimization problem where the distance between the value and the Bellman value target is minimized subject to the constraints that the value function must be within the lower (and upper) bounds. Their work is more general than the value target low bounding methods due to 1) including a value upper bound as well as lower bound, and 2) using bootstrapping, so it’s applicable to non-episodic tasks as well.
|
| 372 |
+
|
| 373 |
+
Compared to value target lower bounding, several limitations exist.
|
| 374 |
+
|
| 375 |
+
1) The prior work bounds the value function itself (similar to lower bound q learning (Oh et al., 2018; Tang, 2020)), instead of bounding the Bellman value target. This could cause suboptimal training because the Bellman target itself could be outside the bounds, causing contradictory training targets and losses. Imagine the current value for a state is 1, its Bellman value target may be a low 0, and the lower bound may be a high 2, then it’s unclear which way the value function should go.
|
| 376 |
+
|
| 377 |
+

|
| 378 |
+
Figure 9: Evaluated average return of value target lower bounding with discounted return (lb-DR) vs SAC or DDPG, td-lambda and Retrace on Atari Breakout and episodic FetchEnv tasks. Solid curves are the mean across five (for Atari) or three (others) seeds, and shaded areas are $+ / -$ one standard deviation.
|
| 379 |
+
|
| 380 |
+

|
| 381 |
+
Figure 10: Learned values of lb-DR and SAC (for Atari games), DDPG (for FetchEnv tasks), tdlambda and Retrace, evaluated on the training experience and plotted against the number of training iterations. Solid curves are the mean across five (for Atari) or three (others) seeds, and shaded areas are $+ / -$ one standard deviation.
|
| 382 |
+
|
| 383 |
+
It will depend largely on the mixing weight between the two losses $\lambda$ and whether initial values overestimate, which can be hard to tune in practice.
|
| 384 |
+
|
| 385 |
+
2) The prior work does not include any theoretical analysis and misses the limitation to only deterministic tasks. The lower and upper bounds are in fact not correct bounds, even on deterministic tasks, because of the use of bootstrapped values together with the empirical discounted return.
|
| 386 |
+
|
| 387 |
+
3) In order to compute the bootstrapped values, the value network needs to be evaluated on all n future time steps, severely increasing GPU memory consumption and compute. Because of this increase in compute, in experiments, it could only look at a limited (4) timesteps into the future, while lb-DR can look all the way to the end of an episode with very little extra computation and storage.
|
| 388 |
+
|
| 389 |
+
We implemented the method (He et al., 2016) and integrated into our baselines. We ran on FetchPush and Atari Breakout, with hyperparameters number of time steps $n = 4$ and the penalty coefficient $\lambda = 4$ , following the original paper.
|
| 390 |
+
|
| 391 |
+
We found that the prior method overestimates value a lot due to two reasons: a) taking max over the n-step returns for n from 1 to 4, and b) the use of the bootstrap value, causing the lower bound to be above what’s actually achievable.
|
| 392 |
+
|
| 393 |
+
We also improved their method by lower bounding the Bellman value target with n-step return (with bootstrap) instead of imposing the constraint on the value function itself. But it still overestimates value and does not learn as quickly as the baseline one-step DDPG or SAC.
|
| 394 |
+
|
| 395 |
+
We also adjusted $\lambda$ to much lower values, hoping to control overestimation and improve over the baseline. Even with a very small lambda of 1e-7, it is still slower than DDPG baseline on FetchPush, likely because initial values are overestimates. On Atari Breakout, with a small lambda of 1e-7, it learns slightly faster than the SAC baseline but still way below the value target lower bounding method.
|
| 396 |
+
|
| 397 |
+
# A.6 A STOCHASTIC EXAMPLE
|
| 398 |
+
|
| 399 |
+
Using empirical return directly as value lower bound can lead to value overestimation, as shown in the stochastic MDP example below.
|
| 400 |
+
|
| 401 |
+
Assume state $S _ { 0 }$ always goes to $S _ { 1 }$ , and $S _ { 1 }$ gets reward $\pm 2 ~ 5 0 \%$ of the times. Then $v ( S _ { 0 } ) =$ $v ( S _ { 1 } ) = 0$ . However, with lower bounding, for the lucky case with reward 2, the value target for $S _ { 0 }$ is $\gamma \operatorname* { m a x } ( 2 , v ( S _ { 1 } ) ) = 2 \gamma$ , and for the unlucky case with reward -2, the value target for $S _ { 0 }$ is $\gamma \operatorname* { m a x } ( - 2 , v ( S _ { 1 } ) ) = \gamma v ( S _ { 1 } ) = 0$ . On average, $v ( S _ { 0 } )$ will be overestimated to be $\gamma$ .
|
| 402 |
+
|
| 403 |
+
It is worth noting that lower bounding the action value directly as done in SIL (Oh et al., 2018) will overestimate $v ( S _ { 1 } )$ as well, whereas lower bounding the value target will produce the correct $v ( S _ { 1 } )$ . This is because the same trajectory is used to both produce the Bellman value target ( $\pm 2$ for $S _ { 1 }$ ) and the lower bound ( $\pm 2$ for $S _ { 1 }$ ) which will be exactly the same for a given trajectory.
|
| 404 |
+
|
| 405 |
+
# A.7 DOES LOWER BOUNDING WITH EMPIRICAL RETURN REQUIRE THE POLICY TO BE DETERMINISTIC?
|
| 406 |
+
|
| 407 |
+
The use of empirical return to lower bound the optimal value does not require the policy to be deterministic. It does require the policy class to include the optimal policy (deterministic when the task is deterministic) or some policy that’s close to the optimal policy. Otherwise, empirical return could still overestimate the optimal value achievable by the policy class. For example, Q learning assumes that the policy class includes the optimal policy which is the greedy one (and is deterministic). Because of that, the behavior policy can be non-deterministic and suboptimal, and it doesn’t affect the learned value to reach optimality (as long as the behavior covers enough of the state space).
|
| 408 |
+
|
| 409 |
+
# A.8 POTENTIAL IMPROVEMENT
|
| 410 |
+
|
| 411 |
+
Note that the goal distance based return (lb-GD) of Section 3.1.1 is a very simple way of arriving at a reasonable lower bound with near zero additional computation. The bound could be made tighter. Typically, an $L _ { 2 }$ distance threshold is used to judge goal achievement, which will likely be satisfied a few time steps before exactly arriving at the hindsight goal. To compute such a tighter bound would require evaluating the reward function across the trajectories of experience using all possible hindsight goal states, and storing them in the replay buffer, i.e. episode length squared more computation and more storage space. It may be worth doing when episodes are short, or doing it only for a small number of time steps into the future when e.g. rewards are non-negative.
|
md/dev/dLL4KXzKUpS/dLL4KXzKUpS.md
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Where2comm: Communication-Efficient Collaborative Perception via Spatial Confidence Maps
|
| 2 |
+
|
| 3 |
+
Yue Hu Shaoheng Fang Zixing Lei Cooperative Medianet Innovation Center, Shanghai Jiao Tong University {18671129361, shfang, chezacarss}@sjtu.edu.cn
|
| 4 |
+
|
| 5 |
+
Yiqi Zhong University of Southern California yiqizhon@usc.edu
|
| 6 |
+
|
| 7 |
+
Siheng Chen∗ Shanghai Jiao Tong University, Shanghai AI Laboratory sihengc@sjtu.edu.cn
|
| 8 |
+
|
| 9 |
+
# Abstract
|
| 10 |
+
|
| 11 |
+
Multi-agent collaborative perception could significantly upgrade the perception performance by enabling agents to share complementary information with each other through communication. It inevitably results in a fundamental trade-off between perception performance and communication bandwidth. To tackle this bottleneck issue, we propose a spatial confidence map, which reflects the spatial heterogeneity of perceptual information. It empowers agents to only share spatially sparse, yet perceptually critical information, contributing to where to communicate. Based on this novel spatial confidence map, we propose Where2comm, a communication-efficient collaborative perception framework. Where2comm has two distinct advantages: i) it considers pragmatic compression and uses less communication to achieve higher perception performance by focusing on perceptually critical areas; and ii) it can handle varying communication bandwidth by dynamically adjusting spatial areas involved in communication. To evaluate Where2comm, we consider 3D object detection in both real-world and simulation scenarios with two modalities (camera/LiDAR) and two agent types (cars/drones) on four datasets: OPV2V, V2X-Sim, DAIR-V2X, and our original CoPerception-UAVs. Where2comm consistently outperforms previous methods; for example, it achieves more than 100, $0 0 0 \times$ lower communication volume and still outperforms DiscoNet and V2X-ViT on OPV2V. Our code is available at https://github.com/MediaBrain-SJTU/where2comm.
|
| 12 |
+
|
| 13 |
+
# 1 Introduction
|
| 14 |
+
|
| 15 |
+
Collaborative perception enables multiple agents to share complementary perceptual information with each other, promoting more holistic perception. It provides a new direction to fundamentally overcome a number of inevitable limitations of single-agent perception, such as occlusion and longrange issues. Related methods and systems are desperately needed in a broad range of real-world applications, such as vehicle-to-everything-communication-aided autonomous driving [1–3], multirobot warehouse automation system [4, 5] and multi-UAVs (unmanned aerial vehicles) for search and rescue [6–8]. To realize collaborative perception, recent works have contributed high-quality datasets [9–11] and effective collaboration methods [12, 13, 2, 14–19].
|
| 16 |
+
|
| 17 |
+
In this emerging field, the current biggest challenge is how to optimize the trade-off between perception performance and communication bandwidth. Communication systems in real-world scenarios are always constrained that they can hardly afford huge communication consumption in real-time, such as passing complete raw observations or a large volume of features. Therefore, we cannot solely promote the perception performance without evaluating the expense of every bit of precious communication bandwidth. To achieve a better performance and bandwidth trade-off, previous works put forth solutions from several perspectives. For example, When2com [12] considers a handshake mechanism which selects the most relevant collaborators; V2VNet [1] considers endto-end-learning-based source coding; and DiscoNet [2] uses 1D convolution to compress message. However, all previous works make a plausible assumption: once two agents collaborate, they are obligated to share perceptual information of all spatial areas equally. This unnecessary assumption can hugely waste the bandwidth as a large proportion of spatial areas may contain irrelevant information for perception task. Figure 1 illustrates such a spatial heterogeneity of perceptual information.
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: Collaborative perception could contribute to safety-critical scenarios, where the white car and the red car may collide due to occlusion. This collision could be avoided when the blue car can share a message about the red car’s position. Such a message is spatially sparse, yet perceptually critical. Considering the precious communication bandwidth, each agent needs to speak to the point!
|
| 21 |
+
|
| 22 |
+
To fill this gap, we consider a novel spatial-confidence-aware communication strategy. The core idea is to enable a spatial confidence map for each agent, where each element reflects the perceptually critical level of a corresponding spatial area. Based on this map, agents decide which spatial area (where) to communicate about. That is, each agent offers spatially sparse, yet critical features to support other agents, and meanwhile requests complementary information from others through multi-round communication to perform efficient and mutually beneficial collaboration.
|
| 23 |
+
|
| 24 |
+
Following this strategy, we propose Where2comm, a novel communication-efficient multi-agent collaborative perception framework with the guidance of spatial confidence maps; see Fig. 2. Where2comm includes three key modules: i) a spatial confidence generator, which produces a spatial confidence map to indicate perceptually critical areas; ii) a spatial confidence-aware communication module, which leverages the spatial confidence map to decide where to communicate via novel message packing, and who to communicate via novel communication graph construction; and iii) a spatial confidence-aware message fusion module, which uses novel confidence-aware multi-head attention to fuse all messages received from other agents, upgrading the feature map for each agent.
|
| 25 |
+
|
| 26 |
+
Where2comm has two distinct advantages. First, it promotes pragmatic compression at the feature level and uses less communication to achieve higher perception performance by focusing on perceptually critical areas. Second, it adapts to various communication bandwidths and communication rounds, while previous models only handle one predefined communication bandwidth and a fixed number of communication rounds. To evaluate Where2comm, we consider the collaborative 3D object detection task on four datasets: DAIR-V2X [11], V2X-Sim [9], OPV2V [10] and our original dataset CoPerception-UAVs. Our experiments cover both real-world and simulation scenarios, two types of agents (cars and drones) and sensors (LiDAR and cameras). Results show that i) the proposed Where2comm consistently and significantly outperforms previous works in the performancebandwidth trade-off across multiple datasets and modalities; and ii) Where2comm achieves better trade-off when the communication round increases.
|
| 27 |
+
|
| 28 |
+
# 2 Related Works
|
| 29 |
+
|
| 30 |
+
Multi-agent communication. The communication strategy in multi-agent systems has been widely studied [20]. Early works [21–23] often use predefined protocols or heuristics to decide how agents communicate with each other. However, it is difficult to generalize those methods to complex tasks. Recent works, thus, explore learning-based methods for complex scenarios. For example,
|
| 31 |
+
|
| 32 |
+
Table 1: Major components comparisons of collaborative perception systems.
|
| 33 |
+
|
| 34 |
+
<table><tr><td>Method</td><td>Venue</td><td>Message packing</td><td>Communication graph construction</td><td>Message fusion</td></tr><tr><td>When2com[12]</td><td>CVPR2020</td><td>Full feature map</td><td>Handshake-based sparse graph</td><td>Attention per-agent</td></tr><tr><td>V2VNet[1]</td><td>ECCV 2020</td><td>Full feature map</td><td>Fully connected graph</td><td>Average per-agent</td></tr><tr><td>DiscoNet [2]</td><td>NeurIPS 2021</td><td>Full feature map</td><td>Fully connected graph</td><td>MLP-based attention per-location</td></tr><tr><td>V2X-ViT[26]</td><td>ECCV2022</td><td>Full feature map</td><td>Fully connected graph</td><td>Self-attention per-location</td></tr><tr><td>Where2comm</td><td>NeurIPS 2022</td><td>Confidence-aware sparse feature map + request map</td><td>Confidence-aware sparse graph</td><td>Confidence-awaremulti-head attention per-location</td></tr></table>
|
| 35 |
+
|
| 36 |
+
CommNet [24] learns continuous communication in the multi-agent system. Vain [25] adopts the attention mechanism to help agents selectively fuse the information from others. Most of these previous works consider decision-making tasks and adopt reinforcement learning due to the lack of explicit supervision. In this work, we focus on the perception task. Based on direct perception supervision, we apply supervised learning to optimize the communication strategy in both trade-off perception ability and communication cost.
|
| 37 |
+
|
| 38 |
+
Collaborative perception. As a recent application of multi-agent communication systems to perception tasks, collaborative perception is still immature. To support this area of research, there is a surge of high-quality datasets (e.g., V2X-Sim [9], OpenV2V [10], Comap[27] and DAIR-V2X[11]), as well as collaboration methods aimed for better performance-bandwidth trade-off (see comparisons in Table 1). When2com [12] proposes a handshake communication mechanism to decide when to communicate and create sparse communication graph. V2VNet [1] proposes multi-round message passing based on graph neural networks to achieve better perception and prediction performance. DiscoNet [2] adopts knowledge distillation to take the advantage of both early and intermediate collaboration. OPV2V [10] proposes a graph-based attentive intermediate fusion to improve perception performances. V2X-ViT [26] introduces a novel heterogeneous multi-agent attention module to fuse information across heterogeneous agents. In this work, we leverage the proposed spatial confidence map to promote more compact messages, more sparse communication graphs, and more comprehensive fusion, resulting in efficient and effective collaboration.
|
| 39 |
+
|
| 40 |
+
# 3 Problem Formulation
|
| 41 |
+
|
| 42 |
+
Consider $N$ agents in the scene. Let $\mathcal { X } _ { i }$ and $\mathcal { \mathrm { V } } _ { i }$ be the observation and the perception supervision of the $i$ th agent, respectively. The objective of collaborative perception is to achieve the maximized perception performance of all agents as a function of the total communication budge $B$ and communication round $K$ ; that is,
|
| 43 |
+
|
| 44 |
+
$$
|
| 45 |
+
\xi _ { \Phi } ( B , K ) = \underset { \theta , \mathcal { P } } { \arg \operatorname* { m a x } } \sum _ { i = 1 } ^ { N } g ( \Phi _ { \theta } ( \mathcal { X } _ { i } , \{ \mathcal { P } _ { i j } ^ { ( K ) } \} _ { j = 1 } ^ { N } ) , \mathcal { Y } _ { i } ) , \mathrm { s . t . } \sum _ { k = 1 } ^ { K } \sum _ { i = 1 } ^ { N } | \mathcal { P } _ { i j } ^ { ( k ) } | \leq B ,
|
| 46 |
+
$$
|
| 47 |
+
|
| 48 |
+
where $g ( \cdot , \cdot )$ is the perception evaluation metric, $\Phi$ is the perception network with trainable parameter θ, and P (k)i→j is the message transmitted from the ith agent to the $j$ th agent at the $k$ th communication round. Note that i) when $B = K = 0$ , there is no collaboration and $\xi _ { \Phi } ( 0 , 0 )$ reflects the singleagent perception performance; ii) through optimizing the communication strategy and the network parameter, collaborative perception should perform well consistently at any communication bandwidth or round; and iii) we consider multi-round communication, where each agent serves as both a supporter (offering message to help others) and a requester (requesting messages from others).
|
| 49 |
+
|
| 50 |
+
In this work, we consider the perception task of 3D object detection and present three contributions: i) we make communication more efficient by designing compact messages and sparse communication graphs; ii) we boost the perception performance by implementing more comprehensive message fusion; iii) we enable the overall system to adapt to varying communication conditions by dynamically adjusting where and who to communicate.
|
| 51 |
+
|
| 52 |
+
# 4 Where2comm: Spatial Confidence-Aware Collaborative Perception System
|
| 53 |
+
|
| 54 |
+
This section presents Where2comm, a multi-round, multi-modality, multi-agent collaborative perception framework based on a spatial-confidence-aware communication strategy; see the overview in Fig. 2. Where2comm includes an observation encoder, a spatial confidence generator, the spatial confidence-aware communication module, the spatial confidence-aware message fusion module and a detection decoder. Among five modules, the proposed spatial confidence generator generates the spatial confidence map. Based on this spatial confidence map, the proposed spatial confidence-aware communication generates compact messages and sparse communication graphs to save communication bandwidth; and the proposed spatial confidence-aware message fusion module leverages informative spatial confidence priors to achieve better aggregation; also see an algorithmic summary in Algorithm 1 and the optimization-oriented design rationale in Section 7.3 in Appendix.
|
| 55 |
+
|
| 56 |
+

|
| 57 |
+
Figure 2: System overview. In Where2comm, spatial confidence generator enables the awareness of spatial heterogeneous of perceptual information, spatial confidence-aware communication enables efficient communication, and spatial confidence-aware message fusion boosts the performance.
|
| 58 |
+
|
| 59 |
+
# 4.1 Observation encoder
|
| 60 |
+
|
| 61 |
+
The observation encoder extracts feature maps from the sensor data. Where2comm accepts single/multimodality inputs, such as RGB images and 3D point clouds. This work adopts the feature representations in bird’s eye view (BEV), where all agents project their individual perceptual information to the same global coordinate system, avoiding complex coordinate transformations and supporting better shared cross-agent collaboration. For the ith agent, given its input $\mathcal { X } _ { i }$ , the feature map is $\mathcal { F } _ { i } ^ { ( 0 ) } = \Phi _ { \mathrm { e n c } } ( \mathcal { X } _ { i } ) \in \mathrm { \overline { { \mathbb { R } } } } ^ { H \times W \times D }$ , where $\Phi _ { \mathrm { e n c } } ( \cdot )$ is the encoder, the superscript 0 reflects that the feature is obtained before communication and $H , W , D$ are its height, weight and channel. All agents share the same BEV coordinate system. For the image input, $\Phi _ { \mathrm { e n c } } ( \cdot )$ is followed by a warping function that transforms the extracted feature from front-view to BEV. For 3D point cloud input, we discretize 3D points as a BEV map and $\Phi _ { \mathrm { e n c } } ( \cdot )$ extracts features in BEV. The extracted feature map is output to the spatial confidence generator and the message fusion module.
|
| 62 |
+
|
| 63 |
+
# 4.2 Spatial confidence generator
|
| 64 |
+
|
| 65 |
+
The spatial confidence generator generates a spatial confidence map from the feature map of each agent. The spatial confidence map reflects the perceptually critical level of various spatial areas. Intuitively, for object detection task, the areas that contain objects are more critical than background areas. During collaboration, areas with objects could help recover the miss-detected objects due to the limited view; and background areas could be omitted to save the precious bandwidth. So we represent the spatial confidence map with the detection confidence map, where the area with high perceptually critical level is the area that contains an object with a high confidence score.
|
| 66 |
+
|
| 67 |
+
To implement, we use a detection decoder structure to produce the detection confidence map. Given the feature map at the $k$ th communication round, $\mathcal { F } _ { i } ^ { ( k ) }$ , the corresponding spatial confidence map is
|
| 68 |
+
|
| 69 |
+
$$
|
| 70 |
+
\mathbf { C } _ { i } ^ { ( k ) } = \Phi _ { \mathrm { g e n e r a t o r } } ( \mathcal { F } _ { i } ^ { ( k ) } ) \in [ 0 , 1 ] ^ { H \times W } ,
|
| 71 |
+
$$
|
| 72 |
+
|
| 73 |
+
where the generator $\Phi _ { \mathrm { g e n e r a t o r } } ( \cdot )$ follows a detection decoder. Since we consider multi-round collaboration, Where2comm iteratively updates the feature map by aggregating information from other agents. Once $\mathcal { F } _ { i } ^ { ( k ) }$ is obtained, (1) is triggered to reflect the perceptually critical level at each spatial location. The proposed spatial confidence map answers a crucial question that was ignored by previous works: for each agent, information at which spatial area is worth sharing with others. By answering this, it provides a solid base for efficient communication and effective message fusion.
|
| 74 |
+
|
| 75 |
+
# 4.3 Spatial confidence-aware communication
|
| 76 |
+
|
| 77 |
+
With the guidance of spatial confidence maps, the proposed communication module packs compact messages with spatially sparse feature maps and transmits messages through a sparsely-connected communication graph. Most existing collaboration perception systems [1, 2, 26] considers full feature maps in the messages and fully-connected communication graphs. To reduce the communication bandwidth without affecting perception, we leverage the spatial confidence map to select the most informative spatial areas in the feature map (where to communicate) and decide the most beneficial collaboration partners (who to communicate).
|
| 78 |
+
|
| 79 |
+
Message packing. Message packing determines what information should be included in the to-besent message. The proposed message includes: i) a request map that indicates at which spatial areas the agent needs to know more; and ii) a spatially sparse, yet perceptually critical feature map.
|
| 80 |
+
|
| 81 |
+
The request map of the ith agent is $\mathbf { R } _ { i } ^ { ( k ) } = 1 - \mathbf { C } _ { i } ^ { ( k ) } \in \mathbb { R } ^ { H \times W }$ , negatively correlated with the spatial confidence map. The intuition is, for the locations with low confidence score, an agent is hard to tell if there is really no objects or it is just caused by the limited information (e.g. occlusion). Thus, the low confidence score indicates there could be missing information at that location. Requesting information at these locations from other agents could improve the current agent’s detection accuracy.
|
| 82 |
+
|
| 83 |
+
The spatially sparse feature map are selected based on each agent’s spatial confidence map and the received request maps from others. Specifically, a binary selection matrix is used to represent each location is selected or not, where 1 denotes selected, and 0 elsewhere. For the message sent from the ith agent to the $j$ th agent at the $k$ th communication round, the binary selection matrix is
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
\mathbf { M } _ { i j } ^ { ( k ) } = \{ \begin{array} { l l } { \Phi _ { \mathrm { s e l e c t } } ( \mathbf { C } _ { i } ^ { ( k ) } ) \in \{ 0 , 1 \} ^ { H \times W } , } & { \quad k = 0 ; } \\ { \Phi _ { \mathrm { s e l e c t } } ( \mathbf { C } _ { i } ^ { ( k ) } \odot \mathbf { R } _ { j } ^ { ( k - 1 ) } ) , \in \{ 0 , 1 \} ^ { H \times W } , } & { \quad k > 0 ; } \end{array}
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
where $\odot$ is the element-wise multiplication, R(k−1)j is the request map from the jth agent received at the previous round, $\Phi _ { \mathrm { s e l e c t } } ( \cdot )$ is the selection function which targets to select the most critical areas conditioned on the input matrix, which represents the critical level at the certain spatial location. We implement $\Phi _ { \mathrm { s e l e c t } } ( \cdot )$ by selecting the locations where the largest elements at in the given input matrix conditioned on the bandwidth limit; optionally, a Gaussian filter could be applied to filter out the outliers and introduce some context. In the initial communication round, each agent selects the most critical areas from its own perspective as the request maps from other agents are not available yet; in communication. Then, the selected feature map is obtained as $\mathcal { Z } _ { i j } ^ { ( k ) } = \mathbf { M } _ { i j } ^ { ( k ) } \odot \mathcal { F } _ { i } ^ { ( k ) } \in \mathbb { R } ^ { H \times \bar { W } \times D }$ ,
|
| 90 |
+
|
| 91 |
+
Overall, the message sent from the $i$ th agent to the $j$ th agent at the $k$ th communication round is $\mathcal { P } _ { i j } ^ { ( k ) } ~ = ~ ( \mathbf { R } _ { i } ^ { ( k ) } , \mathcal { \bar { Z } } _ { i j } ^ { ( k ) } )$ Note that i) $\mathbf { R } _ { i } ^ { ( k ) }$ provides spatial priors to request complementary information for the ith agent’s need in the next round; the feature map $\mathcal { Z } _ { i j } ^ { ( k ) }$ provides supportive information for the ith agent’s need in the this round. They together enable mutually beneficial collaboration; ii) since leading to low commu is sparse, we only transmit nn cost; and iii) the sparsity of $\mathcal { Z } _ { i j } ^ { ( k ) }$ o features and corresponding indices,is determined by the binary selection matrix, which dynamically allocates the communication budget at various spatial areas based on their perceptual critical level, adapting to various communication conditions.
|
| 92 |
+
|
| 93 |
+
Communication graph construction. Communication graph construction targets to identify when and who to communicate to avoid unnecessary communication that wastes the bandwidth. Most previous works [1, 2, 10] consider fully-connected communication graphs. When2com [12] proposes a handshake mechanism, which uses similar global features to match partners. This is hard to interpret because two agents, which have similar global features, do not necessarily need information from each other. Different from all previous works, we provide an explicit design rationale: the necessity of communication between the ith and the $j$ th agents is simply measured by the overlap between the information that the ith agent has and the information that the $j$ th agent needs. With the help of the spatial confidence map and the request map, we construct a more interpretable communication graph.
|
| 94 |
+
|
| 95 |
+
For the initial communication round, every agent in the system is not aware of other agents yet. To activate the collaboration, we construct a fully-connected communication graph. Every agent will broadcast its message to the rest of the system. For the subsequent communication rounds, we examine if the communication between agent $i$ and agent $j$ is necessary based on the maximum value of the binary selection matrix M(k)i→j , i.e. if there is at least one patch is activated, then we regard the connection is necessary. Formally, let $\mathbf { A } ^ { ( k ) }$ be the adjacency matrix of the communication graph at the $k$ th communication round, whose $( i , j )$ th element is
|
| 96 |
+
|
| 97 |
+
$$
|
| 98 |
+
\begin{array} { r } { \mathbf { A } _ { i , j } ^ { ( k ) } = \left\{ \begin{array} { l l } { 1 , \quad } & { k = 0 ; } \\ { \operatorname* { m a x } _ { h \in \{ 0 , 1 , \dots , H - 1 \} , w \in \{ 0 , 1 , \dots , W - 1 \} } \left( \mathbf { M } _ { i \to j } ^ { ( k ) } \right) _ { h , w } \in \{ 0 , 1 \} , \quad } & { k > 0 ; } \end{array} \right. } \end{array}
|
| 99 |
+
$$
|
| 100 |
+
|
| 101 |
+
where $h , w$ index the spatial area, reflecting message passing from the ith agent to the $j$ th agent.
|
| 102 |
+
Given this sparse communication graph, agents can exchange messages with selected partners.
|
| 103 |
+
|
| 104 |
+
# 4.4 Spatial confidence-aware message fusion
|
| 105 |
+
|
| 106 |
+
Spatial confidence-aware message fusion targets to augment the feature of each agent by aggregating the received messages from the other agents. To achieve this, we adopt a transformer architecture, which leverages multi-head attention to fuse the corresponding features from multiple agents at each individual spatial location. The key technical design is to include the spatial confidence maps of all the agents to promote cross-agent attention learning. The intuition is that, the spatial confidence map could explicitly reflect the perceptually critical level, providing a useful prior for attention learning.
|
| 107 |
+
|
| 108 |
+
Specifically, for the ith agent, after receiving the jth agent’s message P(k)j→i, it could unpack to retrieve the feature map $\mathcal { Z } _ { j i } ^ { ( k ) }$ and the spatial confidence ma p C(k)j ${ \bf C } _ { j } ^ { ( k ) } = 1 - { \bf R } _ { j } ^ { ( k ) }$ R(k)j . We also include the ego feature map in fusion and denote $\mathcal { Z } _ { i i } ^ { ( k ) } = \mathcal { F } _ { i } ^ { ( k ) }$ = F (k)i t o make the formulation simple and consistent, where $\mathcal { Z } _ { i i } ^ { ( k ) }$ might not be sparse. To fuse the features from the $j$ th agent at the $k$ th communication round, the cross-agent/ego attention weight for the ith agent is
|
| 109 |
+
|
| 110 |
+
$$
|
| 111 |
+
\mathbf { W } _ { j i } ^ { ( k ) } = \mathrm { M H A _ { W } } ( \mathcal { F } _ { i } ^ { ( k ) } , \mathcal { Z } _ { j i } ^ { ( k ) } , \mathcal { Z } _ { j i } ^ { ( k ) } ) \odot \mathbf { C } _ { j } ^ { ( k ) } \in \mathbb { R } ^ { H \times W } ,
|
| 112 |
+
$$
|
| 113 |
+
|
| 114 |
+
where $\mathrm { M H A } _ { \mathrm { W } } ( \cdot )$ is a multi-head attention applied at each individual spatial location, which outputs the scaled dot-product attention weight. Note that i) the proposed spatial confidence maps contributes to the attention weight, as the features with higher perceptually critical level are more preferred in the feature aggregation; ii) the cross-agent attention weight models the collaboration strength with a $H \times W$ spatial resolution, leading to more flexible information fusion at various spatial regions. Then, the feature map of the ith agent after fusing the messages in the $k$ th communication round is
|
| 115 |
+
|
| 116 |
+
$$
|
| 117 |
+
\mathcal { F } _ { i } ^ { ( k + 1 ) } = \mathrm { F F N } \left( \sum _ { j \in \mathcal { N } _ { i } \bigcup \{ i \} } \mathbf { W } _ { j \to i } ^ { ( k ) } \odot \mathcal { Z } _ { j \to i } ^ { ( k ) } \right) \in \mathbb { R } ^ { H \times W \times D } ,
|
| 118 |
+
$$
|
| 119 |
+
|
| 120 |
+
where $\mathrm { F F N } ( \cdot )$ is the feed-forward network and ${ \mathcal { N } } _ { i }$ is the neighbors of the ith agent defined in the cation graph round. In the $\mathbf { A } ^ { ( k ) }$ . The fused featur round, we output $\mathcal { F } _ { i } ^ { ( k + 1 ) }$ would serve as the ith agent’s feature in theo the detection decoder to generate detections. $( k + 1 ) \operatorname { t h }$ $\mathcal { F } _ { i } ^ { ( k + 1 ) }$
|
| 121 |
+
|
| 122 |
+
Sensor positional encoding. Sensor positional encoding represents the physical distance between each agent’s sensor and its observation. It adopts a standard positional encoding function conditioned on the sensing distance and feature dimension. The features are summed up with the positional encoding of each location before inputting to the transformer.
|
| 123 |
+
|
| 124 |
+
Compared to existing fusion modules that do not use attention mechanism [1] or only use agent-level attentions [12], the per-location attention mechanism adopted by the proposed fusion emphasizes the location-specific feature interactions. It makes the feature fusion more targeted. Compared to the methods that also use the per-location attention-based fusion module[2, 10, 26], the proposed fusion module leverages multi-head attention with two extra priors, including spatial confidence map and sensing distances. Both assist attention learning to prefer high quality and critical features.
|
| 125 |
+
|
| 126 |
+
# 4.5 Detection decoder
|
| 127 |
+
|
| 128 |
+
The detection decoder decodes features into objects, including class and regression output. Given the feature map at the $k$ th communication round $\mathcal { F } _ { i } ^ { ( k ) }$ , the detection decoder $\Phi _ { \mathrm { d e c } } ( \cdot )$ generate the detections of $i$ th agent by $\widehat { \mathcal { O } } _ { i } ^ { ( k ) } = \Phi _ { \mathrm { d e c } } ( \mathcal { F } _ { i } ^ { ( k ) } ) \in \mathbb { R } ^ { H \times W \times 7 }$ , where each location of $\widehat { \mathcal { O } } _ { i } ^ { ( k ) }$ represents a rotated box with class $( c , x , y , h , w , \cos { \alpha } , \sin { \alpha } )$ , denoting class confidence, position, size and angle. The objects are the final output of the proposed collaborative perception system. Note that $\widehat { \mathcal { O } } _ { i } ^ { ( 0 ) }$ denotes the detections without collaboration.
|
| 129 |
+
|
| 130 |
+
# 4.6 Training details and loss functions
|
| 131 |
+
|
| 132 |
+
To train the overall system, we supervise two tasks: spatial confidence generation and object detection at each round. As mentioned before, the functionality of the spatial confidence generator is the same as the classification in the detection decoder. To promote parameter efficiency, our spatial confidence generator reuses the parameters of the detection decoder. For the multi-round settings, each round is supervised with one detection loss, the overall loss is $\begin{array} { r } { L = \sum _ { k = 0 } ^ { K } \sum _ { i } ^ { N } L _ { \mathrm { d e t } } \left( \widehat { \mathcal { O } } _ { i } ^ { ( k ) } , \mathcal { O } _ { i } \right) } \end{array}$ , where $\mathcal { O } _ { i }$ is the ith agent’s ground-truth objects, $L _ { \mathrm { d e t } }$ is the detection loss [28].
|
| 133 |
+
|
| 134 |
+

|
| 135 |
+
Figure 3: Where2comm achieves consistently superior performance-bandwidth trade-off on all the three collaborative perception datasets, e.g, Where2comm achieves $5 , O O O$ times less communication volume and still outperforms When2com on CoPerception-UAVs dataset. The entire red curve comes from a single Where2comm model evaluated at varying bandwidths.
|
| 136 |
+
|
| 137 |
+
Training strategy for multi-round setting. To adapt to multi-round communication and dynamic bandwidth, we train the model under various communication settings with curriculum learning strategy [29]. We first gradually increase the communication bandwidth and round; and then, randomly sample bandwidth and round to promote robustness. Through this training strategy, a single model can perform well at various communication conditions.
|
| 138 |
+
|
| 139 |
+
# 5 Experimental Results
|
| 140 |
+
|
| 141 |
+
Our experiments covers four datasets, both real-world and simulation scenarios, two types of agents (cars and drones) and two types of sensors (LiDAR and cameras). Specifically, we conduct camera-only 3D object detection in the setting of V2X-communication aided autonomous driving on OPV2V dataset [10], camera-only 3D object detection in the setting of drone swarm on the proposed CoPerception-UAVs dataset, and LiDAR-based 3D object detection on DAIR-V2X dataset [11] and V2X-Sim dataset [9]. The detection results are evaluated by Average Precision (AP) at Intersection-over-Union (IoU) threshold of 0.50 and 0.70. The communication results count the message size by byte in log scale with base 2. To compare communication results straightforward and fair, we do not consider any extra data/feature/model compression.
|
| 142 |
+
|
| 143 |
+
# 5.1 Datasets and experimental settings
|
| 144 |
+
|
| 145 |
+
OPV2V. OPV2V [10] is a vehicle-to-vehicle collaborative perception dataset, co-simulated by OpenCDA [10] and Carla [30]. It includes 12K frames of 3D point clouds and RGB images with 230K annotated 3D boxes. The perception range is $4 0 \mathrm { m } \times 4 0 \mathrm { m }$ . For camera-only 3D object detection task on OPV2V, we implement the detector following CADDN [31]. The input front-view image size is (416, 160). The front-view input feature map is transformed to BEV with resolution 0.5m/pixel.
|
| 146 |
+
|
| 147 |
+
V2X-Sim. V2X-Sim [9] is a vehicle-to-everything collaborative perception dataset, co-simulated by SUMO [32] and Carla, including 10K frames of 3D LiDAR point clouds and 501K 3D boxes.
|
| 148 |
+
|
| 149 |
+

|
| 150 |
+
Figure 4: More communication rounds continuously improve performance-bandwidth trade-off.
|
| 151 |
+
|
| 152 |
+
The perception range is $6 4 \mathrm { m } \times 6 4 \mathrm { m }$ . For LiDAR-based 3D object detection task, our detector follows MotionNet [33]. We discretize 3D points into a BEV map with size (256, 256, 13) and the resolution is $0 . 4 \mathrm { m } \iota$ /pixel in length and width, $0 . 2 5 \mathrm { m }$ in height.
|
| 153 |
+
|
| 154 |
+
CoPerception-UAVs. To enrich the collaborative perception datasets, we consider the swarm of unmanned aerial vehicles (UAV) and propose a UAV-swarm-based collaborative perception dataset: CoPerception-UAVs, co-simulated by AirSim [34] and Carla [30], including 131.9K aerial images and 1.94M 3D boxes. The perception range is $2 0 0 \mathrm { m } \times 3 5 0 \mathrm { m }$ . For the camera-only 3D object detection task on CoPerception-UAVs, our detector follows DVDET [8]. The input aerial image size is (800, 450). The aerial-view input feature map is transformed to BEV with the resolution of $0 . 2 5 \mathrm { m }$ /pixel, and the size is (192, 352); see more details in Appendix.
|
| 155 |
+
|
| 156 |
+
DAIR-V2X. DAIR-V2X [11] is the only public real-world collaborative perception dataset. Each sample contains two agents: a vehicle and an infrastructure, with 3D annotations. The perception range is $2 0 1 . 6 \mathrm { m } \times 8 0 \mathrm { m }$ . Originally DAIR-V2X does not label objects outside the camera’s view, we relabel all objects to cover 360-degree detection range. We complement several intermediate fusion-based baselines on DAIR-V2X to comprehensively validate our method on real data. For LiDAR-based 3D object detection task, our detector follows PointPillar [35]. We represent the field of view into a BEV map with size (200, 504, 64) and the resolution is $0 . 4 \mathrm { m }$ /pixel in length and width.
|
| 157 |
+
|
| 158 |
+
# 5.2 Quantitative evaluation
|
| 159 |
+
|
| 160 |
+
Benchmark comparison. Fig. 3 compares the proposed Where2comm with the previous methods in terms of the trade-off between detection performance $( \mathbf { A P } @ \mathbf { I o U } { = } 0 . 5 0 )$ and communication bandwidth; also see exact values in Table 3 of Appendix. We consider single-agent detection without collaboration $( \widehat { \mathcal { O } } _ { i } ^ { ( 0 ) } )$ , When2com [12], V2VNet [1], DiscoNet [2], V2X-ViT [26] and late fusion, where agents directly exchange the detected 3D boxes. The red curve comes from a single Where2comm model evaluated at varying bandwidths. We see that the proposed Where2comm: i) achieves a far-more superior perception-communication trade-off across all the communication bandwidth choices and various collaborative perception tasks, including camera-only 3D object detection from aerial view and car front view, and LiDAR-based 3D object detection; ii) achieves significant improvements over previous state-of-the-arts on both real-world (DAIR-V2X) and simulation scenarios, improves the SOTA performance by $7 . 7 \%$ on DAIR-V2X, $6 . 6 2 \%$ on CoPerception-UAVs, $2 5 . 8 1 \%$ on OPV2V, $1 . 9 \%$ on V2X-Sim; iii) achieves the same detection performance of previous state-of-the-arts with extremely less communication volume: 5128 times less on CoPerception-UAVs, more than 100K times less on OPV2V, 55 times less on V2X-Sim, 105 times less on DAIR-V2X.
|
| 161 |
+
|
| 162 |
+
Multi-round evaluation. Fig. 4 presents the performances of Where2comm at communication rounds ranging from 1 to 3. Each curve comes from a single Where2comm model with a certain communication round evaluated at varying bandwidths. Results show that 1 communication round is good, more rounds are even better. Multi-round communication steadily improves the performance-bandwidth trade-off across all three datasets, reflecting its effectiveness and robustness. This encourages the agents to actively collaborate without worrying the performance degradation. This also validates that Where2comm can well work at various communication bandwidths and rounds.
|
| 163 |
+
|
| 164 |
+
Robustness to localization noise. We follow the localization noise setting in V2VNet and V2X-ViT (Gaussian noise with a mean of $_ { 0 \mathrm { m } }$ and a standard deviation of $0 \mathrm { m } { - } 0 . 6 \mathrm { m } \rangle$ and conduct experiments on all the three datasets to validate the robustness against realistic localization noise. Where2comm is more robust to the localization noise than previous SOTAs. Fig. 5 shows the detection performances as a function of localization noise level in CoPerception-UAVs, OPV2V and V2X-Sim datasets, respectively We see: i) overall the collaborative perception performance degrades with the increasing localization noise, while where2comm outperforms previous SOTAs (When2com, V2VNet,DiscoNet) under all the localization noise. ii) where2comm keeps being superior to No Collaboration while V2VNet fails when noise is over $0 . 4 \mathrm { m }$ and DiscoNet fails when noise is over $0 . 5 \mathrm { m }$ on CoPerceptionUAVs. The reasons are: i) the powerful transformer architecture in fusion module attentively select the most suitable collaborative feature; ii) the spatial confidence map helps filter out noisy features, these two designs work together to mitigate noise localization distortion effects.
|
| 165 |
+
|
| 166 |
+

|
| 167 |
+
Figure 5: Robustness to localization error. Gaussian noise with zero mean and varying std is introduced. Where2comm consistently outperforms previous SOTAs and No Collaboration.
|
| 168 |
+
|
| 169 |
+

|
| 170 |
+
Figure 6: Visualization of collaboration between Drone 1 and Drone 2 on CoPerception-UAVs dataset, including spatial confidence map $( \mathbf { C } _ { 1 } ^ { ( 0 ) } )$ , selection matrix $( \mathbf { M } _ { 1 2 } ^ { ( 0 ) } )$ , message $( \{ \bar { \mathbf { R } _ { 2 } ^ { ( 0 ) } } , \mathcal { Z } _ { 2 1 } ^ { ( 0 ) } \} )$ in the communication module, attention weight in the fusion module (W(0)1→1 $( \mathbf { \bar { W } } _ { 1 \to 1 } ^ { ( 0 ) } , \mathbf { W } _ { 2 \to 1 } ^ { ( 0 ) } )$ 2 2 1, and Drone 1’s detection results before $( \widehat { \mathcal { O } } _ { 1 } ^ { ( 0 ) } )$ and after $( \widehat { \mathcal { O } } _ { 1 } ^ { ( 1 ) } )$ collaboration. Green and red boxes denote groundtruth and detection, respectively. The objects occluded by a tall building can be detected through transmitting spatially sparse, yet perceptually critical message.
|
| 171 |
+
|
| 172 |
+
# 5.3 Qualitative evaluation
|
| 173 |
+
|
| 174 |
+
Visualization of spatial confidence map. Fig. 6 illustrates how Where2comm is empowered by the proposed spatial confidence map. In the scene, Drone 1’s view is occluded by a tall building. With Drone 2’s help, Drone 1 is able to detect through occlusion. Fig. 6 (a-d) shows Drone 1’s observation, spatial confidence map (1), binary selection matrix (2), and ego attention weight (3). Fig. 6 (f-h) shows Drone 2’s observation and message sent to Drone 1, including the request map (opposite of confidence map) and the sparse feature map, achieving efficient communication. Fig. 6 (i) shows the attention weight for Drone 1 to fuse Drone 2’s messages, which is sparse, yet highlights the objects’ positions. Fig. 6 (e) and (j) compares the detection results before and after the collaboration with Drone 2. We see that the proposed spatial confidence map contributes to spatially sparse, yet perceptually critical message, which effectively helps Drone 1 detect occluded objects.
|
| 175 |
+
|
| 176 |
+
Visualization of detection results. Fig. 7 shows that compared to No Collaboration, When2com and DiscoNet, Where2comm is able to achieves more complete and accurate detection results. The reason is that When2com employs a scalar to denote the agent-to-agent attention, which cannot distinguish which spatial area is more informative; DiscoNet employs a MLP-based fusion weight learning, which cannot well capture the complex collaboration attention; while Where2comm can zoom in to critical spatial areas in a cell-level resolution and leverage the spatial confidence map and sensing distances as priors to achieve more comprehensive fusion.
|
| 177 |
+
|
| 178 |
+

|
| 179 |
+
|
| 180 |
+
Figure 7: Where2comm qualitatively outperforms When2com and DiscoNet in DAIR-V2X dataset. Green and red boxes denote ground-truth and detection, respectively. Yellow and blue denote the point clouds collected from vehicle and infrastructure, respectively.
|
| 181 |
+
|
| 182 |
+

|
| 183 |
+
Figure 8: Selection matrix ablation study. Applying Gaussian filter improves performance.
|
| 184 |
+
|
| 185 |
+
Table 2: Fusion component ablation study. Multi-head attention (MHA), sensor positional encoding (SPE) and spatial confidence map (SCM) all improves the performances. Results are reported in $\mathrm { A P @ 0 . 5 0 / A P @ 0 . 7 0 }$ .
|
| 186 |
+
|
| 187 |
+
<table><tr><td>MHA SPE SCM</td><td>OPV2V</td><td>CoPerception-UAVs</td><td>V2X-Sim</td></tr><tr><td rowspan="3">√</td><td></td><td>34.96/13.92</td><td>63.48/44.23 51.2/45.7</td></tr><tr><td>38.75/13.28</td><td>63.99/44.46</td><td>57.3/50.8</td></tr><tr><td>39.82/16.43</td><td>64.34/46.86</td><td>59.1/52.0</td></tr><tr><td>√ √</td><td>√ √ 卜</td><td>47.30/19.30</td><td>64.83/47.62</td><td>59.1/52.2</td></tr></table>
|
| 188 |
+
|
| 189 |
+
# 5.4 Ablation studies
|
| 190 |
+
|
| 191 |
+
Effect of Gaussian filter in perceptually critical area selection. Fig. 8 compares two versions of the selection matrix (2) with and without Gaussian filter. We see that applying Gaussian filter improves the overall performance. The reason is that: i) Gaussian filter could help filter out the outliers in the input map, selecting more robust critical regions; ii) it considers the context, benefiting the independent feature selection at each certain location by providing more information.
|
| 192 |
+
|
| 193 |
+
Effect of components in spatial confidence-aware message fusion. Tab. 2 assesses the effectiveness of the proposed fusion with two priors. We see that: i) per-location multi-head attention (MHA) outperforms the vanilla attention by $1 0 . 8 4 \%$ on OPV2V on $\mathbf { A P @ 0 . 5 0 }$ , because MHA leverages information from multiple heads, better capturing cross-agent attention; and ii) As two informative priors, both sensing position encoding (SPE) and spatial confidence map (SCM) can consistently improve the performance. Especially, the version with all three designs improves the detection performance by $2 2 . 0 6 \%$ on OPV2V on $\mathrm { A P @ } 0 . 5 0$ .
|
| 194 |
+
|
| 195 |
+
# 6 Conclusion and limitation
|
| 196 |
+
|
| 197 |
+
We propose Where2comm, a novel communication-efficient collaborative perception framework. The core idea is to exploit a spatial confidence map at each agent to promote pragmatic compression, assisting agents to decide what to communicate with whom, and whose information to aggregate. Each agent offers spatially sparse, yet perceptually critical features to support other agents; meanwhile, requests complementary information from others in multi-round communication. Comprehensive experiments covering multi-type agents and multi-modality inputs show that Where2comm achieves far superior trade-off between perception performance and communication bandwidth.
|
| 198 |
+
|
| 199 |
+
Limitation and future work. The current work focuses on perceptually critical spatial areas. In future, we plan to expand a similar idea to the temporal dimension and determine critical time stamps. More cost will be reduced by exploring when to communicate. We also expect that more methods on pragmatic compression and emergent communication could be applied to collaborative perception.
|
| 200 |
+
|
| 201 |
+
Acknowledgment. This research is partially supported by the National Key R&D Program of China under Grant 2021ZD0112801, National Natural Science Foundation of China under Grant 62171276, the Science and Technology Commission of Shanghai Municipal under Grant 21511100900, CCFDiDi GAIA Research Collaboration Plan 202112 and CALT Grant 2021-01.
|
| 202 |
+
|
| 203 |
+
References
|
| 204 |
+
[1] Tsun-Hsuan Wang, Sivabalan Manivasagam, Ming Liang, Bin Yang, Wenyuan Zeng, and Raquel Urtasun. V2vnet: Vehicle-to-vehicle communication for joint perception and prediction. In European Conference on Computer Vision, pages 605–621. Springer, 2020.
|
| 205 |
+
[2] Yiming Li, Shunli Ren, Pengxiang Wu, Siheng Chen, Chen Feng, and Wenjun Zhang. Learning distilled collaboration graph for multi-agent perception. Advances in Neural Information Processing Systems, 34, 2021.
|
| 206 |
+
[3] Siheng Chen, Baoan Liu, Chen Feng, Carlos Vallespi-Gonzalez, and Carl K. Wellington. 3d point cloud processing and learning for autonomous driving: Impacting map creation, localization, and perception. IEEE Signal Processing Magazine, 38:68–86, 2021.
|
| 207 |
+
[4] Zhi Li, Ali Vatankhah Barenji, Jiazhi Jiang, Ray Y Zhong, and Gangyan Xu. A mechanism for scheduling multi robot intelligent warehouse system face with dynamic demand. Journal of Intelligent Manufacturing, 31(2):469–480, 2020.
|
| 208 |
+
[5] Michela Zaccaria, Mikhail Giorgini, Riccardo Monica, and Jacopo Aleotti. Multi-robot multiple camera people detection and tracking in automated warehouses. In 2021 IEEE 19th International Conference on Industrial Informatics (INDIN), pages 1–6. IEEE, 2021.
|
| 209 |
+
[6] Jürgen Scherer, Saeed Yahyanejad, Samira Hayat, Evsen Yanmaz, Torsten Andre, Asif Khan, Vladimir Vukadinovic, Christian Bettstetter, Hermann Hellwagner, and Bernhard Rinner. An autonomous multi-uav system for search and rescue. In Proceedings of the First Workshop on Micro Aerial Vehicle Networks, Systems, and Applications for Civilian Use, pages 33–38, 2015.
|
| 210 |
+
[7] Ebtehal Turki Alotaibi, Shahad Saleh Alqefari, and Anis Koubaa. Lsar: Multi-uav collaboration for search and rescue missions. IEEE Access, 7:55817–55832, 2019.
|
| 211 |
+
[8] Yue Hu, Shaoheng Fang, Weidi Xie, and Siheng Chen. Aerial monocular 3d object detection. arXiv preprint arXiv:2208.03974, 2022.
|
| 212 |
+
[9] Yiming Li, Ziyan An, Zixun Wang, Yiqi Zhong, Siheng Chen, and Chen Feng. V2X-Sim: A virtual collaborative perception dataset for autonomous driving. IEEE Robotics and Automation Letters, 7, 2022.
|
| 213 |
+
[10] Runsheng Xu, Hao Xiang, Xin Xia, Xu Han, Jinlong Liu, and Jiaqi Ma. OPV2V: An open benchmark dataset and fusion pipeline for perception with vehicle-to-vehicle communication. ICRA, 2022.
|
| 214 |
+
[11] Haibao Yu, Yizhen Luo, Mao Shu, Yiyi Huo, Zebang Yang, Yifeng Shi, Zhenglong Guo, Hanyu Li, Xing Hu, Jirui Yuan, et al. DAIR-V2X: A large-scale dataset for vehicle-infrastructure cooperative 3d object detection. In Proceedings of the IEEE/CVF Conference on computer vision and pattern recognition (CVPR), 2022.
|
| 215 |
+
[12] Yen-Cheng Liu, Junjiao Tian, Nathaniel Glaser, and Zsolt Kira. When2com: Multi-agent perception via communication graph grouping. In Proceedings of the IEEE/CVF Conference on computer vision and pattern recognition, pages 4106–4115, 2020.
|
| 216 |
+
[13] Yen-Cheng Liu, Junjiao Tian, Chih-Yao Ma, Nathan Glaser, Chia-Wen Kuo, and Zsolt Kira. Who2com: Collaborative perception via learnable handshake communication. In 2020 IEEE International Conference on Robotics and Automation (ICRA), pages 6876–6883. IEEE, 2020.
|
| 217 |
+
[14] Yang Zhou, Jiuhong Xiao, Yue Zhou, and Giuseppe Loianno. Multi-robot collaborative perception with graph neural networks. IEEE Robotics and Automation Letters, 2022.
|
| 218 |
+
[15] Eduardo Arnold, Mehrdad Dianati, and Robert de Temple. Cooperative perception for 3d object detection in driving scenarios using infrastructure sensors. IEEE Transactions on Intelligent Transportation Systems, 23:1852–1864, 2022.
|
| 219 |
+
[16] Zixing Lei, Shunli Ren, Yue Hu, Wenjun Zhang, and Siheng Chen. Latency-aware collaborative perception. ECCV, 2022.
|
| 220 |
+
[17] Yiming Li, Juexiao Zhang, Dekun Ma, Yue Wang, and Chen Feng. Multi-robot scene completion: Towards task-agnostic collaborative perception. In Conference on Robot Learning (CoRL). PMLR, 2022.
|
| 221 |
+
[18] Runsheng Xu, Zhengzhong Tu, Hao Xiang, Wei Shao, Bolei Zhou, and Jiaqi Ma. CoBEVT: Cooperative bird’s eye view semantic segmentation with sparse transformers. CoRL, 2022.
|
| 222 |
+
[19] Sanbao Su, Yiming Li, Sihong He, Songyang Han, Chen Feng, Caiwen Ding, and Fei Miao. Uncertainty quantification of collaborative detection for self-driving, 2022.
|
| 223 |
+
[20] Amanpreet Singh, Tushar Jain, and Sainbayar Sukhbaatar. Learning when to communicate at scale in multiagent cooperative and competitive tasks. ICLR, 2019.
|
| 224 |
+
[21] Ming Tan. Multi-agent reinforcement learning: Independent vs. cooperative agents. In Proceedings of the tenth international conference on machine learning, pages 330–337, 1993.
|
| 225 |
+
[22] Faisal Qureshi and Demetri Terzopoulos. Smart camera networks in virtual reality. Proceedings of the IEEE, 96(10):1640–1656, 2008.
|
| 226 |
+
[23] Yiming Li, Bir Bhanu, and Wei Lin. Auction protocol for camera active control. In 2010 IEEE International Conference on Image Processing, pages 4325–4328. IEEE, 2010.
|
| 227 |
+
[24] Sainbayar Sukhbaatar, Rob Fergus, et al. Learning multiagent communication with backpropagation. Advances in neural information processing systems, 29, 2016.
|
| 228 |
+
[25] Yedid Hoshen. Vain: Attentional multi-agent predictive modeling. Advances in Neural Information Processing Systems, 30, 2017.
|
| 229 |
+
[26] Runsheng Xu, Hao Xiang, Zhengzhong Tu, Xin Xia, Ming-Hsuan Yang, and Jiaqi Ma. V2X-ViT: Vehicle-to-everything cooperative perception with vision transformer. ECCV, 2022.
|
| 230 |
+
[27] Y Yuan and M Sester. Comap: A synthetic dataset for collective multi-agent perception of autonomous driving. The International Archives of Photogrammetry, Remote Sensing and Spatial Information Sciences, 43:255–263, 2021.
|
| 231 |
+
[28] Xingyi Zhou, Dequan Wang, and Philipp Krähenbühl. Objects as points. In arXiv preprint arXiv:1904.07850, 2019.
|
| 232 |
+
[29] Yoshua Bengio, Jérôme Louradour, Ronan Collobert, and Jason Weston. Curriculum learning. In Proceedings of the 26th annual international conference on machine learning, pages 41–48, 2009.
|
| 233 |
+
[30] Alexey Dosovitskiy, German Ros, Felipe Codevilla, Antonio Lopez, and Vladlen Koltun. Carla: An open urban driving simulator. In Conference on robot learning, pages 1–16. PMLR, 2017.
|
| 234 |
+
[31] Cody Reading, Ali Harakeh, Julia Chae, and Steven L. Waslander. Categorical depth distribution network for monocular 3d object detection. CVPR, 2021.
|
| 235 |
+
[32] Daniel Krajzewicz, Jakob Erdmann, Michael Behrisch, and Laura Bieker. Recent development and applications of sumo-simulation of urban mobility. International journal on advances in systems and measurements, 5(3&4), 2012.
|
| 236 |
+
[33] Pengxiang Wu, Siheng Chen, and Dimitris N. Metaxas. Motionnet: Joint perception and motion prediction for autonomous driving based on bird’s eye view maps. 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 11382–11392, 2020.
|
| 237 |
+
[34] Shital Shah, Debadeepta Dey, Chris Lovett, and Ashish Kapoor. Airsim: High-fidelity visual and physical simulation for autonomous vehicles. In Field and service robotics, pages 621–635. Springer, 2018.
|
| 238 |
+
[35] Alex H. Lang, Sourabh Vora, Holger Caesar, Lubing Zhou, Jiong Yang, and Oscar Beijbom. Pointpillars: Fast encoders for object detection from point clouds. 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 12689–12697, 2019.
|
| 239 |
+
|
| 240 |
+
# Checklist
|
| 241 |
+
|
| 242 |
+
1. For all authors...
|
| 243 |
+
|
| 244 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 245 |
+
(b) Did you describe the limitations of your work? [Yes]
|
| 246 |
+
(c) Did you discuss any potential negative societal impacts of your work? [N/A]
|
| 247 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 248 |
+
|
| 249 |
+
2. If you are including theoretical results...
|
| 250 |
+
|
| 251 |
+
(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]
|
| 252 |
+
|
| 253 |
+
3. If you ran experiments...
|
| 254 |
+
|
| 255 |
+
(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.1 and the supplemental material.
|
| 256 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 5.1 and the supplemental material.
|
| 257 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] We have not repeated experiments many times to get error bars since experiments of 3d object detection on large scale datasets is time-consuming.
|
| 258 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Section 5.1 and the supplemental material.
|
| 259 |
+
|
| 260 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 261 |
+
|
| 262 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes] See Section 5.1.
|
| 263 |
+
(b) Did you mention the license of the assets? [Yes] See Section 5.1.
|
| 264 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] See Section 5.1 and the supplemental material.
|
| 265 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] We generate the data using the open-sourced tool and the owners consent to all the public use for research purposes.
|
| 266 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] Our data is synthesized using the open-sourced tool, so there is no real-world personally identifiable information, nor offensive content.
|
| 267 |
+
|
| 268 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 269 |
+
|
| 270 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 271 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 272 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/dMK7EwoTYp/dMK7EwoTYp.md
ADDED
|
@@ -0,0 +1,357 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MonoSDF: Exploring Monocular Geometric Cues for Neural Implicit Surface Reconstruction
|
| 2 |
+
|
| 3 |
+
Zehao $\mathbf { Y u } ^ { 1 }$ Songyou Peng2,3 Michael Niemeyer1,3 Torsten Sattler4 Andreas Geiger1,3
|
| 4 |
+
|
| 5 |
+
1University of Tübingen 2ETH Zurich 3MPI for Intelligent Systems, Tübingen 4Czech Technical University in Prague
|
| 6 |
+
|
| 7 |
+
https://niujinshuchong.github.io/monosdf
|
| 8 |
+
|
| 9 |
+
# Abstract
|
| 10 |
+
|
| 11 |
+
In recent years, neural implicit surface reconstruction methods have become popular for multi-view 3D reconstruction. In contrast to traditional multi-view stereo methods, these approaches tend to produce smoother and more complete reconstructions due to the inductive smoothness bias of neural networks. State-of-the-art neural implicit methods allow for high-quality reconstructions of simple scenes from many input views. Yet, their performance drops significantly for larger and more complex scenes and scenes captured from sparse viewpoints. This is caused primarily by the inherent ambiguity in the RGB reconstruction loss that does not provide enough constraints, in particular in less-observed and textureless areas. Motivated by recent advances in the area of monocular geometry prediction, we systematically explore the utility these cues provide for improving neural implicit surface reconstruction. We demonstrate that depth and normal cues, predicted by general-purpose monocular estimators, significantly improve reconstruction quality and optimization time. Further, we analyse and investigate multiple design choices for representing neural implicit surfaces, ranging from monolithic MLP models over single-grid to multi-resolution grid representations. We observe that geometric monocular priors improve performance both for small-scale single-object as well as large-scale multi-object scenes, independent of the choice of representation.
|
| 12 |
+
|
| 13 |
+
# 1 Introduction
|
| 14 |
+
|
| 15 |
+
3D reconstruction from multiple RGB images is a fundamental problem in computer vision with various applications in robotics, graphics, animation, virtual reality, and more. Recently, coordinatebased neural networks have emerged as a powerful tool for representing 3D geometry and appearance. The key idea is to use compact, memory efficient multi-layer perceptrons (MLPs) to parameterize implicit shape representations such as occupancy or signed distance fields. While early works [8, 37, 44] relied on 3D supervision, several recent works [41, 60, 75] use differentiable surface rendering to reconstruct scenes from multi-view images. At the same time, neural radiance fields (NeRFs) [38] achieved impressive novel view synthesis results with volume rendering techniques. [43, 69, 74] combine surface and volume rendering for the task of 3D reconstruction by expressing volume density as a function of the underlying 3D surface, which in turn improves scene geometry.
|
| 16 |
+
|
| 17 |
+
Current neural implicit-based surface reconstruction approaches achieve impressive reconstruction results for simple scenes with dense viewpoint sampling. Yet, as shown in the first row of Fig. 1, they struggle in the presence of limited input views (DTU with 3 views) or for scenes that contain large textureless regions (walls in ScanNet or Tanks & Temples). A key reason for this behavior is that these model are optimized using a per-pixel RGB reconstruction loss. Using only RGB images as input leads to an underconstrained problem as there exist an infinite number of photo-consistent explanations [4, 80]. Previous works address this problem by incorporating priors on the structure of the scene into the optimization process, e.g., depth smoothness [40], surface smoothness [43, 81], semantic similarity [27], or Manhattan world assumptions [18]. In this paper, we explore monocular geometric priors as they are readily available and efficient to compute. We show that using such priors significantly improves 3D reconstruction quality in challenging scenarios (see second row of Fig. 1).
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: MonoSDF. Top: State-of-the-art neural implicit surface reconstruction methods fail in the presence of limited input views or when applied to complex multi-object scenes. Bottom: We demonstrate that incorporating geometric cues from general-purpose monocular predictors enables scaling to larger scenes while yielding more accurate reconstructions and speeding up optimization. An image resolution of $3 8 4 \times 3 8 4$ pixels was used for all results shown above.
|
| 21 |
+
|
| 22 |
+
Estimating geometric cues such as depth and normals from a single image has been an active research area for decades. The seminal work by Eigen et al. [15, 16] showed that learned models based on deep convolutional neural networks (CNNs) significantly improved over early work in this area [21–24, 53–55]. Recent work [14, 49, 50], in particular Omnidata [14], has made significant headway in terms of prediction quality and generalization to new scenes using very large datasets for training. These strong results on individual images, and the fact that monocular geometric cues can be computed efficiently, naturally lead to the question whether such models are able to provide the additional constraints required by implicit neural surface reconstruction approaches to handle more challenging settings.
|
| 23 |
+
|
| 24 |
+
This paper describes a framework, called MonoSDF, for integrating monocular geometric priors into neural implicit surface reconstruction methods: given multi-view images, we infer depth and surface normals for each image, and use them as additional supervision signals during optimization together with the RGB image reconstruction loss. We observe that these priors lead to significant gains in reconstruction quality, especially in textureless and less-observed areas as shown in Fig. 1. This is due to the fact that the photometric consistency cues used by surface reconstruction methods and the recognition cues used by monocular networks are complementary: while photometric consistency fails in texturless regions such as walls, surface normals can be predicted reliably in these areas due to the structured 3D scene layout. Conversely, photoconsistency cues allow for establishing globally accurate 3D geometry in textured regions, while normal and (relative) depth cues only provide local geometric information.
|
| 25 |
+
|
| 26 |
+
Apart from incorporating monocular geometric cues, we provide a systematic study and analysis of state-of-the-art design choices for coordinate-based neural representations in the context of implicit surface reconstruction. More specifically, we investigate the following architectures: a single, large MLP [43, 69, 74, 75], a dense SDF grid [28], a single feature grid [25, 33, 47, 48] and multi-resolution feature grids [9, 19, 39, 63, 82]. We observe that MLPs act globally and exhibit an inductive smoothness bias while being computationally expensive to optimize and evaluate. In contrast, grid-based representations benefit from locality during optimization and evaluation, hence they are computationally more efficient. However, reconstructions are noisier for sparse views or less-observed areas. Including monocular geometric priors improves neural implicit reconstruction results across different settings with faster convergence times and independent of the underlying representation.
|
| 27 |
+
|
| 28 |
+
In summary, we make the following contributions:
|
| 29 |
+
|
| 30 |
+
• We introduce MonoSDF, a novel framework which exploits monocular geometric cues to improve multi-view 3D reconstruction quality, efficiency, and scalability for neural implicit surface models. • We provide a systematic comparison and detailed analysis of design choices of neural implicit surface representations, including vanilla MLP and grid-based approaches. • We conduct extensive experiments on multiple challenging datasets, ranging from object-level reconstruction on the DTU dataset [1], over room-level reconstruction on Replica [61] and ScanNet [12], to large-scale indoor scene reconstruction on Tanks and Temples [30].
|
| 31 |
+
|
| 32 |
+
# 2 Related Work
|
| 33 |
+
|
| 34 |
+
Architectures for Neural Implicit Scene Representations. Neural implicit scene representations or neural fields [71] have recently gained popularity for representing 3D geometry due to their expressiveness and low memory footprint. Seminal works [8, 37, 44] use a single MLP as the scene representation and show impressive object-level reconstruction quality, but they do not scale to more complicated or large-scale scenes due to the limited model capacity. Follow-up works [9, 19, 36, 39, 48, 63, 82] combine an MLP decoder with one or multi-level voxel grids of low-dimensional features. Such hybrid representations are able to better represent fine geometric details and can be evaluated fast. However, they lead to a larger memory footprint with increasing scene size. In this paper we provide a systematic comparison of four architectural design choices for implicit surface reconstruction.
|
| 35 |
+
|
| 36 |
+
3D Reconstruction from Multi-view Images. Reconstructing the underlying 3D geometry from multi-view images is a long-standing goal of computer vision. Classic multi-view stereo (MVS) methods [2, 5–7, 31, 31, 56, 58, 59] consider either feature matching for depth estimation [5, 56] or represent shapes with voxels [2, 6, 7, 31, 45, 58, 65, 66]. Learning-based MVS methods usually replace some parts of the classic MVS pipeline, e.g., feature matching [20, 32, 35, 67, 79], depth fusion [13, 51], or inferring depth from multi-view images [26, 72, 73, 77]. In contrast to the explicit scene representations used by classic MVS algorithms, recent neural approaches [34,42,75] represent surfaces via a single MLP with continuous outputs. Learned purely from posed 2D images, they show appealing reconstruction results and do not suffer from discretization. However, accurate object masks are required. Inspired by the density-based volume rendering in NeRF [38], which demonstrated impressive view synthesis without object masks, several works [43, 69, 74] use volume rendering for neural implicit surface reconstruction without masks. However, these methods lead to poor results in large-scale scenes with textureless regions. In this work, we show that incorporating monocular priors allows these approaches to obtain significantly more detailed reconstructions and to scale to larger and more challenging scenes.
|
| 37 |
+
|
| 38 |
+
Incorporating Priors into Neural Scene Representations. Several researchers proposed to incorporate priors such as depth smoothness [40], semantic similarity [27], or sparse MVS point clouds [52] for the task of novel view synthesis from sparse inputs. In contrast, in this work, our focus is on implicit 3D surface reconstruction. Concurrently, Manhattan-SDF [18] uses dense MVS depth maps from COLMAP [57] as supervision and adopts Manhattan world priors [10] to handle low-textured planar regions corresponding to walls, floors, etc. Our approach is based on the observation that data-driven monocular depth and normal predictions [14] provide high-quality priors for the full scene. Incorporating these priors into the optimization of neural implicit surfaces not only removes the Manhattan world assumption [10] but also results in improved reconstruction quality and a simpler pipeline.1 Compared to NeuRIS [68], a concurrent work that proposes to use normal priors for indoor scene reconstruction, we integrate monocular depth cues and further demonstrate the effectiveness of monocular cues on various neural scene representations, ranging from MLP to multi-resolution feature grids.
|
| 39 |
+
|
| 40 |
+

|
| 41 |
+
Figure 2: Overview. In this work we use monocular geometric cues predicted by a general-purpose pretrained network to guide the optimization of neural implicit surface models. More specifically, for a batch of rays, we volume render predicted RGB colors, depth, and normals, and optimize wrt. the input RGB images and monocular geometric cues. Further, we investigate different design choices for neural implicit architectures and provide an in-depth analysis. For clarity, we only show the SDF and not the color prediction branch above.
|
| 42 |
+
|
| 43 |
+
# 3 Method
|
| 44 |
+
|
| 45 |
+
Our goal is to recover the underlying scene geometry from multiple posed images while utilizing monocular geometric cues to guide the optimization process. To this end, we first review neural implicit scene representations and various design choices in Section 3.1 and discuss how to perform volume rendering of these representations in Section 3.2. Next, we introduce the monocular geometric cues we investigate in our study in Section 3.3 and discuss loss functions and the overall optimization process in Section 3.4. An overview of our framework is provided in Fig. 2.
|
| 46 |
+
|
| 47 |
+
# 3.1 Implicit Scene Representations
|
| 48 |
+
|
| 49 |
+
We represent scene geometry as a signed distance function (SDF). A signed distance function is a continuous function $f$ that, for a given 3D point, returns the point’s distance to the closest surface:
|
| 50 |
+
|
| 51 |
+
$$
|
| 52 |
+
f : \mathbb { R } ^ { 3 } \to \mathbb { R } \qquad \mathbf { x } \mapsto s = \mathbf { S D F } ( \mathbf { x } ) .
|
| 53 |
+
$$
|
| 54 |
+
|
| 55 |
+
Here, $\mathbf { x }$ is the 3D point and $s$ denotes the corresponding SDF value. In this work, we parameterize the SDF function with learnable parameters $\theta$ and investigate several different design choices for representing the function: explicit as a dense grid of learnable SDF values, implicit as a single MLP, or hybrid using an MLP in combination with single- or multi-resolution feature grids.
|
| 56 |
+
|
| 57 |
+
Dense SDF Grid. The most straightforward way of parameterizing an SDF is to directly store SDF values in each cell of a discretized volume $\mathcal { G } _ { \theta }$ with resolution of $R _ { H } \times R _ { W } \times R _ { D }$ [28]. To query the SDF value $\hat { s }$ for an arbitrary point $\mathbf { x }$ from the dense SDF grid, we can use any interpolation operation:
|
| 58 |
+
|
| 59 |
+
$$
|
| 60 |
+
\hat { s } = \mathrm { i n t e r p } ( \mathbf { x } , \mathcal { G } _ { \theta } ) .
|
| 61 |
+
$$
|
| 62 |
+
|
| 63 |
+
In our experiments, we implement interp as trilinear interpolation.
|
| 64 |
+
|
| 65 |
+
Single MLP. The SDF function can also be parameterized by a single MLP [44] $f _ { \theta }$
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
\hat { s } = f _ { \boldsymbol \theta } ( \gamma ( \mathbf { x } ) ) \mathrm { ~ , ~ }
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
where $\hat { s }$ is the predicted SDF value and $\gamma$ corresponds to a fixed positional encoding [38, 64] mapping $\mathbf { x }$ to a higher dimensional space. After their introduction to novel view synthesis [38], positional
|
| 72 |
+
|
| 73 |
+
encoding functions are now widely used for neural implicit surface reconstruction [43, 69, 74, 75] as they increase the expressiveness of coordinate-based networks [64].
|
| 74 |
+
|
| 75 |
+
Single-Resolution Feature Grid with MLP Decoder. We can also combine both parameterizations and use a feature-conditioned MLP $f _ { \theta }$ together with a feature grid $\Phi _ { \theta }$ with a resolution of $R ^ { 3 }$ , where each cell of the grid stores a feature vector [25, 33, 48, 63] instead of directly storing SDF values:
|
| 76 |
+
|
| 77 |
+
$$
|
| 78 |
+
\hat { s } = f _ { \theta } ( \gamma ( { \bf x } ) , \mathrm { i n t e r p } ( { \bf x } , \Phi _ { \theta } ) ) \ .
|
| 79 |
+
$$
|
| 80 |
+
|
| 81 |
+
Note that the MLP $f _ { \theta }$ is conditioned on the interpolated local feature vector from the feature grid $\Phi _ { \theta }$ . Multi-Resolution Feature Grids with MLP Decoder. Instead of using a single feature grid $\Phi _ { \theta }$ , one can also employ multi-resolution feature grids $\{ \Phi _ { \theta } ^ { l } \} _ { l = 1 } ^ { L }$ with resolutions $R _ { l }$ [9, 19, 39, 63, 82]. The resolutions are sampled in geometric space [39] to combine features at different frequencies:
|
| 82 |
+
|
| 83 |
+
$$
|
| 84 |
+
R _ { l } : = \ \lfloor R _ { \mathrm { m i n } } b ^ { l } \rfloor \qquad b : = \ \mathrm { e x p } \left( { \frac { \ln R _ { \mathrm { m a x } } - \ln R _ { \mathrm { m i n } } } { L - 1 } } \right) ,
|
| 85 |
+
$$
|
| 86 |
+
|
| 87 |
+
where $R _ { \mathrm { m i n } } , R _ { \mathrm { m a x } }$ are the coarsest and finest resolution, respectively. Similarly, we extract the interpolated features at each level and concatenate them together:
|
| 88 |
+
|
| 89 |
+
$$
|
| 90 |
+
\hat { s } = f _ { \theta } ( \gamma ( { \bf x } ) , \{ \mathrm { i n t e r p } ( { \bf x } , \Phi _ { \theta } ^ { l } ) \} _ { l } ) ) \mathrm { ~ . ~ }
|
| 91 |
+
$$
|
| 92 |
+
|
| 93 |
+
As the total number of grid cells grows cubically, we use a fixed number of parameters to store the feature grids and use a spatial hash function to index the feature vector at finer levels [39] (see supplementary for details).
|
| 94 |
+
|
| 95 |
+
Color Prediction. In addition to the 3D geometry, we also predict color values such that our model can be optimized with a reconstruction loss. Following [75], we therefore define a second function $\mathbf { c } _ { \theta }$
|
| 96 |
+
|
| 97 |
+
$$
|
| 98 |
+
\hat { \mathbf { c } } = \mathbf { c } _ { \theta } ( \mathbf { x } , \mathbf { v } , \hat { \mathbf { n } } , \hat { \mathbf { z } } )
|
| 99 |
+
$$
|
| 100 |
+
|
| 101 |
+
that predicts a RGB color value cˆ for a 3D point $\mathbf { x }$ and a viewing direction $\mathbf { v }$ . The 3D unit normal nˆ is the analytical gradient of our SDF function. The feature vector $\hat { \mathbf { z } }$ is the output of a second linear head of the SDF network as in [75]. We parameterize $\mathbf { c } _ { \theta }$ with a two-layer MLP with network weights $\theta$ . In case of the dense grid SDF parameterization, we similarly optimize a dense feature grid and obtain the feature vector $\hat { \mathbf { z } }$ via the interpolation function interp.
|
| 102 |
+
|
| 103 |
+
# 3.2 Volume Rendering of Implicit Surfaces
|
| 104 |
+
|
| 105 |
+
Following recent work [43,69,74,75], we optimize the implicit representations described in Section 3.1 via an image-based reconstruction loss using differentiable volume rendering. More specifically, to render a pixel, we cast a ray r from the camera center $\mathbf { o }$ through the pixel along its view direction $\mathbf { v }$ . We sample $M$ points $\mathbf { x } _ { \mathbf { r } } ^ { i } = \mathbf { o } + t _ { \mathbf { r } } ^ { i } \mathbf { v }$ along the ray and predict their SDF ${ \hat { s } } _ { \mathbf { r } } ^ { i }$ and color values $\hat { \mathbf { c } } _ { \mathbf { r } } ^ { i }$ . We follow [74] to transform the SDF values ${ \bar { s } } _ { \mathbf { r } } ^ { i }$ to density values $\boldsymbol { \sigma } _ { \mathbf { r } } ^ { i }$ for volume rendering:
|
| 106 |
+
|
| 107 |
+
$$
|
| 108 |
+
\sigma _ { \beta } ( s ) = { \left\{ \begin{array} { l l } { { \frac { 1 } { 2 \beta } } \exp \left( { \frac { s } { \beta } } \right) } & { { \mathrm { i f } } s \leq 0 } \\ { { \frac { 1 } { \beta } } \left( 1 - { \frac { 1 } { 2 } } \exp \left( - { \frac { s } { \beta } } \right) \right) } & { { \mathrm { i f } } s > 0 } \end{array} \right. } ,
|
| 109 |
+
$$
|
| 110 |
+
|
| 111 |
+
where $\beta$ is a learnable parameter. Following NeRF [38], the color $\hat { C } ( \mathbf { r } )$ for the current ray $\mathbf { r }$ is computed via numerical integration:
|
| 112 |
+
|
| 113 |
+
$$
|
| 114 |
+
\hat { C } ( { \bf r } ) = \sum _ { i = 1 } ^ { M } T _ { { \bf r } } ^ { i } \alpha _ { { \bf r } } ^ { i } \hat { \bf c } _ { { \bf r } } ^ { i } \qquad T _ { { \bf r } } ^ { i } = \prod _ { j = 1 } ^ { i - 1 } \left( 1 - \alpha _ { { \bf r } } ^ { j } \right) \qquad \alpha _ { { \bf r } } ^ { i } = 1 - \exp \left( - \sigma _ { { \bf r } } ^ { i } \delta _ { { \bf r } } ^ { i } \right) ~ ,
|
| 115 |
+
$$
|
| 116 |
+
|
| 117 |
+
where $T _ { \mathbf { r } } ^ { i }$ and $\alpha _ { \mathbf { r } } ^ { i }$ denote the transmittance and alpha value of sample point $i$ along ray $\mathbf { r }$ , respectively, and ${ \delta _ { \mathbf { r } } ^ { i } }$ is the distance between neighboring sample points. Similarly, we compute the depth $\bar { \hat { D } } ( { \bf r } )$ and normal $\hat { N } ( \mathbf { r } )$ of the surface intersecting the current ray as:
|
| 118 |
+
|
| 119 |
+
$$
|
| 120 |
+
\hat { D } ( { \bf r } ) = \sum _ { i = 1 } ^ { M } T _ { \bf r } ^ { i } \alpha _ { \bf r } ^ { i } t _ { \bf r } ^ { i } \qquad \hat { N } ( { \bf r } ) = \sum _ { i = 1 } ^ { M } T _ { \bf r } ^ { i } \alpha _ { \bf r } ^ { i } \hat { \bf n } _ { \bf r } ^ { i } .
|
| 121 |
+
$$
|
| 122 |
+
|
| 123 |
+
# 3.3 Exploiting Monocular Geometric Cues
|
| 124 |
+
|
| 125 |
+
Unifying volume rendering with implicit surfaces leads to impressive 3D reconstruction results. Yet, this approach struggles with more complex scenes especially in textureless and sparsely covered regions. To overcome this limitation, we use readily available, efficient-to-compute monocular geometric priors thereby improving neural implicit surface methods.
|
| 126 |
+
|
| 127 |
+
Monocular Depth Cues. One common monocular geometric cue is a monocular depth map, which can be easily obtained via an off-the-shelf monocular depth predictor. More specifically, we use a pretrained Omnidata model [14] to predict a depth map $\bar { D }$ for each input RGB image. Note that the absolute scale is difficult to estimate in general scenes, so $\bar { D }$ must be considered as a relative cue. However, this relative depth information is provided also over larger distances in the image.
|
| 128 |
+
|
| 129 |
+
Monocular Normal Cues. Another geometric cue we use is the surface normal. Similar to the depth cues, we apply the same pretrained Omnidata model to acquire a normal map $\bar { N }$ for each RGB image. Unlike depth cues that provide semi-local relative information, normal cues are local and capture geometric detail. We hence expect that surface normals and depth are complementary to each other.
|
| 130 |
+
|
| 131 |
+
# 3.4 Optimization
|
| 132 |
+
|
| 133 |
+
Reconstruction Loss. Eq. (9) provides a linkage from the 3D scene representation to 2D observations. We can therefore optimize the scene representation with a simple RGB reconstruction loss:
|
| 134 |
+
|
| 135 |
+
$$
|
| 136 |
+
\mathcal { L } _ { \mathrm { r g b } } = \sum _ { { \bf r } \in \mathcal { R } } \| \hat { C } ( { \bf r } ) - C ( { \bf r } ) \| _ { 1 } \mathrm { ~ . ~ }
|
| 137 |
+
$$
|
| 138 |
+
|
| 139 |
+
Here $\mathcal { R }$ denotes the set of pixels/rays in the minibatch and $C ( \mathbf { r } )$ is the observed pixel color.
|
| 140 |
+
|
| 141 |
+
Eikonal Loss. Following common practice, we also add an Eikonal term [17] on the sampled points to regularize SDF values in 3D space
|
| 142 |
+
|
| 143 |
+
$$
|
| 144 |
+
{ \mathcal { L } } _ { \mathrm { e i k o n a l } } = \sum _ { \mathbf { x } \in { \mathcal { X } } } ( \| \nabla f _ { \theta } ( \mathbf { x } ) \| _ { 2 } - 1 ) ^ { 2 } ~ ,
|
| 145 |
+
$$
|
| 146 |
+
|
| 147 |
+
where $\mathcal { X }$ are a set of uniformly sampled points together with near-surface points [74].
|
| 148 |
+
|
| 149 |
+
Depth Consistency Loss. Besides $\mathcal { L } _ { \mathrm { r g b } }$ and $\mathcal { L } _ { \mathrm { e i k o n a l } }$ , we also enforce consistency between our rendered expected depth $\hat { D }$ and the monocular depth $\bar { D }$ :
|
| 150 |
+
|
| 151 |
+
$$
|
| 152 |
+
\mathcal { L } _ { \mathrm { d e p t h } } = \sum _ { \mathbf { r } \in \mathcal { R } } \left. \left( w \hat { D } ( \mathbf { r } ) + q \right) - \bar { D } ( \mathbf { r } ) \right. ^ { 2 } \ ,
|
| 153 |
+
$$
|
| 154 |
+
|
| 155 |
+
where $w$ and $q$ are the scale and shift used to align $\hat { D }$ and $\bar { D }$ since $\bar { D }$ is defined only up to scale. Note that these factors have to be estimated individually per batch as the depth maps predicted for different batches can differ in scale and shift. Specifically, we solve for $w$ and $q$ with a least-squares criterion [16, 50] which has a closed-form solution (see supplementary for details).
|
| 156 |
+
|
| 157 |
+
Normal Consistency Loss. Similarly, we impose consistency on the volume-rendered normal $\hat { N }$ and the predicted monocular normals $\bar { N }$ transformed to the same coordinate system with angular and L1 losses [14]:
|
| 158 |
+
|
| 159 |
+
$$
|
| 160 |
+
\mathcal { L } _ { \mathrm { n o r m a l } } = \sum _ { \mathbf { r } \in \mathcal { R } } \| \hat { N } ( \mathbf { r } ) - \bar { N } ( \mathbf { r } ) \| _ { 1 } + \| 1 - \hat { N } ( \mathbf { r } ) ^ { \top } \bar { N } ( \mathbf { r } ) \| _ { 1 } \ .
|
| 161 |
+
$$
|
| 162 |
+
|
| 163 |
+
The overall loss we use to optimize our implicit surfaces jointly with the appearance network is:
|
| 164 |
+
|
| 165 |
+
$$
|
| 166 |
+
{ \mathcal { L } } = { \mathcal { L } } _ { \mathrm { r g b } } + \lambda _ { 1 } { \mathcal { L } } _ { \mathrm { e i k o n a l } } + \lambda _ { 2 } { \mathcal { L } } _ { \mathrm { d e p t h } } + \lambda _ { 3 } { \mathcal { L } } _ { \mathrm { n o r m a l } } ~ .
|
| 167 |
+
$$
|
| 168 |
+
|
| 169 |
+
Implementation Details. We implement our method in PyTorch [46] and use the Adam optimizer [29] with a learning rate of 5e-4 for neural networks and 1e-2 for feature grids and dense SDF grids. We set $\lambda _ { 1 } , \lambda _ { 2 } .$ , $\lambda _ { 3 }$ to 0.1, 0.1, 0.05, respectively. We sample 1024 rays per iteration and apply the error-bounded sampling strategy introduced by [74] to sample points along each ray. For MLPs and feature grids, we adapt the architecture and initialization scheme from [74] and [39], respectively. For obtaining monocular cues, we first resize each image and center crop it to $3 8 4 \times 3 8 4$ , which we then feed as input to the pretrained Omnidata model [14]. See supplementary for more details.
|
| 170 |
+
|
| 171 |
+

|
| 172 |
+
Figure 3: Architectural Ablation Study. Comparing different design choices for neural implicit surface representations, we observe that a dense SDF grid leads to noisy reconstructions due to a missing smoothness bias. The MLP and the Single-Res. Fea. Grid improve results, but geometry tends to be overly smooth with missing details. The best results are obtained using Multi-Res. Fea. Grids.
|
| 173 |
+
|
| 174 |
+
# 4 Experiments
|
| 175 |
+
|
| 176 |
+
We first analyze different architectural design choices and perform ablation studies wrt. monocular cues and optimization time on a room-level dataset (Replica) with perfect ground truth. Next, we provide qualitative and quantitative comparisons against state-of-the-art baselines on real-world indoor scenes. Finally, we evaluate our method on object-level reconstruction for both sparse input and dense input scenarios.
|
| 177 |
+
|
| 178 |
+
Datasets. While previous neural implicit-based reconstruction methods mainly focused on singleobject scenes with many input views, in this work, we investigate the importance of monocular geometric cues for scaling to more complex scenes. Thus we consider: a) Real-world indoor scans: Replica [61] and ScanNet [12]; b) Real-world large-scale indoor scenes: Tanks and Temples [30] advanced scenes; c) Object-level scenes: DTU [1] in the sparse 3-view setting from [40, 76].
|
| 179 |
+
|
| 180 |
+
Baselines. We compare against a) state-of-the-art neural implicit surfaces methods: UNISURF [43], VolSDF [74], NeuS [69], and Manhattan-SDF [18]. b) Classic MVS methods: COLMAP [56] and a state-of-the-art commercial software (RealityCapture2). c) TSDF-Fusion [11] with predicted monocular depth cues, where GT depth maps are used to recover the scale and shift values (cf. Eq. (13)). This baseline shows the reconstruction quality if only monocular depth cues and no implicit surface model is used.
|
| 181 |
+
|
| 182 |
+
Evaluation Metrics. For DTU, we follow the official evaluation protocol and report the Chamfer distance. For Replica and ScanNet, following [18, 37, 47, 48, 62, 82], we report the Chamfer Distance, the F-score with a threshold of 5cm, as well as a Normal Consistency measure.
|
| 183 |
+
|
| 184 |
+
# 4.1 Ablation Study
|
| 185 |
+
|
| 186 |
+
We first analyze different scene representation choices on the Replica dataset. Next, we ablate the impact of our geometric cues on reconstruction quality and convergence time.
|
| 187 |
+
|
| 188 |
+
<table><tr><td colspan="4">Normal C.↑Chamfer-L1↓F-score ↑</td></tr><tr><td>MLP [74]</td><td>86.48</td><td>6.75</td><td>66.88</td></tr><tr><td>Dense SDF Grid</td><td>57.30</td><td>26.68</td><td>15.50</td></tr><tr><td>Single-res. Fea. Grid</td><td>86.41</td><td>6.28</td><td>64.22</td></tr><tr><td>Multi-res.Fea. Grids</td><td>87.95</td><td>5.03</td><td>78.38</td></tr></table>
|
| 189 |
+
|
| 190 |
+
Architecture Choices for Scene Representations. We compare the four different scene geometry representations introduced in Section 3.1 and report metrics averaged over the Replica dataset in Table 1. Note that no monocular geometric cues are used here. We first observe that using a single MLP as the scene geometry representation leads to decent results, but the recon
|
| 191 |
+
|
| 192 |
+
# Table 1: Architectural Ablation on Replica.
|
| 193 |
+
|
| 194 |
+
struction tends to be over-smooth (see Table 1 and Fig. 3). For grid-based representations, optimizing a dense SDF grid leads to a significantly worse performance compared to all other neural implicit scene representations, even with careful parameter tuning. The reason is the lack of a smoothness bias: The SDF values in grid cells are all stored and optimized independently of each other, hence there is no local or global smoothness bias. In contrast, the Single-Res. Fea. Grid replaces the SDF value in each grid cell with a low-dimensional latent code, and uses a shallow MLP conditioned on these features to read out SDF values of arbitrary 3D points. This modification leads to a notable boost in reconstruction quality over the dense grid, performing similarly well as the single MLP. Using a Multi-Res. Fea. Grids as in [39] further increases performance. We observe that the Multi-Res. Fea. Grids is the best-performing grid-based model, and from now on we report results for the single MLP and the Multi-Res. Feature Grids. For simplicity, we will refer to the multi-resolution feature grids as Multi-Res. Grids or Grids in the following.
|
| 195 |
+
|
| 196 |
+

|
| 197 |
+
+ Depth + Normal
|
| 198 |
+
|
| 199 |
+
<table><tr><td></td><td>Normal C.↑ Chamfer-L1↓F-score ↑</td><td></td><td></td><td></td></tr><tr><td rowspan="4">MLP</td><td>No Cues</td><td>86.48</td><td>6.75</td><td>66.88</td></tr><tr><td>Only Depth</td><td>90.56</td><td>4.26</td><td>76.42</td></tr><tr><td>Only Normal</td><td>91.35</td><td>3.19</td><td>85.84</td></tr><tr><td>Both Cues</td><td>92.11</td><td>2.94</td><td>86.18</td></tr><tr><td rowspan="4">Multi-Res. Grids</td><td>No Cues</td><td>87.95</td><td>5.03</td><td>78.38</td></tr><tr><td>Only Depth</td><td>90.87</td><td>3.75</td><td>80.32</td></tr><tr><td>Only Normal</td><td>89.90</td><td>3.61</td><td>81.28</td></tr><tr><td>Both Cues</td><td>90.93</td><td>3.23</td><td>85.91</td></tr></table>
|
| 200 |
+
|
| 201 |
+
(a) Different Cues
|
| 202 |
+
|
| 203 |
+

|
| 204 |
+
Figure 4: Ablation of Monocular Geometric Cues. Monocular geometric cues significantly improve reconstruction quality for both architectures (we show our MLP variant). With monocular depth cues, the recovered geometry contains more details and a better overall structure. With normal cues, missing details are added and the results become smoother. Using both cues leads to the best performance.
|
| 205 |
+
Table 2: Ablation of Monocular Geometric Cues. a.) We report reconstruction results on Replica for MLP and Multi-Res. Grids with and without the monocular geometric cues. We observe that monocular cues improve reconstruction quality for both architectures, and using both cues in combination leads to the best performance. b.) The optimization speed becomes significantly faster when incorporating monocular cues. Comparing the two architectures, we observe that the grid approach yields faster convergences while the MLP with both cues leads to the best results.
|
| 206 |
+
|
| 207 |
+
Ablation of Different Cues. We now investigate the effectiveness of different monocular geometric cues for the two chosen representations. Table 2 (a) and Fig. 4 show that, for both representations, using either one or both monocular cues significantly boosts reconstruction quality. We also find both cues to be complementary, with the best performance being achieved when using both. Similar behavior can be observed for the other two representations (cf. supplementary material). It is worth noting that the differences between the two representations become negligible when using monocular cues, indicating that those serve as a general drop-in to improve reconstruction quality.
|
| 208 |
+
|
| 209 |
+
Optimization Time. Table 2 (b) shows optimization time for the two scene representations with and without cues. We see that the Multi-Res. Grids converge faster than the single MLP model. Further, adding the monocular cues significantly speeds up the convergence process. After only 10K iterations, both representations perform better than the converged models without monocular cues. Note that the overhead required for incorporating the monocular cues into the optimization process is small and can be neglected. An extended version of Table 2 (b) can be found in the supplementary materials.
|
| 210 |
+
|
| 211 |
+
# 4.2 Real-world Large-scale Scene Reconstruction
|
| 212 |
+
|
| 213 |
+
To show the effectiveness of our method for large-scale scene reconstruction, we compare against various baselines on two challenging large-scale indoor datasets.
|
| 214 |
+
|
| 215 |
+
ScanNet. On ScanNet, we use the test split from [18] and also follow their evaluation protocol in which depth maps are rendered from input camera poses and then re-fused using TSDF Fusion [11] to evaluate only observed areas. We observe in Table 3 that our MLP variant outperforms all baselines achieving smoother reconstructions with more fine details. Note that we outperform concurrent work [68]. Further, we find that the MLP variant performs significantly better than using Multi-Res. Grids. ScanNet’s RGB images contain motion blur and the camera poses are also noisy. This can be harmful to the local geometry updates in grid-based representations, while MLPs are more robust to this noise due to their smoothness bias.
|
| 216 |
+
|
| 217 |
+
<table><tr><td>COLMAP [56]</td><td>VolSDF[38]</td><td>Manhattan-SDF[18]</td><td>Ours (MLP)</td><td></td><td>Ground Truth</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>□</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>国</td><td>國</td><td></td><td></td><td>国</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 218 |
+
|
| 219 |
+
Table 3: Scene-level Reconstruction on ScanNet. Colmap and VolSDF do not lead to competitive reconstructions. Manhatten-SDF achieves compelling results, but less-observed areas are noisier and details are missing. In contrast, our approaches reconstruct smooth and details surfaces, achieving the best results. Further, MLPs are more robust to the motion blur and noise in camera poses.
|
| 220 |
+
|
| 221 |
+
<table><tr><td></td><td>COLMAP [56]</td><td>UNISURF[43] NeuS [69]</td><td></td><td></td><td></td><td></td><td>]VolSDF[74] M-SDF[18] NeuRIS [68] Ours (Grids) Ours (MLP)</td><td></td></tr><tr><td>Chamfer-L1↓</td><td>0.141</td><td>0.359</td><td>0.194</td><td>0.267</td><td>0.070</td><td>0.050</td><td>0.064</td><td>0.042</td></tr><tr><td>F-score↑</td><td>0.537</td><td>0.267</td><td>0.291</td><td>0.364</td><td>0.602</td><td>0.692</td><td>0.626</td><td>0.733</td></tr></table>
|
| 222 |
+
|
| 223 |
+
Tanks & Temples. To further investigate the scalability of our method to larger-scale scenes, we conduct experiments on the Tanks and Temples advanced sets. The qualitative results in Fig. 1 show that the monocular cues significantly boost the performance of VolSDF [74], making MonoSDF the first neural implicit model achieving reasonable results on such a large-scale indoor scene. See the supplementary material for more visual comparisons and discussions.
|
| 224 |
+
|
| 225 |
+
# 4.3 Object-level Reconstruction from Sparse Views
|
| 226 |
+
|
| 227 |
+
We now evaluate our method on another challenging task: reconstructing single objects from sparse input views. We adopt the test split from [74,75] on DTU and choose three input views following [40].
|
| 228 |
+
|
| 229 |
+
We first observe in Table 4 and Fig. 1 that without the usage of the monocular geometric cues, neither the MLP (VolSDF [74]) nor the Multi-Res. Grids work well with only 3 input views. When incorporating the cues, the results for both representations are significantly improved. Interestingly, the grid-based representations perform inferior to a single MLP as they are updated locally and do not benefit from the inductive bias of a monolithic MLP representation.
|
| 230 |
+
|
| 231 |
+
Comparing against TSDF Fusion [11] that fused predicted depth cues from all views into a TSDF volume without any optimization, we observe that this baseline has difficulties in reconstructing meaningful details due to inconsistencies in the monocular depth cues. Note that this baseline uses the GT depth maps from [13] to compute scale and shift for the depth cues. Classic MVS methods perform well quantitatively, but they heavily rely on dense matching, and in case of three input images, this inevitably leads to incomplete reconstructions (see supplementary material). In contrast, our approach combines neural implicit surface representations with the benefits from monocular geometric cues that are more robust to less-observed regions.
|
| 232 |
+
|
| 233 |
+
Table 4: Reconstruction on DTU (3 Views). We report the average over the test split from [74] (see supplementary for per-object results).
|
| 234 |
+
|
| 235 |
+
<table><tr><td>Chamfer-L1↓</td></tr><tr><td>TSDF-Fusion[11]</td></tr><tr><td>4.80 COLMAP [56] 2.56</td></tr><tr><td>RealityCapture 2.84</td></tr><tr><td>Grids 6.47</td></tr><tr><td>Gridsw/ cues 3.68</td></tr><tr><td>MLP [74] 4.21</td></tr><tr><td>MLP w/cues 1.86</td></tr></table>
|
| 236 |
+
|
| 237 |
+
# 4.4 Object-level Reconstruction from Dense Views
|
| 238 |
+
|
| 239 |
+
To further investigate the effectiveness and flexibility of our method, we evaluate our approach on the DTU dataset with all input views, which is a common setting in recent work [43, 70, 74]. In this experiment, we simply resize the low-resolution monocular cues to full resolution (from $3 8 4 \times 3 8 4$ to $1 2 0 0 \times 1 2 0 0$ pixels) while keeping the image ratio. As the original image is of size $1 2 0 0 \times 1 6 0 0$ , the monocular cues are missing in the left and right part of the image. Therefore, we only use the monocular cues where they are available.
|
| 240 |
+
|
| 241 |
+
As shown in Table 5, our approach with MLP architecture achieves reconstruction quality similar to state-of-the-art methods [43, 70, 74]. This is reasonable as the dense input views provide enough constraints and the prior information from monocular cues is negligible. However, our method with multi-resolution feature grid architecture outperforms previous work by a large margin. We attribute this to the expressiveness of multi-resolution feature grids where monocular cues are still effective to suppress noise and therefore can reconstruct smooth and detailed surfaces. We kindly refer the reader to the supplementary material for additional visual comparisons.
|
| 242 |
+
|
| 243 |
+
Table 5: Object-level Reconstruction on DTU Dataset will All Input Views. We compare Chamfer distance with state-of-the-art methods. Our approach with MLP achieves similar results to previous methods, while our method with multi-resolution feature grids leads to more detailed surfaces and outperforms previous work by a large margin.
|
| 244 |
+
|
| 245 |
+
<table><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>出出 </td><td>上 国 视建健班</td></tr><tr><td>Scan</td><td>243740556365698397105106110114 118 122 Mean</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>COLMAP</td><td></td><td></td><td></td><td></td><td></td><td>0.81 2.05 0.73 1.22 1.79 1.58 1.02 3.05 1.40 2.05 1.00 1.32 0.49 0.78 1.17</td><td></td><td></td></tr><tr><td>NeRF[38]</td><td></td><td></td><td>1.90 1.60 1.85 0.58 2.28 1.27 1.47 1.67 2.05 1.07</td><td></td><td></td><td>0.88 2.53 31.06</td><td>1.15 0.96</td><td>1.36 1.49</td></tr><tr><td>UniSurf [43] 1.32 1.36 1.72 0.44 1.35 0.79 0.80 1.49 1.37 0.89 (</td><td></td><td></td><td></td><td></td><td></td><td>0.591.47 0.46 0.59 0.62</td><td></td><td>1.02</td></tr><tr><td>NeuS[70]1</td><td></td><td></td><td>1.00 1.37 0.93 0.43 1.10 0.65 0.57 1.48 1.09 0.83</td><td></td><td></td><td>0.521.20 0.35</td><td>0.49 0.54</td><td>0.84</td></tr><tr><td>VolSDF[74]</td><td></td><td></td><td></td><td></td><td>1.14 1.26 0.81 0.49 1.25 0.70 0.72 1.29 1.18 0.70 0.66 1.08</td><td>0.42</td><td>0.61 0.55</td><td>0.86</td></tr><tr><td></td><td>Ours (MLP) 0.83 1.61 0.65 0.47 0.92 0.87 0.87 1.30 1.25 0.68 0.65 0.96 0.41 0.62 0.58</td><td></td><td>Ours(Grids) 0.66 0.88 0.43 0.40 0.87 0.78 0.81 1.23 1.18 0.66 0.66 0.96 0.41 0.57 0.51</td><td></td><td></td><td></td><td></td><td>0.84</td></tr></table>
|
| 246 |
+
|
| 247 |
+
# 5 Conclusion
|
| 248 |
+
|
| 249 |
+
We have presented MonoSDF, a novel framework that systematically explores how monocular geometric cues can be incorporated into the optimization of neural implicit surfaces from multiview images. We show that such easy-to-obtain monocular cues can significantly improve 3D reconstruction quality, efficiency, and scalability for a variety of neural implicit representations. When using monocular cues, a simple MLP architecture performs best overall, demonstrating that MLPs in principle are able to represent complex scenes, albeit being slower to converge compared to grid-based representations. Multi-resolution feature grids in general can converge fast and capture details, but are less robust to noise and ambiguities in the input images.
|
| 250 |
+
|
| 251 |
+
Limitations. The performance of our model depends on the quality of the monocular cues. Filtering strategies to handle failures of the monocular predictor are thus a promising direction to further improve reconstruction quality. We kindly refer the reader to the supplementary material for additional analysis. While we demonstrated that integrating depth and normal cues significantly improves reconstruction, exploring other cues such as occlusion edges, plane, or curvature [14, 78] is an interesting future direction. We are currently limited by the low-resolution $3 8 4 \times 3 8 4$ pixels) output of the Omnidata model [14] and plan to explore different ways of using higher-resolution cues. We provide some preliminary results of using high-resolution cues in the supplementary. Joint optimization of scene representations and camera parameters [3, 82] is another interesting direction, especially for multi-resolution grids, in order to better handle noisy camera poses.
|
| 252 |
+
|
| 253 |
+
# Acknowledgments and Disclosure of Funding
|
| 254 |
+
|
| 255 |
+
This work was supported by an NVIDIA research gift. We thank the Max Planck ETH Center for Learning Systems (CLS) for supporting SP and the International Max Planck Research School for Intelligent Systems (IMPRS-IS) for supporting MN. ZY is supported by BMWi in the project KI Delta Learning (project number 19A19013O). AG is supported by the ERC Starting Grant LEGO3D (850533) and DFG EXC number 2064/1 - project number 390727645. TS is supported by the EU Horizon 2020 project RICAIP (grant agreeement No.857306), and the European Regional Development Fund under project IMPACT (No. CZ.02.1.01/0.0/0.0/15_003/0000468). We thank the authors of Manhattan-SDF and NeuRIS for sharing results on ScanNet. We also thank Christian Reiser and Zijian Dong for proofreading.
|
| 256 |
+
|
| 257 |
+
# References
|
| 258 |
+
|
| 259 |
+
view stereopsis. International Journal of Computer Vision (IJCV), 120(2):153–168, 2016. 3,
|
| 260 |
+
7 [2] M. Agrawal and L. S. Davis. A probabilistic framework for surface reconstruction from multiple images. In Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2001. 3 [3] D. Azinovic, R. Martin-Brualla, D. B. Goldman, M. Nießner, and J. Thies. Neural rgb-d surface ´ reconstruction. In Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR),
|
| 261 |
+
2022. 10 [4] J. T. Barron, B. Mildenhall, D. Verbin, P. P. Srinivasan, and P. Hedman. Mip-nerf 360: Unbounded anti-aliased neural radiance fields. IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2022. 2 [5] M. Bleyer, C. Rhemann, and C. Rother. Patchmatch stereo - stereo matching with slanted support windows. In Proc. of the British Machine Vision Conf. (BMVC), 2011. 3 [6] J. D. Bonet and P. Viola. Poxels: Probabilistic voxelized volume reconstruction. In Proc. of the IEEE International Conf. on Computer Vision (ICCV), 1999. 3 [7] A. Broadhurst, T. W. Drummond, and R. Cipolla. A probabilistic framework for space carving. In Proc. of the IEEE International Conf. on Computer Vision (ICCV), 2001. 3 [8] Z. Chen and H. Zhang. Learning implicit fields for generative shape modeling. Proceedings of IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2019. 1, 3 [9] J. Chibane, T. Alldieck, and G. Pons-Moll. Implicit functions in feature space for 3d shape reconstruction and completion. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020. 2, 3, 5 [10] J. M. Coughlan and A. L. Yuille. Manhattan world: Compass direction from a single image by bayesian inference. In Proc. of the IEEE International Conf. on Computer Vision (ICCV), 1999.
|
| 262 |
+
3 [11] B. Curless and M. Levoy. A volumetric method for building complex models from range images. In ACM Trans. on Graphics, 1996. 7, 8, 9 [12] A. Dai, A. X. Chang, M. Savva, M. Halber, T. Funkhouser, and M. Niessner. Scannet: Richlyannotated 3d reconstructions of indoor scenes. In Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2017. 3, 7 [13] S. Donne and A. Geiger. Learning non-volumetric depth fusion using successive reprojections. In Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2019. 3, 9 [14] A. Eftekhar, A. Sax, J. Malik, and A. Zamir. Omnidata: A scalable pipeline for making multi-task mid-level vision datasets from 3d scans. In Proc. of the IEEE International Conf. on Computer Vision (ICCV), 2021. 2, 3, 6, 10 [15] D. Eigen and R. Fergus. Predicting depth, surface normals and semantic labels with a common multi-scale convolutional architecture. In Proc. of the IEEE International Conf. on Computer Vision (ICCV), 2015. 2 [16] D. Eigen, C. Puhrsch, and R. Fergus. Depth map prediction from a single image using a multi-scale deep network. In Advances in Neural Information Processing Systems (NIPS), 2014.
|
| 263 |
+
2, 6 [17] A. Gropp, L. Yariv, N. Haim, M. Atzmon, and Y. Lipman. Implicit geometric regularization for learning shapes. In Proc. of the International Conf. on Machine learning (ICML), 2020. 6 [18] H. Guo, S. Peng, H. Lin, Q. Wang, G. Zhang, H. Bao, and X. Zhou. Neural 3d scene reconstruction with the manhattan-world assumption. In Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2022. 2, 3, 7, 8, 9 [19] S. Hadadan, S. Chen, and M. Zwicker. Neural radiosity. ACM Trans. Graph., 2021. 2, 3, 5 [20] W. Hartmann, S. Galliani, M. Havlena, L. Van Gool, and K. Schindler. Learned multi-patch similarity. In Proc. of the IEEE International Conf. on Computer Vision (ICCV), 2017. 3 [21] D. Hoiem, A. Efros, and M. Hebert. Putting objects in perspective. International Journal of Computer Vision (IJCV), 80:3–15, 2008. 2 [22] D. Hoiem, A. A. Efros, and M. Hebert. Automatic photo pop-up. ACM Trans. on Graphics,
|
| 264 |
+
2005. 2 [23] D. Hoiem, A. A. Efros, and M. Hebert. Geometric context from a single image. In Proc. of the IEEE International Conf. on Computer Vision (ICCV), 2005. 2
|
| 265 |
+
[24] D. Hoiem, A. A. Efros, and M. Hebert. Recovering surface layout from an image. International Journal of Computer Vision (IJCV), 75(1):151–172, October 2007. 2
|
| 266 |
+
[25] J. Huang, S.-S. Huang, H. Song, and S.-M. Hu. Di-fusion: Online implicit 3d reconstruction with deep priors. In Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2021. 2, 5
|
| 267 |
+
[26] P. Huang, K. Matzen, J. Kopf, N. Ahuja, and J. Huang. Deepmvs: Learning multi-view stereopsis. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2018. 3
|
| 268 |
+
[27] A. Jain, M. Tancik, and P. Abbeel. Putting nerf on a diet: Semantically consistent few-shot view synthesis. In Proc. of the IEEE International Conf. on Computer Vision (ICCV), 2021. 2, 3
|
| 269 |
+
[28] Y. Jiang, D. Ji, Z. Han, and M. Zwicker. Sdfdiff: Differentiable rendering of signed distance fields for 3d shape optimization. In Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2020. 2, 4
|
| 270 |
+
[29] D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. In Proc. of the International Conf. on Machine learning (ICML), 2015. 6
|
| 271 |
+
[30] A. Knapitsch, J. Park, Q.-Y. Zhou, and V. Koltun. Tanks and temples: Benchmarking large-scale scene reconstruction. ACM Trans. on Graphics, 36(4), 2017. 3, 7
|
| 272 |
+
[31] K. N. Kutulakos and S. M. Seitz. A theory of shape by space carving. International Journal of Computer Vision (IJCV), 38(3):199–218, 2000. 3
|
| 273 |
+
[32] V. Leroy, J. Franco, and E. Boyer. Shape reconstruction using volume sweeping and learned photoconsistency. In Proc. of the European Conf. on Computer Vision (ECCV), 2018. 3
|
| 274 |
+
[33] L. Liu, J. Gu, K. Z. Lin, T. Chua, and C. Theobalt. Neural sparse voxel fields. In Advances in Neural Information Processing Systems (NeurIPS), 2020. 2, 5
|
| 275 |
+
[34] S. Liu, Y. Zhang, S. Peng, B. Shi, M. Pollefeys, and Z. Cui. DIST: Rendering deep implicit signed distance function with differentiable sphere tracing. In Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2020. 3
|
| 276 |
+
[35] W. Luo, A. Schwing, and R. Urtasun. Efficient deep learning for stereo matching. In Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2016. 3
|
| 277 |
+
[36] J. N. Martel, D. B. Lindell, C. Z. Lin, E. R. Chan, M. Monteiro, and G. Wetzstein. Acorn: Adaptive coordinate networks for neural scene representation. In ACM Trans. on Graphics, 2021. 3
|
| 278 |
+
[37] L. Mescheder, M. Oechsle, M. Niemeyer, S. Nowozin, and A. Geiger. Occupancy networks: Learning 3d reconstruction in function space. In Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2019. 1, 3, 7
|
| 279 |
+
[38] B. Mildenhall, P. P. Srinivasan, M. Tancik, J. T. Barron, R. Ramamoorthi, and R. Ng. NeRF: Representing scenes as neural radiance fields for view synthesis. In Proc. of the European Conf. on Computer Vision (ECCV), 2020. 1, 3, 4, 5, 9, 10
|
| 280 |
+
[39] T. Müller, A. Evans, C. Schied, and A. Keller. Instant neural graphics primitives with a multiresolution hash encoding. ACM Trans. on Graphics, 2022. 2, 3, 5, 6, 7
|
| 281 |
+
[40] M. Niemeyer, J. T. Barron, B. Mildenhall, M. S. Sajjadi, A. Geiger, and N. Radwan. Regnerf: Regularizing neural radiance fields for view synthesis from sparse inputs. In Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2022. 2, 3, 7, 9
|
| 282 |
+
[41] M. Niemeyer, L. Mescheder, M. Oechsle, and A. Geiger. Occupancy flow: 4d reconstruction by learning particle dynamics. In Proc. of the IEEE International Conf. on Computer Vision (ICCV), 2019. 1
|
| 283 |
+
[42] M. Niemeyer, L. Mescheder, M. Oechsle, and A. Geiger. Differentiable volumetric rendering: Learning implicit 3d representations without 3d supervision. In Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2020. 3
|
| 284 |
+
[43] M. Oechsle, S. Peng, and A. Geiger. Unisurf: Unifying neural implicit surfaces and radiance fields for multi-view reconstruction. In Proc. of the IEEE International Conf. on Computer Vision (ICCV), 2021. 1, 2, 3, 5, 7, 9, 10
|
| 285 |
+
[44] J. J. Park, P. Florence, J. Straub, R. A. Newcombe, and S. Lovegrove. Deepsdf: Learning continuous signed distance functions for shape representation. In Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2019. 1, 3, 4
|
| 286 |
+
[45] D. Paschalidou, A. O. Ulusoy, C. Schmitt, L. van Gool, and A. Geiger. Raynet: Learning volumetric 3d reconstruction with ray potentials. In Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2018. 3
|
| 287 |
+
[46] A. Paszke, S. Gross, F. Massa, A. Lerer, J. Bradbury, G. Chanan, T. Killeen, Z. Lin, N. Gimelshein, L. Antiga, A. Desmaison, A. Kopf, E. Yang, Z. DeVito, M. Raison, A. Tejani, S. Chilamkurthy, B. Steiner, L. Fang, J. Bai, and S. Chintala. Pytorch: An imperative style, high-performance deep learning library. In Advances in Neural Information Processing Systems (NIPS), 2019. 6
|
| 288 |
+
[47] S. Peng, C. M. Jiang, Y. Liao, M. Niemeyer, M. Pollefeys, and A. Geiger. Shape as points: A differentiable poisson solver. In Advances in Neural Information Processing Systems (NeurIPS), 2021. 2, 7
|
| 289 |
+
[48] S. Peng, M. Niemeyer, L. Mescheder, M. Pollefeys, and A. Geiger. Convolutional occupancy networks. In Proc. of the European Conf. on Computer Vision (ECCV), 2020. 2, 3, 5, 7
|
| 290 |
+
[49] R. Ranftl, A. Bochkovskiy, and V. Koltun. Vision transformers for dense prediction. ArXiv preprint, 2021. 2
|
| 291 |
+
[50] R. Ranftl, K. Lasinger, D. Hafner, K. Schindler, and V. Koltun. Towards robust monocular depth estimation: Mixing datasets for zero-shot cross-dataset transfer. IEEE Trans. on Pattern Analysis and Machine Intelligence (PAMI), 2020. 2, 6
|
| 292 |
+
[51] G. Riegler, A. O. Ulusoy, H. Bischof, and A. Geiger. OctNetFusion: Learning depth fusion from data. In Proc. of the International Conf. on 3D Vision (3DV), 2017. 3
|
| 293 |
+
[52] B. Roessle, J. T. Barron, B. Mildenhall, P. P. Srinivasan, and M. Nießner. Dense depth priors for neural radiance fields from sparse input views. In Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2021. 3
|
| 294 |
+
[53] A. Saxena, S. H. Chung, and A. Y. Ng. Learning depth from single monocular images. In Advances in Neural Information Processing Systems (NIPS), 2006. 2
|
| 295 |
+
[54] A. Saxena, S. H. Chung, and A. Y. Ng. 3-D depth reconstruction from a single still image. International Journal of Computer Vision (IJCV), 76:53–69, 2008. 2
|
| 296 |
+
[55] A. Saxena, M. Sun, and A. Y. Ng. Make3D: learning 3D scene structure from a single still image. IEEE Trans. on Pattern Analysis and Machine Intelligence (PAMI), 31:824–840, 2009. 2
|
| 297 |
+
[56] J. L. Schönberger, E. Zheng, M. Pollefeys, and J.-M. Frahm. Pixelwise view selection for unstructured multi-view stereo. In Proc. of the European Conf. on Computer Vision (ECCV), 2016. 3, 7, 9
|
| 298 |
+
[57] J. L. Schönberger and J.-M. Frahm. Structure-from-motion revisited. In Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2016. 3
|
| 299 |
+
[58] S. Seitz and C. Dyer. Photorealistic scene reconstruction by voxel coloring. In Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 1997. 3
|
| 300 |
+
[59] S. M. Seitz, B. Curless, J. Diebel, D. Scharstein, and R. Szeliski. A comparison and evaluation of multi-view stereo reconstruction algorithms. In Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2006. 3
|
| 301 |
+
[60] V. Sitzmann, M. Zollhöfer, and G. Wetzstein. Scene representation networks: Continuous 3d-structure-aware neural scene representations. In Advances in Neural Information Processing Systems (NIPS), 2019. 1
|
| 302 |
+
[61] J. Straub, T. Whelan, L. Ma, Y. Chen, E. Wijmans, S. Green, J. J. Engel, R. Mur-Artal, C. Ren, S. Verma, A. Clarkson, M. Yan, B. Budge, Y. Yan, X. Pan, J. Yon, Y. Zou, K. Leon, N. Carter, J. Briales, T. Gillingham, E. Mueggler, L. Pesqueira, M. Savva, D. Batra, H. M. Strasdat, R. D. Nardi, M. Goesele, S. Lovegrove, and R. Newcombe. The Replica dataset: A digital replica of indoor spaces. arXiv.org, 1906.05797, 2019. 3, 7
|
| 303 |
+
[62] E. Sucar, S. Liu, J. Ortiz, and A. Davison. iMAP: Implicit mapping and positioning in real-time. In Proc. of the IEEE International Conf. on Computer Vision (ICCV), 2021.
|
| 304 |
+
[63] T. Takikawa, J. Litalien, K. Yin, K. Kreis, C. Loop, D. Nowrouzezahrai, A. Jacobson, M. McGuire, and S. Fidler. Neural geometric level of detail: Real-time rendering with implicit 3D shapes. In Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2021. 2, 3, 5
|
| 305 |
+
[64] M. Tancik, P. Srinivasan, B. Mildenhall, S. Fridovich-Keil, N. Raghavan, U. Singhal, R. Ramamoorthi, J. Barron, and R. Ng. Fourier features let networks learn high frequency functions in low dimensional domains. In Advances in Neural Information Processing Systems (NeurIPS), 2020. 4, 5
|
| 306 |
+
[65] S. Tulsiani, T. Zhou, A. A. Efros, and J. Malik. Multi-view supervision for single-view reconstruction via differentiable ray consistency. In Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2017. 3
|
| 307 |
+
[66] A. O. Ulusoy, A. Geiger, and M. J. Black. Towards probabilistic volumetric reconstruction using ray potentials. In Proc. of the International Conf. on 3D Vision (3DV), 2015. 3
|
| 308 |
+
[67] B. Ummenhofer, H. Zhou, J. Uhrig, N. Mayer, E. Ilg, A. Dosovitskiy, and T. Brox. Demon: Depth and motion network for learning monocular stereo. In Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2017. 3
|
| 309 |
+
[68] J. Wang, P. Wang, X. Long, C. Theobalt, T. Komura, L. Liu, and W. Wang. Neuris: Neural reconstruction of indoor scenes using normal priors. In ECCV, 2022. 3, 8, 9
|
| 310 |
+
[69] P. Wang, L. Liu, Y. Liu, C. Theobalt, T. Komura, and W. Wang. Neus: Learning neural implicit surfaces by volume rendering for multi-view reconstruction. In Advances in Neural Information Processing Systems (NeurIPS), 2021. 1, 2, 3, 5, 7, 9
|
| 311 |
+
[70] S. Wang, M. Mihajlovic, Q. Ma, A. Geiger, and S. Tang. Metaavatar: Learning animatable clothed human models from few depth images. In Advances in Neural Information Processing Systems (NeurIPS), 2021. 9, 10
|
| 312 |
+
[71] Y. Xie, T. Takikawa, S. Saito, O. Litany, S. Yan, N. Khan, F. Tombari, J. Tompkin, V. Sitzmann, and S. Sridhar. Neural fields in visual computing and beyond. In EUROGRAPHICS, 2022. 3
|
| 313 |
+
[72] Y. Yao, Z. Luo, S. Li, T. Fang, and L. Quan. Mvsnet: Depth inference for unstructured multi-view stereo. Proc. of the European Conf. on Computer Vision (ECCV), 2018. 3
|
| 314 |
+
[73] Y. Yao, Z. Luo, S. Li, T. Shen, T. Fang, and L. Quan. Recurrent mvsnet for high-resolution multiview stereo depth inference. Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2019. 3
|
| 315 |
+
[74] L. Yariv, J. Gu, Y. Kasten, and Y. Lipman. Volume rendering of neural implicit surfaces. In Advances in Neural Information Processing Systems (NeurIPS), 2021. 1, 2, 3, 5, 6, 7, 9, 10
|
| 316 |
+
[75] L. Yariv, Y. Kasten, D. Moran, M. Galun, M. Atzmon, B. Ronen, and Y. Lipman. Multiview neural surface reconstruction by disentangling geometry and appearance. In Advances in Neural Information Processing Systems (NIPS), 2020. 1, 2, 3, 5, 9
|
| 317 |
+
[76] A. Yu, V. Ye, M. Tancik, and A. Kanazawa. pixelNeRF: Neural radiance fields from one or few images. In Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2021. 7
|
| 318 |
+
[77] Z. Yu and S. Gao. Fast-mvsnet: Sparse-to-dense multi-view stereo with learned propagation and gauss-newton refinement. In CVPR, 2020. 3
|
| 319 |
+
[78] Z. Yu, J. Zheng, D. Lian, Z. Zhou, and S. Gao. Single-image piece-wise planar 3d reconstruction via associative embedding. In CVPR, pages 1029–1037, 2019. 10
|
| 320 |
+
[79] S. Zagoruyko and N. Komodakis. Learning to compare image patches via convolutional neural networks. In Proc. IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2015. 3
|
| 321 |
+
[80] K. Zhang, G. Riegler, N. Snavely, and V. Koltun. Nerf++: Analyzing and improving neural radiance fields. arXiv:2010.07492, 2020. 2
|
| 322 |
+
[81] X. Zhang, P. P. Srinivasan, B. Deng, P. Debevec, W. T. Freeman, and J. T. Barron. NeRFactor: Neural Factorization of Shape and Reflectance Under an Unknown Illumination. arXiv preprint arXiv:2106.01970, 2021. 2
|
| 323 |
+
[82] Z. Zhu, S. Peng, V. Larsson, W. Xu, H. Bao, Z. Cui, M. R. Oswald, and M. Pollefeys. Nice-slam: Neural implicit scalable encoding for slam. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022. 2, 3, 5, 7, 10
|
| 324 |
+
|
| 325 |
+
# Checklist
|
| 326 |
+
|
| 327 |
+
1. For all authors...
|
| 328 |
+
|
| 329 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 330 |
+
(b) Did you describe the limitations of your work? [Yes]
|
| 331 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] We discuss potential negative societal impacts in our supplementary material.
|
| 332 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 333 |
+
|
| 334 |
+
2. If you are including theoretical results...
|
| 335 |
+
|
| 336 |
+
(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]
|
| 337 |
+
|
| 338 |
+
3. If you ran experiments...
|
| 339 |
+
|
| 340 |
+
(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 and data are released.
|
| 341 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
|
| 342 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No]
|
| 343 |
+
(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 describe details of our computational resources in supplementary material.
|
| 344 |
+
|
| 345 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 346 |
+
|
| 347 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 348 |
+
(b) Did you mention the license of the assets? [N/A]
|
| 349 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
|
| 350 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 351 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 352 |
+
|
| 353 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 354 |
+
|
| 355 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 356 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 357 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/e2M4CNa-UOS/e2M4CNa-UOS.md
ADDED
|
@@ -0,0 +1,495 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Efficient Sequence Packing without Cross-contamination: Accelerating Large Language Models without Impacting Performance
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 Effective training of today’s large language models (LLMs) depends on large
|
| 11 |
+
2 batches and long sequences for throughput and accuracy. To handle variable-length
|
| 12 |
+
3 sequences on hardware accelerators, it is common practice to introduce padding
|
| 13 |
+
4 tokens, so that all sequences in a batch have the same length. We show in this paper
|
| 14 |
+
5 that the variation in sequence lengths in common NLP datasets is such that up to
|
| 15 |
+
6 $50 \%$ of all tokens can be padding. In less common, but not extreme, cases (e.g.
|
| 16 |
+
7 GLUE-cola with sequence length 128), the ratio is up to $89 \%$ . Existing methods
|
| 17 |
+
8 to address the resulting inefficiency are complicated by the need to avoid ‘cross
|
| 18 |
+
9 contamination’ in self-attention, by a reduction in accuracy when sequence ordering
|
| 19 |
+
10 information is lost, or by customized kernel implementations only valid for specific
|
| 20 |
+
11 accelerators. This paper introduces a new formalization of sequence packing in
|
| 21 |
+
12 the context of the well-studied bin packing problem, and presents new algorithms
|
| 22 |
+
13 based on this formulation which, for example, confer a $2 \mathbf { x }$ speedup for phase 2
|
| 23 |
+
14 pre-training in BERT. We show how existing models can be adapted to ensure
|
| 24 |
+
15 mathematical equivalence between the original and packed models, meaning that
|
| 25 |
+
16 packed models can be trained with existing pre-training and fine-tuning practices.
|
| 26 |
+
|
| 27 |
+
# 17 1 Introduction
|
| 28 |
+
|
| 29 |
+
18 Many language datasets, including the de-facto pre-training dataset for BERT—Wikipedia, have
|
| 30 |
+
19 a skewed distribution of sequence lengths (see Figure 1). However, typical machine learning
|
| 31 |
+
20 accelerators, and their corresponding libraries, exhibit poor performance when processing variable
|
| 32 |
+
21 length workloads. A simple mitigation is to set a maximum sequence length, and to pad shorter
|
| 33 |
+
22 sequences with padding tokens. This naive batching is widely used and provided in the vanilla BERT
|
| 34 |
+
23 implementation as well as the Hugging Face framework $| \dot { \overline { { { \vert 3 2 } \vert } } } |$ . Its effect is enhanced by the offline
|
| 35 |
+
24 dataset generation process which, in BERT, attempts to “pack” together sentences so as to fill the
|
| 36 |
+
25 sequence length as completely as possible $\pmb { \mathbb { B } } ] \mathbf { l }$ . We improve this process at a whole-dataset level.
|
| 37 |
+
26 We show that, even after this pre-processing, padding tokens represent $5 0 \%$ of all tokens of the
|
| 38 |
+
27 Wikipedia pre-training dataset at sequence length 512. Thus, by avoiding processing the padding
|
| 39 |
+
28 tokens one can get a $2 \mathbf { x }$ speed-up for phase 2. Overall, the lengths range between 5 tokens up to 512.
|
| 40 |
+
29 Samples of length 512 represent only $2 3 . 5 \%$ of the dataset,
|
| 41 |
+
30 Beyond the simple batching, other solutions have been addressed in the literature, and in open-source
|
| 42 |
+
31 software implementations. When processing sequences, most libraries and algorithms mention
|
| 43 |
+
32 packing as reference to concatenating sentences from the same document (BERT) or from different
|
| 44 |
+
33 documents (BERT, T5 $\pmb { \Vert 2 4 \Vert }$ , GPT-3 [4], and RoBERTa $\mathbb { I I } ^ { }$ ) as they arrive (GREEDY) from the
|
| 45 |
+
34 source dataset to generate the training dataset. None of the respective papers addresses the packing
|
| 46 |
+
35 efficiency, i.e., remaining fraction of padding. To “separate” sequences from different documents, a
|
| 47 |
+
36 separator token is introduced. However, this is not sufficient and can have a significant impact on
|
| 48 |
+
37 performance. This is discussed only in the RoBERTa paper which shows that downstream F1 scores
|
| 49 |
+
38 get consistently reduced on average by $0 . 3 5 \%$ . Alternative common approaches to overcome the large
|
| 50 |
+
39 amount of padding in many datasets are “un-padding” as in Effective Transformer $\pmb { \Vert 5 \Vert }$ and sorted
|
| 51 |
+
40 batching (SORT) as in Faster Transformer $\mathbb { \left| \mathbb { Z } \right\| }$ , lingvo $\overline { { \| 2 8 \| } }$ fairseq $\lVert 2 2 \rVert$ , and RoBERTa. However, for
|
| 52 |
+
41 running efficiently on arbitrary accelerators, these approaches require substantial hardware-specific
|
| 53 |
+
42 low-level code optimizations only available on GPUs. Further details are in Sections C [1] and 4.4.
|
| 54 |
+
43 Beyond language models, packing has been also present in other areas of machine learning, however
|
| 55 |
+
44 with little to no exploration in the literature and mostly hidden in some libraries without any further
|
| 56 |
+
45 discussion. For example, PyG (PyTorch Geometric) combines multiple small graphs in a batch to
|
| 57 |
+
46 account for the large variation in size and to optimize the hardware usage when training a Graph
|
| 58 |
+
47 Neural Network (GNN). Another example is the RNN implementation in PyTorch which introduces a
|
| 59 |
+
48 “PackedSequence” object and states that “All RNN modules accept packed sequences as inputs” but
|
| 60 |
+
49 does not address how sequences are packed efficiently and how the processing of packed sequences
|
| 61 |
+
50 is implemented in an efficient manner while avoiding interaction between sequences. Even though
|
| 62 |
+
51 we focus on BERT [6] and other transformers in this paper, the general principles can be transferred
|
| 63 |
+
52 to many more machine learning algorithms with differently sized data samples.
|
| 64 |
+
|
| 65 |
+
In this paper, we formally frame the packing problem in transformer based models, and provide some solutions, showing that sequences can be packed efficiently, separator tokens are not required, and cross-contamination can be avoided with little overhead.
|
| 66 |
+
|
| 67 |
+
56 In summary, the contributions of the paper are as follows. In Section 2, we produce histograms of a
|
| 68 |
+
57 variety of datasets showing the high percentage of padding tokens. In Section $\boxed { 3 . 1 }$ we present two new
|
| 69 |
+
58 deterministic and efficient packing algorithms based on established solvers which efficiently pack
|
| 70 |
+
59 datasets with millions of sequences in a matter of seconds (or less). In Section $3 . 2$ and Section ${ \dot { \overline { { | 3 . 3 | } } } } ,$ we
|
| 71 |
+
60 describe ‘cross-contamination’ —the cause of the accuracy reduction which separator tokens do not
|
| 72 |
+
61 mitigate— and show how the BERT model can be adjusted to show the same convergence behavior
|
| 73 |
+
62 on packed and unpacked sequences. We empirically show that the proposed packing algorithms
|
| 74 |
+
63 produce a nearly-optimal packing scheme for Wikipedia pre-training dataset (Section $\bar { 4 . 1 ) }$ and more
|
| 75 |
+
64 in the Appendix. In Section $4 . 2 ,$ we demonstrate that the convergence of the BERT large model on
|
| 76 |
+
65 the packed dataset is equivalent to that on the un-packed dataset with $2 \mathbf { x }$ throughput increase on the
|
| 77 |
+
66 Wikipedia sequence length 512 pre-training dataset. Further experiments underline the necessity and
|
| 78 |
+
67 efficiency of our changes.
|
| 79 |
+
|
| 80 |
+
# 68 2 Sequence length distributions
|
| 81 |
+
|
| 82 |
+

|
| 83 |
+
Figure 1: Sequence length distributions for different datasets. The three graphics at the top left show Wikipedia BERT pre-training dataset sequence length histograms (token count excluding padding) for different maximum sequence lengths based on the Wikipedia article dump from October 1st 2020. The theoretical speed-up relates to not using any padding tokens and not having any overhead from processing the different lengths. Top right: GLUE datasets. Bottom from left to right: SQuAD 1.1, LibriSpeech text labels, LibriSpeech audio token sequence, and QM9 molecules of a graph in a sequence.
|
| 84 |
+
|
| 85 |
+
69 BERT is pre-trained using masked-language modelling and next-sentence prediction on a large
|
| 86 |
+
70 corpus of Wikipedia articles. Each sequence is composed of one ${ \mathrm { < C L S > } }$ token followed by the
|
| 87 |
+
71 first “segment” of sentences, followed by a ${ \mathrm { - S E P } } { \mathrm { > } }$ token, and then finally the second “segment” of
|
| 88 |
+
72 sentences. Because these “segments” are created in sentence-level increments there is no token-level
|
| 89 |
+
73 control of sequence length. Furthermore $1 0 \%$ (default value, $\mathbb { I I }$ ) of sequences are intentionally
|
| 90 |
+
74 cut short. This leads to significant levels of padding, especially for longer maximum sequence
|
| 91 |
+
75 lengths (see Figure $\mathbb { L }$ and Section $\mathbf { J } \mathbb { \equiv } \mathbb { I } ^ { }$ ). At sequence length 128 (commonly used in phase 1 of
|
| 92 |
+
76 pre-training) the theoretical speed-up is around 1.2, at sequence length 384 this increases to 1.7, and
|
| 93 |
+
77 finally at sequence length 512 (commonly used for phase 2 of pre-training) it is 2.0. Despite the
|
| 94 |
+
78 widespread use of the Wikipedia dataset for pre-training BERT such histograms have, to the best
|
| 95 |
+
79 of our knowledge, not been published previously. This has perhaps lead to the underestimation of
|
| 96 |
+
80 the speed-up opportunity available. To put things into perspective, the sequence length 512 dataset
|
| 97 |
+
81 contains 8.33 billion tokens, of which 4.17 billion are padding tokens.
|
| 98 |
+
82 Note that the skewed sequence length distributions are neither limited to Wikipedia, as shown with
|
| 99 |
+
83 GLUE [30, 31] from Section $\mathbf { L } \mathbb { \mathbb { \mathbf { \Pi } } }$ and SQuAD 1.1 $\pmb { \left. 2 5 \right. }$ from Section $\mathbb { K } \mathbb { 1 } \mathbb { 1 }$ $2 . 2 x$ speed up), to BERT
|
| 100 |
+
84 training, as shown with LibiSpeech text distributions $\mathbb { \left| \mathbb { Z } 3 \right| }$ from Section $\mathbf { M } \mathbb { I } \mathbb { I }$ , nor to text itself,
|
| 101 |
+
85 given the LibriSpeech audio data distributions, and the QM9 molecular data $\overline { { \mathbb { B } 2 7 } } , \overline { { \sf 2 6 } } ]$ ( $1 . 6 x$ speed-up,
|
| 102 |
+
86 Section $\mathbb { Q } \mathbb { \mathbb { 1 } \mathbb { 1 } } )$ ). All distributions can be found in Figure $\bigstar$ Since LibriSpeech audio data is skewed to
|
| 103 |
+
87 longer sequences, only $1 . 3 x$ speed-up could be achieved despite the theoretical maximum of $1 . 6 x$
|
| 104 |
+
88 For all other cases, the algorithms presented in Section $3 . 1$ lead to close to optimal packing.
|
| 105 |
+
|
| 106 |
+
# 89 3 Methods
|
| 107 |
+
|
| 108 |
+
90 Our approach consists of three distinct components. Firstly, we pack the $n$ data samples efficiently
|
| 109 |
+
91 during pre-processing to make full use of the maximum sequence length, $s _ { m }$ (Sections $3 . 1$ and $\dot { \mathbb { E } } \dot { ) }$
|
| 110 |
+
92 Secondly, we introduce a series of model changes in Section $3 . 2$ that preserve the equivalence with
|
| 111 |
+
93 the original BERT implementation. The changes include a self-attention mask to prevent the model
|
| 112 |
+
94 from attending between different sequences in the same pack (Section $3 . 2 . 2 )$ and an adjustment
|
| 113 |
+
95 of the the positional embeddings (Section $3 . 2 . 1 )$ to handle packs of sequences. Other components
|
| 114 |
+
96 of the model, such as the feed-forward layer $\pmb { \mathbb { Z } } 9 \|$ , operate on a per-token basis and do not require
|
| 115 |
+
97 modification for pre-training. In Section $3 . 2 . 3 ,$ we also demonstrate how to compute a per-sequence
|
| 116 |
+
98 loss and accuracy for NSP and downstream fine-tuning tasks. Thirdly, we provide suggestions for
|
| 117 |
+
99 hyperparameter adjustment (Section $\textcircled { 3 . 3 }$ that lead to analogous convergence behavior between the
|
| 118 |
+
100 packed and un-packed BERT implementations. Additional videos and animations are provided as
|
| 119 |
+
101 supplemental material.
|
| 120 |
+
|
| 121 |
+
# 3.1 Packing algorithms
|
| 122 |
+
|
| 123 |
+
3 The widely studied and well established bin packing problem deals with the assignment of items into bins of a fixed capacity such that the number of utilized bins is minimized. It has been known for decades if not centuries. Since an exact solution is strongly NP-complete $\pmb { \mathbb { I } }$ , numerous approximate solutions have been proposed [12, 15, 13, 36]. Since most existing approximations have a high complexity of at least $O ( n \log n )$ , we propose two new heuristic offline algorithms that are tailored to the NLP setting applied to the whole dataset. For a detailed introduction to packing see Section F.
|
| 124 |
+
|
| 125 |
+
# 3.1.1 Shortest-pack-first histogram-packing (SPFHP)
|
| 126 |
+
|
| 127 |
+
Shortest-pack-first histogram-packing (SPFHP) works on the bins in the sequence length histogram (with bin size 1) rather than the individual samples. The histogram is traversed in sorted order from longest to shortest sequences. Then, to pack the data during the traversal, we apply the worst-fit algorithm $[ 1 2 , 1 3 6 ]$ such that the histogram bin being processed goes to the “pack”1 that has the most space remaining (“shortest-pack-first”). If the histogram bin does not fit completely, a new pack is created. We also limit the packing depth, in other words the maximum number of sequences that are allowed in a pack. Therefore, an existing pack is only extended if it is not already at maximum packing depth. The detailed code for the algorithm is provided in Listing $\textcircled { 3 }$ The time and space complexity of the algorithm are $O ( n + s _ { m } ^ { 2 } )$ and $O ( s _ { m } ^ { 2 } )$ (Section G.2[1] ).
|
| 128 |
+
|
| 129 |
+
120 The proposed NNLSHP algorithm is based on re-stating the packing problem as a (weighted) non
|
| 130 |
+
121 negative least squares problem (NNLS) $\mathbb { \left[ 3 \right] }$ of the form $w A x = w b$ where $x \geq 0$ . The vector $b$ is the
|
| 131 |
+
122 histogram containing the counts of all the sequence lengths in the dataset. Next, we define the $A$
|
| 132 |
+
123 matrix (the “packing matrix“) by first generating a list of all possible sequence length combinations
|
| 133 |
+
124 (“strategies”) that add up exactly to the maximum sequence length. We focus specifically on strategies
|
| 134 |
+
125 that consist of at most 3 sequences per pack (independent of $b$ ) and encode each strategy as a column
|
| 135 |
+
126 of the sparse matrix $A$ . For example, a strategy consisting of the sequence length 128, 128, and
|
| 136 |
+
127 256 in represented a column vector that has the value 2 at the 128th row, the value 1 at the 256th
|
| 137 |
+
128 row, and zero at all other rows. The variable $x$ describes the non-negative repetition count for each
|
| 138 |
+
129 strategy. So a 24 in the ith row of $x$ means that the strategy represented by the ith column of $A$ should
|
| 139 |
+
130 repeat 24 times. Moreover, in the un-weighted setting, $A x = b$ states that we would like to “mix” the
|
| 140 |
+
131 pre-defined strategies (columns of $A$ ) such that the number of samples matches the histogram $b$ , and
|
| 141 |
+
132 where each strategy is used $x \geq 0$ times. We use the residual weight $w$ to control the penalization
|
| 142 |
+
133 of the $A x - b$ residual on different sequence lengths (different rows of $b$ ). Heuristically, we set
|
| 143 |
+
134 the weight of 0.09 for all sequences of length 8 or smaller because they are considered acceptable
|
| 144 |
+
135 padding sequences while all other sequence lengths get weight 1. We discuss this heuristic choice of
|
| 145 |
+
136 parameters in Section F.4.5 and $\operatorname { F } . 5 { \widehat { \bigcirc } }$ . The overall efficiency of the packing is not greatly influenced
|
| 146 |
+
137 by the weighing (less than $1 \%$ extra speed-up).
|
| 147 |
+
138 After solving $w A x = w b$ for $x \geq 0$ using an off-the-shelf solver, we obtain a floating point solution,
|
| 148 |
+
139 which means that the repetition counts are not necessarily integers. Since we cannot use a non-natural
|
| 149 |
+
140 number of strategies, we round the solution $\hat { x }$ to the nearest integer. The error introduced by this
|
| 150 |
+
141 rounding is found to be negligible (a few hundred sequences in the worst case) compared to the size
|
| 151 |
+
142 of the dataset (millions of sequences). The time complexity and space complexity of the algorithm
|
| 152 |
+
143 are $O ( n + s _ { m } ^ { 5 } )$ and $O ( s _ { m } ^ { 3 } )$ . Further details are provided in Section F.4.
|
| 153 |
+
|
| 154 |
+
# 3.2 packedBERT: model changes
|
| 155 |
+
|
| 156 |
+
145 This section describes how any vanilla BERT implementation should be modified for packed sequence
|
| 157 |
+
146 processing, such that the behavior of the model is the same as when processing unpacked sequences.
|
| 158 |
+
147 Preserving the mathematical equivalence is necessary to ensure existing BERT pre-training and
|
| 159 |
+
148 fine-tuning practices remain valid, as well as being required by benchmarks such as MLPerf™ [17].
|
| 160 |
+
149 The presented approaches and principles apply to a variety of other models.
|
| 161 |
+
|
| 162 |
+
# 3.2.1 Adjust positional embeddings
|
| 163 |
+
|
| 164 |
+
The BERT model uses three types of embeddings: token, segment, and positional embeddings. The latter is canonically implemented as a bias add operation, rather than a full embedding look-up. This is possible because the positional indices increase linearly for every sequence. However, when using the packed data format the position index needs to be reset with each new packed sequence. For instance, when packing two sequences one of length 2 and one of length 3, the positional embedding indexes that need to be picked up are $[ 0 , 1 , 0 , 1 , 2 ]$ . To achieve this, the bias add needs to be replaced by an embedding look-up to extract the correct positional embedding for each token in the pack. This also requires keeping an extra input which specifies the position of each token in its sequence. This required adjustment has only a minor impact on absolute accuracy/loss (see Section 4.2 and 4.2.1).
|
| 165 |
+
|
| 166 |
+
# 160 3.2.2 Adjust attention masking
|
| 167 |
+
|
| 168 |
+

|
| 169 |
+
|
| 170 |
+
Figure 2: Attention mask code [left], respective zero-one mask [middle], and vectorized unpacking of the sequence loss[right]. White rectangles correspond to padding.
|
| 171 |
+
|
| 172 |
+
161 To maintain an implementation that is consistent with the un-packed version, tokens from different
|
| 173 |
+
162 sequences within a pack should not be able to attend to each other. This is typically achieved in
|
| 174 |
+
163 other implementations by unpacking the sequences using custom attention kernels and then doing
|
| 175 |
+
164 the attention per-sequence $\pmb { \bar { \bar { \bar { \bar { \lambda } } } } }$ . Instead, we propose directly masking the attention matrix with a
|
| 176 |
+
165 block-diagonal mask before the attention softmax. This is straightforward to implement in modern
|
| 177 |
+
166 frameworks (see Figure $\textcircled{2}$ . Naturally, there is a cost to both the mask construction and applying
|
| 178 |
+
167 it to the attention matrix. However, it is required to keep the accuracy (see Table $^ { 1 , }$ Section 4.1,
|
| 179 |
+
168 Section $\boxed { 4 . 2 }$ . See also the code of the deprecated tensor2tensor library and our own provided code.
|
| 180 |
+
|
| 181 |
+
# 169 3.2.3 Adjust per-sequence loss and accuracy
|
| 182 |
+
|
| 183 |
+
170 Canonical implementations of BERT compute the cross-entropy loss for the masked language model
|
| 184 |
+
171 on a per-token basis. However other NLP tasks, such as SQuAD, compute the loss and accuracy on
|
| 185 |
+
172 a per-sequence basis. This section discusses how to handle such tasks when training with packed
|
| 186 |
+
173 sequences. Simply feeding packs of sequences to the same implementation of cross-entropy would
|
| 187 |
+
174 result in a per-pack weighted loss. In other words, the overall loss on the micro-batch would sum-up
|
| 188 |
+
175 the losses on the individual packs, rather than individual sequences. As a result, the model would
|
| 189 |
+
176 converge to a different optimum than when running with the un-packed implementation. For instance,
|
| 190 |
+
177 a pack of a single sequence would contribute to the loss with the same weight as a pack of three
|
| 191 |
+
178 sequences.
|
| 192 |
+
179 To recover the per-sequence averaging behavior of the canonical un-packed BERT implementation,
|
| 193 |
+
180 we effectively “unpack” the incoming logits and labels. Once the sequences have been unpacked,
|
| 194 |
+
181 we can compute the loss on each sequence separately as usual and then add up the losses. However,
|
| 195 |
+
182 rather than looping through the sequences index, we compute on all indexes in parallel (see Figure 2).
|
| 196 |
+
183 This minimizes the latency overhead of un-packing the loss calculation. As an example, we show how
|
| 197 |
+
184 per-sequence loss can be implemented for the pre-training task. We use the “masked lm weight” [7]
|
| 198 |
+
185 input tensor to represent which sequence a given masked token belongs to (0, 1, 2 and so on). This
|
| 199 |
+
186 is consistent with the canonical BERT implementation where this input takes a value of either 1
|
| 200 |
+
187 (belonging to the sequence) or 0 (belonging to padding). The full methodology is detailed in Listing 5
|
| 201 |
+
188 and can be applied to other classification or pre-training tasks.
|
| 202 |
+
|
| 203 |
+
# 189 3.3 Adjust hyperparameters
|
| 204 |
+
|
| 205 |
+
190 In terms of convergence behavior, the primary consequence of packing is an increase in the effective
|
| 206 |
+
191 batch size (with respect to number of sequences and real tokens) with some added variation over
|
| 207 |
+
192 different iterations. If we look on the sentence level, the number of sentences in one batch increases
|
| 208 |
+
193 by the packing factor. Similarly, the number of tokens in one batch increases. Hence, hyperparameters
|
| 209 |
+
194 that are sensitive to these numbers need to be adjusted.
|
| 210 |
+
195 A direct solution is to reduce the computational batch size by the packing factor (average number of
|
| 211 |
+
196 sequences per pack) and keep all other hyperparameters the same. For example, if the packing factor
|
| 212 |
+
197 is 2, cutting the gradient accumulation count by half is sufficient. The advantage of this strategy is that
|
| 213 |
+
198 no fine-tuning of hyperparameters is required and performance curves are comparable. However, this
|
| 214 |
+
199 approach might be not desirable as it might imply under-utilizing the memory/compute, especially if
|
| 215 |
+
200 the micro batch size needs to be reduced.
|
| 216 |
+
201 Hence to preserve batch size and optimize hardware utilization, we additionally propose an approxi
|
| 217 |
+
202 mate heuristic for updating the decay parameters of the LAMB optimizer $\boldsymbol { \left[ \left[ 3 5 \right] \right] }$ . For a packed dataset
|
| 218 |
+
203 with a packing factor $p$ , we update the decay parameters as: $\beta _ { 1 } : = \beta _ { 1 } ^ { p }$ , $\beta _ { 2 } : = \beta _ { 2 } ^ { p }$ . For $p = 2$ , this
|
| 219 |
+
204 corresponds to the exact parameters for calculating momentum and velocity, when updating with the
|
| 220 |
+
205 same gradient twice (Section $\bigstar \bigstar$ . A common approach is to scale the learning rate with the batch size.
|
| 221 |
+
206 However, our experiments in Section $\boxed { 4 . 2 }$ show that this reduces convergence speed.
|
| 222 |
+
207 Since these adjustments are only heuristics the convergence of the model will be comparable but not
|
| 223 |
+
208 identical. In particular, it is unlikely that simply adjusting the hyperparameters will fully undo the
|
| 224 |
+
209 impact of the increased batch size. However, with these adjustments, researchers should be able to
|
| 225 |
+
210 continue to use existing configurations.
|
| 226 |
+
|
| 227 |
+
# 211 4 Experiments
|
| 228 |
+
|
| 229 |
+
# 4.1 Bin packing algorithm comparison
|
| 230 |
+
|
| 231 |
+
We evaluate our algorithms using the following metrics: number of packs, number of all tokens, number of padding tokens, solution time of the packing algorithm (after histogram and strategy creation), number of strategies used, packing efficiency (the fraction of non-padding tokens in the packed dataset), the speed-up achieved compared to not packing (depth 1), and the average number of sequences per sample (packing factor). For SPFHP, we analyse different (maximum) packing depth, since packing is less efficient with smaller depth and we want to get a general understanding on how the packing depth influences the processing time. For NNLSHP, we focus on packing depth 3 because it packs the data sufficiently well. For the speed-up analysis, we focus on the intelligence processing unit (IPU) [11] (IPU-M2000, 16 accelerator chips), BERT phase 2 pretraining setup as in Section $\bar { 4 . 2 } .$ A GPU dynamically loads the code into the accelerator; in contrast, the IPU works with a static pre-compiled engine that gets loaded onto the chip at the start of the run. While other approaches result in excessive padding or continuous changes of the code, our approach can work with the same code for the whole dataset. So in this setting the IPU architecture would especially benefit from our approach since it avoids code changes. Nevertheless, it can be applied to any implementation on GPU or TPU. For determining the speed-up, we take advantage of the precompiled kernel. Since time measurements are quite noisy, we can profile the kernel and how many cycles it takes for processing a batch. That way, we can determine the overhead (in cycles) from processing the additional attention masking and for unpacking the loss. Combining overhead and packing factor, we get the speed-up estimate. No experiment repetitions are required since the algorithms and measurements are deterministic.
|
| 232 |
+
|
| 233 |
+
Table 1: Key performance results of proposed packing algorithms (SPFHP and NNLSHP) on IPU.
|
| 234 |
+
|
| 235 |
+
<table><tr><td>pack. depth</td><td>packing algorithm</td><td>EFF (%)</td><td>p</td><td>OH (%)</td><td>realized speed-up</td></tr><tr><td>1</td><td>NONE</td><td>50.0</td><td>1.00</td><td>0.000</td><td>1.000</td></tr><tr><td>1</td><td>SORT</td><td>99.9</td><td>2.00</td><td>>100</td><td><1.000</td></tr><tr><td>~10</td><td>GREEDY</td><td>~78</td><td>≈1.6</td><td>~4.48</td><td>~1.5</td></tr><tr><td>2</td><td>SPFHP</td><td>80.5</td><td>1.61</td><td>4.283</td><td>1.544</td></tr><tr><td>3</td><td>SPFHP</td><td>89.4</td><td>1.79</td><td>4.287</td><td>1.716</td></tr><tr><td>3</td><td>NNLSHP</td><td>99.7</td><td>2.00</td><td>4.287</td><td>1.913</td></tr><tr><td>4</td><td>SPFHP</td><td>93.9</td><td>1.88</td><td>4.294</td><td>1.803</td></tr><tr><td>8</td><td>SPFHP</td><td>98.9</td><td>1.98</td><td>4.481</td><td>1.895</td></tr><tr><td>max</td><td>SPFHP</td><td>99.6</td><td>1.99</td><td>4.477</td><td>1.905</td></tr></table>
|
| 236 |
+
|
| 237 |
+
Packing depth describes the maximum number of packed sequences. NONE is the baseline BERT implementation, whereas SORT corresponds to sorted batching, and GREEDY concatenates sequences as they arrive until they would exceed 512 tokens. Setting no limit resulted in a maximum packing depth of 16. EFFiciency is the percentage of real tokens in the packed dataset. The packing factor describes the resulting potential speed-up compared to packing depth 1. With overhead (OH), we denote the percentage decrease in throughput due to changes to the model to enable packing (such as the masking scheme introduced in Section $\boxed { 3 . 2 . 2 }$ . The realized speed-up is the combination of the speed-up due to packing (the packing factor) and the decrease in throughput due to the overhead on the IPU. It is used to measure the relative speed-up in throughput and the overhead from masking and loss adjustment. SORT can be only efficient on GPUs (see Section $4 . 4 )$ .
|
| 238 |
+
|
| 239 |
+
233 The main results for the performance metric evaluation are displayed in Table $\nsupseteq$ The processing
|
| 240 |
+
234 time for SPFHP on an Intel(R) Xeon(R) Gold 6138 CPU with 2.00GHz, 80 nodes, and 472G RAM
|
| 241 |
+
235 was around $0 . 0 3 s$ and independent from the packing depth. Classical First-Fit-Decreasing requires
|
| 242 |
+
236 87-120s, a lot of memory, and scales almost linear with the number of samples. We see that the
|
| 243 |
+
237 overhead slightly increases with packing depth but that the benefits of packing outweigh the cost. The
|
| 244 |
+
238 best speed-up is obtained with NNLSHP at depth 3 which required $2 8 . 4 s$ on the CPU for processing
|
| 245 |
+
239 and ran out of memory for larger depth. With a value of 1.913, it is close to the theoretical upper
|
| 246 |
+
240 bound of 2.001. The results show that efficiency, packing factor, and speed-up can be viewed inter
|
| 247 |
+
241 changeably. The amount of time needed to process a sample (a pack of sequences) is barely changed
|
| 248 |
+
242 relative to the un-packed implementation. The packing factor, or the improvement in efficiency,
|
| 249 |
+
243 effectively provide an accurate estimate of the speed-up. GREEDY packing as used in T5 shows
|
| 250 |
+
244 to be quite inefficient and sorted batching (SORT) is highly efficient in avoiding padding but the
|
| 251 |
+
245 resulting different computational graphs cause a major overhead on the IPU that exceeds the benefits
|
| 252 |
+
246 of avoiding the padding. Since we made our algorithm and code public available, results have been
|
| 253 |
+
247 reproduced with a different framework on the Habana Gaudi accelerator $\mathbb { m }$ and confirmed that our
|
| 254 |
+
248 approach is hardware and software independent giving it a huge advantage over existing approaches.
|
| 255 |
+
|
| 256 |
+
# 4.2 MLPerf™ phase 2 pretraining setup: learning curves and hyperparameter adjustment
|
| 257 |
+
|
| 258 |
+
For depth 1 (classic BERT) and NNLSHP with depth 3, we additionally evaluate on the MLPerf™ version 0.7 BERT pre-training benchmark $\mathbb { \equiv } \mathbb { \ln { \frac { } { } } }$ . Briefly, this involves training from a standard checkpoint to a masked-language model accuracy of $7 1 . 2 \%$ using 3 million sequences with a maximum length of 512 tokens (refer to $\mathbb { \lVert 1 9 \rVert }$ for details). Following this standardized benchmark supports reproduction of results even on other systems and makes sure that the reproduction effort is moderate and setup rules are clearly documented. We compare the resulting speed-up as well as the respective learning curves by evaluating the data on a held-out validation dataset. The objective of this additional evaluation is to analyse if convergence behavior is changed by the packing strategy and if the theoretical speed-up can be achieved in practice.
|
| 259 |
+
|
| 260 |
+
259 With packing, we effectively increase the average batch size by the packing factor $( \approx 2 )$ . However,
|
| 261 |
+
260 with a different batch size, different hyperparameters are required (see Section $\textcircled { 3 . 3 }$ and there is no
|
| 262 |
+
261 mapping that will generate exact matching of results but only heuristics. In a first comparison, we
|
| 263 |
+
262 use the same hyperparameters when comparing packed and unpacked training except for cutting the
|
| 264 |
+
263 accumulation count by half. This way, we make sure that the batch size is constant on average and
|
| 265 |
+
264 we have the same amount of training steps. In the second comparison, we evaluate our heuristics and
|
| 266 |
+
265 how they compensate the difference in batch size. This setup is more desirable because it is beneficial
|
| 267 |
+
266 to use the hardware to its full potential and cutting the batch size by half usually reduces throughput.
|
| 268 |
+
267 In the third comparison, we compare two optimized setups. In these two cases, packing takes half the
|
| 269 |
+
268 amount of training steps.
|
| 270 |
+
|
| 271 |
+
The learning curves are displayed in Figure 3. In the first setup, we see the curves almost matching perfectly when normalizing by the numbers of samples processed. Differences can be explained by the variation of the number of sequences in the packing batch, and general noise in the training process. Especially after the initial phase, the curves show a near-identical match. The second setup shows bigger differences since changing the batch size and hyperparameters changes the training dynamics. We observe slower convergence early on in training due to the increased batch size. This is expected. The adjustment of the learning rate actually decreases performance probably because we correct for the increased number of sequences already in the modified loss. With the adjustment of the decay parameter of LAMB, we see matching performance at the later training stages. However, it is not feasible to completely recover the early convergence behavior of the smaller batch size by adjusting the hyperparameters. For instance doubling the batch size of unpacked BERT to 3000 and adjusting the LAMB decay parameters leads to more of a slow down in convergence than when running packed BERT with a batch size of 1500 and a packing factor of 2. n practice, our implementations exceeds the estimated 1.913 maximum speed-up. This estimate is based on the reduction in the computational work needed to process the dataset. However, packing the data also reduces the latency of the transferring the data to the device. Figure $3$ shows that the realized total speed-up from packing exceeds $2 x$ .
|
| 272 |
+
|
| 273 |
+
# 4.2.1 Ablation study
|
| 274 |
+
|
| 275 |
+
So far, we have shown that with the introduced adjustments, we can match the accuracy of unpacked BERT. In the following, we analyze in how far the masking adjustment is required. In Figure $\mathbb { G } ,$ w e can see that without our adjustments, training loss and accuracy worsen drastically and a longer training time does not lead to a recovery. When not adjusting the positional embedding, the loss and accuracy almost match. However, the accuracy stalls at $7 1 . 8 \%$ and does not reach the target accuracy of $7 2 . 1 \%$ . So overall, both adjustments are crucial to avoid a reduction in performance.
|
| 276 |
+
|
| 277 |
+
When running packed BERT without the NSP loss but keeping everything else the same in a full training setup, we observed that downstream performance on SQuAD reduced the F1 measure by $1 . 3 1 \%$ and EM by $1 . 1 5 \%$ . Hence, we do not consider removing NSP as done in approaches like RoBERTa and T5 as discussed in Section $\mathbb { I }$
|
| 278 |
+
|
| 279 |
+

|
| 280 |
+
Figure 3: Comparison of learning curves for packed and unpacked processing, where all experiments converged to the target accuracy within the same number of training samples(3 million). [left] same effective batch size (ebs is batch size times packing factor), [middle] different heuristic adjustments of the hyperparameters (batch size 1500 for all runs, such that ebs for packed runs is $1 5 0 0 * 2 ,$ , and [right] realized speed-up from packing (in excess of desired $2 \mathbf { x }$ ). Further learning curves are provided in Section O.
|
| 281 |
+
|
| 282 |
+

|
| 283 |
+
Figure 4: Comparison of learning curves with and without mask or positional embedding adjustment in our packed BERT approach. The grey accuracy baseline to reach is $7 2 . 1 \%$ .
|
| 284 |
+
|
| 285 |
+
# 297 4.3 Full pretraining and SQuAD finetuning
|
| 286 |
+
|
| 287 |
+
298
|
| 288 |
+
299
|
| 289 |
+
300
|
| 290 |
+
301
|
| 291 |
+
302
|
| 292 |
+
303
|
| 293 |
+
304
|
| 294 |
+
305
|
| 295 |
+
306
|
| 296 |
+
307
|
| 297 |
+
308
|
| 298 |
+
309
|
| 299 |
+
310
|
| 300 |
+
311
|
| 301 |
+
312
|
| 302 |
+
313
|
| 303 |
+
314
|
| 304 |
+
315
|
| 305 |
+
316
|
| 306 |
+
|
| 307 |
+
Packing slightly violates the i.i.d. assumption of data. Thus, we have to check that downstream performance is not impacted by packing. This is especially relevant in a full training setup without a starting checkpoint. To this aim, we show that the packed and unpacked SQuAD 1.1 scores are comparable after a full-pretraining of BERT base and large plus fine-tuning. During pre-training, in order to avoid giving an advantage to packing by further hyperparameter tuning, we reduce the gradient accumulation count for the packed BERT training for phase 1 and phase 2 to match, on average, the total number of sequences that get processed before each weight update. With this approach, we can use the same hyperparameters and number of training steps but process each batch faster by avoiding the processing of padding. This gives a slight disadvantage to the packed run in terms of machine utilization, as explained in Section $3 . 3$ and is different to the speedup analysis in Section $4 . 2 .$ For Phase 2, we use sequence length 384 since longer range attention is not relevant for SQuAD 1.1. The respective speed-ups from packing for BERT base and large are shown in Table $2 { : }$ the realized speed-up, measured as the quotient of the throughputs between the packed and unpacked runs, is slightly lower to the theoretical throughput (i.e. the packing factor) due to the packing overhead. Further learning curves with the loss function and accuracy are provided in Section $\mathrm { \bf P }$ For the fine-tuning training on SQuAD 1.1, we do not use packing. The scores, computed as the median of 10 different seeds, are displayed in Table $\textcircled{3}$ They are comparable to the reference ones in $\pmb { \Vert 6 \Vert }$ : for BERT base (resp. large) the F1 score is reduced by $0 . 2 \%$ (resp. $0 . 3 \%$ ) and the EM score increases by $0 . 3 \%$ (resp. $0 . 0 2 \%$ ).
|
| 308 |
+
|
| 309 |
+
Table 2: Measured speed-ups in BERT pretraining with packing.
|
| 310 |
+
|
| 311 |
+
<table><tr><td>Model size</td><td>Sequence length</td><td>Packing factor</td><td>Realized speed-up</td></tr><tr><td rowspan="2">base</td><td>128</td><td>1.17</td><td>1.15</td></tr><tr><td>384</td><td>1.70</td><td>1.68</td></tr><tr><td rowspan="2">large</td><td>128</td><td>1.17</td><td>1.15</td></tr><tr><td>384</td><td>1.70</td><td>1.69</td></tr></table>
|
| 312 |
+
|
| 313 |
+
Table 3: SQuAD 1.1 scores after BERT pretraining with packing.
|
| 314 |
+
|
| 315 |
+
<table><tr><td>Model size</td><td>Configuration</td><td>F1</td><td>Exact match</td></tr><tr><td>base</td><td>回 Packed</td><td>88.5 88.32</td><td>80.8 81.03</td></tr><tr><td>large</td><td>回 Packed</td><td>90.9 90.65</td><td>84.1 84.12</td></tr></table>
|
| 316 |
+
|
| 317 |
+
# 317 4.4 Scaling analysis: Impact of accelerators count
|
| 318 |
+
|
| 319 |
+
318 A further advantage of packing over competing un-padding approaches is the inherent load balancing
|
| 320 |
+
319 provided by packing. So called un-padding approaches rely on dynamically launching custom kernels
|
| 321 |
+
320 that ignore padding. A stated advantage of such implementations is the ability to avoid computing
|
| 322 |
+
321 the complete $( 5 1 2 \mathrm { ~ x ~ } 5 1 2 )$ ) attention matrix. This provides additional computational savings compared
|
| 323 |
+
322 to packing, where the attention matrix is computed in its entirety and then masked. Because of
|
| 324 |
+
323 these additional savings, un-padding can exceed the theoretical upper bound for speed-up from
|
| 325 |
+
324 packing (2.013 on Wikipedia). As a result of the dynamic nature of the approach, the processing
|
| 326 |
+
325 time with un-padding is different for each sequence in the batch, and the amount of time required to
|
| 327 |
+
326 process a batch of sequences will be determined by the processing time of the longest sequence in
|
| 328 |
+
327 the batch (with the sequences being processed in parallel). Furthermore, in the multiple accelerator
|
| 329 |
+
328 setting the processing time on each device will vary depending on the sequences in the batch that it
|
| 330 |
+
329 receives. Devices which finish early have to wait for the slowest device to finish before exchanging
|
| 331 |
+
330 gradients. This load-imbalance between the devices (and inside the batch) leads to a considerable
|
| 332 |
+
331 decrease in the speed-up from un-padding as the number of accelerators is increased (see Figure $5$
|
| 333 |
+
332 and Section E [1]). In contrast, packing (our approach) is inherently load-balanced. The processing
|
| 334 |
+
333 time on each accelerator is independent of the content inside the batch received by the device. Any
|
| 335 |
+
334 number of accelerators can therefore operate in unison without having to wait for the slowest batch to
|
| 336 |
+
335 process (all per-device batches are equally fast).
|
| 337 |
+
|
| 338 |
+

|
| 339 |
+
Figure 5: Comparison of the theoretical speed-up as the number of accelerators is increased.
|
| 340 |
+
|
| 341 |
+
# 336 5 Conclusion
|
| 342 |
+
|
| 343 |
+
Whereas packing is a well known concept, this paper sheds a new light onto it in multiple aspects. First, we visualize the sequence length distributions of multiple datasets not just from language domains but also audio and molecular domains to emphasize that packing is beneficial for a lot of datasets and that in many cases, more than $2 \mathbf { x }$ acceleration can be achieved by removing $5 0 \%$ or more padding. Second, we provide two new highly efficient packing approaches based on established solvers that leave almost no padding and that can tackle arbitrarily large datasets in a matter of seconds, in contrast to existing approaches that are slow and suboptimal. Third, we demonstrate that without adjusting the sequence processing algorithm (e.g., BERT) to the packed sequences, predictive performance is reduced. Thus, we propose several model adjustments that are all necessary to keep predictive performance. Last but not least, we prove that, thanks to such adjustments, predictive performance is preserved as if no packing was used — but speed significantly increases, especially since the adjustments come with an overhead of less than $5 \%$ . We prove in our experiments that downstream performance is not impacted by packing and that the anticipated $2 \mathbf { x }$ acceleration can be achieved.
|
| 344 |
+
|
| 345 |
+
351 In the future, an interesting direction is the packing of images of different sizes to help accelerate
|
| 346 |
+
352 computer-vision applications. This is especially relevant given the recent advances in the use of
|
| 347 |
+
353 transformer-based approaches in the computer vision domain, for example the visual transformer $\pmb { \mathbb { B 3 } }$ .
|
| 348 |
+
354 Note that many images come in different shapes and resolutions and packing them can be a new
|
| 349 |
+
355 approach to tackle this diversity instead of casting them all to the same resolution and shape. Masking
|
| 350 |
+
356 out the self-attention within transformers is easier to implement than avoiding cross-contamination of
|
| 351 |
+
357 convolutions applied to packed images. Future work should explore improving the performance of
|
| 352 |
+
358 other models (RoBERTa, GPT-3, T5) by avoiding contamination between non-contiguous segments
|
| 353 |
+
359 from different documents. Even BERT itself might benefit from avoiding contamination between the
|
| 354 |
+
360 two concatenated segments.
|
| 355 |
+
|
| 356 |
+
#
|
| 357 |
+
|
| 358 |
+
361 References
|
| 359 |
+
362 [1] ANONYMOUS. Supplemental Material for “Efficient Sequence Packing without Cross-contamination:
|
| 360 |
+
363 Accelerating Large Language Models without Impacting Performance’, 2022.
|
| 361 |
+
364 [2] BOTTOU, L., CURTIS, F. E., AND NOCEDAL, J. Optimization Methods for Large-Scale Machine Learning.
|
| 362 |
+
365 SIAM Review 60, 2 (jan 2018), 223–311.
|
| 363 |
+
366 [3] BRO, R., AND DE JONG, S. A fast non-negativity-constrained least squares algorithm. Journal of
|
| 364 |
+
367 Chemometrics 11, 5 (sep 1997), 393–401.
|
| 365 |
+
368 [4] BROWN, T. B., MANN, B., RYDER, N., SUBBIAH, M., KAPLAN, J., DHARIWAL, P., NEELAKANTAN,
|
| 366 |
+
369 A., SHYAM, P., SASTRY, G., ASKELL, A., AGARWAL, S., HERBERT-VOSS, A., KRUEGER, G.,
|
| 367 |
+
370 HENIGHAN, T., CHILD, R., RAMESH, A., ZIEGLER, D. M., WU, J., WINTER, C., HESSE, C., CHEN,
|
| 368 |
+
371 M., SIGLER, E., LITWIN, M., GRAY, S., CHESS, B., CLARK, J., BERNER, C., MCCANDLISH, S.,
|
| 369 |
+
372 RADFORD, A., SUTSKEVER, I., AND AMODEI, D. Language Models are Few-Shot Learners. In Advances
|
| 370 |
+
373 in Neural Information Processing Systems 33 pre-proceedings (NeurIPS 2020) (may 2020).
|
| 371 |
+
374 [5] BYTEDANCE INC. Effective Transformer. https://github.com/bytedance/effective_
|
| 372 |
+
375 transformer, 2021.
|
| 373 |
+
376 [6] DEVLIN, J., CHANG, M. W., LEE, K., AND TOUTANOVA, K. BERT: Pre-training of deep bidirectional
|
| 374 |
+
377 transformers for language understanding. NAACL HLT 2019 - 2019 Conference of the North American
|
| 375 |
+
378 Chapter of the Association for Computational Linguistics: Human Language Technologies - Proceedings
|
| 376 |
+
379 of the Conference 1 (oct 2019), 4171–4186.
|
| 377 |
+
380 [7] DEVLIN, J., CHANG, M. W., LEE, K., AND TOUTANOVA, K. BERT: Pre-training of Deep Bidirectional
|
| 378 |
+
381 Transformers for Language Understanding. https://github.com/google-research/bert, 2019.
|
| 379 |
+
382 [8] DEVLIN, J., CHANG, M. W., LEE, K., AND TOUTANOVA, K. Pre-training data creation script
|
| 380 |
+
383 for BERT. https://github.com/google-research/bert/blob/master/create_pretraining_
|
| 381 |
+
384 data.py#L243, 2019.
|
| 382 |
+
385 [9] FEDUS, W., ZOPH, B., AND SHAZEER, N. Switch Transformers: Scaling to Trillion Parameter Models
|
| 383 |
+
386 with Simple and Efficient Sparsity. arXiv (jan 2021).
|
| 384 |
+
387 [10] INTEL, 2021.
|
| 385 |
+
388 [11] JIA, Z., TILLMAN, B., MAGGIONI, M., AND SCARPAZZA, D. P. Dissecting the Graphcore IPU
|
| 386 |
+
389 architecture via microbenchmarking. ArXiv abs/1912.03413 (2019).
|
| 387 |
+
390 [12] JOHNSON, D. S. Near-optimal bin packing algorithms. PhD thesis, Massachusetts Institute of Technology,
|
| 388 |
+
391 1973.
|
| 389 |
+
392 [13] JOHNSON, D. S., AND GAREY, M. R. A 7160 theorem for bin packing. Journal of Complexity 1, 1 (oct
|
| 390 |
+
393 1985), 65–106.
|
| 391 |
+
394 [14] KORTE, B., AND VYGEN, J. Combinatorial Optimization, vol. 21 of Algorithms and Combinatorics.
|
| 392 |
+
395 Springer Berlin Heidelberg, Berlin, Heidelberg, 2012.
|
| 393 |
+
396 [15] LEE, C. C., AND LEE, D. T. A Simple On-Line Bin-Packing Algorithm. Journal of the ACM (JACM) 32,
|
| 394 |
+
397 3 (jul 1985), 562–572.
|
| 395 |
+
398 [16] LIU, Y., OTT, M., GOYAL, N., DU, J., JOSHI, M., CHEN, D., LEVY, O., LEWIS, M., ZETTLEMOYER,
|
| 396 |
+
399 L., AND STOYANOV, V. RoBERTa: A Robustly Optimized BERT Pretraining Approach. arXiv (jul 2019).
|
| 397 |
+
400 [17] MATTSON, P., REDDI, V. J., CHENG, C., COLEMAN, C., DIAMOS, G., KANTER, D., MICIKEVICIUS,
|
| 398 |
+
401 P., PATTERSON, D., SCHMUELLING, G., TANG, H., WEI, G., AND WU, C. MLPerf: An Industry
|
| 399 |
+
402 Standard Benchmark Suite for Machine Learning Performance. IEEE Micro 40, 2 (2020), 8–16.
|
| 400 |
+
403 [18] MENG, Q., CHEN, W., WANG, Y., MA, Z. M., AND LIU, T. Y. Convergence analysis of distributed
|
| 401 |
+
404 stochastic gradient descent with shuffling. Neurocomputing 337 (apr 2019), 46–57.
|
| 402 |
+
405 [19] MLCOMMONS. v0.7 Results. https://mlcommons.org/en/training-normal-07/, 2020. Result
|
| 403 |
+
406 not verified by MLPerf. Throughput/speedup is not the primary metric of MLPerf. MLPerf name and logo
|
| 404 |
+
407 are trademarks. See www.mlperf.org for more information.
|
| 405 |
+
408 [20] NVIDIA. Reference numbers for BERT un-padding results. https://github.com/mlcommons/
|
| 406 |
+
409 training_results_v0.7/blob/master/NVIDIA/results/dgxa100_ngc20.06_pytorch/bert/
|
| 407 |
+
410 result_0.txt, 2020. Throughput/speedup is not the primary metric of MLPerf. MLPerf name and logo
|
| 408 |
+
411 are trademarks. See www.mlperf.org for more information.
|
| 409 |
+
412 [21] NVIDIA. Faster Transformer. https://github.com/NVIDIA/DeepLearningExamples/tree/
|
| 410 |
+
413 master/FasterTransformer/v1, 2021.
|
| 411 |
+
414 [22] OTT, M., EDUNOV, S., BAEVSKI, A., FAN, A., GROSS, S., NG, N., GRANGIER, D., AND AULI,
|
| 412 |
+
415 M. fairseq: A fast, extensible toolkit for sequence modeling. In Proceedings of NAACL-HLT 2019:
|
| 413 |
+
416 Demonstrations (2019).
|
| 414 |
+
417 [23] PANAYOTOV, V., CHEN, G., POVEY, D., AND KHUDANPUR, S. Librispeech: an asr corpus based on
|
| 415 |
+
418 public domain audio books. In Acoustics, Speech and Signal Processing (ICASSP), 2015 IEEE International
|
| 416 |
+
419 Conference on (2015), IEEE, pp. 5206–5210.
|
| 417 |
+
420 [24] RAFFEL, C., SHAZEER, N., ROBERTS, A., LEE, K., NARANG, S., MATENA, M., ZHOU, Y., LI, W.,
|
| 418 |
+
421 AND LIU, P. J. Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer. Journal
|
| 419 |
+
422 of Machine Learning Research 21 (oct 2019).
|
| 420 |
+
423 [25] RAJPURKAR, P., ZHANG, J., LOPYREV, K., AND LIANG, P. SQuAD: $^ { 1 0 0 , 0 0 0 + }$ questions for machine
|
| 421 |
+
424 comprehension of text. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language
|
| 422 |
+
425 Processing (Austin, Texas, Nov. 2016), Association for Computational Linguistics, pp. 2383–2392.
|
| 423 |
+
426 [26] RAMAKRISHNAN, R., DRAL, P. O., RUPP, M., AND VON LILIENFELD, O. A. Quantum chemistry
|
| 424 |
+
427 structures and properties of 134 kilo molecules. Scientific Data 1 (2014).
|
| 425 |
+
428 [27] RUDDIGKEIT, L., VAN DEURSEN, R., BLUM, L. C., AND REYMOND, J.-L. Enumeration of 166 billion
|
| 426 |
+
429 organic small molecules in the chemical universe database gdb-17. Journal of Chemical Information and
|
| 427 |
+
430 Modeling 52, 11 (2012), 2864–2875. PMID: 23088335.
|
| 428 |
+
431 [28] SHEN, J., NGUYEN, P., WU, Y., CHEN, Z., ET AL. Lingvo: a modular and scalable framework for
|
| 429 |
+
432 sequence-to-sequence modeling, 2019.
|
| 430 |
+
433 [29] VASWANI, A., SHAZEER, N., PARMAR, N., USZKOREIT, J., JONES, L., GOMEZ, A. N., KAISER, U.,
|
| 431 |
+
434 AND POLOSUKHIN, I. Attention is all you need. In Proceedings of the 31st International Conference on
|
| 432 |
+
435 Neural Information Processing Systems (Red Hook, NY, USA, 2017), NIPS’17, Curran Associates Inc.,
|
| 433 |
+
436 p. 6000–6010.
|
| 434 |
+
437 [30] WANG, A., SINGH, A., MICHAEL, J., HILL, F., LEVY, O., AND BOWMAN, S. GLUE: A multi-task
|
| 435 |
+
438 benchmark and analysis platform for natural language understanding. In Proceedings of the 2018 EMNLP
|
| 436 |
+
439 Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP (Brussels, Belgium, Nov.
|
| 437 |
+
440 2018), Association for Computational Linguistics, pp. 353–355.
|
| 438 |
+
441 [31] WARSTADT, A., SINGH, A., AND BOWMAN, S. R. Neural network acceptability judgments. arXiv
|
| 439 |
+
442 preprint arXiv:1805.12471 (2018).
|
| 440 |
+
443 [32] WOLF, T., DEBUT, L., SANH, V., CHAUMOND, J., DELANGUE, C., MOI, A., CISTAC, P., RAULT, T.,
|
| 441 |
+
444 LOUF, R., FUNTOWICZ, M., DAVISON, J., SHLEIFER, S., VON PLATEN, P., MA, C., JERNITE, Y., PLU,
|
| 442 |
+
445 J., XU, C., SCAO, T. L., GUGGER, S., DRAME, M., LHOEST, Q., AND RUSH, A. M. Transformers: State
|
| 443 |
+
446 of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in
|
| 444 |
+
447 Natural Language Processing: System Demonstrations (Online, Oct. 2020), Association for Computational
|
| 445 |
+
448 Linguistics, pp. 38–45.
|
| 446 |
+
449 [33] WU, B., XU, C., DAI, X., WAN, A., ZHANG, P., YAN, Z., TOMIZUKA, M., GONZALEZ, J., KEUTZER,
|
| 447 |
+
450 K., AND VAJDA, P. Visual transformers: Token-based image representation and processing for computer
|
| 448 |
+
451 vision, 2020.
|
| 449 |
+
452 [34] XLA, T. XLA: Optimizing Compiler for Machine Learning. https://www.tensorflow.org/xla,
|
| 450 |
+
453 2021.
|
| 451 |
+
454 [35] YOU, Y., LI, J., REDDI, S., HSEU, J., KUMAR, S., BHOJANAPALLI, S., SONG, X., DEMMEL, J.,
|
| 452 |
+
455 KEUTZER, K., AND HSIEH, C.-J. Large Batch Optimization for Deep Learning: Training BERT in 76
|
| 453 |
+
456 minutes. arXiv (apr 2019).
|
| 454 |
+
457 [36] YUE, M., AND ZHANG, L. A simple proof of the inequality $M F F D ( L ) \leq 7 1 / 6 0 O P T ( L ) + 1 , L$ for
|
| 455 |
+
458 the MFFD bin-packing algorithm. Acta Mathematicae Applicatae Sinica $^ Ḋ I I Ḍ$ , 3 (jul 1995), 318–330.
|
| 456 |
+
|
| 457 |
+
1. For all authors...
|
| 458 |
+
|
| 459 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] Our paper has four main claims. First, in Figure $^ 1$ we show the sequence length distribution of Wikipedia and many other datasets and the excessive padding that they require. Second, in Section $4 . { \dot { 1 } } ,$ we show that we can efficiently pack the data which can be easily reproduced with the shared data and code [1]. Third, in Figure 3[right], we clearly show the $2 \mathbf { x }$ performance gain from packing and the related hyperparameter adjustment scheme. Fourth, multiple additional experiments on downstream tasks, ablation studies, and packing variants further verify the validity of our proposed approaches.
|
| 460 |
+
|
| 461 |
+
(b) Did you describe the limitations of your work? [Yes] We see three potential limitations that we discuss in the paper. First, as stated in Section $\mathbf { A }$ “Broader Impact” in the appendix [1], our approach is clearly dependent on the sequence length distribution of the dataset. However, we looked into several other datasets beyond Wikipedia and observed even higher potential for acceleration and document this in multiple sections throughout the paper as well as in the appendix [1]. Second, we explain our focus on the IPU hardware in Section $\boxed { 4 . 1 }$ Our theoretical analysis in Section $\boxed { 4 . 4 }$ indicates that our approach benefits also GPUs. We also cite other work, that shows that our approach is hardware independent. Third, our changes to the network with a modified attention mask and loss calculation come with some overhead. This is addressed in Table 1 [overhead column] in Section 4.1.
|
| 462 |
+
|
| 463 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes] We address this point in Section $\mathbf { \bar { A } }$ “Broader Impact”, third paragraph, in the appendix [1].
|
| 464 |
+
|
| 465 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 466 |
+
|
| 467 |
+
2. If you are including theoretical results...
|
| 468 |
+
|
| 469 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] Detailed algorithm explanations, clarifications of assumptions, and proofs are provided in the supplemental material [1].
|
| 470 |
+
(b) Did you include complete proofs of all theoretical results? [Yes] Sections D, E, and G in the supplemental material [1] provide the necessary derivations on theoretical results.
|
| 471 |
+
|
| 472 |
+
3. If you ran experiments...
|
| 473 |
+
|
| 474 |
+
(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] All packing code is provided in the paper. The packing results on BERT got verified by multiple independent parties. One party used a draft of this paper to successfully reproduce its main findings. Links to implementations in three different frameworks will be provided after acceptance, to avoid violating the blind submission rules.
|
| 475 |
+
|
| 476 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] In the first part, we follow the MLPerf 0.7 benchmark rules. We document the parameters that we changed and why we change them. For the downstream tasks, we follow the reference and report where, how and why we change hyperparameters.
|
| 477 |
+
|
| 478 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] The packing algorithms are deterministic and have no error. Other experiments are only executed once to compare convergence curves. For downstream tasks, we report repetition details and the median as in the reference.
|
| 479 |
+
|
| 480 |
+
(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 used 16 Graphcore Mk2 IPUs for acceleration on an internal cluster.
|
| 481 |
+
|
| 482 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 483 |
+
|
| 484 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes] Appropriate references to the BERT authors, all datasets, and the code snippet from the HugginFace inc. are appropriately referenced with citations and links.
|
| 485 |
+
|
| 486 |
+
(b) Did you mention the license of the assets? [Yes] For the only taken code snippet, the license is part of the file [Listing 7 in $\mathbb { I I I }$ . Dataset licenses like Wikipedia’s “Creative Commons Attribution-ShareAlike 3.0 License” are covered by the references. New materials like packing code and histograms will be provided under an MIT license which will be added over a link to the resources in the final paper version.
|
| 487 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] New materials like packing code and histograms are included in the supplement document as well as separate file. To avoid violating the blind submission rules, they will be linked in the final version like many other assets which are already publicly available under MIT license.
|
| 488 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] We did not curate other people’s data. We only provide a very high level aggregate of the used data.
|
| 489 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] We did not curate other people’s data.
|
| 490 |
+
|
| 491 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 492 |
+
|
| 493 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] Our experiments did not include crowdsourcing or human subjects.
|
| 494 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] Our experiments did not include crowdsourcing or human subjects.
|
| 495 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] Our experiments did not include crowdsourcing or human subjects.
|
md/dev/frE4fUwz_h/frE4fUwz_h.md
ADDED
|
@@ -0,0 +1,427 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SPIKFORMER: WHEN SPIKING NEURAL NETWORK MEETS TRANSFORMER
|
| 2 |
+
|
| 3 |
+
1,2Zhaokun Zhou $^ { 1 , 2 }$ Yuesheng Zhu∗ 4Chao He 2Yaowei Wang 3Shuicheng Yan
|
| 4 |
+
1,2Yonghong Tian 1,2Li Yuan∗
|
| 5 |
+
1Peking University 2Peng Cheng Laboratory 3Sea AI Lab
|
| 6 |
+
4 Shenzhen EEGSmart Technology Co., Ltd.
|
| 7 |
+
{yuanli-ece}@pku.edu.cn
|
| 8 |
+
|
| 9 |
+
# ABSTRACT
|
| 10 |
+
|
| 11 |
+
We consider two biologically plausible structures, the Spiking Neural Network (SNN) and the self-attention mechanism. The former offers an energy-efficient and event-driven paradigm for deep learning, while the latter has the ability to capture feature dependencies, enabling Transformer to achieve good performance. It is intuitively promising to explore the marriage between them. In this paper, we consider leveraging both self-attention capability and biological properties of SNNs, and propose a novel Spiking Self Attention (SSA) as well as a powerful framework, named Spiking Transformer (Spikformer). The SSA mechanism in Spikformer models the sparse visual feature by using spike-form Query, Key, and Value without softmax. Since its computation is sparse and avoids multiplication, SSA is efficient and has low computational energy consumption. It is shown that Spikformer with SSA can outperform the state-of-the-art SNNs-like frameworks in image classification on both neuromorphic and static datasets. Spikformer (66.3M parameters) with comparable size to SEW-ResNet-152 (60.2M, $6 9 . 2 6 \%$ ) can achieve $7 4 . 8 1 \%$ top1 accuracy on ImageNet using 4 time steps, which is the state-of-the-art in directly trained SNNs models. Codes is avaiable at Spikformer.
|
| 12 |
+
|
| 13 |
+
# 1 INTRODUCTION
|
| 14 |
+
|
| 15 |
+
As the third generation of neural network (Maass, 1997), the Spiking Neural Network (SNN) is very promising for its low power consumption, event-driven characteristic, and biological plausibility (Roy et al., 2019). With the development of artificial neural networks (ANNs), SNNs are able to lift performance by borrowing advanced architectures from ANNs, such as ResNet-like SNNs (Hu et al., 2021a; Fang et al., 2021a; Zheng et al., 2021; Hu et al., 2021b), Spiking Recurrent Neural Networks (Lotfi Rezaabad & Vishwanath, 2020) and Spiking Graph Neural Networks (Zhu et al., 2022). Transformer, originally designed for natural language processing (Vaswani et al., 2017), has flourished for various tasks in computer vision, including image classification (Dosovitskiy et al., 2020; Yuan et al., 2021a), object detection (Carion et al., 2020; Zhu et al., 2020; Liu et al., 2021), semantic segmentation (Wang et al., 2021; Yuan et al., 2021b) and low-level image processing (Chen et al., 2021). Self-attention, the key part of Transformer, selectively focuses on information of interest, and is also an important feature of the human biological system (Whittington et al., 2022; Caucheteux & King, 2022). Intuitively, it is intriguing to explore applying self-attention in SNNs for more advanced deep learning, considering the biological properties of the two mechanisms.
|
| 16 |
+
|
| 17 |
+
It is however non-trivial to port the self-attention mechanism into SNNs. In vanilla self-attention (VSA) (Vaswani et al., 2017), there are three components: Query, Key, and Value. As shown in Figure 1(a), standard inference of VSA is firstly obtaining a matrix by computing the dot product of float-point-form Query and Key; then softmax, which contains exponential calculations and division operations, is adopted to normalize the matrix to give the attention map which will be used to weigh the Value. The above steps in VSA do not conform to the calculation characteristics of SNNs, i.e., avoiding multiplication. Moreover, the heavy computational overhead of VSA almost prohibits applying it directly to SNNs. Therefore, in order to develop Transformer on SNNs, we need to design a new effective and computation-efficient self-attention variant that can avoid multiplications.
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
Figure 1: Illustration of vanilla self-attention (VSA) and our Spiking Self Attention (SSA). A red spike indicates a value of 1 at that location. The blue dashed boxes provide examples of matrix dot product operation. For convenience, we choose one of the heads of SSA, where $N$ is the number of input patches and $d$ is the feature dimension of one head. FLOPs is the floating point operations and SOPs is the theoretical synaptic operations. The theoretical energy consumption to perform one calculation between Query, Key and Value in one time step is obtained from 8-encoder-blocks 512-embedding-dimension Spikformer on ImageNet test set according to (Kundu et al., 2021b; Hu et al., 2021a). More details about the calculation of theoretical SOP and energy consumption are included in appendix. C.2. (a) In VSA, $Q _ { \mathcal { F } } , K _ { \mathcal { F } } , V _ { \mathcal { F } }$ are float-point forms. After the dot-product of $Q \mathcal { F }$ and $K \mathcal { \tau }$ , the softmax function regularizes negative values in the attention map to positive values. (b) In SSA, all value in attention map is non-negative and the computation is sparse using spike-form $Q , K , V \left( 5 . 5 \times 1 0 ^ { 6 } \mathrm { V S . 7 7 } \times 1 0 ^ { 6 } \right.$ in VSA). Therefore, the computation in SSA consumes less energy compared with VSA $( 3 5 4 . 2 \mu \mathrm { J } )$ . In addition, the SSA is decomposable (the calculation order of $Q , K$ and $V$ is changeable).
|
| 21 |
+
|
| 22 |
+
We thus present Spiking Self Attention (SSA), as illustrated in Figure 1(b). SSA introduces selfattention mechanism to SNNs for the first time, which models the interdependence using spike sequences. In SSA, the Query, Key, and Value are in spike form which only contains of 0 and 1. The obstacles to the application of self-attention in SNNs are mainly caused by softmax. 1) As shown in Figure 1, the attention map calculated from spike-form Query and Key has natural non-negativeness, which ignores irrelevant features. Thus, we do not need the softmax to keep the attention matrix non-negative, which is its most important role in VSA (Qin et al., 2022). 2) The input and the Value of the SSA are in the form of spikes, which only consist of 0 and 1 and contain less fine-grained feature compared to the float-point input and Value of the VSA in ANNs. So the float-point Query and Key and softmax function are redundant for modeling such spike sequences. Tab. 1 illustrates that our SSA is competitive with VSA in the effect of processing spike sequences. Based on the above insights, we discard softmax normalization for the attention map in SSA. Some previous Transformer variants also discard softmax or replace it with a linear function. For example, in Performer (Choromanski et al., 2020), positive random feature is adopted to approximate softmax; CosFormer (Qin et al., 2022) replaces softmax with ReLU and cosine function.
|
| 23 |
+
|
| 24 |
+
With such designs of SSA, the calculation of spike-form Query, Key, and Value avoids multiplications and can be done by logical AND operation and addition. Also, its computation is very efficient. Due to sparse spike-form Query, Key and Value (shown in appendix D.1) and simple computation, the number of operations in SSA is small, which makes the energy consumption of SSA very low. Moreover, our SSA is decomposable after deprecation of softmax, which further reduces its computational complexity when the sequence length is greater than the feature dimension of one head, as depicted in Figure 1(b) $\textcircled{1} \textcircled{2}$ .
|
| 25 |
+
|
| 26 |
+
Based on the proposed SSA, which well suits the calculation characteristics of SNNs, we develop the Spiking Transformer (Spikformer). An overview of Spikformer is shown in Figure 2. It boosts the performance trained on both static datasets and neuromorphic datasets. To the best of our knowledge, it is the first time to explore the self-attention mechanism and directly-trained Transformer in the SNNs. To sum up, there are three-fold contributions of our work:
|
| 27 |
+
|
| 28 |
+
• We design a novel spike-form self-attention named Spiking Self Attention (SSA) for the properties of SNNs. Using sparse spike-form Query, Key, and Value without softmax, the calculation of SSA avoids multiplications and is efficient. • We develop the Spiking Transformer (Spikformer) based on the proposed SSA. To the best of our knowledge, this is the first time to implement self-attention and Transformer in SNNs.
|
| 29 |
+
|
| 30 |
+
• Extensive experiments show that the proposed architecture outperforms the state-of-the-art SNNs on both static and neuromorphic datasets. It is worth noting that we achieved more than $7 4 \%$ accuracy on ImageNet with 4 time steps using directly-trained SNN model for the first time.
|
| 31 |
+
|
| 32 |
+
# 2 RELATED WORK
|
| 33 |
+
|
| 34 |
+
Vision Transformers. For the image classification task, a standard vision transformer (ViT) includes a patch splitting module, the transformer encoder layer(s), and linear classification head. The Transformer encoder layer consists of a self-attention layer and a multi perception layer block. Selfattention is the core component making ViT successful. By weighting the image-patches feature value through the dot-product of query and key and softmax function, self-attention can capture the global dependence and interest representation (Katharopoulos et al., 2020; Qin et al., 2022). Some works have been carried out to improve the structures of ViTs. Using convolution layers for patch splitting has been proven to be able to accelerate convergence and alleviate the data-hungry problem of ViT (Xiao et al., 2021b; Hassani et al., 2021). There are some methods aiming to reduce the computational complexity of self-attention or improve its ability of modeling visual dependencies (Song, 2021; Yang et al., 2021; Rao et al., 2021; Choromanski et al., 2020). This paper focuses on exploring the effectiveness of self-attention in SNNs and developing a powerful spiking transformer model for image classification.
|
| 35 |
+
|
| 36 |
+
Spiking Neural Networks. Unlike traditional deep learning models that convey information using continuous decimal values, SNNs use discrete spike sequences to calculate and transmit information. Spiking neurons receive continuous values and convert them into spike sequences, including the Leaky Integrate-and-Fire (LIF) neuron (Wu et al., 2018), PLIF (Fang et al., 2021b), etc. There are two ways to get deep SNN models: ANN-to-SNN conversion and direct training. In ANNto-SNN conversion (Cao et al., 2015; Hunsberger & Eliasmith, 2015; Rueckauer et al., 2017; Bu et al., 2021; Meng et al., 2022; Wang et al., 2022), the high-performance pre-trained ANN is converted to SNN by replacing the ReLU activation layers with spiking neurons. The converted SNN requires large time steps to accurately approximate ReLU activation, which causes large latency (Han et al., 2020). In the area of direct training, SNNs are unfolded over the simulation time steps and trained in a way of backpropagation through time (Lee et al., 2016; Shrestha & Orchard, 2018). Because the event-triggered mechanism in spiking neurons is non-differentiable, the surrogate gradient is used for backpropagation (Lee et al., 2020; Neftci et al., 2019)Xiao et al. (2021a) adopts implicit differentiation on the equilibrium state to train SNN. Various models from ANNs have been ported to SNNs. However, the study of self-attention on SNN is currently blank. Yao et al. (2021) proposed temporal attention to reduce the redundant time step. Zhang et al. (2022a;b) both use ANN-Transformer to process spike data, although they have ’Spiking Transformer’ in the title. Mueller et al. (2021) provides a ANN-SNN conversion Transformer, but remains vanilla self-attention which does not conform the characteristic of SNN. In this paper, we will explore the feasibility of implementing self-attention and Transformer in SNNs.
|
| 37 |
+
|
| 38 |
+
As the fundamental unit of SNNs, the spike neuron receives the resultant current and accumulates membrane potential which is used to compare with the threshold to determine whether to generate the spike. We uniformly use LIF spike neurons in our work. The dynamic model of LIF is described as:
|
| 39 |
+
|
| 40 |
+
$$
|
| 41 |
+
\begin{array} { l } { { \displaystyle H [ t ] = V [ t - 1 ] + \frac { 1 } { \tau } \left( X [ t ] - \left( V [ t - 1 ] - V _ { r e s e t } \right) \right) , } } \\ { { \displaystyle S [ t ] = \Theta ( H [ t ] - V _ { t h } ) , } } \\ { { \displaystyle V [ t ] = H [ t ] \left( 1 - S [ t ] \right) + V _ { r e s e t } S [ t ] , } } \end{array}
|
| 42 |
+
$$
|
| 43 |
+
|
| 44 |
+
where $\tau$ is the membrane time constant, and $X [ t ]$ is the input current at time step $t$ . When the membrane potential $H [ t ]$ exceeds the firing threshold $V _ { t h }$ , the spike neuron will trigger a spike $S [ t ]$ . $\Theta ( v )$ is the Heaviside step function which equals 1 for $v \geq 0$ and 0 otherwise. $V [ t ]$ represents the membrane potential after the trigger event which equals $H [ t ]$ if no spike is generated, and otherwise equals to the reset potential $V _ { r e s e t }$ .
|
| 45 |
+
|
| 46 |
+
# 3 METHOD
|
| 47 |
+
|
| 48 |
+
We propose Spiking Transformer (Spikformer), which incorporates the self-attention mechanism and Transformer into the spiking neural networks (SNNs) for enhanced learning capability. Now we explain the overview and components of Spikformer one by one.
|
| 49 |
+
|
| 50 |
+

|
| 51 |
+
Figure 2: The overview of Spiking Transformer (Spikformer), which consists of a spiking patch splitting module (SPS), a Spikformer encoder and a Linear classification head. We empircally find that the layer normalization (LN) does not apply to SNNs, so we use batch normalization (BN) instead.
|
| 52 |
+
|
| 53 |
+
# 3.1 OVERALL ARCHITECTURE
|
| 54 |
+
|
| 55 |
+
An overview of Spikformer is depicted in Figure 2. Given a 2D image sequence $I \in \mathbb { R } ^ { T \times C \times H \times W \mathbb { 1 } }$ , the Spiking Patch Splitting (SPS) module linearly projects it to a $D$ dimensional spike-form feature vector and splits it into a sequence of $N$ flattened spike-form patches $x$ . Float-point-form position embedding cannot be used in SNNs. We employ a conditional position embedding generator (Chu et al., 2021) to generate spike-form relative position embedding (RPE) and add the RPE to patches sequence $x$ to get $X _ { 0 }$ . The conditional position embedding generator contains a 2D convolution layer (Conv2d) with kernel size 3, batch normalization (BN), and spike neuron layer $( \cal { S } \mathcal { N } )$ . Then we pass the $X _ { 0 }$ to the $L$ -block Spikformer encoder. Similar to the standard ViT encoder block, a Spikformer encoder block consists of a Spiking Self Attention (SSA) and an MLP block. Residual connections are applied in both the SSA and MLP block. As the main component in Spikformer encoder block, SSA offers an efficient method to model the local-global information of images using spike-form Query $( Q )$ , Key $( K )$ , and Value $( V )$ without softmax, which will be analyzed in detail in Sec. 3.3. A global average-pooling (GAP) is utilized on the processed feature from Spikformer encoder and outputs the $D$ -dimension feature which will be sent to the fully-connected-layer classification head (CH) to output the prediction $Y$ . Spikformer can be written as follows:
|
| 56 |
+
|
| 57 |
+
$$
|
| 58 |
+
\begin{array} { r l r l } & { x = \operatorname { S P S } \left( I \right) , \quad \quad \quad } & & { I \in \mathbb { R } ^ { T \times C \times H \times W } , x \in \mathbb { R } ^ { T \times N \times D } , } \\ & { \operatorname { R P E } = \mathcal { S N } ( \operatorname { B N } ( ( \operatorname { C o n v 2 d } ( x ) ) ) ) , \quad \quad } & & { \operatorname { R P E } \in \mathbb { R } ^ { T \times N \times D } } \\ & { X _ { 0 } = x + \operatorname { R P E } , \quad \quad } & & { X _ { 0 } \in \mathbb { R } ^ { T \times N \times D } } \\ & { X _ { l } ^ { \prime } = \operatorname { S S A } ( X _ { l - 1 } ) + X _ { l - 1 } , \quad \quad } & & { X _ { l } ^ { \prime } \in \mathbb { R } ^ { T \times N \times D } , l = 1 . . . L } \\ & { X _ { l } = \operatorname { M L P } ( X _ { l } ^ { \prime } ) + X _ { l } ^ { \prime } , \quad \quad } & & { X _ { l } \in \mathbb { R } ^ { T \times N \times D } , l = 1 . . . L } \\ & { Y = \operatorname { C H } ( \operatorname { G A P } ( X _ { L } ) ) } \end{array}
|
| 59 |
+
$$
|
| 60 |
+
|
| 61 |
+
# 3.2 SPIKING PATCH SPLITTING
|
| 62 |
+
|
| 63 |
+
As shown in Figure 2, the Spiking Patch Splitting (SPS) module aims to linearly project an image to a $D$ dimensional spike-form feature and split the feature into patches with a fixed size. SPS can contain multiple blocks. Similar to the convolutional stem in Vision Transformer (Xiao et al., 2021b; Hassani et al., 2021), we apply a convolution layer in each SPS block to introduce inductive bias into
|
| 64 |
+
|
| 65 |
+
Spikformer. Specifically, given an image sequence $I \in \mathbb { R } ^ { T \times C \times H \times W }$ :
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
x = \Re \Re \left( S \mathcal { N } ( \mathrm { B N } ( ( \mathrm { C o n v 2 d } ( I ) ) ) ) \right)
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
where the Conv2d and $\operatorname { \mathcal { M P } }$ represent the 2D convolution layer (stride-1, $3 \times 3$ kernel size) and max-pooling, respectively. The number of SPS blocks can be more than 1. When using multiple SPS blocks, the number of output channels in these convolution layers is gradually increased and finally matches the embedding dimension of patches. For example, given an output embedding dimension $D$ and a four-block SPS module, the number of output channels in four convolution layers is $D / 8 , D / 4 , D / 2 , D$ . While the 2D-max-pooling layer is applied to down-sample the feature size after SPS block with a fixed size. After the processing of SPS, $I$ is split into an image patches sequence x ∈ RT ×N×D.
|
| 72 |
+
|
| 73 |
+
# 3.3 SPIKING SELF ATTENTION MECHANISM
|
| 74 |
+
|
| 75 |
+
Spikformer encoder is the main component of the whole architecture, which contains the Spiking Self Attention (SSA) mechanism and MLP block. In this section we focus on SSA, starting with a review of vanilla self-attention (VSA). Given an input feature sequence $X \in \mathbb { R } ^ { T \times N \times D }$ , the VSA in ViT has three float-point key components, namely query $( Q \tau )$ , key $( K _ { \mathcal { F } } )$ , and value $( V _ { \mathcal { F } } )$ which are calculated by learnable linear matrices $W _ { Q } , W _ { K } , W _ { V } \in \mathbb { R } ^ { D \times D }$ and $X$ :
|
| 76 |
+
|
| 77 |
+
$$
|
| 78 |
+
Q _ { \mathcal { F } } = X W _ { Q } , K _ { \mathcal { F } } = X W _ { K } , V _ { \mathcal { F } } = X W _ { V }
|
| 79 |
+
$$
|
| 80 |
+
|
| 81 |
+
where $\mathcal { F }$ denotes the float-point form. The output of vanilla self-attention can be computed as:
|
| 82 |
+
|
| 83 |
+
$$
|
| 84 |
+
\mathrm { V S A } ( Q _ { \mathcal { F } } , K _ { \mathcal { F } } , V _ { \mathcal { F } } ) = \mathrm { S o f t m a x } \left( \frac { Q _ { \mathcal { F } } K _ { \mathcal { F } } ^ { \mathrm { T } } } { \sqrt { d } } \right) V _ { \mathcal { F } }
|
| 85 |
+
$$
|
| 86 |
+
|
| 87 |
+
where $d = D / H$ is the feature dimension of one head and $H$ is the head number. Converting the float-point-form Value $( V _ { \mathcal { F } } )$ into spike form $( V )$ can realize the direct application of VSA in SNNs, which can be expressed as:
|
| 88 |
+
|
| 89 |
+
$$
|
| 90 |
+
\mathrm { V S A } ( Q _ { \mathcal { F } } , K _ { \mathcal { F } } , V ) = \mathrm { S o f t m a x } \left( \frac { Q _ { \mathcal { F } } K _ { \mathcal { F } } ^ { \mathrm { T } } } { \sqrt { d } } \right) V
|
| 91 |
+
$$
|
| 92 |
+
|
| 93 |
+
However, the calculation of VSA is not applicable in SNNs for two reasons. 1) The float-point matrix multiplication of $Q _ { \mathcal { F } } , K _ { \mathcal { F } }$ and softmax function which contains exponent calculation and division operation, do not comply with the calculation rules of SNNs. 2) The quadratic space and time complexity of the sequence length of VSA do not meet the efficient computational requirements of SNNs.
|
| 94 |
+
|
| 95 |
+
We propose Spiking Self-Attention (SSA), which is more suitable for SNNs than the VSA, as shown in Figure 1(b) and the bottom of Figure 2. The query $( Q )$ , key $( K )$ , and Value $( V )$ are computed through learnable matrices firstly. Then they become spiking sequences via different spike neuron layers:
|
| 96 |
+
|
| 97 |
+
$$
|
| 98 |
+
Q = \mathcal { S } \mathcal { N } _ { Q } ( \mathrm { B N } ( X W _ { Q } ) ) , K = \mathcal { S } \mathcal { N } _ { K } ( \mathrm { B N } ( X W _ { K } ) ) , V = \mathcal { S } \mathcal { N } _ { V } ( \mathrm { B N } ( X W _ { V } ) )
|
| 99 |
+
$$
|
| 100 |
+
|
| 101 |
+
where $Q , K , V \in \mathbb { R } ^ { T \times N \times D }$ . We believe that the calculation process of the attention matrix should use pure spike-form Query and Key(only containing 0 and 1). Inspired by vanilla self-attention (Vaswani et al., 2017), we add a scaling factor $s$ to control the large value of the matrix multiplication result. $s$ does not affect the property of SSA. As shown in Figure 2, the spike-friendly SSA is defined as:
|
| 102 |
+
|
| 103 |
+
$$
|
| 104 |
+
\begin{array} { r l } & { \mathrm { S S A } ^ { \prime } ( Q , K , V ) = \mathcal { S N } \left( Q K ^ { \mathrm { T } } V \ast s \right) } \\ & { \mathrm { S S A } ( Q , K , V ) = \mathcal { S N } ( \mathrm { B N } ( \mathrm { L i n e a r } ( \mathrm { S S A } ^ { \prime } ( Q , K , V ) ) ) ) . } \end{array}
|
| 105 |
+
$$
|
| 106 |
+
|
| 107 |
+
The single-head SSA introduced here can easily be extended to the multi-head SSA, which is detailed in the appendix A. SSA is independently conducted on each time step and seeing more details in appendix B. As shown in Eq. (15), SSA cancels the use of softmax to normalize the attention matrix in Eq. (12) and directly multiplies $Q , K$ and $V$ . An intuitive calculation example is shown in Figure 1(b). The softmax is unnecessary in our SSA, and it even hinders the implementation of self-attention to SNNs. Formally, based on Eq. (14), the spike sequences $Q$ and $K$ output by the spiking neuron layer $S \mathcal { N } _ { Q }$ and $\mathcal { S N } _ { k }$ respectively, are naturally non-negative (0 or 1), resulting in a non-negative attention map. SSA only aggregates these relevant features and ignores the irrelevant information. Hence it does not need the softmax to ensure the non-negativeness of the attention map. Moreover, compared to the float-point-form $X _ { \mathcal { F } }$ and $V _ { \mathcal { F } }$ in ANNs, the input $X$ and the Value $V$ of self-attention in SNNs are in spike form, containing limited information. The vanilla self-attention (VSA) with float-point-form $Q _ { \mathcal { F } } , K _ { \mathcal { F } }$ and softmax is redundant for modeling the spike-form $X , V$ , which cannot get more information from $X , V$ than SSA. That is, SSA is more suitable for SNNs than the VSA.
|
| 108 |
+
|
| 109 |
+
We conduct experiments to validate the above insights by comparing the proposed SSA with four different calculation methods of the attention map, as shown in Tab. 1.
|
| 110 |
+
|
| 111 |
+
$\mathrm { A _ { I } }$ denotes multiplying the float-points $Q$ and $K$ directly to get the attention map, which preserves both positive and negative correlation. $\mathrm { A _ { R e L U } }$ uses the multiplication between ${ \mathrm { R e L U } } ( Q )$ and $\mathrm { R e L U } ( K )$ to obtain the attention map. $\mathrm { A _ { R e L U } }$ retains the positive values of $Q , K$ and sets the negative values to 0,
|
| 112 |
+
|
| 113 |
+
Table 1: Analysis of the SSA’s rationality. We replace SSA with other attention variants and keep the remaining network structure in Spikformer unchanged. We show the accuracy (Acc) on CIFAR10-DVS (Li et al., 2017), CIFAR10/100 (Krizhevsky, 2009). OPs (M) is the number of operations (For $\mathrm { A _ { I } }$ , $\mathrm { A _ { L e a k y R e L U } }$ , $\mathrm { A _ { R e L U } }$ and $\mathrm { A } _ { \mathrm { s o f t m a x } }$ , OPs is FLOPs, and SOPs is ignored; For ASSA, it is SOPs.) and $\mathrm { P }$ $( \mu \mathrm { J } )$ is the theoretical energy consumption to perform one calculation among $Q , K , V$ .
|
| 114 |
+
|
| 115 |
+
<table><tr><td></td><td>CIFAR10-DVS</td><td>CIFAR10</td><td>CIFAR100</td></tr><tr><td></td><td colspan="3">Acc/OPs (M)/P (μJ)</td></tr><tr><td>A1</td><td>79.40/16.8/77</td><td>93.96/6.3/29</td><td>76.94/6.3/29</td></tr><tr><td>ALeakyReLU</td><td>79.80/16.8/77</td><td>93.85/6.3/29</td><td>76.73/6.3/29</td></tr><tr><td>AReLU</td><td>79.40/16.8/77</td><td>94.34/6.3/29</td><td>77.00/6.3/29</td></tr><tr><td>Asoftmax</td><td>80.00/19.1/88</td><td>94.97/6.6/30</td><td>77.92/6.6/30</td></tr><tr><td>AssA</td><td>80.90/0.66/0.594</td><td>95.19/1.1/0.990</td><td>77.86/1.3/1.170</td></tr></table>
|
| 116 |
+
|
| 117 |
+
while $\mathrm { A _ { L e a k y R e L U } }$ still retains the negative points. $\mathrm { A } _ { \mathrm { s o f t m a x } }$ means the attention map is generated following VSA. The above four methods use the same Spikformer framework and weight the spike-form $V$ . From Tab. 1, the superior performance of our $\mathrm { A } _ { \mathrm { S S A } }$ over $\mathrm { A _ { I } }$ and ALeakyReLU proves the superiority of $\mathcal { S N }$ . The reason why $\mathrm { A _ { S S A } }$ is better than $\mathrm { A _ { R e L U } }$ may be that $\mathrm { A _ { S S A } }$ has better non-linearity in self-attention. By comparing with $\mathrm { A } _ { \mathrm { s o f t m a x } }$ , $\mathrm { A } _ { \mathrm { S S A } }$ is competitive, which even surpasses $\mathrm { A } _ { \mathrm { s o f t m a x } }$ on CIFAR10DVS and CIFAR10. This can be attributed to SSA being more suitable for spike sequences $X$ and $V$ ) with limited information than VSA. Furthermore, the number of operations and theoretical energy consumption required by the $\mathrm { A _ { S S A } }$ to complete the calculation of $Q , K , V$ is much lower than that of the other methods.
|
| 118 |
+
|
| 119 |
+
SSA is specially designed for modeling spike sequences. The $Q , K$ , and $V$ are all in spike form, which degrades the matrWe take a row of Query $q$ dot-product calculatioand a column of Key $k$ to logical AND operation aas a calculation example: $\begin{array} { r } { \sum _ { i = 1 } ^ { d } q _ { i } k _ { i } = \sum _ { q _ { i } = 1 } k _ { i } } \end{array}$ . . Also, as shown in Tab. 1, SSA has a low computation burden and energy consumption due to sparse spike-form $Q , K$ and $V$ (Figure. 4) and simplified calculation. In addition, the order of calculation between $Q , K$ and $V$ is changeable: $Q K ^ { \mathrm { T } }$ first and then $V$ , or $K ^ { \mathrm { T } } V$ first and then $Q$ . When the sequence length $N$ is bigger than one head dimension $d$ , the second calculation order above will incur less computation complexity $( O ( N d ^ { 2 } ) )$ than the first one $( O ( N ^ { 2 } d ) )$ . SSA maintains the biological plausibility and computationally efficient properties throughout the whole calculation process.
|
| 120 |
+
|
| 121 |
+
# 4 EXPERIMENTS
|
| 122 |
+
|
| 123 |
+
We conduct experiments on both static datasets CIFAR, ImageNet (Deng et al., 2009), and neuromorphic datasets CIFAR10-DVS, DVS128 Gesture (Amir et al., 2017) to evaluate the performance of Spikformer. The models for conducting experiments are implemented based on Pytorch (Paszke et al., 2019), SpikingJelly 2 and Pytorch image models library (Timm) 3. We train the Spikformer from scratch and compare it with current SNNs models in Sec. 4.1 and 4.2. We conduct ablation studies to show the effects of the SSA module and Spikformer in Sec. 4.3.
|
| 124 |
+
|
| 125 |
+
# 4.1 STATIC DATASETS CLASSIFICATION
|
| 126 |
+
|
| 127 |
+
ImageNet contains around 1.3 million 1, 000-class images for training and 50, 000 images for validation. The input size of our model on ImageNet is set to the default $2 2 4 \times 2 2 4$ . The optimizer is AdamW and the batch size is set to 128 or 256 during 310 training epochs with a cosine-decay learning rate whose initial value is 0.0005. The scaling factor is 0.125 when training on ImageNet and CIFAR. A four-block SPS splits the image into $1 9 6 ~ 1 6 \times 1 6$ patches. Following (Yuan et al., 2021a), standard data augmentation methods, such as random augmentation, mixup, and cutmix, are also used in training. We try a variety of models with different embedding dimensions and numbers of transformer blocks for ImageNet, which has been shown in Tab. 2. We also give a comparison of synaptic operations (SOPs) (Merolla et al., 2014) and theoretical energy consumption.
|
| 128 |
+
|
| 129 |
+
Table 2: Evaluation on ImageNet. Param refers to the number of parameters. Power is the average theoretical energy consumption when predicting an image from ImageNet test set, whose calculation detail is shown in Eq. 22. Spikformer- $. L – D$ represents a Spikformer model with $L$ Spikformer encoder blocks and $D$ feature embedding dimensions. The train loss, test loss and test accuracy curves are shown in appendix D.2. OPs refers to SOPs in SNN and FLOPs in ANN-ViT.
|
| 130 |
+
|
| 131 |
+
<table><tr><td>Methods</td><td>Architecture</td><td>Param (M)</td><td>OPs (G)</td><td>Power (mJ)</td><td>Time Step</td><td>Acc</td></tr><tr><td>Hybrid training(Rathi et al.,2020)</td><td>ResNet-34</td><td>21.79</td><td>1</td><td>-</td><td>250</td><td>61.48</td></tr><tr><td rowspan="2">TET(Deng et al., 2021)</td><td>Spiking-ResNet-34</td><td>21.79</td><td>1</td><td></td><td>6</td><td>64.79</td></tr><tr><td>SEW-ResNet-34</td><td>21.79</td><td>-</td><td>-</td><td>4</td><td>68.00</td></tr><tr><td>Spiking ResNet(Hu et al., 2021a)</td><td>ResNet-34</td><td>21.79</td><td>65.28</td><td>59.295</td><td>350</td><td>71.61</td></tr><tr><td>STBP-tdBN(Zheng et al., 2021)</td><td>ResNet-50 Spiking-ResNet-34</td><td>25.56 21.79</td><td>78.29</td><td>70.934</td><td>350</td><td>72.75</td></tr><tr><td rowspan="4">SEW ResNet(Fang et al.,2021a)</td><td></td><td>21.79</td><td>6.50 3.88</td><td>6.393</td><td>6</td><td>63.72</td></tr><tr><td>SEW-ResNet-34</td><td></td><td></td><td>4.035</td><td>4</td><td>67.04</td></tr><tr><td>SEW-ResNet-50</td><td>25.56</td><td>4.83</td><td>4.890</td><td>4</td><td>67.78</td></tr><tr><td>SEW-ResNet-101 SEW-ResNet-152</td><td>44.55 60.19</td><td>9.30 13.72</td><td>8.913 12.891</td><td>4 4</td><td>68.76 69.26</td></tr><tr><td>Transformer</td><td>Transformer-8-512</td><td>29.68</td><td>8.33</td><td>38.340</td><td>1</td><td>80.80</td></tr><tr><td rowspan="5">Spikformer</td><td>Spikformer-8-384</td><td>16.81</td><td>6.82</td><td>7.734</td><td>4</td><td>70.24</td></tr><tr><td>Spikformer-6-512</td><td>23.37</td><td>8.69</td><td>9.417</td><td>4</td><td>72.46</td></tr><tr><td>Spikformer-8-512</td><td>29.68</td><td>11.09</td><td>11.577</td><td>4</td><td>73.38</td></tr><tr><td>Spikformer-10-512</td><td>36.01</td><td>13.67</td><td>13.899</td><td>4</td><td>73.68</td></tr><tr><td>Spikformer-8-768</td><td>66.34</td><td>22.09</td><td>21.477</td><td>4</td><td>74.81</td></tr></table>
|
| 132 |
+
|
| 133 |
+
From the results, it can be seen that our Spikformer achieves a significant accuracy boost on the ImageNet compared with the current best SNNs models. In particular, our comparison first starts from our smallest model with other models. The Spikformer-8-384 with 16.81M parameters has $7 0 . 2 4 \%$ top-1 accuracy when trained from scratch on ImageNet, which outperforms the best the current best direct-train model SEW-ResNet152: $6 9 . 2 6 \%$ with $6 0 . 1 9 \mathbf { M }$ . In addition, the SOPs and the theoretical energy consumption of Spikformer-8-384 (6.82G, $7 . 7 3 4 \mathrm { m J }$ ) are lower compared with the SEW-ResNet-152 (13.72G, 12.891mJ). The 29.68M model Spikformer-8-512 has already achieved state-of-the-art performance with $7 3 . 3 8 \%$ , which is even higher than the converted model (Hu et al., 2021a) $( 7 2 . 7 5 \% )$ using 350 time steps. As the number of Spikformer blocks increases, the classification accuracy of our model on ImageNet is also getting higher. The Spikformer-10-512 obtains $7 3 . 6 8 \%$ with $4 2 . 3 5 \mathrm { M }$ The same happens when gradually increasing the embedding dimension, where Spikformer-8-768 further improves the performance to $7 4 . 8 1 \%$ and significantly outperforms the SEW-ResNet-152 model by $5 . 5 5 \%$ . ANNViT-8-512 is $7 . \bar { 4 } 2 \%$ higher than Spikformer-8-512, but the theoretical energy consumption is $3 . 3 1 \times$ of Spikformer-8-512. In Figure 3, we show the attention map examples of the last encoder block in Spikformer-8-512 at the fourth time step. SSA can capture image regions associated with classification semantics and set irrelevant regions to 0 (black region), and is shown to be effective, event-driven, and energy-efficient.
|
| 134 |
+
|
| 135 |
+

|
| 136 |
+
Figure 3: Attention map examples of SSA. The black region is 0.
|
| 137 |
+
|
| 138 |
+
CIFAR provides 50, 000 train and $1 0 , 0 0 0$ test images with $3 2 \times 3 2$ resolution. The batch size is set to 128. A four-block SPS (the first two blocks do not contain the max-pooling layer) splits the image into $6 4 4 \times 4$ patches. Tab. 3 shows the accuracy of Spikformer compared with other models on CIFAR. As shown in Tab. 3, Spikformer-4- 384 achieves ${ \bar { 9 } } 5 . 1 9 \%$ accuracy on CIFAR10, which is better than the TET $( 9 4 . 4 4 \% )$ and ResNet-19
|
| 139 |
+
|
| 140 |
+
Table 3: Performance comparison of our method with existing methods on CIFAR10/100. Our method improves network performance across all tasks. \* denotes self-implementation results by Deng et al. (2021). Note that Hybrid training (Rathi et al., 2020) adopts ResNet-20 for CIFAR10 and VGG-11 for CIFAR100.
|
| 141 |
+
|
| 142 |
+
<table><tr><td>Methods</td><td>Architecture</td><td>Param (M)</td><td>Time Step</td><td>CIFAR10 Acc</td><td>CIFAR100 Acc</td></tr><tr><td rowspan="6">Hybrid training(Rathi et al.,2020) Diet-SNN(Rathi & Roy,2020) STBP(Wu et al.,2018) STBP NeuNorm(Wu et al., 2019) TSSL-BP(Zhang&Li,2020)</td><td>VGG-11</td><td>9.27</td><td>125</td><td>92.22</td><td>67.87</td></tr><tr><td>ResNet-20</td><td>0.27</td><td>10/5</td><td>92.54</td><td>64.07</td></tr><tr><td>CIFARNet</td><td>17.54</td><td>12</td><td>89.83</td><td>-</td></tr><tr><td>CIFARNet</td><td>17.54</td><td>12</td><td>90.53</td><td>-</td></tr><tr><td>CIFARNet</td><td>17.54</td><td>5</td><td>91.41</td><td>-</td></tr><tr><td>ResNet-19</td><td>12.63</td><td>4</td><td>92.92</td><td>70.86</td></tr><tr><td>TET(Deng et al.,2021)</td><td>ResNet-19</td><td>12.63</td><td>4</td><td>94.44</td><td>74.47</td></tr><tr><td rowspan="3">ANN</td><td>ResNet-19*</td><td>12.63</td><td>1</td><td>94.97</td><td>75.35</td></tr><tr><td>Transformer-4-384</td><td>9.32</td><td>1</td><td>96.73</td><td>81.02</td></tr><tr><td>Spikformer-4-256</td><td>4.15</td><td>4</td><td>93.94</td><td>75.96</td></tr><tr><td rowspan="4">Spikformer</td><td>Spikformer-2-384</td><td>5.76</td><td>4</td><td>94.80</td><td>76.95</td></tr><tr><td>Spikformer-4-384</td><td>9.32</td><td>4</td><td>95.19</td><td>77.86</td></tr><tr><td>Spikformer-4-384 400E</td><td>9.32</td><td>4</td><td>95.51</td><td>78.21</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 143 |
+
|
| 144 |
+
ANN $( 9 4 . 9 7 \% )$ ). The performance is improved as the dimensions or blocks increase. Specifically, Spikformer-4-384 improves by $1 . 2 5 \%$ compared to Spikformer-4-256 and improves by $0 . 3 9 \%$ compared to Spikformer-2-384. We also find that extending the number of training epochs to 400 can improve the performance (Spikformer-4-384 400E achieves $0 . 3 2 \%$ and $0 . 3 5 \%$ advance compared to Spikformer-4-384 on CIFAR10 and CIFAR100). The improvement of the proposed Spikformer on complex datasets such as CIFAR100 is even higher. Spikformer-4-384 $( 7 7 . 8 6 \%$ , 9.32M) obtains a significant improvement of $2 . 5 1 \%$ compared with ResNet-19 ANN $( 7 5 . 3 5 \%$ , 12.63M) model. The ANN-Transformer model is $1 . 5 4 \%$ and $3 . 1 6 \%$ higher than Spikformer-4-384, respectively. As shown in appendix D.5, transfer learning can achieve higher performance on CIFAR based on pre-trained Spikformer, which demonstrates high transfer ability.
|
| 145 |
+
|
| 146 |
+
# 4.2 NEUROMORPHIC DATASETS CLASSIFICATION
|
| 147 |
+
|
| 148 |
+
DVS128 Gesture is a gesture recognition dataset that contains 11 hand gesture categories from 29 individuals under 3 illumination conditions. CIFAR10-DVS is also a neuromorphic dataset converted from the static image dataset by shifting image samples to be captured by the DVS camera, which provides 9, 000 training samples and 1, 000 test samples.
|
| 149 |
+
|
| 150 |
+
For the above two datasets of image size $1 2 8 \times 1 2 8$ , we adopt a four-block SPS. The patch embedding dimension is 256 and the patch size is $1 6 \times 1 6$ . We use a shallow Spikformer with 2 transformer encoder blocks. The SSA contains 8 and 16 heads for DVS128 Gesture and CIFAR10-DVS, respectively. The time-step of the spiking neuron is 10 or 16. The training epoch is 200 for DVS128 Gesture and 106 for CIFAR10-DVS. The optimizer is AdamW and the batch size is set to 16. The learning rate is initialized to 0.1 and reduced with cosine decay. We apply data augmentation on CIFAR10-DVS according to (Li et al., 2022). We use a learnable parameter as the scaling factor to control the $Q K ^ { \mathrm { T } } V$ result.
|
| 151 |
+
|
| 152 |
+
The classification performance of Spikformer as well as the compared state-of-the-art models on neuromorphic datasets is shown in Tab. 4. It can be seen that our model achieves good performance on both datasets by using a 2.59M model. On DVS128 Gesture, we obtain an accuracy of $9 8 . 2 \%$ with 16-time steps, which is higher than SEW-ResNet $( 9 7 . 9 \% )$ ). Our result is also competitive compared with TA-SNN $( 9 8 . 6 \%$ , 60 time steps) (Yao et al., 2021) which uses floating-point spikes in the forward propagation. On CIFAR10-DVS, we achieve a $1 . 6 \%$ and $3 . 6 \%$ better accuracy than the SOTA methods DSR $( 7 7 . 3 \% )$ with binary spikes using 10 steps and 16 steps respectively. TET is not an architecture-based but a loss-based method which achieves $8 3 . 2 \%$ using long epochs (300) and 9.27M VGGSNN, so we do not compare with it in the table.
|
| 153 |
+
|
| 154 |
+
# 4.3 ABLATION STUDY
|
| 155 |
+
|
| 156 |
+
Time step The accuracy regarding different simulation time steps of the spike neuron is shown in Tab. 5. When the time step is 1, our method is $1 . 8 7 \%$ lower than the network with $T = 4$ on CIFAR10.
|
| 157 |
+
|
| 158 |
+
Table 4: Performance comparison to the state-of-the-art (SOTA) methods on two neuromorphic datasets. Bold font means the best; ∗ denotes with Data Augmentation.
|
| 159 |
+
|
| 160 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Spikes</td><td colspan="2">CIFAR10-DVS</td><td colspan="2">DVS128</td></tr><tr><td>T Step</td><td>Acc</td><td>T Step</td><td>Acc</td></tr><tr><td>LIAF-Net (Wu et al.,2021)TNNLs-2021</td><td>X</td><td>10</td><td>70.4</td><td>60</td><td>97.6</td></tr><tr><td>TA-SNN(Ya etal,2021)C02</td><td>×</td><td>10</td><td>72.0</td><td>60</td><td>98.6</td></tr><tr><td>Rollout (Kugeleetal.,)Fronteros</td><td>√</td><td>48</td><td>66.8</td><td>240</td><td>97.2</td></tr><tr><td>DECOLLE(Kaiser etal.,202O)Front eurosci-200</td><td>√</td><td>1</td><td>1</td><td>500</td><td>95.5</td></tr><tr><td>tdBN (Zheng et al.,2021)AAAl-2021</td><td>√</td><td>10</td><td>67.8</td><td>40</td><td>96.9</td></tr><tr><td>PLIF F(Fang et al.,2021b)ICCV-2021</td><td>√</td><td>20</td><td>74.8</td><td>20</td><td>97.6</td></tr><tr><td>SEW-ResNet (Fang et al.,2021a)NeurIPS-2021</td><td><</td><td>16</td><td>74.4</td><td>16</td><td>97.9</td></tr><tr><td>Dspike (Li etal.,2021)NeurIPS-2021</td><td>√</td><td>10</td><td>75.4*</td><td>1</td><td>-</td></tr><tr><td>SALT (Kim & Panda,2021)Neural Netw-2021</td><td>√</td><td>20</td><td>67.1</td><td>-</td><td>-</td></tr><tr><td>DSR (Meng et al.,2022)CVPR-2022</td><td>√</td><td>10</td><td>77.3*</td><td>-</td><td>1</td></tr><tr><td rowspan="2">Spikformer</td><td></td><td>10</td><td>78.9*</td><td>10</td><td>96.9</td></tr><tr><td>:</td><td>16</td><td>80.9*</td><td>16</td><td>98.3</td></tr></table>
|
| 161 |
+
|
| 162 |
+
Spikformer-8-512 with 1 time step still achieves $7 0 . 1 4 \%$ . The above results show Spikformer is robust under low latency (fewer time steps) conditions.
|
| 163 |
+
|
| 164 |
+
SSA We conduct ablation studies on SSA to further identify its advantage. We first test its effect by replacing SSA with standard vanilla self-attention. We test two cases where Value is in floating point form (Spikformer-L- $. D _ { w }$ VSA $\mathrm { V } _ { \mathcal { F } }$ ) and in spike form (Spikformer- $L \mathrm { - } D _ { w }$ VSA).
|
| 165 |
+
|
| 166 |
+
We also test the different attention variants on ImageNet following Tab. 1. On CIFAR10, the performance of Spikformer with SSA is competitive compared to Spikformer- $4 \mathrm { - } 3 8 4 _ { w }$ VSA and even Spikformer- $4 { - } 3 8 4 _ { w }$ VSA $\mathrm { v } _ { \mathcal { F } }$ . On ImageNet, our Spikformer- $8 - 5 1 2 _ { w }$ SSA outperforms Spikformer- $8 - 5 1 2 _ { w }$ VSA by $\mathrm { { \bar { 0 } . 6 8 \% } }$ . On CIFAR100 and ImageNet, the accuracy of Spikformer- $L$ - $D _ { w }$ VSA $\mathrm { v } _ { \mathcal { F } }$ is better than Spikformer because of the float-point-form Value. The reason why the Spikformer$8 – 5 1 2 _ { w \mathrm { ~ I ~ } }$ , Spikformer- $8 – 5 1 2 _ { w }$ ReLU, and Spikformer- $\cdot 8 - 5 1 2 _ { w }$ LeakyReLU do
|
| 167 |
+
|
| 168 |
+
Table 5: Ablation study results on SSA, and time step.
|
| 169 |
+
|
| 170 |
+
<table><tr><td>Datasets</td><td>Models</td><td>Time Step</td><td>Topl-Acc (%)</td></tr><tr><td rowspan="2"></td><td>CIFAR10/100 Spikformer-4-384 sSA</td><td>1246</td><td>93.51/74.36 93.59/76.28 95.19/77.86 95.34/78.61</td></tr><tr><td>Spikformer-4-384w VSA Spikformer-4-384wVSAVF</td><td>4 4</td><td>94.97/77.92 95.17/78.37</td></tr><tr><td>ImageNet</td><td>Spikformer-8-512wI Spikformer-8-512w ReLU Spikformer-8-512wLeakyReLU Spikformer-8-512w VSA Spikformer-8-512w VSA VF</td><td>4 4 4 4 4</td><td>X X 72.70 73.96</td></tr></table>
|
| 171 |
+
|
| 172 |
+
not converge is that the value of dot-product value of Query, Key, and Value is large, which makes the surrogate gradient of the output spike neuron layer disappear. More details are in the appendix D.4. In comparison, the dot-product value of the designed SSA is in a controllable range, which is determined by the sparse spike-form $Q$ , $K$ and $V$ , and makes Spikformer $\dot { } _ { w }$ SSA easy to converge.
|
| 173 |
+
|
| 174 |
+
# 5 CONCLUSION
|
| 175 |
+
|
| 176 |
+
In this work we explored the feasibility of implementing the self-attention mechanism and Transformer in Spiking Neuron Networks and propose Spikformer based on a new Spiking Self-Attention (SSA). Unlike the vanilla self-attention mechanism in ANNs, SSA is specifically designed for SNNs and spike data. We drop the complex operation of softmax in SSA, and instead perform matrix dotproduct directly on spike-form Query, Key, and Value, which is efficient and avoids multiplications. In addition, this simple self-attention mechanism makes Spikformer work surprisingly well on both static and neuromorphic datasets. With directly training from scratch, Spiking Transformer outperforms the state-of-the-art SNNs models. We hope our investigations pave the way for further research on transformer-based SNNs models.
|
| 177 |
+
|
| 178 |
+
# REPRODUCIBILITY STATEMENT
|
| 179 |
+
|
| 180 |
+
Our codes are based on SpikingJelly(Fang et al., 2020), an open-source SNN framework, and Pytorch image models library (Timm)(Wightman, 2019). The experimental results in this paper are reproducible. We explain the details of model training and dataset augmentation in the main text and supplement it in the appendix. Our codes of Spikformer models are uploaded as supplementary material and will be available on GitHub after review.
|
| 181 |
+
|
| 182 |
+
# ACKNOWLEDGEMENTS
|
| 183 |
+
|
| 184 |
+
This work is supported by Nature Science Foundation of China (No.62202014 and No.62006007), Shenzhen Basic Research Program (No.JCYJ20220813151736001), and the National Innovation 2030 Major ST Project of China (No.2020AAA0104203).
|
| 185 |
+
|
| 186 |
+
# REFERENCES
|
| 187 |
+
|
| 188 |
+
Arnon Amir, Brian Taba, David Berg, Timothy Melano, Jeffrey McKinstry, Carmelo Di Nolfo, Tapan Nayak, Alexander Andreopoulos, Guillaume Garreau, Marcela Mendoza, Jeff Kusnitz, Michael Debole, Steve Esser, Tobi Delbruck, Myron Flickner, and Dharmendra Modha. A low power, fully event-based gesture recognition system. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 7243–7252, 2017.
|
| 189 |
+
|
| 190 |
+
Tong Bu, Wei Fang, Jianhao Ding, PengLin Dai, Zhaofei Yu, and Tiejun Huang. Optimal ann-snn conversion for high-accuracy and ultra-low-latency spiking neural networks. In International Conference on Learning Representations (ICLR), 2021.
|
| 191 |
+
|
| 192 |
+
Yongqiang Cao, Yang Chen, and Deepak Khosla. Spiking deep convolutional neural networks for energy-efficient object recognition. International Journal of Computer Vision, 113(1):54–66, 2015.
|
| 193 |
+
|
| 194 |
+
Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 213–229. Springer, 2020.
|
| 195 |
+
|
| 196 |
+
Charlotte Caucheteux and Jean-Remi King. Brains and algorithms partially converge in natural ´ language processing. Communications biology, 5(1):1–10, 2022.
|
| 197 |
+
|
| 198 |
+
Hanting Chen, Yunhe Wang, Tianyu Guo, Chang Xu, Yiping Deng, Zhenhua Liu, Siwei Ma, Chunjing Xu, Chao Xu, and Wen Gao. Pre-trained image processing transformer. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 12299–12310, 2021.
|
| 199 |
+
|
| 200 |
+
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.
|
| 201 |
+
|
| 202 |
+
Xiangxiang Chu, Zhi Tian, Yuqing Wang, Bo Zhang, Haibing Ren, Xiaolin Wei, Huaxia Xia, and Chunhua Shen. Twins: Revisiting the design of spatial attention in vision transformers. In Proceedings of the International Conference on Neural Information Processing Systems (NeurIPS), volume 34, pp. 9355–9366, 2021.
|
| 203 |
+
|
| 204 |
+
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 248–255, 2009.
|
| 205 |
+
|
| 206 |
+
Shikuang Deng, Yuhang Li, Shanghang Zhang, and Shi Gu. Temporal Efficient Training of Spiking Neural Network via Gradient Re-weighting. In International Conference on Learning Representations (ICLR), 2021.
|
| 207 |
+
|
| 208 |
+
Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representa- tions (ICLR), 2020.
|
| 209 |
+
|
| 210 |
+
Wei Fang, Yanqi Chen, Jianhao Ding, Ding Chen, Zhaofei Yu, Huihui Zhou, Yonghong Tian, and other contributors. Spikingjelly. https://github.com/fangwei123456/spikingjelly, 2020. Accessed: YYYY-MM-DD.
|
| 211 |
+
|
| 212 |
+
Wei Fang, Zhaofei Yu, Yanqi Chen, Tiejun Huang, Timothee Masquelier, and Yonghong Tian. Deep ´ Residual Learning in Spiking Neural Networks. In Proceedings of the International Conference on Neural Information Processing Systems (NeurIPS), volume 34, pp. 21056–21069, 2021a.
|
| 213 |
+
|
| 214 |
+
Wei Fang, Zhaofei Yu, Yanqi Chen, Timothee Masquelier, Tiejun Huang, and Yonghong Tian. ´ Incorporating learnable membrane time constant to enhance learning of spiking neural networks. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 2661– 2671, 2021b.
|
| 215 |
+
|
| 216 |
+
Bing Han, Gopalakrishnan Srinivasan, and Kaushik Roy. Rmp-snn: Residual membrane potential neuron for enabling deeper high-accuracy and low-latency spiking neural network. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 13558– 13567, 2020.
|
| 217 |
+
|
| 218 |
+
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.
|
| 219 |
+
|
| 220 |
+
Mark Horowitz. 1.1 computing’s energy problem (and what we can do about it). In 2014 IEEE International Solid-State Circuits Conference Digest of Technical Papers (ISSCC), pp. 10–14. IEEE, 2014.
|
| 221 |
+
|
| 222 |
+
Yangfan Hu, Huajin Tang, and Gang Pan. Spiking deep residual networks. IEEE Transactions on Neural Networks and Learning Systems, pp. 1–6, 2021a. doi: 10.1109/TNNLS.2021.3119238.
|
| 223 |
+
|
| 224 |
+
Yifan Hu, Yujie Wu, Lei Deng, and Guoqi Li. Advancing residual learning towards powerful deep spiking neural networks. arXiv preprint arXiv:2112.08954, 2021b.
|
| 225 |
+
|
| 226 |
+
Eric Hunsberger and Chris Eliasmith. Spiking deep networks with lif neurons. arXiv preprint arXiv:1510.08829, 2015.
|
| 227 |
+
|
| 228 |
+
Jacques Kaiser, Hesham Mostafa, and Emre Neftci. Synaptic Plasticity Dynamics for Deep Continuous Local Learning (DECOLLE). Frontiers in Neuroscience, 14:424, 2020. doi: 10.3389/fnins.2020.00424.
|
| 229 |
+
|
| 230 |
+
Angelos Katharopoulos, Apoorv Vyas, Nikolaos Pappas, and Franc¸ois Fleuret. Transformers are rnns: Fast autoregressive transformers with linear attention. In Proceedings of the 37th International Conference on Machine Learning (ICML), pp. 5156–5165, 2020.
|
| 231 |
+
|
| 232 |
+
Youngeun Kim and Priyadarshini Panda. Optimizing Deeper Spiking Neural Networks for Dynamic Vision Sensing. Neural Networks, 144:686–698, 2021.
|
| 233 |
+
|
| 234 |
+
Alex Krizhevsky. Learning multiple layers of features from tiny images. 2009.
|
| 235 |
+
|
| 236 |
+
Alexander Kugele, Thomas Pfeil, Michael Pfeiffer, and Elisabetta Chicca. Efficient Processing of Spatio-temporal Data Streams with Spiking Neural Networks. Frontiers in Neuroscience, 14:439, 2020.
|
| 237 |
+
|
| 238 |
+
Souvik Kundu, Gourav Datta, Massoud Pedram, and Peter A Beerel. Spike-thrift: Towards energyefficient deep spiking neural networks by limiting spiking activity via attention-guided compression. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision (WACV), pp. 3953–3962, 2021a.
|
| 239 |
+
|
| 240 |
+
Souvik Kundu, Massoud Pedram, and Peter A Beerel. Hire-snn: Harnessing the inherent robustness of energy-efficient deep spiking neural networks by training with crafted input noise. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 5209–5218, 2021b.
|
| 241 |
+
|
| 242 |
+
Chankyu Lee, Syed Shakib Sarwar, Priyadarshini Panda, Gopalakrishnan Srinivasan, and Kaushik Roy. Enabling spike-based backpropagation for training deep neural network architectures. Frontiers in neuroscience, 14:119, 2020.
|
| 243 |
+
|
| 244 |
+
Jun Haeng Lee, Tobi Delbruck, and Michael Pfeiffer. Training deep spiking neural networks using backpropagation. Frontiers in neuroscience, 10:508, 2016.
|
| 245 |
+
|
| 246 |
+
Hongmin Li, Hanchao Liu, Xiangyang Ji, Guoqi Li, and Luping Shi. Cifar10-dvs: an event-stream dataset for object classification. Frontiers in neuroscience, 11:309, 2017.
|
| 247 |
+
|
| 248 |
+
Yuhang Li, Yufei Guo, Shanghang Zhang, Shikuang Deng, Yongqing Hai, and Shi Gu. Differentiable Spike: Rethinking Gradient-Descent for Training Spiking Neural Networks. In Proceedings of the International Conference on Neural Information Processing Systems (NeurIPS), volume 34, pp. 23426–23439, 2021.
|
| 249 |
+
|
| 250 |
+
Yuhang Li, Youngeun Kim, Hyoungseob Park, Tamar Geller, and Priyadarshini Panda. Neuromorphic data augmentation for training spiking neural networks. arXiv preprint arXiv:2203.06145, 2022.
|
| 251 |
+
|
| 252 |
+
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 (ICCV), pp. 10012–10022, 2021.
|
| 253 |
+
|
| 254 |
+
Ali Lotfi Rezaabad and Sriram Vishwanath. Long short-term memory spiking networks and their applications. In Proceedings of the International Conference on Neuromorphic Systems 2020 (ICONS), pp. 1–9, 2020.
|
| 255 |
+
|
| 256 |
+
Wolfgang Maass. Networks of spiking neurons: the third generation of neural network models. Neural networks, 10(9):1659–1671, 1997.
|
| 257 |
+
|
| 258 |
+
Qingyan Meng, Mingqing Xiao, Shen Yan, Yisen Wang, Zhouchen Lin, and Zhi-Quan Luo. Training High-Performance Low-Latency Spiking Neural Networks by Differentiation on Spike Representation. ArXiv preprint arXiv:2205.00459, 2022.
|
| 259 |
+
|
| 260 |
+
Paul A Merolla, John V Arthur, Rodrigo Alvarez-Icaza, Andrew S Cassidy, Jun Sawada, Filipp Akopyan, Bryan L Jackson, Nabil Imam, Chen Guo, Yutaka Nakamura, et al. A million spikingneuron integrated circuit with a scalable communication network and interface. Science, 345 (6197):668–673, 2014.
|
| 261 |
+
|
| 262 |
+
Etienne Mueller, Viktor Studenyak, Daniel Auge, and Alois Knoll. Spiking transformer networks: A rate coded approach for processing sequential data. In 2021 7th International Conference on Systems and Informatics (ICSAI), pp. 1–5. IEEE, 2021.
|
| 263 |
+
|
| 264 |
+
Emre O Neftci, Hesham Mostafa, and Friedemann Zenke. Surrogate gradient learning in spiking neural networks: Bringing the power of gradient-based optimization to spiking neural networks. IEEE Signal Processing Magazine, 36(6):51–63, 2019.
|
| 265 |
+
|
| 266 |
+
Priyadarshini Panda, Sai Aparna Aketi, and Kaushik Roy. Toward scalable, efficient, and accurate deep spiking neural networks with backward residual connections, stochastic softmax, and hybridization. Frontiers in Neuroscience, 14:653, 2020.
|
| 267 |
+
|
| 268 |
+
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 Proceedings of the International Conference on Neural Information Processing Systems (NeurIPS), volume 32, 2019.
|
| 269 |
+
|
| 270 |
+
Zhen Qin, Weixuan Sun, Hui Deng, Dongxu Li, Yunshen Wei, Baohong Lv, Junjie Yan, Lingpeng Kong, and Yiran Zhong. cosformer: Rethinking softmax in attention. arXiv preprint arXiv:2202.08791, 2022.
|
| 271 |
+
|
| 272 |
+
Yongming Rao, Wenliang Zhao, Benlin Liu, Jiwen Lu, Jie Zhou, and Cho-Jui Hsieh. Dynamicvit: Efficient vision transformers with dynamic token sparsification. In Proceedings of the International Conference on Neural Information Processing Systems (NeurIPS), volume 34, pp. 13937–13949, 2021.
|
| 273 |
+
|
| 274 |
+
Nitin Rathi and Kaushik Roy. Diet-snn: Direct input encoding with leakage and threshold optimization in deep spiking neural networks. arXiv preprint arXiv:2008.03658, 2020.
|
| 275 |
+
|
| 276 |
+
Nitin Rathi, Gopalakrishnan Srinivasan, Priyadarshini Panda, and Kaushik Roy. Enabling deep spiking neural networks with hybrid conversion and spike timing dependent backpropagation. arXiv preprint arXiv:2005.01807, 2020.
|
| 277 |
+
|
| 278 |
+
Kaushik Roy, Akhilesh Jaiswal, and Priyadarshini Panda. Towards spike-based machine intelligence with neuromorphic computing. Nature, 575(7784):607–617, 2019.
|
| 279 |
+
|
| 280 |
+
Bodo Rueckauer, Iulia-Alexandra Lungu, Yuhuang Hu, Michael Pfeiffer, and Shih-Chii Liu. Conversion of continuous-valued deep networks to efficient event-driven networks for image classification. Frontiers in neuroscience, 11:682, 2017.
|
| 281 |
+
|
| 282 |
+
Sumit B Shrestha and Garrick Orchard. Slayer: Spike layer error reassignment in time. In Proceedings of the International Conference on Neural Information Processing Systems (NeurIPS), volume 31, 2018.
|
| 283 |
+
|
| 284 |
+
Jeong-geun Song. Ufo-vit: High performance linear vision transformer without softmax. arXiv preprint arXiv:2109.14382, 2021.
|
| 285 |
+
|
| 286 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Proceedings of the International Conference on Neural Information Processing Systems (NeurIPS), volume 30, 2017.
|
| 287 |
+
|
| 288 |
+
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 (ICCV), pp. 568–578, 2021.
|
| 289 |
+
|
| 290 |
+
Yuchen Wang, Malu Zhang, Yi Chen, and Hong Qu. Signed neuron with memory: Towards simple, accurate and high-efficient ann-snn conversion. In International Joint Conference on Artificial Intelligence, 2022.
|
| 291 |
+
|
| 292 |
+
James C. R. Whittington, Joseph Warren, and Tim E.J. Behrens. Relating transformers to models and neural representations of the hippocampal formation. In International Conference on Learning Representations (ICLR), 2022. URL https://openreview.net/forum?id $=$ B8DVo9B1YE0.
|
| 293 |
+
|
| 294 |
+
Ross Wightman. Pytorch image models. https://github.com/rwightman/ pytorch-image-models, 2019.
|
| 295 |
+
|
| 296 |
+
Yujie Wu, Lei Deng, Guoqi Li, Jun Zhu, and Luping Shi. Spatio-temporal backpropagation for training high-performance spiking neural networks. Frontiers in neuroscience, 12:331, 2018.
|
| 297 |
+
|
| 298 |
+
Yujie Wu, Lei Deng, Guoqi Li, Jun Zhu, Yuan Xie, and Luping Shi. Direct Training for Spiking Neural Networks: Faster, Larger, Better. In Proceedings of the AAAI Conference on Artificial Intelligence (AAAI), pp. 1311–1318, 2019. doi: 10.1609/aaai.v33i01.33011311.
|
| 299 |
+
|
| 300 |
+
Zhenzhi Wu, Hehui Zhang, Yihan Lin, Guoqi Li, Meng Wang, and Ye Tang. LIAF-Net: Leaky Integrate and Analog Fire Network for Lightweight and Efficient Spatiotemporal Information Processing. IEEE Transactions on Neural Networks and Learning Systems, pp. 1–14, 2021. doi: 10.1109/TNNLS.2021.3073016.
|
| 301 |
+
|
| 302 |
+
Mingqing Xiao, Qingyan Meng, Zongpeng Zhang, Yisen Wang, and Zhouchen Lin. Training feedback spiking neural networks by implicit differentiation on the equilibrium state. volume 34, pp. 14516–14528, 2021a.
|
| 303 |
+
|
| 304 |
+
Tete Xiao, Mannat Singh, Eric Mintun, Trevor Darrell, Piotr Dollar, and Ross Girshick. Early ´ convolutions help transformers see better. In Proceedings of the International Conference on Neural Information Processing Systems (NeurIPS), volume 34, pp. 30392–30400, 2021b.
|
| 305 |
+
|
| 306 |
+
Jianwei Yang, Chunyuan Li, Pengchuan Zhang, Xiyang Dai, Bin Xiao, Lu Yuan, and Jianfeng Gao. Focal attention for long-range interactions in vision transformers. In Proceedings of the International Conference on Neural Information Processing Systems (NeurIPS), volume 34, pp. 30008–30022, 2021.
|
| 307 |
+
|
| 308 |
+
Man Yao, Huanhuan Gao, Guangshe Zhao, Dingheng Wang, Yihan Lin, Zhaoxu Yang, and Guoqi Li. Temporal-wise attention spiking neural networks for event streams classification. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 10221–10230, 2021.
|
| 309 |
+
|
| 310 |
+
Man Yao, Guangshe Zhao, Hengyu Zhang, Yifan Hu, Lei Deng, Yonghong Tian, Bo Xu, and Guoqi Li. Attention spiking neural networks. arXiv preprint arXiv:2209.13929, 2022.
|
| 311 |
+
|
| 312 |
+
Bojian Yin, Federico Corradi, and Sander M Bohte. Accurate and efficient time-domain classification ´ with adaptive spiking recurrent neural networks. Nature Machine Intelligence, 3(10):905–913, 2021.
|
| 313 |
+
|
| 314 |
+
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 (ICCV), pp. 558–567, 2021a.
|
| 315 |
+
|
| 316 |
+
Li Yuan, Qibin Hou, Zihang Jiang, Jiashi Feng, and Shuicheng Yan. Volo: Vision outlooker for visual recognition. arXiv preprint arXiv:2106.13112, 2021b.
|
| 317 |
+
|
| 318 |
+
Jiqing Zhang, Bo Dong, Haiwei Zhang, Jianchuan Ding, Felix Heide, Baocai Yin, and Xin Yang. Spiking transformers for event-based single object tracking. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 8801–8810, 2022a.
|
| 319 |
+
|
| 320 |
+
Jiyuan Zhang, Lulu Tang, Zhaofei Yu, Jiwen Lu, and Tiejun Huang. Spike transformer: Monocular depth estimation for spiking camera. In Proceedings of the European Conference on Computer Vision (ECCV), 2022b.
|
| 321 |
+
|
| 322 |
+
Wenrui Zhang and Peng Li. Temporal spike sequence learning via backpropagation for deep spiking neural networks. In Proceedings of the International Conference on Neural Information Processing Systems (NeurIPS), volume 33, pp. 12022–12033, 2020.
|
| 323 |
+
|
| 324 |
+
Hanle Zheng, Yujie Wu, Lei Deng, Yifan Hu, and Guoqi Li. Going Deeper With Directly-Trained Larger Spiking Neural Networks. In Proceedings of the AAAI Conference on Artificial Intelligence (AAAI), pp. 11062–11070, 2021.
|
| 325 |
+
|
| 326 |
+
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.
|
| 327 |
+
|
| 328 |
+
Zulun Zhu, Jiaying Peng, Jintang Li, Liang Chen, Qi Yu, and Siqiang Luo. Spiking graph convolutional networks. In Proceedings of the Thirty-First International Joint Conference on Artificial Intelligence (IJCAI), pp. 2434–2440, 2022. doi: 10.24963/ijcai.2022/338.
|
| 329 |
+
|
| 330 |
+
# APPENDIX
|
| 331 |
+
|
| 332 |
+
# A MULTIHEAD SPIKING SELF ATTENTION
|
| 333 |
+
|
| 334 |
+
In practice, we reshape the $Q , K , V \in \mathbb { R } ^ { T \times N \times D }$ into multi-head form $\mathbb { R } ^ { T \times H \times N \times d }$ , where $D =$ $H \times d$ . Then we split $Q , K , V$ into $H$ parts and run $H$ SSA operations, in parallel, which are called $H$ -head SSA. The Multihead Spiking Self Attention (MSSA) is shown in follows:
|
| 335 |
+
|
| 336 |
+
$$
|
| 337 |
+
Q = ( q _ { 1 } , q _ { 2 } , \cdots , q _ { H } ) , K = ( k _ { 1 } , k _ { 2 } , \cdots , k _ { H } ) , V = ( v _ { 1 } , v _ { 2 } , \cdots , v _ { H } ) \quad q , k , v \in \mathbb { R } ^ { T \times N \times d }
|
| 338 |
+
$$
|
| 339 |
+
|
| 340 |
+
$$
|
| 341 |
+
\mathrm { M S S A } ^ { \prime } ( Q , K , V ) = [ \mathrm { S S A } _ { 1 } ^ { \prime } ( q _ { 1 } , k _ { 1 } , v _ { 1 } ) ; \mathrm { S S A } _ { 2 } ^ { \prime } ( q _ { 2 } , k _ { 2 } , v _ { 2 } ) ; \cdots ; \mathrm { S S A } _ { h } ^ { \prime } ( q _ { H } , k _ { H } , v _ { H } ) ]
|
| 342 |
+
$$
|
| 343 |
+
|
| 344 |
+
$$
|
| 345 |
+
\mathrm { M S S A } ( Q , K , V ) = \mathcal { S } \mathcal { N } ( \mathrm { B N } ( \mathrm { L i n e a r } ( \mathrm { M S S A } ^ { \prime } ( Q , K , V ) ) ) )
|
| 346 |
+
$$
|
| 347 |
+
|
| 348 |
+
# B SPIKING SELF ATTENTION AND TIME STEP
|
| 349 |
+
|
| 350 |
+
In practice, $T$ is a independent dimension for spike neuron layer. In other layers, it is merged with the batch size.
|
| 351 |
+
|
| 352 |
+
# C EXPERIMENT DETAILS
|
| 353 |
+
|
| 354 |
+
# C.1 TRAINING
|
| 355 |
+
|
| 356 |
+
Unlike the standard ViT, Dropout and Droppath are not applied in Spikformer. We remove the layer norm before each self-attention and MLP block, and add batch norm after each linear layer instead. In all Spikformer models, the hidden dimension of MLP blocks is $4 \times D$ , where $D$ is the embedding dimension. As in Eq. (20), we select the Sigmoid function as the surrogate function with $\alpha = 4$ .
|
| 357 |
+
|
| 358 |
+
$$
|
| 359 |
+
{ \mathrm { S i g m o i d } } ( x ) = { \frac { 1 } { 1 + \exp \left( - \alpha x \right) } }
|
| 360 |
+
$$
|
| 361 |
+
|
| 362 |
+
For DVS128 Gesture, we place a 1D max-pooling layer after $Q$ and $K$ to increase the density of the data, which improves the accuracy from $9 7 . 9 \%$ to $9 8 . 3 \%$ in 16 time steps. We set the threshold voltage $V _ { t h }$ of the spike neuron layer after $Q K ^ { \mathrm { T } } V * s$ to 0.5, while the others are set to 1.
|
| 363 |
+
|
| 364 |
+
# C.2 THEORETICAL SYNAPTIC OPERATION AND ENERGY CONSUMPTION CALCULATION
|
| 365 |
+
|
| 366 |
+
The calculation of theoretical energy consumption requires first calculating the synaptic operations:
|
| 367 |
+
|
| 368 |
+
$$
|
| 369 |
+
\mathrm { S O P s } ( { l } ) = f r \times T \times \mathrm { F L O P s } ( { l } )
|
| 370 |
+
$$
|
| 371 |
+
|
| 372 |
+
where $l$ is a block/layer in Spikformer, $f r$ is the firing rate of the input spike train of the block/layer and $T$ is the simulation time step of spike neuron. $\mathrm { F L O P s } ( l )$ refers to floating point operations of $l$ , which is the number of multiply-and-accumulate (MAC) operations. And SOPs is the number of spike-based accumulate (AC) operations. We estimate the theoretical energy consumption of Spikformer according to (Kundu et al., 2021b; Hu et al., 2021b; Horowitz, 2014; Kundu et al., 2021a; Yin et al., 2021; Panda et al., 2020; Yao et al., 2022). We assume that the MAC and AC operations are implemented on the $4 5 \mathrm { n m }$ hardware [12], where $E _ { M A C } = 4 . 6 p J$ and $E _ { A C } = 0 . 9 p J$ . The theoretical energy consumption of Spikformer is calculated:
|
| 373 |
+
|
| 374 |
+
$$
|
| 375 |
+
\begin{array} { l } { { \displaystyle E _ { S p i k f o r m e r } = E _ { M A C } \times { \mathrm { F L } } _ { \mathrm { S N N ~ C o n v } } ^ { 1 } } } \\ { { \displaystyle \phantom { \sum } + E _ { A C } \times \left( \sum _ { n = 2 } ^ { N } \mathrm { S O P } _ { \mathrm { S N N ~ C o n v } } ^ { n } + \sum _ { m = 1 } ^ { M } \mathrm { S O P } _ { \mathrm { S N N ~ F C } } ^ { m } + \sum _ { l = 1 } ^ { L } \mathrm { S O P } _ { \mathrm { S S A } } ^ { l } \right) } } \end{array}
|
| 376 |
+
$$
|
| 377 |
+
|
| 378 |
+
where $\mathrm { F L } _ { S N N \ C o n v } ^ { 1 }$ is the first layer to encode static RGB images into spike-form. Then the SOPs of $m$ SNN Conv layers, $n$ SNN Fully Connected Layer (FC) and $l$ SSA are added together and multiplied by $E _ { A C }$ . For ANNs, the theoretical energy consumption of block $b$ is calculated:
|
| 379 |
+
|
| 380 |
+
$$
|
| 381 |
+
\mathrm { P o w e r } ( b ) = 4 . 6 p J \times \mathrm { F L O P s } ( b )
|
| 382 |
+
$$
|
| 383 |
+
|
| 384 |
+
For SNNs, Power $( b )$ is:
|
| 385 |
+
|
| 386 |
+
$$
|
| 387 |
+
\mathrm { P o w e r } ( b ) = 0 . 9 p J \times \mathrm { S O P s } ( b )
|
| 388 |
+
$$
|
| 389 |
+
|
| 390 |
+

|
| 391 |
+
Figure 4: Fire rate of Query, Key and Value of blocks in Spikformer-8-512 on ImageNet test set.
|
| 392 |
+
|
| 393 |
+

|
| 394 |
+
Figure 5: Training loss, testing loss and test accuracy on ImageNet.
|
| 395 |
+
|
| 396 |
+
# D ADDITIONAL RESULTS
|
| 397 |
+
|
| 398 |
+
D.1 FIRE RATE OF QUERY, KEY AND VALUE
|
| 399 |
+
|
| 400 |
+
As shown in 4, the Query, Key and Value are very spare in SSA, causing sparse computation of SSA.
|
| 401 |
+
|
| 402 |
+
# D.2 LOSS AND ACCURACY ON IMAGENET
|
| 403 |
+
|
| 404 |
+
We show the training loss, testing loss and test accuracy of Spikformer in Figue. 5. Both training and testing losses decrease as the number of Spikformer blocks increases or the embedding dimension increases.
|
| 405 |
+
|
| 406 |
+
Table 6: Additional result on CIFAR10/100. Spikformer- $4 - 3 8 4 _ { w }$ IF uses the Integrate-and-Fire neuron.
|
| 407 |
+
|
| 408 |
+
<table><tr><td>Models</td><td>Time Step</td><td>Top1-Acc (%)</td></tr><tr><td>Spikformer-4-384w I</td><td>1</td><td>92.39/74.28</td></tr><tr><td>Spikformer-4-384w ReLU</td><td>1</td><td>92.98/74.32</td></tr><tr><td>Spikformer-4-384w LeakyReLU</td><td>1</td><td>92.88/74.31</td></tr><tr><td>Spikformer-4-384w VSA</td><td>1</td><td>93.11/74.37</td></tr><tr><td>Spikformer-4-384w IF</td><td>4</td><td>95.33/78.14</td></tr></table>
|
| 409 |
+
|
| 410 |
+
Table 7: Transfer Learning on CIFAR10/100.
|
| 411 |
+
|
| 412 |
+
<table><tr><td>Models</td><td>CIFAR10</td><td>CIFAR100</td></tr><tr><td>Spikformer-4-384</td><td>95.54</td><td>79.96</td></tr><tr><td>Spikformer-8-384</td><td>96.64</td><td>82.09</td></tr><tr><td>Spikformer-8-512</td><td>97.03</td><td>83.83</td></tr></table>
|
| 413 |
+
|
| 414 |
+
# D.3 ADDITIONAL ACCURACY RESULTS ON CIFAR
|
| 415 |
+
|
| 416 |
+
We conduct additional experiments on CIFAR as shown in Tab. 6.
|
| 417 |
+
|
| 418 |
+
# D.4 ANALYSIS OF SELF-ATTENTION VARIANTS NOT CONVERGING ON IMAGENET
|
| 419 |
+
|
| 420 |
+
The reason that the three models do not converge in Tab. 5 is explain as follows. As shown in Figure. 6 (a), the gradient of sigmoid surrogate function vanishes when the difference between the average input value $V _ { i }$ and the firing threshold $V _ { t h }$ is too large or too small. We collect the output value of $\Dot { Q } K ^ { \mathrm { T } } V * s$ after one training eopch of Spikformer- $8 – 5 1 2 _ { w \mathrm { ~ I ~ } }$ , Spikformer- $8 - 5 1 2 _ { w }$ ReLU, Spikformer- $8 – 5 1 2 _ { w }$ LeakyReLU, and Spikformer- $8 - 5 1 2 _ { w }$ SSA, which will be sent to the spike neuron layer as the input value $V _ { i }$ , as shown in Eq. (15). Compared to the other three variants, as shown in Figure. 6 (b), the value of $Q K ^ { \mathrm { T } } V * s$ in Spikformer- $8 – 5 1 2 _ { w }$ SSA is controlled in a suitable range. Therefore, SSA has stable surrogate gradients during training and converges easily.
|
| 421 |
+
|
| 422 |
+

|
| 423 |
+
Figure 6: (a) the sigmoid surrogate function and its gradient curve. (b) the value of $Q K ^ { \mathrm { T } } V$
|
| 424 |
+
|
| 425 |
+
# D.5 TRANSFER LEARNING
|
| 426 |
+
|
| 427 |
+
We transfer Spikformer to the downstream CIFAR dataset. The pre-trained Spikformer-4-384 and Spikformer-8-384/512 on ImageNet are finetuned with 60 epochs. The input size of CIFAR is $2 2 4 \times 2 2 4$ . The remaining hyperparameters are the same as the ones directly trained on CIFAR. As shown in Tab. 7, Spikformer shows high transfer ability.
|
md/dev/g1GnnCI1OrC/g1GnnCI1OrC.md
ADDED
|
@@ -0,0 +1,484 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# E-CRF: EMBEDDED CONDITIONAL RANDOM FIELD FOR BOUNDARY-CAUSED CLASS WEIGHTS CONFUSION IN SEMANTIC SEGMENTATION
|
| 2 |
+
|
| 3 |
+
Jie ${ \bf Z } { \bf h } { \bf u } ^ { 1 , 2 }$ Huabin Huang3 Banghuai $\mathbf { L i ^ { 3 } }$ Leye Wang1,2∗
|
| 4 |
+
|
| 5 |
+
Key Lab of High Confidence Software Technologies (Peking University), Ministry of Education, China1
|
| 6 |
+
School of Computer Science, Peking University, Beijing, China2
|
| 7 |
+
MEGVII Technology3
|
| 8 |
+
zhujie $@$ stu.pku.edu.cn, {huanghuabin1994, libanghuai} $@$ gmail.com, leyewang@pku.edu.cn
|
| 9 |
+
|
| 10 |
+
# ABSTRACT
|
| 11 |
+
|
| 12 |
+
Modern semantic segmentation methods devote much effect to adjusting image feature representations to improve the segmentation performance in various ways, such as architecture design, attention mechnism, etc. However, almost all those methods neglect the particularity of class weights (in the classification layer) in segmentation models. In this paper, we notice that the class weights of categories that tend to share many adjacent boundary pixels lack discrimination, thereby limiting the performance. We call this issue Boundary-caused Class Weights Confusion (BCWC). We try to focus on this problem and propose a novel method named Embedded Conditional Random Field (E-CRF) to alleviate it. E-CRF innovatively fuses the CRF into the CNN network as an organic whole for more effective end-to-end optimization. The reasons are two folds. It utilizes CRF to guide the message passing between pixels in high-level features to purify the feature representation of boundary pixels, with the help of inner pixels belonging to the same object. More importantly, it enables optimizing class weights from both scale and direction during backpropagation. We make detailed theoretical analysis to prove it. Besides, superpixel is integrated into E-CRF and served as an auxiliary to exploit the local object prior for more reliable message passing. Finally, our proposed method yields impressive results on ADE20K, Cityscapes, and Pascal Context datasets.
|
| 13 |
+
|
| 14 |
+
# 1 INTRODUCTION
|
| 15 |
+
|
| 16 |
+
Semantic segmentation plays an important role in practical applications such as autonomous driving, image editing, etc. Nowadays, numerous CNN-based methods (Chen et al., 2014; Fu et al., 2019; Ding et al., 2019) have been proposed. They attempt to adjust the image feature representation of the model itself to recognize each pixel correctly. However, almost all those methods neglect the particularity of class weights (in the classification layer) that play an important role in distinguishing pixel categories in segmentation models. Hence, it is critical to keep class weights discriminative. Unfortunately, CNN models have the natural defect for this. Generally speaking, most discriminative higher layers in the CNN network always have the larger receptive field, thus pixels around the boundary may obtain confusing features from both sides. As a result, these ambiguous boundary pixels will mislead the optimization direction of the model and make the class weights of such categories that tend to share adjacent pixels indistinguishable. For the convenience of illustration, we call this issue as Boundary-caused Class Weights Confusion (BCWC). We take Deeplab ${ \mathrm { V } } 3 +$ (Chen et al., 2018a) as an example to train on ADE20K (Zhou et al., 2017) dataset. Then, we count the number of adjacent pixels for each class pair and find a corresponding category that has the most adjacent pixels for each class. Fig 1(a) shows the similarity of the class weight between these pairs in descending order according to the number of adjacent pixels. It is clear that if two categories share more adjacent pixels, their class weights tend to be more similar, which actually indicates that BCWC makes class representations lack discrimination and damages the overall segmentation performance.
|
| 17 |
+
|
| 18 |
+
Previous works mainly aim to improve boundary pixel segmentation, but they seldom explicitly take class weights confusion i.e., BCWC, into consideration
|
| 19 |
+
|
| 20 |
+

|
| 21 |
+
Figure 1: (a) Observations on ADE20K. We find a corresponding category that shares the most adjacent pixels for each class and calculate the similarity of their class weights. X-axis stands for the number of adjacent pixels for each class pair in descending order, and Y-axis represents the similarity of their class weights. Blue line denotes baseline model while orange line denotes E-CRF. Apparently, two categories that share more adjacent pixels are inclined to have more similar class weights, while E-CRF effectively decreases the similarity between adjacent categories and makes their class weights more discriminative. (b) Message passing procedure of E-CRF. $F$ is the original feature maps of the CNN network. E-CRF utilizes pairwise module $\psi _ { p } ^ { f }$ and auxiliary superpixel-based module $\dot { \psi } _ { s } ^ { f }$ on $F$ to obtain refined feature maps $F ^ { p }$ and $F ^ { s }$ respectively. Then $F$ , $F ^ { p }$ and $F ^ { s }$ are fused as $F ^ { * }$ to further segment the image.
|
| 22 |
+
|
| 23 |
+
Considering the inherent drawback of CNN networks mentioned before, delving into the relationship between raw pixels becomes a potential alternative to eliminate the BCWC problem, and Conditional Random Field (CRF) (Chen et al., 2014) stands out. It is generally known that pixels of the same object tend to share similar characteristics in the local area. Intuitively, CRF utilizes the local consistency between original image pixels to refine the boundary segmentation results with the help of inner pixels of the same object. CRF makes some boundary pixels that are misclassified by the CNN network quite easy to be recognized correctly. But these CRF-based methods (Chen et al., 2014; Zhen et al., 2020a) only adopt CRF as an offline post-processing module, we call it Vanilla-CRF, to refine the final segmentation results. They are incapable of relieving BCWC problem as CRF and the CNN network are treated as two totally separate modules.
|
| 24 |
+
|
| 25 |
+
Based on Chen et al. (2014; 2017a), Lin et al. (2015); Arnab et al. (2016); Zheng et al. (2015) go a step further to unify the segmentation model and CRF in a single pipeline for end-to-end training. We call it Joint- $C R F$ for simplicity. Same as Vanilla-CRF, Joint-CRF inclines to rectify those misclassified boundary pixels via increasing the prediction score of the associated category, which means it still operates on the object class probabilities. But it can alleviate the BCWC problem to some extent as the probability score refined by CRF directly involves in the model backpropagation. Afterwards, the disturbing gradients caused by those pixels will be relieved, which will promote the class representation learning. However, as shown in Fig 3, the effectiveness of Joint-CRF is restricted as it only optimizes the scale of the gradient and lacks the ability to optimize class representations effectively due to the defective design. More theoretical analysis can be found in Sec. 3.3.
|
| 26 |
+
|
| 27 |
+
To overcome the aforementioned drawbacks, in this paper, we present a novel approach named Embedded CRF (E-CRF) to address the BCWC problem more effectively. The superiority of E-CRF lies in two main aspects. On the one hand, by fusing CRF mechanism into the segmentation model, E-CRF utilizes the local consistency among original image pixels to guide the message passing of high-level features. Each pixel pair that comes from the same object tends to obtain higher message passing weights. Therefore, the feature representation of the boundary pixels can be purified by the corresponding inner pixels from the same object. In turn, those pixels will further contribute to the discriminative class representation learning. On the other hand, it extends the fashion of optimizing class weights from one perspective (i.e., scale) to two (i.e., scale and direction) during backpropagation. In Sec. 3.3, we prove theoretically that E-CRF outperforms other CRF-based methods on eliminating the BCWC problem by optimizing both direction and scale of the disturbing gradient of class weights. However, during this process, the noise information can also have a direct influence on the class weights (likely to hinder the optimization for the BCWC problem). In addition, E-CRF adopts superpixel (Ren & Malik, 2003) as an auxiliary and leverage its local prior to suppress the noise and further strengthen the reliability of the message passing to the boundary pixels. Superpixel groups adjacent pixels that share similar characteristics to form a block. It is prone to achieve clear and smooth boundaries and increases the potential for higher segmentation performance. In E-CRF, we average the deep feature representation of all inner pixels in the same superpixel block and then add this local object prior to each pixel back to enhance the representation of boundary pixels.
|
| 28 |
+
|
| 29 |
+

|
| 30 |
+
Figure 2: Illustration of Joint-CRF and E-CRF. The first row is the simplified structure of Joint-CRF, which unifies the CNN network and CRF in a single pipeline for end-to-end training. However, CRF only serves as a post-processing module. The second row is the overview of our E-CRF, which fuses CRF into CNN network as an organic whole to eliminate BCWC problem.
|
| 31 |
+
|
| 32 |
+
In this work, we explicitly propose the BCWC problem in semantic segmentation and an effective approach to alleviate it. We conduct extensive experiments on three challenging semantic segmentation benchmarks, i.e., ADE20K (Zhou et al., 2017), Cityscapes (Cordts et al., 2016), and Pascal Context (Mottaghi et al., 2014), and yeild impressive results. For example, E-CRF outperforms baselines (Deeplab ${ \mathrm { V } } 3 +$ (Chen et al., 2018a) with ResNet-101 (He et al., 2016)) by $1 . 4 2 \%$ mIoU on ADE20K and ${ \bf 0 . 9 2 \% }$ mIoU on Cityscapes in single scale. In addition, we make an exhaustive theoretical analysis in Sec. 3.3 to prove the effectiveness of E-CRF. Code is available at https://github.com/JiePKU/E-CRF.
|
| 33 |
+
|
| 34 |
+
# 2 RELATED WORK
|
| 35 |
+
|
| 36 |
+
Semantic Segmentation. Fully convolutional network (FCN) (Long et al., 2015) based methods have made great progress in semantic segmentation by leveraging the powerful convolutional features of classification networks (He et al., 2016; Huang et al., 2017) pre-trained on large-scale data (Russakovsky et al., 2015). There are several model variants proposed to enhance contextual aggregation. For example, DeeplabV2 (Chen et al., 2017a) and DeeplabV3 (Chen et al., 2017b) take advantage of the astrous spatial pyramid pooling (ASPP) to embed contextual information, which consists of parallel dilated convolutions with different dilated rates to broaden the receptive field. Inspired by the encoder-decoder structures (Ronneberger et al., 2015; Ding et al., 2018), Deeplab ${ \bf V } 3 +$ (Chen et al., 2018a) adds a decoder upon DeeplabV3 to refine the segmentation results especially along object boundaries. With the success of self-attention mechanism in natural language processing, Non-local (Wang et al., 2018) first adopts self-attention mechanism as a module for computer vision tasks, such as video classification, object detection and instance segmentation. $\mathbf { A } ^ { 2 } \mathbf { N e t }$ (Chen et al., 2018b) proposes the double attention block to distribute and gather informative global features from the entire spatio-temporal space of the images.
|
| 37 |
+
|
| 38 |
+
Conditional Random Fields. Fully connected CRFs have been used for semantic image labeling in (Payet & Todorovic, 2010; Toyoda & Hasegawa, 2008), but inference complexity in fully connected models has restricted their application to sets of hundreds of image regions or fewer. To address this issue, densely connected pairwise potentials (Krähenbühl & Koltun, 2011) facilitate interactions between all pairs of image pixels based on a mean field approximation to the CRF distribution. Chen et al. (2014) show further improvements by post-processing the results of a CNN with a CRF. Subsequent works (Lin et al., 2015; Arnab et al., 2016; Zheng et al., 2015) have taken this idea further by incorporating a CRF as layers within a deep network and then learning parameters of both the CRF and CNN together via backpropagation. In terms of enhancements to conventional CRF models, Ladický et al. (2010) propose using an off-the-shelf object detector to provide additional cues for semantic segmentation.
|
| 39 |
+
|
| 40 |
+
Superpixel. Superpixel (Ren & Malik, 2003) is pixels with similar characteristics that are grouped together to form a large block. Since its introduction in 2003, there have been many mature algorithms (Achanta et al., 2012; Weikersdorfer et al., 2013; Van den Bergh et al., 2012). Owing to their representational and computational efficiency, superpixels are widely-used in computer vision algorithms such as target detection (Shu et al., 2013; Yan et al., 2015), semantic segmentation (Gould et al., 2008; Sharma et al., 2014; Gadde et al., 2016), and saliency estimation (He et al., 2015; Perazzi et al., 2012). Yan et al. (2015) convert object detection problem into superpixel labeling problem and conducts an energy function considering appearance, spatial context and numbers of labels. Gadde et al. (2016) use superpixels to change how information is stored in the higher level of a CNN. In (He et al., 2015), superpixels are taken as input and contextual information is recovered among superpixels, which enables large context to be involved in analysis.
|
| 41 |
+
|
| 42 |
+
We give a detailed discussion about the difference between E-CRF and three highly related works including PCGrad (Yu et al., 2020b), OCNet (Yuan & Wang, 2018), and SegFix (Yuan et al., 2020b) in Appendix A.5.
|
| 43 |
+
|
| 44 |
+
# 3 METHOD
|
| 45 |
+
|
| 46 |
+
# 3.1 REVISITING CONDITIONAL RANDOM FIELD (CRF)
|
| 47 |
+
|
| 48 |
+
CRF is a typical discriminative model suitable for prediction tasks where contextual information or the state of the neighbors affects the current prediction. Nowadays, it is widely adopted in the semantic segmentation field (Krähenbühl & Koltun, 2011; Chen et al., 2014). CRF utilizes the correlation between original image pixels to refine the segmentation results by modeling this problem as the maximum a posteriori (MAP) inference in a conditional random field (CRF), defined over original image pixels. In practice, the most common way is to approximate CRF as a message passing procedure among pixels and it can be formulated as:
|
| 49 |
+
|
| 50 |
+
$$
|
| 51 |
+
Y _ { i } ^ { * } = \frac { 1 } { Z _ { i } } ( \psi _ { u } ( i ) + \sum _ { j \neq i } ^ { G } \psi _ { p } ( i , j ) Y _ { j } ) ,
|
| 52 |
+
$$
|
| 53 |
+
|
| 54 |
+
where $Y _ { i }$ and $Y _ { i } ^ { * }$ are defined as the classification scores of CNN model and CRF respectively for pixel $i$ , $Z _ { i }$ is the normalization factor known as the partition function, and $\psi _ { u } ( i )$ is a unary function which often adopts $Y _ { i }$ as the default value. $G$ is the associated pixel set with pixel $i$ . For example, DenseCRF (Krähenbühl & Koltun, 2011) takes all other pixels except pixel $i$ itself as the set $G$ . Moreover, the pairwise function $\psi _ { p } ( i , j )$ is defined to measure the message passing weight from pixel $j$ to pixel $i$ . It is formulated as:
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
\psi _ { p } ( i , j ) = \mu ( i , j ) \underbrace { \sum _ { m = 1 } ^ { M } \omega ^ { ( m ) } k ^ { ( m ) } ( \mathbf { f } _ { i } , \mathbf { f } _ { j } ) } _ { k ( \mathbf { f } _ { i } , \mathbf { f } _ { j } ) } ,
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
where $\mu ( i , j )$ is a label compatibility function that introduces the co-occurrent probability for a specific label pair assignment at pixel $i$ and $j$ , while $k ( \mathbf { f } _ { i } , \mathbf { f } _ { j } )$ is a set of hand-designed Gaussian kernels, $\mathbf { f } _ { i }$ and $\mathbf { f } _ { j }$ are feature vectors of pixel $i$ and $j$ in any arbitrary feature space, such as RGB images. $\boldsymbol { w } ^ { ( m ) }$ is the corresponding linear combination weight for each Gaussian kernel. When dealing with multi-class image segmentation, $M { = } 2$ is a common setting. Then, $k ( \mathbf { f } _ { i } , \mathbf { f } _ { j } )$ is carefully designed as contrast-sensitive two-kernel potentials, defined in terms of color vectors $( I _ { i } , I _ { j } )$ and position coordinates $( p _ { i } , p _ { j } )$ for pixel $i$ and $j$ respectively:
|
| 61 |
+
|
| 62 |
+
$$
|
| 63 |
+
k ( \mathbf { f } _ { i } , \mathbf { f } _ { j } ) = w ^ { ( 1 ) } \underbrace { \exp \left( - \frac { \left| p _ { i } - p _ { j } \right| ^ { 2 } } { 2 \theta _ { \alpha } ^ { 2 } } - \frac { \left| I _ { i } - I _ { j } \right| ^ { 2 } } { 2 \theta _ { \beta } ^ { 2 } } \right) } _ { a p p e a r a n c e \quad k e r n e l } + w ^ { ( 2 ) } \underbrace { \exp \left( - \frac { \left| p _ { i } - p _ { j } \right| ^ { 2 } } { 2 \theta _ { \gamma } ^ { 2 } } \right) } _ { s m o o t h n e s s \quad k e r n e l } .
|
| 64 |
+
$$
|
| 65 |
+
|
| 66 |
+
The appearance kernel is inspired by the observation that nearby pixels with similar colors are more likely to share the same class. $\theta _ { \alpha }$ and $\theta _ { \beta }$ are scale factors to control the degree of these two elements, i.e., similarity and distance between two pixels. Apart from this, the smoothness kernel further removes the influence of some small isolated regions (Krähenbühl & Koltun, 2011) and $\theta _ { \gamma }$ is the associated scale factor. Notably, all these parameters are learnable during the model training.
|
| 67 |
+
|
| 68 |
+
Unfortunately, current CRF-based methods (Chen et al., 2014; 2017a; Lin et al., 2015; Liu et al., 2015) for semantic segmentation always adopt CRF as a post-processing module. For example, Vanilla-CRF (Chen et al., 2014; 2017a) utilizes CRF to refine segmentation scores offline, which has no impacts on BCWC since the CNN network and CRF are treated as two separate modules. Joint-CRF (Lin et al., 2015; Liu et al., 2015; Lin et al., 2016) works in a similar way although CRF involves in the backpropagation of CNN networks, restricting its ability to relieve BCWC.
|
| 69 |
+
|
| 70 |
+
# 3.2 EMBEDDED CRF
|
| 71 |
+
|
| 72 |
+
To solve the BCWC problem in a more intrinsical way, we propose a novel method named Embedded CRF (E-CRF) to tackle the tough problem via fusing the CRF mechanism into the CNN network as an organic whole for more effective end-to-end training. An overview of E-CRF can be found in Fig 2 and we formulate its core function based on Eq (1) as:
|
| 73 |
+
|
| 74 |
+
$$
|
| 75 |
+
F _ { i } ^ { * } = \frac { 1 } { Z _ { i } } \left\{ \psi _ { u } ^ { f } ( i ) + \sum _ { j \neq i } ^ { G } \psi _ { p } ^ { f } ( i , j ) F _ { j } + F _ { i } ^ { S } \right\} .
|
| 76 |
+
$$
|
| 77 |
+
|
| 78 |
+
Specifically, the first two terms are analogous to Eq (1) but we perform CRF mechanism on the high-level features. $F _ { i }$ stands for the original output of feature extractors for pixel $i$ , $\psi _ { u } ^ { f } ( i )$ and $\psi _ { p } ^ { \check { f } } ( i , j )$ play the same role as they do in Eq (1). $\bar { \psi _ { u } ^ { f } ( i ) }$ takes $F _ { i }$ as the default value. In addition, we reformulate $\psi _ { p } ^ { f } ( i , j )$ to perform message passing between pixel pairs in the high-level feature:
|
| 79 |
+
|
| 80 |
+
$$
|
| 81 |
+
\psi _ { p } ^ { f } ( i , j ) = \mu ^ { f } ( i , j ) k ( { \bf f } _ { i } , { \bf f } _ { j } ) .
|
| 82 |
+
$$
|
| 83 |
+
|
| 84 |
+
It is worth noting that $k ( \mathbf { f } _ { i } , \mathbf { f } _ { j } )$ is no longer hand-designed Gaussian kernels as it is in Eq (1) but simple convolution operators instead to make the whole model more flexible for end-to-end training and optimization. Experiments in Sec. 4 prove this modification is a more suitable choice:
|
| 85 |
+
|
| 86 |
+
$$
|
| 87 |
+
k ( \mathbf { f } _ { i } , \mathbf { f } _ { j } ) = \mathbf { f } _ { i } \cdot \mathbf { f } _ { j } = c o n v ( [ I _ { i } , p _ { i } ] ) \cdot c o n v ( [ I _ { j } , p _ { j } ] ) ,
|
| 88 |
+
$$
|
| 89 |
+
|
| 90 |
+
where $[ x , y ]$ denotes the concatenation operator. Different from Eq (3), we normalize the input image $I$ into the range $[ 0 , 1 ]$ to eliminate the scale variance between pixels and we replace original absolute position coordinates $p$ with cosine position embeddings (Vaswani et al., 2017) to make it more compatible with CNN networks. E-CRF encodes the appearance and position of pixels into more discriminative tokens via the flexible convolution operation, then the dot product is adopted to measure the similarity between pixel pairs. As indicated in Eq (6), E-CRF intends to make nearby pixel pairs that share same appearance to achieve higher $k ( \mathbf { f } _ { i } , \mathbf { f } _ { j } )$ . Its intention is the same as Eq (3). Correspondingly, we also adjust $\mu ^ { f } ( i , j )$ as the feature compatibility to measure the co-occurrent probability of $F _ { i }$ and $F _ { j }$ :
|
| 91 |
+
|
| 92 |
+
$$
|
| 93 |
+
\mu ^ { f } ( i , j ) = s i g m o i d ( c o n v [ F _ { i } , F _ { j } ] ) .
|
| 94 |
+
$$
|
| 95 |
+
|
| 96 |
+
Another component in Eq (4) is $F _ { i } ^ { S }$ . It relies on the superpixel algorithm (Ren & Malik, 2003; Weikersdorfer et al., 2013; Van den Bergh et al., 2012; Gadde et al., 2016) to divide the whole image $I$ into several non-overlapping blocks. Pixels in the same superpixel block tend to share the same characteristics. Thus, we adopt this local object prior to achieve the more effective message passing between pixels in the high-level feature space. Concretely, we design $F _ { i } ^ { S }$ as:
|
| 97 |
+
|
| 98 |
+
$$
|
| 99 |
+
F _ { i } ^ { S } = \sum _ { l } ^ { Q } \psi _ { s } ^ { f } ( l ) F _ { l } = \sum _ { l } ^ { Q } \frac { 1 } { n } F _ { l }
|
| 100 |
+
$$
|
| 101 |
+
|
| 102 |
+

|
| 103 |
+
Figure 3: Different optimization effects for baseline, Joint-CRF and E-CRF. $W _ { 1 }$ and $W _ { 2 }$ are two class weight vectors that share adjacent pixels. ∇W is the gradient variation for $W _ { 1 }$ and $W _ { 1 } ^ { * }$ is the new class weight after gradient descent. $F _ { k }$ is a sample boundary pixel whose ground-truth label keeps consistent with $W _ { 1 }$ but contains confusing features from both sides. $\theta$ measures the distance between $W _ { 2 }$ and $W _ { 1 } ^ { * }$ . (a) $\nabla W$ tends to push $W _ { 1 }$ towards $W _ { 2 }$ due to the confusing features from both classes. (b) Joint-CRF eases the disturbing gradients and reduces the scale of $\nabla W$ . Obviously, $\theta _ { 2 }$ is larger than $\theta _ { 1 }$ . (c) E-CRF aims to enhance the feature representation of $F _ { k }$ via the inner pixels like $F _ { j }$ from the same object. It adjusts both scale and direction of $\nabla W$ to make $\theta _ { 3 } > \theta _ { 2 } > \theta _ { 1 }$ .
|
| 104 |
+
|
| 105 |
+
$Q$ is the associated superpixel block that contains pixel $i$ and $\psi _ { s } ^ { f } ( l )$ devotes the re-weighting factor for the deep features of pixel $l$ in $Q$ . We adopt $\begin{array} { r } { \dot { \psi _ { s } ^ { f } } ( l ) = \frac { 1 } { n } } \end{array}$ and $n$ is the total number of pixels in $Q$ . $F _ { i } ^ { S }$ serves as a supplement in Eq (4) to add the local object prior to each pixel back, which increases the reliability of message passing in E-CRF. What’s more, superpixel (Gould et al., 2008; Sharma et al., 2014; Gadde et al., 2016) always tends to generate clearer and smoother boundary segmentation results than traditional CNN networks or CRFs do, which also increases the potential for more accurate segmentation results. Detailed experiments can be found in Sec. 4.
|
| 106 |
+
|
| 107 |
+
# 3.3 HOW E-CRF RELIEVES BCWC
|
| 108 |
+
|
| 109 |
+
In this section, without loss of generality, we take multi-class segmentation problem as an example to dive into the principle of E-CRF from the perspective of gradient descent. Suppose $F _ { k }$ is the feature vector of a foreground boundary pixel $k$ whose class label is $c \in [ 0 , n - 1 ]$ and its prediction probability is $P _ { k } ^ { c }$ . Then, considering the label $y _ { k }$ is one-hot form, the typical cross-entropy loss $L _ { k }$ can be defined as:
|
| 110 |
+
|
| 111 |
+
$$
|
| 112 |
+
L _ { k } = - \sum _ { i = 0 } ^ { i < n } y _ { k } ^ { i } \ln P _ { k } ^ { i } = - \ln P _ { k } ^ { c } ,
|
| 113 |
+
$$
|
| 114 |
+
|
| 115 |
+
$$
|
| 116 |
+
P _ { k } ^ { c } = s o f t m a x ( Y _ { k } ^ { c } ) = \frac { e ^ { Y _ { k } ^ { c } } } { ( \underset { m \neq c } { \sum } e ^ { Y _ { k } ^ { m } } ) + e ^ { Y _ { k } ^ { c } } } , \mathrm { } a n d \mathrm { } Y _ { k } ^ { c } = W _ { c } ^ { T } \cdot F _ { k } ,
|
| 117 |
+
$$
|
| 118 |
+
|
| 119 |
+
where $W _ { c }$ is the class weight of $c$ -th category. $Y _ { k } ^ { m }$ is calculated by other class weights and unrelated with $W _ { c }$ and $Y _ { k } ^ { c }$ . Below the gradient variation $\nabla W _ { c }$ can be formulated as:
|
| 120 |
+
|
| 121 |
+
$$
|
| 122 |
+
\nabla W _ { c } = \frac { \partial L _ { k } } { \partial W _ { c } } = \frac { \partial L _ { k } } { \partial P _ { k } ^ { c } } \cdot \frac { \partial P _ { k } ^ { c } } { \partial Y _ { k } ^ { c } } \cdot \frac { \partial Y _ { k } ^ { c } } { \partial W _ { c } }
|
| 123 |
+
$$
|
| 124 |
+
|
| 125 |
+
Through Eq (9), Eq (10) and Eq (11), class weight in the next iteration will be updated 2:
|
| 126 |
+
|
| 127 |
+
$$
|
| 128 |
+
\boldsymbol { W _ { c } ^ { * } } = \boldsymbol { W _ { c } } - \boldsymbol { \nabla } \boldsymbol { W _ { c } } = \boldsymbol { W _ { c } } + \left( 1 - \boldsymbol { P _ { k } ^ { c } } \right) \cdot \boldsymbol { F _ { k } }
|
| 129 |
+
$$
|
| 130 |
+
|
| 131 |
+
As shown in Eq (12), the direction of the gradient descent keeps the same as $F _ { k }$ while the magnitude of the gradient is decided by $P _ { k } ^ { c }$ . What happens if we integrate the CRF into the segmentation pipeline? As we have discussed in Sec. 1, Vanilla-CRF has nothing to do with the optimization process of CNN networks, while if we adopt Joint-CRF, $\nabla W _ { c }$ can be reformulated as:
|
| 132 |
+
|
| 133 |
+
$$
|
| 134 |
+
- \boldsymbol { \nabla } W _ { c } = ( 1 - \hat { P } _ { k } ^ { c } ) \cdot \boldsymbol { F } _ { k } = ( 1 - \frac { 1 } { Z _ { k } } ( \sum _ { j \in G } w _ { j } P _ { j } ^ { c } + P _ { k } ^ { c } ) ) \cdot \boldsymbol { F } _ { k }
|
| 135 |
+
$$
|
| 136 |
+
|
| 137 |
+
where $\hat { P } _ { k } ^ { c }$ is the refined score by CRF, $w _ { j }$ is the message passing weight from pixel $j$ to pixel $k$ and $P _ { j } ^ { c }$ is the original score of pixel $j$ . In general, boundary pixel $k$ is hard to classify correctly due to the confusing features from both sides. Thus the original probability $P _ { k } ^ { c }$ is always small. In contrast, other inner pixels of the same object are easy to recognize and tend to achieve a higher probability. Consequently, $\hat { P } _ { k } ^ { c }$ is usually larger than $P _ { k } ^ { c }$ and disturbing gradients caused by boundary pixel will be relieved to some extent, which makes inter-class distance further as shown in Fig 3(b). However, Eq (13) only adjusts the scale of the gradient descent while the direction still keeps the same as $F _ { k }$ , which weakens its effects for better representation learning. When it comes to our proposed E-CRF, $\nabla W _ { c }$ can be further defined as:
|
| 138 |
+
|
| 139 |
+
$$
|
| 140 |
+
\begin{array} { l } { - \nabla W _ { c } = ( 1 - P _ { k } ^ { c * } ) \cdot F _ { k } ^ { * } = \underbrace { ( 1 - P _ { k } ^ { c * } ) } _ { s c a l e } \cdot \underbrace { 1 } _ { Z _ { k } } ( \underbrace { \sum _ { j \in G } w _ { j } F _ { j } } _ { d i r e c t i o n } + F _ { k } ) } \\ { P _ { k } ^ { c * } = s o f t m a x ( \underbrace { \sum _ { j \in G } w _ { j } Y _ { j } ^ { c } + Y _ { k } ^ { c } } _ { j \in G } ) } \end{array}
|
| 141 |
+
$$
|
| 142 |
+
|
| 143 |
+
where $F _ { k } ^ { * }$ is the refined feature representations by E-CRF, and $P _ { k } ^ { c * }$ is the refined score which is analogous to $\hat { P } _ { k } ^ { c }$ in Eq (13). Comparing with Joint-CRF, it is clear that E-CRF not only changes the scale of the gradient descent but also adjusts its optimization direction. The optimization process is directly applied to the class weight matrix (in the final layer), which opens up room for more discriminative class weights. In other words, we can adjust the class weight from both the scale and direction to make the class weights more discriminative to decrease the class weights similarity (or class weights confusion). As depicted in Fig 3(c), assume $W _ { 1 }$ is the class weight vector that a pixel belongs to, while $W _ { 2 }$ is the other one which has a higher co-occurrent probability with $W _ { 1 }$ in the same image. E-CRF designs an effective message passing procedure to purify the feature representation of boundary pixels assisted by inner pixels from the same object $F _ { j }$ in Fig 3(c)). In this way, it relieves the influence of disturbing gradients and makes the inter-class distance between $W _ { 1 } ( W _ { 1 } ^ { * } )$ and $W _ { 2 }$ further, which means more discriminative feature representations.
|
| 144 |
+
|
| 145 |
+
# 4 EXPERIMENT
|
| 146 |
+
|
| 147 |
+
# 4.1 IMPLEMENTATION DETAILS
|
| 148 |
+
|
| 149 |
+
We follow the previous works (Chen et al., 2014; He et al., 2019b; Chen et al., 2018a) and perform experiments on three challenging semantic segmentation benchmarks, i.e., ADE20K (Zhou et al., 2017), Cityscapes (Cordts et al., 2016) and Pascal Context (Mottaghi et al., 2014). Due to the space limit, a detailed description of these three datasets can be found in our Appendix A. We adopt Deeplab ${ \mathrm { V } } 3 +$ (Chen et al., 2018a) with ResNet (He et al., 2016) pretrained on ImageNet (Russakovsky et al., 2015) as our baseline to implement E-CRF. The detailed information follows standard settings in (Chen et al., 2014; 2018a) and we add it into our Appendix A. Specially, we employ SLIC (Achanta et al., 2012), a common superpixel segmentation algorithm, to divide each image of ADE20K, Cityscapes and Pascal Context into 200, 600, and 200 blocks respectively. Note that the superpixel is generated offline. To verify the effectiveness of our approach for semantic segmentation, we adopt two common metrics in our experiments, i.e., class-wise mIoU to measure the overall segmentation performance and 1-pixel boundary F-score (Takikawa et al., 2019; Tan et al., 2023) to measure the boundary segmentation performance.
|
| 150 |
+
|
| 151 |
+
# 4.2 ABLATION STUDY
|
| 152 |
+
|
| 153 |
+
# 4.2.1 COMPARISONS WITH RELATED METHODS
|
| 154 |
+
|
| 155 |
+
As shown in Table 1, we compare our proposed E-CRF with other traditional CRF-based methods, i.e., Vanilla-CRF and Joint-CRF. First of all, it is clear that all the CRF-based methods outperform the baseline model by a large margin, which well verifies the main claim in (Chen et al., 2014; 2017a; Lin et al., 2015; Liu et al., 2015; Lin et al., 2016) that CRF is beneficial to boundary segmentation (F-score). What’s more, E-CRF achieves the best result among all those methods, which surpasses the baseline model with up to $1 . 4 8 \%$ mIoU and $2 . 2 0 \%$ F-score improvements. E-CRF fuses the CRF mechanism into the CNN network as an organic whole. It relieves the disturbing gradients caused by the BCWC problem and adjusts the feature representations to boost the overall segmentation performance and the boundary segmentation. Fig 1(a) also proves that E-CRF can decrease the interclass similarity consistently which results in more discriminative feature representations. Experiments on Cityscapes dataset can be found in our Appendix A.
|
| 156 |
+
|
| 157 |
+
Table 1: Comparisons with baseline, Vanilla-CRF and Joint-CRF on ADE20K val dataset. $^ 3 \mathrm { I t }$ stands for Deeplab ${ \mathrm { V } } 3 +$ followed by DenseCRF. 4An end-to-end manner of Vanilla-CRF, similar to (Zheng et al., 2015).
|
| 158 |
+
|
| 159 |
+
<table><tr><td rowspan="2">Method</td><td colspan="2">ResNet-50</td><td colspan="2">ResNet-101</td></tr><tr><td>F-score (%)</td><td>mIoU (%)</td><td>F-score (%)</td><td>mIoU (%)</td></tr><tr><td>DeeplabV3+</td><td>14.25</td><td>42.72</td><td>16.15</td><td>44.60</td></tr><tr><td>Vanilla-CRF 3</td><td>16.26</td><td>43.18 (+0.46)</td><td>17.89</td><td>45.14 (+0.54)</td></tr><tr><td>Joint-CRF 4</td><td>16.32</td><td>43.69 (+0.96)</td><td>18.03</td><td>45.61 (+1.01)</td></tr><tr><td>E-CRF (Ours)</td><td>16.45</td><td>44.20 (+1.48)</td><td>18.32</td><td>46.02 (+1.42)</td></tr></table>
|
| 160 |
+
|
| 161 |
+
# 4.2.2 ABLATION ON MESSAGE PASSING STRATEGIES
|
| 162 |
+
|
| 163 |
+
As we have discussed in Sec. 3.2, two message passing components, i.e., pairwise module $\psi _ { p } ^ { f }$ and superpixel-based module $\psi _ { s } ^ { f }$ , play vital roles in our proposed E-CRF. Table 2 shows that $\psi _ { p } ^ { f }$ and $\psi _ { s } ^ { f }$ can boost the overall segmentation performance on ADE20K val dataset with up to $1 . 1 9 \%$ mIoU and $1 . 2 5 \%$ mIoU gains when integrated into the baseline model respectively. Moreover, if we fuse them as a whole into E-CRF, they can further promote the segmentation performance by up to $1 . 4 8 \%$ mIoU improvements. We also compare with Non-local (Wang et al., 2018), another famous attention-based message passing method, into our experiments for comprehensive comparisons even though it actually has different design concepts from ours. Unfortunately, we find that although Non-local achieves improvements over the baseline, it is still inferior to our E-CRF.
|
| 164 |
+
|
| 165 |
+
Table 2: Comparisons between message passing strategies, and ablation studies for different message passing components in E-CRF, pairwise $\dot { \psi } _ { p } ^ { f }$ and auxiliary superpixel-based $\psi _ { s } ^ { f }$ .
|
| 166 |
+
|
| 167 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2"></td><td rowspan="2"></td><td colspan="2">mIoU(%)</td></tr><tr><td>ResNet-50</td><td>ResNet-101</td></tr><tr><td>DeeplabV3+</td><td></td><td></td><td>42.72</td><td>44.60</td></tr><tr><td>+ Non-local</td><td></td><td></td><td>43.52 (↑ 0.80)</td><td>45.34 (↑ 0.74)</td></tr><tr><td rowspan="3">E-CRF</td><td>√</td><td></td><td>43.91 (↑ 1.19)</td><td>45.47 (↑ 0.87)</td></tr><tr><td></td><td></td><td>43.83 (个 1.11)</td><td>45.85 (个 1.25)</td></tr><tr><td>√</td><td>√</td><td>44.20 (个 1.48)</td><td>46.02 (个 1.42)</td></tr></table>
|
| 168 |
+
|
| 169 |
+
# 4.2.3 ABLATION OF SUPERPIXEL NUMBERS
|
| 170 |
+
|
| 171 |
+
We follow standard settings in our paper and take Deeplab ${ \bf V } 3 +$ based on ResNet-50 as the baseline model to present the performance of E-CRF under different superpixel numbers. Detailed comparisons on ADE20K dataset are reported in Table 3 and SP denotes SuperPixel. As shown in Table 3, different numbers of superpixels indeed affect the performance of E-CRF.
|
| 172 |
+
|
| 173 |
+
Intuitively, when the number of superpixels is 200, E-CRF acquires the best performance as it achieves a better trade-off between the superpixel purity and the long-range dependency. Moreover, it is worth noting that when the pairwise message passing strategy (i.e., $\psi _ { p } ^ { f } )$ is also adopted in E-CRF, it becomes more robust to the different numbers of superpixels that may introduce noise, as our adaptive message passing mechanism (including $\overset { \cdot } { \psi } _ { p } ^ { f }$ and $\psi _ { s } ^ { f }$ ) can be compatible with the variance.
|
| 174 |
+
|
| 175 |
+
Table 3: Comparisons with different superpixel numbers on ADE20K val dataset.
|
| 176 |
+
|
| 177 |
+
<table><tr><td>SP num</td><td>mIoU w\ f (%)</td><td>mIoU w\o φf (%)</td></tr><tr><td>No</td><td>43.91</td><td>42.72</td></tr><tr><td>100</td><td>44.02</td><td>43.43</td></tr><tr><td>200</td><td>44.20</td><td>43.83</td></tr><tr><td>300</td><td>44.13</td><td>43.56</td></tr><tr><td>400</td><td>43.96</td><td>43.22</td></tr></table>
|
| 178 |
+
|
| 179 |
+
More ablation studies including comparison of different boundary refinement and computational cost are presented in Appendix A.4.
|
| 180 |
+
|
| 181 |
+
Table 4: Comparisons with other state-of-the-art methods on ADE20K val dataset, Cityscapes val and test, and Pascal Context val dataset.
|
| 182 |
+
|
| 183 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">backbone</td><td colspan="4">mIoU(%)</td></tr><tr><td>ADE-val</td><td>City-val</td><td>City-test</td><td>Pas-Con</td></tr><tr><td>CCNet (Huang et al.,2019)</td><td>ResNet101</td><td>45.22</td><td>81.3</td><td>81.9</td><td>-</td></tr><tr><td>ANL (Zhu et al., 2019)</td><td>ResNet101</td><td>45.24</td><td>-</td><td>=</td><td>52.8</td></tr><tr><td>GFFNet (Li et al.,2020c)</td><td>ResNet101</td><td>45.33</td><td>81.8</td><td>82.3</td><td>54.2</td></tr><tr><td>APCNet (He et al.,2019b)</td><td>ResNet101</td><td>45.38</td><td>-</td><td>=</td><td>54.7</td></tr><tr><td>DMNet (He et al., 2019a)</td><td>ResNet101</td><td>45.50</td><td>-</td><td>=</td><td>54.4</td></tr><tr><td>SpyGR (Li et al.,2020a)</td><td>ResNet101</td><td>-</td><td>80.5</td><td>81.6</td><td>52.8</td></tr><tr><td>RecoNet (Chen et al., 2020)</td><td>ResNet101</td><td>45.54</td><td>81.6</td><td>82.3</td><td>54.8</td></tr><tr><td>SPNet (Hou et al., 2020)</td><td>ResNet101</td><td>45.60</td><td>-</td><td>-</td><td>54.5</td></tr><tr><td>DNL (Yin et al.,2020)</td><td>ResNet101</td><td>45.82</td><td>1</td><td>-</td><td>55.3</td></tr><tr><td>RANet (Shen et al., 2020)</td><td>ResNet101</td><td>-</td><td>81.9</td><td>82.4</td><td>54.9</td></tr><tr><td>ACNet (Fu et al., 2019)</td><td>ResNet101</td><td>45.90</td><td>82.0</td><td>82.3</td><td>54.1</td></tr><tr><td>HANet (Choi et al., 2020)</td><td>ResNet101</td><td>-</td><td>82.05</td><td>82.1</td><td>-</td></tr><tr><td>RPCNet (Zhen et al., 2020b)</td><td>ResNet101</td><td>1</td><td>82.1</td><td>81.8</td><td>-</td></tr><tr><td>CaCNet (Liu et al.,2020)</td><td>ResNet101</td><td>46.12</td><td>1</td><td></td><td>55.4</td></tr><tr><td>CPNet (Yu et al., 2020a)</td><td>ResNet101</td><td>46.27</td><td>1</td><td>=</td><td>53.9</td></tr><tr><td>STLNet (Zhu et al., 2021)</td><td>ResNet101</td><td>46.48</td><td>82.3</td><td>82.3</td><td>55.6</td></tr><tr><td>E-CRF (Ours)</td><td>ResNet101</td><td>46.83</td><td>82.74</td><td>82.5</td><td>56.1</td></tr></table>
|
| 184 |
+
|
| 185 |
+
# 4.3 COMPARISONS WITH SOTA METHODS
|
| 186 |
+
|
| 187 |
+
In this research, we mainly focus on the Boundary-caused Class Weight Confusion (BCWC) in CNN models. Hence, in this section, we choose CNN-based methods for fair comparisons.5
|
| 188 |
+
|
| 189 |
+
ADE20K. We first compare our E-CRF (ResNet101 as backbone) with existing methods on the ADE20K val set. We follow standard settings in (Huang et al., 2019; Yuan et al., 2020a; Zhu et al., 2021) to adopt multi-scale testing and left-right flipping strategies. Results are presented in Table 4. It is shown that E-CRF outperforms existing approaches. Segmentation visualization is presented in our Appendix
|
| 190 |
+
|
| 191 |
+
Cityscapes. To verify the generalization of our method, we perform detailed comparisons with other SOTA methods on Cityscapes val and test set. Multi-scale testing and left-right flipping strategies are also adopted. The results with ResNet101 as backbone are reported in Table 4. Remarkably, our algorithm achieves $8 2 . 7 4 \%$ mIoU in val set and outperforms previous methods by a large margin.
|
| 192 |
+
|
| 193 |
+
Pascal Context. To further verify the generalization of E-CRF (ResNet101 as backbone), we compare our method with other SOTA method on Pascal Context dataset as shown in Table 4. We adopt multi-scale testing and left-right flipping strategies as well. The result suggests the superiority of our method.
|
| 194 |
+
|
| 195 |
+
# 5 CONCLUSION AND FUTURE WORKS
|
| 196 |
+
|
| 197 |
+
In this paper, we focus on the particularity of class weights in semantic segmentation and explicitly consider an important issue , named as Boundary-caused Class Weights Confusion (BCWC). We dive deep into it and propose a novel method, $E { \mathrm { - } } C R F$ , via combining CNN network with CRF as an organic whole to alleviate BCWC from two aspects (i.e., scale and direction). In addition, we make an exhaustive theoretical analysis to prove the effectiveness of E-CRF. Eventually, our proposed method achieves new results on ADE20K, Cityscapes, and Pascal Context datasets.
|
| 198 |
+
|
| 199 |
+
There are two important directions for future research. In this work, we use SLIC, a common cluster-based algorithm for fast implementation. There exist many other superpixel algorithms such as graphical-based (Felzenszwalb & Huttenlocher, 2004) and CNN-based (Jampani et al., 2018) that may give better boundary results for objects. Therefore how these different methods influence the performance in our framework is interesting. Besides, We find that transformer-based networks suffer from BCWC issue as well and make a preliminary exploration. More works are expected to focus on this issue.
|
| 200 |
+
|
| 201 |
+
# ACKNOWLEDGMENTS
|
| 202 |
+
|
| 203 |
+
We thank the anonymous reviewers for their constructive comments. We also sincerely thank Tiancai Wang for useful discussion. This work is supported by the NSFC Grants no. 61972008.
|
| 204 |
+
|
| 205 |
+
# REFERENCES
|
| 206 |
+
|
| 207 |
+
Radhakrishna Achanta, Appu Shaji, Kevin Smith, Aurelien Lucchi, Pascal Fua, and Sabine Süsstrunk. Slic superpixels compared to state-of-the-art superpixel methods. IEEE transactions on pattern analysis and machine intelligence, 34(11):2274–2282, 2012.
|
| 208 |
+
|
| 209 |
+
Anurag Arnab, Sadeep Jayasumana, Shuai Zheng, and Philip HS Torr. Higher order conditional random fields in deep neural networks. In Computer Vision–ECCV 2016: 14th European Conference, Amsterdam, The Netherlands, October 11-14, 2016, Proceedings, Part II 14, pp. 524–540. Springer, 2016.
|
| 210 |
+
|
| 211 |
+
Liang-Chieh Chen, George Papandreou, Iasonas Kokkinos, Kevin Murphy, and Alan L Yuille. Semantic image segmentation with deep convolutional nets and fully connected crfs. arXiv preprint arXiv:1412.7062, 2014.
|
| 212 |
+
|
| 213 |
+
Liang-Chieh Chen, George Papandreou, Iasonas Kokkinos, Kevin Murphy, and Alan L Yuille. Deeplab: Semantic image segmentation with deep convolutional nets, atrous convolution, and fully connected crfs. IEEE transactions on pattern analysis and machine intelligence, 40(4):834–848, 2017a.
|
| 214 |
+
|
| 215 |
+
Liang-Chieh Chen, George Papandreou, Florian Schroff, and Hartwig Adam. Rethinking atrous convolution for semantic image segmentation. arXiv preprint arXiv:1706.05587, 2017b.
|
| 216 |
+
|
| 217 |
+
Liang-Chieh Chen, Yukun Zhu, George Papandreou, Florian Schroff, and Hartwig Adam. Encoderdecoder with atrous separable convolution for semantic image segmentation. In Proceedings of the European conference on computer vision (ECCV), pp. 801–818, 2018a.
|
| 218 |
+
|
| 219 |
+
Wanli Chen, Xinge Zhu, Ruoqi Sun, Junjun He, Ruiyu Li, Xiaoyong Shen, and Bei Yu. Tensor low-rank reconstruction for semantic segmentation. In Andrea Vedaldi, Horst Bischof, Thomas Brox, and Jan-Michael Frahm (eds.), Computer Vision – ECCV 2020, pp. 52–69, Cham, 2020. Springer International Publishing. ISBN 978-3-030-58520-4.
|
| 220 |
+
|
| 221 |
+
Yunpeng Chen, Yannis Kalantidis, Jianshu Li, Shuicheng Yan, and Jiashi Feng. $\mathbf { A } \hat { \mathbf { \xi } } ^ { 2 }$ -nets: Double attention networks. 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., 2018b.
|
| 222 |
+
|
| 223 |
+
Sungha Choi, Joanne T. Kim, and Jaegul Choo. Cars can’t fly up in the sky: Improving urban-scene segmentation via height-driven attention networks. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020.
|
| 224 |
+
|
| 225 |
+
Xiangxiang Chu, Zhi Tian, Yuqing Wang, Bo Zhang, Haibing Ren, Xiaolin Wei, Huaxia Xia, and Chunhua Shen. Twins: Revisiting the design of spatial attention in vision transformers. Advances in Neural Information Processing Systems, 34, 2021.
|
| 226 |
+
|
| 227 |
+
Marius Cordts, Mohamed Omran, Sebastian Ramos, Timo Rehfeld, Markus Enzweiler, Rodrigo Benenson, Uwe Franke, Stefan Roth, and Bernt Schiele. The cityscapes dataset for semantic urban scene understanding. In Proc. of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
|
| 228 |
+
|
| 229 |
+
Henghui Ding, Xudong Jiang, Bing Shuai, Ai Qun Liu, and Gang Wang. Context contrasted feature and gated multi-scale aggregation for scene segmentation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2393–2402, 2018.
|
| 230 |
+
|
| 231 |
+
Henghui Ding, Xudong Jiang, Ai Qun Liu, Nadia Magnenat Thalmann, and Gang Wang. Boundaryaware feature propagation for scene segmentation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 6819–6829, 2019.
|
| 232 |
+
|
| 233 |
+
Pedro F Felzenszwalb and Daniel P Huttenlocher. Efficient graph-based image segmentation. International journal of computer vision, 59:167–181, 2004.
|
| 234 |
+
|
| 235 |
+
Jun Fu, Jing Liu, Yuhang Wang, Yong Li, Yongjun Bao, Jinhui Tang, and Hanqing Lu. Adaptive context network for scene parsing. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 6748–6757, 2019.
|
| 236 |
+
|
| 237 |
+
Raghudeep Gadde, Varun Jampani, Martin Kiefel, Daniel Kappler, and Peter V Gehler. Superpixel convolutional networks using bilateral inceptions. In European conference on computer vision, pp. 597–613. Springer, 2016.
|
| 238 |
+
|
| 239 |
+
Stephen Gould, Jim Rodgers, David Cohen, Gal Elidan, and Daphne Koller. Multi-class segmentation with relative location prior. International Journal of Computer Vision, 80(3):300–316, 2008.
|
| 240 |
+
|
| 241 |
+
Junjun He, Zhongying Deng, and Yu Qiao. Dynamic multi-scale filters for semantic segmentation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 3562–3572, 2019a.
|
| 242 |
+
|
| 243 |
+
Junjun He, Zhongying Deng, Lei Zhou, Yali Wang, and Yu Qiao. Adaptive pyramid context network for semantic segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7519–7528, 2019b.
|
| 244 |
+
|
| 245 |
+
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.
|
| 246 |
+
|
| 247 |
+
Shengfeng He, Rynson WH Lau, Wenxi Liu, Zhe Huang, and Qingxiong Yang. Supercnn: A superpixelwise convolutional neural network for salient object detection. International journal of computer vision, 115(3):330–344, 2015.
|
| 248 |
+
|
| 249 |
+
Qibin Hou, Li Zhang, Ming-Ming Cheng, and Jiashi Feng. Strip pooling: Rethinking spatial pooling for scene parsing. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 4003–4012, 2020.
|
| 250 |
+
|
| 251 |
+
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.
|
| 252 |
+
|
| 253 |
+
Zilong Huang, Xinggang Wang, Lichao Huang, Chang Huang, Yunchao Wei, and Wenyu Liu. Ccnet: Criss-cross attention for semantic segmentation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 603–612, 2019.
|
| 254 |
+
|
| 255 |
+
Varun Jampani, Deqing Sun, Ming-Yu Liu, Ming-Hsuan Yang, and Jan Kautz. Superpixel sampling networks. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 352–368, 2018.
|
| 256 |
+
|
| 257 |
+
Philipp Krähenbühl and Vladlen Koltun. Efficient inference in fully connected crfs with gaussian edge potentials. Advances in neural information processing systems, 24:109–117, 2011.
|
| 258 |
+
|
| 259 |
+
L’ubor Ladický, Paul Sturgess, Karteek Alahari, Chris Russell, and Philip H. S. Torr. What, where and how many? combining object detectors and crfs. In Kostas Daniilidis, Petros Maragos, and Nikos Paragios (eds.), Computer Vision – ECCV 2010, pp. 424–437, Berlin, Heidelberg, 2010. Springer Berlin Heidelberg.
|
| 260 |
+
|
| 261 |
+
Xia Li, Yibo Yang, Qijie Zhao, Tiancheng Shen, Zhouchen Lin, and Hong Liu. Spatial pyramid based graph reasoning for semantic segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8950–8959, 2020a.
|
| 262 |
+
|
| 263 |
+
Xiangtai Li, Xia Li, Li Zhang, Guangliang Cheng, Jianping Shi, Zhouchen Lin, Shaohua Tan, and Yunhai Tong. Improving semantic segmentation via decoupled body and edge supervision. In Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part XVII 16, pp. 435–452. Springer, 2020b.
|
| 264 |
+
|
| 265 |
+
Xiangtai Li, Houlong Zhao, Lei Han, Yunhai Tong, Shaohua Tan, and Kuiyuan Yang. Gated fully fusion for semantic segmentation. In Proceedings of the AAAI Conference on Artificial Intelligence, pp. 11418–11425, 2020c.
|
| 266 |
+
|
| 267 |
+
Guosheng Lin, Chunhua Shen, Ian Reid, and Anton van den Hengel. Deeply learning the messages in message passing inference. Advances in Neural Information Processing Systems, 28, 2015.
|
| 268 |
+
|
| 269 |
+
Guosheng Lin, Chunhua Shen, Anton Van Den Hengel, and Ian Reid. Efficient piecewise training of deep structured models for semantic segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3194–3203, 2016.
|
| 270 |
+
|
| 271 |
+
Jianbo Liu, Junjun He, Yu Qiao, Jimmy S. Ren, and Hongsheng Li. Learning to predict contextadaptive convolution for semantic segmentation. In Andrea Vedaldi, Horst Bischof, Thomas Brox, and Jan-Michael Frahm (eds.), Computer Vision – ECCV 2020, pp. 769–786, Cham, 2020. Springer International Publishing. ISBN 978-3-030-58595-2.
|
| 272 |
+
|
| 273 |
+
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, pp. 10012–10022, 2021.
|
| 274 |
+
|
| 275 |
+
Ziwei Liu, Xiaoxiao Li, Ping Luo, Chen-Change Loy, and Xiaoou Tang. Semantic image segmentation via deep parsing network. In Proceedings of the IEEE international conference on computer vision, pp. 1377–1385, 2015.
|
| 276 |
+
|
| 277 |
+
Jonathan Long, Evan Shelhamer, and Trevor Darrell. Fully convolutional networks for semantic segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3431–3440, 2015.
|
| 278 |
+
|
| 279 |
+
Roozbeh Mottaghi, Xianjie Chen, Xiaobai Liu, Nam-Gyu Cho, Seong-Whan Lee, Sanja Fidler, Raquel Urtasun, and Alan Yuille. The role of context for object detection and semantic segmentation in the wild. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 891–898, 2014.
|
| 280 |
+
|
| 281 |
+
Nadia Payet and Sinisa Todorovic. ˆ 2–random forest random field. Advances in Neural Information Processing Systems, 23, 2010.
|
| 282 |
+
|
| 283 |
+
Chao Peng, Tete Xiao, Zeming Li, Yuning Jiang, Xiangyu Zhang, Kai Jia, Gang Yu, and Jian Sun. Megdet: A large mini-batch object detector. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 6181–6189, 2018.
|
| 284 |
+
|
| 285 |
+
Federico Perazzi, Philipp Krähenbühl, Yael Pritch, and Alexander Hornung. Saliency filters: Contrast based filtering for salient region detection. In 2012 IEEE conference on computer vision and pattern recognition, pp. 733–740. IEEE, 2012.
|
| 286 |
+
|
| 287 |
+
René 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.
|
| 288 |
+
|
| 289 |
+
Xiaofeng Ren and Jitendra Malik. Learning a classification model for segmentation. In Computer Vision, IEEE International Conference on, volume 2, pp. 10–10. IEEE Computer Society, 2003.
|
| 290 |
+
|
| 291 |
+
Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computerassisted intervention, pp. 234–241. Springer, 2015.
|
| 292 |
+
|
| 293 |
+
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.
|
| 294 |
+
|
| 295 |
+
Abhishek Sharma, Oncel Tuzel, and Ming-Yu Liu. Recursive context propagation network for semantic scene labeling. In NIPS, volume 1, pp. 2, 2014.
|
| 296 |
+
|
| 297 |
+
Dingguo Shen, Yuanfeng Ji, Ping Li, Yi Wang, and Di Lin. Ranet: Region attention network for semantic segmentation. Advances in Neural Information Processing Systems, 33:13927–13938, 2020.
|
| 298 |
+
|
| 299 |
+
Guang Shu, Afshin Dehghan, and Mubarak Shah. Improving an object detector and extracting regions using superpixels. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3721–3727, 2013.
|
| 300 |
+
|
| 301 |
+
Robin Strudel, Ricardo Garcia, Ivan Laptev, and Cordelia Schmid. Segmenter: Transformer for semantic segmentation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 7262–7272, 2021.
|
| 302 |
+
|
| 303 |
+
Towaki Takikawa, David Acuna, Varun Jampani, and Sanja Fidler. Gated-scnn: Gated shape cnns for semantic segmentation. In Proceedings of the IEEE/CVF international conference on computer vision, pp. 5229–5238, 2019.
|
| 304 |
+
|
| 305 |
+
Haoru Tan, Sitong Wu, and Jimin Pi. Semantic diffusion network for semantic segmentation. arXiv preprint arXiv:2302.02057, 2023.
|
| 306 |
+
|
| 307 |
+
Takahiro Toyoda and Osamu Hasegawa. Random field model for integration of local information and global information. IEEE Transactions on Pattern Analysis and Machine Intelligence, 30(8): 1483–1489, 2008.
|
| 308 |
+
|
| 309 |
+
Michael Van den Bergh, Xavier Boix, Gemma Roig, Benjamin de Capitani, and Luc Van Gool. Seeds: Superpixels extracted via energy-driven sampling. In European conference on computer vision, pp. 13–26. Springer, 2012.
|
| 310 |
+
|
| 311 |
+
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.
|
| 312 |
+
|
| 313 |
+
Chi Wang, Yunke Zhang, Miaomiao Cui, Peiran Ren, Yin Yang, Xuansong Xie, Xian-Sheng Hua, Hujun Bao, and Weiwei Xu. Active boundary loss for semantic segmentation. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 36, pp. 2397–2405, 2022.
|
| 314 |
+
|
| 315 |
+
Xiaolong Wang, Ross Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 7794–7803, 2018.
|
| 316 |
+
|
| 317 |
+
David Weikersdorfer, Alexander Schick, and Daniel Cremers. Depth-adaptive supervoxels for rgb-d video segmentation. In 2013 IEEE International Conference on Image Processing, pp. 2708–2712. IEEE, 2013.
|
| 318 |
+
|
| 319 |
+
Enze Xie, Wenhai Wang, Zhiding Yu, Anima Anandkumar, Jose M Alvarez, and Ping Luo. Segformer: Simple and efficient design for semantic segmentation with transformers. Advances in Neural Information Processing Systems, 34:12077–12090, 2021.
|
| 320 |
+
|
| 321 |
+
Junjie Yan, Yinan Yu, Xiangyu Zhu, Zhen Lei, and Stan Z Li. Object detection by labeling superpixels. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 5107– 5116, 2015.
|
| 322 |
+
|
| 323 |
+
Minghao Yin, Zhuliang Yao, Yue Cao, Xiu Li, Zheng Zhang, Stephen Lin, and Han Hu. Disentangled non-local neural networks. In Andrea Vedaldi, Horst Bischof, Thomas Brox, and Jan-Michael Frahm (eds.), Computer Vision – ECCV 2020, pp. 191–207, Cham, 2020. Springer International Publishing. ISBN 978-3-030-58555-6.
|
| 324 |
+
|
| 325 |
+
Changqian Yu, Jingbo Wang, Changxin Gao, Gang Yu, Chunhua Shen, and Nong Sang. Context prior for scene segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12416–12425, 2020a.
|
| 326 |
+
|
| 327 |
+
Tianhe Yu, Saurabh Kumar, Abhishek Gupta, Sergey Levine, Karol Hausman, and Chelsea Finn. Gradient surgery for multi-task learning. Advances in Neural Information Processing Systems, 33: 5824–5836, 2020b.
|
| 328 |
+
|
| 329 |
+
Yuhui Yuan and Jingdong Wang. Ocnet: Object context network for scene parsing. arXiv preprint arXiv:1809.00916, 2018.
|
| 330 |
+
|
| 331 |
+
Yuhui Yuan, Xilin Chen, and Jingdong Wang. Object-contextual representations for semantic segmentation. In Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part VI 16, pp. 173–190. Springer, 2020a.
|
| 332 |
+
|
| 333 |
+
Yuhui Yuan, Jingyi Xie, Xilin Chen, and Jingdong Wang. Segfix: Model-agnostic boundary refinement for segmentation. In European Conference on Computer Vision, pp. 489–506. Springer, 2020b.
|
| 334 |
+
|
| 335 |
+
Mingmin Zhen, Shiwei Li, Lei Zhou, Jiaxiang Shang, Haoan Feng, Tian Fang, and Long Quan. Learning discriminative feature with crf for unsupervised video object segmentation. In European Conference on Computer Vision, pp. 445–462. Springer, 2020a.
|
| 336 |
+
|
| 337 |
+
Mingmin Zhen, Jinglu Wang, Lei Zhou, Shiwei Li, Tianwei Shen, Jiaxiang Shang, Tian Fang, and Long Quan. Joint semantic segmentation and boundary detection using iterative pyramid contexts. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 13666–13675, 2020b.
|
| 338 |
+
|
| 339 |
+
Shuai Zheng, Sadeep Jayasumana, Bernardino Romera-Paredes, Vibhav Vineet, Zhizhong Su, Dalong Du, Chang Huang, and Philip HS Torr. Conditional random fields as recurrent neural networks. In Proceedings of the IEEE international conference on computer vision, pp. 1529–1537, 2015.
|
| 340 |
+
|
| 341 |
+
Sixiao Zheng, Jiachen Lu, Hengshuang Zhao, Xiatian Zhu, Zekun Luo, Yabiao Wang, Yanwei Fu, Jianfeng Feng, Tao Xiang, Philip HS Torr, et al. Rethinking semantic segmentation from a sequence-to-sequence perspective with transformers. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 6881–6890, 2021.
|
| 342 |
+
|
| 343 |
+
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, pp. 633–641, 2017.
|
| 344 |
+
|
| 345 |
+
Lanyun Zhu, Deyi Ji, Shiping Zhu, Weihao Gan, Wei Wu, and Junjie Yan. Learning statistical texture for semantic segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12537–12546, 2021.
|
| 346 |
+
|
| 347 |
+
Zhen Zhu, Mengde Xu, Song Bai, Tengteng Huang, and Xiang Bai. Asymmetric non-local neural networks for semantic segmentation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 593–602, 2019.
|
| 348 |
+
|
| 349 |
+
# A APPENDIX
|
| 350 |
+
|
| 351 |
+
# A.1 FORMULA DERIVATION
|
| 352 |
+
|
| 353 |
+
Firstly, we give the gradient equation of $\nabla W _ { c }$ mentioned in this paper:
|
| 354 |
+
|
| 355 |
+
$$
|
| 356 |
+
\nabla W _ { c } = \frac { \partial L _ { k } } { \partial W _ { c } } = \frac { \partial L _ { k } } { \partial P _ { k } ^ { c } } \cdot \frac { \partial P _ { k } ^ { c } } { \partial Y _ { k } ^ { c } } \cdot \frac { \partial Y _ { k } ^ { c } } { \partial W _ { c } } .
|
| 357 |
+
$$
|
| 358 |
+
|
| 359 |
+
According to it, we present the derivative of each term respectively:
|
| 360 |
+
|
| 361 |
+
$$
|
| 362 |
+
{ \frac { \partial L _ { k } } { \partial P _ { k } ^ { c } } } = - { \frac { 1 } { P _ { k } ^ { c } } } ,
|
| 363 |
+
$$
|
| 364 |
+
|
| 365 |
+
$$
|
| 366 |
+
\frac { \partial P _ { k } ^ { c } } { \partial Y _ { k } ^ { c } } = \frac { ( ( \underset { m \neq c } { \sum } e ^ { Y _ { k } ^ { m } } ) + e ^ { Y _ { k } ^ { c } } ) \cdot e ^ { Y _ { k } ^ { c } } - ( e ^ { Y _ { k } ^ { c } } ) ^ { 2 } } { ( ( \underset { m \neq c } { \sum } e ^ { Y _ { k } ^ { m } } ) + e ^ { Y _ { k } ^ { c } } ) ^ { 2 } } = \frac { e ^ { Y _ { k } ^ { c } } } { \big ( \underset { m \neq c } { \sum } e ^ { Y _ { k } ^ { m } } \big ) + e ^ { Y _ { k } ^ { c } } } - ( \frac { e ^ { Y _ { k } ^ { c } } } { ( \underset { m \neq c } { \sum } e ^ { Y _ { k } ^ { m } } ) + e ^ { Y _ { k } ^ { c } } } ) ^ { 2 } ,
|
| 367 |
+
$$
|
| 368 |
+
|
| 369 |
+
and
|
| 370 |
+
|
| 371 |
+
$$
|
| 372 |
+
{ \frac { \partial Y _ { k } ^ { c } } { \partial W _ { c } } } = F _ { k } .
|
| 373 |
+
$$
|
| 374 |
+
|
| 375 |
+
Further, it is worth noting that $P _ { k } ^ { c }$ is given by:
|
| 376 |
+
|
| 377 |
+
$$
|
| 378 |
+
P _ { k } ^ { c } = \frac { e ^ { Y _ { k } ^ { c } } } { ( \displaystyle \sum _ { m \neq c } e ^ { Y _ { k } ^ { m } } ) + e ^ { Y _ { k } ^ { c } } } .
|
| 379 |
+
$$
|
| 380 |
+
|
| 381 |
+
To simplify Eq (18), we take Eq (20) into account. Thus, Eq (18) is formulated as:
|
| 382 |
+
|
| 383 |
+
$$
|
| 384 |
+
\frac { \partial P _ { k } ^ { c } } { \partial Y _ { k } ^ { c } } = P _ { k } ^ { c } - P _ { k } ^ { c } \cdot P _ { k } ^ { c } = P _ { k } ^ { c } \cdot ( 1 - P _ { k } ^ { c } ) .
|
| 385 |
+
$$
|
| 386 |
+
|
| 387 |
+
So after integrating Eq (17), Eq (21), and Eq (19), Eq (16) can be formulated as:
|
| 388 |
+
|
| 389 |
+
$$
|
| 390 |
+
\nabla W _ { c } = { \frac { \partial L _ { k } } { \partial W _ { c } } } = - { \frac { 1 } { P _ { k } ^ { c } } } \cdot P _ { k } ^ { c } \cdot ( 1 - P _ { k } ^ { c } ) \cdot F _ { k } = - ( 1 - P _ { k } ^ { c } ) \cdot F _ { k } .
|
| 391 |
+
$$
|
| 392 |
+
|
| 393 |
+
Finally, the class weights $W _ { c } ^ { * }$ in the next iteration will be updated:
|
| 394 |
+
|
| 395 |
+
$$
|
| 396 |
+
\boldsymbol { W _ { c } ^ { * } } = \boldsymbol { W _ { c } } - \boldsymbol { \nabla } \boldsymbol { W _ { c } } = \boldsymbol { W _ { c } } + \left( 1 - \boldsymbol { P } _ { k } ^ { c } \right) \cdot \boldsymbol { F _ { k } } .
|
| 397 |
+
$$
|
| 398 |
+
|
| 399 |
+
# A.2 EXPERIMENT SETUP
|
| 400 |
+
|
| 401 |
+
ADE20K ADE20K (Zhou et al., 2017) is one of the most challenging benchmarks, containing 150 fine-grained semantic concepts and a variety of scenes with 1,038 image-level labels. There are 20210 images in training set and 2000 images in validation set.
|
| 402 |
+
|
| 403 |
+
Cityscapes Cityscapes (Cordts et al., 2016) has 5,000 images captured from 50 different cities. Each image has $2 0 4 8 \times 1 0 2 4$ pixels, which have high quality pixel-level labels of 19 semantic classes. There are 2,975 images in training set, 500 images in validation set and 1,525 images in test set. We do not use coarse data in our experiments.
|
| 404 |
+
|
| 405 |
+
Pascal Context PASCAL Context (Mottaghi et al., 2014) is a challenging scene understanding dataset, which provides the semantic labels for the images. There are 4, 998 images for training and 5, 105 images for validation on PASCAL Context dataset. In our experiment, the 59 most frequent categories are used for training.
|
| 406 |
+
|
| 407 |
+
Implementation Details. The initial learning rate is set as 0.01 for both datasets. We employ a poly learning rate strategy where the initial learning rate is multiplied by (1 − iter/totaliter)0.9 after each iteration. We set training time to 80000 iterations for ADE20K and Pascal Context, and 180 epochs for Cityscapes. Momentum and weight decay coefficients are set as 0.9 and 0.0005, respectively. For data augmentation, we apply the common scale (0.5 to 2.0), cropping and flipping of the image to augment the training data. Input size for ADE20K dataset is set to $5 1 2 \times 5 1 2$ , and $4 8 0 \times 4 8 0$ is for Pascal Context while input size for Cityscapes dataset is set to $8 3 2 \times 8 3 2$ . The syncBN (Peng et al., 2018) is adopted in all experiments, and batch size on ADE20K and Pascal Context is set to 16 and it is set to 8 for Cityscapes.
|
| 408 |
+
|
| 409 |
+
# A.3 COMPARISONS WITH RELATED METHODS ON CITYSCAPES
|
| 410 |
+
|
| 411 |
+
To further evaluate our proposed method, we thoroughly compare our approach with baseline and other traditional CRF-based methods, i.e., Vanilla-CRF and Joint-CRF on Cityscapes dataset. As shown in Table 5, E-CRF achieves the best result among all those methods, which outperforms the baseline model by $0 . 9 2 \%$ in mIoU and $3 . 8 1 \%$ in F-score respectively. Obviously, our method is more effective than both Vanilla-CRF and Joint-CRF.
|
| 412 |
+
|
| 413 |
+
<table><tr><td rowspan="2">Method</td><td colspan="2">ResNet-50</td><td colspan="2">ResNet-101</td></tr><tr><td>F-score (%)</td><td>mIoU (%)</td><td>F-score (%)</td><td>mloU (%)</td></tr><tr><td>DeeplabV3+</td><td>60.48</td><td>79.54</td><td>61.94</td><td>80.85</td></tr><tr><td>Vanilla-CRF</td><td>62.38</td><td>79.65 (+0.11)</td><td>63.46</td><td>80.92 (+0.07)</td></tr><tr><td>Joint-CRF</td><td>63.44</td><td>79.78 (+0.24)</td><td>64.43</td><td>81.05 (+0.20)</td></tr><tr><td>E-CRF (Ours)</td><td>64.29</td><td>80.35 (+0.81)</td><td>65.57</td><td>81.77 (+0.92)</td></tr></table>
|
| 414 |
+
|
| 415 |
+
Table 5: Comparisons with baseline, Valina-CRF and Joint-CRF on Cityscapes val dataset.
|
| 416 |
+
|
| 417 |
+
# A.4 MORE ABLATION STUDIES
|
| 418 |
+
|
| 419 |
+
# A.4.1 DIFFERENT BOUNDARY REFINEMENT
|
| 420 |
+
|
| 421 |
+
We consider three typical methods inlcuding Segfix Yuan et al. (2020b), DecoupleSegNet Li et al. (2020b), and ABL 6 (Wang et al., 2022). They refine boundary segmentation via post-processing, improving boundary representation, and adding boundary allignment loss respectively. But all of them ignore the existence of BCWC issue, which may restrict their capability. In Table 4, we use Deeplab ${ \mathrm { V } } 3 +$ with ResNet101 as our baseline method. For Segfix, we use the official code (It uses HRNet as backbone) to boost the performance of Deeplab ${ \cal N } 3 +$ . For DecoupleSegNet which is constructed based on Deeplab ${ \cal N } 3 +$ , we also use the official code (It uses ResNet101 as backbone). All the models are trained on ADE20K for 80K iterations with batch size set to 16. When testing, we adopt the single-scale testing strategy (i.e., raw image) because using a single scale (i.e., raw images) when comparing with baselines or performing ablation studies is a traditional default setting in the semantic segmentation field. The goal is to eliminate the effect of other elements (e.g., image augmentation).
|
| 422 |
+
|
| 423 |
+
It is observed that all the methods enhance the performance and E-CRF achieves the highest mIoU and F-score. We speculate that this is because E-CRF has explicitly considered the BCWC problem and optimizes the class weights from both scale and direction aspects while refining boundary representation. It also indicates the importance of obtaining distinguishable class weights in semantic segmentation.
|
| 424 |
+
|
| 425 |
+
Table 6: Comparisons with other boundary refining methods on ADE20K val dataset.
|
| 426 |
+
|
| 427 |
+
<table><tr><td>Method</td><td>mloU (%)F-score (%)</td><td></td></tr><tr><td>DeeplabV3+ (Chen et al., 2018a)</td><td>44.60</td><td>16.15</td></tr><tr><td>SegFix(Yuan etal.,2020b)</td><td>45.62</td><td>18.14</td></tr><tr><td>DecoupleSegNet (Li et al., 2020b)</td><td>45.73</td><td>18.02</td></tr><tr><td>ABL (Wang et al., 2022)</td><td>45.38</td><td>1</td></tr><tr><td>E-CRF</td><td>46.02</td><td>18.32</td></tr></table>
|
| 428 |
+
|
| 429 |
+
# A.4.2 COMPARISONS ON COMPUTATIONAL COSTS
|
| 430 |
+
|
| 431 |
+
We take Deeplab ${ \bf V } 3 +$ based on ResNet101 as the baseline model to perform the training time comparisons. Image size is set to $5 1 2 \times 5 1 2$ and all the experiments are conducted on 8 GeForce RTX 2080Ti GPUs with two images per GPU. The FLOPs, parameter size, and inference FPS are also reported in Table 7. We can find that our proposed E-CRF brings negligible extra costs over the baseline model. The cost difference between E-CRF and Joint-CRF is marginal. We also measure the time consuming of superpixel method (5ms), which is much smaller than that of inference (55ms).
|
| 432 |
+
|
| 433 |
+
Table 7: Comparisons on Computational costs on ADE20K dataset.
|
| 434 |
+
|
| 435 |
+
<table><tr><td>Method</td><td>Backbone</td><td>Training Time(s)</td><td>FLOPs(G)</td><td>Parameters(M)</td><td>FPS</td></tr><tr><td>DeeplabV3+</td><td>ResNet101</td><td>0.71</td><td>254.8</td><td>60.1</td><td>19.75</td></tr><tr><td>Vanilla-CRF</td><td>ResNet101</td><td>0.71</td><td>254.8</td><td>60.1</td><td>1.86</td></tr><tr><td>Joint-CRF</td><td>ResNet101</td><td>0.73</td><td>254.9</td><td>60.2</td><td>19.04</td></tr><tr><td>E-CRF</td><td>ResNet101</td><td>0.74</td><td>255.0</td><td>60.2</td><td>18.32</td></tr></table>
|
| 436 |
+
|
| 437 |
+
# A.5 DISCUSSION
|
| 438 |
+
|
| 439 |
+
In this section, we discuss the difference between E-CRF and three related works including PCGrad (Yu et al., 2020b), OCNet (Yuan & Wang, 2018), and SegFix (Yuan et al., 2020b).
|
| 440 |
+
|
| 441 |
+
Difference between Projecting Conflicting Gradients (PCGrad) and E-CRF: PCGrad and E-CRF are both gradient-based methods that focus on adjusting the gradient properly to optimize the learning process more effectively and efficiently. PCGrad is designed to mitigate a key optimization issue in multi-task learning caused by conflicting gradients, where gradients for different tasks point away from one another as measured by a negative inner product. If two gradients are conflicting, PCGrad alters the gradients by projecting each onto the normal plane of the other, preventing the interfering components of the gradient from being applied to the network. The idea behind PCGrad is simple and the method is effective. PCGrad is a task-level gradient optimization method, mainly focusing on conflicting gradients caused by multiple tasks during training (e.g., in semantic segmentation and depth estimation). E-CRF is a finer-grained pixel-level gradient optimization method. E-CRF mainly aims at mitigating the boundary-caused class weights confusion in semantic segmentation via adjusting class weights from both scale and direction.
|
| 442 |
+
|
| 443 |
+
Difference between OCNet and E-CRF: OCNet uses self-attention to implement the object context pooling module. The object context pooling estimates the context representation of each pixeliby aggregating the representations of the selected subset of pixels based on the estimated dense relation matrix. Further, OCNet combines context pooling module with the conventional multi-scale context schemes including PPM and ASPP. In E-CRF, we follow the idea behind Conditional Random Filed and embed it from logit space to deep-feature space. We instance the unary function and reformulate the pairwise function with a convolutional-based kernel. The kernel takes raw image RGB value and relative position embeddings as inputs (See Eq (6)), which is different from self-attention that takes extracted deep features as inputs. We also maintain one special term in CRF called label compatibility and transfer it to feature compatibility (See Eq (7)). Such is missing in self-attention. Besides, we do not measure the similarity between superpixel center and boundary pixels. We simply leverage the local prior in superpixel and use it to guide deep feature averaging. The motivation is to suppress noise information. Finally, the motivation between OCNet and E-CRF is different. OCNet mainly focuses on integrating as much object context as possible while E-CRF explicitly targets on the BCWC problem and optimizes class weights from both scale and direction.
|
| 444 |
+
|
| 445 |
+
Difference between SegFix and E-CRF: SegFix first encodes input image and predicts a boundary map and a direction map. Then SegFix uses the predicted boundary map and offset map derived from the direction map to correct the wrongly classified boundary pixels via internal points with high confidence. SegFix is beneficial for refining boundary segmentation and is served as a postprocessing method, thus lacking the capability to alleviate BCWC problem. Our method is derived from traditional CRF (a post-processing method) and can be regarded as a plug-and-play module. It can be easily integrated with other methods. Besides, our method extends the optimization flexibility for BCWC problem. Empirically, we have compared Segfix and E-CRF based on Deeplab ${ \bf V } 3 +$ in Table 6 (Please see A.4.1). E-CRF produces $4 6 . 0 2 \%$ for mIoU on ADE20K, outperforming SegFix $( 4 5 . 6 2 \% )$ by $0 . 4 \%$ . This indicates the importance of alleviating BCWC problem.
|
| 446 |
+
|
| 447 |
+
# A.6 PAIRWISE MESSAGE PASSING VISUALIZATION
|
| 448 |
+
|
| 449 |
+
E-CRF takes an equivalent transformation to replace hand-designed Gaussian kernels in VanillaCRF with simple convolution operators for more flexible end-to-end optimization. The convolution operation involves two aspects. One is the appearance similarity and the other one is the relative position between pixels. As depicted in Fig 4(a), we take a pixel $k$ in the stool for an example and show its relationship with other pixels in the image. Fig 4(b) and Fig 4(c) show its appearance similarity and cosine position embedding with other pixels respectively. It is clear that pixels share similar colors or close to the target pixel $k$ tend to be highlighted. Subsequently, in $\mathrm { F i g 4 ( d ) }$ , we directly visualize the results of our pairwise message passing module $\psi _ { p } ^ { f }$ defined in Eq.(5). We can find that $\psi _ { p } ^ { f }$ becomes concentrated on the most relevant pixels compared with the pixel $k$ , which verifies the reliability of our pairwise message passing design.
|
| 450 |
+
|
| 451 |
+

|
| 452 |
+
Figure 4: Visualization of pairwise message passing module $\psi _ { p } ^ { f }$ in E-CRF. (a) A target pixel $k$ of the stool in the image. (b) The appearance similarity between other pixels and $k$ . Pixels share the similar colors with $k$ tend to be highlighted. (c) The visualization of the relative position between $k$ and other pixels. Pixels close to $k$ achieve higher values. (d) The visualization of $\psi _ { p } ^ { f }$ in E-CRF. $\psi _ { p } ^ { f }$ focuses more on most relevant pixels compared to $k$ .
|
| 453 |
+
|
| 454 |
+

|
| 455 |
+
Figure 5: Visualization comparisons between our method and baseline on ADE20K validation set. (a) Images from ADE20K dataset. (b) Segmentation output from Deeplab ${ \cal N } 3 +$ . (c) Segmentation output from our method. Obviously, compared with baseline, the results are segmented well by E-CRF. (d) Image labels.
|
| 456 |
+
|
| 457 |
+
# B BCWC IN TRANSFORMER
|
| 458 |
+
|
| 459 |
+
Are transformer-based models also suffering from Boundary-caused Class Weight Confusion? Is our method effective to transformer-based models? To answer these questions, we make a preliminary exploration in this section.
|
| 460 |
+
|
| 461 |
+
# B.1 OBSERVATIONS ON ADE20K
|
| 462 |
+
|
| 463 |
+
Following the same idea in Fig.1(a) of this paper, we take Segformer (Xie et al., 2021) (a transformer-based segmentation model) as an example to train on ADE20K (Zhou et al., 2017) dataset. We count the number of adjacent pixels for each class pair and find a corresponding category that has the most adjacent pixels for each class. Then, we calculate the similarity of their class weights and depict it in Fig 6. X-axis stands for the number of adjacent pixels for each class pair in descending order, and Yaxis represents the similarity of their class weights. Blue line denotes Segformer while orange line denotes ECRF based on Segformer. As shown
|
| 464 |
+
|
| 465 |
+

|
| 466 |
+
Figure 6: Class weight similarity on transformer-based model
|
| 467 |
+
|
| 468 |
+
in Fig 6, two categories that share more adjacent pixels are inclined to have more similar class weights, while E-CRF effectively decreases the similarity between adjacent categories and makes their class weights more discriminative. These observations on transformer-based model are quite similar to previous results in CNN-based models. Apparently, transformer-based models are also suffering from Boundary-caused Class Weight Confusion.
|
| 469 |
+
|
| 470 |
+
# B.2 EFFECTIVENESS ON TRANSFORMER
|
| 471 |
+
|
| 472 |
+
To evaluate the effectiveness of our method, we take Segformer (Xie et al., 2021) (based on MiT-B5) as our transformer baseline and incoporate E-CRF into it. Experiments are conducted on ADE20K and Cityscapes datasets. Similarly, we also compare our method with other traditinal CRF-based methods, i.e., Vanilla-CRF and Joint-CRF 7. As shown in Table 8, E-CRF achieves the best result among all those methods, which surpasses the baseline model with up to $1 . 0 1 \%$ mIoU and $3 . 8 1 \%$ F-score improvements. By E-CRF relieves the disturbing gradients caused by the BCWC problem boost the overall segmentation performance and the boundary segmentation. Fig 6 also proves that E-CRF can decrease the inter-class similarity consistently which results in more discriminative feature representations.
|
| 473 |
+
|
| 474 |
+
<table><tr><td rowspan="2">Method</td><td colspan="2">ADE20K</td><td colspan="2">Cityscapes</td></tr><tr><td>F-score (%)</td><td>mIoU (%)</td><td>F-score (%)</td><td>mIoU (%)</td></tr><tr><td>Segformer</td><td>18.53</td><td>49.13</td><td>62.42</td><td>82.25</td></tr><tr><td>Vanilla-CRF</td><td>21.72</td><td>49.36 (+0.23)</td><td>64.06</td><td>82.31 (+0.06)</td></tr><tr><td>Joint-CRF</td><td>21.91</td><td>49.55 (+0.42)</td><td>64.93</td><td>82.41 (+0.16)</td></tr><tr><td>E-CRF (Ours)</td><td>22.34</td><td>50.14 (+1.01)</td><td>66.05</td><td>83.07 (+0.82)</td></tr></table>
|
| 475 |
+
|
| 476 |
+
Table 8: Comparisons with baseline, Valina-CRF, and Joint-CRF on ADE20K and Cityscapes val datasets.
|
| 477 |
+
|
| 478 |
+
# B.3 COMPARISONS WITH SOTA METHODS
|
| 479 |
+
|
| 480 |
+
To further verify the effectiveness, we compare our methods with other transformer-based SOTA methods with similar number of parameters (except SETR) for fair comparisons in both ADE20K and Cityscapes datasets. Multi-scale testing and left-right flipping strategies are adopted. As shown in Table 9, our method achieves the best results among all the SOTA methods in both ADE20K and Cityscapes datasets. Besides, our method also has the smallest number of parameters.
|
| 481 |
+
|
| 482 |
+
Table 9: Comparisons with other transformer-based SOTA methods on ADE20K val dataset and Cityscapes val and test dataset.
|
| 483 |
+
|
| 484 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2">Backbone</td><td colspan="3">mIoU(%)</td></tr><tr><td>|ADE-val City-val City-test|Params (M)</td><td></td><td></td></tr><tr><td>SETR (Zheng et al., 2021)</td><td>ViT-L (307M)</td><td>50.20 82.15</td><td>82.2</td><td>310M</td></tr><tr><td>UperNet</td><td>Swin-B (Liu et al.,2021) (88M)</td><td>49.65 1</td><td>1</td><td>121M</td></tr><tr><td>UperNet</td><td>Twins-L (Chu et al.,2021) (99M)</td><td>50.20 1</td><td>1</td><td>133M</td></tr><tr><td>SegFormer (Xie et al., 2021)</td><td>MiT-B5 (81M)</td><td>50.22</td><td>83.48 82.2</td><td>85M</td></tr><tr><td>UperNet</td><td>XCiT-M24 (Chu et al.,2021) (84M)</td><td>48.40 1</td><td>1</td><td>109M</td></tr><tr><td>DPT (Ranftl et al., 2021)</td><td>ViT-B (86M)</td><td>48.34</td><td>- 1</td><td>112M</td></tr><tr><td>Segmentor (Strudel et al., 2021)</td><td>DeiT-B (86M)</td><td>50.08</td><td>80.60 -</td><td>86M</td></tr><tr><td>E-CRF (Ours)</td><td>MiT-B5 (81M)</td><td>51.28</td><td>83.7 82.5</td><td>85M</td></tr></table>
|
md/dev/gUL6zYN4Uaf/gUL6zYN4Uaf.md
ADDED
|
@@ -0,0 +1,440 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# CRAMMING: TRAINING A LANGUAGE MODEL ON ASINGLE GPU IN ONE DAY
|
| 2 |
+
|
| 3 |
+
# Anonymous authors
|
| 4 |
+
|
| 5 |
+
Paper under double-blind review
|
| 6 |
+
|
| 7 |
+
# ABSTRACT
|
| 8 |
+
|
| 9 |
+
Recent trends in language modeling have focused on increasing performance through scaling, and have resulted in an environment where training language models is out of reach for most researchers and practitioners. While most in the community are asking how to push the limits of extreme computation, we ask the opposite question: How far can we get with a single GPU in just one day?
|
| 10 |
+
|
| 11 |
+
We investigate the downstream performance achievable with a transformer-based language model trained completely from scratch with masked language modeling for a single day on a single consumer GPU. Aside from re-analyzing nearly all components of the pretraining pipeline for this scenario and providing a modified pipeline with performance close to BERT, we investigate why scaling down is hard, and which modifications actually improve performance in this scenario. We provide evidence that even in this constrained setting, performance closely follows scaling laws observed in large-compute settings. Through the lens of scaling laws, we categorize a range of recent improvements to training and architecture and discuss their merit and practical applicability (or lack thereof) for the limited compute setting.
|
| 12 |
+
|
| 13 |
+
# 1 SCALING UP AND SCALING DOWN
|
| 14 |
+
|
| 15 |
+
Large-scale training of machine learning models with transformer architectures has lead to groundbreaking improvements in many sub-fields of natural language processing including language understanding and natural language generation (Vaswani et al., 2017; Dosovitskiy et al., 2021; Radford et al., 2019). The nowadays accepted (but historically surprising) key behavior of these systems is that they reliably scale – they continuously improve in performance when the number of model parameters and amount of data grow. These increases in performance are well-described by various power laws as studied by Kaplan et al. (2020). This sets up a dominant paradigm in which scaling is the key to performance improvement (Sutton, 2019).
|
| 16 |
+
|
| 17 |
+
The power of scale has set off a race to produce extremely large models, which in turn has created an environment where few researchers or practitioners feel that they are capable of training a language model. The original BERT model Devlin et al. (2019), which became a cornerstone transformer for many practical applications in natural language understanding, already required a significant amount of computation to train. Yet, the reproduction and improvements in Liu et al. (2019) further increased its performance by cranking up the level of computation by orders of magnitude. As these pre-trained checkpoints became popular for a range of downstream applications (Wolf et al., 2020), the competition for the largest language model became a focal point for industrial labs. This led to training runs that improved the performance of pretrained language models at the expense of computation at the zettaFLOP scale (Raffel et al., 2020; Yang et al., 2020; Zaheer et al., 2021) and later at the extremely large yottaFLOP scale (Brown et al., 2020; Black et al., 2022; Chowdhery et al., 2022; Rae et al., 2022).
|
| 18 |
+
|
| 19 |
+
Our goal is to turn this trend on its head and investigate how to best scale down language model training and what trade-offs emerge when doing so: What downstream performance can be achieved by a modest researcher when training from scratch with a single GPU for a single day? The ability to train a language model to the performance level of BERT with such modest resources has several interesting implications. For one, if scaled-down model pretraining is a viable analogue of large-compute pretraining, then this opens up a host of further academic investigations that are currently hard to realize for large-scale models. For example, research questions about the differences between existing and new pre-training tasks, tracing model predictions to data points (Ilyas et al., 2022), security questions such as membership inference (Carlini et al., 2022) and data poisoning (Geiping et al., 2021), and a wide range of empirical investigations into topics such as stability or generalization that arise during training (Nagarajan & Kolter, 2019; Jiang et al., 2019). At the same time, we can imagine situations in which legal requirements make it unclear whether models trained on public data with uncertain origin are permissible, and where a practitioner is interested in retraining their language models using a specialized or trustworthy data source (Wilka et al., 2017; Gold & Latonero, 2017).
|
| 20 |
+
|
| 21 |
+
In addition, we are motivated to benchmark the overall conceptual progress of research in this area over the last years, beyond simply turning the scaling knob. The goal of achieving BERT-like performance with modest training resources would have seemed unthinkable in 2018, and yet with modern advances and transformer training techniques this may now be possible.
|
| 22 |
+
|
| 23 |
+
To answer these questions, we consider a challenge we call “Cramming” – learning a whole language model the day before the test. Our studies begin by investigating many facets of the training pipeline to see which modifications actually improve performance in the scaled-down scenario. We provide evidence that even in this constrained setting, performance closely follows scaling laws observed in large-compute settings. An unsurprising consequence of these laws is that scaling down is hard; while smaller model architectures enable speeding up gradient computations, overall rates of model improvement over time remain nearly constant. Nonetheless, we can find changes to the training pipeline that exploit scaling laws to yield improvements by improving the effective rate of gradient computations without compromising model size. In the end, we are able to train models that achieve respectable performance – often close to and sometimes exceeding BERT on GLUE tasks – on a shoestring budget.
|
| 24 |
+
|
| 25 |
+
# 2 TYING OUR HANDS BEHIND OUR BACK: A SETUP WITH LIMITED COMPUTE
|
| 26 |
+
|
| 27 |
+
Before we start this investigation, we want to outline the extent of limitations we are interested in. The rules for cramming are as follows:
|
| 28 |
+
|
| 29 |
+
• A transformer-based language model of arbitrary size is trained with masked-language modeling, completely from scratch.
|
| 30 |
+
• Existing pretrained models cannot be included in any part of the pipeline.
|
| 31 |
+
• Any raw text (excluding downstream data) can be included for training. This means that one can achieve speedups by making judicious choices about how and when to sample data, provided the sampling mechanism does not require a pre-trained model.
|
| 32 |
+
• The downloading and pre-processing of raw data is exempted from the total compute budget. Pre-processing may include CPU-based tokenizer construction, tokenization, and filtering, but cannot include representation learning (e.g. pre-training a word embedding is not allowed, unless it is counted towards the final runtime).
|
| 33 |
+
• Training proceeds on a single GPU for 24 hours.
|
| 34 |
+
• Downstream performance is evaluated on GLUE (Wang et al., 2018). Downstream finetuning on GLUE is limited to brief training with only the training data of the downstream task (we consider 5 epochs or less) and needs to work with hyperparameters set globally for all GLUE tasks. Downstream finetuning is excluded from the total compute budget.
|
| 35 |
+
|
| 36 |
+
In our implementation, we analyze both a setup with a classical $\mathtt { r t x 2 0 8 0 t i }$ GPU (released September 2018) and a separate setup with a more modern rtxa6000 GPU (released October 2020). We pair each unit with 4 CPU cores and 32GB of RAM.
|
| 37 |
+
|
| 38 |
+
Why these limitations? We are principally interested in re-investigating the original BERT setup of Devlin et al. (2019) with limited compute. The optimal architecture of the transformer is not fixed, as the optimal size and shape depends on scaling laws (Kaplan et al., 2020). The limitations on usage of existing models rule out distillation from an existing model (Turc et al., 2019; Jiao et al., 2020; Sun et al., 2020; Wang et al., 2020b; Kaliamoorthi et al., 2021) and data filtering based on existing large models (Golchin et al., 2022), both of which ultimately answer questions about compression and
|
| 39 |
+
|
| 40 |
+
<table><tr><td rowspan=1 colspan=1>Group</td><td rowspan=1 colspan=2>Target</td><td rowspan=1 colspan=1>Accelerator</td><td rowspan=1 colspan=1>Time Limit</td><td rowspan=1 colspan=1>Total exaFLOP</td></tr><tr><td rowspan=6 colspan=1>(Devlin et al., 2019)(Dettmers, 2018)(Narasimhan, 2019)(Raffel et al., 2020)(Iandola et al., 2020)(Narang et al., 2021)(Tay et al., 2021)(Izsak et al., 2021)</td><td rowspan=3 colspan=2>BERTBERTBERT-large</td><td rowspan=1 colspan=1>16 TPU</td><td rowspan=1 colspan=1>4 days</td><td rowspan=1 colspan=1>680</td></tr><tr><td rowspan=1 colspan=1>8V100</td><td rowspan=1 colspan=1>11 days</td><td rowspan=1 colspan=1>950</td></tr><tr><td rowspan=1 colspan=1>BERT-large</td><td rowspan=1 colspan=1>1472 V100</td><td rowspan=1 colspan=1>47 min</td><td rowspan=1 colspan=1>519</td></tr><tr><td rowspan=3 colspan=2>T5-basesqueezeBERTT5 variationsT5-small-L16BERT variation</td><td rowspan=1 colspan=1>16 TPUv3</td><td rowspan=1 colspan=1>1 day</td><td rowspan=1 colspan=1>170</td></tr><tr><td rowspan=1 colspan=1>8Titan RTX</td><td rowspan=1 colspan=1>4days</td><td rowspan=1 colspan=1>361</td></tr><tr><td rowspan=1 colspan=1>16 TPUv316 TPUv38v100</td><td rowspan=1 colspan=1>1.75 days11.2 hours1 day</td><td rowspan=1 colspan=1>2988286</td></tr><tr><td rowspan=1 colspan=1>(Liu et al., 2019)(Chowdhery et al., 2022)</td><td rowspan=1 colspan=2>roBERTa-basePaLM</td><td rowspan=1 colspan=1>1024V1006144 TPUv4</td><td rowspan=1 colspan=1>1.25 day50 days</td><td rowspan=1 colspan=1>13 8247 299072</td></tr><tr><td rowspan=1 colspan=1>Our Setup 1Our Setup 2</td><td rowspan=1 colspan=2>BERTvariationBERT variation</td><td rowspan=1 colspan=1>1rtx2080ti1rtxa6000</td><td rowspan=1 colspan=1>1 day1 day</td><td rowspan=1 colspan=1>513</td></tr></table>
|
| 41 |
+
|
| 42 |
+
Table 1: Maximal Throughput available for select training runs of large language models. FLOP Counts for BERT reproductions and related models. Large-scale LMs included only for reference.
|
| 43 |
+
|
| 44 |
+
transfer of already processed information. Further, we do not want to limit data to the original dataset used to train BERT, wanting to allow for possible improvements through better data curation and quality. The rtx2080ti GPU is a natural candidate for this experiment, given that it was released before Devlin et al. (2019), but the more recent $\mathtt { r t x a 6 0 0 0 }$ is also interesting, being arguably the limit of a single-user workstation. At the finetuning stage we want to mimic the original BERT finetuning and evaluation setup, but provide additional limits to prevent gains based on tuning of only the downstream procedure, for example via computationally extensive downstream training (Bahri et al., 2021a), use of multiple downstream datasets (for example continued pretraining with MNLI before finetuning other tasks (Izsak et al., 2021)), and extended hyperparameter optimization for each GLUE task (Devlin et al., 2019; Liu et al., 2019; Lan et al., 2019).
|
| 45 |
+
|
| 46 |
+
# 3 RELATED WORK ON EFFICIENT TRANSFORMERS
|
| 47 |
+
|
| 48 |
+
How long does it take to train BERT? In general, this question is hard to answer, due to wildly varying hardware and software setups and differing measures of efficiency (Dehghani et al., 2021). An upper bound on the compute of a training run can be established by finding the total number of (low-precision) floating point operations available over the wallclock budget of the run. This peak of total FLOPs in a given time interval is generally not reached in actual compute, even for highly optimized models (Chowdhery et al., 2022), but represents the paid budget required to realize a training run. We summarize budgets for a few select training runs in Table 1. After the original training run for BERT on TPUs, initial reactions estimated up to 11 days of compute for comparable results on GPUs (Dettmers, 2018). However, sustained improvements, especially in software, have reduced the upper limit significantly (You et al., 2019; Narasimhan, 2019). Yet, recipes and implementations generally require entire server nodes (for GPUs) or TPU slices and target larger BERT architectures.
|
| 49 |
+
|
| 50 |
+
Other work discussing improvements to BERT targets compute settings closer to the original BERT, for example SqueezeBERT (Iandola et al., 2020) employs 8 Titan RTX cards for four days. Sellam et al. (2022) note that the original BERT training run is an outlier and doubling its training time more reliably reproduces the original results.
|
| 51 |
+
|
| 52 |
+
Our central point of comparison for BERT training with limited resources is the work of Izsak et al. (2021) who also attempt the goal of training BERT within 24 hours with overall similar limitations, but use a full server node with 8 V100 GPUs. Izsak et al. (2021) choose a BERTLARGE architecture variant and train with sequence length of 128, including a range of tweaks such as modified learning rates schedules, large batch sizes, sparse prediction and packed sequences. We re-evaluate this setup as a baseline setting for our own compute budget (which is about $1 5 \mathrm { x }$ smaller).
|
| 53 |
+
|
| 54 |
+
Studies of Efficient Transformers Recent years have seen a flurry of research working to improve and modify the transformer architecture proposed in Vaswani et al. (2017) and we refer to Treviso et al. (2022) for a recent categorization and review of research in this area. Several meta-studies have investigated proposed improvements and modifications: Narang et al. (2021) evaluate a large range of architectural modifications applied to the T5 model pipeline of Raffel et al. (2020) on tasks in both language understanding and translation. The encoder-decoder structure of T5 is closer in spirit to the original transformer setup, but is understood to behave similarly to BERT when using the encoder component (Liu et al., 2021a). Evaluating modifications with 1.75 days of compute on TPU slices they find that most improvements do not reliably materialize gains in final accuracy. Tay et al. (2021) work in the same setting and evaluate the optimal shape of T5 derived architectures and its relative effects on downstream performance as models are scaled. Further exploration of the scaling behavior of various architectural improvements in Tay et al. (2022a) find that only few modifications outperform the original architecture of Vaswani et al. (2017) at all scales, especially when evaluating downstream accuracy. The meta-study investigating improvements in preparation for extreme-scale training in Scao et al. (2022) focuses on minor modifications to layout, positional embeddings and data sources for autoregressive models, and other extremely-large scale training runs have so far been similarly conservative in their settings (Brown et al., 2020; Black et al., 2022; Rae et al., 2022).
|
| 55 |
+
|
| 56 |
+
In general though, these evaluations target larger compute settings than we intend to use, and are concerned with whether improvements (often from academic sources and proposed with evaluations on small scales) translate to larger scales. In this work, we set aside the question of (up)scaling and focus only on the limited compute.
|
| 57 |
+
|
| 58 |
+
Scaling Laws The difficulty in finding tangible improvements is echoed in the scaling laws of Kaplan et al. (2020). Over a wide range of transformer model shapes, Kaplan et al. (2020) find only model size (as number of parameters in non-embedding layers) strongly predicts performance. Further, for a fixed compute budget, an optimal model size can be derived, but performance is only mildly connected to model size - larger models processes less data per unit of compute, but improve faster by almost the same margin. While the precise coefficients and shape of these scaling laws continue to be iterated on (Hoffmann et al., 2022) and adapted for related settings (Bansal et al., 2022; Clark et al., 2022; Bahri et al., 2021b), their overall logic appears hard to escape, even if power laws fit observations somewhat less well on small scales.
|
| 59 |
+
|
| 60 |
+
# 4 INVESTIGATIONS
|
| 61 |
+
|
| 62 |
+
For our experimental evaluation we implement and test a considerable number of proposed modifications to the setup of Devlin et al. (2019) for their merits in our limited compute setting as described in Section 2. We first clarify the common implementation and initial data setup, and then investigate architectural, training and dataset improvements.
|
| 63 |
+
|
| 64 |
+
# 4.1 IMPLEMENTATION DETAILS
|
| 65 |
+
|
| 66 |
+
We implement everything in PyTorch (Paszke et al., 2017) and to limit our gains from the ”software lottery” (Hooker, 2021) we do not use specialized implementations (e.g. as proposed for attention mechanisms in Ivanov et al. (2021); Dao et al. (2022)), which would further bias results towards well-established components. We keep everything on the implementation level of the PyTorch framework, allowing only automated operator fusion (Sarofeen et al., 2022) that can be applied to all components. We run all experiments and ablation studies with the same setup of automated mixed precision (Micikevicius et al., 2018) for standard 16- and 32-bit floating point precision (over full 32-bit float, scaled 16-bit (Rasley et al., 2020) and pure bfloat16 (Wang & Kanwar, 2019). We find no benefit from offloading (Ren et al., 2021; Rasley et al., 2020) in our setting.).
|
| 67 |
+
|
| 68 |
+
Initial Data Setup We start our investigation with a close analogue to the original raw text sources of Devlin et al. (2019), using a recent dump of the English Wikipedia (20220301.en) and English bookcorpus, noting the commentary of Tan (2019); Bandy & Vincent (2021). We force all text into lower-case, strip accents and non-ascii characters and create an English tokenizer from scratch based only on this data. We choose WordPiece with a vocabulary size of $2 ^ { 1 5 } = 3 2 7 6 8$ (Wu et al., 2016). We found no significant change in performance with BPE (Sennrich et al., 2016) or SentencePiece with Unigrams (Kudo, 2018; Kudo & Richardson, 2019). Smaller vocabulary sizes $( 2 ^ { 1 2 } , 2 ^ { 1 3 } , 2 ^ { 1 4 } )$ resulted in worse performance, while larger vocabulary sizes $( 2 ^ { 1 6 } )$ we not reliably better. We pack tokenized data into randomized sequences of length 128 and separate unrelated fragments by $< S \in \mathrm { p } >$ The performance impact from dropping this separator was minimal. No impact was observed from including a <cls> token in pretraining. The shorter sequence length is sufficient for the downstream applications that we are targeting and simplifies attention computations. Packing data into full sequences limits us to simpler sequence losses, but uses the available compute optimally Liu et al. (2019); Izsak et al. (2021). For the targeted compute settings, this sequence length results in micro-batch sizes of 64 to 96 for most variations of the base BERT architecture on $\mathtt { g t x 2 0 8 0 t i }$ , which we will accumulate into larger batch sizes. With our limited compute budget, this produces enough samples to run single-epoch training (Komatsuzaki, 2019; Hernandez et al., 2022) where no data point is revisited.
|
| 69 |
+
|
| 70 |
+

|
| 71 |
+
Figure 1: Various Transformer architectures and shapes, showing MLM loss versus number of tokens ingested. Left: Global view. Right: Zoom onto 10e8 or more tokens. All models trained with the same budget. We see that improvements through architectural reshaping are minimal; while there are some fluctuations in loss early in training, the rates of loss decay during most of training differ by a multiplicative constant (horizontal shift due to logarithmic horizontal axis) that depends strongly on the model size and not model type.
|
| 72 |
+
|
| 73 |
+
# 4.2 MODIFYING THE ARCHITECTURE
|
| 74 |
+
|
| 75 |
+
The most obvious way to efficiently scale down training is by modifying the model architecture; intuitively, it seems likely that smaller/lower capacity models will be optimal in the cramming regime. In this section, we study the relationship between model type and training efficiency. We see that scaling laws create a strong barrier to scaling down. Per-token efficiency of training depends strongly on model size, but not transformer type. Furthermore, smaller models learn less efficiently, and this largely mitigates any throughput gains. Fortunately, the fact that training efficiency is nearly constant across models of the same size means that we can boost performance by finding architecture modifications that speed up gradient computation while keeping the parameter count nearly constant. This makes architecture selection fairly straightforward as we can make design choices based primarily on how they affect computation time for a single gradient step.
|
| 76 |
+
|
| 77 |
+
Scaling laws hold in the low-resource regime A large corpus of research in recent years has developed architectural improvements to speed up the original transformer. Many of these methods have not been found to improve training for the large-scale T5 architecture Narang et al. (2021); Tay et al. (2022a). But, in the low compute setting where data throughput is of utmost importance, maybe this is the way forward? Scaling laws have been observed by Kaplan et al. (2020) in the highresource regime, and seem to hold strongly in the limit as resources grow. Surprisingly, these laws also hold in the limit of extreme compute down-scaling, and they create a barrier to low-cost training.
|
| 78 |
+
|
| 79 |
+
We exemplify the effect of scaling laws for many transformer variants from the literature in Figure 1, where we train each architecture variant with optimized training hyperparameters as described below in Section 4.3. We apply these architecture variants to a shared baseline model that incorporates Pre-Normalization and rotary embedding. Figure 1 visualizes the progress of MLM loss versus the number of tokens ingested in total and all architectures run with the same time budget.
|
| 80 |
+
|
| 81 |
+
We observe that varying the transformer type and size has only minimal impact on the final loss after 24 hours. Models with more parameters learn more efficiently, as their MLM loss decreases faster on a per-gradient basis. However, smaller architectures make up for their slower learning efficiency by higher throughput, and thus process more tokens over the limited budget. Figure 1 shows that different architectures are unpredictable throughout an initial stage of training (the first 1B tokens), after which the per-token efficiencies differ by only a multiplicative constant (a horizontal shift due to the log axis). This constant depends almost entirely on the model size, not model type, so that all choices reach a MLM loss around 1.9 at the end of training.
|
| 82 |
+
|
| 83 |
+
Exploiting the scaling law. The scaling laws seem to bar us from making large gains via major changes to the transformer size and type, as per-token performance is tightly coupled to model size. As a result, we find no improvements when using a funnel-transformer architecture (Dai et al., 2020; Nawrot et al., 2022), when dropping FFN layers (Sridhar et al., 2022), or when using recurrent layers (Lan et al., 2019), even when trained with BPTT as in Schwarzschild (2021). Rescaling architectures to be deep-narrow (Tay et al., 2021; Wies et al., 2021) provides no gains.
|
| 84 |
+
|
| 85 |
+
While this principle closes one door for scaling down efficiently, it opens another; Because pergradient efficiency remains nearly constant for all models of the same size, we can exploit scaling laws by quickly searching for architectural choices that speed up computation while keeping model size roughly constant. A number of obvious optimizations fall into this category, and we describe them below, in addition to several other tweaks that provide marginal but worthwhile/free gains.
|
| 86 |
+
|
| 87 |
+
Attention Block: We disable all QKV biases (Dayma et al., 2021). This exploits the scaling law by removing a layer of computation, making the forward and backward pass somewhat faster, while keeping the model size nearly constant. We find that we can decrease gradient costs by reducing the number of attention heads (Merity, 2019; Araabi & Monz, 2020; Liu et al., 2021b; Javaheripi et al., 2022), as this parallelizes better on the GPU and provides a slight performance boost. We find no benefits from replacements to the softmax operation (Richter & Wattenhofer, 2020). We further keep the original multi-head self-attention mechanism. A large amount of work has been focused on efficient attention (Sukhbaatar et al., 2019; Beltagy et al., 2020; Wang et al., 2020a; Liu et al., 2021c) and studies of efficient attention (Tay et al., 2020a;b). But, because we set the maximal sequence length to 128, attention complexity is less of a concern in our setting. To verify this, we implement the recently proposed FLASH mechanism (Hua et al., 2022), but find no benefits. We further experiment with Fourier attention as proposed in Lee-Thorp et al. (2021), but find no improvements. We supplement the attention with rotary embeddings (Su et al., 2021; Black et al., 2022), which we find to provide small benefits.
|
| 88 |
+
|
| 89 |
+
Feedforward Block: We find empirical gains from disabling all linear layer biases (Dayma et al., 2021). Just as for the attention layers, this leverages the scaling law by accelerating gradient computation without noticeable impacts on model size. As a result, we get higher throughput without compromising the rate at which the model improves. We keep the original feedforward block largely unchanged, finding no benefits from changing to another activation than GELU. We do see small improvements from re-ordering the block into a gated linear unit (Dauphin et al., 2017). In contrast to other work, e.g. (Black et al., 2022), we do not increase the number of parameters in the FFN block to compensate for the halving of the hidden dimensionality due to gating.
|
| 90 |
+
|
| 91 |
+
Embedding: We implement scaled sinusoidal positional embeddings as described in Hua et al. (2022), finding incremental benefits over learned or unscaled sinusoidal embeddings. We see no improvements from decoupling the input and output embeddings (Chung et al., 2020). The suggestion from Lan et al. (2019) to factorize the input embedding provides no gains in our setting. We include a layer normalization at the end of the embedding block.
|
| 92 |
+
|
| 93 |
+
Layer Structure: As observed in many studies, we find that pre-normalization with Layer Norms is beneficial over post Layer Norms (Baevski & Auli, 2018; Xiong et al., 2020). We see no additional benefit from other variants of this modification, such as (Liu et al., 2020b; Shleifer et al., 2021). Further, replacing Layer Normalization with RMS Normalization provides no gains (Zhang & Sennrich, 2019). We note that the key effect of pre-normalization is to stabilize training and enable larger learning rates and reduced warmup, and we see limited benefits from including it by itself. We see no benefits from stochastic dropping of entire layers as described in (Zhang & He, 2020).
|
| 94 |
+
|
| 95 |
+
Head Block: We find that we can remove the nonlinear head without ill effect. We can further drop the decoder bias (Radford et al., 2019) and gain in memory using sparse token prediction (Liu et al., 2019; Izsak et al., 2021). We add a final Layer Norm to stabilize training further.
|
| 96 |
+
|
| 97 |
+

|
| 98 |
+
Figure 2: Learning Rate Schedules. Although globally many schedule result in similar behavior, we see in the zoom in the middle, that differences do exist. The right side shows the corresponding learning rate schedules.
|
| 99 |
+
|
| 100 |
+
# 4.3 MODIFYING THE TRAINING SETUP
|
| 101 |
+
|
| 102 |
+
We study the impact of training hyper-parameters on the BERT-base architecture. The original BERT training recipe understandably results is poor model performance in the cramming setting, and so we revisit a number of standard choices.
|
| 103 |
+
|
| 104 |
+
Objective: We train with only masked language modeling on fully packed blocks of tokens with a masking rate of $15 \%$ and the original setup of Devlin et al. (2019) where $1 0 \%$ of all masks are filled with random words and $10 \%$ unchanged. We see no improvement from masking at larger rates, e.g. at $40 \%$ as proposed in (Wettig et al., 2022). We see no difference enabling or disabling the mentioned $20 \%$ rule. We evaluate other functions for the masked-language objective, such as mean-squared error (Hui & Belkin, 2021) or L1 loss, but find no benefits.
|
| 105 |
+
|
| 106 |
+
Choice of Optimizer: We keep Adam (Kingma & Ba, 2015) as the optimizer of choice, with weight decay of 0.01 as described in (Loshchilov & Hutter, 2017), $\beta _ { 1 } = 0 . 9 , \beta _ { 2 } = 0 . 9 8$ and $\varepsilon =$ $1 0 ^ { - \bar { 1 } 2 }$ . We find no noticeable change in varying these parameters in reasonable amounts, e.g. $\varepsilon =$ $1 0 ^ { - 6 }$ , $\beta _ { 1 } = 0 . 9 , \beta _ { 2 } = 0 . 9 9 9$ . We test other first-order adaptive optimizers (Shazeer & Stern, 2018; Liu et al., 2020a) but find no advantages in our setting. We further find no advantages using higherorder optimizers (Yadav, 2020; Anil et al., 2021), but note that especially for higher-order optimizers there is a greater amount of variability in implementation.
|
| 107 |
+
|
| 108 |
+
Learning Rate Schedule and Peak: Following the advice of Izsak et al. (2021), we re-scale the learning rate schedule so that it is tied to our budget and the learning rate decays as the budget reduces to zero. Interestingly, we observe in Figure 2 that while globally a large number of learning rate shapes lead to similar reductions in loss, we find that we can make some gains through the choice of schedule. We find that a simple one-cycle learning rate (Smith & Topin, 2018) with a peak learning rate of $1 0 ^ { - 3 }$ leads to minimal pretraining loss within our budget.
|
| 109 |
+
|
| 110 |
+
Batch Size Schedule: A particularity of our setting is that, due to being limited to a single GPU, the micro-batch size that finds its way onto this GPU (96 for most experiments) is several times smaller than the optimal batch size. We find that the optimal batch size in this setting is around 1536 for minimal pretraining loss and 4032 for maximal downstream performance, i.e. we accumulate gradients and only perform an update every 16 and 42 forward/backward passes, respectively.
|
| 111 |
+
|
| 112 |
+
Fortunately, we can find small speedups by using an aggressive batch size schedule; we increase the number of averaged micro-batches linearly over the course of training. This results in more progress earlier in training, and leads to a small benefit to performance. We also experiment with automatic and adaptive batching rules (De et al., 2017; Bollapragada et al., 2018a;b), but find that the best results from these adaptive schedules resemble the fixed linear schedule. For simplicity we just stick to the simpler linear schedule.
|
| 113 |
+
|
| 114 |
+
Dropping Dropout The original BERT model of Devlin et al. (2019) includes dropout as in Vaswani et al. (2017), which prevents overfitting when training data is small relative to total compute budget. While it can be helpful as a regularizer, dropout effectively reduces the number of gradient updates seen by each parameter, as updates do not occur when the associated feature is dropped. At the same time, update runtime is not strongly effected by the presence of dropout, and so dropout results in a net reduction in updates per second.
|
| 115 |
+
|
| 116 |
+
Table 2: Dataset Variations for the optimal model from Section 4.2 and optimal training routine from Section 4.3, modifying final batch size in conjunction with dataset format.
|
| 117 |
+
|
| 118 |
+
<table><tr><td>Dataset</td><td>Batch Size</td><td>MNLI (m)</td></tr><tr><td>Bookcorpus-Wikipedia</td><td>1536</td><td>79.8</td></tr><tr><td>The Pile</td><td>1536</td><td>80.5</td></tr><tr><td>The Pile (natural data subset)</td><td>1536</td><td>80.8</td></tr><tr><td>C4-Subset</td><td>1536</td><td>79.1</td></tr><tr><td>Bookcorpus-Wikipedia,Deduduplication > 100</td><td>1536</td><td>79.9</td></tr><tr><td>Bookcorpus-Wikipedia, Deduduplication > 50</td><td>1536</td><td>79.5</td></tr><tr><td>Bookcorpus-Wikipedia, filtered with t = O.3,sorted</td><td>1536</td><td>80.8</td></tr><tr><td>Bookcorpus-Wikipedia, sorted</td><td>1536</td><td>81.0</td></tr><tr><td>C4-Subset, Deduduplication > 100</td><td>1536</td><td>79.2</td></tr><tr><td>C4-Subset, filtered with t = 0.3</td><td>1536</td><td>79.9</td></tr><tr><td>C4-Subset, filtered with t = O.3,sorted</td><td>1536</td><td>81.4</td></tr><tr><td>C4-Subset, fltered with t= O.3,larger,sorted</td><td>1536</td><td>81.9</td></tr><tr><td>Bookcorpus-Wikipedia</td><td>4032</td><td>80.5</td></tr><tr><td>C4-Subset, filtered with t = 0.3</td><td>4032</td><td>82.2</td></tr><tr><td>C4-Subset, filtered with t = O.3, sorted</td><td>4032</td><td>82.5</td></tr><tr><td>C4-Subset, filtered with t = 0.3</td><td>8064</td><td>80.9</td></tr></table>
|
| 119 |
+
|
| 120 |
+
In the cramming setting, training data is large compared to compute. Overfitting is not possible due to the single epoch schedule, and we disable dropout during pretraining (Brown et al., 2020) to maximize the number of parameter updates. We re-enable dropout during downstream fine-tuning with a dropout value of 0.1. Further, we experiment with length curricula (Li et al., 2022) and token dropping (Hou et al., 2022), but find no gains.
|
| 121 |
+
|
| 122 |
+
# 4.4 OPTIMIZING THE DATASET
|
| 123 |
+
|
| 124 |
+
We found above that scaling laws create a barrier to making major gains (beyond computational efficiencies) with architectural modifications. However, scaling laws do not preclude us from training on better data. Once we have exhausted our ability to train on more tokens per second, we should seek to train on better tokens.
|
| 125 |
+
|
| 126 |
+
We consider two data based pathways to better down-scaling. First, we can filter, process, or sort the existing data in various ways. Second, we can swap our data source. To this end, we experiment with several subsets of The Pile (Gao et al., 2020), containing raw text from only Gutenberg, Books3 and Wikipedia (en). From these Pile datasets we tokenize the first $4 \times 1 0 ^ { 6 }$ entries to generate enough tokens for our single pass. Another popular source of data is C4, the colossal, cleaned version of Common Crawl (Raffel et al., 2020), from which we stream the first $2 0 \times 1 0 ^ { 6 }$ entries. For each data source we regenerate its own WordPiece tokenizer as described in Section 4.1.
|
| 127 |
+
|
| 128 |
+
Of these four sources, we find the Pile to perform best in terms of downstream MNLI performance. However, it turns out we can further improve especially the C4 datset through additional processing. We first evaluate deduplication as described in Lee et al. (2022) via exact substring deduplication, but find this not to help in downstream performance in our case. We then test filtering for uncompressible data. We use the tokenizer itself to remove all training sequences from C4 set that cannot be compressed well; we simply set a threshold $t$ , e.g. $t = 0 . 3$ , and drop all entries from the dataset where the number of tokens in the entry is larger than $t$ times the number of raw characters. This removes, for example, sequences consisting of hard-to-compress HTML or markdown code. Surprisingly, this results in a measurable improvement on C4, summarized in Table 2.
|
| 129 |
+
|
| 130 |
+
We then see some further improvements from two directions. First, sorting all tokenized sequences by some metric, and second, increasing the final batch size. For filtering we sort all tokenized sequences by their average (unigram) token prevalence, so that likely sequences occur first. This has some positive effect, and can be strengthened slightly by drawing from a larger corpus, as the unlikely sequences never get reached. Finally, increasing the batch size to 4032 at the end of training (as mentioned in Section 4.3) is disproportionally effective on C4, but less so on bookcorpus-wikipedia. We believe that both modifications ultimately reduce the likelihood of training being hindered by fluctuations in the data distribution.
|
| 131 |
+
|
| 132 |
+
Table 3: Comparison in GLUE-dev performance of baseline BERT to crammed model. Avg. Score is all scores excluding CoLA.
|
| 133 |
+
|
| 134 |
+
<table><tr><td></td><td>MNLI (m/mm)</td><td>SST-2</td><td>STSB</td><td>RTE</td><td>QNLI</td><td>QQP</td><td>MRPC</td><td>Avg.</td></tr><tr><td>BERT-Base</td><td>83.5/83.6</td><td>92.1</td><td>86.7</td><td>58.3</td><td>90.3</td><td>87.6</td><td>88.7</td><td>83.9</td></tr><tr><td>BERT-Base(2080ti)</td><td>54.2/54.1</td><td>80.9</td><td>14.3</td><td>52.0</td><td>59.8</td><td>65.4</td><td>78.1</td><td>57.4</td></tr><tr><td>Crammed LM (2080ti)</td><td>82.0/82.5</td><td>90.4</td><td>84.9</td><td>56.5</td><td>88.2</td><td>87.0</td><td>85.0</td><td>82.1</td></tr><tr><td>Crammed LM (A6000)</td><td>83.3/83.8</td><td>92.1</td><td>84.5</td><td>56.1</td><td>88.5</td><td>87.3</td><td>87.5</td><td>82.9</td></tr></table>
|
| 135 |
+
|
| 136 |
+
# 5 FINETUNING PERFORMANCE ON GLUE
|
| 137 |
+
|
| 138 |
+
Finally, we evaluate performance on the GLUE benchmark of Wang et al. (2018), minus WNLI as in Devlin et al. (2019). We note that we only use MNLI (m) during the previous sections and do not tune hyperparameters based on the full GLUE scores. We finetune both the pretrained BERT-base checkpoint and our models under the same constraints laid out in Section 2. For BERT-base, we finetune all datasets for 5 epochs with a batch size of 32 and learning rate of $2 \times 1 0 ^ { - 5 }$ . For the crammed models, we find that this is not optimal and minor improvements
|
| 139 |
+
|
| 140 |
+
Table 4: Comparison in GLUE-dev performance of baseline BERT to crammed model. Avg. Score is all scores excluding CoLA, GLUE is the full average over the same tasks as in Devlin et al. (2019).
|
| 141 |
+
|
| 142 |
+
<table><tr><td></td><td>CoLA</td><td>Avg.</td><td>GLUE</td></tr><tr><td>BERT-Base</td><td>56.0</td><td>83.9</td><td>80.8</td></tr><tr><td>BERT-Base(2080ti)</td><td>2.0</td><td>57.4</td><td>51.2</td></tr><tr><td>Crammed LM (2080ti)</td><td>41.9</td><td>82.1</td><td>77.6</td></tr><tr><td>Crammed LM (A6000)</td><td>37.0</td><td>82.9</td><td>77.8</td></tr></table>
|
| 143 |
+
|
| 144 |
+
can be gained from a batch size of 16 and learning rate of $4 \times 1 0 ^ { - 5 }$ with cosine decay (this setup does not improve the pretrained BERT checkpoint).
|
| 145 |
+
|
| 146 |
+
Table 3 and Table 4 describe the performance of this setup on the GLUE downstream tasks (as median over 5 trials). There we compare the original BERT-base checkpoint, a reproduction of the BERT pretraining settings stopped after our budget is reached, and the modified recipe, evaluated with the single day $\mathtt { r t x 2 0 8 0 t i }$ setup and the single day $\mathtt { A 6 0 0 0 }$ setup. Overall, performance is surprisingly decent, especially for the larger datasets of MNLI, QQP, QNLI and SST-2, where downstream finetuning can smooth remaining differences. However, even the smaller datasets mostly work. The average is brought down however by a massive drop on CoLA (corpus of linguistic acceptability) (Warstadt et al., 2019). This behavior is intriguing and we offer two hypotheses. First, it is conceivable that the chosen global hyperparameters for finetuning are a bad fit for CoLA in particular. CoLa performance can be brittle with respect to hyperparameter, with Jiao et al. (2020) training longer only on CoLA or Joshi et al. (2020) training less only on CoLA. Nevertheless, for BERT, a set of global hyperparameters exists, pointing at a deficiency in the crammed model. As a second hypothesis, it is conceivable that these models need to process more text before they memorize enough data to do well on CoLA. This would be in contrast to Liu et al. (2021d) who find that CoLA is learned relatively quickly compared to other downstream tasks when probing intermediate BERT checkpoints. On the other hand, deficiencies on CoLA in particular are also common in approaches that distill BERT into smaller architectures (Sun et al., 2019; Turc et al., 2019; Mukherjee et al., 2021), which might come with limited capacity for linguistic acceptability.
|
| 147 |
+
|
| 148 |
+
# 6 CONCLUSIONS
|
| 149 |
+
|
| 150 |
+
We discuss how much performance a transformer-based language model can achieve when crammed into a setting with very limited compute, finding that several strands of modification, such as especially training recipe and data setup lead to decent downstream performance on GLUE. Overall though, cramming language models appears hard, as we empirically find many implications of Kaplan et al. (2020) to still hold in this regime. We hope that this work can provide a baseline for explorations of the question of cramming we formalize in Section 2 and cast a new light on a number of improvements and tricks proposed for transformer architectures in recent years.
|
| 151 |
+
|
| 152 |
+
REPRODUCIBILITY STATEMENT
|
| 153 |
+
|
| 154 |
+
We provide code to reproduce all experiments.
|
| 155 |
+
|
| 156 |
+
# REFERENCES
|
| 157 |
+
|
| 158 |
+
Rohan Anil, Vineet Gupta, Tomer Koren, Kevin Regan, and Yoram Singer. Scalable Second Order Optimization for Deep Learning. arXiv:2002.09018 [cs, math, stat], March 2021. URL http: //arxiv.org/abs/2002.09018.
|
| 159 |
+
|
| 160 |
+
Ali Araabi and Christof Monz. Optimizing Transformer for Low-Resource Neural Machine Translation. In Proceedings of the 28th International Conference on Computational Linguistics, pp. 3429–3435, Barcelona, Spain (Online), December 2020. International Committee on Computational Linguistics. doi: 10.18653/v1/2020.coling-main.304. URL https://aclanthology. org/2020.coling-main.304.
|
| 161 |
+
|
| 162 |
+
Mikel Artetxe, Jingfei Du, Naman Goyal, Luke Zettlemoyer, and Ves Stoyanov. On the Role of Bidirectionality in Language Model Pre-Training. arxiv:2205.11726[cs], May 2022. doi: 10. 48550/arXiv.2205.11726. URL http://arxiv.org/abs/2205.11726.
|
| 163 |
+
|
| 164 |
+
Alexei Baevski and Michael Auli. Adaptive Input Representations for Neural Language Modeling. In International Conference on Learning Representations, September 2018. URL https:// openreview.net/forum?id ${ \bf \Phi } = { \bf \Phi }$ ByxZX20qFQ.
|
| 165 |
+
|
| 166 |
+
Dara Bahri, Hossein Mobahi, and Yi Tay. Sharpness-Aware Minimization Improves Language Model Generalization. arXiv:2110.08529 [cs], October 2021a. URL http://arxiv.org/ abs/2110.08529.
|
| 167 |
+
|
| 168 |
+
Yasaman Bahri, Ethan Dyer, Jared Kaplan, Jaehoon Lee, and Utkarsh Sharma. Explaining Neural Scaling Laws. arxiv:2102.06701[cond-mat, stat], February 2021b. doi: 10.48550/arXiv.2102. 06701. URL http://arxiv.org/abs/2102.06701.
|
| 169 |
+
|
| 170 |
+
Payal Bajaj, Chenyan Xiong, Guolin Ke, Xiaodong Liu, Di He, Saurabh Tiwary, Tie-Yan Liu, Paul Bennett, Xia Song, and Jianfeng Gao. METRO: Efficient Denoising Pretraining of Large Scale Autoencoding Language Models with Model Generated Signals. arXiv:2204.06644 [cs], April 2022. URL http://arxiv.org/abs/2204.06644.
|
| 171 |
+
|
| 172 |
+
Jack Bandy and Nicholas Vincent. Addressing ”Documentation Debt” in Machine Learning: A Retrospective Datasheet for BookCorpus. NeurIPS 2021 Track Datasets and Benchmarks, November 2021. URL https://openreview.net/forum?id $=$ Qd_eU1wvJeu.
|
| 173 |
+
|
| 174 |
+
Yamini Bansal, Behrooz Ghorbani, Ankush Garg, Biao Zhang, Maxim Krikun, Colin Cherry, Behnam Neyshabur, and Orhan Firat. Data Scaling Laws in NMT: The Effect of Noise and Architecture. arXiv:2202.01994 [cs], February 2022. URL https://arxiv.org/abs/2202. 01994v1.
|
| 175 |
+
|
| 176 |
+
Hangbo Bao, Li Dong, Furu Wei, Wenhui Wang, Nan Yang, Xiaodong Liu, Yu Wang, Songhao Piao, Jianfeng Gao, Ming Zhou, and Hsiao-Wuen Hon. UniLMv2: Pseudo-Masked Language Models for Unified Language Model Pre-Training. arXiv:2002.12804 [cs], February 2020. URL http://arxiv.org/abs/2002.12804.
|
| 177 |
+
|
| 178 |
+
Iz Beltagy, Matthew E. Peters, and Arman Cohan. Longformer: The Long-Document Transformer. arXiv:2004.05150 [cs], December 2020. URL http://arxiv.org/abs/2004.05150.
|
| 179 |
+
|
| 180 |
+
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. arXiv:2204.06745 [cs], April 2022. URL http://arxiv.org/abs/2204.06745.
|
| 181 |
+
|
| 182 |
+
Raghu Bollapragada, Richard Byrd, and Jorge Nocedal. Adaptive Sampling Strategies for Stochastic Optimization. SIAM Journal on Optimization, 28(4):3312–3343, January 2018a. ISSN 1052-6234. doi: 10.1137/17M1154679. URL https://epubs.siam.org/doi/abs/10. 1137/17M1154679.
|
| 183 |
+
|
| 184 |
+
Raghu Bollapragada, Dheevatsa Mudigere, Jorge Nocedal, Hao-Jun Michael Shi, and Ping Tak Peter Tang. A Progressive Batching L-BFGS Method for Machine Learning. arxiv:1802.05374[cs, math, stat], May 2018b. URL http://arxiv.org/abs/1802.05374.
|
| 185 |
+
|
| 186 |
+
Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language Models are Few-Shot Learners. In 34th Conference on Neural Information Processing Systems (NeurIPS 2020), December 2020. URL http://arxiv.org/abs/2005.14165.
|
| 187 |
+
|
| 188 |
+
Nicholas Carlini, Steve Chien, Milad Nasr, Shuang Song, Andreas Terzis, and Florian Tramer. Membership Inference Attacks From First Principles. arxiv:2112.03570[cs], April 2022. doi: 10.48550/arXiv.2112.03570. URL http://arxiv.org/abs/2112.03570.
|
| 189 |
+
|
| 190 |
+
Ivan Chelombiev, Daniel Justus, Douglas Orr, Anastasia Dietrich, Frithjof Gressmann, Alexandros Koliousis, and Carlo Luschi. GroupBERT: Enhanced Transformer Architecture with Efficient Grouped Structures. arxiv:2106.05822 [cs], June 2021. URL https://arxiv.org/abs/ 2106.05822v1.
|
| 191 |
+
|
| 192 |
+
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. arXiv:2204.02311 [cs], April 2022. URL http://arxiv.org/abs/2204.02311.
|
| 193 |
+
|
| 194 |
+
Hyung Won Chung, Thibault Fevry, Henry Tsai, Melvin Johnson, and Sebastian Ruder. Rethinking Embedding Coupling in Pre-trained Language Models. In International Conference on Learning Representations, September 2020. URL https://openreview.net/forum? id=xpFFI_NtgpW.
|
| 195 |
+
|
| 196 |
+
Aidan Clark, Diego de las Casas, Aurelia Guy, Arthur Mensch, Michela Paganini, Jordan Hoffmann, Bogdan Damoc, Blake Hechtman, Trevor Cai, Sebastian Borgeaud, George van den Driessche, Eliza Rutherford, Tom Hennigan, Matthew Johnson, Katie Millican, Albin Cassirer, Chris Jones, Elena Buchatskaya, David Budden, Laurent Sifre, Simon Osindero, Oriol Vinyals, Jack Rae, Erich Elsen, Koray Kavukcuoglu, and Karen Simonyan. Unified Scaling Laws for Routed Language Models. arXiv:2202.01169 [cs], February 2022. URL http: //arxiv.org/abs/2202.01169.
|
| 197 |
+
|
| 198 |
+
Kevin Clark, Minh-Thang Luong, Quoc V. Le, and Christopher D. Manning. ELECTRA: Pretraining Text Encoders as Discriminators Rather Than Generators. In International Conference on Learning Representations, September 2019. URL https://openreview.net/forum? id=r1xMH1BtvB.
|
| 199 |
+
|
| 200 |
+
Kevin Clark, Minh-Thang Luong, Quoc V. Le, and Christopher D. Manning. Pre-Training Transformers as Energy-Based Cloze Models. arXiv:2012.08561 [cs], December 2020. URL http: //arxiv.org/abs/2012.08561.
|
| 201 |
+
|
| 202 |
+
Zihang Dai, Guokun Lai, Yiming Yang, and Quoc Le. Funnel-Transformer: Filtering out Sequential Redundancy for Efficient Language Processing. In Advances in Neural Information Processing Systems, volume 33, pp. 4271–4282. Curran Associates, Inc., 2020. URL https://papers.nips.cc/paper/2020/hash/ 2cd2915e69546904e4e5d4a2ac9e1652-Abstract.html.
|
| 203 |
+
|
| 204 |
+
Tri Dao, Daniel Y. Fu, Stefano Ermon, Atri Rudra, and Christopher Re. FlashAttention: Fast and ´ Memory-Efficient Exact Attention with IO-Awareness. arxiv:2205.14135[cs], May 2022. doi: 10.48550/arXiv.2205.14135. URL http://arxiv.org/abs/2205.14135.
|
| 205 |
+
|
| 206 |
+
Yann N. Dauphin, Angela Fan, Michael Auli, and David Grangier. Language Modeling with Gated Convolutional Networks. In Proceedings of the 34th International Conference on Machine Learning, pp. 933–941. PMLR, July 2017. URL https://proceedings.mlr.press/v70/ dauphin17a.html.
|
| 207 |
+
|
| 208 |
+
Boris Dayma, Suraj Patil, Pedro Cuenca, Khalid Saifullah, Tanishq Abraham, Phuc L ´ e Kh ˆ ac, Luke ´ Melas, and Ritobrata Ghosh. DALL·E Mini, July 2021. URL https://github.com/ borisdayma/dalle-mini.
|
| 209 |
+
|
| 210 |
+
Soham De, Abhay Yadav, David Jacobs, and Tom Goldstein. Big Batch SGD: Automated Inference using Adaptive Batch Sizes. arxiv:1610.05792[cs, math, stat], April 2017. URL http:// arxiv.org/abs/1610.05792.
|
| 211 |
+
|
| 212 |
+
Mostafa Dehghani, Yi Tay, Anurag Arnab, Lucas Beyer, and Ashish Vaswani. The Efficiency Misnomer. In International Conference on Learning Representations, September 2021. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ iulEMLYh1uR.
|
| 213 |
+
|
| 214 |
+
Tim Dettmers. TPUs vs GPUs for Transformers (BERT), October 2018. URL https:// timdettmers.com/2018/10/17/tpus-vs-gpus-for-transformers-bert/.
|
| 215 |
+
|
| 216 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. arXiv:1810.04805 [cs], May 2019. URL http://arxiv.org/abs/1810.04805.
|
| 217 |
+
|
| 218 |
+
Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale. arXiv:2010.11929 [cs], June 2021. URL http://arxiv.org/abs/2010.11929.
|
| 219 |
+
|
| 220 |
+
Francesco Fusco, Damian Pascual, and Peter Staar. pNLP-Mixer: An Efficient all-MLP Architecture for Language. arxiv:2202.04350 [cs], February 2022. URL https://arxiv.org/abs/ 2202.04350v1.
|
| 221 |
+
|
| 222 |
+
Leo Gao, Stella Biderman, Sid Black, Laurence Golding, Travis Hoppe, Charles Foster, Jason Phang, Horace He, Anish Thite, Noa Nabeshima, Shawn Presser, and Connor Leahy. The Pile: An 800GB Dataset of Diverse Text for Language Modeling. arXiv:2101.00027 [cs], December 2020. URL http://arxiv.org/abs/2101.00027.
|
| 223 |
+
|
| 224 |
+
Jonas Geiping, Liam H. Fowl, W. Ronny Huang, Wojciech Czaja, Gavin Taylor, Michael Moeller, and Tom Goldstein. Witches’ Brew: Industrial Scale Data Poisoning via Gradient Matching. In International Conference on Learning Representations, April 2021. URL https: //openreview.net/forum?id $=$ 01olnfLIbD.
|
| 225 |
+
|
| 226 |
+
Shahriar Golchin, Mihai Surdeanu, Nazgol Tavabi, and Ata Kiapour. A Compact Pretraining Approach for Neural Language Models. arxiv:2208.12367[cs], August 2022. doi: 10.48550/arXiv. 2208.12367. URL http://arxiv.org/abs/2208.12367.
|
| 227 |
+
|
| 228 |
+
Zachary Gold and Mark Latonero. Robots Welcome: Ethical and Legal Considerations for Web Crawling and Scraping. Washington Journal of Law, Technology & Arts, 13 (3):275–312, 2017. URL https://heinonline.org/HOL/P?h ${ } = { }$ hein.journals/ washjolta13&i=283.
|
| 229 |
+
|
| 230 |
+
Xiaotao Gu, Liyuan Liu, Hongkun Yu, Jing Li, Chen Chen, and Jiawei Han. On the Transformer Growth for Progressive BERT Training. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 5174–5180, Online, June 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.naacl-main.406. URL https://aclanthology.org/2021. naacl-main.406.
|
| 231 |
+
|
| 232 |
+
Pengcheng He, Jianfeng Gao, and Weizhu Chen. DeBERTaV3: Improving DeBERTa using ELECTRA-Style Pre-Training with Gradient-Disentangled Embedding Sharing. arXiv:2111.09543 [cs], December 2021. URL http://arxiv.org/abs/2111.09543.
|
| 233 |
+
|
| 234 |
+
Danny Hernandez, Tom Brown, Tom Conerly, Nova DasSarma, Dawn Drain, Sheer El-Showk, Nelson Elhage, Zac Hatfield-Dodds, Tom Henighan, Tristan Hume, Scott Johnston, Ben Mann, Chris Olah, Catherine Olsson, Dario Amodei, Nicholas Joseph, Jared Kaplan, and Sam McCandlish. Scaling Laws and Interpretability of Learning from Repeated Data. arxiv:2205.10487[cs], May 2022. URL http://arxiv.org/abs/2205.10487.
|
| 235 |
+
|
| 236 |
+
Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, Diego de Las Casas, Lisa Anne Hendricks, Johannes Welbl, Aidan Clark, Tom Hennigan, Eric Noland, Katie Millican, George van den Driessche, Bogdan Damoc, Aurelia Guy, Simon Osindero, Karen Simonyan, Erich Elsen, Jack W. Rae, Oriol Vinyals, and Laurent Sifre. Training Compute-Optimal Large Language Models. arXiv:2203.15556 [cs], March 2022. URL http://arxiv.org/abs/2203.15556.
|
| 237 |
+
|
| 238 |
+
Sara Hooker. The hardware lottery. Communications of the ACM, 64(12):58–65, November 2021. ISSN 0001-0782. doi: 10.1145/3467017. URL https://doi.org/10.1145/3467017.
|
| 239 |
+
|
| 240 |
+
Le Hou, Richard Yuanzhe Pang, Tianyi Zhou, Yuexin Wu, Xinying Song, Xiaodan Song, and Denny Zhou. Token Dropping for Efficient BERT Pretraining. arXiv:2203.13240 [cs], March 2022. URL http://arxiv.org/abs/2203.13240.
|
| 241 |
+
|
| 242 |
+
Weizhe Hua, Zihang Dai, Hanxiao Liu, and Quoc Le. Transformer Quality in Linear Time. In Proceedings of the 39th International Conference on Machine Learning, pp. 9099–9117. PMLR, June 2022. URL https://proceedings.mlr.press/v162/hua22a.html.
|
| 243 |
+
|
| 244 |
+
Like Hui and Mikhail Belkin. Evaluation of Neural Architectures Trained with Square Loss vs Cross-Entropy in Classification Tasks. arXiv:2006.07322 [cs, stat], October 2021. URL http: //arxiv.org/abs/2006.07322.
|
| 245 |
+
|
| 246 |
+
Forrest N. Iandola, Albert E. Shaw, Ravi Krishna, and Kurt W. Keutzer. SqueezeBERT: What can computer vision teach NLP about efficient neural networks? arXiv:2006.11316 [cs], June 2020. URL http://arxiv.org/abs/2006.11316.
|
| 247 |
+
|
| 248 |
+
Andrew Ilyas, Sung Min Park, Logan Engstrom, Guillaume Leclerc, and Aleksander Madry. Datamodels: Predicting Predictions from Training Data. arxiv:2202.00622[cs, stat], February 2022. doi: 10.48550/arXiv.2202.00622. URL http://arxiv.org/abs/2202.00622.
|
| 249 |
+
|
| 250 |
+
Andrei Ivanov, Nikoli Dryden, Tal Ben-Nun, Shigang Li, and Torsten Hoefler. Data Movement Is All You Need: A Case Study on Optimizing Transformers. arXiv:2007.00072 [cs, stat], November 2021. URL http://arxiv.org/abs/2007.00072.
|
| 251 |
+
|
| 252 |
+
Peter Izsak, Moshe Berchansky, and Omer Levy. How to Train BERT with an Academic Budget. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pp. 10644–10652, Online and Punta Cana, Dominican Republic, November 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.emnlp-main.831. URL https://aclanthology.org/2021.emnlp-main.831.
|
| 253 |
+
|
| 254 |
+
Mojan Javaheripi, Shital Shah, Subhabrata Mukherjee, Tomasz L. Religa, Caio C. T. Mendes, Gustavo H. de Rosa, Sebastien Bubeck, Farinaz Koushanfar, and Debadeepta Dey. LiteTransformerSearch: Training-free On-device Search for Efficient Autoregressive Language Models. arXiv:2203.02094 [cs], March 2022. URL http://arxiv.org/abs/2203.02094.
|
| 255 |
+
|
| 256 |
+
Yiding Jiang, Behnam Neyshabur, Hossein Mobahi, Dilip Krishnan, and Samy Bengio. Fantastic Generalization Measures and Where to Find Them. arXiv:1912.02178 [cs, stat], December 2019. URL http://arxiv.org/abs/1912.02178.
|
| 257 |
+
|
| 258 |
+
Xiaoqi Jiao, Yichun Yin, Lifeng Shang, Xin Jiang, Xiao Chen, Linlin Li, Fang Wang, and Qun Liu. TinyBERT: Distilling BERT for Natural Language Understanding. arXiv:1909.10351 [cs], October 2020. URL http://arxiv.org/abs/1909.10351.
|
| 259 |
+
|
| 260 |
+
Mandar Joshi, Danqi Chen, Yinhan Liu, Daniel S. Weld, Luke Zettlemoyer, and Omer Levy. SpanBERT: Improving Pre-training by Representing and Predicting Spans. Transactions of the Association for Computational Linguistics, 8:64–77, 2020. doi: 10.1162/tacl a 00300. URL https://aclanthology.org/2020.tacl-1.5.
|
| 261 |
+
|
| 262 |
+
Prabhu Kaliamoorthi, Aditya Siddhant, Edward Li, and Melvin Johnson. Distilling Large Language Models into Tiny and Effective Students using pQRNN. arxiv: 2101.08890 [cs], January 2021. URL https://arxiv.org/abs/2101.08890v1.
|
| 263 |
+
|
| 264 |
+
Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B. Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling Laws for Neural Language Models. arxiv:2001.08361[cs, stat], January 2020. doi: 10.48550/arXiv.2001.08361. URL http://arxiv.org/abs/2001.08361.
|
| 265 |
+
|
| 266 |
+
Guolin Ke, Di He, and Tie-Yan Liu. Rethinking Positional Encoding in Language Pre-training. In International Conference on Learning Representations, September 2020. URL https:// openreview.net/forum?id $= ($ 09-528y2Fgf.
|
| 267 |
+
|
| 268 |
+
Diederik P. Kingma and Jimmy Ba. Adam: A Method for Stochastic Optimization. In International Conference on Learning Representations (ICLR), San Diego, May 2015. URL http://arxiv. org/abs/1412.6980.
|
| 269 |
+
|
| 270 |
+
Aran Komatsuzaki. One Epoch Is All You Need. arXiv:1906.06669 [cs, stat], June 2019. URL http://arxiv.org/abs/1906.06669.
|
| 271 |
+
|
| 272 |
+
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), pp. 66–75, Melbourne, Australia, July 2018. Association for Computational Linguistics. doi: 10.18653/v1/P18-1007. URL https: //aclanthology.org/P18-1007.
|
| 273 |
+
|
| 274 |
+
Taku Kudo and John Richardson. SentencePiece: A simple and language independent subword tokenizer and detokenizer for Neural Text Processing. In EMNLP (Demonstration), July 2019. URL https://openreview.net/forum?id $=$ S1EyQGf_bH.
|
| 275 |
+
|
| 276 |
+
Zhenzhong Lan, Mingda Chen, Sebastian Goodman, Kevin Gimpel, Piyush Sharma, and Radu Soricut. ALBERT: A Lite BERT for Self-supervised Learning of Language Representations. In International Conference on Learning Representations, September 2019. URL https: //openreview.net/forum?id $=$ H1eA7AEtvS.
|
| 277 |
+
|
| 278 |
+
Katherine Lee, Daphne Ippolito, Andrew Nystrom, Chiyuan Zhang, Douglas Eck, Chris CallisonBurch, and Nicholas Carlini. Deduplicating Training Data Makes Language Models Better. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 8424–8445, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-long.577. URL https://aclanthology.org/ 2022.acl-long.577.
|
| 279 |
+
|
| 280 |
+
James Lee-Thorp, Joshua Ainslie, Ilya Eckstein, and Santiago Ontanon. FNet: Mixing Tokens with Fourier Transforms. arxiv:2105.03824 [cs], May 2021. URL https://arxiv.org/abs/ 2105.03824v3.
|
| 281 |
+
|
| 282 |
+
Tao Lei, Ran Tian, Jasmijn Bastings, and Ankur P. Parikh. Simple Recurrence Improves Masked Language Models. arxiv:2205.11588[cs], May 2022. URL http://arxiv.org/abs/ 2205.11588.
|
| 283 |
+
|
| 284 |
+
Conglong Li, Minjia Zhang, and Yuxiong He. Curriculum Learning: A Regularization Method for Efficient and Stable Billion-Scale GPT Model Pre-Training. arXiv:2108.06084 [cs], February 2022. URL http://arxiv.org/abs/2108.06084.
|
| 285 |
+
|
| 286 |
+
Frederick Liu, Siamak Shakeri, Hongkun Yu, and Jing Li. EncT5: Fine-tuning T5 Encoder for Nonautoregressive Tasks. arxiv:2110.08426[cs], October 2021a. doi: 10.48550/arXiv.2110.08426. URL http://arxiv.org/abs/2110.08426.
|
| 287 |
+
|
| 288 |
+
Liyuan Liu, Haoming Jiang, Pengcheng He, Weizhu Chen, Xiaodong Liu, Jianfeng Gao, and Jiawei Han. On the Variance of the Adaptive Learning Rate and Beyond. In International Conference on Learning Representations, March 2020a. URL https://openreview.net/forum?id= rkgz2aEKDr.
|
| 289 |
+
|
| 290 |
+
Liyuan Liu, Xiaodong Liu, Jianfeng Gao, Weizhu Chen, and Jiawei Han. Understanding the Difficulty of Training Transformers. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 5747–5763, Online, November 2020b. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-main.463. URL https: //aclanthology.org/2020.emnlp-main.463.
|
| 291 |
+
|
| 292 |
+
Liyuan Liu, Jialu Liu, and Jiawei Han. Multi-head or Single-head? An Empirical Comparison for Transformer Training. arxiv:2106.09650[cs], June 2021b. doi: 10.48550/arXiv.2106.09650. URL http://arxiv.org/abs/2106.09650.
|
| 293 |
+
|
| 294 |
+
Xiaoyu Liu, Jiahao Su, and Furong Huang. Tuformer: Data-driven Design of Transformers for Improved Generalization or Efficiency. In International Conference on Learning Representations, September 2021c. URL https://openreview.net/forum?id ${ \bf \Phi } = { \bf \Phi }$ V0A5g83gdQ_.
|
| 295 |
+
|
| 296 |
+
Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. RoBERTa: A Robustly Optimized BERT Pretraining Approach. arXiv:1907.11692 [cs], July 2019. URL http://arxiv.org/abs/ 1907.11692.
|
| 297 |
+
|
| 298 |
+
Zeyu Liu, Yizhong Wang, Jungo Kasai, Hannaneh Hajishirzi, and Noah A. Smith. Probing Across Time: What Does RoBERTa Know and When? In Findings of the Association for Computational Linguistics: EMNLP 2021, pp. 820–842, Punta Cana, Dominican Republic, November 2021d. Association for Computational Linguistics. doi: 10.18653/v1/2021.findings-emnlp.71. URL https://aclanthology.org/2021.findings-emnlp.71.
|
| 299 |
+
|
| 300 |
+
Ilya Loshchilov and Frank Hutter. Decoupled Weight Decay Regularization. arXiv:1711.05101 [cs, math], November 2017. URL http://arxiv.org/abs/1711.05101.
|
| 301 |
+
|
| 302 |
+
Stephen Merity. Single Headed Attention RNN: Stop Thinking With Your Head. arXiv:1911.11423 [cs], November 2019. URL http://arxiv.org/abs/1911.11423.
|
| 303 |
+
|
| 304 |
+
Paulius Micikevicius, Sharan Narang, Jonah Alben, Gregory Diamos, Erich Elsen, David Garcia, Boris Ginsburg, Michael Houston, Oleksii Kuchaiev, Ganesh Venkatesh, and Hao Wu. Mixed Precision Training. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $=$ r1gs9JgRZ.
|
| 305 |
+
|
| 306 |
+
Soren Mindermann, Jan Brauner, Muhammed Razzak, Mrinank Sharma, Andreas Kirsch, Win- ¨ nie Xu, Benedikt Holtgen, Aidan N. Gomez, Adrien Morisot, Sebastian Farquhar, and Yarin ¨ Gal. Prioritized Training on Points that are Learnable, Worth Learning, and Not Yet Learnt. arxiv:2206.07137[cs], June 2022. doi: 10.48550/arXiv.2206.07137. URL http://arxiv. org/abs/2206.07137.
|
| 307 |
+
|
| 308 |
+
Subhabrata Mukherjee, Ahmed Hassan Awadallah, and Jianfeng Gao. XtremeDistilTransformers: Task Transfer for Task-agnostic Distillation. arXiv:2106.04563 [cs], June 2021. URL http: //arxiv.org/abs/2106.04563.
|
| 309 |
+
|
| 310 |
+
Rafael Muller, Simon Kornblith, and Geoffrey E Hinton.¨ When does label smoothing help? In Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. URL https://papers.nips.cc/paper/2019/hash/ f1748d6b0fd9d439f71450117eba2725-Abstract.html.
|
| 311 |
+
|
| 312 |
+
Vaishnavh Nagarajan and J. Zico Kolter. Generalization in Deep Networks: The Role of Distance from Initialization. arXiv:1901.01672 [cs, stat], January 2019. URL http://arxiv.org/ abs/1901.01672.
|
| 313 |
+
|
| 314 |
+
Sharan Narang, Hyung Won Chung, Yi Tay, Liam Fedus, Thibault Fevry, Michael Matena, Karishma Malkan, Noah Fiedel, Noam Shazeer, Zhenzhong Lan, Yanqi Zhou, Wei Li, Nan Ding, Jake Marcus, Adam Roberts, and Colin Raffel. Do Transformer Modifications Transfer Across Implementations and Applications? In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pp. 5758–5773, Online and Punta Cana, Dominican Republic, November 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.emnlp-main.465. URL https://aclanthology.org/2021.emnlp-main.465.
|
| 315 |
+
|
| 316 |
+
Shar Narasimhan. NVIDIA Clocks World’s Fastest BERT Training Time and Largest Transformer Based Model, Paving Path For Advanced Conversational AI, August 2019. URL https:// developer.nvidia.com/blog/training-bert-with-gpus/.
|
| 317 |
+
|
| 318 |
+
Piotr Nawrot, Szymon Tworkowski, Michał Tyrolski, Łukasz Kaiser, Yuhuai Wu, Christian Szegedy, and Henryk Michalewski. Hierarchical Transformers Are More Efficient Language Models. arxiv:2110.13711[cs], April 2022. URL http://arxiv.org/abs/2110.13711.
|
| 319 |
+
|
| 320 |
+
Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in PyTorch. In NIPS 2017 Autodiff Workshop, Long Beach, CA, 2017. URL https: //openreview.net/forum?id $=$ BJJsrmfCZ.
|
| 321 |
+
|
| 322 |
+
Bo Peng. RWKV-LM. Zenodo, August 2021. URL https://zenodo.org/record/ 5196577.
|
| 323 |
+
|
| 324 |
+
Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language Models are Unsupervised Multitask Learners. OpenAI, pp. 24, 2019.
|
| 325 |
+
|
| 326 |
+
Jack W. Rae, Sebastian Borgeaud, Trevor Cai, Katie Millican, Jordan Hoffmann, Francis Song, John Aslanides, Sarah Henderson, Roman Ring, Susannah Young, Eliza Rutherford, Tom Hennigan, Jacob Menick, Albin Cassirer, Richard Powell, George van den Driessche, Lisa Anne Hendricks, Maribeth Rauh, Po-Sen Huang, Amelia Glaese, Johannes Welbl, Sumanth Dathathri, Saffron Huang, Jonathan Uesato, John Mellor, Irina Higgins, Antonia Creswell, Nat McAleese, Amy Wu, Erich Elsen, Siddhant Jayakumar, Elena Buchatskaya, David Budden, Esme Sutherland, Karen Simonyan, Michela Paganini, Laurent Sifre, Lena Martens, Xiang Lorraine Li, Adhiguna Kuncoro, Aida Nematzadeh, Elena Gribovskaya, Domenic Donato, Angeliki Lazaridou, Arthur Mensch, Jean-Baptiste Lespiau, Maria Tsimpoukelli, Nikolai Grigorev, Doug Fritz, Thibault Sottiaux, Mantas Pajarskas, Toby Pohlen, Zhitao Gong, Daniel Toyama, Cyprien de Masson d’Autume, Yujia Li, Tayfun Terzi, Vladimir Mikulik, Igor Babuschkin, Aidan Clark, Diego de Las Casas, Aurelia Guy, Chris Jones, James Bradbury, Matthew Johnson, Blake Hechtman, Laura Weidinger, Iason Gabriel, William Isaac, Ed Lockhart, Simon Osindero, Laura Rimell, Chris Dyer, Oriol Vinyals, Kareem Ayoub, Jeff Stanway, Lorrayne Bennett, Demis Hassabis, Koray Kavukcuoglu, and Geoffrey Irving. Scaling Language Models: Methods, Analysis & Insights from Training Gopher. arXiv:2112.11446 [cs], January 2022. URL http://arxiv.org/abs/2112.11446.
|
| 327 |
+
|
| 328 |
+
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-toText Transformer. arXiv:1910.10683 [cs, stat], July 2020. URL http://arxiv.org/abs/ 1910.10683.
|
| 329 |
+
|
| 330 |
+
Jeff Rasley, Samyam Rajbhandari, Olatunji Ruwase, and Yuxiong He. DeepSpeed: System Optimizations Enable Training Deep Learning Models with Over 100 Billion Parameters. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, KDD ’20, pp. 3505–3506, New York, NY, USA, August 2020. Association for Computing Machinery. ISBN 978-1-4503-7998-4. doi: 10.1145/3394486.3406703. URL https://doi.org/10.1145/3394486.3406703.
|
| 331 |
+
|
| 332 |
+
Jie Ren, Samyam Rajbhandari, Reza Yazdani Aminabadi, Olatunji Ruwase, Shuangyan Yang, Minjia Zhang, Dong Li, and Yuxiong He. {ZeRO-Offload $\}$ : Democratizing {Billion-Scale} Model Training. In 2021 USENIX Annual Technical Conference (USENIX ATC 21), pp. 551– 564, 2021. ISBN 978-1-939133-23-6. URL https://www.usenix.org/conference/ atc21/presentation/ren-jie.
|
| 333 |
+
|
| 334 |
+
Oliver Richter and Roger Wattenhofer. Normalized Attention Without Probability Cage. arXiv:2005.09561 [cs, stat], May 2020. URL http://arxiv.org/abs/2005.09561.
|
| 335 |
+
|
| 336 |
+
Aurko Roy, Rohan Anil, Guangda Lai, Benjamin Lee, Jeffrey Zhao, Shuyuan Zhang, Shibo Wang, Ye Zhang, Shen Wu, Rigel Swavely, Tao, Yu, Phuong Dao, Christopher Fifty, Zhifeng Chen, and Yonghui Wu. N-Grammer: Augmenting Transformers with latent n-grams. arxiv:2207.06366[cs], July 2022. doi: 10.48550/arXiv.2207.06366. URL http://arxiv. org/abs/2207.06366.
|
| 337 |
+
|
| 338 |
+
Christian Sarofeen, Piotr Bialecki, Jie Jiang, Kevin Stephano, Masaki Kozuki, Neal Vaidya, and Stas Bekman. Introducing nvFuser, a deep learning compiler for PyTorch, August 2022. URL https://pytorch.org/blog/ introducing-nvfuser-a-deep-learning-compiler-for-pytorch/.
|
| 339 |
+
|
| 340 |
+
Teven Le Scao, Thomas Wang, Daniel Hesslow, Lucile Saulnier, Stas Bekman, M. Saiful Bari, Stella Biderman, Hady Elsahar, Jason Phang, Ofir Press, Colin Raffel, Victor Sanh, Sheng Shen, Lintang Sutawika, Jaesung Tae, Zheng Xin Yong, Julien Launay, and Iz Beltagy. What Language Model to Train if You Have One Million GPU Hours? In Challenges {\&, April 2022. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ rI7BL3fHIZq.
|
| 341 |
+
|
| 342 |
+
Avi Schwarzschild. Easy-To-Hard, October 2021. URL https://github.com/aks2203/ easy-to-hard.
|
| 343 |
+
|
| 344 |
+
Thibault Sellam, Steve Yadlowsky, Ian Tenney, Jason Wei, Naomi Saphra, Alexander D’Amour, Tal Linzen, Jasmijn Bastings, Iulia Raluca Turc, Jacob Eisenstein, Dipanjan Das, and Ellie Pavlick. The MultiBERTs: BERT Reproductions for Robustness Analysis. In International Conference on Learning Representations, March 2022. URL https://openreview.net/forum?id= K0E_F0gFDgA.
|
| 345 |
+
|
| 346 |
+
Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural Machine Translation of Rare Words with Subword Units. In Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 1715–1725, Berlin, Germany, August 2016. Association for Computational Linguistics. doi: 10.18653/v1/P16-1162. URL https: //aclanthology.org/P16-1162.
|
| 347 |
+
|
| 348 |
+
Noam Shazeer and Mitchell Stern. Adafactor: Adaptive Learning Rates with Sublinear Memory Cost. arxiv:1804.04235[cs, stat], April 2018. doi: 10.48550/arXiv.1804.04235. URL http: //arxiv.org/abs/1804.04235.
|
| 349 |
+
|
| 350 |
+
Sheng Shen, Pete Walsh, Kurt Keutzer, Jesse Dodge, Matthew Peters, and Iz Beltagy. Staged Training for Transformer Language Models. arXiv:2203.06211 [cs], March 2022. URL http: //arxiv.org/abs/2203.06211.
|
| 351 |
+
|
| 352 |
+
Sam Shleifer, Jason Weston, and Myle Ott. NormFormer: Improved Transformer Pretraining with Extra Normalization. arXiv:2110.09456 [cs], November 2021. URL http://arxiv.org/ abs/2110.09456.
|
| 353 |
+
|
| 354 |
+
Leslie N. Smith and Nicholay Topin. Super-Convergence: Very Fast Training of Neural Networks Using Large Learning Rates. arXiv:1708.07120 [cs, stat], May 2018. URL http://arxiv. org/abs/1708.07120.
|
| 355 |
+
|
| 356 |
+
David So, Wojciech Manke, Hanxiao Liu, Zihang Dai, Noam Shazeer, and Quoc V. Le. Searching ´ for Efficient Transformers for Language Modeling. In Advances in Neural Information Processing Systems, May 2021. URL https://openreview.net/forum?id=bzpkxS_JVsI.
|
| 357 |
+
|
| 358 |
+
Sharath Nittur Sridhar, Anthony Sarah, and Sairam Sundaresan. TrimBERT: Tailoring BERT for Trade-offs. arXiv:2202.12411 [cs], February 2022. URL http://arxiv.org/abs/2202. 12411.
|
| 359 |
+
|
| 360 |
+
Jianlin Su, Yu Lu, Shengfeng Pan, Bo Wen, and Yunfeng Liu. RoFormer: Enhanced Transformer with Rotary Position Embedding. arxiv:2104.09864 [cs], April 2021. URL https://arxiv. org/abs/2104.09864v2.
|
| 361 |
+
|
| 362 |
+
Sainbayar Sukhbaatar, Edouard Grave, Piotr Bojanowski, and Armand Joulin. Adaptive Attention Span in Transformers. arXiv:1905.07799 [cs, stat], August 2019. URL http://arxiv.org/ abs/1905.07799.
|
| 363 |
+
|
| 364 |
+
Siqi Sun, Yu Cheng, Zhe Gan, and Jingjing Liu. Patient Knowledge Distillation for BERT Model Compression. 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. 4323–4332, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1441. URL https://aclanthology.org/ D19-1441.
|
| 365 |
+
|
| 366 |
+
Zhiqing Sun, Hongkun Yu, Xiaodan Song, Renjie Liu, Yiming Yang, and Denny Zhou. MobileBERT: A Compact Task-Agnostic BERT for Resource-Limited Devices. arXiv:2004.02984 [cs], April 2020. URL http://arxiv.org/abs/2004.02984.
|
| 367 |
+
|
| 368 |
+
Richard Sutton. The Bitter Lesson. Incomplete Ideas (blog), pp. 1, March 2019. URL http: //www.incompleteideas.net/IncIdeas/BitterLesson.html.
|
| 369 |
+
|
| 370 |
+
Liling Tan. What the bookcorpus?, December 2019. URL https://gist.github.com/ alvations/4d2278e5a5fbcf2e07f49315c4ec1110.
|
| 371 |
+
|
| 372 |
+
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:2011.04006 [cs], November 2020a. URL http://arxiv.org/abs/ 2011.04006.
|
| 373 |
+
|
| 374 |
+
Yi Tay, Mostafa Dehghani, Dara Bahri, and Donald Metzler. Efficient Transformers: A Survey. arXiv:2009.06732 [cs], September 2020b. URL http://arxiv.org/abs/2009.06732.
|
| 375 |
+
|
| 376 |
+
Yi Tay, Mostafa Dehghani, Jinfeng Rao, William Fedus, Samira Abnar, Hyung Won Chung, Sharan Narang, Dani Yogatama, Ashish Vaswani, and Donald Metzler. Scale Efficiently: Insights from Pretraining and Finetuning Transformers. In International Conference on Learning Representations, September 2021. URL https://openreview.net/forum?id=f2OYVDyfIB.
|
| 377 |
+
|
| 378 |
+
Yi Tay, Mostafa Dehghani, Samira Abnar, Hyung Won Chung, William Fedus, Jinfeng Rao, Sharan Narang, Vinh Q. Tran, Dani Yogatama, and Donald Metzler. Scaling Laws vs Model Architectures: How does Inductive Bias Influence Scaling? arxiv:2207.10551[cs], July 2022a. doi: 10.48550/arXiv.2207.10551. URL http://arxiv.org/abs/2207.10551.
|
| 379 |
+
|
| 380 |
+
Yi Tay, Mostafa Dehghani, Vinh Q. Tran, Xavier Garcia, Dara Bahri, Tal Schuster, Huaixiu Steven Zheng, Neil Houlsby, and Donald Metzler. Unifying Language Learning Paradigms. arxiv:2205.05131[cs], May 2022b. URL http://arxiv.org/abs/2205.05131.
|
| 381 |
+
|
| 382 |
+
Marcos Treviso, Tianchu Ji, Ji-Ung Lee, Betty van Aken, Qingqing Cao, Manuel R. Ciosici, Michael Hassid, Kenneth Heafield, Sara Hooker, Pedro H. Martins, Andre F. T. Martins, Pe-´ ter Milder, Colin Raffel, Edwin Simpson, Noam Slonim, Niranjan Balasubramanian, Leon Derczynski, and Roy Schwartz. Efficient Methods for Natural Language Processing: A Survey. arxiv:2209.00099[cs], August 2022. URL http://arxiv.org/abs/2209.00099.
|
| 383 |
+
|
| 384 |
+
Iulia Turc, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Well-Read Students Learn Better: On the Importance of Pre-training Compact Models. arXiv:1908.08962 [cs], September 2019. URL http://arxiv.org/abs/1908.08962.
|
| 385 |
+
|
| 386 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention Is All You Need. arXiv:1706.03762 [cs], December 2017. URL http://arxiv.org/abs/1706.03762.
|
| 387 |
+
|
| 388 |
+
Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R. Bowman. GLUE: A Multi-Task Benchmark and Analysis Platform for Natural Language Understanding. In International Conference on Learning Representations, September 2018. URL https:// openreview.net/forum?id=rJ4km2R5t7.
|
| 389 |
+
|
| 390 |
+
Shibo Wang and Pankaj Kanwar. BFloat16: The secret to high performance on Cloud TPUs, August 2019. URL https:// cloud.google.com/blog/products/ai-machine-learning/ bfloat16-the-secret-to-high-performance-on-cloud-tpus/.
|
| 391 |
+
|
| 392 |
+
Sinong Wang, Belinda Z. Li, Madian Khabsa, Han Fang, and Hao Ma. Linformer: Self-Attention with Linear Complexity. arxiv:2006.04768v3 [cs], June 2020a. URL https://arxiv.org/ abs/2006.04768v3.
|
| 393 |
+
|
| 394 |
+
Thomas Wang, Adam Roberts, Daniel Hesslow, Teven Le Scao, Hyung Won Chung, Iz Beltagy, Julien Launay, and Colin Raffel. What Language Model Architecture and Pretraining Objective Work Best for Zero-Shot Generalization? arXiv:2204.05832 [cs, stat], April 2022. URL http: //arxiv.org/abs/2204.05832.
|
| 395 |
+
|
| 396 |
+
Wenhui Wang, Furu Wei, Li Dong, Hangbo Bao, Nan Yang, and Ming Zhou. MiniLM: Deep Self-Attention Distillation for Task-Agnostic Compression of Pre-Trained Transformers. arXiv:2002.10957 [cs], April 2020b. URL http://arxiv.org/abs/2002.10957.
|
| 397 |
+
|
| 398 |
+
Alex Warstadt, Amanpreet Singh, and Samuel R. Bowman. Neural Network Acceptability Judgments. arxiv:1805.12471[cs], October 2019. doi: 10.48550/arXiv.1805.12471. URL http: //arxiv.org/abs/1805.12471.
|
| 399 |
+
|
| 400 |
+
Alexander Wettig, Tianyu Gao, Zexuan Zhong, and Danqi Chen. Should You Mask $15 \%$ in Masked Language Modeling? arxiv: 2202.08005 [cs], February 2022. URL https://arxiv.org/ abs/2202.08005v1.
|
| 401 |
+
|
| 402 |
+
Noam Wies, Yoav Levine, Daniel Jannai, and Amnon Shashua. Which transformer architecture fits my data? A vocabulary bottleneck in self-attention. In Proceedings of the 38th International Conference on Machine Learning, pp. 11170–11181. PMLR, July 2021. URL https://proceedings.mlr.press/v139/wies21a.html.
|
| 403 |
+
|
| 404 |
+
Rachel Wilka, Rachel Landy, and Scott A. McKinney. How Machines Learn: Where Do Companies Get Data for Machine Learning and What Licenses Do They Need. Washington Journal of Law, Technology & Arts, 13(3):217–244, 2017. URL https://heinonline.org/HOL/P?h= hein.journals/washjolta13& $\dot { \bar { \tau } } = 2 2 6$ .
|
| 405 |
+
|
| 406 |
+
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. HuggingFace’s Transformers: Stateof-the-art Natural Language Processing. arXiv:1910.03771 [cs], July 2020. URL http:// arxiv.org/abs/1910.03771.
|
| 407 |
+
|
| 408 |
+
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:1609.08144[cs], October 2016. URL http://arxiv.org/abs/1609.08144.
|
| 409 |
+
|
| 410 |
+
Ruibin Xiong, Yunchang Yang, Di He, Kai Zheng, Shuxin Zheng, Chen Xing, Huishuai Zhang, Yanyan Lan, Liwei Wang, and Tie-Yan Liu. On Layer Normalization in the Transformer Architecture. arXiv:2002.04745 [cs, stat], June 2020. URL http://arxiv.org/abs/2002. 04745.
|
| 411 |
+
|
| 412 |
+
Abhay Yadav. Making L-BFGS Work with Industrial-Strength Nets. In BMVC 2020, pp. 13, 2020.
|
| 413 |
+
|
| 414 |
+
Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Ruslan Salakhutdinov, and Quoc V. Le. XLNet: Generalized Autoregressive Pretraining for Language Understanding. arXiv:1906.08237 [cs], January 2020. URL http://arxiv.org/abs/1906.08237.
|
| 415 |
+
|
| 416 |
+
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, September 2019. URL https://openreview.net/forum?id $=$ Syx4wnEtvH.
|
| 417 |
+
|
| 418 |
+
Manzil Zaheer, Guru Guruganesh, Avinava Dubey, Joshua Ainslie, Chris Alberti, Santiago Ontanon, Philip Pham, Anirudh Ravula, Qifan Wang, Li Yang, and Amr Ahmed. Big Bird: Transformers for Longer Sequences. arXiv:2007.14062 [cs, stat], January 2021. URL http://arxiv. org/abs/2007.14062.
|
| 419 |
+
|
| 420 |
+
Biao Zhang and Rico Sennrich. Root Mean Square Layer Normalization. arXiv:1910.07467 [cs, stat], October 2019. URL http://arxiv.org/abs/1910.07467.
|
| 421 |
+
|
| 422 |
+
Minjia Zhang and Yuxiong He. Accelerating Training of Transformer-Based Language Models with Progressive Layer Dropping. In Advances in Neural Information Processing Systems, volume 33, pp. 14011–14023, 2020. URL https://proceedings.neurips.cc/paper/ 2020/hash/a1140a3d0df1c81e24ae954d935e8926-Abstract.html?fbclid= IwAR2bOnieMB2yBSK6Ks9_RVAkPHfUnTQLliZzJEzp89cLiIvErF_zf6efu6c.
|
| 423 |
+
|
| 424 |
+
Chen Zhu, Renkun Ni, Zheng Xu, Kezhi Kong, W. Ronny Huang, and Tom Goldstein. GradInit: Learning to Initialize Neural Networks for Stable and Efficient Training. arxiv:2102.08098[cs], November 2021. doi: 10.48550/arXiv.2102.08098. URL http://arxiv.org/abs/2102. 08098.
|
| 425 |
+
|
| 426 |
+
A APPENDIX
|
| 427 |
+
|
| 428 |
+
# B LIMITATIONS
|
| 429 |
+
|
| 430 |
+
In this work, we limited our investigation to transformer-based architectures trained with MLM objectives. However, we do think that the general task of cramming posed in Section 2 is interesting even when relaxing these constraints. There have been a number of modifications proposed to the objective in particular (Joshi et al., 2020; Bao et al., 2020; Bajaj et al., 2022; Tay et al., 2022b). While Artetxe et al. (2022) and Wang et al. (2022) find MLM still to hold up well as a pretraining objective, other suggestions such as ELECTRA (Clark et al., 2019; 2020; He et al., 2021) could be employed which might be beneficial for crammed models. Also, the optimal architecture might not be transformer-based (Merity, 2019; Fusco et al., 2022; Peng, 2021)
|
| 431 |
+
|
| 432 |
+
# C OTHER MODIFICATIONS
|
| 433 |
+
|
| 434 |
+
A few recent developments not included in this study are Roy et al. (2022), Shen et al. (2022), and Mindermann et al. (2022). Modifications further not included in this study are more involved initialization (Zhu et al., 2021), additional objective modifications (Muller et al. ¨ , 2019), progressive growth (Gu et al., 2021; Shen et al., 2022), convolutional variants (Iandola et al., 2020; Chelombiev et al., 2021; So et al., 2021), sequence recurrence (Lei et al., 2022) and TUPE embeddings (Ke et al., 2020).
|
| 435 |
+
|
| 436 |
+
D ADDITIONAL INFORMATION
|
| 437 |
+
|
| 438 |
+
Table 5: Additional raw results for experiments considered in the main body. First two blocks: Architectural variants as discussed in Section 4.2. Third block: Ablation study of finally adopted model. All experiments run with the training setup described in Section 4.3 for a day on a single GPU with mixed precision. Batch size is 4032 and dataset is bookcorpus-wikipedia. Downstream evaluation as described in Section 5.
|
| 439 |
+
|
| 440 |
+
<table><tr><td>Name</td><td>MLMLoss</td><td>MNLI-m</td><td>MNLI-mm</td><td>Tokens/Second</td></tr><tr><td>Modified Transformer</td><td>1.89</td><td>81.02</td><td>81.35</td><td>50946</td></tr><tr><td>DeepNarrow (12Layers)</td><td>1.94</td><td>80.90</td><td>80.97</td><td>78396</td></tr><tr><td>DeepNarrow (24 Layers)</td><td>1.98</td><td>80.78</td><td>81.14</td><td>41289</td></tr><tr><td>E=128</td><td>2.14</td><td>76.68</td><td>77.62</td><td>53267</td></tr><tr><td>FFN every 2 blocks</td><td>1.93</td><td>80.43</td><td>80.97</td><td>64774</td></tr><tr><td>FFN every 3 blocks</td><td>1.97</td><td>80.44</td><td>80.93</td><td>71634</td></tr><tr><td>FFN every 4 blocks</td><td>2.00</td><td>80.03</td><td>79.67</td><td>73319</td></tr><tr><td>H= 512</td><td>1.93</td><td>80.61</td><td>80.93</td><td>83718</td></tr><tr><td>H= 1024</td><td>1.95</td><td>80.07</td><td>80.68</td><td>32004</td></tr><tr><td>4 Layers</td><td>2.00</td><td>78.45</td><td>79.00</td><td>137127</td></tr><tr><td>6 Layers</td><td>1.93</td><td>79.49</td><td>79.82</td><td>96156</td></tr><tr><td>8 Layers</td><td>1.89</td><td>81.11</td><td>81.08</td><td>74248</td></tr><tr><td>10 Layers</td><td>1.89</td><td>81.02</td><td>81.21</td><td>61431</td></tr><tr><td>16 Layers</td><td>1.92</td><td>81.39</td><td>82.10</td><td>39406</td></tr><tr><td>24 Layers</td><td>2.01</td><td>80.64</td><td>80.97</td><td>26927</td></tr><tr><td>Recurrent (1-12)</td><td>2.40</td><td>77.46</td><td>77.81</td><td>52405</td></tr><tr><td>Recurrent (2-6)</td><td>2.04</td><td>80.45</td><td>80.73</td><td>53148</td></tr><tr><td>Recurrent (3-4)</td><td>2.00</td><td>80.78</td><td>81.33</td><td>51634</td></tr><tr><td>Recurrent (4-3)</td><td>1.98</td><td>80.95</td><td>81.26</td><td>51952</td></tr><tr><td>BERT-tiny</td><td>3.30</td><td>56.71</td><td>57.21</td><td>914694</td></tr><tr><td>BERT-mini</td><td>2.49</td><td>72.22</td><td>73.21</td><td>429593</td></tr><tr><td>BERT-Large (Izsak variant)</td><td>2.38</td><td>76.93</td><td>77.47</td><td>13448</td></tr><tr><td>Original BERT</td><td>7.54</td><td>35.45</td><td>35.22</td><td>41978</td></tr><tr><td>With decoder bias</td><td>1.89</td><td>80.97</td><td>81.20</td><td>51155</td></tr><tr><td>ε= 6 in Layer Norm</td><td>1.90</td><td>80.49</td><td>81.35</td><td>51728</td></tr><tr><td>Learned Embedding</td><td>1.88</td><td>80.51</td><td>81.03</td><td>52601</td></tr><tr><td>No Norm after Embedding</td><td>1.94</td><td>79.65</td><td>80.34</td><td>52175</td></tr><tr><td>No Final Norm</td><td>1.89</td><td>80.40</td><td>80.89</td><td>51207</td></tr><tr><td>No Skip of Head Transform</td><td>1.88</td><td>80.49</td><td>81.19</td><td>51728</td></tr><tr><td>No Rotational Embedding</td><td>1.88</td><td>80.91</td><td>81.52</td><td>53526</td></tr><tr><td>Post-LN</td><td>7.54</td><td>31.82</td><td>31.82</td><td>52270</td></tr><tr><td>With QKV bias</td><td>1.89</td><td>80.70</td><td>80.88</td><td>51112</td></tr><tr><td>With bias in Linear Layers</td><td>1.89</td><td>80.64</td><td>81.49</td><td>50584</td></tr><tr><td>12 Heads</td><td>1.88</td><td>81.75</td><td>81.99</td><td>47967</td></tr></table>
|
md/dev/hfjbX1UKNx/hfjbX1UKNx.md
ADDED
|
@@ -0,0 +1,497 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MCL-GAN: GENERATIVE ADVERSARIAL NETWORKSWITH MULTIPLE SPECIALIZED DISCRIMINATORS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
We propose a generative adversarial network with multiple discriminators, which collaborate to represent a real dataset more effectively. This approach facilitates learning a generator consistent with the underlying data distribution based on real images and thus mitigates the chronic mode collapse problem. From the inspiration of multiple choice learning, we guide each discriminator to have expertise in the subset of the entire data and allow the generator to find reasonable correspondences between the latent and real data spaces automatically without the extra supervision for training examples. Despite the use of multiple discriminators, the backbone networks are shared across the discriminators and the increase of training cost is marginal. We demonstrate the effectiveness of our algorithm using multiple evaluation metrics in the standard datasets for diverse tasks.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Generative models learn to represent a probability distribution of data. With recent advances of deep generative models, Generative Adversarial Networks (GANs) (Goodfellow et al., 2014) and Variational Autoencoders (VAEs) (Kingma & Welling, 2014) have shown impressive achievements in unconditional generation of high-dimensional realistic images as well as various conditional generation tasks including image-to-image translation (Zhu et al., 2017b; Lee et al., 2018; Zhu et al., 2017a), image inpainting (Yeh et al., 2017), image super-resolution (Ledig et al., 2017), etc.
|
| 12 |
+
|
| 13 |
+
GANs have received a lot of attention due to their interesting framework of minimax games, where two agents, a generator and a discriminator, compete against each other. Specifically, a discriminator distinguishes whether a sample comes from the real dataset or the generator while the generator attempts to deceive the discriminator. In theory, the generator learns the real data distribution by reaching an equilibrium point of the minimax game. It is known that GANs produce acute, high quality images compared to VAEs. However, in practice, the alternating training procedure does not guarantee the convergence to the optimal solution and often experiences mode collapsing, failing to cover the multiple modes of real data or, even worse, reaching at trivial solutions.
|
| 14 |
+
|
| 15 |
+
This paper focuses on the mode collapse problem in training GANs. Our main idea is adopting multiple collaborating discriminators. Each discriminator is learned to specialize in a subset of reference data space, which is identified automatically via the training procedure, so the ensemble of discriminators provide not only the differentiation of fake data, but also more accurate predictions over the clusters of real data. In this respect, a generator is encouraged to produce diverse modes that deceive a set of discrimantors. We employ Multiple Choice Learning (MCL) to learn multiple discriminators that are trained on a subset of training data as illustrated in Figure 1. The generator is updated via a set of expert models, each of which is associated with a subset of the true and generated examples closest to the expert. We call the proposed approach based on a single generator and multiple discriminators MCL-GAN, which is optimized by the standard objective of GAN combined with the objective for MCL in the discriminator side.
|
| 16 |
+
|
| 17 |
+
There are several GAN literatures that employ multiple discriminators (Nguyen et al., 2017; Durugkar et al., 2017; Albuquerque et al., 2019). Among them, GMAN (Durugkar et al., 2017) is closely related with our approach in the sense that it utilizes the ensemble prediction of discriminators. It explores multi-discriminator extensions of GANs with diverse versions of the aggregated prediction of discriminators—from a harsh trainer to a lenient teacher with a softened criteria. Meanwhile, there are significant differences in the method of ensembling from our approach. While GMAN focuses on the loss to the generator with parallel learning of discriminators, our strategy takes care of the specialization of each discriminator for more informative feedbacks to the generator.
|
| 18 |
+
|
| 19 |
+
The training algorithm of the proposed method is inspired by Multiple Choice Learning (Lee et al., 2016), which is known to be effective in learning specialized models with high oracle accuracy in recognition tasks. Encouraged by this benefit, Chen & Koltun (2017); Mun et al. (2018); Firman et al. (2018); Li et al. (2019) apply MCL or its variations (Lee et al., 2017; Tian et al., 2019) to produce diverse and accurate outputs in several applications. For instance, Mun et al. (2018) propose MCL-KD framework to come up with the visual question answering (VQA) systems based on multiple models that are specialized in different types of visual reasonings. Li et al. (2019) apply MCL to a conditional generative model for synthesizing diverse image from semantic layouts. DiverseNet (Firman et al., 2018) introduces the control parameter as an input that diversifies the outputs of networks with an MCL loss by making each control parameter ally with a different mode of data. While these works generate multiple outputs explicitly and select them at inference time, our approach adopts a unique strategy for diversifying the mode, learning to branch the decision of discriminators.
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
Figure 1: The main idea of MCL-GAN. Each discriminator $D _ { m }$ is trained to specialize in the cluster $S _ { m }$ of the real dataset. The mapping between $D _ { m }$ and $S _ { m }$ is obtained automatically by MCL.
|
| 23 |
+
|
| 24 |
+
The proposed method takes an advantage of MCL techniques into unconditional generative models, which has not been explored before. No supervision such as class labels or other conditions are assumed unlike the aforementioned works. Our main contributions are summarized as follows:
|
| 25 |
+
|
| 26 |
+
• We propose a single-generator multi-discriminator GAN training algorithm to alleviate the mode collapse problem. Our approach provides simple yet effective updating rules based on MCL to achieve the goal.
|
| 27 |
+
We present a balanced discriminator assignment strategy to facilitate the robust convergence of models and preserve the multi-modality of training data, where the number of the discriminators is determined adaptively.
|
| 28 |
+
• The proposed method is applicable to many GAN variants since there is no constraint on the network architectures or the loss functions. Our method requires a small additional overhead and trains the model with computational efficiency via feature sharing in the discriminators. We experimentally show the competence of our method in terms of the generated image quality and the behavior of the networks.
|
| 29 |
+
|
| 30 |
+
# 2 RELATED WORK
|
| 31 |
+
|
| 32 |
+
There exist a lot of GAN approaches that address the mode collapse problem for output diversity.
|
| 33 |
+
This section discusses the recent progress related to the issue briefly.
|
| 34 |
+
|
| 35 |
+
# 2.1 HANDLING MODE COLLAPSE FOR DIVERSITY
|
| 36 |
+
|
| 37 |
+
Many variations of GANs propose either novel metrics for the discriminator loss or better alternatives of the discriminator design. For example, LSGAN (Mao et al., 2017) substitutes the least square function for the binary cross-entropy function as the discriminator loss. WGAN (Arjovsky et al., 2017) introduces a critic function based on the Earth-Mover’s distance rather than a binary classifier, and WGAN-GP (Gulrajani et al., 2017) improves WGAN by adding a gradient penalty term. PacGAN (Lin et al., 2018) augments the discriminator’s input by packing samples for a single label. EBGAN (Zhao et al., 2017) models the discriminator as an energy function, which is, in effect, implemented by the reconstruction loss of the autoencoder. BiGAN (Donahue et al., 2017), ALI (Dumoulin et al., 2017), VEEGAN (Srivastava et al., 2017), Inclusive GAN (Yu et al., 2020) also learn reconstruction networks. In particular, VEEGAN (Srivastava et al., 2017) autoencodes the latent vectors to learn the inverse function of the generator and map both the true and generated data to the latent distribution, i.e. a Gaussian. Inclusive GAN (Yu et al., 2020) learns a generator by matching between real and fake examples in the feature space.
|
| 38 |
+
|
| 39 |
+
The mode collapse and diversity issue of generated outputs has been addressed explicitly in (Liu et al., 2019; Yang et al., 2018; Mao et al., 2019). They formulate the diversity metrics that encourage the mode exploration of the generators and derive the loss function using the metrics. To be specific, Liu et al. (2019) measure normalized pairwise distances between the latent vectors and between their corresponding outputs, which are employed as a diversity loss to optimize the generator.
|
| 40 |
+
|
| 41 |
+
# 2.2 GAN WITH MULTIPLE GENERATORS
|
| 42 |
+
|
| 43 |
+
Another line of research is the integration of multiple generators (Tolstikhin et al., 2017; Ghosh et al., 2018; Hoang et al., 2018; Park et al., 2018). This approach represents the data distribution with a mixture model enforcing each generator to cover a portion of the whole data space. It is naturally expected that mixture models approximate true distributions better than a single model especially in high-dimensional spaces with multiple modes.
|
| 44 |
+
|
| 45 |
+
MAD-GAN (Ghosh et al., 2018) introduce an augmented classifier as a discriminator, which predicts whether the sample is real and which generator the sample is drawn from, to encourage individual generators to learn distinctive modes. MGAN (Hoang et al., 2018) has the similar strategies to MADGAN, but constructs a separate branch in the discriminator to perform the two tasks. MEGAN (Park et al., 2018) adopts a gating network that produces a one-hot vector to select the generator creating the best example. P2GAN (Trung Le et al., 2019) sequentially adds a new generator to cover the missing modes of the real data.
|
| 46 |
+
|
| 47 |
+
# 2.3 GAN WITH MULTIPLE DISCRIMINATORS
|
| 48 |
+
|
| 49 |
+
Multiple discriminators are often employed to improve the performance of a single generator (Nguyen et al., 2017; Durugkar et al., 2017; Albuquerque et al., 2019; Doan et al., 2019). D2GAN (Nguyen et al., 2017) conducts a three player minimax game, where two discriminators are trained for the completely opposite objectives, minimizing Kullback-Leibler (KL) divergence and the inverse KL divergence between the true and generated data distributions. The balancing of two losses plays a role for seeking desirable and diverse modes at the same time. Albuquerque et al. (2019) propose a general multi-objective optimization framework in the scenario with multiple discriminators. They present the hypervolume maximization algorithm to obtain weighed gradients. Neyshabur et al. (2017) train a GAN based on multiple projections. Each discriminator makes a decision for the random low-dimensional projection of a sample to address the instability of GAN training in high-dimensions.
|
| 50 |
+
|
| 51 |
+
GMAN (Durugkar et al., 2017) presents diverse aggregation methods of multiple discriminators, where both hard and soft discriminator selection strategies are studied. Note that all the existing approaches learn the multiple discriminators independently and they may have strong correlations, which may not be appropriate for diversifying the generated samples. Our approach, however, assigns each sample to the best-suited discriminator through the interactions among the discriminators, and, consequently, each discriminator becomes the expert model for the assigned examples.
|
| 52 |
+
|
| 53 |
+
# 3 MULTIPLE CHOICE LEARNING
|
| 54 |
+
|
| 55 |
+
We present the main idea of MCL (Guzman-Rivera et al., 2012) and its extensions briefly. Given a training dataset with $N$ samples, $\mathcal { D } = \{ ( \mathbf { x } _ { i } , y _ { i } ) \} _ { i = 1 } ^ { N }$ , $M$ models, $\{ f _ { m } \} _ { m = 1 } ^ { M }$ and a task-specific loss function, $\ell ( \cdot , \cdot )$ , MCL minimizes the following oracle loss:
|
| 56 |
+
|
| 57 |
+
$$
|
| 58 |
+
\mathcal { L } _ { \mathrm { M C L } } ( \mathcal { D } ) = \sum _ { i = 1 } ^ { N } \operatorname* { m i n } _ { m } \ell ( y _ { i } , f _ { m } ( \mathbf { x } _ { i } ) ) .
|
| 59 |
+
$$
|
| 60 |
+
|
| 61 |
+
In other words, only the model with the smallest error out of $M$ candidates is selected for each example. This optimization process makes each model $f _ { m }$ become an expert for a subset of $\mathcal { D }$ , thus leads to forming a natural cluster in $\mathcal { D }$ .
|
| 62 |
+
|
| 63 |
+
A weakness of MCL is the possible mistakes caused by the overconfidence issues. If non-specialized models make wrong predictions with high confidences in the score aggregation process, the average scores are misleading and the ensemble model may result in poor quality outputs. To alleviate the limitation, Confident Multiple Choice Learning (CMCL) (Lee et al., 2017) adopts a confident oracle loss that enforces the predictions of a non-specialized model to be uniformly distributed using KL divergence, denoted by $D _ { \mathrm { K L } }$ . Assuming that $f _ { m }$ predicts the output distribution given data point $x$ , i.e., $P _ { m } ( y | x )$ , the modified loss is modified as
|
| 64 |
+
|
| 65 |
+
$$
|
| 66 |
+
{ \mathcal { L } } _ { \mathrm { C M C L } } ( { \mathcal { D } } ) = \sum _ { i = 1 } ^ { N } \sum _ { m = 1 } ^ { M } v _ { i , m } \ell ( y _ { i } , P _ { m } ( y | \mathbf { x } _ { i } ) ) + \beta ( 1 - v _ { i , m } ) D _ { \mathrm { K L } } ( { \mathcal { U } } ( y ) \| P _ { m } ( y | \mathbf { x } _ { i } ) ) ,
|
| 67 |
+
$$
|
| 68 |
+
|
| 69 |
+
where specia $\boldsymbol { \mathcal { U } } ( \boldsymbol { y } )$ is the uniform distrimodels. Note that, if , $v _ { i , m } \in \{ 0 , 1 \}$ allows the ch is assigned to ces of themodels. $\textstyle \sum _ { m = 1 } ^ { M } v _ { i , m } = k ( k < M )$ $k$
|
| 70 |
+
|
| 71 |
+
# 4 MCL-GAN
|
| 72 |
+
|
| 73 |
+
We describe our GAN structure with a generator $G ( \cdot ; \theta )$ and $M$ discriminators $\{ D _ { m } ( \cdot ; \phi _ { m } ) \} _ { m = 1 } ^ { M }$ extended from the standard GAN. Let $p _ { z }$ and $p _ { d }$ be the distributions of the latent space and real data space, respectively. Given $\mathbf { z } \sim p _ { z }$ , the generator produces a sample $\tilde { \mathbf { x } } = G ( z ; \theta )$ and $M$ predictions are made by the discriminators for each real example $\mathbf { x } \sim p _ { d }$ and fake sample x˜. Each prediction, $D _ { m } ( { \mathbf { x } } ; \phi _ { m } )$ , ranges in $[ 0 , 1 ]$ and represents the probability that $\mathbf { x }$ belongs to the true data distribution.
|
| 74 |
+
|
| 75 |
+
# 4.1 EXPERT TRAINING
|
| 76 |
+
|
| 77 |
+
Assuming that we draw $N _ { d }$ real data and generate $N _ { g }$ examples in each training batch, denoted by $\mathbf { x }$ and $\tilde { \mathbf { x } }$ , respectively, each network is trained as follows.
|
| 78 |
+
|
| 79 |
+
Discriminators Expert discriminators are the ones that predict the highest scores for each sample. With the indicator variable $v _ { i , m }$ for sample $\mathbf { x } _ { i }$ , the discriminators are trained to minimize the following loss function:
|
| 80 |
+
|
| 81 |
+
$$
|
| 82 |
+
\mathcal { L } _ { \mathrm { e } } ( \mathbf { x } ) = - \sum _ { i = 1 } ^ { N _ { d } } \sum _ { m = 1 } ^ { M } v _ { i , m } \log ( D _ { m } ( \mathbf { x } _ { i } ; \phi _ { m } ) ) ,
|
| 83 |
+
$$
|
| 84 |
+
|
| 85 |
+
where we choose $k$ experts out of $M$ discriminators for each example, i.e., $\textstyle \sum _ { m = 1 } ^ { M } v _ { i , m } = k$ . In the case of a fake sample, all discriminators have to identify it correctly. Thus the following standard loss is added to equation 3:
|
| 86 |
+
|
| 87 |
+
$$
|
| 88 |
+
\mathcal { L } _ { \mathrm { e } } ( \tilde { \mathbf { x } } ) = - \sum _ { j = 1 } ^ { N _ { g } } \sum _ { m = 1 } ^ { M } \log ( 1 - D _ { m } ( G ( \mathbf { z } _ { j } ) ; \phi _ { m } ) ) .
|
| 89 |
+
$$
|
| 90 |
+
|
| 91 |
+
Generator We train the generator with respect to the gradients given by the expert models to encourage the generator to find the closest mode given $\mathbf { z }$ . With another indicator variable $u _ { j , m }$ for $\mathbf { z } _ { j }$ , the expert loss for the generator is given by
|
| 92 |
+
|
| 93 |
+
$$
|
| 94 |
+
\mathcal { L } _ { \mathrm { e } } ( \tilde { \mathbf { x } } ) = \sum _ { j = 1 } ^ { N _ { g } } \sum _ { m = 1 } ^ { M } u _ { j , m } \log ( 1 - D _ { m } ( G ( \mathbf { z } _ { j } ; \theta ) ) ; \phi _ { m } ) ,
|
| 95 |
+
$$
|
| 96 |
+
|
| 97 |
+
$\textstyle \sum _ { m = 1 } ^ { M } u _ { j , m } = k$
|
| 98 |
+
|
| 99 |
+
# 4.2 NON-EXPERT TRAINING
|
| 100 |
+
|
| 101 |
+
The non-expert discriminators should not be over-confident to real example while it is desirable to produce higher scores for real samples than fake ones. For this requirement, we give a uniform soft label, e.g., $\bar { y } = [ 0 . 5 , 0 . 5 ]$ for non-expert discriminators and regularize them with some weight. To be precise, we obtain the following non-expert loss term corresponding to equation 3:
|
| 102 |
+
|
| 103 |
+
$$
|
| 104 |
+
\mathcal { L } _ { \mathrm { n e } } ( { \bf x } ) = \sum _ { i = 1 } ^ { N _ { d } } \sum _ { m = 1 } ^ { M } ( 1 - v _ { i , m } ) \ell _ { \mathrm { c e } } ( D _ { m } ( \mathbf { x } _ { i } ) , y ) ,
|
| 105 |
+
$$
|
| 106 |
+
|
| 107 |
+
with the same $v _ { i , m }$ defined in equation 3 and $\ell _ { \mathrm { c e } } ( \cdot , y )$ is the cross-entropy loss function given a target label $y$ . The other counterpart for equation 5 is derived similarly as
|
| 108 |
+
|
| 109 |
+
$$
|
| 110 |
+
\mathcal { L } _ { \mathrm { n e } } \big ( \tilde { \mathbf { x } } \big ) = \sum _ { j = 1 } ^ { N _ { g } } \sum _ { m = 1 } ^ { M } ( 1 - u _ { j , m } ) \ell _ { \mathrm { c e } } \big ( D _ { m } ( G ( \mathbf { z } _ { j } ) ) , y \big ) .
|
| 111 |
+
$$
|
| 112 |
+
|
| 113 |
+
The non-expert model training is effective to handle the overconfidence issue, but the model may still suffer from the data deficiency problem of the standard MCL framework because each discriminator can see only a subset of the whole dataset. To ameliorate this limitation, our discriminators share the parameters of all layers for feature extraction while branching the last layer only. This implementation is also sensible in that the discriminators partially have the same objective to distinguish the fake examples. The common representations of all real samples are likely to be learned in the earlier layers despite being clustered in the different subsets whereas the critical information for the high-level classification is often found in the last layer. Moreover, the number of training parameters and training time are saved sigificantly while taking advantage of ensemble learning.
|
| 114 |
+
|
| 115 |
+
# 4.3 BALANCED ASSIGNMENT OF DISCRIMINATORS
|
| 116 |
+
|
| 117 |
+
On top of the adversarial losses, we introduce another loss for balanced updates of discriminators. As our training does not include any supervision for the specialized factor for certain discriminator, e.g., class labels or feature embeddings, it may be difficult to reasonably distribute real samples to expert models from the beginning. Since the abilities of individual discriminators are severely off-balanced, they are highly prone to assign all samples to few specific models. Especially at an early phase of training, the model’s capability is more sensitive to the number of updates in the discriminators.
|
| 118 |
+
|
| 119 |
+
To tackle this challenge, we propose another loss, namely a balance loss, that gives discriminators balanced chances to be updated. We let the selection of expert discriminators approximately follow a categorical distribution with a parameter $\pmb { \mu } = [ \mu _ { 1 } , \dots , \mu _ { M } ]$ . Then the loss is computed by the KL divergence of the probability distribution of discriminators for being selected as experts from $\pmb { \mu }$ . To obtain the probability for discriminator selection, we apply the softmax function to the vector of $M$ predictions of discriminators—more precisely, logits before sigmoid function—for each example since the discriminator with the highest score is guaranteed to be chosen as an expert. We average these probability vectors over the training batch. i.e., $\begin{array} { r } { \mathbf q = \frac { 1 } { N _ { d } } \sum _ { i = 1 } ^ { N _ { d } } \mathbf s ( [ D _ { 1 } ( \mathbf x _ { i } ) , \dots , D _ { M } ( \mathbf x _ { i } ) ] ; \bar { \tau } ) } \end{array}$ where $\mathbf { s } ( \cdot ; \tau )$ denotes a vector-valued softmax function with temperature $\tau$ given an input vector. To sum up, the balance loss is given by
|
| 120 |
+
|
| 121 |
+
$$
|
| 122 |
+
\begin{array} { r } { \mathcal { L } _ { \mathrm { b a l } } ( \mathbf { x } ) = D _ { \mathrm { K L } } ( \pmb { \mu } | | \mathbf { q } ) . } \end{array}
|
| 123 |
+
$$
|
| 124 |
+
|
| 125 |
+
In practice, we set $\begin{array} { r } { \mu _ { m } = \frac { 1 } { M } , \forall m } \end{array}$ to update the discriminators evenly, which is because the true distribution is unavailable. This assumption may not be congruent to the real distribution of the dataset and excessively forced assignment would not result in an optimal clustering for specialization. We, therefore, decrease the weight for the balance loss gradually during training. Eventually, each example will be naturally assigned to its best model with a very small weight of the balance loss. This adjustment helps stabilize training and naturally cluster the reference data. Note that the models are balanced within a few epochs and the weight reduction helps generate higher quality samples.
|
| 126 |
+
|
| 127 |
+
Likewise, a small enforcement on the distribution of the generator’s output facilitates balanced generation when the statistics of generated samples are skewed. For this case, we use the distribution of the discriminators’ assignments instead of arbitrarily chosen $\pmb { \mu }$ , i.e.,
|
| 128 |
+
|
| 129 |
+
$$
|
| 130 |
+
\mathcal { L } _ { \mathrm { b a l } } ( \tilde { \mathbf { x } } ) = D _ { \mathrm { K L } } ( \mathbf { q } \| \mathbf { o } ) .
|
| 131 |
+
$$
|
| 132 |
+
|
| 133 |
+
# 4.4 TOTAL LOSS
|
| 134 |
+
|
| 135 |
+
Altogether, the total loss is summarized as follows:
|
| 136 |
+
|
| 137 |
+
$$
|
| 138 |
+
\mathcal { L } = \mathcal { L } _ { \mathrm { e } } + \alpha \mathcal { L } _ { \mathrm { n e } } + \beta \mathcal { L } _ { \mathrm { b a l } } ,
|
| 139 |
+
$$
|
| 140 |
+
|
| 141 |
+
where $\beta$ is different for discriminators and generator. Although we describe the loss functions based on the standard GAN, it is applicable to other GAN formulations with different adversarial losses.
|
| 142 |
+
|
| 143 |
+

|
| 144 |
+
Figure 2: Snapshots of 256 random samples drawn from the generators of the baseline and MCL-GAN. Data sampled from the true distribution are in orange while the generated ones are in green.
|
| 145 |
+
|
| 146 |
+
# 4.5 CHOICE OF NUMBER OF DISCRIMINATORS
|
| 147 |
+
|
| 148 |
+
A remaining concern is that we need to find the optimal number of discriminators while such information is not available in general as in many clustering tasks. If the number of discriminators is much larger than the optimal one, it is more desirable to focus on training a subset of discriminators than dividing the dataset into many minor clusters forcefully.
|
| 149 |
+
|
| 150 |
+
To ease this issue, we employ $L _ { 1 }$ regularization on the outputs of the discriminators, which encourages the sparsity of the discriminator selection and leads to more desirable clustering results. Hence, even in the case that we are given an excessively large number of discriminators, our algorithm converges at good points by using a small number of discriminators in practice. It is true that this strategy may not always lead to the optimal number of discriminators and has conflict with the balance loss in equation 8. However, the balance loss fades away as training goes, and our model identifies a proper number of clusters by deactivating a subset of discriminators. This sparsity loss may be useful when we learn on the examples drawn from unknown distributions.
|
| 151 |
+
|
| 152 |
+
# 5 EXPERIMENTS
|
| 153 |
+
|
| 154 |
+
# 5.1 SYNTHETIC DATA
|
| 155 |
+
|
| 156 |
+
We first perform toy experiments to verify the main idea of the proposed method intuitively. We consider a 2D mixture of 8 isotropic Gaussians whose centers are aligned on a circle with a radius $\sqrt { 2 }$ while their standard deviation in each dimension is set to 0.05. We employ 8 discriminators for training with the standard GAN loss while utilizing 2 discriminators for the model with Hinge loss (Lim & Ye, 2017). We choose one expert discriminator for each sample $k = 1 ,$ ) in all experiments.
|
| 157 |
+
|
| 158 |
+
Figure 2 illustrates the snapshots of random samples through iterations generated by the baselines and MCL-GANs. Unlike the base models $m = 1 ,$ ) fail to cover all 8 modes, MCL-GANs learn to identify diverse modes quickly and produce the samples at all modes eventually.
|
| 159 |
+
|
| 160 |
+
Appendix A presents that, when MCL-GANs are learned with an excessive number of discriminators, e.g., $m = 2 0$ , they mostly utilize 8 or 16 expert discriminators in a wide range of weight for the $L _ { 1 }$ loss. This implies that MCL-GAN covers all the modes effectively and robustly.
|
| 161 |
+
|
| 162 |
+
# 5.2 UNCONDITIONAL GAN ON IMAGE DATASET
|
| 163 |
+
|
| 164 |
+
We run the unconditional GAN experiment on four distinct datasets including MNIST (LeCun & Cortes, 2010), Fashion-MNIST (Xiao et al., 2017), CIFAR-10 (Krizhevsky et al., 2009) and CelebA (Liu et al., 2015), where two types of network architectures are employed—DCGAN (Radford et al., 2016) and StyleGAN2 (Karras et al., 2020). The images are resized to $3 2 \times 3 2$ except for CelebA dataset: $6 4 \times 6 4$ for DCGAN and $1 2 8 \times 1 2 8$ for StyleGAN2 experiment. For StyleGAN2 experiments on CelebA, we use the first and the last 30K images from the align&cropped version for a train and a validation set following (Yu et al., 2020). With the DCGAN architecture, we apply our method on three different GAN loss functions: the vanilla GAN (Goodfellow et al., 2014), LSGAN (Mao et al., 2017) and Hinge loss (Lim & Ye, 2017). Appendix I describes more details of our setting.
|
| 165 |
+
|
| 166 |
+
Table 1: Precision and recall scores from PRD curves on MNIST, Fashion-MNIST and CelebA datasets with the DCGAN architecture.
|
| 167 |
+
|
| 168 |
+
<table><tr><td rowspan="2">Method</td><td rowspan="2"></td><td rowspan="2">m</td><td colspan="2">MNIST</td><td colspan="2">Fashion-MNIST</td><td colspan="2">CelebA</td></tr><tr><td>Rec.↑</td><td>Prec.↑</td><td>Rec.↑</td><td>Prec.↑</td><td>Rec.↑</td><td>Prec.↑</td></tr><tr><td rowspan="4">GAN</td><td>Base (Radford et al.,2016)</td><td>1</td><td>0.896</td><td>0.778</td><td>0.936</td><td>0.900</td><td>0.834</td><td>0.839</td></tr><tr><td>GMAN (Durugkar et al., 2017)</td><td>5</td><td>0.968</td><td>0.976</td><td>0.909</td><td>0.955</td><td>0.888</td><td>0.873</td></tr><tr><td>GMAN (Durugkar et al., 2017)</td><td>10</td><td>0.964</td><td>0.977</td><td>0.928</td><td>0.946</td><td>0.921</td><td>0.923</td></tr><tr><td>MCL-GAN</td><td>5</td><td>0.985</td><td>0.977</td><td>0.972</td><td>0.925</td><td>0.945</td><td>0.953</td></tr><tr><td rowspan="2">LSGAN (Mao et al., 2017)</td><td>MCL-GAN Base</td><td>10 1</td><td>0.976 0.977</td><td>0.975 0.957</td><td>0.964 0.928</td><td>0.914 0.866</td><td>0.940 0.923</td><td>0.938 0.943</td></tr><tr><td>GMAN (Durugkar et al., 2017)</td><td>10</td><td>0.966</td><td>0.973</td><td>0.953</td><td>0.952</td><td>0.934</td><td>0.906</td></tr><tr><td rowspan="2">Hinge (Lim& Ye,2017)</td><td>MCL-GAN</td><td>10</td><td>0.983</td><td>0.980</td><td>0.963</td><td>0.911</td><td>0.950</td><td>0.952</td></tr><tr><td>Base</td><td>1</td><td>0.790</td><td>0.785</td><td>0.936</td><td>0.853</td><td>0.905</td><td>0.883</td></tr><tr><td rowspan="2"></td><td>MCL-GAN</td><td>5</td><td>0.957</td><td>0.965</td><td>0.959</td><td>0.916</td><td>0.914</td><td>0.925</td></tr><tr><td>MCL-GAN</td><td>10</td><td>0.978</td><td>0.968</td><td>0.949</td><td>0.885</td><td>0.928</td><td>0.931</td></tr></table>
|
| 169 |
+
|
| 170 |
+
Table 2: FID scores on CIFAR-10 with the DCGAN architecture.
|
| 171 |
+
|
| 172 |
+
<table><tr><td>Model</td><td>#Disc.(m)</td><td># Gen.</td><td>FID↓</td></tr><tr><td>DCGAN Radford et al. (2016)</td><td>1</td><td>1</td><td>37.7</td></tr><tr><td>GMAN Durugkar et al. (2017)</td><td>10</td><td>1</td><td>37.11</td></tr><tr><td>Albuquerque et al.Albuquerque et al. (2019)</td><td>10</td><td>1</td><td>30.26</td></tr><tr><td>MGAN Hoang et al. (2018)</td><td>1</td><td>10</td><td>26.7</td></tr><tr><td>MSGAN Mao et al. (2019) (conditional)</td><td>1</td><td>1</td><td>28.73</td></tr><tr><td>MCL-GAN</td><td>10</td><td>1</td><td>26.87</td></tr></table>
|
| 173 |
+
|
| 174 |
+
# 5.2.1 QUANTITATIVE RESULTS
|
| 175 |
+
|
| 176 |
+
We present the quantitative performance of MCL-GAN with the DCGAN and StyleGAN2 backbones using Precision Recall Distribution (PRD) (Sajjadi et al., 2018) and Frechet Inception Distance \` (FID) (Heusel et al., 2017). More details about the evaluation metrics is provided in Appendix J.
|
| 177 |
+
|
| 178 |
+
DCGAN backbone Table 1 summarizes the precision and recall scores of our methods compared to the baseline models with different GAN objectives. MCL-GAN achieves outstanding performance in terms of both recall and precision compared to the baseline and GMAN on MNIST and CelebA. For Fashion-MNIST, we observe the different property of our method from GMAN while both methods surpass their baseline models; MCL-GAN focuses on improving the mode coverage (diversity) and GMAN cares about the image quality more than the diversity. Among many combinations of the number of discriminators $( m )$ and experts $( k )$ for our method, we discuss the results when $m = 5$ , 10 and $k = 1$ for the moment and leave the thorough analysis on the hyperparameters in Appendix F.
|
| 179 |
+
|
| 180 |
+
Table 2 compares the FID scores on CIFAR-10 with other GAN models. MCL-GAN outperforms DCGAN, GMAN and Albuquerque et al. (2019) by large margins while it is as competitive as MGAN. This is encouraging because MGAN relies on multiple generators, 10 in this case. MSGAN results are obtained given class labels. This result implies that MCL-GAN is effective to maintain the multi-modality in the underlying distribution with relatively small memory footprint and without extra supervision.
|
| 181 |
+
|
| 182 |
+
StyleGAN2 backbone Table 3 presents that MCL-GAN is also effective in the state-of-the-art backbone model, StyleGAN2, and outperforms not only StyleGAN2 but also Inclusive GAN (Yu et al., 2020) in terms of all metrics. For CelebA30K, we evaluates the performances on both train and validation sets. Note that Inclusive GAN uses the sample-wise reconstruction loss by regarding each image as a mode, which appears to improve recall. However, note that this goal is different from the objective of the standard GAN, estimating the underlying distribution. Also, the model may suffer from sampling bias and scalability issue.
|
| 183 |
+
|
| 184 |
+
# 5.2.2 QUALITATIVE RESULTS
|
| 185 |
+
|
| 186 |
+
We investigate the quality of images generated by MCL-GAN and compare its performance with GMAN (Durugkar et al., 2017), which is an existing approach based on multiple discriminators.
|
| 187 |
+
|
| 188 |
+
Table 3: FID, precision and recall scores on CIFAR-10 and CelebA datasets with the StyleGAN2 architecture, where 10 and 5 discriminators are adopted, respectively, while $k = 1$ . The asterisk $( * )$ means that results are copied from (Yu et al., 2020) except for our method.
|
| 189 |
+
|
| 190 |
+
<table><tr><td rowspan="2">Method</td><td colspan="3">CIFAR-10</td><td colspan="6">CelebA30K*</td></tr><tr><td>FID↓</td><td>Rec.↑</td><td>Prec.↑</td><td>FID↓</td><td></td><td>Rec.↑</td><td></td><td>Prec.↑</td><td></td></tr><tr><td></td><td>-</td><td>-</td><td>-</td><td>Train</td><td>Val</td><td>Train</td><td>Val</td><td>Train</td><td>Val</td></tr><tr><td>StyleGAN2 (Karras etal., 2020)</td><td>9.06</td><td>0.979</td><td>0.984</td><td>9.37</td><td>9.49</td><td>0.730</td><td>0.741</td><td>0.855</td><td>0.844</td></tr><tr><td>Inclusive GAN (Yu et al., 2020)</td><td>-</td><td>-</td><td>-</td><td>11.56</td><td>11.28</td><td>0.849</td><td>0.848</td><td>0.927</td><td>0.941</td></tr><tr><td>MCL-GAN</td><td>7.13</td><td>0.985</td><td>0.989</td><td>8.41</td><td>8.61</td><td>0.988</td><td>0.990</td><td>0.985</td><td>0.983</td></tr></table>
|
| 191 |
+
|
| 192 |
+

|
| 193 |
+
Figure 3: Qualitative comparison between MCL-GAN and GMAN on MNIST (top) and FashionMNIST (bottom). MCL-GAN generates more semantically faithful and diverse images than GMAN.
|
| 194 |
+
|
| 195 |
+
Figure 3 illustrates clear difference between MCL-GAN and GMAN on MNIST and Fashion-MNIST. For MNIST, the generated images by GMAN is sometimes hard to recognize or too thin and crisp compared to the real examples. The images for Fashion-MNIST are lacking in diversity; the types of generated bags and shoes are rather simple. On the other hand, MCL-GAN generates the images that are faithful to the true distribution in semantics and diversity and are indistinguishable from real images. More qualitative results are available in Appendix C.1.
|
| 196 |
+
|
| 197 |
+
# 5.3 CONDITIONED IMAGE SYNTHESIS
|
| 198 |
+
|
| 199 |
+
We apply the MCL-GAN to image-to-image translation and text-to-image synthesis tasks, which require more complex architectures to generate high-resolution images. In this experiment, the mode-seeking regularizer introduced in MSGAN (Mao et al., 2019) has been applied to alleviate the mode collapse issue in conditional GANs. Then, we observe whether the mode seeking technique and the use of multiple discriminators create synergy, using FID, NDB/JSD (Richardson & Weiss, 2018), and LPIPS (Zhang et al., 2018) following (Mao et al., 2019).
|
| 200 |
+
|
| 201 |
+
Image-to-image translation We choose DRIT (Lee et al., 2018; 2020) as our baseline, which is an unpaired image-to-image translation technique based on the cycle consistency. We employ MCL-GAN with $m = 3$ and $k = 1$ in each discriminator for distinguishing the real and the translated images. As shown in Table 4, MCL-GAN significantly improves the diversity measure, LPIPS, while achieving high-fidelity data generation performance in terms of other metrics. In particular, our approach works better on more challenging task, cat dog, due to object shape changes across domains. Table 6 presents the translation results in the opposite directions on the two datasets.
|
| 202 |
+
|
| 203 |
+
Table 4: Quantitative results on Yosemitee (Summer Winter) and Cat Dog dataset. The best results are obtained when MCL component is added in most cases. The asterisk (∗) means that results are copied from (Mao et al., 2019).
|
| 204 |
+
|
| 205 |
+
<table><tr><td>Dataset</td><td>Metric</td><td>DRIT*</td><td>+MS (DRIT++)*</td><td>+MCL</td><td>+MCL+MS</td></tr><tr><td rowspan="4">Winter→Summer</td><td>FID↓</td><td>47.37± 3.25</td><td>46.23±2.45</td><td>49.41± 1.29</td><td>41.94 ± 1.43</td></tr><tr><td>NDB↓</td><td>30.60 ± 2.97</td><td>27.80 ± 3.03</td><td>23.40 ±1.52</td><td>24.20± 3.27</td></tr><tr><td>JSD↓</td><td>0.049 ± 0.009</td><td>0.038 ± 0.004</td><td>0.033 ±0.002</td><td>0.030 ± 0.005</td></tr><tr><td>LPIPS↑</td><td>0.097 ± 0.000</td><td>0.118 ± 0.001</td><td>0.153 ± 0.001</td><td>0.248 ± 0.001</td></tr><tr><td rowspan="4">Dog→Cat</td><td>FID↓</td><td>62.85± 0.21</td><td>29.57 ± 0.23</td><td>20.61±0.05</td><td>27.16 ±0.20</td></tr><tr><td>NDB↓</td><td>41.00 ± 0.71</td><td>31.00 ± 0.71</td><td>16.40±0.89</td><td>20.20 ±1.48</td></tr><tr><td>JSD↓</td><td>0.272 ± 0.002</td><td>0.068 ± 0.001</td><td>0.024 ± 0.001</td><td>0.031 ± 0.001</td></tr><tr><td>LPIPS ↑</td><td>0.102 ± 0.001</td><td>0.214 ± 0.001</td><td>0.429 ± 0.001</td><td>0.482 ± 0.000</td></tr></table>
|
| 206 |
+
|
| 207 |
+
Table 5: Quantitative results on CUB-200-2011. We obtained improved results consistently by adding the proposed MCL component. The asterisk $( \ast )$ means that results are copied from (Mao et al., 2019).
|
| 208 |
+
|
| 209 |
+
<table><tr><td></td><td>StackGAN++*</td><td>+MS*</td><td>+MCL</td><td>+MCL+MS</td></tr><tr><td>FID↓</td><td>25.99 ± 4.26</td><td>25.53±1.83</td><td>22.91 ± 0.80</td><td>25.44 ± 0.41</td></tr><tr><td>NDB↓</td><td>38.20 ±2.39</td><td>30.60 ± 2.51</td><td>28.80±3.63</td><td>23.20 ±3.03</td></tr><tr><td>JSD↓</td><td>0.092 ± 0.005</td><td>0.073 ± 0.003</td><td>0.079 ± 0.004</td><td>0.053 ± 0.002</td></tr><tr><td>LPIPS↑</td><td>0.362 ± 0.004</td><td>0.373 ± 0.007</td><td>0.629 ± 0.001</td><td>0.624 ± 0.002</td></tr></table>
|
| 210 |
+
|
| 211 |
+
Text-to-image synthesis This experiment is based on StackGAN $^ { + + }$ (Zhang et al., 2017) trained on CUB-200-2011 (Wah et al., 2011) with a mode-seeking regularizer. Stac ${ \mathrm { G A N } } + + { }$ has a hierarchical structure that each set of a discriminator and a generator is responsible for a certain resolution. We adopt its 3-stage version and trains an MCL-GAN with $m = 3$ and $k = 1$ only at the last stage, which handles images with size $2 5 6 \times 2 5 6$ . Table 5 illustrates that the integration of MCL improves performance consistently, especially in terms of the diversity measure, LPIPS.
|
| 212 |
+
|
| 213 |
+
# 6 DISCUSSION
|
| 214 |
+
|
| 215 |
+
MCL-GAN is a model-agnostic ensemble algorithm with multiple discriminators. Our experiments imply that the specialized discriminators on the well-clustered subsets are beneficial compared to independently trained ones on the whole dataset or its random subsets. Although MCL-GAN does not rely on class labels for discriminator specialization, its performance is as competitive as the discriminator assignment based on the class labels (see Appendix E). The proposed approach runs efficiently because it is free from any time-consuming clustering procedure for sample assignment.
|
| 216 |
+
|
| 217 |
+
One drawback is that our method carries additional hyperparameters including the weights for several loss terms and the number of discriminators, and one might question about the robustness of MCLGAN with respect to the variations of the hyperparameters. From our analysis on the hyperparameter setting, presented in Appendix F, the performance of the proposed method improves significantly by the expert training and the balanced assignment of discriminators while the rest of the loss terms make stable contributions over a wide range of their weights. Also, since MCL-GAN adjusts the number of active discriminators that participate in learning as experts, its performance is robust to the number of discriminators.
|
| 218 |
+
|
| 219 |
+
# 7 CONCLUSION
|
| 220 |
+
|
| 221 |
+
We presented a generative adversarial network framework with multiple discriminators, where each discriminator behaves as an expert classifier and covers a separate mode in the underlying distribution. This idea is implemented by incorporating the concept of multiple choice learning. The combination of generative adversarial network and multiple choice learning turns out to be effective to alleviate the mode collapse problem. Also, the integration of the sparsity loss encourages our model to identify the proper number of discriminators and estimate a desirable distribution. We demonstrated the effectiveness of the proposed algorithm on various GAN models and datasets.
|
| 222 |
+
|
| 223 |
+
Reproducibility statement We provide implementation and evaluation details in Appendix I and J to facilitate reproduction of the results presented in Section 5. The source code is available in the supplementary material. We will release the code.
|
| 224 |
+
|
| 225 |
+
Ethics statement Deep generative models have some potentials to be used for adverse or abusive applications. Although our work involves unconditional image generations based on face datasets, this is rather a generic framework based on GANs to mitigate the mode collapse and dropping problems hampering sample diversity. Our algorithm is not directly related to particular applications with ethical issues, and we believe that the proposed approach can alleviate the bias and fairness issues by identifying the minority groups in a dataset effectively.
|
| 226 |
+
|
| 227 |
+
# REFERENCES
|
| 228 |
+
|
| 229 |
+
Isabela Albuquerque, Joao Monteiro, Thang Doan, Breandan Considine, Tiago Falk, and Ioannis Mitliagkas. Multi-objective training of generative adversarial networks with multiple discriminators. In ICML, pp. 202–211, 2019.
|
| 230 |
+
|
| 231 |
+
Martin Arjovsky, Soumith Chintala, and Leon Bottou. Wasserstein generative adversarial networks.´ volume 70 of PMLR, pp. 214–223, International Convention Centre, Sydney, Australia, 06–11 Aug 2017.
|
| 232 |
+
|
| 233 |
+
Qifeng Chen and Vladlen Koltun. Photographic image synthesis with cascaded refinement networks. In ICCV, pp. 1511–1520, 2017.
|
| 234 |
+
|
| 235 |
+
Thang Doan, Joao Monteiro, Isabela Albuquerque, Bogdan Mazoure, Audrey Durand, Joelle Pineau, and R Devon Hjelm. On-line adaptative curriculum learning for gans. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 3470–3477, 2019.
|
| 236 |
+
|
| 237 |
+
Jeff Donahue, Philipp Krahenb ¨ uhl, and Trevor Darrell. Adversarial feature learning. 2017. ¨
|
| 238 |
+
|
| 239 |
+
Vincent Dumoulin, Ishmael Belghazi, Ben Poole, Olivier Mastropietro, Alex Lamb, Martin Arjovsky, and Aaron Courville. Adversarially learned inference. ICLR, 2017.
|
| 240 |
+
|
| 241 |
+
Ishan Durugkar, Ian Gemp, and Sridhar Mahadevan. Generative multi-adversarial networks. 2017.
|
| 242 |
+
|
| 243 |
+
Michael Firman, Neill DF Campbell, Lourdes Agapito, and Gabriel J Brostow. Diversenet: When one right answer is not enough. In CVPR, pp. 5598–5607, 2018.
|
| 244 |
+
|
| 245 |
+
Arnab Ghosh, Viveka Kulharia, Vinay P Namboodiri, Philip HS Torr, and Puneet K Dokania. Multiagent diverse generative adversarial networks. In CVPR, pp. 8513–8521, 2018.
|
| 246 |
+
|
| 247 |
+
Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In NeurIPS, pp. 2672–2680, 2014.
|
| 248 |
+
|
| 249 |
+
Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron C Courville. Improved training of wasserstein gans. In NeurIPS, pp. 5767–5777, 2017.
|
| 250 |
+
|
| 251 |
+
Abner Guzman-Rivera, Dhruv Batra, and Pushmeet Kohli. Multiple choice learning: Learning to produce multiple structured outputs. In NeurIPS, pp. 1799–1807, 2012.
|
| 252 |
+
|
| 253 |
+
Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, Gunter Klambauer, and ¨ Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a nash equilibrium. In NeurIPS, 2017.
|
| 254 |
+
|
| 255 |
+
Quan Hoang, Tu Dinh Nguyen, Trung Le, and Dinh Phung. Mgan: Training generative adversarial nets with multiple generators. In ICLR, 2018.
|
| 256 |
+
|
| 257 |
+
Tero Karras, Samuli Laine, Miika Aittala, Janne Hellsten, Jaakko Lehtinen, and Timo Aila. Analyzing and improving the image quality of stylegan. In CVPR, pp. 8110–8119, 2020.
|
| 258 |
+
|
| 259 |
+
Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
|
| 260 |
+
|
| 261 |
+
Diederik P Kingma and Max Welling. Auto-encoding variational bayes. In ICLR, 2014.
|
| 262 |
+
|
| 263 |
+
Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009.
|
| 264 |
+
|
| 265 |
+
Yann LeCun and Corinna Cortes. MNIST handwritten digit database. 2010. URL http://yann. lecun.com/exdb/mnist/.
|
| 266 |
+
|
| 267 |
+
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 CVPR, pp. 4681–4690, 2017.
|
| 268 |
+
|
| 269 |
+
Hsin-Ying Lee, Hung-Yu Tseng, Jia-Bin Huang, Maneesh Kumar Singh, and Ming-Hsuan Yang. Diverse image-to-image translation via disentangled representations. In ECCV, 2018.
|
| 270 |
+
|
| 271 |
+
Hsin-Ying Lee, Hung-Yu Tseng, Qi Mao, Jia-Bin Huang, Yu-Ding Lu, Maneesh Kumar Singh, and Ming-Hsuan Yang. Drit++: Diverse image-to-image translation via disentangled representations. IJCV, pp. 1–16, 2020.
|
| 272 |
+
|
| 273 |
+
Kimin Lee, Changho Hwang, Kyoung Soo Park, and Jinwoo Shin. Confident multiple choice learning. In ICML, pp. 2014–2023, 2017.
|
| 274 |
+
|
| 275 |
+
Stefan Lee, Senthil Purushwalkam Shiva Prakash, Michael Cogswell, Viresh Ranjan, David Crandall, and Dhruv Batra. Stochastic multiple choice learning for training diverse deep ensembles. In NeurIPS, pp. 2119–2127, 2016.
|
| 276 |
+
|
| 277 |
+
Ke Li, Tianhao Zhang, and Jitendra Malik. Diverse image synthesis from semantic layouts via conditional imle. In ICCV, pp. 4220–4229, 2019.
|
| 278 |
+
|
| 279 |
+
Jae Hyun Lim and Jong Chul Ye. Geometric gan. arXiv preprint arXiv:1705.02894, 2017.
|
| 280 |
+
|
| 281 |
+
Zinan Lin, Ashish Khetan, Giulia Fanti, and Sewoong Oh. Pacgan: The power of two samples in generative adversarial networks. NeurIPS, 2018.
|
| 282 |
+
|
| 283 |
+
Shaohui Liu, Xiao Zhang, Jianqiao Wangni, and Jianbo Shi. Normalized diversification. In CVPR, pp. 10306–10315, 2019.
|
| 284 |
+
|
| 285 |
+
Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In ICCV, 2015.
|
| 286 |
+
|
| 287 |
+
Qi Mao, Hsin-Ying Lee, Hung-Yu Tseng, Siwei Ma, and Ming-Hsuan Yang. Mode seeking generative adversarial networks for diverse image synthesis. In CVPR, pp. 1429–1437, 2019.
|
| 288 |
+
|
| 289 |
+
Xudong Mao, Qing Li, Haoran Xie, Raymond YK Lau, Zhen Wang, and Stephen Paul Smolley. Least squares generative adversarial networks. In ICCV, pp. 2794–2802, 2017.
|
| 290 |
+
|
| 291 |
+
Jonghwan Mun, Kimin Lee, Jinwoo Shin, and Bohyung Han. Learning to specialize with knowledge distillation for visual question answering. In NeurIPS, pp. 8081–8091, 2018.
|
| 292 |
+
|
| 293 |
+
Behnam Neyshabur, Srinadh Bhojanapalli, and Ayan Chakrabarti. Stabilizing gan training with multiple random projections. arXiv preprint arXiv:1705.07831, 2017.
|
| 294 |
+
|
| 295 |
+
Tu Nguyen, Trung Le, Hung Vu, and Dinh Phung. Dual discriminator generative adversarial nets. In NeurIPS, pp. 2670–2680, 2017.
|
| 296 |
+
|
| 297 |
+
David Keetae Park, Seungjoo Yoo, Hyojin Bahng, Jaegul Choo, and Noseong Park. Megan: Mixture of experts of generative adversarial networks for multimodal image generation. In IJCAI, pp. 878–884, 2018.
|
| 298 |
+
|
| 299 |
+
Alec Radford, Luke Metz, and Soumith Chintala. Unsupervised representation learning with deep convolutional generative adversarial networks. In ICLR, 2016.
|
| 300 |
+
|
| 301 |
+
Eitan Richardson and Yair Weiss. On gans and gmms. arXiv preprint arXiv:1805.12462, 2018.
|
| 302 |
+
|
| 303 |
+
Mehdi S. M. Sajjadi, Olivier Bachem, Mario Luciˇ c, Olivier Bousquet, and Sylvain Gelly. Assessing´ Generative Models via Precision and Recall. In NeurIPS, pp. 5228–5237, 2018.
|
| 304 |
+
|
| 305 |
+
Akash Srivastava, Lazar Valkov, Chris Russell, Michael U Gutmann, and Charles Sutton. Veegan: Reducing mode collapse in gans using implicit variational learning. In NeurIPS, pp. 3308–3318, 2017.
|
| 306 |
+
|
| 307 |
+
Kai Tian, Yi Xu, Shuigeng Zhou, and Jihong Guan. Versatile multiple choice learning and its application to vision computing. In CVPR, pp. 6349–6357, 2019.
|
| 308 |
+
|
| 309 |
+
Ilya O Tolstikhin, Sylvain Gelly, Olivier Bousquet, Carl-Johann Simon-Gabriel, and Bernhard Scholkopf. Adagan: Boosting generative models. In ¨ NeurIPS, pp. 5424–5433, 2017.
|
| 310 |
+
|
| 311 |
+
Quan Hoang Trung Le, Hung Vu, Tu Dinh Nguyen, Hung Bui, and Dinh Phung. Learning generative adversarial networks from multiple data sources. In IJCAI, pp. 2823–2829, 2019.
|
| 312 |
+
|
| 313 |
+
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.
|
| 314 |
+
|
| 315 |
+
Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms, 2017.
|
| 316 |
+
|
| 317 |
+
Dingdong Yang, Seunghoon Hong, Yunseok Jang, Tianchen Zhao, and Honglak Lee. Diversitysensitive conditional generative adversarial networks. In ICLR, 2018.
|
| 318 |
+
|
| 319 |
+
Raymond A Yeh, Chen Chen, Teck Yian Lim, Alexander G Schwing, Mark Hasegawa-Johnson, and Minh N Do. Semantic image inpainting with deep generative models. In CVPR, pp. 5485–5493, 2017.
|
| 320 |
+
|
| 321 |
+
Ning Yu, Ke Li, Peng Zhou, Jitendra Malik, Larry Davis, and Mario Fritz. Inclusive gan: Improving data and minority coverage in generative models. In European Conference on Computer Vision, pp. 377–393. Springer, 2020.
|
| 322 |
+
|
| 323 |
+
Han Zhang, Tao Xu, Hongsheng Li, Shaoting Zhang, Xiaogang Wang, Xiaolei Huang, and Dimitris N Metaxas. Stackgan: Text to photo-realistic image synthesis with stacked generative adversarial networks. In ICCV, pp. 5907–5915, 2017.
|
| 324 |
+
|
| 325 |
+
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.
|
| 326 |
+
|
| 327 |
+
Junbo Zhao, Michael Mathieu, and Yann LeCun. Energy-based generative adversarial networks. In ICLR, 2017.
|
| 328 |
+
|
| 329 |
+
Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In ICCV, 2017a.
|
| 330 |
+
|
| 331 |
+
Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A Efros. Unpaired image-to-image translation using cycle-consistent adversarial networks. In ICCV, pp. 2223–2232, 2017b.
|
| 332 |
+
|
| 333 |
+
# A EFFECT OF $L _ { 1 }$ LOSS ON SYNTHETIC DATA
|
| 334 |
+
|
| 335 |
+
To examine the behaviour of $L _ { 1 }$ loss, we run the experiment with 20 discriminators which exceeds the actual number of modes of 8 Gaussians dataset. Figure 4 shows each expert discriminator per generated sample by different colors. Training with $m = 2 0$ without $L _ { 1 }$ loss, 16 discrimantors are utilized to cluster the true distribution. Since two discrimantors are assigned per each mode, the diversity within the mode is improved. By adding a small $L _ { 1 }$ loss, we discover only 8 discrimantors are effectively used in training, one for each mode. These results show that the $L _ { 1 }$ regularization helps identify the proper number of discriminators to generate high-fidelity data efficiently.
|
| 336 |
+
|
| 337 |
+

|
| 338 |
+
Figure 4: Effect of $L _ { 1 }$ loss weight $( \gamma )$ . Each random sample is colored by its expert discriminator. True data are in orange. Bar graphs demonstrate the update statistics of individual discriminators.
|
| 339 |
+
|
| 340 |
+
# B QUANTITATIVE RESULTS
|
| 341 |
+
|
| 342 |
+
We include the all image-to-image translation results on Yosemitee (Summer Winter) and ca dog dataset in Table 6 in addition to Table 4 of the main paper. MCL-GAN improves the diversity measure (LPIPS) for all cases while achieving better or competitive quality of images.
|
| 343 |
+
|
| 344 |
+
Table 6: Quantitative results on Yosemitee (Summer Winter) and $\mathrm { C a t } { } \mathrm { D o g }$ dataset. The best results are obtained when MCL component is added in most cases. The asterisk $( * )$ means that results are copied from (Mao et al., 2019).
|
| 345 |
+
|
| 346 |
+
<table><tr><td>Dataset</td><td>Metric</td><td>DRIT (Lee et al., 2018)*</td><td>+MS (DRIT++)*</td><td>+MCL</td><td>+MCL+MS</td></tr><tr><td rowspan="4">Summer→Winter</td><td>FID↓</td><td>57.24 ± 2.03</td><td>51.85 ± 1.16</td><td>53.77 ± 1.36</td><td>49.74± 2.74</td></tr><tr><td>NDB↓</td><td>25.60 ± 1.14</td><td>22.80±2.96</td><td>25.40 ± 1.14</td><td>30.00 ± 2.55</td></tr><tr><td>JSD↓</td><td>0.066 ± 0.005</td><td>0.046 ± 0.006</td><td>0.036 ± 0.004</td><td>0.044 ± 0.005</td></tr><tr><td>LPIPS ↑</td><td>0.115 ± 0.000</td><td>0.147 ± 0.001</td><td>0.199 ± 0.002</td><td>0.263 ± 0.003</td></tr><tr><td rowspan="4">Winter →Summer</td><td>FID↓ NDB↓</td><td>47.37± 3.25</td><td>46.23±2.45 27.80 ± 3.03</td><td>49.41±1.29 23.40 ±1.52</td><td>41.94± 1.43 24.20±3.27</td></tr><tr><td></td><td>30.60 ± 2.97</td><td></td><td></td><td></td></tr><tr><td>JSD↓</td><td>0.049 ± 0.009</td><td>0.038 ±0.004</td><td>0.033 ±0.002</td><td>0.030 ±0.005</td></tr><tr><td>LPIPS↑</td><td>0.097 ± 0.000</td><td>0.118 ± 0.001</td><td>0.153 ± 0.001</td><td>0.248 ± 0.001</td></tr><tr><td rowspan="4">Cat→Dog</td><td>FID↓</td><td>22.74±0.28</td><td>16.02 ± 0.30</td><td>20.64± 0.13</td><td>15.36 ± 0.16</td></tr><tr><td>NDB↓</td><td>42.00 ± 2.12</td><td>27.20 ± 0.84</td><td>29.80 ± 1.10</td><td>22.20± 2.77</td></tr><tr><td>JSD←</td><td>0.127 ± 0.003</td><td>0.084 ± 0.002</td><td>0.048 ± 0.002</td><td>0.031 ± 0.002</td></tr><tr><td>LPIPS↑</td><td>0.245 ± 0.002</td><td>0.280 ±0.002</td><td>0.511 ± 0.000</td><td>0.553 ± 0.000</td></tr><tr><td rowspan="4">Dog→Cat</td><td>FID↓</td><td>62.85± 0.21</td><td>29.57 ± 0.23</td><td>20.61± 0.05</td><td>27.16± 0.20</td></tr><tr><td>NDB↓</td><td>41.00 ± 0.71</td><td>31.00 ± 0.71</td><td>16.40 ±0.89</td><td>20.20 ±1.48</td></tr><tr><td>JSD↓</td><td>0.272 ± 0.002</td><td>0.068 ± 0.001</td><td>0.024 ± 0.001</td><td>0.031 ± 0.001</td></tr><tr><td>LPIPS↑</td><td>0.102 ± 0.001</td><td>0.214 ± 0.001</td><td>0.429 ± 0.001</td><td>0.482 ± 0.000</td></tr></table>
|
| 347 |
+
|
| 348 |
+
# C QUALITATIVE RESULTS
|
| 349 |
+
|
| 350 |
+
# C.1 UNCONDITIONAL GAN ON IMAGE DATASETS
|
| 351 |
+
|
| 352 |
+
Figure 5 compares the results of generated examples by MCL-GAN and GMAN together with real data on Fashion-MNIST (Xiao et al., 2017), CIFAR-10 (Krizhevsky et al., 2009) and CelebA (Liu et al., 2015). The samples are drawn randomly rather than cherry-picked. For CIFAR-10, MCL-GAN generate relatively clear images and some of them are recognizable as vehicles or animals (see Figure 6) whereas most images obtained from GMAN look incomplete and noisy. For CelebA, GMAN produces high quality images, but we discover more distorted and unnatural images than MCL-GAN. Some selected examples from MCL-GAN with DCGAN backbone on Fashion-MNIST, CIFAR-10, and CelebA are displayed in Figure 6. Figure7 shows random samples generated by MCL-GAN with StyleGAN2 backbone on CIFAR-10 and CelebA30K.
|
| 353 |
+
|
| 354 |
+

|
| 355 |
+
Figure 5: Qualitative comparison between MCL-GAN and GMAN on Fashion-MNIST (top), CIFAR10 (middle) and CelebA (bottom). MCL-GAN generates more realistic images with less failure cases than GMAN.
|
| 356 |
+
|
| 357 |
+
Figure 11 and 12 qualitatively compare the diversity of the generated images between the baselines and MCL-GANs. For all methods including the baselines, mode-seeking regularization (Mao et al.,
|
| 358 |
+
|
| 359 |
+

|
| 360 |
+
Figure 6: Selected samples generated by MCL-GAN with DCGAN architecture.
|
| 361 |
+
|
| 362 |
+

|
| 363 |
+
Figure 7: Random samples generated by MCL-GAN with StyleGAN2 architecture. For generation, truncation $\psi = 0 . 8$ is applied.
|
| 364 |
+
|
| 365 |
+
2019) is applied. As shown in Figure 11(a), images generated by MCL-GAN have more variations in edges and expressions of dogs. Regarding Yosemitee results (Figure 11(b)) which the shapes of the contents are fixed, colors are more diverse and vivid in MCL-GAN results. For Figure 12, we fix the text code for each text description to remove the diversity effect of text embedding and produce images with the same set of latent vectors. MCL-GAN produces more diverse bird images, in terms of shape, orientation and size with high quality. We present more qualitative results of MCL-GAN in Figure 13 and 14.
|
| 366 |
+
|
| 367 |
+
# D SPECIALIZATION OF EACH DISCRIMANTOR
|
| 368 |
+
|
| 369 |
+
Figure 8 qualitatively presents how successfully the discriminators in MCL-GAN are specialized to the subsets of the whole datasets. We learn the model with 10 discriminators, and illustrate the generated images. Note that the panel corresponding to each dataset consists of $1 0 \times 1 0$ images and the images in the same row belong to the same discriminators. We can observe semantic consistency of images within the same row in MNIST and Fashion-MNIST clearly. The images in the same row of CIFAR-10 also have some similarities although the signal is not as strong as the other two datasets. We believe that this is partly due to the inherent characteristics of the dataset that are more difficult to recognize.
|
| 370 |
+
|
| 371 |
+

|
| 372 |
+
Figure 8: Cluster by discrimantors. Each row represents the subcluster of each discriminator. Close similarities are discovered among the images if they are in the same row.
|
| 373 |
+
|
| 374 |
+
# E CLUSTERING VIA MCL VS. GROUND-TRUTH LABEL
|
| 375 |
+
|
| 376 |
+
We additionally run the same multi-discriminator framework by clustering using ground-truth labels instead of MCL on real dataset. This is to verify the effectiveness of the specialized discriminators on our learning framework and check if the clustering by MCL is sufficiently reliable compared to the results by true labels. As presented in Table 7, the performance of MCL is as competitive as the method based on true labels in terms of both metrics.
|
| 377 |
+
|
| 378 |
+
Table 7: Recall and precision scores given by different clustering methods: MCL vs. ground-truth label. The model ‘Label’ assigns an expert discriminator of each real sample by the ground-truth label under our multi-discriminator framework.
|
| 379 |
+
|
| 380 |
+
<table><tr><td rowspan="2">Model</td><td rowspan="2">m k</td><td rowspan="2"></td><td colspan="2">MNIST</td><td colspan="2">Fashion-MNIST</td></tr><tr><td>Recall</td><td>Precision</td><td>Recall</td><td>Precision</td></tr><tr><td>DCGAN</td><td>1</td><td>1</td><td>0.891</td><td>0.789</td><td>0.927</td><td>0.903</td></tr><tr><td>MCL-GAN</td><td>5</td><td>1</td><td>0.983</td><td>0.977</td><td>0.977</td><td>0.929</td></tr><tr><td>MCL-GAN</td><td>10</td><td>1</td><td>0.976</td><td>0.973</td><td>0.967</td><td>0.916</td></tr><tr><td>Label</td><td>10</td><td>1</td><td>0.978</td><td>0.966</td><td>0.969</td><td>0.935</td></tr></table>
|
| 381 |
+
|
| 382 |
+
# F ANALYSIS ON HYPERPARAMETERS
|
| 383 |
+
|
| 384 |
+
# F.1 NON-EXPERT LOSS WEIGHT
|
| 385 |
+
|
| 386 |
+
Table 8 shows the effect of non-expert training regularization when training 10 discriminators with the standard GAN loss on MNIST. The performance increase is mostly driven by expert training. The best score is obtained with $\alpha = 0 . 0 1$ while all positive $\alpha$ improves the precision scores, which supports the effect of the lowered confidence of non-expert discriminators.
|
| 387 |
+
|
| 388 |
+
Table 8: Effect of non-expert loss weight $( \alpha )$ when $m = 1 0$ and $k = 1$ on MNIST.
|
| 389 |
+
|
| 390 |
+
$$
|
| 391 |
+
\frac { \alpha } { \mathrm { R e c a l l } \ | \ 0 . 9 8 3 \ 0 . 9 8 4 \ 0 . 9 7 8 \ 0 . 9 8 2 \ 0 . 9 8 3 } \ 0 . 9 7 6 \ 0 . 9 7 6 \ 0 . 9 7 6
|
| 392 |
+
$$
|
| 393 |
+
|
| 394 |
+
# F.2 BALANCE LOSS WEIGHTS
|
| 395 |
+
|
| 396 |
+
We denote the balance loss weights of discriminator and generator by $\beta _ { d }$ and $\beta _ { g }$ , respectively. We conduct the ablation studies on several $( \beta _ { d } , \beta _ { g } )$ combinations for 10 discriminators with Hinge loss on MNIST. In Table 9, we observe that $\beta _ { d }$ plays an important role in boosting the performance of GAN. This is mainly because $\beta _ { d }$ is responsible for distributing the chances of being an expert to multiple discriminators; Only a few discriminators are utilized in training if $\beta _ { d }$ is zero or too small.
|
| 397 |
+
|
| 398 |
+
$\beta _ { g }$ has a relatively smaller effect on the performance than $\beta _ { d }$ . However, it helps improve recall scores without sacrificing precision as the best score is obtained when $( \beta _ { d } , \beta _ { g } ) = ( 0 . 5 , 1 0 )$ . Note that the performance does not change drastically for all cases where $\beta _ { d } > 0$ and surpasses a single discriminator GAN with a large margin.
|
| 399 |
+
|
| 400 |
+
Table 9: Effect of balance loss weights $\beta _ { d }$ and $\beta _ { g }$ ) when $m = 1 0$ and $k = 1$ on MNIST.
|
| 401 |
+
|
| 402 |
+
<table><tr><td>βd</td><td>βg</td><td>Recall</td><td>Precision</td></tr><tr><td>vanilla</td><td></td><td>0.803</td><td>0.765</td></tr><tr><td>0</td><td>0</td><td>0.926</td><td>0.856</td></tr><tr><td>0.2</td><td>0</td><td>0.973</td><td>0.966</td></tr><tr><td>0.5</td><td>0</td><td>0.971</td><td>0.970</td></tr><tr><td>0</td><td>5</td><td>0.931</td><td>0.894</td></tr><tr><td>0.2</td><td>5</td><td>0.978</td><td>0.963</td></tr><tr><td>0.5</td><td>5</td><td>0.977</td><td>0.967</td></tr><tr><td>0</td><td>10</td><td>0.949</td><td>0.883</td></tr><tr><td>0.2</td><td>10</td><td>0.978</td><td>0.966</td></tr><tr><td>0.5</td><td>10</td><td>0.981</td><td>0.972</td></tr></table>
|
| 403 |
+
|
| 404 |
+
# F.3 NUMBER OF DISCRIMANTORS AND $L _ { 1 }$ LOSS WEIGHT
|
| 405 |
+
|
| 406 |
+
We conduct the experiment under a various number of discriminators and illustrate the results in Table 10. It turns out that the performance of the proposed method is fairly robust to the number of discriminators quantitatively and adding the $L _ { 1 }$ loss does not incur noticeable differences in terms of precision/recall measure. However, interestingly, the $L _ { 1 }$ loss plays a crucial role in finding modes in the underlying distribution. Figure 9 illustrates the impact of the $L _ { 1 }$ loss on MNIST and Fashion-MNIST when we train the model with 40 discriminators. According to our results, only a fraction of the discriminators are specialized to data, and the number of active discriminators is fairly coherent to the number of classes in the dataset.
|
| 407 |
+
|
| 408 |
+
Table 10: Comparisons by number of discriminators $( m )$ .
|
| 409 |
+
|
| 410 |
+
<table><tr><td></td><td colspan="2">MNIST</td><td colspan="2">Fashion-MNIST</td></tr><tr><td>m</td><td>Recall</td><td>Precision</td><td>Recall</td><td>Precision</td></tr><tr><td>1</td><td>0.883</td><td>0.795</td><td>0.928</td><td>0.904</td></tr><tr><td>5</td><td>0.979</td><td>0.976</td><td>0.974</td><td>0.929</td></tr><tr><td>10</td><td>0.974</td><td>0.972</td><td>0.965</td><td>0.934</td></tr><tr><td>20</td><td>0.972</td><td>0.958</td><td>0.958</td><td>0.922</td></tr><tr><td>40</td><td>0.977</td><td>0.970</td><td>0.974</td><td>0.938</td></tr><tr><td>20 (+L1)</td><td>0.967</td><td>0.964</td><td>0.967</td><td>0.939</td></tr><tr><td>40 (+L1)</td><td>0.973</td><td>0.960</td><td>0.966</td><td>0.914</td></tr></table>
|
| 411 |
+
|
| 412 |
+

|
| 413 |
+
Figure 9: Effect of $L _ { 1 }$ loss weight $( \gamma )$ . The update statistics of individual discriminators when 40 discriminators are used for training on MNIST and Fashion-MNIST datasets.
|
| 414 |
+
|
| 415 |
+
# F.4 NUMBER OF EXPERTS PER EXAMPLE
|
| 416 |
+
|
| 417 |
+
We evaluate our model on the various numbers of experts $k$ for $m = 5$ and 10, and present the results on MNIST and CIFAR-10 in Table 11. The number of optimal $k$ may be different in each dataset, however, choosing too many experts tend to drop the scores relevant to recall metric.
|
| 418 |
+
|
| 419 |
+
Figure 10 shows how the specialization characteristics of discriminators differ by the number of experts per sample, i.e., $k \in \{ 1 , 3 , 5 \}$ , when there are 10 discriminators on MNIST and FashionMNIST. As $k$ increases, the models get less specialized by sharing more data each other so the subclusters become less distinctive.
|
| 420 |
+
|
| 421 |
+
Table 11: Comparisons by number of experts per sample $( k )$
|
| 422 |
+
|
| 423 |
+
<table><tr><td></td><td></td><td>MNIST</td><td></td><td>CIFAR-10</td></tr><tr><td>m</td><td>k</td><td>Recall</td><td>Precision</td><td>Recall Precision</td></tr><tr><td>5</td><td>1</td><td>0.983</td><td>0.975</td><td>0.903 0.942</td></tr><tr><td>5</td><td>3</td><td>0.983</td><td>0.981 0.896</td><td>0.948</td></tr><tr><td>10</td><td>1</td><td>0.973</td><td>0.973 0.902</td><td>0.937</td></tr><tr><td>10</td><td>3</td><td>0.973</td><td>0.969</td><td>0.913 0.946</td></tr><tr><td>10</td><td>5</td><td>0.975</td><td>0.964</td><td>0.917 0.948 0.951</td></tr><tr><td>10</td><td>7</td><td>0.960</td><td>0.927</td><td>0.912</td></tr></table>
|
| 424 |
+
|
| 425 |
+

|
| 426 |
+
Figure 10: Specialization results for $k \in \{ 1 , 3 , 5 \}$ with 10 discriminators on MNIST and FashionMNIST. The images in each row correspond to the same discriminators.
|
| 427 |
+
|
| 428 |
+
# G STABILITY TO HYPERPARAMETER CHANGE
|
| 429 |
+
|
| 430 |
+
We conduct experiments on MNIST with $m = 1 0 , 2 0 , 4 0$ using $L _ { 1 }$ regularization multiple times and observe that the accuracies (precision and recall) are very stable regardless of the number of discriminators for expert training as in Table 12. Note that we performed each experiment 4 times with random initialization.
|
| 431 |
+
|
| 432 |
+
Table 12: Stability of model performances and the number of active discriminators when $m =$ 10, 20, 40 and $\gamma = 0 . 0 0 0 2$ on MNIST.
|
| 433 |
+
|
| 434 |
+
<table><tr><td>m</td><td>Recall</td><td>Precision</td><td># active discriminators</td></tr><tr><td>10(+L1)</td><td>0.965±0.004</td><td>0.965± 0.006</td><td>8.3±1.0</td></tr><tr><td>20(+Li)</td><td>0.966 ± 0.004</td><td>0.964 ± 0.002</td><td>12.0 ±1.2</td></tr><tr><td>40(+L1)</td><td>0.968 ± 0.005</td><td>0.963 ± 0.009</td><td>10.0 ±1.4</td></tr></table>
|
| 435 |
+
|
| 436 |
+
# H COMPUTATIONAL OVERHEADS
|
| 437 |
+
|
| 438 |
+
Table 13 compares the training time per iteration and memory usage with the DCGAN baselines when training on CelebA dataset ( $6 4 \times 6 4$ sized). While independent training of multiple discriminators, e.g., GMAN (Durugkar et al., 2017), requires more than four times the resources and time, additional overheads are marginal for MCL-GAN due to feature sharing. We used a machine with a Titan $\mathrm { X p }$ GPU for the measurement.
|
| 439 |
+
|
| 440 |
+
Table 13: Comparisons of computational overheads on CelebA.
|
| 441 |
+
|
| 442 |
+
<table><tr><td></td><td>DCGAN (m = 1)</td><td>MCL-GAN (m = 10)</td><td>GMAN (m = 10)</td></tr><tr><td>Time (s/iteration)</td><td>0.4412</td><td>0.4584</td><td>2.6369</td></tr><tr><td>Memory (MB)</td><td>2443</td><td>2991</td><td>11857</td></tr></table>
|
| 443 |
+
|
| 444 |
+
# I IMPLEMENTATION DETAILS
|
| 445 |
+
|
| 446 |
+
# I.1 SYNTHETIC DATA
|
| 447 |
+
|
| 448 |
+
We reuse the experimental design and implementation1 following (Gulrajani et al., 2017).
|
| 449 |
+
|
| 450 |
+
# I.2 UNCONDITIONAL GAN ON IMAGE DATASETS
|
| 451 |
+
|
| 452 |
+
DCGAN backbone We mostly follow the training convention proposed in DCGAN (Radford et al., 2016). We use Adam optimizer (Kingma & Ba, 2015) with $\beta = ( 0 . 5 , 0 . 9 9 9 )$ and set 64 and 128 as size of the mini-batch for real data and latent vectors, respectively. We use the same learning rate and temperature in balance loss for all networks, i.e., $l r = 0 . 0 0 0 1$ , $\tau = 0 . 1$ for LSGAN experiments and $l r = 0 . 0 0 0 2 , \tau = 1 . 0$ for the others. The weights for balance loss of discrimantors, $\beta _ { d }$ , is chosen in the range [0.05, 1.0] and we choose the best performance. For the weights for balance loss of generator, $\beta _ { g } = 0$ produces fairly good results on all cases while positive $\beta _ { g }$ gives particularly significant improvement in some LSGAN and Hinge loss experiments. We choose $\beta _ { g } \in \{ 1 . 0 , 2 . 0 \}$ for LSGAN experiments on all datasets and $\beta _ { g } \in \{ 5 . 0 , 1 0 . 0 \}$ for Hinge loss experiments on MNIST. For implementing standard GAN loss, we use the modified minimax objective for the generator, i.e., $\operatorname* { m i n } \mathbb { E } _ { z \sim p _ { z } } \log D ( G ( z ) )$ .
|
| 453 |
+
|
| 454 |
+
StyleGAN2 backbone We adopt the configuration E architecture among the StyleGAN2 variations and use default hyperparameters for training using the official implementation2 without applying data augmentation option. We set the batch size at 64 and 16 for CIFAR-10 and CelebA30K, respectively.
|
| 455 |
+
|
| 456 |
+
GMAN settings We used the official implementation3 of GMAN. Among its varients, we use three versions that use the arithmetic mean of softmax, i.e., GMAN-1, GMAN-0 and $\mathrm { G M A N ^ { * } }$ , and choose the best scores among them to report in Table 1 and 2. For differentiating discriminators, we apply different dropout rates in [0.4, 0.6] and split of mini-batches for the input of discriminators while adopting the same architectures as DCGAN.
|
| 457 |
+
|
| 458 |
+
# I.3 CONDITIONED IMAGE SYNTHESIS
|
| 459 |
+
|
| 460 |
+
We apply the MCL components to the official codes of $\mathrm { D R I T } + + ^ { 4 }$ , $\operatorname { S t a c k G A N + + } ^ { 5 }$ and MSGAN6 and use the default settings of their original implementations.
|
| 461 |
+
|
| 462 |
+
# J EVALUATION DETAILS
|
| 463 |
+
|
| 464 |
+
# J.1 UNCONDITIONAL GAN ON IMAGE DATASETS
|
| 465 |
+
|
| 466 |
+
Evaluation metrics We measure precision/recall based on Precision Recall Distribution (PRD) (Sajjadi et al., 2018). We adopt $F _ { 8 }$ and $F _ { 1 / 8 }$ scores from the PRD curve as a recall and precision of each model, respectively. We use the official implementations of $\mathrm { P R D } ^ { 7 }$ and $\mathrm { F I D ^ { 8 } }$ for the measurement.
|
| 467 |
+
|
| 468 |
+
DCGAN backbone We run the the experiment on MNIST (LeCun & Cortes, 2010), FashionMNIST (Xiao et al., 2017), CIFAR-10 (Krizhevsky et al., 2009) and CelebA (Liu et al., 2015) until 40, 50, 150 and 30 epochs, respectively. We generate 60K random examples for MNIST and Fashion-MNIST and 50K random samples for the other datasets, and then compare them with the reference datasets with the same number of examples.
|
| 469 |
+
|
| 470 |
+
StyleGAN2 backbone We run the the experiment on CIFAR-10 (Krizhevsky et al., 2009) and CelebA30K (Liu et al., 2015) until 300 epochs and choose the best model in terms of FID. We generate 50K and 30K random examples for CIFAR-10 and CelebA30K, respectively, and then compare them with the whole train (/validation) set. We do not use the truncation trick when generating samples for quantitative evaluations.
|
| 471 |
+
|
| 472 |
+
# J.2 CONDITIONED IMAGE SYNTHESIS
|
| 473 |
+
|
| 474 |
+
We measure FID, NDB/JSD9 and LPIPS10 using their official implementations. We follow all evaluation details in MSGAN (Mao et al., 2019) which is referenced for comparision. Note that NDB counts the number of statistically different bins based on the clusters made by $k$ -means clustering while LPIPS measures the average feature distances of sample pairs. JSD is calculated based on the results (clusters) of NDB.
|
| 475 |
+
|
| 476 |
+

|
| 477 |
+
Figure 11: Diversity comparison of image-to-image translation on Yosemitee (Summer Winter) and Cat Dog dataset.
|
| 478 |
+
|
| 479 |
+
Input: This bird has wings that are black and has a yellow belly.
|
| 480 |
+
|
| 481 |
+

|
| 482 |
+
Input: This bird is white with blue and has a very short beak.
|
| 483 |
+
|
| 484 |
+

|
| 485 |
+
Figure 12: Diversity comparison of text-to-image synthesis on CUB-200-2011.
|
| 486 |
+
|
| 487 |
+

|
| 488 |
+
Figure 13: More image-to-image translation results by MCL-GAN on Cat Dog.
|
| 489 |
+
|
| 490 |
+
Input: This bird has a pointed beak, yellow breast and belly, brown wings and yellow neck.
|
| 491 |
+
|
| 492 |
+

|
| 493 |
+
|
| 494 |
+
Input: This bird is white with black and has a very short beak.
|
| 495 |
+
|
| 496 |
+

|
| 497 |
+
Figure 14: More text-to-image synthesis results by MCL-GAN on CUB-200-2011.
|
md/dev/nO5caZwFwYu/nO5caZwFwYu.md
ADDED
|
@@ -0,0 +1,267 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# EFFICIENT ACTIVE SEARCH FOR COMBINATORIAL OPTIMIZATION PROBLEMS
|
| 2 |
+
|
| 3 |
+
André Hottung Bielefeld University, Germany andre.hottung@uni-bielefeld.de
|
| 4 |
+
|
| 5 |
+
Yeong-Dae Kwon Samsung SDS, Korea y.d.kwon@samsung.com
|
| 6 |
+
|
| 7 |
+
Kevin Tierney Bielefeld University, Germany kevin.tierney@uni-bielefeld.de
|
| 8 |
+
|
| 9 |
+
# ABSTRACT
|
| 10 |
+
|
| 11 |
+
Recently, numerous machine learning based methods for combinatorial optimization problems have been proposed that learn to construct solutions in a sequential decision process via reinforcement learning. While these methods can be easily combined with search strategies like sampling and beam search, it is not straightforward to integrate them into a high-level search procedure offering strong search guidance. Bello et al. (2016) propose active search, which adjusts the weights of a (trained) model with respect to a single instance at test time using reinforcement learning. While active search is simple to implement, it is not competitive with state-of-the-art methods because adjusting all model weights for each test instance is very time and memory intensive. Instead of updating all model weights, we propose and evaluate three efficient active search strategies that only update a subset of parameters during the search. The proposed methods offer a simple way to significantly improve the search performance of a given model and outperform state-of-the-art machine learning based methods on combinatorial problems, even surpassing the well-known heuristic solver LKH3 on the capacitated vehicle routing problem. Finally, we show that (efficient) active search enables learned models to effectively solve instances that are much larger than those seen during training.
|
| 12 |
+
|
| 13 |
+
# 1 INTRODUCTION
|
| 14 |
+
|
| 15 |
+
In recent years, a wide variety of machine learning (ML) based methods for combinatorial optimization problems have been proposed (e.g., Kool et al. (2019); Hottung et al. (2020)) . While early approaches failed to outperform traditional operations research methods, the gap between handcrafted and learned heuristics has been steadily closing. However, the main potential of ML-based methods lies not only in their ability to outperform existing methods, but in automating the design of customized heuristics in situations where no handcrafted heuristics have yet been developed. We hence focus on developing approaches that require as little additional problem-specific knowledge as possible.
|
| 16 |
+
|
| 17 |
+
Existing ML based methods for combinatorial optimization problems can be classified into construction methods and improvement methods. Improvement methods search the space of complete solutions by iteratively refining a given start solution. They allow for a guided exploration of the search space and are able to find high-quality solutions. However, they usually rely on problemspecific components. In contrast, construction methods create a solution sequentially starting from an empty solution (i.e., they consider a search space consisting of incomplete solutions). At test time, they can be used to either greedily construct a single solution or to sample multiple solutions from the probability distribution encoded in the trained neural network. Furthermore, the sequential solution generation process can be easily integrated into a beam search without requiring any problem-specific components. However, search methods like sampling and beam search offer no (or very limited) search guidance. Additionally, these methods do not react towards the solutions seen so far, i.e., the underlying distribution from which solutions are sampled is never changed throughout the search.
|
| 18 |
+
|
| 19 |
+
Bello et al. (2016) propose a generic search strategy called active search that allows an extensive, guided search for construction methods without requiring any problem specific components. Active search is an iterative search method that at each iteration samples solutions for a single test instance using a given model and then adjusts the parameters of that model with the objective to increase the likelihood of generating high-quality solutions in future iterations. They report improved performance over random sampling when starting the search from an already trained model. Despite promising results, active search has not seen adaption in the literature. The reason for this is its resource requirements, as adjusting all model parameters separately for each test instance is very time intensive, especially compared to methods that can sample solutions to multiple different instances in one batch.
|
| 20 |
+
|
| 21 |
+
We extend the idea of active search as follows. (1) We propose to only adjust a subset of (model) parameters to a single instance during the search, while keeping all other parameters fixed. We show that this efficient active search (EAS) drastically reduces the runtime of active search without impairing the solution quality. (2) We implement and evaluate three different implementations of EAS and show that all offer significantly improved performance over pure sampling approaches.
|
| 22 |
+
|
| 23 |
+
In our EAS implementations, the majority of (model) parameters are not updated during the search, which drastically reduces the runtime, because gradients only need to be computed for a subset of model weights, and most operations can be applied identically across a batch of different instances. Furthermore, we show that for some problems, EAS finds even better solutions than the original active search. All EAS implementations can be easily applied to existing ML construction methods.
|
| 24 |
+
|
| 25 |
+
We evaluate the proposed EAS approaches on the traveling salesperson problem (TSP), the capacitated vehicle routing problem (CVRP) and the job shop scheduling problem (JSSP). For all problems, we build upon already existing construction approaches that only offer limited search capabilities. In all experiments, EAS leads to significantly improved performance over sampling approaches. For the CVRP and the JSSP, the EAS approaches outperform all state-of-the-art ML based approaches, and even the well-known heuristic solver LKH3 for the CVRP. Furthermore, EAS approaches assists in model generalization, resulting in drastically improved performance when searching for solutions to instances that are much larger than the instances seen during model training.
|
| 26 |
+
|
| 27 |
+
# 2 LITERATURE REVIEW
|
| 28 |
+
|
| 29 |
+
Construction methods Hopfield (1982) first used a neural network (a Hopfield network) to solve small TSP instances with up to 30 cities. The development of recent neural network architectures has paved the way for ML approaches that are able to solve large instances. The pointer network architecture proposed by Vinyals et al. (2015) efficiently learns the conditional probability of a permutation of a given input sequence, e.g., a permutation of cities for a TSP solution. The authors solve TSP instances with up to 50 cities via supervised learning. Bello et al. (2016) report that training a pointer network via actor-critic RL instead results in a better performance on TSP instances with 50 and 100 cities. Furthermore, graph neural networks are used to solve the TSP, e.g., a graph embedding network in Khalil et al. (2017) and a graph attention network in Deudon et al. (2018).
|
| 30 |
+
|
| 31 |
+
The first applications of neural network based methods to the CVRP are reported by Nazari et al. (2018) and Kool et al. (2019). Nazari et al. (2018) propose a model with an attention mechanism and a recurrent neural network (RNN) decoder that can be trained via actor-critic RL. Kool et al. (2019) propose an attention model that uses an encoder that is similar to the encoder used in the transformer architecture Vaswani et al. (2017). Peng et al. (2019) and Xin et al. (2021) extend the attention model to update the node embeddings throughout the search, resulting in improved performance at the cost of longer runtimes for the CVRP. Falkner & Schmidt-Thieme (2020) propose an attention-based model that constructs tours in parallel for the CVRP with time windows.
|
| 32 |
+
|
| 33 |
+
While ML-based construction methods have mainly focused on routing problems, there are some notable exceptions. For example, Khalil et al. (2017) use a graph embedding network approach to solve the minimum vertex cover and the maximum cut problems (in addition to the TSP). Zhang et al. (2020) propose a graph neural network based approach for the job shop scheduling problem (JSSP). Li et al. (2018) use a guided tree search enhanced ML approach to solve the maximal independent set, minimum vertex cover, and the maximal clique problems. For a more detailed review of ML methods on different combinatorial optimization problems, we refer to Vesselinova et al. (2020).
|
| 34 |
+
|
| 35 |
+
While most approaches construct routing problem solutions autoregressively, some approaches predict a heat-map that describes which edges will likely be part of a good solution. The heat-map is then used in a post-hoc search to construct solutions. Joshi et al. (2019) use a graph convolutional network to create a heat-map and a beam search to search for solutions. Similarly, Fu et al. (2020) use a graph convolutional residual network with Monte Carlo tree search to solve large TSP instances. Kool et al. (2021) use the model from Joshi et al. (2019) to generate the heat-map and use it to search for solution to TSP and CVRP instances with a dynamic programming based approach.
|
| 36 |
+
|
| 37 |
+
Improvement methods Improvement methods integrate ML based methods into high-level search heuristics or try to learn improvement operators directly. In general, they often invest more time into solving an instance than construction based methods (and usually find better solutions). Chen & Tian (2019) propose an approach that iteratively changes a local part of the solution. At each iteration, the trainable region picking policy selects a part of the solution that should be changed and a trainable rule picking policy selects an action from a given set of possible modification operations. Hottung & Tierney (2020) propose a method for the CVRP that iteratively destroys parts of a solution using predefined, handcrafted operators and then reconstructs them with a learned repair operator. Wu et al. (2021) and de O. da Costa et al. (2020) propose to use RL to pick an improving solution from a specified local neighborhood (e.g., the 2-Opt neighborhood) to solve routing problems. Hottung et al. (2021) learn a continuous representation of discrete routing problem solutions using conditional variational autoencoders and search for solutions using a generic, continuous optimizer.
|
| 38 |
+
|
| 39 |
+
# 3 SOLVING COMBINATORIAL OPTIMIZATION PROBLEMS WITH EAS
|
| 40 |
+
|
| 41 |
+
We propose three EAS implementations that adjust a small subset of (model) parameters in an iterative search process. Given an already trained model, we investigate adjusting (1) the normally static embeddings of the problem instance that are generated by the encoder model, (2) the weights of additional instance-specific residual layers added to the decoder, and (3) the parameters of a lookup table that directly affect the probability distribution returned by model. In each iteration, multiple solutions are sampled for one instance and the dynamic (model) parameters are adjusted with the goal of increasing the probability of generating high quality solutions (as during model training). This allows the search to sample solutions of higher quality in subsequent iterations, i.e., the search can focus on the more promising areas of the search space. Once a high-quality solution for an instance is found, the adjusted parameters are discarded, so that the search process can be repeated on other instances. All strategies efficiently generate solutions to a batch of instances in parallel, because the network layers not updated during the search are applied identically to all instances of the batch.
|
| 42 |
+
|
| 43 |
+
Background RL based approaches for combinatorial problems aim to learn a neural network based model $p _ { \theta } ( \pi | l )$ with weights $\theta$ that can be used to generate a solution $\pi$ given an instance l. State-ofthe-art approaches usually use a model that consists of an encoder and a decoder unit. The encoder usually creates static embeddings $\omega$ that describe the instance $l$ using a computationally expensive encoding process (e.g., Kool et al. (2019); Kwon et al. (2020)). The static embeddings are then used to autoregessively construct solutions using the decoder over $T$ time steps. At each step $t$ , the decoder $q _ { \phi } ( a | s _ { t } , \bar { \omega } )$ , with weights $\phi \subset \theta$ , outputs a probability value for each possible action $a$ in the state $s _ { t }$ (e.g., for the TSP, each action corresponds to visiting a different city next). The starting state $s _ { 1 }$ describes the problem instance $l$ (e.g., the positions of the cities for the TSP and the starting city) and the state $s _ { t + 1 }$ is obtained by applying the action $a _ { t }$ selected at time step $t$ to the state $s _ { t }$ . The (partial) solution $\pi _ { t }$ is defined by the sequence of selected actions $a _ { 1 } , a _ { 2 } , \ldots , a _ { t }$ . Once a complete solution, $\pi _ { T }$ , fulfilling all constraints of the problem is constructed, the objective function value $\mathbf { \bar { \boldsymbol { C } } } ( \pi , l )$ of the solution can be computed (e.g., the tour length for the TSP).
|
| 44 |
+
|
| 45 |
+
Figure 1 shows the solution generation for a TSP instance with a model that uses static embeddings. The static embeddings $\omega$ are used at each decoding step to generate a probability distribution over all possible next actions and the selected action is provided to the decoder in the next decoding step. During testing, solutions can be constructed by either selecting actions greedily or by sampling each action according to $q _ { \phi } ( a | s _ { t } , \omega )$ . Since the static embeddings are not updated during solution generation they only need to be computed once per instance, which allows to quickly sample multiple solutions per instance. We note that not all models use static embeddings. Some approaches update all instance embeddings after each action (e.g., Zhang et al. (2020)), which allows the embeddings to contain information on the current solution state $s _ { t }$ .
|
| 46 |
+
|
| 47 |
+

|
| 48 |
+
Figure 1: Sampling a solution for the TSP with a model $p _ { \theta } ( \pi | l )$ that uses static instance embeddings.
|
| 49 |
+
|
| 50 |
+
# 3.1 EMBEDDING UPDATES
|
| 51 |
+
|
| 52 |
+
Our first proposed strategy, called EAS-Emb, updates the embeddings $\omega$ generated by an encoder using a loss function consisting of an RL component $\mathcal { L } _ { R L }$ and an imitation learning $\left( \operatorname { I L } \right)$ component $\mathcal { L } _ { I L }$ . The loss $\mathcal { L } _ { R L }$ is based on REINFORCE (Williams, 1992) and is the expected cost of the generated solutions, $\mathbb { E } \left[ C ( \pi ) \right]$ . We aim to adjust the embedding parameters to increase the likelihood of generating solutions with lower costs (e.g., a shorter tour length for the TSP). The loss $\mathcal { L } _ { I L }$ is the negation of the log-probability of (re-)generating the best solution seen so far. We adjust the embedding parameters to increase this probability.
|
| 53 |
+
|
| 54 |
+
More formally, for an instance $l$ we generate the embeddings $\omega$ using a given encoder. Based on $\omega$ we can (repeatedly) sample a solution $\pi$ whose cost is $C ( \pi )$ . A subset of the embeddings $\hat { \omega } \subseteq \omega$ is adjusted to minimize $\mathcal { L } _ { R L }$ using the gradient
|
| 55 |
+
|
| 56 |
+
$$
|
| 57 |
+
\nabla _ { \hat { \omega } } \mathcal { L } _ { R L } ( \hat { \omega } ) = \mathbb { E } _ { \boldsymbol \pi } \left[ ( C ( \boldsymbol \pi ) - b _ { \circ } ) \nabla _ { \hat { \omega } } \log q _ { \phi } ( \boldsymbol \pi \mid \hat { \omega } ) \right]
|
| 58 |
+
$$
|
| 59 |
+
|
| 60 |
+
where $\begin{array} { r } { q _ { \phi } ( \pi \mid \hat { \omega } ) \equiv \prod _ { t = 1 } ^ { T } q _ { \phi } ( a _ { t } \mid s _ { t } , \hat { \omega } ) } \end{array}$ , and $b _ { \circ }$ is a baseline (we use the baseline proposed in Kwon et al. (2020) for our experiments).
|
| 61 |
+
|
| 62 |
+
For the second loss $\mathcal { L } _ { I L }$ , let $\bar { \pi }$ be the best solution found so far for the instance $l$ , that consists of the actions $\bar { a } _ { 1 } , \dots , \bar { a } _ { T }$ . We use teacher forcing to make the decoder $q _ { \phi } ( \cdot | s _ { t } , \hat { \omega } )$ generate the solution $\bar { \pi }$ , during which we obtain the probability values associated with the actions $\bar { a } _ { 1 } , \dots , \bar { a } _ { T }$ . We increase the log-likelihood of generating $\bar { \pi }$ by adjusting $\hat { \omega }$ using the gradient
|
| 63 |
+
|
| 64 |
+
$$
|
| 65 |
+
\nabla _ { \boldsymbol { \hat { \omega } } } \mathcal { L } _ { I L } ( \boldsymbol { \hat { \omega } } ) = - \nabla _ { \boldsymbol { \hat { \omega } } } \log q _ { \phi } ( \bar { \pi } \mid \boldsymbol { \hat { \omega } } ) \equiv - \nabla _ { \boldsymbol { \hat { \omega } } } \log \prod _ { t = 1 } ^ { T } q _ { \phi } ( \bar { a } _ { t } | s _ { t } , \boldsymbol { \hat { \omega } } ) .
|
| 66 |
+
$$
|
| 67 |
+
|
| 68 |
+
The gradient of the overall loss $\mathcal { L } _ { R I L }$ is defined as $\nabla _ { \hat { \omega } } \mathcal { L } _ { R I L } ( \hat { \omega } ) = \nabla _ { \hat { \omega } } \mathcal { L } _ { R L } ( \hat { \omega } ) + \lambda \cdot \nabla _ { \hat { \omega } } \mathcal { L } _ { I L } ( \hat { \omega } )$ , where $\lambda$ is a tunable parameter. If a high value for $\lambda$ is selected, the search focuses on generating solutions that are similar to the incumbent solution. This accelerates the convergence of the search policy, which is useful when the number of search iterations is limited.
|
| 69 |
+
|
| 70 |
+
We note that both decoding processes required for RL and $\mathrm { I L }$ can be carried out in parallel, using the same forward pass through the network. Furthermore, only the parameters $\hat { \omega }$ are instance specific, while all other model parameters are identical for all instances. This makes parallelization of multiple instances in a batch more efficient both in time and memory.
|
| 71 |
+
|
| 72 |
+
# 3.2 ADDED-LAYER UPDATES
|
| 73 |
+
|
| 74 |
+
We next propose EAS-Lay, which adds an instance-specific residual layer to a trained model. During the search, the weights in the added layer are updated, while the weights of all other original layers are held fixed. We use both RL and $\mathrm { I L }$ , similarly to EAS-Emb in Section 3.1.
|
| 75 |
+
|
| 76 |
+
We formalize EAS-Lay as follows. For each instance $l$ we insert a layer
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
\operatorname { L } ^ { \star } ( h ) = h + ( ( \operatorname { R e L u } ( h W ^ { 1 } + b ^ { 1 } ) W ^ { 2 } + b ^ { 2 } )
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
into the given decoder $q _ { \phi }$ , resulting in a slightly modified model $\tilde { q } _ { \phi , \psi }$ , where $\psi = \{ W ^ { 1 } , b ^ { 1 } , W ^ { 2 } , b ^ { 2 } \}$ . The layer takes in the input $h$ and applies two linear transformations with a ReLu activation function in between. The weight matrices $W ^ { \bar { 1 } }$ and $W ^ { 2 }$ and the bias vectors $b ^ { 1 }$ and $b ^ { 2 }$ are adjusted throughout the search via gradient descent. The weights in the matrix $W ^ { 2 }$ and the vector $b ^ { 2 }$ are initialized to zero so that the added layer does not affect the output of the model during the first iteration of the search. The gradient for $\mathcal { L } _ { R L }$ is given as
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
\nabla _ { \psi } \mathcal { L } _ { R L } ( \psi ) = \mathbb { E } _ { \pi } \big [ ( C ( \pi ) - b _ { \circ } ) \nabla _ { \psi } \log \tilde { q } _ { \phi , \psi } ( \pi ) \big ] ,
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
with $\begin{array} { r } { \tilde { q } _ { \phi , \psi } ( \pi ) \equiv \prod _ { t = 1 } ^ { T } \tilde { q } _ { \phi , \psi } ( a _ { t } \mid s _ { t } , \omega ) } \end{array}$ , and $b _ { \circ }$ is a baseline. The gradient for $\mathcal { L } _ { I L }$ is defined similarly.
|
| 89 |
+
|
| 90 |
+
Note that the majority of the network operations are not instance specific. They can be applied identically to all instances running in parallel as a batch, resulting in significantly lower runtime during search. The position at which the new layer is inserted has an impact on the performance of EAS-Lay, and identifying the best position usually requires testing. In general, the memory requirement of this approach can be reduced by inserting the additional layer closer towards the output layer of the network. This decreases the number of layers to be considered during backpropagation. We noticed for transformer-based architectures that applying the residual layer $\mathrm { L } ^ { \star } ( \cdot )$ to the query vector $q$ before it is passed to the single attention head usually results in a good performance.
|
| 91 |
+
|
| 92 |
+
# 3.3 TABULAR UPDATES
|
| 93 |
+
|
| 94 |
+
EAS-Emb and EAS-Lay require significantly less memory per instance than the original active search. However, they still need to store many gradient weights associated with multiple layers for the purpose of backpropagation. This significantly limits the number of solutions one can generate in parallel. We hence propose EAS-Tab, which does not require backpropagation, but instead uses a simple lookup table to modify the policy of the given model. For each action at a given state, the table provides a guide on how to change its probability, so that the sampled solution has a higher chance at being similar to the best solution found in the past.
|
| 95 |
+
|
| 96 |
+
Formally, at each step $t$ during the sequential generation of a solution, we redefine the probability of selecting action $a _ { t }$ in the state $s _ { t }$ as $q _ { \phi } ( a | \bar { s _ { t } } , \omega ) ^ { \alpha } \cdot Q _ { g ( s _ { t } , a _ { t } ) }$ and renormalize over all possible actions using the softmax function. Here, $\alpha$ is a hyperparameter, and $g$ is a function that maps each possible state and action pair to an entry in the table $Q$ . The network parameters $\theta$ remain unchanged, resulting in fast and memory efficient solution generation. The hyperparameter $\alpha$ is similar to the temperature value proposed in Bello et al. (2016) and modifies the steepness of the probability distribution returned by the model (lower values increase the exploration of the search). During search, the table $Q$ is updated with the objective of increasing the quality of the generated solutions. More precisely, after each iteration, $Q$ is updated based on the best solution $\bar { \pi }$ found so far consisting of the actions $\bar { a } _ { 1 } , \dots , \bar { a } _ { T }$ at states $\bar { s } _ { 1 } , \dots , \bar { s } _ { T }$ , respectively, with
|
| 97 |
+
|
| 98 |
+
$$
|
| 99 |
+
Q _ { g ( s _ { t } , a _ { t } ) } = \left\{ \begin{array} { l l } { \operatorname* { m a x } ( 1 , \frac { \sigma } { q _ { \phi } ( a | s _ { t } , \omega ) ^ { \alpha } } ) , } & { \mathrm { i f } g ( s _ { t } , a _ { t } ) \in \{ g ( \bar { a } _ { 1 } , \bar { s } _ { 1 } ) , \dots , g ( \bar { a } _ { T } , \bar { s } _ { T } ) \} } \\ { 1 , } & { \mathrm { o t h e r w i s e } } \end{array} \right.
|
| 100 |
+
$$
|
| 101 |
+
|
| 102 |
+
The hyperparameter $\sigma$ defines the degree of exploitation of the search. If a higher value of $\sigma$ is used, the probabilities for actions that generate the incumbent solution are increased.
|
| 103 |
+
|
| 104 |
+
In contrast to embedding or added-layer updates, this EAS method requires deeper understanding of the addressed combinatorial optimization problem to design the function $g ( s _ { t } , a _ { t } )$ . For example, for the TSP with $n$ nodes we use a table $Q$ of size $n \times n$ in which each entry $Q _ { i , j }$ corresponds to a directed edge $e _ { i , j }$ of the problem instance. The probability increases for the same directed edge that was used in the incumbent solution. This definition of $g ( s _ { t } , a _ { t } )$ effectively ignores the information on all the previous visits stored in state $s _ { t }$ , focusing instead on the current location (city) in choosing the next move. We note that this EAS approach is similar to the ant colony optimization algorithm (Dorigo et al., 2006), which has been applied to a wide variety of combinatorial optimization problems.
|
| 105 |
+
|
| 106 |
+
# 4 EXPERIMENTS
|
| 107 |
+
|
| 108 |
+
We evaluate all EAS strategies using existing, state-of-the-art RL based methods for three different combinatorial optimization problems. For the first two, the TSP and the CVRP, we implement EAS for the POMO approach (Kwon et al., 2020). For the third problem, the JSSP, we use the L2D method from Zhang et al. (2020). We extend the code made available by the authors of POMO (MIT license) and L2D (no license) with our EAS strategies to ensure a fair evaluation. Note that we only make minor modifications to these methods, and we use the models trained by the authors when available.
|
| 109 |
+
|
| 110 |
+
We run all experiments on a GPU cluster using a single Nvidia Tesla V100 GPU and a single core of an Intel Xeon 4114 CPU at $2 . 2 \ : \mathrm { G H z }$ for each experiment. Our source code is available at https://github.com/ahottung/EAS. We use the Adam optimizer (Kingma & Ba, 2014) for all EAS approaches. The hyperparameters $\lambda , \sigma , \alpha$ , and the learning rate for the optimizer are tuned via Bayesian optimization using scikit-optimize (Head et al., 2020) on separate validation instances, which are sampled from the same distribution as the test instances. The hyperparameters are not adjusted for larger instances used to evaluate the generalization performance.
|
| 111 |
+
|
| 112 |
+
# 4.1 TSP
|
| 113 |
+
|
| 114 |
+
The TSP is a well-known routing problem involving finding the shortest tour between a set of $n$ nodes (i.e., cities) that visits each node exactly once and returns to the starting node. We assume that the distance matrix obeys the triangle inequality.
|
| 115 |
+
|
| 116 |
+
Implementation POMO uses a model that is very similar to the AM model from Kool et al. (2019). The model generates instance embeddings only once per instance and does not update them during construction. The probability distribution over all actions are generated by a decoder, whose last layer is a single-headed attention layer. This last layer calculates the compatibility of a query vector $q$ to the key vector $k _ { i }$ for each node $i$ . In this operation, the key vector $k _ { i }$ is an embedding that has been computed separately, but identically for each input (i.e., node $i$ ) during the instance encoding process. For EAS-Emb, we only update the set of single-head keys $k _ { i }$ $( i = 1 , \ldots , n )$ . For EAS-Lay we apply the residual layer $\mathrm { L } ^ { \star } ( \cdot )$ described in Equation 3 to the query vector $q$ before it is passed to the single attention head. For EAS-Tab, we use a table $Q$ of size $n \times n$ and the mapping function $g ( s _ { t } , a _ { t } )$ such that each entry $Q _ { i , j }$ corespondents to a directed edge $e _ { i , j }$ of the problem instance.
|
| 117 |
+
|
| 118 |
+
Setup We use the 10,000 TSP instances with $n = 1 0 0$ from Kool et al. (2019) for testing and three additional sets of 1,000 instances to evaluate generalization performance. We evaluate the EAS approaches against just using POMO with greedy action selection, random sampling, and active search as in Bello et al. (2016). In all cases, we use the model trained on instances with $n = 1 0 0$ made available by the POMO authors. For greedy action selection, POMO generates $8 \cdot n$ solutions for an instance of size $n$ (using 8 augmentations and $n$ different starting cities). In all other cases, we generate $2 0 0 \cdot 8 \cdot n$ solutions per instance (over the course of 200 iterations for the (E)AS approaches). The batch size (the number of instances solved in parallel) is selected for each method individually to fully utilize the available GPU memory. We compare to the exact solver Concorde (Applegate et al., 2006), the heuristic solver LKH3 (Helsgaun, 2017), the graph convolutional neural network with beam search (GCN-BS) from Joshi et al. (2019), the 2-Opt based deep learning (2-Opt-DL) approach from de O. da Costa et al. (2020), the learning improvement heuristics (LIH) method from Wu et al. (2021), the conditional variational autoencoder (CVAE-Opt) approach (Hottung et al., 2021), and deep policy dynamic programming (DPDP) (Kool et al., 2021).
|
| 119 |
+
|
| 120 |
+
Results Table 1 shows the average costs, average gap and the total runtime (wall-clock time) for each instance set. The exact solver Concorde performs best overall, as it is a highly specialized TSP solver. Of the POMO-based approaches, the original active search offers the best gap to optimality, but requires 5 days of runtime. EAS significantly lowers the runtime while the gap is only marginally larger. DPDP performs best among ML-based approaches. However, DPDP relies on a handcrafted and problem-specific beam search, whereas EAS methods are completely problem-independent. On the larger instances, EAS significantly improves generalization performance, reducing the gap over sampling by up to $3 . 6 \mathrm { x }$ . We also evaluate active search using the imitation learning loss, but observe no impact on the search performance (see Appendix B).
|
| 121 |
+
|
| 122 |
+
Table 1: Results for the TSP
|
| 123 |
+
|
| 124 |
+
<table><tr><td rowspan="2"></td><td colspan="3">Testing (10k inst.)</td><td colspan="10">Generalization (1k instances)</td></tr><tr><td colspan="3">n=100</td><td colspan="3">n=125</td><td colspan="3">n=150</td><td colspan="3"></td><td>n = 200</td></tr><tr><td>Method</td><td>Obj.</td><td>Gap</td><td>Time</td><td>Obj.</td><td>Gap</td><td>Time</td><td>Obj.</td><td>Gap</td><td></td><td>Time</td><td>Obj.</td><td>Gap</td><td>Time</td></tr><tr><td>Concorde</td><td></td><td>[7.765 0.000%</td><td></td><td></td><td>82M|8.583 0.000%</td><td></td><td></td><td>12M|9.346 0.000%</td><td></td><td></td><td>17M|10.687 0.000%</td><td></td><td>31M</td></tr><tr><td>LKH3</td><td>7.765</td><td>0.000%</td><td>8H</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>8.5830.000%73M9.3460.000% 99M10.6870.000%</td><td>3H</td></tr><tr><td>GCN-BS</td><td>7.87</td><td>1.39%</td><td>40M</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>=</td><td>-</td></tr><tr><td>2-Opt-DL</td><td>7.83</td><td>0.87%</td><td>41M</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>=</td></tr><tr><td>LIH</td><td>7.87</td><td>1.42%</td><td>2H</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>=</td></tr><tr><td>CVAE-Opt</td><td>1</td><td>0.343%</td><td>6D</td><td></td><td>8.646 0.736%</td><td>21H</td><td></td><td>9.482 1.454%</td><td></td><td>30H</td><td></td><td></td><td></td></tr><tr><td>DPDP</td><td>7.765</td><td>0.004%</td><td>2H</td><td></td><td>8.589 0.070%</td><td>31M</td><td></td><td>9.4340.942%</td><td></td><td>44M</td><td></td><td>11.154 4.370%</td><td>74M</td></tr><tr><td>Greedy</td><td>7.776</td><td>0.146%</td><td>1M|</td><td>8.607</td><td>0.278%</td><td></td><td><1M|9.397</td><td></td><td>0.542%</td><td><1M|</td><td>10.843</td><td>1.457%</td><td>1M</td></tr><tr><td>Sampling</td><td>7.770</td><td>0.074%</td><td>4H</td><td>8.595</td><td>0.145%</td><td>45M</td><td></td><td>9.378</td><td>0.334%</td><td>78M</td><td></td><td>10.8381.416%</td><td>3H</td></tr><tr><td>Active S.</td><td></td><td>7.768 0.046%</td><td>5D</td><td>8.591</td><td>0.095%</td><td>15H</td><td>9.364</td><td></td><td>0.192%</td><td>19H</td><td>10.735</td><td>50.447%</td><td>24H</td></tr><tr><td>0 EAS-Emb</td><td></td><td>7.769 0.063%</td><td>5H</td><td>8.591</td><td>0.092%</td><td>57M</td><td></td><td>9.363</td><td>0.174%</td><td>2H</td><td>10.730 0.400%</td><td></td><td>4H</td></tr><tr><td>P EAS-Lay</td><td></td><td>7.769 0.053%</td><td>7H</td><td>8.591</td><td>0.089%</td><td>74M</td><td></td><td>9.363 0.176%</td><td></td><td>2H</td><td>10.737 0.471%</td><td></td><td>4H</td></tr><tr><td>EAS-Tab</td><td></td><td>7.768 0.048%</td><td>5H</td><td>8.591</td><td>0.091%49M</td><td></td><td></td><td>9.3650.196%</td><td></td><td>1H</td><td>10.756 0.650%</td><td></td><td>3H</td></tr></table>
|
| 125 |
+
|
| 126 |
+
# 4.2 CVRP
|
| 127 |
+
|
| 128 |
+
The goal of the CVRP is to find the shortest routes for a set of vehicles with limited capacity that must deliver goods to a set of $n$ customers. We again use the POMO approach as a basis for our EAS strategies. As is standard in the ML literature, we evaluate all approaches on instance sets where the locations and demands are sampled uniformly at random. Additionally, we consider the more realistic instance sets proposed in Hottung & Tierney (2020) with up to 297 customers (see Appendix A).
|
| 129 |
+
|
| 130 |
+
Implementation We use the same EAS implementation for the CVRP as for the TSP.
|
| 131 |
+
|
| 132 |
+
Setup We use the 10,000 CVRP instances from Kool et al. (2019) for testing and additional sets of 1,000 instances to evaluate the generalization performance. Again, we compare the EAS approaches to POMO using greedy action selection, sampling and active search. We generate the same number of solutions per instance as for the TSP. We compare to LIH, CAVE-Opt, DPDP, NeuRewriter (Chen & Tian, 2019) and neural large neighborhood search (NLNS) from Hottung & Tierney (2020).
|
| 133 |
+
|
| 134 |
+
Results Table 2 shows the average costs, the average gap to LKH3 and the total wall-clock time for all instance sets. EAS-Lay outperforms all other approaches on the test instances, including approaches that rely on problem-specific knowledge, with a gap that beats LKH3. Both other EAS methods also find solutions of better quality than LKH3, which is quite an accomplishment given the many years of work on the LKH3 approach. We note it is difficult to provide a fair comparison between a single-core, CPU-bound technique like LKH3 and our approaches that use a GPU. Nonetheless, assuming a linear speedup, at least 18 CPU cores would be needed for LKH3 to match the runtime of EAS-Tab. On the generalization instance sets with $n = 1 2 5$ and $n = 1 5 0$ , the EAS approaches also outperform LKH3 and CVAE-Opt while being significantly faster than active search. On the instances with $n = 2 0 0$ , active search finds the best solutions of all POMO based approaches with a gap of $0 . 2 2 \%$ to LKH3, albeit with a long runtime of 36 hours. We hypothesize that significant changes to the learned policy are necessary to generate high-quality solutions for instances that are very different to those seen during training. Active search’s ability to modify all model parameters makes it easier to make those changes. EAS-Tab offers the worst performance on the instances with $n = 2 0 0$ with a gap of $1 1 . 8 \%$ . This is because EAS-Tab is very sensitive to the selection of the hyperparameter $\alpha$ , meaning that EAS-Tab requires hyperparameter tuning on some problems to generalize more effectively. Adjusting $\alpha$ for the $n = 2 0 0$ case improves EAS-Tab’s gap to at least $3 . 5 4 \%$ , making it slightly better than greedy or sampling.
|
| 135 |
+
|
| 136 |
+
Table 2: Results for the CVRP on instances with uniformly sampled locations and demands
|
| 137 |
+
|
| 138 |
+
<table><tr><td rowspan="2"></td><td colspan="3">Testing (10k inst.) n=100</td><td colspan="10">Generalization (1k instances)</td></tr><tr><td>Obj.</td><td>Gap</td><td>Time</td><td>Obj.</td><td>n =125 Gap</td><td>Time</td><td>Obj.</td><td>n=150 Gap</td><td>Time</td><td>Obj.</td><td>n = 200 Gap</td><td></td><td>Time</td></tr><tr><td>Method</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>LKH3</td><td>|15.65</td><td>0.00%</td><td></td><td>6D|17.50</td><td>0.00%</td><td></td><td>19H|19.22</td><td></td><td>0.00%</td><td></td><td>20H|22.00</td><td>0.00%</td><td>25H</td></tr><tr><td>NLNS NeuRewriter</td><td>15.99</td><td>2.23%</td><td>62M</td><td>[|18.07</td><td>3.23%</td><td></td><td>9M|19.96</td><td></td><td>3.86%</td><td>12M|23.02</td><td></td><td>4.66%</td><td>24M</td></tr><tr><td>LIH</td><td>16.10</td><td></td><td>66M</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>=</td></tr><tr><td>CVAE-Opt</td><td>16.03</td><td>2.47% 1.36%</td><td>5H</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>=</td><td>=</td></tr><tr><td>DPDP</td><td>15.63</td><td>-0.13%</td><td>11D 23H</td><td>17.87 17.51</td><td>2.08% 0.07%</td><td>36H 3H</td><td>19.84 19.31</td><td></td><td>3.24% 0.48%</td><td>46H 5H</td><td>22.26</td><td>51.20%</td><td>= 9H</td></tr><tr><td>Greedy</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></td><td>15.76</td><td>0.76%</td><td>2M</td><td>17.73</td><td>1.29%</td><td><1M</td><td>19.64</td><td></td><td>2.18%</td><td>1M</td><td>|22.90</td><td>4.12%</td><td>1M</td></tr><tr><td>Sampling 0</td><td>15.67</td><td>0.17%</td><td>7H</td><td>17.60</td><td>0.54%</td><td>73M</td><td>19.48</td><td></td><td>1.35%</td><td>2H</td><td>23.18</td><td>5.35%</td><td>5H</td></tr><tr><td>Active S.</td><td>15.63</td><td>-0.07%</td><td>8D</td><td>17.47</td><td>-0.21%</td><td>25H</td><td>19.21</td><td></td><td>-0.03%</td><td>29H</td><td>22.05</td><td>0.22%</td><td>36H</td></tr><tr><td>EAS-Emb</td><td>15.63 15.61</td><td>-0.08%</td><td>9H 12H</td><td>17.47</td><td>-0.21%</td><td>93M</td><td>19.22</td><td></td><td>0.03%</td><td>3H</td><td>22.19</td><td>0.88%</td><td>6H</td></tr><tr><td>EAS-Lay EAS-Tab</td><td>15.62</td><td>-0.23% -0.14%</td><td>8H</td><td>17.50</td><td>17.46 -0.24% 0.00%</td><td>2H 80M</td><td>19.21 19.36</td><td></td><td>-0.04% 0.72%</td><td>3H 2H</td><td>22.10 24.56</td><td>0.45% 11.8%</td><td>8H 5H</td></tr></table>
|
| 139 |
+
|
| 140 |
+
# 4.3 JSSP
|
| 141 |
+
|
| 142 |
+
The JSSP is a scheduling problem involving assigning jobs to a set of heterogeneous machines. Each job consists of multiple operations that are run sequentially on the set of machines. The objective is to minimize the time needed to complete all jobs, called the makespan. We evaluate EAS using the L2D approach, which is a state-of-the-art ML based construction method using a graph neural network.
|
| 143 |
+
|
| 144 |
+
Implementation L2D represents JSSP instances as disjunctive graphs in which each operation of an instance is represented by a node in the graph. To create a schedule, L2D sequentially selects the operation that should be scheduled next. To this end, an embedding $h _ { v }$ is created for each node $v$ in a step-wise encoding process. In contrast to POMO, the embeddings $h _ { v }$ are recomputed after each decision step $t$ . Since EAS-Emb requires static embeddings, we modify the network to use $\tilde { h } _ { v } ^ { t } = h _ { v } ^ { t } + h _ { v } ^ { S T }$ as an embedding for node t to zero. During the searc $v$ at step with E $t$ , where S-Emb $h _ { v } ^ { S T }$ is a vector that is initialized winly adjust the static component $h _ { v } ^ { S T }$ of the embedding with gradient descent. For EAS-Lay, we insert the residual layer $\mathrm { L } ^ { \star } ( \cdot )$ described in Equation 3 to each embedding $h _ { v }$ separately and identically. Finally, for EAS-Tab, we use a table $Q$ of size $| O | \times | O |$ , where $| O |$ is the number of operations, and we design the function $g ( s _ { t } , a _ { t } )$ so that the entry $Q _ { i , j }$ corresponds to selecting the operation $o _ { j }$ directly after the operation $o _ { i }$ .
|
| 145 |
+
|
| 146 |
+
Setup We use three instance sets with 100 instances from Zhang et al. (2020) for testing and to evaluate the generalization performance. We use the exact solver Google OR-Tools (Perron & Furnon) as a baseline, allowing it a maximum runtime of 1 hour per instance. Furthermore, we compare to L2D with greedy action selection. Note that the performance of the L2D implementation is CPU bound and does not allow different instances to be batch processed. We hence solve instances sequentially and generate significantly fewer solutions per instance than for the TSP and the CVRP. For sampling, active search and the EAS approaches we sample 8,000 solutions per problem instance over the course of 200 iterations for the (efficient) active search approaches.
|
| 147 |
+
|
| 148 |
+
Results Table 3 shows the average gap to the OR-Tools solution and the total wall-clock time per instance set. EAS-Emb offers the best performance for all three instance sets. On the $1 0 \times 1 0$ instances, EAS-Emb reduces the gap by $50 \%$ in comparison to pure sampling. Even on the $2 0 \times 1 5$ instances it reduces the gap to $1 6 . 8 \%$ from $2 0 . 8 \%$ for pure sampling, despite the low number of sampled solutions per instance. EAS-Lay offers performance that is comparable to active search. We note that if L2D were to more heavily use the GPU, instances could be solved in batches, thus drastically reducing the runtime of EAS-Lay and EAS-Tab. While EAS-Tab shows similar performance to active search on the test instance set, it is unable to generalize effectively to the larger instances.
|
| 149 |
+
|
| 150 |
+
# 4.4 SEARCH TRAJECTORY ANALYSIS
|
| 151 |
+
|
| 152 |
+
To get a better understanding of how efficient active search improves performance, we monitor the quality of the solutions sampled at each of the 200 iterations of the search. Figure 2 reports the average quality over all test instances for the JSSP and over the first 1,000 test instances for the TSP and CVRP. As expected, the quality of solutions generated via pure sampling does not change over the course of the search for all three problems. For all other methods, the quality of the generated solutions improves throughout the search. Thus, all active search variants successfully modify the (model) parameters in a way that increases the likelihood of generating high-quality solutions.
|
| 153 |
+
|
| 154 |
+
Table 3: Results for the JSSP
|
| 155 |
+
|
| 156 |
+
<table><tr><td colspan="2" rowspan="2"></td><td colspan="3">Testing(100 inst.)</td><td colspan="4">Generalization (1OO instances)</td></tr><tr><td colspan="2">10×10</td><td colspan="3">15×15</td><td colspan="3">20×15</td></tr><tr><td colspan="2" rowspan="2">Method</td><td rowspan="2">Obj. Gap</td><td rowspan="2">Time</td><td rowspan="2">Obj.</td><td>Gap</td><td>Time</td><td>Obj. Gap</td><td>Time</td></tr><tr><td rowspan="2"></td><td rowspan="2"></td><td rowspan="2"></td><td rowspan="2">0.0%</td></tr><tr><td rowspan="2">OR-Tools Greedy</td><td rowspan="2">1807.6 0.0%</td></tr><tr><td>37S|1</td><td rowspan="2">[1188.0</td><td colspan="2" rowspan="2">0.0%</td><td rowspan="2">3H| |1345.5</td><td rowspan="2"></td><td rowspan="2">80H</td></tr><tr><td rowspan="2"></td><td rowspan="2">1988.6</td></tr><tr><td>22.3% 871.7</td><td>20S 1528.3</td><td>28.6%</td><td>44S</td><td>1738.0</td><td>29.2%</td><td>60S</td></tr><tr><td rowspan="4">Sampling L</td><td>854.2</td><td>8.0% 5.8%</td><td>8H 8H</td><td>1378.3 16.0% 1345.2 13.2%</td><td>25H 32H</td><td>1624.6 1576.5</td><td>20.8% 17.2%</td><td>40H</td></tr><tr><td>EAS-Emb</td><td>837.0 3.7%</td><td>7H</td><td>1326.4 11.7%</td><td>22H</td><td>1570.8</td><td>16.8%</td><td>50H 37H</td></tr><tr><td>EAS-Lay</td><td>859.6 6.5%</td><td>7H</td><td>1352.6</td><td>13.8%</td><td>25H 1581.8</td><td>17.6%</td><td>46H</td></tr><tr><td>EAS-Tab</td><td>860.2 6.5%</td><td>8H</td><td>1376.8</td><td>15.9% 29H</td><td></td><td>1623.420.7%</td><td>51H</td></tr></table>
|
| 157 |
+
|
| 158 |
+

|
| 159 |
+
Figure 2: Average costs of sampled solutions at each iteration (best viewed in color).
|
| 160 |
+
|
| 161 |
+

|
| 162 |
+
Figure 3: Influence of $\lambda$ on the solution quality for EAS-Emb and EAS-Lay.
|
| 163 |
+
|
| 164 |
+
For the TSP, EAS-Emb and EAS-Lay offer nearly identical performance, with EAS-Tab outperforming both by a very slight margin. The original active search is significantly more unstable, which is likely the result of the learning rate being too high. Note that the learning rate has been tuned on an independent validation set. These results indicate that selecting a suitable learning rate is significantly more difficult for the original active search than for our efficient active search variants where only a subset of (model) parameters are changed. For the CVRP, all EAS variants find better solutions on average than the original search after only a few iterations. Keeping most parameters fixed seems to simplify the underlying learning problem and allows for faster convergence. For the JSSP, EAS-Emb offers significantly better performance than all other methods. The reason for this is that the L2D approach uses only two node features and has a complex node embedding generation procedure. While the original active search must fine tune the entire embedding generation process to modify the generated solutions, EAS-Emb can just modify the node embedding directly.
|
| 165 |
+
|
| 166 |
+
# 4.5 ABLATION STUDY: IMITATION LEARNING LOSS
|
| 167 |
+
|
| 168 |
+
We evaluate the impact of the imitation learning loss $\mathcal { L } _ { I L }$ of EAS-Emb and EAS-Lay with a sensitivity and ablation analysis for the hyperparameter $\lambda$ . We solve the first 500 test instances (to reduce the computational costs) for the TSP and CVRP, and all test instances for the JSSP using EAS-Emb and EAS-Lay with different $\lambda$ values. The learning rate remains fixed to a value determined in independent tuning runs in which $\lambda$ is fixed to zero. Figure 3 shows the results for all three problems. For the TSP and the CVRP, the results show that $\mathcal { L } _ { I L }$ can significantly improve performance. When $\lambda$ is set to 0 or very small values, $\mathcal { L } _ { I L }$ is disabled, thus including $\mathcal { L } _ { I L }$ is clearly beneficial on the TSP and CVRP. For the JSSP, the inclusion of $\mathcal { L } _ { I L }$ does not greatly improve performance, but it does not hurt it, either. Naturally, $\lambda$ should not be selected too low or too high as either too little or too much intensification can hurt search performance.
|
| 169 |
+
|
| 170 |
+
# 5 CONCLUSION
|
| 171 |
+
|
| 172 |
+
We presented a simple technique that can be used to extend ML-based construction heuristics by an extensive search. Our proposed modification of active search fine tunes a small subset of (model) parameters to a single instance at test time. We evaluate three example implementations of EAS that all result in significantly improved model performance in both testing and generalization experiments on three different, difficult combinatorial optimization problems. Our approach of course comes with some key limitations. Search requires time, thus for applications needing extremely fast (or practically instant) solutions, greedy construction remains a better option. Furthermore, while the problems we experiment on have the same computational complexity as real-world optimization problems, additional work may be needed to handle complex side constraints as often seen in industrial problems.
|
| 173 |
+
|
| 174 |
+
# ACKNOWLEDGMENTS
|
| 175 |
+
|
| 176 |
+
The computational experiments in this work have been performed using the Bielefeld GPU Cluster.
|
| 177 |
+
|
| 178 |
+
# REFERENCES
|
| 179 |
+
|
| 180 |
+
David Applegate, Ribert Bixby, Vasek Chvatal, and William Cook. Concorde TSP solver, 2006.
|
| 181 |
+
|
| 182 |
+
Irwan Bello, Hieu Pham, Quoc V Le, Mohammad Norouzi, and Samy Bengio. Neural Combinatorial Optimization with Reinforcement Learning. ArXiv, abs/1611.0, 2016.
|
| 183 |
+
|
| 184 |
+
Xinyun Chen and Yuandong Tian. Learning to perform local rewriting for combinatorial optimization. In Advances in Neural Information Processing Systems, pp. 6278–6289, 2019.
|
| 185 |
+
|
| 186 |
+
Paulo R de O. da Costa, Jason Rhuggenaath, Yingqian Zhang, and Alp Akcay. Learning 2-opt heuristics for the traveling salesman problem via deep reinforcement learning. In Asian Conference on Machine Learning, pp. 465–480. PMLR, 2020.
|
| 187 |
+
|
| 188 |
+
Michel Deudon, Pierre Cournut, Alexandre Lacoste, Yossiri Adulyasak, and Louis-Martin Rousseau. Learning heuristics for the TSP by policy gradient. In International Conference on the Integration of Constraint Programming, Artificial Intelligence, and Operations Research, pp. 170–181. Springer, 2018.
|
| 189 |
+
|
| 190 |
+
Marco Dorigo, Mauro Birattari, and Thomas Stutzle. Ant colony optimization. IEEE computational intelligence magazine, 1(4):28–39, 2006.
|
| 191 |
+
|
| 192 |
+
Jonas K Falkner and Lars Schmidt-Thieme. Learning to solve vehicle routing problems with time windows through joint attention. arXiv preprint arXiv:2006.09100, 2020.
|
| 193 |
+
|
| 194 |
+
Zhang-Hua Fu, Kai-Bin Qiu, and Hongyuan Zha. Generalize a small pre-trained model to arbitrarily large TSP instances. arXiv preprint arXiv:2012.10658, 2020.
|
| 195 |
+
|
| 196 |
+
Tim Head, Manoj Kumar, Holger Nahrstaedt, Gilles Louppe, and Iaroslav Shcherbatyi. scikitoptimize/scikit-optimize, September 2020. URL https://doi.org/10.5281/zenodo. 4014775.
|
| 197 |
+
|
| 198 |
+
Keld Helsgaun. An extension of the Lin-Kernighan-Helsgaun TSP solver for constrained traveling salesman and vehicle routing problems. Roskilde: Roskilde University, 2017.
|
| 199 |
+
|
| 200 |
+
John J. Hopfield. Neural Networks and Physical Systems with Emergent Collective Computational Abilities. Proceedings of the National Academy of Sciences of the United States of America, 79(8): 2554–2558, 1982. ISSN 00278424.
|
| 201 |
+
|
| 202 |
+
André Hottung and Kevin Tierney. Neural large neighborhood search for the capacitated vehicle routing problem. In European Conference on Artificial Intelligence, pp. 443–450, 2020.
|
| 203 |
+
|
| 204 |
+
André Hottung, Shunji Tanaka, and Kevin Tierney. Deep learning assisted heuristic tree search for the container pre-marshalling problem. Computers & Operations Research, 113:104781, 2020.
|
| 205 |
+
|
| 206 |
+
André Hottung, Bhanu Bhandari, and Kevin Tierney. Learning a latent search space for routing problems using variational autoencoders. In International Conference on Learning Representations, 2021.
|
| 207 |
+
|
| 208 |
+
Chaitanya K Joshi, Thomas Laurent, and Xavier Bresson. An efficient graph convolutional network technique for the travelling salesman problem. arXiv preprint arXiv:1906.01227, 2019.
|
| 209 |
+
|
| 210 |
+
Elias Khalil, Hanjun Dai, Yuyu Zhang, Bistra Dilkina, and Le Song. Learning combinatorial optimization algorithms over graphs. 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.
|
| 211 |
+
|
| 212 |
+
Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
|
| 213 |
+
|
| 214 |
+
Wouter Kool, Herke van Hoof, and Max Welling. Attention, learn to solve routing problems! In International Conference on Learning Representations, 2019.
|
| 215 |
+
|
| 216 |
+
Wouter Kool, Herke van Hoof, Joaquim Gromicho, and Max Welling. Deep policy dynamic programming for vehicle routing problems. arXiv preprint arXiv:2102.11756, 2021.
|
| 217 |
+
|
| 218 |
+
Yeong-Dae Kwon, Jinho Choo, Byoungjip Kim, Iljoo Yoon, Youngjune Gwon, and Seungjai Min. POMO: policy optimization with multiple optima for reinforcement learning. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 21188–21198. Curran Associates, Inc., 2020.
|
| 219 |
+
|
| 220 |
+
Zhuwen Li, Qifeng Chen, and Vladlen Koltun. Combinatorial optimization with graph convolutional networks and guided tree search. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. CesaBianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 31. Curran Associates, Inc., 2018.
|
| 221 |
+
|
| 222 |
+
Mohammadreza Nazari, Afshin Oroojlooy, Lawrence Snyder, and Martin Takác. Reinforcement learning for solving the vehicle routing problem. In Advances in Neural Information Processing Systems, pp. 9839–9849, 2018.
|
| 223 |
+
|
| 224 |
+
Bo Peng, Jiahai Wang, and Zizhen Zhang. A deep reinforcement learning algorithm using dynamic attention model for vehicle routing problems. In International Symposium on Intelligence Computation and Applications, pp. 636–650. Springer, 2019.
|
| 225 |
+
|
| 226 |
+
Laurent Perron and Vincent Furnon. OR-Tools. URL https://developers.google.com/ optimization/.
|
| 227 |
+
|
| 228 |
+
Eduardo Uchoa, Diego Pecin, Artur Pessoa, Marcus Poggi, Thibaut Vidal, and Anand Subramanian. New benchmark instances for the capacitated vehicle routing problem. European Journal of Operational Research, 257(3):845–858, 2017.
|
| 229 |
+
|
| 230 |
+
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 (eds.), Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017.
|
| 231 |
+
|
| 232 |
+
Natalia Vesselinova, Rebecca Steinert, Daniel F. Perez-Ramirez, and Magnus Boman. Learning combinatorial optimization on graphs: A survey with applications to networking. IEEE Access, 8: 120388–120416, 2020.
|
| 233 |
+
|
| 234 |
+
Thibaut Vidal, Teodor Gabriel Crainic, Michel Gendreau, and Christian Prins. A unified solution framework for multi-attribute vehicle routing problems. European Journal of Operational Research, 234(3):658–673, 2014.
|
| 235 |
+
|
| 236 |
+
Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. Pointer networks. In Advances in Neural Information Processing Systems, pp. 2692–2700, 2015.
|
| 237 |
+
|
| 238 |
+
Ronald J Williams. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine Learning, 8(3-4):229–256, 1992.
|
| 239 |
+
|
| 240 |
+
Yaoxin Wu, Wen Song, Zhiguang Cao, Jie Zhang, and Andrew Lim. Learning improvement heuristics for solving routing problems. IEEE Transactions on Neural Networks and Learning Systems, 2021.
|
| 241 |
+
|
| 242 |
+
Liang Xin, Wen Song, Zhiguang Cao, and Jie Zhang. Step-wise deep learning models for solving routing problems. IEEE Transactions on Industrial Informatics, 17(7):4861–4871, 2021.
|
| 243 |
+
|
| 244 |
+
Cong Zhang, Wen Song, Zhiguang Cao, Jie Zhang, Puay Siew Tan, and Xu Chi. Learning to dispatch for job shop scheduling via deep reinforcement learning. In Advances in Neural Information Processing Systems, volume 33, pp. 1621–1632, 2020.
|
| 245 |
+
|
| 246 |
+
# A EXPERIMENTS FOR MORE REALISTIC CVRP INSTANCES
|
| 247 |
+
|
| 248 |
+
We provide results from additional experiments for the CVRP on more realistic instances to show that our approach is effective at solving instances with a wide range of structures. Our EAS methods are implemented in the same way as in Section 4.2
|
| 249 |
+
|
| 250 |
+
Setup We evaluate EAS on 9 instance sets from Hottung & Tierney (2020) (consisting of 20 instances each) that have been generated based on the instances from Uchoa et al. (2017) performing 3 runs per instance. The characteristics of the instances vary significantly between sets, but all instances in the same set have been sampled from an identical distribution. For each instance set we train a new model for 3 weeks on a separate, corresponding training set. For testing, we run all (efficient) active search approaches for 200 iterations using the newly trained models. Additionally, we test the generalization performance by solving all instance sets with EAS-Lay using the CVRP model of Section 4.2 that has been trained on the uniform instances (with $n = 1 0 0$ ) from Kool et al. (2019) and call this Lay\*. We only evaluate the generalization performance of EAS-Lay (the best performing EAS approach from Section 4.2) to keep the computational costs low. In all experiments, we use hyperparameters tuned for the uniform CVRP instances. We compare to NLNS, LKH3 and the state-of-the-art unified hybrid genetic search (GS) from Vidal et al. (2014). As is standard in the operations research literature, we round the distances between customers to the nearest integer. Furthermore, we solve instances sequentially and not in batches of different instances. However, to make better use of the available GPU memory, we solve up to 10 copies of the same instance in parallel for the EAS approaches and for POMO with sampling. The best solution found so far is shared between all runs, which has an impact on the imitation learning loss $\mathcal { L } _ { I L }$ for EAS-Emb and EAS-Lay. For EAS-Tab we set $\tilde { Q } = ( 1 - \bar { \beta } ) \cdot Q + \beta \cdot Q ^ { g l o b }$ , where $Q ^ { g l o b }$ is the lookup table for the best solution over all runs and $\beta$ is linearly increased from 0 to 1 over the course of the search.
|
| 251 |
+
|
| 252 |
+
Results Table 4 shows the gap to the unified hybrid genetic search and the average runtime per instance for all methods. For EAS-Lay we report the performance of the instance set specific models and additionally the generalization performance when using the model trained on uniform CVRP instances (with $n = 1 0 0$ ). The later results are marked with a star. EAS-Emb and EAS-Lay both find better solution than NLNS and LKH3 on 8 out of the 9 instance sets. EAS-Tab outperforms NLNS and LKH3 on all but two instance sets. As a side note, we have found that the original active search (AS) performs surprisingly well, outperforming LKH3 on 3 instance sets, even though it still cannot surpass our newly proposed EAS methods. The version of EAS-Lay (marked with a star) that uses the model trained on uniform instances with $n = 1 0 0$ performs surprisingly well with gaps between $0 . 2 6 \%$ to $4 . 0 8 \%$ to the GS.
|
| 253 |
+
|
| 254 |
+
Table 4: Results for the CVRP on the instance sets from Hottung & Tierney (2020).
|
| 255 |
+
|
| 256 |
+
<table><tr><td></td><td></td><td colspan="4">Gap to GS in %</td><td colspan="2">POMO</td><td colspan="5"> Avg. Runtime in minutes</td></tr><tr><td>Inst.</td><td>n</td><td>POMO Sam. AS</td><td>POMO-EAS Emb Lay Lay* Tab</td><td></td><td>[NLNS LKH|</td><td></td><td></td><td></td><td>POMO-EAS Sam. AS Emb Lay Lay* TabNLNS LKH GS</td><td></td><td></td><td></td></tr><tr><td>XE 1</td><td>100</td><td></td><td></td><td></td><td></td><td>2.12</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>XE</td><td>128</td><td>0.86 0.65 0.76 0.80</td><td>10.23 0.26 0.260.25</td><td>0.61 0.31| 0.26 0.29</td><td>0.32 0.44</td><td>0.9 0.54</td><td>1.3 1.6</td><td>1.3 1.8</td><td>1.4 2.0</td><td>1.5 0.9 2.1</td><td>3.2</td><td>6.2 0.6 2.0</td></tr><tr><td>XE</td><td>180</td><td>0.51 0.20</td><td>0.09 0.09</td><td>0.54 0.13</td><td>0.58 0.16</td><td>1.3 2.5</td><td>2.2</td><td>3.3</td><td>3.7</td><td>24 3.8</td><td>3.2 3.2</td><td>1.2 1.1 1.4</td></tr><tr><td>3.57 XE</td><td>199</td><td></td><td></td><td></td><td></td><td></td><td></td><td>4.2</td><td>4.7</td><td>3.5</td><td>3.2</td><td>3.6 2.4</td></tr><tr><td>XE 9</td><td>213</td><td>1.50 0.88 1.96 1.30</td><td>0.37 0.45</td><td>1.29 0.80 4.08 0.83</td><td>2.03 2.26</td><td>0.72 3.3 1.09</td><td>2.4</td><td></td><td>5.2</td><td>4.9 5.4</td><td>10.2</td><td>1.1 2.4</td></tr><tr><td>XE 11</td><td>236</td><td>1.42 1.22</td><td>0.64 0.71 0.82 0.84</td><td>1.76 0.94</td><td>0.65</td><td>3.7 0.78 4.0</td><td>2.5 2.7</td><td>4.6 5.2</td><td>5.1</td><td>3.9 5.6 4.8</td><td>10.2</td><td>1.1 3.2</td></tr><tr><td>3 XE</td><td></td><td>1.40 0.88</td><td>0.38 0.56</td><td>2.83 0.80</td><td>0.82</td><td>1.55 7.1</td><td>3.5</td><td>8.7</td><td>6</td><td></td><td>10.2</td><td>5.7 3.6</td></tr><tr><td>XE 15</td><td>268</td><td>1.81 2.17</td><td>0.850.96</td><td>2.51 1.27</td><td>1.81</td><td>1.32 7.3</td><td>3.3</td><td>8.8</td><td></td><td>76</td><td>10.3</td><td>5.8 5.5</td></tr><tr><td>XE 17</td><td>297</td><td>1.66 0.97</td><td>0.44 0.65</td><td>2.15 0.92</td><td>1.41</td><td>1.23 8.9</td><td>3.8</td><td>8.8</td><td>6.8</td><td>9.4</td><td>10.3</td><td>2.5 4.2</td></tr></table>
|
| 257 |
+
|
| 258 |
+
# B ABLATION STUDY: ACTIVE SEARCH LOSS
|
| 259 |
+
|
| 260 |
+
We evaluate if applying the imitation learning loss component used by EAS-Emb and EAS-Lay to the original active search can significantly improve the performance. To this end, we solve all test instances using active search with and without the imitation learning loss component. Note that the hyperparameters for each approach have been tuned independently on separate validation set instances. Table 5 shows the results. We observe no significant impact of the imitation learning loss $\mathcal { L } _ { \pi }$ on the performance of active search. This means that active search with imitation learning loss is not competitive with EAS-Lay and EAS-Emb across all problems, even when sharing the same loss function.
|
| 261 |
+
|
| 262 |
+

|
| 263 |
+
Figure 4: Influence of $\sigma$ on the solution quality for EAS-Tab
|
| 264 |
+
|
| 265 |
+
# C PARAMETER SWEEP: EAS-TAB INTENSIFICATION
|
| 266 |
+
|
| 267 |
+
We investigate the impact of the hyperparameter $\sigma$ on EAS-Tab, which controls the degree of exploitation of the search. By setting $\sigma$ to zero (or very small values) we essentially disable the lookup table, thus examining its impact on the search. We again solve all three problems with different values of $\sigma$ on a subset of test instances. We fix $\alpha$ independently based on tuning on a separate set of validation instances. Figure 4 provides the results for adjusting $\sigma$ . For all three problems, $\sigma = 1 0$ provides the best trade-off between exploration and exploitation. Note that low $\sigma$ values (which reduce the impact of the lookup table updates) hurt performance, meaning that the table based adjustments are effective in all cases.
|
md/dev/p4RvNzlJX7W/p4RvNzlJX7W.md
ADDED
|
@@ -0,0 +1,637 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# PARAMETER AVERAGING FOR SGD STABILIZES THE IMPLICIT BIAS TOWARDS FLAT REGIONS
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Stochastic gradient descent is a workhorse for training deep neural networks due to its excellent generalization performance. Several studies demonstrated this success is attributed to the implicit bias of the method that prefers a flat minimum and developed new methods based on this perspective. Recently, Izmailov et al. (2018) empirically observed that an averaged stochastic gradient descent with a large step size can bring out the implicit bias more effectively and can converge more stably to a flat minimum than the vanilla stochastic gradient descent. In our work, we theoretically justify this observation by showing that the averaging scheme improves the bias-optimization tradeoff coming from the stochastic gradient noise: a large step size amplifies the bias but makes convergence unstable, and vice versa. Specifically, we show that the averaged stochastic gradient descent can get closer to a solution of a penalized objective on the sharpness than the vanilla stochastic gradient descent using the same step size under certain conditions. In experiments, we verify our theory and show this learning scheme significantly improves performance.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Stochastic gradient descent (SGD) (Robbins & Monro, 1951) is a powerful learning method for training modern deep neural networks. In order to further improve the performance, a great deal of SGD variants such as adaptive gradient methods has been developed. However, SGD is still the workhorse because SGD often generalizes better than these variants even when they achieve much faster convergence regarding the training loss (Keskar & Socher, 2017; Wilson et al., 2017; Luo et al., 2019). Therefore, the study of the implicit bias of SGD, explaining why it works so better, is nowadays an active research subject.
|
| 12 |
+
|
| 13 |
+
Among such studies, flat minima (Hochreiter & Schmidhuber, 1997) has been recognized as an important notion relevant to the generalization performance of deep neural networks, and SGD has been considered to have a bias towards a flat minimum. Hochreiter & Schmidhuber (1997); Keskar et al. (2017) suggested the correlation between flatness (sharpness) and generalization, that is, flat minima generalizes well compared to sharp minima, and Neyshabur et al. (2017) rigorously supported this correlation under $\ell _ { 2 }$ -regularization by using the PAC-Bayesian framework (McAllester, 1998; 1999). Furthermore, by the large scale experiments, Jiang et al. (2020) verified that the flatness measures reliably capture the generalization performance and are the most relevant among 40 complexity measures. In parallel, Keskar et al. (2017) empirically demonstrated that SGD prefers a flat minimum due to its own stochastic gradient noise and subsequent studies (Kleinberg et al., 2018; Zhou et al., 2020) proved this implicit bias based on the smoothing effect due to the noise and stochastic differential equation, respectively.
|
| 14 |
+
|
| 15 |
+
Along this line of research, there are endeavors to enhance the bias aiming to improve performance. Especially, stochastic weight averaging (SWA) (Izmailov et al., 2018) and sharpness aware minimization (SAM) (Foret et al., 2020) achieved significant improvement in generalization performance over SGD. SWA is a cyclic averaging scheme for SGD, which includes the averaged SGD (Ruppert, 1988; Polyak & Juditsky, 1992) as a special case. Averaged SGD with an appropriately small step size or diminishing step size to zero is well known to be an efficient method that achieves statistically optimal convergence rates for the convex optimization problems (Bach & Moulines, 2011; Lacoste-Julien et al., 2012; Rakhlin et al., 2012). However, such a small step size strategy does not seem useful for training deep neural networks, and Izmailov et al. (2018) found the averaged SGD with not small but large step size works quite well.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: We run SGD and averaged SGD 500 times with the uniform stochastic gradient noise for two objective functions (top and bottom). Figure (a) depicts the objective function $f$ (green, $\eta = 0$ ) and smoothed objectives $F$ (red and blue, $\eta > 0$ ). Figures (b) and (c) plot convergent points by SGD and averaged SGD with histograms, respectively.
|
| 19 |
+
|
| 20 |
+
The success of using a large step size can be attributed to the strong implicit bias as discussed in Izmailov et al. (2018). SGD with a large step size cannot stay in sharp regions because of the amplified stochastic gradient noise, and thus it moves to another region. After a long run, SGD will finally oscillate according to an invariant distribution covering a flat region. Then, by taking the average, we can get the mean of this distribution, which is located inside a flat region. Although this provides a good insight into how the averaged SGD with a large step size behaves, the theoretical understanding remains elusive. Hence, the research problem we aim to address is
|
| 21 |
+
|
| 22 |
+
Why does the averaged SGD with a large step size converge to a flat region more stably than SGD?
|
| 23 |
+
|
| 24 |
+
In our work, we address this question via the convergence analysis of both SGD and averaged SGD.
|
| 25 |
+
|
| 26 |
+
# 1.1 CONTRIBUTIONS
|
| 27 |
+
|
| 28 |
+
We first explain the idea behind our study. Our analysis builds upon the alternative view of SGD (Kleinberg et al., 2018) which suggested that SGD implicitly optimizes the smoothed objective function obtained by the convolution with the stochastic gradient noise (see the left of Figure 1). Since as pointed out later the smoothed objective is essentially a penalized objective on the sharpness whose strength depends on the step size, the more precise optimization of the smoothed objective with a large step size implies the convergence to a flatter region. At the same time, the step size is known to control the optimization accuracy of SGD, that is, we need to take a small step size at the final phase of training to converge. These observations indicate the bias-optimization tradeoff coming from the stochastic gradient noise and controlled by the step size:
|
| 29 |
+
|
| 30 |
+
A large step size amplifies the bias towards a flat region but makes the optimization for the smoothed objective inaccurate, whereas a small step size weakens the bias but makes the optimization accurate.
|
| 31 |
+
|
| 32 |
+
In our work, we prove that the averaged SGD can improve the above tradeoff, that is, it can optimize the smoothed objective more precisely than SGD under the same step size. Specifically, we prove as long as the smoothed objective satisfies one-point strong convexity at the solution and some regularity√ conditions, SGD using the step size $\eta$ converges to a distance $O ( \sqrt { \eta } )$ from the solution (Theorem 1), whereas the averaged SGD using the same step size converges to a distance ${ \cal { O } } ( \eta )$ (Theorem 2).
|
| 33 |
+
|
| 34 |
+
We remark that large step size in our study means the step size with which SGD oscillates and poorly performs but the averaged SGD works. Clearly, a larger step size regardless of the condition of the objective will diverge, thus it should be appropriately small to achieve sufficient optimization. The better dependence of ${ \cal { O } } ( \eta )$ than $O ( \sqrt { \eta } )$ means that the averaged SGD can work well with a wider range of step sizes than SGD. Although, a too small step-size does not always bias the solution because the deviation of the solution is $\cdot$ , the above dfference of the order can make the separation between SGD and averaged SGD with an appropriately chosen step-size depending on the problem. As a result, we can expect the improvement by the averaged SGD for datasets such that the stronger implicit bias with the appropriately larger step size is useful.
|
| 35 |
+
|
| 36 |
+
The separation between SGD and averaged SGD regarding the bias can occur even in the simple setup as seen in Figure 1 which depicts obtained parameters by running SGD and averaged SGD 500 times in two cases. We observe (a) both methods with the small step size can get stuck at sharp valleys or an edge of a flat region because of weak bias and accurate optimization, (b) SGD with the large step size amplifies the bias and reaches a flat region but is unstable, and (c) averaged SGD with large step size can converge stably to a near biased solution which minimizes the smoothed objective. The behavior of the averaged SGD in an asymmetric valley (the top of Figure 1), that the parameter is biased toward a flat side from an edge of the region, is also known to be preferable property in generalization as well as flat minima (see Izmailov et al. (2018); He et al. (2019)). We note that this phenomenon is certainly captured by our theory. Indeed, Figure 2 shows the convergent point of the averaged SGD is almost the minimizer of smoothed objective for each step size.
|
| 37 |
+
|
| 38 |
+

|
| 39 |
+
Figure 2: The figure plots the original objective (green), smoothed objectives (blue, darker is smoother), and convergent points obtained by the averaged SGD which is run for the asymmetric valley objective 500 times for each step size $\dot { \eta } \in \{ 0 , 1$ , 0.3, 0.5, 0.7, 0.9}.
|
| 40 |
+
|
| 41 |
+
Our findings are summarized below:
|
| 42 |
+
|
| 43 |
+
• SGD and averaged SGD implicitly optimize the smoothed objective, whose strength depends on the step size, up to $O ( \sqrt { \eta } )$ and ${ \cal { O } } ( \eta )$ errors in Euclidean distance from the solution. This explains why these methods reach a flat region with an approprie step-size, since smoothing eliminates sharp minima.
|
| 44 |
+
• This means that averaged SGD can optimize the smoothed objective more precisely than SGD under the same step size as long as required conditions uniformly hold regarding the step size, resulting in a stronger bias towards a flat region. In other words, averaged SGD better controls the bias-optimization tradeoff than SGD.
|
| 45 |
+
• Hence, the parameter averaging yields an improvement for difficult datasets such that the stronger implicit bias with the larger step size is useful. This suggests the use of larger step size for such datasets so that averaged SGD stably converges but SGD itself is unstable to effectively bring out the implicit bias.
|
| 46 |
+
|
| 47 |
+
Technical difference from Kleinberg et al. (2018). The proof idea of Proposition 1 relies on the alternative view of SGD (Kleinberg et al., 2018) which shows the existence of an associated SGD for the smoothed objective. However, since its stochastic gradient is a biased estimator, they showed the convergence not to the solution but to a point at which a sort of one-point strong convexity holds, and avoid the treatment of a biased estimator. Hence, the optimization of the smoothed objective is not guaranteed in their theory. On the other hand, optimization accuracy is the key in our theory, thus we need nontrivial refinement of the proof under a normal one-point strong convexity at the solution.
|
| 48 |
+
|
| 49 |
+
# 2 PRELIMINARY – STOCHASTIC GRADIENT DESCENT
|
| 50 |
+
|
| 51 |
+
In this section, we introduce the problem setup and stochastic gradient descent (SGD) in the general form including the standard SGD for the risk minimization problems appearing in machine learning.
|
| 52 |
+
|
| 53 |
+
Let $f : \mathbb { R } ^ { d } \mathbb { R }$ be a smooth nonconvex objective function to be minimized. For simplicity, we assume $f$ is nonnegative. A stochastic gradient descent, randomly initialized at $w _ { 0 }$ , for optimizing $f$ is described as follows: for $t = 0 , 1 , 2 , . . .$ .
|
| 54 |
+
|
| 55 |
+
$$
|
| 56 |
+
w _ { t + 1 } = w _ { t } - \eta \left( \nabla f ( w _ { t } ) + \epsilon _ { t + 1 } ( w _ { t } ) \right) ,
|
| 57 |
+
$$
|
| 58 |
+
|
| 59 |
+
where $\eta > 0$ is the step-size and $\epsilon _ { t + 1 } : \mathbb { R } ^ { d } \mathbb { R } ^ { d }$ is a random field corresponding to the stochastic gradient noise i.e., for any $w \in \mathbb { R } ^ { d }$ , $\{ \epsilon _ { t + 1 } ( w ) \} _ { t = 0 } ^ { \infty }$ is a sequence of zero-mean random variables taking values in $\mathbb { R } ^ { d }$ . A typical setup of the above is an empirical/expected risk minimization in machine learning.
|
| 60 |
+
|
| 61 |
+
Example 1 (Risk Minimization). Let $\ell ( w , z )$ be a loss function consisting of the hypothesis function parameterized by $w \in \mathbb { R } ^ { d }$ and the data $z \in \mathbb { R } ^ { p }$ . Let $\mu$ be an empirical/true data distribution over the data space and $Z$ be a random variable following $\mu$ . Then, the objective function is defined by
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
f ( w ) = \mathbb { E } _ { Z \sim \mu } [ \ell ( w , Z ) ] .
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
Given i.i.d. random variables $\{ Z _ { t + 1 } \} _ { t = 0 } ^ { \infty }$ with the same distribution as $Z$ , the standard stochastic gradient at $t$ -th iterate $w _ { t }$ is defined as $\tilde { \nabla _ { w } \ell } ( w _ { t } , Z _ { t + 1 } )$ . In this setting, the stochastic noise $\epsilon _ { t + 1 }$ can be $\epsilon _ { t + 1 } ( w ) = \nabla _ { w } \ell ( w , Z _ { t + 1 } ) - \nabla f ( w )$ . Note that we can further include the $\ell _ { 2 }$ -regularization in the objective $f$ and the perturbation by the data augmentation in the distribution $\mu$ .
|
| 68 |
+
|
| 69 |
+
As this example satisfies, we suppose $\{ \epsilon _ { t + 1 } \} _ { t = 0 } ^ { \infty }$ are independent copies each other. That is, there is a measurable map from a probability space: $\bar { \Omega } \overset { \sim } { \ni } z \mapsto \epsilon ( \bar { w } , z ) \in \mathbb R ^ { d }$ , and then $\epsilon _ { t + 1 }$ can be written as a measurable map from a product probability space: $\Omega ^ { \mathbb { Z } _ { \geq 0 } } \ni \{ z _ { s + 1 } \} _ { s = 0 } ^ { \infty } \mapsto \epsilon ( w , z _ { t + 1 } ) \in \mathbb { R } ^ { d }$ when explicitly representing them as measurable maps. Moreover, we make the following assumptions on the objective function and stochastic gradient noise.
|
| 70 |
+
|
| 71 |
+
# Assumption 1.
|
| 72 |
+
|
| 73 |
+
(A1) $f : { \mathbb { R } ^ { d } } \to { \mathbb { R } }$ is nonnegative, twice continuously differentiable, and its Hessian is bounded, i.e., there is a constant $L > 0$ such that for any $w \in \mathbb { R } ^ { d }$ , $- L I \preceq \nabla ^ { 2 } f ( w ) \preceq L I$ .
|
| 74 |
+
(A2) Random fields $\{ \epsilon _ { t + 1 } \} _ { t = 0 } ^ { \infty }$ are independent copies each other and each $\epsilon _ { t + 1 } ( w )$ is differentiable in $w$ . Moreover, for any $w \in \mathbb { R } ^ { d } \mathbb { \bar { E } } [ \epsilon _ { t + 1 } ( w ) ] = 0$ and there are σ1 $, \sigma _ { 2 } > 0$ such that for any $w \in \mathbb { R } ^ { d }$ , $\mathbb { E } [ \| \epsilon _ { t + 1 } ( w ) \| ^ { 2 } ] \le \sigma _ { 1 } ^ { 2 }$ and $\mathbb { E } [ \| J _ { \epsilon _ { t + 1 } } ^ { \top } ( w ) \| _ { 2 } ] \le \sigma _ { 2 } .$ . , where $J _ { \epsilon _ { t + 1 } }$ is Jacobian of $\epsilon _ { t + 1 }$ .
|
| 75 |
+
|
| 76 |
+
Remark. The smoothness and boundedness conditions (A1) on the objective function and the zero-mean and the bounded variance conditions (A2) on stochastic gradient noise are commonly assumed in the convergence analysis for the stochastic optimization methods. Moreover, if Hessian matrix satisfies $- L I \overset { \cdot } { \preceq } \nabla _ { w } ^ { 2 } \ell ( w , \overset { \cdot } { z } ) \preceq L I$ in Example 1, then the last condition on $J _ { \epsilon _ { t + 1 } }$ also holds with at least $\sigma _ { 2 } = 2 L$ because $J _ { \epsilon _ { t + 1 } } ( w ) = \nabla _ { w } ^ { 2 } \ell ( w , Z _ { t + 1 } ) - \nabla ^ { 2 } f ( w )$ .
|
| 77 |
+
|
| 78 |
+
# 3 ALTERNATIVE VIEW OF STOCHASTIC GRADIENT DESCENT
|
| 79 |
+
|
| 80 |
+
An alternative view (Kleinberg et al., 2018) of SGD is the key in our analysis relating to an implicit bias towards a flat minimum. We introduce this view with a refined convergence analysis and see the bias-optimization tradeoff caused by the stochastic gradient noise with a step size.
|
| 81 |
+
|
| 82 |
+
An alternative view of SGD considers an associated iterations $\{ v _ { t } \} _ { t = 0 } ^ { \infty }$ with $\{ w _ { t } \} _ { t = 0 } ^ { \infty }$ , which approximately minimizes a smoothed objective function obtained by the stochastic gradient noise. We here define $v _ { t }$ as a parameter obtained by the exact gradient descent from $w _ { t }$ , that is, ${ v _ { t } } = { w _ { t } } - \eta \nabla f ( { w _ { t } } )$ and we analyze the update of $v _ { t }$ instead of $w _ { t }$ . Since $w _ { t + 1 } = v _ { t } - \eta \epsilon _ { t + 1 } ( w _ { t } )$ , we get $\boldsymbol v _ { t + 1 } = \boldsymbol v _ { t } - \eta \epsilon _ { t + 1 } ( \boldsymbol w _ { t } ) - \eta \nabla f ( \boldsymbol v _ { t } - \eta \epsilon _ { t + 1 } ( \boldsymbol w _ { t } ) ) .$ . As shown in Appendix A. 1, under a specific setting given later, $w \mapsto v = w - \eta \nabla f ( w )$ becomes a smooth invertible injection and its inverse is differentiable, thus, we identify $\epsilon _ { t + 1 } ^ { \prime } ( v )$ with $\epsilon _ { t + 1 } ( w )$ through the map $w \mapsto v$ . Then, we get an update rule of $v _ { t }$ :
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
v _ { t + 1 } = v _ { t } - \eta \epsilon _ { t + 1 } ^ { \prime } ( v _ { t } ) - \eta \nabla f ( v _ { t } - \eta \epsilon _ { t + 1 } ^ { \prime } ( v _ { t } ) ) .
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
For convenience, we refer to the rule (2) as an implicit stochastic gradient descent in this paper. Since, the conditional expectation of $\epsilon _ { t + 1 } ^ { \prime } ( v _ { t } )$ at $v _ { t }$ is zero, we expect that the implicit SGD (2) minimizes the following smoothed objective function:
|
| 89 |
+
|
| 90 |
+
$$
|
| 91 |
+
F ( v ) = \mathbb { E } [ f ( v - \eta \epsilon ^ { \prime } ( v ) ) ] ,
|
| 92 |
+
$$
|
| 93 |
+
|
| 94 |
+
where $\epsilon ^ { \prime }$ is an independent copy of $\epsilon _ { 1 } ^ { \prime } , \epsilon _ { 2 } ^ { \prime } , \ldots$ . However, we note that this implicit SGD is not a standard SGD because $\nabla f ( v _ { t } - \eta \epsilon _ { t + 1 } ^ { \prime } ( v _ { t } ) )$ is a biased estimate of $\nabla F ( \boldsymbol { v } )$ (i.e., $\nabla F ( \boldsymbol { v } ) \neq \mathbb { E } [ \nabla f ( \boldsymbol { v } -$ $\eta \epsilon ^ { \prime } ( v ) ) ] ,$ ) in general1, and thus we need a detailed convergence analysis.
|
| 95 |
+
|
| 96 |
+
The function (3) is actually a smoothed function of $f$ by the convolution using the stochastic gradient noise $\eta \epsilon ^ { \prime }$ and the level of smoothness is controlled by the step-size $\eta$ as seen in the left of Figure 1 which depicts the original objective $f$ corresponding to $\eta = 0$ and smoothed objectives $F$ . In this figure, we can observe how a nonconvex function is smoothened and its sharp local minima are eliminated by an appropriately large step size (the bottom-left figure) and how the solution is biased toward the flat side in an asymmetric valley (the top-left figure). Hence, we expect that stochastic gradient descent can avoid sharp minima and converges to a flat region. Indeed, by taking Taylor expansion of $f$ , we see that $F ( \bar { v } )$ is an approximation of the function $f ( v )$ plus the penalization on the high (positive) curvature of $f$ along the noise direction in expectation:
|
| 97 |
+
|
| 98 |
+
$$
|
| 99 |
+
F ( v ) = f ( v ) + \frac { \eta ^ { 2 } } { 2 } \operatorname { T r } \left( \nabla ^ { 2 } f ( v ) \mathbb { E } [ \epsilon ^ { \prime } ( v ) \epsilon ^ { \prime } ( v ) ^ { \top } ] \right) + O ( \eta ^ { 3 } ) .
|
| 100 |
+
$$
|
| 101 |
+
|
| 102 |
+
The above observation indicates the reasonability of imposing some sort of convexity conditions at the solution of the smoothed objective $F ( v )$ rather than the original objective $f ( w )$ . In this paper, we make the following one-point strong convexity at the solution $v _ { * }$ to show the convergence of $F ( v _ { t } )$ . Let $v _ { * } = \arg \operatorname* { m i n } _ { \boldsymbol { v } \in \mathbb { R } ^ { d } } F ( \boldsymbol { v } )$ . We note that $F$ and $v _ { * }$ depend on the value of $\eta$ , but we do not explicitly denote this dependency for simplicity.
|
| 103 |
+
|
| 104 |
+
# Assumption 2.
|
| 105 |
+
|
| 106 |
+
For instance, this assumption holds for the function in the bottom-left in Figure 1 with sufficiently large $\eta$ and for the function in the top-left figure with any $\eta$ in a certain interval $( 0 , \eta _ { 0 } ]$ .
|
| 107 |
+
|
| 108 |
+
Assumption (A3) is a normal one-point strong convexity, whereas Kleinberg et al. (2018) assumed a different condition: $\begin{array} { r } { \mathbb { E } [ \nabla f ( v - \eta \bar { \epsilon ^ { \prime } } ( v ) ) ] ^ { \top } ( v - v _ { \circ } ) \geq c \| v - v _ { \circ } \| ^ { 2 } } \end{array}$ at some parameter $v _ { \circ }$ and showed the convergence to $v _ { \circ }$ . If $\nabla F ( v ) = \mathbb { E } [ \nabla f ( v - \eta \epsilon ^ { \prime } ( v ) ) ]$ , then $v _ { \circ }$ should be $v _ { * }$ and both assumptions coincide. However, as noted above $\nabla F ( v ) \neq \mathbb { E } [ \nabla f ( v - \eta \epsilon ^ { \prime } ( v ) ) ]$ in general, and hence $v _ { \circ }$ is not necessarily $v _ { * }$ . Our aim is to clarify how precisely SGD and averaged SGD can minimize $F ( v )$ . That is why we make the normal one-point strong convexity at $v _ { * }$ and need a much more detailed analysis. Moreover, our proof allows for a larger step size than that in Kleinberg et al. (2018) because of the different proof techniques.
|
| 109 |
+
|
| 110 |
+
Theorem 1. Under Assumption (A1), (A2), and (A3), run SGD for $T$ -iterations with the step size $\begin{array} { r } { \eta \le \frac { 1 } { 2 L } } \end{array}$ , then a sequence $\{ v _ { t } \} _ { t = 0 } ^ { \infty }$ of the implicit $S G D$ satisfies the following inequality:
|
| 111 |
+
|
| 112 |
+
$$
|
| 113 |
+
\frac { 1 } { T + 1 } \sum _ { t = 0 } ^ { T } \mathbb { E } [ \| v _ { t } - v _ { * } \| ^ { 2 } ] \leq O \left( T ^ { - 1 } \right) + \frac { 2 \eta \sigma _ { 1 } ^ { 2 } } { c } + \frac { 8 \eta ^ { 2 } \sigma _ { 1 } ^ { 2 } L } { 3 c } \left( 1 + \frac { 2 \eta \sigma _ { 2 } ^ { 2 } } { c } \right) .
|
| 114 |
+
$$
|
| 115 |
+
|
| 116 |
+
Remark. If $\sigma _ { 1 } = 0$ , then SGD is nothing but deterministic gradient descent and $f = F$ because of the absence of stochastic gradient noise. Hence, SGD converges to a minimizer of $f$ according to the classical optimization theory, which is recovered by Theorem 1 with $\sigma _ { 1 } = 0$ .
|
| 117 |
+
|
| 118 |
+
This theorem shows the convergence of SGD to the minimum of the smoothed objective $F$ up to distance $O ( \sqrt { \eta } )$ from $v _ { * }$ as long as $F$ satisfies required assumptions even if the original objective $f$ has local minima. This is also true for $w _ { t }$ since $\lVert w _ { t } - v _ { t } \rVert = O ( \eta )$ . Thus, convergence to a flatter region is expected through an explicit expression as a regularized objective (4). Moreover, we can see from the theorem the optimization accuracy becomes more accurate by using a smaller step size for the problem where the required conditions uniformly hold regarding $\eta$ . On the other hand, a small step size clearly weakens the bias. Thus, the step size $\eta$ controls the bias-optimization tradeoff coming from the stochastic gradient noise.
|
| 119 |
+
|
| 120 |
+
# 4 AVERAGED SGD WITH LARGE STEP-SIZE
|
| 121 |
+
|
| 122 |
+
Izmailov et al. (2018) empirically demonstrated that averaged SGD converges to a flat region and achieves better generalization even when SGD oscillates with a relatively large step size. We theoretically attribute this phenomenon to that the averaged SGD can get closer to $v _ { * }$ than SGD using the same step size under certain settings. In other words, parameter averaging can improve the bias-optimization tradeoff and bring out the implicit bias more effectively. In the averaged SGD, we run normal SGD (1) and take the average as follows:
|
| 123 |
+
|
| 124 |
+
$$
|
| 125 |
+
\overline { { w } } _ { T + 1 } = \frac { 1 } { T + 1 } \sum _ { t = 1 } ^ { T + 1 } w _ { t } .
|
| 126 |
+
$$
|
| 127 |
+
|
| 128 |
+
Our aim is to show $\operatorname* { l i m } _ { T \to \infty } \overline { { w } } _ { T }$ can be closer to $v _ { * }$ than $\{ w _ { t } \} _ { t = 0 } ^ { \infty }$ and $\{ v _ { t } \} _ { t = 0 } ^ { \infty }$ by clarifying the dependency of this limit on the step size $\eta$ . Preferably, the implicit SGD (2) is more useful in analyzing the averaged SGD because the average $\begin{array} { r } { \overline { { v } } _ { T } = \frac { 1 } { T } \sum _ { t = 0 } ^ { T } v _ { t } } \end{array}$ is consistent with $\overline { { w } } _ { T }$ as confirmed below. By the definition, we see
|
| 129 |
+
|
| 130 |
+
$$
|
| 131 |
+
\overline { { w } } _ { T + 1 } = \overline { { v } } _ { T } + \frac { 1 } { T + 1 } \sum _ { t = 0 } ^ { T } \epsilon _ { t + 1 } ( w _ { t } ) ,
|
| 132 |
+
$$
|
| 133 |
+
|
| 134 |
+
where the noise term $\textstyle \sum _ { t = 0 } ^ { T } \epsilon _ { t + 1 } ( w _ { t } ) \big / ( T + 1 )$ is zero in expectation and its variance is upper bounded by $\sigma _ { 1 } ^ { 2 } / ( T { + } 1 )$ under Assumption (A2). Hence, $\overline { { w } } _ { T + 1 } - \overline { { v } } _ { T }$ converges to zero in probability by Chebyshev’s inequality; for any $r > 0$ , $\mathbb { P } [ \| \overline { { w } } _ { T + 1 } - \overline { { v } } _ { T } \| > r ] \le \sigma _ { 1 } ^ { 2 } / ( T + 1 ) r ^ { 2 } \to 0$ as $T \to \infty$ , and the analysis of $\mathrm { l i m } _ { T \infty } \overline { { w } } _ { T }$ reduces to that of $\operatorname* { l i m } _ { T \to \infty } \overline { { v } } _ { T }$ .
|
| 135 |
+
|
| 136 |
+
We further make the additional assumptions on the smoothed objective $F : \mathbb { R } ^ { d } \mathbb { R }$ and give the theorem that shows the convergence of the averaged SGD.
|
| 137 |
+
|
| 138 |
+
# Assumption 3.
|
| 139 |
+
|
| 140 |
+
(A4) There is $M > 0$ such that for any $\cdot$ , $\| \nabla F ( v ) - \nabla ^ { 2 } F ( v _ { * } ) ( v - v _ { * } ) \| \leq M \| v - v _ { * } \| ^ { 2 } .$ (A5) $\nabla ^ { 2 } F ( v _ { * } )$ is positive, i.e., there is $\mu > 0$ such that $\nabla ^ { 2 } F ( v _ { * } ) \succeq \mu I$ .
|
| 141 |
+
|
| 142 |
+
Remark. (A4) is used to show the superiority of the averaging scheme. This condition can be derived by the boundedness of the third-order derivative assumed in Dieuleveut et al. (2020). The positivity of Hessian (A5) is only required at $v _ { * }$ , which is consistent with nonconvexity. For instance, examples in Figure 1 satisfy (A5).
|
| 143 |
+
|
| 144 |
+
Theorem 2. Under Assumption (A1)–(A5), run the averaged SGD for $T$ -iterations with the step size $\begin{array} { r } { \eta \le \frac { 1 } { 2 L } } \end{array}$ , then the average $\overline { { v } } _ { T }$ satisfies the following inequality:
|
| 145 |
+
|
| 146 |
+
$$
|
| 147 |
+
\left\| \mathbb { E } [ \overline { { v } } _ { T } ] - v _ { * } \right\| \leq O \left( T ^ { - \frac { 1 } { 2 } } \right) + \frac { 4 \sigma _ { 1 } \sigma _ { 2 } \eta ^ { \frac { 3 } { 2 } } L ^ { \frac { 1 } { 2 } } } { \sqrt { 3 } \mu } + \frac { 2 \eta \sigma _ { 1 } ^ { 2 } M } { c \mu } + \frac { 8 \eta ^ { 2 } \sigma _ { 1 } ^ { 2 } L M } { 3 c \mu } \left( 1 + \frac { 2 \eta \sigma _ { 2 } ^ { 2 } } { c } \right) .
|
| 148 |
+
$$
|
| 149 |
+
|
| 150 |
+
The variance of the averaged parameter $\overline { { v } } _ { T }$ is typically small, hence we evaluate the distance of $\cdot$ to $\cdot$ . Indeed, this is reasonable because the central limit theorem holds for averaged SGD under the mild conditoin even for nonconvex problems (Yu et al., 2020). Theorem 2 says that the averaged SGD can optimize the smoothed objective $F$ with better accuracy of ${ \cal { O } } ( \eta )$ than $O ( \sqrt { \eta } )$ achieved by SGD using the same step size as long as the required conditions (one-point strong convexity at minimizer and regularity for smoothed objectives) are satisfied uniformly for $\eta$ in a certain interval $( 0 , \eta _ { 0 } ]$ $\exists \eta _ { 0 } < 1 )$ . These uniform requirements hold for valleys like the top-left case of Figure 1 and likely holds in the final phase of training deep neural network because of the observation that the parameter eventually falls in a better-shaped valley (see Figure 4). Therefore, we expect the averaged SGD to outperform the normal SGD in such cases, and we recommend the use of the tail-averaging scheme for deep learning as adopted in SWA (Izmailov et al., 2018), whose benefit is well known even in the convex optimization (Rakhlin et al., 2012; Mücke et al., 2019).
|
| 151 |
+
|
| 152 |
+
# 5 EXPERIMENTS
|
| 153 |
+
|
| 154 |
+
We evaluate the empirical performance of SGD and averaged SGD on image classification tasks using CIFAR10 and CIFAR100 datasets. To evaluate the usefulness of the parameter averaging for the other methods, we also compare SAM (Foret et al., 2020) with its averaging variant. We employ the tail-averaging scheme where the average is taken over the last phase of training.
|
| 155 |
+
|
| 156 |
+
Table 2: Comparison of test classification accuracies on CIFAR100 and CIFAR10 datasets.
|
| 157 |
+
|
| 158 |
+
<table><tr><td></td><td colspan="5">CIFAR100</td><td colspan="3">CIFAR10</td></tr><tr><td></td><td>m</td><td>ResNet-50</td><td>WRN-28-10</td><td>Pyramid</td><td>m</td><td>ResNet-50</td><td>WRN-28-10</td><td>Pyramid</td></tr><tr><td>SGD</td><td>s</td><td>80.83 (0.21)</td><td>81.81 (0.29)</td><td>81.43 (0.32)</td><td>s</td><td>95.95 (0.11)</td><td>96.85 (0.16)</td><td>96.41 (0.22)</td></tr><tr><td>Averaged</td><td>S</td><td>82.13 (0.22)</td><td>83.13 (0.13)</td><td>84.23 (0.03)</td><td>s</td><td>96.58 (0.14)</td><td>97.24 (0.07)</td><td>97.07 (0.08)</td></tr><tr><td>SGD</td><td>l</td><td>82.87 (0.13)</td><td>84.23 (0.10)</td><td>85.12 (0.20)</td><td>m</td><td>96.89 (0.05)</td><td>97.44 (0.04)</td><td>97.28 (0.13)</td></tr><tr><td>SAM</td><td>s</td><td>82.56 (0.14)</td><td>83.80 (0.27)</td><td>84.59 (0.24)</td><td>S</td><td>96.34 (0.12)</td><td>97.14 (0.05)</td><td>97.34 (0.03)</td></tr><tr><td>Averaged</td><td>S</td><td>82.64 (0.12)</td><td>84.09 (0.30)</td><td>85.40 (0.12)</td><td>S</td><td>96.33 (0.10)</td><td>97.21 (0.05)</td><td>97.34 (0.03)</td></tr><tr><td>SAM</td><td>l</td><td>82.73 (0.28)</td><td>84.55 (0.17)</td><td>86.00 (0.04)</td><td>m</td><td>96.31 (0.11)</td><td>97.20 (0.06)</td><td>97.35 (0.06)</td></tr></table>
|
| 159 |
+
|
| 160 |
+
Table 1: Decay schedules for (averaged) SGD.
|
| 161 |
+
|
| 162 |
+
<table><tr><td>m milestones</td></tr><tr><td>{80,160,240} S</td></tr><tr><td>m {80,160}</td></tr><tr><td>1 {300}</td></tr></table>
|
| 163 |
+
|
| 164 |
+
We use the CNN architectures: ResNet (He et al., 2016) with 50-layers (ResNet-50), WideResNet (Zagoruyko & Komodakis, 2016) with 28 layers and width 10 (WRN-28-10), and Pyramid Network (Han et al., 2017) with 272 layers and widening factor 200. In all settings, we use the standard data augmentations: horizontal flip, normalization, padding by four pixels, random crop, and cutout (DeVries & Taylor, 2017), and we employ the weight decay with the coefficient 0.05. Moreover, we use the multi-step strategy for the step size, which decays the step size by a factor once the number of epochs reaches one of the given milestones. To see the dependence on the step size, we use two decay schedules for the parameter averaging. Table 1 summarizes milestones labeled by the symbols: ${ } ^ { \cdot } s$ ’, $" m '$ , and $\mathbf { \nabla } ^ { \cdot } l ^ { \prime }$ . The initial step size and a decay factor of the step size are set to 0.1 and 0.2 in all cases. The averages are taken from 300 epochs for the schedules $\cdot _ { s } ,$ and $\mathbf { \nabla } \cdot \mathbf { \vec { \tau } } _ { l } \cdot \mathbf { \vec { \tau } } _ { \mathrm { ~ \tiny ~ \vec ~ { ~ } ~ } }$ , and from 160 epochs for the schedule $\cdot _ { m } \cdot { \bf \cdot }$ . These hyperparameters were tuned based on the validation sets.
|
| 165 |
+
|
| 166 |
+
For a fair comparison, we run (averaged) SGD with 400 epochs and (averaged) SAM with 200 epochs because SAM requires two gradients per iteration, and thus the milestones and starting epoch of taking averages are also halved for (averaged) SAM. We evaluate each method 5 times for ResNet-50 and WRN-28-10, and 3 times for Pyramid network. The averages of classification accuracies are listed in Table 2 with the standard deviations in brackets. We observe from the table that the parameter averaging for SGD improves the classification accuracies in all cases, especially on CIFAR100 dataset. Eventually, the averaged SGD achieves comparable or better performance than SAM. Moreover, we also observe improvement by parameter averaging for SAM in most cases, which is consistent with the observations in Kaddour et al. (2022).
|
| 167 |
+
|
| 168 |
+
Comparing results on CIFAR100 and CIFAR10, the large step size is better, and the small step size is relatively poor on CIFAR100 dataset, whereas the small step size generally works on CIFAR10 dataset. If we use the step-size strategy $\mathbf { \nabla } \cdot \mathbf { \nabla } l ^ { \prime }$ for CIFAR10, then the improvement becomes small (see Appendix B for this result). We hypothesize that this is because the strong bias with a large step size would be useful for difficult datasets, whereas the weak bias with a small step size would be sufficient for simple datasets such that the normal SGD already achieves high accuracies. Moreover, we note that the averaged SGD on CIFAR100 quite works well with the large step-size schedule $\mathbf { \nabla } ^ { \cdot } l ^ { \prime }$ , but SGD itself does not converge and poorly performs under this schedule as seen in Figure 3. The accuracy of SGD temporarily increases at the 300 epochs because of the decay of the step size, it decreases thereafter. However, the average of such parameters achieves significantly high accuracy as expected by our theory.
|
| 169 |
+
|
| 170 |
+

|
| 171 |
+
Figure 3: Test accuracies achieved by SGD and averaged SGD on CIFAR100 dataset with ResNet-50 and WRN-28-10.
|
| 172 |
+
|
| 173 |
+

|
| 174 |
+
Figure 4: Sections of the train (red) and test (blue) loss landscapes across the parameters obtained by averaged SGD (distance $\scriptstyle = 0$ ) and SGD (distance ${ \mathop : } = 1$ ) for ResNet-50 with CIFAR100 dataset. SGD is run with a small step size after running averaged SGD with a large step size. The middle figure is the close-up view at the edge. The triangle and circle markers represent convergent parameters by SGD and averaged SGD, respectively. The right figure plots smoothed train loss functions (green, darker is smoother) with Gaussian noises in addition to train and test losses. The blank circles are the minimizers of smoothed objectives.
|
| 175 |
+
|
| 176 |
+
Finally, we observe in Figure 4 the loss landscape around the convergent point is in better shape and forms an asymmetric valley. Therefore, we expect that the loss function around the solution uniformly satisfies the required conditions in our theory. Specifically, Figure 4 depicts the section of train and test loss functions across parameters obtained by the averaged SGD and SGD. The middle figure is the close-up view at the edge and plots each parameter. The right figure depicts the smoothed objectives with Gaussian noises in addition to train and test losses in log-scale. We observe in Figure 4 the phenomenon that SGD converges to an edge and averaged SGD converges to a flat side. This phenomenon can be explained by our theory because the minimizer of the smoothed asymptotic valley is shifted to a flat side as confirmed in a synthetic setting (Figure 2) and deep learning setting (the right of Figure 4). Moreover, the right figure indicates the possibility that the smoothed objective with appropriate stochastic gradient noise well approximates test loss, although we employ artificial noise (Gaussian) to depict graphs for simplicity. Finally, we observe that averaged SGD achieves a lower test loss which makes about $2 \%$ improvement in the classification error on CIFAR100 dataset. These observations are also consistent with the experiments conducted in He et al. (2019).
|
| 177 |
+
|
| 178 |
+
# 6 RELATED LITERATURE AND DISCUSSION
|
| 179 |
+
|
| 180 |
+
Flat Minimum. Keskar et al. (2017) and Hochreiter & Schmidhuber (1997) showed a flat minimum generalizes well and a sharp minimum generalizes poorly. However, the flatness solely cannot explain generalization because it can be easily manipulated (Dinh et al., 2017). Neyshabur et al. (2017) rigorously proved the sharpness combined with $\ell _ { 2 }$ -norm provides a generalization bound and Jiang et al. (2020) verified this correlation through large scale experiments. Keskar et al. (2017) also argued that SGD converges to a flat minimum and He et al. (2019) argued the averaged SGD tends to converge to an asymmetric valley. Several works (Kleinberg et al., 2018; Zhou et al., 2020) studied the stochastic gradient noise to theoretically prove the existence of an implicit bias towards a flat region or asymmetric valley. Moreover, many works (Izmailov et al., 2018; Foret et al., 2020; Damian et al., 2021; Orvieto et al., 2022) studied the techniques to further bring out the bias of SGD. In particular, SAM and SWA achieved a significant improvement in the generalization performance. In our paper, we show that parameter averaging stabilizes the convergence to a flat region or asymmetric valley, and suggest the usefulness of the combination with the large step size for the difficult dataset which needs a stronger regularization.
|
| 181 |
+
|
| 182 |
+
Markov Chain Interpretation of SGD. Dieuleveut et al. (2020); Yu et al. (2020) provided the Markov chain interpretation of SGD. They showed the marginal distribution of the parameter of SGD converges to an invariant distribution for convex and nonconvex optimization problems, respectively. Moreover, Dieuleveut et al. (2020) showed the mean of the invariant distribution, attained by the averaged SGD, is at distance ${ \cal { O } } ( \eta )$ from the minimizer of the objective function, whereas SGD itself oscillates at distance $O ( \sqrt { \eta } )$ in the convex optimization settings. Izmailov et al. (2018) also attributed the success of SWA to such a phenomenon. That is, Izmailov et al. (2018) explained that SGD travels on the hypersphere because of the convergence to Gaussian distribution and the concentration on the sphere under a simplified setting, and thus averaging scheme allows us to go inside of the sphere which may be flat. We can say our contribution is to theoretically justify this intuition by extending the result obtained by Dieuleveut et al. (2020) to a nonconvex optimization setting. In the proof, we utilize the alternative view of SGD (Kleinberg et al., 2018) in a non-asymptotic way under some conditions not on the original objective but on the smoothed objective function. Combination with the Markov chain view for nonconvex objective (Yu et al., 2020) may be helpful in more detailed analyses.
|
| 183 |
+
|
| 184 |
+
Step size and Minibatch. SGD with a large step size often suffers from stochastic gradient noise and becomes unstable. This is the reason why we should take a smaller step size so that SGD converges. In this sense, the minibatching of stochastic gradients clearly plays the same role as the step size and sometimes brings additional gains. For instance, Smith et al. (2017) empirically demonstrated that the number of parameter updates can be reduced, maintaining the learning curves on both training and test datasets by increasing minibatch size instead of decreasing step size. We remark that our analysis can incorporate the minibatch by dividing $\sigma _ { 1 } ^ { 2 }$ and $\sigma _ { 2 } ^ { 2 }$ in Theorem 1 and 2 by the minibatch size, and we can see certain improvements of optimization accuracy as well. Then, both SGD and averaged SGD share the same dependency on the minibatch size and thus controlling step size seems more beneficial for parameter averaging.
|
| 185 |
+
|
| 186 |
+
Edge of Stability. Recently, Cohen et al. (2021) showed the deterministic gradient descent for deep neural networks enters Edge of Stability phase. In the traditional optimization theory, the step size is set to be smaller than $1 / L$ to ensure stable convergence and we also make such a restriction. On the other hand, the Edge of Stability phase appears when using a higher step size than $2 / L$ . In this phase, the training loss behaves non-monotonically and the sharpness finally stabilizes around $2 / \eta$ . This can be explained as follows (Lewkowycz et al., 2020); if the sharpness around the current parameter is large compared to the step size, then gradient descent cannot stay in such a region and goes to a flatter region that can accommodate the large step size. There are works (Arora et al., 2022; Ahn et al., 2022) which attempted to rigorously justify Edge of Stability phase. Interestingly, their analyses are based on a similar intuition to ours, but we consider a different regime of step sizes and a different factor (stochastic noise or larger step size than $2 / L$ ) brings the implicit bias towards flat regions. We believe establishing a unified theory is interesting future research.
|
| 187 |
+
|
| 188 |
+
Averaged SGD. The averaged SGD (Ruppert, 1988; Polyak & Juditsky, 1992) is a popular variant of SGD, which returns the average of parameters obtained by SGD aiming at stabilizing the convergence. Because of the better generalization performance, many works conducted convergence rate analysis√ in the expected risk minimization setting and derived the asymptotically optimal rates $O ( 1 / \sqrt { T } )$ and $O ( 1 / T )$ for non-strongly convex and strongly convex problems (Nemirovski et al., 2009; Bach & Moulines, 2011; Rakhlin et al., 2012; Lacoste-Julien et al., 2012). However, the schedule of step size is basically designed to optimize the original objective function, and hence the implicit bias coming from the large step size will eventually disappear. When applying a non-diminishing step size schedule, the non-zero optimization error basically remains. What we do in this paper is to characterize it as the implicit bias toward a flat region.
|
| 189 |
+
|
| 190 |
+
# CONCLUSION
|
| 191 |
+
|
| 192 |
+
In this paper, we showed that parameter averaging improves the bias-optimization tradeoff caused by the stochastic gradient noise. Specifically, we proved that averaged SGD optimizes the smoothed objective functions up to ${ \cal { O } } ( \eta )$ -error, whereas SGD itself optimizes it up to $O ( \sqrt { \eta } )$ -error in terms of Euclidean distance from the solution, where $\eta$ is the step size. Therefore, parameter averaging significantly stabilizes the implicit bias toward a flat region, and we can expect improved performance for difficult datasets such that the stronger bias induced by a larger step size is helpful. Finally, we observed the consistency of our theory with the experiments on image classification tasks. In addition to the above discussion, another interesting research direction is to investigate what type of noise is strongly related to generalization performance.
|
| 193 |
+
|
| 194 |
+
# REFERENCES
|
| 195 |
+
|
| 196 |
+
Kwangjun Ahn, Jingzhao Zhang, and Suvrit Sra. Understanding the unstable convergence of gradient descent. In Proceedings of the 39th International Conference on Machine Learning, volume 162, pp. 247–257, 2022.
|
| 197 |
+
|
| 198 |
+
Sanjeev Arora, Zhiyuan Li, and Abhishek Panigrahi. Understanding gradient descent on the edge of stability in deep learning. In Proceedings of the 39th International Conference on Machine Learning, pp. 948–1024, 2022.
|
| 199 |
+
|
| 200 |
+
Francis Bach and Eric Moulines. Non-asymptotic analysis of stochastic approximation algorithms for machine learning. In Advances in Neural Information Processing Systems, volume 24, pp. 451–459, 2011.
|
| 201 |
+
|
| 202 |
+
Jeremy Cohen, Simran Kaur, Yuanzhi Li, J Zico Kolter, and Ameet Talwalkar. Gradient descent on neural networks typically occurs at the edge of stability. In Proceedings of the 9th International Conference on Learning Representations, 2021.
|
| 203 |
+
|
| 204 |
+
Alex Damian, Tengyu Ma, and Jason D Lee. Label noise sgd provably prefers flat global minimizers. Advances in Neural Information Processing Systems, 34:27449–27461, 2021.
|
| 205 |
+
|
| 206 |
+
Terrance DeVries and Graham W Taylor. Improved regularization of convolutional neural networks with cutout. arXiv preprint arXiv:1708.04552, 2017.
|
| 207 |
+
|
| 208 |
+
Aymeric Dieuleveut, Alain Durmus, and Francis Bach. Bridging the gap between constant step size stochastic gradient descent and markov chains. Annals of Statistics, 48(3):1348–1382, 06 2020.
|
| 209 |
+
|
| 210 |
+
Laurent Dinh, Razvan Pascanu, Samy Bengio, and Yoshua Bengio. Sharp minima can generalize for deep nets. In Proceedings of the 34th International Conference on Machine Learning, pp. 1019–1028, 2017.
|
| 211 |
+
|
| 212 |
+
Pierre Foret, Ariel Kleiner, Hossein Mobahi, and Behnam Neyshabur. Sharpness-aware minimization for efficiently improving generalization. In Proceedings of the 8th International Conference on Learning Representations, 2020.
|
| 213 |
+
|
| 214 |
+
Dongyoon Han, Jiwhan Kim, and Junmo Kim. Deep pyramidal residual networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 5927–5935, 2017.
|
| 215 |
+
|
| 216 |
+
Haowei He, Gao Huang, and Yang Yuan. Asymmetric valleys: beyond sharp and flat local minima. In Advances in Neural Information Processing Systems, volume 32, pp. 2553–2564, 2019.
|
| 217 |
+
|
| 218 |
+
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.
|
| 219 |
+
|
| 220 |
+
Sepp Hochreiter and Jürgen Schmidhuber. Flat minima. Neural computation, 9(1):1–42, 1997.
|
| 221 |
+
|
| 222 |
+
Pavel Izmailov, Dmitrii Podoprikhin, Timur Garipov, Dmitry Vetrov, and Andrew Gordon Wilson. Averaging weights leads to wider optima and better generalization. In 34th Conference on Uncertainty in Artificial Intelligence, pp. 876–885, 2018.
|
| 223 |
+
|
| 224 |
+
Yiding Jiang, Behnam Neyshabur, Hossein Mobahi, Dilip Krishnan, and Samy Bengio. Fantastic generalization measures and where to find them. In Proceedings of the 8th International Conference on Learning Representations, 2020.
|
| 225 |
+
|
| 226 |
+
Jean Kaddour, Linqing Liu, Ricardo Silva, and Matt Kusner. A fair comparison of two popular flat minima optimizers: Stochastic weight averaging vs. sharpness-aware minimization. arXiv preprint arXiv:2202.00661, 2022.
|
| 227 |
+
|
| 228 |
+
Nitish Shirish Keskar and Richard Socher. Improving generalization performance by switching from adam to sgd. arXiv preprint arXiv:1712.07628, 2017.
|
| 229 |
+
|
| 230 |
+
Nitish Shirish Keskar, Jorge Nocedal, Ping Tak Peter Tang, Dheevatsa Mudigere, and Mikhail Smelyanskiy. On large-batch training for deep learning: Generalization gap and sharp minima. In Proceedings of the 5th International Conference on Learning Representations, 2017.
|
| 231 |
+
|
| 232 |
+
Bobby Kleinberg, Yuanzhi Li, and Yang Yuan. An alternative view: When does sgd escape local minima? In Proceedings of the 35th International Conference on Machine Learning, pp. 2698– 2707, 2018.
|
| 233 |
+
|
| 234 |
+
Simon Lacoste-Julien, Mark Schmidt, and Francis Bach. A simpler approach to obtaining an o (1/t) convergence rate for the projected stochastic subgradient method. arXiv preprint arXiv:1212.2002, 2012.
|
| 235 |
+
|
| 236 |
+
Aitor Lewkowycz, Yasaman Bahri, Ethan Dyer, Jascha Sohl-Dickstein, and Guy Gur-Ari. The large learning rate phase of deep learning: the catapult mechanism. arXiv preprint arXiv:2003.02218, 2020.
|
| 237 |
+
|
| 238 |
+
Liangchen Luo, Yuanhao Xiong, Yan Liu, and Xu Sun. Adaptive gradient methods with dynamic bound of learning rate. In Proceedings of the 7th International Conference on Learning Representations, 2019.
|
| 239 |
+
|
| 240 |
+
David A McAllester. Some pac-bayesian theorems. In Proceedings of the eleventh annual conference on Computational learning theory, pp. 230–234, 1998.
|
| 241 |
+
|
| 242 |
+
David A McAllester. Pac-bayesian model averaging. In Proceedings of the twelfth annual conference on Computational learning theory, pp. 164–170, 1999.
|
| 243 |
+
|
| 244 |
+
Nicole Mücke, Gergely Neu, and Lorenzo Rosasco. Beating sgd saturation with tail-averaging and minibatching. Advances in Neural Information Processing Systems, 32:12568–12577, 2019.
|
| 245 |
+
|
| 246 |
+
Arkadii S Nemirovski, Anatoli Juditsky, Guanghui Lan, and Alexander Shapiro. Robust stochastic approximation approach to stochastic programming. SIAM Journal on Optimization, 19(4):1574– 1609, 2009.
|
| 247 |
+
|
| 248 |
+
Yurii Nesterov. Introductory Lectures on Convex Optimization: A Basic Course. Kluwer Academic Publishers, 2004.
|
| 249 |
+
|
| 250 |
+
Behnam Neyshabur, Srinadh Bhojanapalli, David McAllester, and Nati Srebro. Exploring generalization in deep learning. Advances in neural information processing systems, 30, 2017.
|
| 251 |
+
|
| 252 |
+
Antonio Orvieto, Anant Raj, Hans Kersting, and Francis Bach. Explicit regularization in overparametrized models via noise injection. arXiv preprint arXiv:2206.04613, 2022.
|
| 253 |
+
|
| 254 |
+
Boris T Polyak and Anatoli B Juditsky. Acceleration of stochastic approximation by averaging. SIAM Journal on Control and Optimization, 30(4):838–855, 1992.
|
| 255 |
+
|
| 256 |
+
Alexander Rakhlin, Ohad Shamir, and Karthik Sridharan. Making gradient descent optimal for strongly convex stochastic optimization. In Proceedings of International Conference on Machine Learning 29, pp. 1571–1578, 2012.
|
| 257 |
+
|
| 258 |
+
Herbert Robbins and Sutton Monro. A stochastic approximation method. The annals of mathematical statistics, pp. 400–407, 1951.
|
| 259 |
+
|
| 260 |
+
David Ruppert. Efficient estimations from a slowly convergent Robbins-Monro process. Technical report, Cornell University Operations Research and Industrial Engineering, 1988.
|
| 261 |
+
|
| 262 |
+
Samuel L Smith, Pieter-Jan Kindermans, Chris Ying, and Quoc V Le. Don’t decay the learning rate, increase the batch size. arXiv preprint arXiv:1711.00489, 2017.
|
| 263 |
+
|
| 264 |
+
Ashia C Wilson, Rebecca Roelofs, Mitchell Stern, Nati Srebro, and Benjamin Recht. The marginal value of adaptive gradient methods in machine learning. Advances in neural information processing systems, 30, 2017.
|
| 265 |
+
|
| 266 |
+
Lu Yu, Krishnakumar Balasubramanian, Stanislav Volgushev, and Murat A Erdogdu. An analysis of constant step size sgd in the non-convex regime: Asymptotic normality and bias. arXiv preprint arXiv:2006.07904, 2020.
|
| 267 |
+
|
| 268 |
+
Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. In British Machine Vision Conference 2016. British Machine Vision Association, 2016.
|
| 269 |
+
|
| 270 |
+
Pan Zhou, Jiashi Feng, Chao Ma, Caiming Xiong, Steven Chu Hong Hoi, et al. Towards theoretically understanding why sgd generalizes better than adam in deep learning. Advances in Neural Information Processing Systems, 33:21285–21296, 2020.
|
| 271 |
+
|
| 272 |
+
# Appendix
|
| 273 |
+
|
| 274 |
+
A PROOFS
|
| 275 |
+
|
| 276 |
+
A. 1 IMPLICIT STOCHASTIC GRADIENT DESCENT
|
| 277 |
+
|
| 278 |
+
Let denote by $\varphi : \mathbb { R } ^ { d } \mathbb { R } ^ { d }$ a change of variables from $w$ to $v$ introduced in Section 3, i.e., $\boldsymbol { v } = \varphi ( \boldsymbol { w } ) = \boldsymbol { \dot { w } } - \eta \nabla f ( \boldsymbol { w } )$ .
|
| 279 |
+
|
| 280 |
+
Lemma A. Under Assumption (A1) and $\begin{array} { r } { \eta \le \frac { 1 } { 2 L } } \end{array}$ , the function $\varphi$ is injective and invertible, and its inverse $\varphi ^ { - 1 }$ defined on on $\mathrm { I m } \varphi$ is differentiable.
|
| 281 |
+
|
| 282 |
+
Proof. For $w , w ^ { \prime } \in \mathbb { R } ^ { d }$ , we suppose $\varphi ( w ) = \varphi ( w ^ { \prime } )$ . Then, it holds that
|
| 283 |
+
|
| 284 |
+
$$
|
| 285 |
+
\| w - w ^ { \prime } \| = \eta \| \nabla f ( w ) - \nabla f ( w ^ { \prime } ) \| \leq \eta L \| w - w ^ { \prime } \| \leq \frac { 1 } { 2 } \| w - w ^ { \prime } \| ,
|
| 286 |
+
$$
|
| 287 |
+
|
| 288 |
+
where we used $L$ -Lipschitz continuity of $\nabla f$ due to (A1). Therefore, we see $w = w ^ { \prime }$ and $\varphi$ is an injection. Moreover, since $\begin{array} { r } { J _ { \varphi } ( w ) = I - \eta \nabla ^ { 2 } f ( w ) \succeq ( 1 - \eta L ) I \succeq \frac { 1 } { 2 } I } \end{array}$ . Thus, $\varphi$ is invertible and $\varphi ^ { - 1 }$ , which is defined on $\mathrm { I m } \varphi$ , is differentiable because of the injectivity and the inverse map theorem. □
|
| 289 |
+
|
| 290 |
+
Using $\varphi$ , we see $\epsilon ^ { \prime } ( v ) = \epsilon ( \varphi ^ { - 1 } ( v ) )$ for $v \in \mathrm { I m } \varphi$ . Let $( \Omega , { \mathcal { F } } , P )$ be a probability space such that $\epsilon ^ { \prime } { ( v ) }$ can be represented as a measurable map $z \in \Omega \mapsto \epsilon _ { . } ^ { \prime } ( v , z )$ . Note that we use $\epsilon ^ { \prime } { ( v ) }$ and $\epsilon ^ { \prime } ( v , z )$ depending on the situation. For a function $\bar { g } : \mathbb { R } ^ { d } \to \mathbb { R } ^ { d }$ , we denote by $J _ { g } ( w )$ Jacobian of $g$ , i.e., $J _ { g } ( w ) = ( \partial g _ { i } ( w ) / \partial w _ { j } ) _ { i , j = 1 } ^ { d } .$ .
|
| 291 |
+
|
| 292 |
+
Lemma B. Under Assumption (A1) and (A2), we get for any $v \in \mathrm { I m } \varphi \subset \mathbb { R } ^ { d }$ ,
|
| 293 |
+
|
| 294 |
+
$$
|
| 295 |
+
\nabla F ( v ) = \mathbb E [ \nabla f ( v - \eta \epsilon ^ { \prime } ( v ) ) ] - \eta \int J _ { \epsilon ^ { \prime } ( \cdot , z ) } ^ { \top } ( v ) \nabla f ( v - \eta \epsilon ^ { \prime } ( v , z ) ) \mathrm { d } P ( z ) .
|
| 296 |
+
$$
|
| 297 |
+
|
| 298 |
+
Moreover, if $\begin{array} { r } { \eta \le \frac { 1 } { 2 L } } \end{array}$ , then
|
| 299 |
+
|
| 300 |
+
$$
|
| 301 |
+
\begin{array} { r } { \| \nabla F ( v ) - \mathbb { E } [ \nabla f ( v - \eta \epsilon ^ { \prime } ( v ) ) ] \| \le 2 \eta \sigma _ { 2 } \sqrt { \mathbb { E } \left[ \| \nabla f ( v - \eta \epsilon ^ { \prime } ( v ) ) \| ^ { 2 } \right] } . } \end{array}
|
| 302 |
+
$$
|
| 303 |
+
|
| 304 |
+
Proof. The first equality of the statement can be confirmed by the direct calculation as follows:
|
| 305 |
+
|
| 306 |
+
$$
|
| 307 |
+
\begin{array} { r l } { { \nabla F ( v ) = \nabla \mathbb { E } [ f ( v - \eta \epsilon ^ { \prime } ( v ) ) ] } } \\ & { = \int \nabla ( f ( v - \eta \epsilon ^ { \prime } ( v , z ) ) ) \mathrm { d } P ( z ) } \\ & { = \int ( I - \eta J _ { \epsilon ^ { \prime } ( \cdot , z ) } ^ { \top } ( v ) ) \nabla f ( v - \eta \epsilon ^ { \prime } ( v , z ) ) \mathrm { d } P ( z ) } \\ & { = \mathbb { E } [ \nabla f ( v - \eta \epsilon ^ { \prime } ( v ) ) ] - \eta \int J _ { \epsilon ^ { \prime } ( \cdot , z ) } ^ { \top } ( v ) \nabla f ( v - \eta \epsilon ^ { \prime } ( v , z ) ) \mathrm { d } P ( z ) . } \end{array}
|
| 308 |
+
$$
|
| 309 |
+
|
| 310 |
+
Next, we evaluate the last term below. By the chain rule and inverse map theory,
|
| 311 |
+
|
| 312 |
+
$$
|
| 313 |
+
J _ { \epsilon ^ { \prime } ( \cdot , z ) } ( v ) = J _ { \epsilon ( \phi ^ { - 1 } ( \cdot ) , z ) } ( v ) = J _ { \epsilon ( \cdot , z ) } ( \phi ^ { - 1 } ( v ) ) J _ { \phi ^ { - 1 } } ( v ) = J _ { \epsilon ( \cdot , z ) } ( \varphi ^ { - 1 } ( v ) ) J _ { \varphi } ^ { - 1 } ( \varphi ^ { - 1 } ( v ) ) .
|
| 314 |
+
$$
|
| 315 |
+
|
| 316 |
+
Note that from assumption for any $w \in \mathbb { R } ^ { d }$ , $\begin{array} { r } { J _ { \varphi } ( w ) = I - \eta \nabla ^ { 2 } f ( w ) \succeq ( 1 - \eta L ) I \succeq \frac { 1 } { 2 } I } \end{array}$ . Hence,
|
| 317 |
+
|
| 318 |
+
$$
|
| 319 |
+
\| J _ { \epsilon ^ { \prime } ( \cdot , z ) } ^ { \top } ( v ) \| _ { 2 } \leq \| J _ { \varphi } ^ { - 1 } ( \varphi ^ { - 1 } ( v ) ) \| _ { 2 } \| J _ { \epsilon ( \cdot , z ) } ^ { \top } ( \varphi ^ { - 1 } ( v ) ) \| _ { 2 } \leq 2 \sigma _ { 2 } .
|
| 320 |
+
$$
|
| 321 |
+
|
| 322 |
+
Finally, we get
|
| 323 |
+
|
| 324 |
+
$$
|
| 325 |
+
\begin{array} { r l } & { \left\| \int J _ { \epsilon ^ { \prime } ( \cdot , z ) } ^ { \top } ( v ) \nabla f ( v - \eta \epsilon ^ { \prime } ( v , z ) ) \mathrm { d } { \cal P } ( z ) \right\| } \\ & { \qquad \leq \sqrt { \displaystyle \int \| J _ { \epsilon ^ { \prime } ( \cdot , z ) } ^ { \top } ( v ) \| _ { 2 } ^ { 2 } \| \nabla f ( v - \eta \epsilon ^ { \prime } ( v , z ) ) \| ^ { 2 } \mathrm { d } { \cal P } ( z ) } } \\ & { \qquad \leq 2 \sigma _ { 2 } \sqrt { \displaystyle \int \| \nabla f ( v - \eta \epsilon ^ { \prime } ( v , z ) ) \| ^ { 2 } \mathrm { d } { \cal P } ( z ) } } \\ & { \qquad \leq 2 \sigma _ { 2 } \sqrt { \mathbb E \| \nabla f ( v - \eta \epsilon ^ { \prime } ( v ) ) \| ^ { 2 } ] } . } \end{array}
|
| 326 |
+
$$
|
| 327 |
+
|
| 328 |
+
This finishes the proof.
|
| 329 |
+
|
| 330 |
+
# A. 2 PROOF OF THEOREM 1
|
| 331 |
+
|
| 332 |
+
The following proposition is the restatement of the well-known convergence result to a stationary point using the coordinate $v$ .
|
| 333 |
+
|
| 334 |
+
Proposition A. Under Assumption (A1), (A2), and $\begin{array} { r } { \eta \le \frac { 1 } { 2 L } } \end{array}$ , we get
|
| 335 |
+
|
| 336 |
+
$$
|
| 337 |
+
\sum _ { t = 0 } ^ { T } \mathbb { E } \left[ \| \nabla f ( v _ { t } - \eta \epsilon _ { t + 1 } ^ { \prime } ( v _ { t } ) ) \| ^ { 2 } \right] \leq \frac { 4 } { 3 \eta } \mathbb { E } [ f ( w _ { 0 } ) ] + \frac { 2 } { 3 } \eta \sigma _ { 1 } ^ { 2 } L ( T + 2 ) .
|
| 338 |
+
$$
|
| 339 |
+
|
| 340 |
+
Proof. It is known that (A1) derives the following (Nesterov, 2004): for any $w , w ^ { \prime } \in \mathbb { R } ^ { d }$ ,
|
| 341 |
+
|
| 342 |
+
$$
|
| 343 |
+
f ( w ^ { \prime } ) \leq f ( w ) + \nabla f ( w ) ^ { \top } ( w ^ { \prime } - w ) + \frac { L } { 2 } \| w ^ { \prime } - w \| ^ { 2 } .
|
| 344 |
+
$$
|
| 345 |
+
|
| 346 |
+
Substituting the update Eq. (1) into this inequality with $w ^ { \prime } = w _ { t + 1 }$ and $w = w _ { t }$ , and taking the conditional expectation $\mathbb { E } [ \cdot | \mathcal { F } _ { t } ]$ , we get
|
| 347 |
+
|
| 348 |
+
$$
|
| 349 |
+
\begin{array} { r l } & { \mathbb { E } [ f ( w _ { t + 1 } ) | \mathcal { F } _ { t } ] \le f ( w _ { t } ) - \eta \| \nabla f ( w _ { t } ) \| ^ { 2 } + \frac { \eta ^ { 2 } L } { 2 } \mathbb { E } \left[ \| \nabla f ( w _ { t } ) + \epsilon _ { t + 1 } ( w _ { t } ) \| ^ { 2 } | \mathcal { F } _ { t } \right] } \\ & { \quad \quad \quad = f ( w _ { t } ) - \eta \left( 1 - \frac { \eta L } { 2 } \right) \| \nabla f ( w _ { t } ) \| ^ { 2 } + \frac { \eta ^ { 2 } L } { 2 } \mathbb { E } \left[ \| \epsilon _ { t + 1 } ( w _ { t } ) \| ^ { 2 } | \mathcal { F } _ { t } \right] } \\ & { \quad \quad \quad \le f ( w _ { t } ) - \frac { 3 \eta } { 4 } \| \nabla f ( w _ { t } ) \| ^ { 2 } + \frac { \eta ^ { 2 } \sigma _ { 1 } ^ { 2 } L } { 2 } . } \end{array}
|
| 350 |
+
$$
|
| 351 |
+
|
| 352 |
+
Thus, we have E[f (wt+1)] ≤ E[f (wt)] − 3η4 E[∥∇f (wt)∥2] + η2σ21L2 . By summing up this inequality, we get
|
| 353 |
+
|
| 354 |
+
$$
|
| 355 |
+
\sum _ { t = 0 } ^ { T + 1 } \mathbb { E } [ \| \nabla f ( w _ { t } ) \| ^ { 2 } ] \leq \frac { 4 } { 3 \eta } \mathbb { E } [ f ( w _ { 0 } ) ] + \frac { 2 } { 3 } \eta \sigma _ { 1 } ^ { 2 } L ( T + 2 ) ,
|
| 356 |
+
$$
|
| 357 |
+
|
| 358 |
+
where we used the nonnegativity of $f$ . By dropping the term with $t = 0$ of the sum in the left hand side and using $w _ { t + 1 } = v _ { t } - \eta \epsilon _ { t + 1 } ^ { \prime } ( v _ { t } )$ , we finally get
|
| 359 |
+
|
| 360 |
+
$$
|
| 361 |
+
\sum _ { t = 0 } ^ { T } \mathbb { E } [ \| \nabla f ( v _ { t } - \eta \epsilon _ { t + 1 } ^ { \prime } ( v _ { t } ) ) \| ^ { 2 } ] \leq \frac { 4 } { 3 \eta } \mathbb { E } [ f ( w _ { 0 } ) ] + \frac { 2 } { 3 } \eta \sigma _ { 1 } ^ { 2 } L ( T + 2 ) .
|
| 362 |
+
$$
|
| 363 |
+
|
| 364 |
+
Using the above results, we prove Theorem 1, which is restated below.
|
| 365 |
+
|
| 366 |
+
Theorem A. Under Assumption (A1), (A2), and (A3), run the stochastic gradient descent with $T$ -iterations with the step size $\begin{array} { r } { \eta \le \frac { 1 } { 2 L } } \end{array}$ , then the implicit SGD satisfies the following inequality:
|
| 367 |
+
|
| 368 |
+
$$
|
| 369 |
+
\begin{array} { r l } & { \displaystyle \frac { 1 } { T + 1 } \sum _ { t = 0 } ^ { T } \mathbb { E } [ \| v _ { t } - v _ { * } \| ^ { 2 } ] \leq \frac { 1 } { c \eta ( T + 1 ) } \mathbb { E } [ \| v _ { 0 } - v _ { * } \| ^ { 2 } ] + \frac { 8 } { 3 c \left( T + 1 \right) } \left( 1 + \frac { 2 \eta \sigma _ { 2 } ^ { 2 } } { c } \right) \mathbb { E } [ f ( w _ { 0 } ) ] } \\ & { \quad \quad \quad \quad + \frac { 2 \eta \sigma _ { 1 } ^ { 2 } } { c } + \frac { 8 \eta ^ { 2 } \sigma _ { 1 } ^ { 2 } L } { 3 c } \left( 1 + \frac { 2 \eta \sigma _ { 2 } ^ { 2 } } { c } \right) } \\ & { \quad \quad \quad \quad = O \left( T ^ { - 1 } \right) + \frac { 2 \eta \sigma _ { 1 } ^ { 2 } } { c } + \frac { 8 \eta ^ { 2 } \sigma _ { 1 } ^ { 2 } L } { 3 c } \left( 1 + \frac { 2 \eta \sigma _ { 2 } ^ { 2 } } { c } \right) . } \end{array}
|
| 370 |
+
$$
|
| 371 |
+
|
| 372 |
+
Proof of Theorem $A$ . To evaluate $\lVert \boldsymbol { v } _ { t + 1 } - \boldsymbol { v } _ { * } \rVert ^ { 2 }$ for the implicit SGD (2), we first give several bounds as follows. By Assumption (A3), Young’s inequality, and Lemma B, we get
|
| 373 |
+
|
| 374 |
+
$$
|
| 375 |
+
\begin{array} { r l } & { - 2 ( v _ { t } - v _ { * } ) ^ { \top } \mathbb { E } [ \nabla f ( v _ { t } - \eta \epsilon _ { t + 1 } ^ { \prime } ( v _ { t } ) ) \vert \mathcal { F } _ { t } ] } \\ & { = - 2 ( v _ { t } - v _ { * } ) ^ { \top } \nabla F ( v _ { t } ) + 2 ( v _ { t } - v _ { * } ) ^ { \top } ( \nabla F ( v _ { t } ) - \mathbb { E } [ \nabla f ( v _ { t } - \eta \epsilon _ { t + 1 } ^ { \prime } ( v _ { t } ) ) \vert \mathcal { F } _ { t } ] ) } \\ & { \leq - 2 c \| v _ { t } - v _ { * } \| ^ { 2 } + c \| v _ { t } - v _ { * } \| ^ { 2 } + \displaystyle \frac { 1 } { c } \| \nabla F ( v _ { t } ) - \mathbb { E } [ \nabla f ( v _ { t } - \eta \epsilon _ { t + 1 } ^ { \prime } ( v _ { t } ) ) \vert \mathcal { F } _ { t } ] \| ^ { 2 } } \\ & { \leq - c \| v _ { t } - v _ { * } \| ^ { 2 } + \displaystyle \frac { 4 \eta ^ { 2 } \sigma _ { 2 } ^ { 2 } } { c } \mathbb { E } \left[ \| \nabla f ( v _ { t } - \eta \epsilon _ { t + 1 } ^ { \prime } ( v _ { t } ) ) \| ^ { 2 } \vert \mathcal { F } _ { t } \right] . } \end{array}
|
| 376 |
+
$$
|
| 377 |
+
|
| 378 |
+
By Assumption (A2) and Young’s inequality again, we get
|
| 379 |
+
|
| 380 |
+
$$
|
| 381 |
+
\begin{array} { r l } & { \mathbb { E } [ \| \epsilon _ { t + 1 } ^ { \prime } ( v _ { t } ) + \nabla f ( v _ { t } - \eta \epsilon _ { t + 1 } ^ { \prime } ( v _ { t } ) ) \| ^ { 2 } | \mathcal { F } _ { t } ] } \\ & { \leq 2 \mathbb { E } [ \| \epsilon _ { t + 1 } ^ { \prime } ( v _ { t } ) \| ^ { 2 } | \mathcal { F } _ { t } ] + 2 \mathbb { E } [ \| \nabla f ( v _ { t } - \eta \epsilon _ { t + 1 } ^ { \prime } ( v _ { t } ) ) \| ^ { 2 } | \mathcal { F } _ { t } ] } \\ & { \leq 2 \sigma _ { 1 } ^ { 2 } + 2 \mathbb { E } [ \| \nabla f ( v _ { t } - \eta \epsilon _ { t + 1 } ^ { \prime } ( v _ { t } ) ) \| ^ { 2 } | \mathcal { F } _ { t } ] . } \end{array}
|
| 382 |
+
$$
|
| 383 |
+
|
| 384 |
+
Combining the above two inequalities, we get
|
| 385 |
+
|
| 386 |
+
$$
|
| 387 |
+
\begin{array} { r l } & { \mathbb { E } [ \| v _ { t + 1 } - v _ { * } \| ^ { 2 } | \mathcal { F } _ { t } ] = \mathbb { E } [ \| v _ { t } - \eta \epsilon _ { t + 1 } ^ { \prime } ( v _ { t } ) - \eta \nabla f ( v _ { t } - \eta \epsilon _ { t + 1 } ^ { \prime } ( v _ { t } ) ) - v _ { * } \| ^ { 2 } | \mathcal { F } _ { t } ] } \\ & { \quad \quad \quad \quad \quad \quad \quad = \| v _ { t } - v _ { * } \| ^ { 2 } - 2 \eta ( v _ { t } - v _ { * } ) ^ { \top } \mathbb { E } [ \nabla f ( v _ { t } - \eta \epsilon _ { t + 1 } ^ { \prime } ( v _ { t } ) ) | \mathcal { F } _ { t } ] } \\ & { \quad \quad \quad \quad \quad + \eta ^ { 2 } \mathbb { E } [ \| \epsilon _ { t + 1 } ^ { \prime } ( v _ { t } ) + \nabla f ( v _ { t } - \eta \epsilon _ { t + 1 } ^ { \prime } ( v _ { t } ) ) \| ^ { 2 } | \mathcal { F } _ { t } ] } \\ & { \quad \quad \quad \quad \quad \leq ( 1 - c \eta ) \| v _ { t } - v _ { * } \| ^ { 2 } + 2 \eta ^ { 2 } \sigma _ { 1 } ^ { 2 } } \\ & { \quad \quad \quad \quad \quad + 2 \eta ^ { 2 } \left( 1 + \frac { 2 \eta \sigma _ { 2 } ^ { 2 } } { c } \right) \mathbb { E } \left[ \| \nabla f ( v _ { t } - \eta \epsilon _ { t + 1 } ^ { \prime } ( v _ { t } ) ) \| ^ { 2 } | \mathcal { F } _ { t } \right] . } \end{array}
|
| 388 |
+
$$
|
| 389 |
+
|
| 390 |
+
Taking the expectation regarding all histories and summing up over $t = 0 , 1 , \ldots , T$ , we get
|
| 391 |
+
|
| 392 |
+
$$
|
| 393 |
+
\begin{array} { r l } { \displaystyle c \eta \sum _ { t = 0 } ^ { T } \mathbb { E } [ \| v _ { t } - v _ { * } \| ^ { 2 } ] \leq \mathbb { E } [ \| v _ { 0 } - v _ { * } \| ^ { 2 } ] - \mathbb { E } [ \| v _ { T + 1 } - v _ { * } \| ^ { 2 } ] + 2 \eta ^ { 2 } \sigma _ { 1 } ^ { 2 } ( T + 1 ) } & { } \\ { \displaystyle + 2 \eta ^ { 2 } \left( 1 + \frac { 2 \eta \sigma _ { 2 } ^ { 2 } } { c } \right) \sum _ { t = 0 } ^ { T } \mathbb { E } \left[ \| \nabla f ( v _ { t } - \eta \epsilon _ { t + 1 } ^ { \prime } ( v _ { t } ) ) \| ^ { 2 } \right] } & { } \\ { \leq \mathbb { E } [ \| v _ { 0 } - v _ { * } \| ^ { 2 } ] - \mathbb { E } [ \| v _ { T + 1 } - v _ { * } \| ^ { 2 } ] + 2 \eta ^ { 2 } \sigma _ { 1 } ^ { 2 } ( T + 1 ) } & { } \\ { \displaystyle + \frac { 8 } { 3 } \eta \left( 1 + \frac { 2 \eta \sigma _ { 2 } ^ { 2 } } { c } \right) \mathbb { E } [ f ( w _ { 0 } ) ] + \frac { 4 } { 3 } \eta ^ { 3 } \left( 1 + \frac { 2 \eta \sigma _ { 2 } ^ { 2 } } { c } \right) \sigma _ { 1 } ^ { 2 } L ( T + 2 ) , } \end{array}
|
| 394 |
+
$$
|
| 395 |
+
|
| 396 |
+
where we used Proposition A. Therefore, we conclude
|
| 397 |
+
|
| 398 |
+
$$
|
| 399 |
+
\begin{array} { r l } & { \displaystyle \frac { 1 } { T + 1 } \sum _ { t = 0 } ^ { T } \mathbb { E } [ \| v _ { t } - v _ { * } \| ^ { 2 } ] \leq \frac { 1 } { c \eta ( T + 1 ) } \mathbb { E } [ \| v _ { 0 } - v _ { * } \| ^ { 2 } ] + \frac { 8 } { 3 c ( T + 1 ) } \left( 1 + \frac { 2 \eta \sigma _ { 2 } ^ { 2 } } { c } \right) \mathbb { E } [ f ( w _ { 0 } ) ] } \\ & { \quad \quad \quad \quad \quad + \frac { 2 \eta \sigma _ { 1 } ^ { 2 } } { c } + \frac { 8 \eta ^ { 2 } } { 3 c } \left( 1 + \frac { 2 \eta \sigma _ { 2 } ^ { 2 } } { c } \right) \sigma _ { 1 } ^ { 2 } L } \\ & { \quad \quad \quad \quad = O \left( T ^ { - 1 } \right) + \frac { 2 \eta \sigma _ { 1 } ^ { 2 } } { c } + \frac { 8 \eta ^ { 2 } } { 3 c } \left( 1 + \frac { 2 \eta \sigma _ { 2 } ^ { 2 } } { c } \right) \sigma _ { 1 } ^ { 2 } L . } \end{array}
|
| 400 |
+
$$
|
| 401 |
+
|
| 402 |
+
# A. 3 PROOF OF THEOREM 2
|
| 403 |
+
|
| 404 |
+
We give several statements used to prove Theorem 2.
|
| 405 |
+
|
| 406 |
+
Lemma C. Under the same assumptions as in Theorem A, run the stochastic gradient descent with $T$ -iterations with the step size $\begin{array} { r } { \eta \le \frac { 1 } { 2 L } } \end{array}$ , then the implicit SGD satisfies the following inequality:
|
| 407 |
+
|
| 408 |
+
$$
|
| 409 |
+
\begin{array} { r l } & { \left. \mathbb { E } \left[ \displaystyle \sum _ { t = 0 } ^ { T } \nabla f ( v _ { t } - \eta \ell _ { t + 1 } ^ { \prime } ( v _ { t } ) ) \right] \right. \leq \frac { 1 } { \eta } O ( 1 ) + \frac { 1 } { \eta } \sqrt { ( T + 1 ) \left( \frac { 4 \eta \sigma _ { 1 } ^ { 2 } } { c } + \frac { 1 6 \eta ^ { 2 } \sigma _ { 1 } ^ { 2 } L } { 3 c } \left( 1 + \frac { 2 \eta \sigma _ { 2 } ^ { 2 } } { c } \right) \right) } , } \\ & { \mathbb { E } \left[ \left. \displaystyle \sum _ { t = 0 } ^ { T } \left( \nabla F ( v _ { t } ) - \mathbb { E } \left[ \nabla f ( v _ { t } - \eta \ell _ { t + 1 } ^ { \prime } ( v _ { t } ) ) | \mathcal { F } _ { t } \right] \right) \right. \right] \leq 2 \sigma _ { 2 } \eta ^ { \frac { 1 } { 2 } } O ( T ^ { \frac { 1 } { 2 } } ) + 2 \sigma _ { 1 } \sigma _ { 2 } \eta ^ { \frac { 3 } { 2 } } \sqrt { \frac { 2 } { 3 } L ( T + 1 ) ( T + \frac { 2 \eta \sigma _ { 1 } ^ { 2 } } { c } + \frac { 1 } { \eta } ) } . } \end{array}
|
| 410 |
+
$$
|
| 411 |
+
|
| 412 |
+
Proof of Lemma $C$ . By the simple calculation, we get
|
| 413 |
+
|
| 414 |
+
$$
|
| 415 |
+
\begin{array} { r l } { | { \bf \zeta } | \displaystyle \sum _ { i = 0 } ^ { \infty } \bf { \cal Y } _ { ( i ) } ^ { ( j ) } \{ \alpha _ { 1 } - w _ { i } ^ { \prime } ( s _ { i } ) , \alpha _ { 2 } - w _ { i } ^ { \prime } ( s _ { i } ) \} | } & { = | { \bf \zeta } | \displaystyle \sum _ { i = 0 } ^ { \infty } \{ { \bf Y } _ { ( i ) } ^ { ( j ) } ( { \bf Y } _ { ( i ) } ^ { ( j ) } ( { \bf z } - w _ { i + 1 } ^ { \prime } ( s _ { i } ) + \epsilon _ { i + 1 } ^ { \prime } ( s _ { i } ) ) ) \} | } \\ & { = \frac { 1 } { \pi } | { \bf Z } | \displaystyle \| s _ { i } - w _ { i + 1 } ^ { \prime } ( s _ { i } ) , } \\ & { = - \frac { 1 } { \pi } { \pi } { \bf E } \| { \bf w } _ { i } - w _ { i + 1 } \| } \\ & { = { \bf Y } _ { i } \{ { \bf \bar { k } } _ { i } } \{ { \bf \bar { k } } _ { i } , { \bf w } _ { i - 1 } \} ^ { ( j ) } \\ & { \leq \frac { 1 } { \pi } \sqrt { 2 \pi [ { \bf k } _ { i } - w _ { i - 1 } ] ^ { 2 } + | w _ { i + 2 } - w _ { i } | ^ { 2 } } } \\ & { \leq \frac { 1 } { \pi } \sqrt { 2 \pi [ { \bf k } _ { i } - w _ { i - 1 } ] ^ { 2 } } } \\ & { \leq \frac { 1 } { \pi } \sqrt { \alpha _ { 1 } } \{ { \bf Y } _ { ( i ) } ^ { ( j ) } - { \bf X } _ { ( i ) } ^ { ( j ) } ( { \bf Y } _ { ( i ) } ^ { ( j ) } - { \bf H } _ { ( i ) } ^ { ( j ) } ( 1 + \frac { 2 { w _ { i } ^ { 2 } } s _ { i } ^ { 2 } } { 4 \pi } ( \frac { 1 - \beta _ { 0 } s _ { i } ^ { 2 } } { s } ) ) \} } \\ & \leq \frac { 1 } { \pi } \sqrt { \alpha _ { 1 } } \{ { \bf Y } _ { ( i ) } ^ { ( j ) } + { \bf Y } _ { ( i ) } ^ { ( j ) } - { \bf H } _ { ( i ) } ^ ( j ) \end{array}
|
| 416 |
+
$$
|
| 417 |
+
|
| 418 |
+
where we used Theorem A.
|
| 419 |
+
|
| 420 |
+
Next, we show the second inequality by using Lemma $\mathbf { B }$ as follows:
|
| 421 |
+
|
| 422 |
+
$$
|
| 423 |
+
\begin{array} { r l } { \left. { \sum \left[ \left\| \sum _ { j = 0 } ^ { \infty } \left( \nabla F ( x _ { j } ) - \mathbf { E } \left[ \nabla f ( x _ { j } - \eta _ { j + 1 } ^ { \varepsilon } ( x _ { j } ) ) \right] \mathcal { F } _ { j } \right) \right\| \right] } } \\ & { \le \mathbb { E } \left[ \frac { \displaystyle \sum _ { j = 0 } ^ { T } \left\| \nabla F ( x _ { j } ) - \mathbf { E } \left[ \nabla f ( x _ { j } - \eta _ { j + 1 } ^ { \varepsilon } ( x _ { j } ) ) \right] \mathcal { F } _ { j } \right\| } { \displaystyle \sum _ { j = 0 } ^ { T } \left\| \nabla F ( x _ { j } - \eta _ { j + 1 } ^ { \varepsilon } ( x _ { j } ) ) \right\| ^ { 2 } \left| \mathcal { F } _ { j } \right| } \right] } \\ & { \le \mathbb { E } \left[ \frac { \displaystyle \sum _ { j = 0 } ^ { T } 2 \gamma \varepsilon _ { j } \gamma \overline { { S } } \left[ \left| \nabla f ( x _ { j } - \eta _ { j + 1 } ^ { \varepsilon } ( x _ { j + 1 } ) ) \right| \mathcal { F } _ { j } \right| } { \displaystyle \sum _ { j = 0 } ^ { T } \sqrt { \varepsilon _ { j } \gamma } \left[ \nabla F ( x _ { j } - \eta _ { j } ^ { \varepsilon } ( x _ { j } ) ) \right] \left| \mathcal { F } _ { j } \right| } \right] } \\ & \right]{ \le 2 \eta _ { j } \eta _ { j } \frac { \gamma } { \varepsilon _ { j } } \sqrt { \varepsilon _ { j } \gamma } \frac { \gamma } { \varepsilon _ { j } } \left[ \nabla F ( x _ { j } - \eta _ { j } ^ { \varepsilon } ( x _ { j } ) ) \right] } \\ & { \le 2 \eta _ { j } \eta _ { j } \sqrt { ( 1 + 1 ) \displaystyle \sum _ { j = 0 } ^ { T } \left[ \left| \nabla f ( x _ { j } - \eta _ { j + 1 } ^ { \varepsilon } ( x _ { j } ) ) \right| ^ { 2 } \right] } } \\ & { \le 2 \eta _ { j } \eta _ { j } ^ { \varepsilon } \sqrt { \frac { \gamma } { \varepsilon _ { j } } \left( \left| \nabla f ( x _ { j } - \eta _ { j } ^ { \varepsilon } ( x _ { j } ) ) \right| ^ { 2 } \right] } } \end{array}
|
| 424 |
+
$$
|
| 425 |
+
|
| 426 |
+
$$
|
| 427 |
+
\leq 2 \sigma _ { 2 } \eta ^ { { \frac { 1 } { 2 } } } O ( T ^ { \frac { 1 } { 2 } } ) + 2 \sigma _ { 1 } \sigma _ { 2 } \eta ^ { { \frac { 3 } { 2 } } } \sqrt { { \frac { 2 } { 3 } } L ( T + 1 ) ( T + 2 ) } .
|
| 428 |
+
$$
|
| 429 |
+
|
| 430 |
+
Proposition B. Under the same assumptions as in Theorem A, run the stochastic gradient descent with $\cdot$ -iterations with the step size $\begin{array} { r } { \eta \le \frac { 1 } { 2 L } } \end{array}$ , then the implicit SGD satisfies the following inequality:
|
| 431 |
+
|
| 432 |
+
$$
|
| 433 |
+
\frac { 1 } { T + 1 } \left\| \mathbb { E } \left[ \sum _ { t = 0 } ^ { T } \nabla F ( v _ { t } ) \right] \right\| \leq O ( T ^ { - \frac { 1 } { 2 } } ) + \frac { 4 } { \sqrt { 3 } } \sigma _ { 1 } \sigma _ { 2 } \eta ^ { \frac { 3 } { 2 } } L ^ { \frac { 1 } { 2 } } .
|
| 434 |
+
$$
|
| 435 |
+
|
| 436 |
+
Proof of Proposition $B$ . Using Lemma C, we get
|
| 437 |
+
|
| 438 |
+
$$
|
| 439 |
+
\begin{array} { r l } { \underset { T + 1 } { \overset { 1 } { \prod } } } & { \tau [ \overset { 2 } { \underset { \mathrm { E q } } { \overset { . . } { \prod } } } \nabla F ( t _ { \mathrm { E q } } ) ] \leq \underset { T + 1 } { \overset { 1 } { \prod } } \mathbf { E } [ \underset { \mathrm { E q } } { \overset { . . } { \prod } } ( \nabla F ( s _ { \mathrm { E q } } ) , ~ \Psi _ { \mathrm { E q } } ^ { 2 } ( s _ { \mathrm { H } } ) , ~ \Psi _ { \mathrm { E q } } ^ { 2 } ( s _ { \mathrm { H } } ) ) ] } \\ & { + \underset { T + 1 } { \overset { 1 } { \prod } } \mathbf { E } [ \underset { \mathrm { E q } } { \overset { . . } { \prod } } [ \nabla f ( s _ { \mathrm { E q } } - \Psi _ { \mathrm { E q } } ^ { 2 } , \{ \bar { \mathbf { H } } ( s _ { \mathrm { H } } ) , \} \mathcal { F } _ { \mathrm { E q } } ^ { . } ) ] } \\ & { \leq \underset { T + 1 } { \overset { 1 } { \prod } } \mathbf { E } [ \underset { \mathrm { E q } } { \overset { . . } { \prod } } ( \nabla F ( s _ { \mathrm { H } } ) , ~ \Psi _ { \mathrm { E q } } ^ { - } ( \{ \bar { \mathbf { H } } ( s _ { \mathrm { H } } ) , \} \Psi _ { \mathrm { E q } } ^ { . } ) ) ] } \\ & { + \underset { T + 1 } { \overset { 1 } { \prod } } \mathbf { E } [ \underset { \mathrm { E q } } { \overset { . . } { \prod } } \nabla f ( s _ { \mathrm { H } } - \Psi _ { \mathrm { E q } } ^ { + } , \{ \bar { \mathbf { H } } ( s _ { \mathrm { H } } ) \} ) ] } \\ & { \leq 2 \underset { \mathrm { E q } } { \overset { . } { \prod } } \partial ( T - \underset { \mathrm { E q } } { \overset { . } { \prod } } + 2 \underset { \mathrm { E q } } { \overset { . } { \prod } } \gamma _ { \mathrm { E q } } ^ { 2 } \underset { T + 1 } { \overset { . } { \prod } } 2 } \\ & + \frac { 1 } { \eta } \partial ( \omega ^ { 1 } - 1 _ { \mathrm { E q } } ^ { - } ) \frac { 1 } { \eta } \frac ( 4 \ \end{array}
|
| 440 |
+
$$
|
| 441 |
+
|
| 442 |
+
We here prove Theorem 2 which is restated below.
|
| 443 |
+
|
| 444 |
+
Theorem B. Under Assumption (A1)–(A5), run the averaged SGD for $T$ -iterations with the step size $\cdot$ , then the average $\overline { { v } } _ { T }$ satisfies the following inequality:
|
| 445 |
+
|
| 446 |
+
$$
|
| 447 |
+
\left\| \mathbb { E } [ \overline { { v } } _ { T } ] - v _ { * } \right\| \leq { \cal O } \left( T ^ { - \frac { 1 } { 2 } } \right) + \frac { 4 \sigma _ { 1 } \sigma _ { 2 } \eta ^ { \frac { 3 } { 2 } } L ^ { \frac { 1 } { 2 } } } { \sqrt { 3 } \mu } + \frac { 2 \eta \sigma _ { 1 } ^ { 2 } M } { c \mu } + \frac { 8 \eta ^ { 2 } \sigma _ { 1 } ^ { 2 } L M } { 3 c \mu } \left( 1 + \frac { 2 \eta \sigma _ { 2 } ^ { 2 } } { c } \right) .
|
| 448 |
+
$$
|
| 449 |
+
|
| 450 |
+
Proof. We define $R ( v ) = \nabla F ( v ) - \nabla ^ { 2 } F ( v _ { * } ) ( v - v _ { * } )$ . Then, by (A4), we see $\| R ( v ) \| \leq M \| v - v _ { * } \| ^ { 2 }$ . By taking average of $R ( v _ { t } )$ over $t \in \{ 0 , 1 , \ldots , T \}$ and rearranging terms, we get
|
| 451 |
+
|
| 452 |
+
$$
|
| 453 |
+
\nabla ^ { 2 } F ( v _ { * } ) ( \overline { { v } } _ { T } - v _ { * } ) = \frac { 1 } { T + 1 } \sum _ { t = 0 } ^ { T } \nabla F ( v _ { t } ) - \frac { 1 } { T + 1 } \sum _ { t = 0 } ^ { T } R ( v _ { t } ) .
|
| 454 |
+
$$
|
| 455 |
+
|
| 456 |
+
Therefore, we get
|
| 457 |
+
|
| 458 |
+
$$
|
| 459 |
+
\begin{array} { r l } & { \mu \| \mathbb { E } [ \overline { { v } } _ { T } ] - v _ { * } \| \leq \| \nabla ^ { 2 } F ( v _ { * } ) ( \mathbb { E } [ \overline { { v } } _ { T } ] - v _ { * } ) \| } \\ & { \qquad \leq \frac { 1 } { T + 1 } \left\| \mathbb { E } \left[ \displaystyle \sum _ { t = 0 } ^ { T } \nabla F ( v _ { t } ) \right] \right\| + \frac { 1 } { T + 1 } \left\| \mathbb { E } \left[ \displaystyle \sum _ { t = 0 } ^ { T } R ( v _ { t } ) \right] \right\| } \\ & { \qquad \leq \frac { 1 } { T + 1 } \left\| \mathbb { E } \left[ \displaystyle \sum _ { t = 0 } ^ { T } \nabla F ( v _ { t } ) \right] \right\| + \frac { M } { T + 1 } \mathbb { E } \left[ \displaystyle \sum _ { t = 0 } ^ { T } \| v _ { t } - v _ { * } \| ^ { 2 } \right] . } \end{array}
|
| 460 |
+
$$
|
| 461 |
+
|
| 462 |
+
The latter and former terms can be bounded by Theorem A and Proposition B. Thus, we finally get
|
| 463 |
+
|
| 464 |
+
$$
|
| 465 |
+
\mu \| \mathbb { E } [ \overline { { v } } _ { T } ] - v _ { * } \| \leq O \left( T ^ { - \frac { 1 } { 2 } } \right) + \frac { 4 \sigma _ { 1 } \sigma _ { 2 } \eta ^ { \frac { 3 } { 2 } } L ^ { \frac { 1 } { 2 } } } { \sqrt { 3 } } + \frac { 2 \eta \sigma _ { 1 } ^ { 2 } M } { c } + \frac { 8 \eta ^ { 2 } \sigma _ { 1 } ^ { 2 } L M } { 3 c } \left( 1 + \frac { 2 \eta \sigma _ { 2 } ^ { 2 } } { c } \right) .
|
| 466 |
+
$$
|
| 467 |
+
|
| 468 |
+
# B ADDITIONAL EXPERIMENTS
|
| 469 |
+
|
| 470 |
+
Table 3: Comparison of test classification accuracies on CIFAR10 dataset. All methods adopt the multi-step strategy for the step size schedule.
|
| 471 |
+
|
| 472 |
+
<table><tr><td colspan="3">CIFAR10</td></tr><tr><td></td><td>m</td><td>ResNet-50 WRN-28-10</td></tr><tr><td>SGD</td><td>s</td><td>95.95 (0.10) 96.85 (0.16)</td></tr><tr><td rowspan="3">Averaged SGD</td><td>S</td><td>96.58 (0.14) 97.24 (0.07)</td></tr><tr><td>m</td><td>96.89 (0.05) 97.44 (0.04)</td></tr><tr><td>l</td><td>96.27 (0.16) 97.05 (0.09)</td></tr></table>
|
| 473 |
+
|
| 474 |
+
We run SGD and averaged SGD on CIFAR10 dataset with the step size strategy $\mathbf { \nabla } \cdot \mathbf { \vec { \tau } } _ { l } \cdot \mathbf { \vec { \tau } } _ { \mathrm { ~ \tiny ~ \vec ~ { ~ } ~ } }$ under the same settings as in Section 5. Table 3 lists the results including this case. We observe that the large step size $\mathbf { \nabla } \cdot \mathbf { \vec { \tau } } _ { l } \cdot \mathbf { \vec { \tau } } _ { \mathbf { \vec { \tau } } }$ does not work so well on CIFAR10 dataset compared to other schedules. We hypothesize this is because CIFAR10 is not so difficult dataset and does not require stronger bias induced by a larger step size.
|
| 475 |
+
|
| 476 |
+
We also validate the cosine annealing strategy for the step size, which is frequently used due to its excellent performance. We used the symbols $^ { \ast } s ^ { \prime } , \ m ^ { \prime }$ , and $\mathbf { \nabla } \cdot \mathbf { \vec { \tau } } _ { l } \cdot \mathbf { \vec { \tau } } _ { \mathrm { ~ \tiny ~ \vec ~ { ~ } ~ } }$ for the cosine annealing depending on the last step sizes which are set to 0, 0.004, and 0.02, respectively. The parameter averaging for averaged SGD is taken over the last quarter of the training. From the table, we observe the usefulness of parameter averaging for cosine annealing schedule as well.
|
| 477 |
+
|
| 478 |
+
Table 4: Comparison of test classification accuracies on CIFAR100 and CIFAR10 datasets. All methods adopt cosine annealing for the step-size schedule.
|
| 479 |
+
|
| 480 |
+
<table><tr><td></td><td colspan="5">CIFAR100</td><td colspan="3">CIFAR10</td></tr><tr><td></td><td>m</td><td>ResNet-50</td><td>WRN-28-10</td><td>Pyramid</td><td>n</td><td>ResNet-50</td><td>WRN-28-10</td><td>Pyramid</td></tr><tr><td>SGD</td><td>S</td><td>82.26</td><td>82.68</td><td>82.97</td><td>S</td><td>96.58</td><td>97.00</td><td>96.66</td></tr><tr><td>Averaged</td><td>s</td><td>83.89</td><td>84.28</td><td>85.14</td><td>S</td><td>97.01</td><td>97.28</td><td>97.07</td></tr><tr><td>SGD</td><td>l</td><td>83.21</td><td>84.49</td><td>85.47</td><td>m</td><td>96.86</td><td>97.51</td><td>97.32</td></tr><tr><td>SAM</td><td>S</td><td>83.35</td><td>84.64</td><td>86.24</td><td>s</td><td>96.40</td><td>96.89</td><td>97.61</td></tr><tr><td>Averaged</td><td>S</td><td>83.18</td><td>84.94</td><td>86.79</td><td>S</td><td>96.56</td><td>97.14</td><td>97.55</td></tr><tr><td>SAM</td><td>l</td><td>83.58</td><td>85.26</td><td>86.84</td><td>m</td><td>96.51</td><td>97.19</td><td>97.48</td></tr></table>
|
| 481 |
+
|
| 482 |
+
Finally, we run SGD, SGD with a large step size, and averaged SGD to train the standard convolutional neural network on Fashion MNIST dataset to confirm how efficiently sharpness and classification accuracy can be optimized by each method. We note the large step size used for SGD is the same as that for averaged SGD. We plot the trace of Hessian $\nabla ^ { 2 } f ( \boldsymbol { w } )$ and test loss functions in Figure 5. From this figure, we observe that the averaged SGD converges to a flatter region and achieves the highest classification accuracy on the test dataset as expected in our theory.
|
| 483 |
+
|
| 484 |
+

|
| 485 |
+
Figure 5: The figure depicts the curve of the trace of Hessian $\nabla ^ { 2 } f ( w )$ and test loss functions achieved by SGD, SGD with large step size, and averaged SGD. Each algorithm is run to train the standard convolutional neural network on Fashion MNIST dataset.
|
| 486 |
+
|
| 487 |
+

|
| 488 |
+
Figure 6: The left figure plots the mollifier $g _ { \delta }$ (blue) and smoothed mollifier $G _ { \delta }$ (orange), and the right figure plots the objective $f$ (blue) and smoothed objective $F$ (orange). The constants $\delta = 0 . 1 , r = 2 . 0$ , and $p = 1 . 0$
|
| 489 |
+
|
| 490 |
+
# C MOTIVATING EXAMPLE
|
| 491 |
+
|
| 492 |
+
# C. 1 PROBLEM SETUP
|
| 493 |
+
|
| 494 |
+
In this section, we present a motivating example that verifies the convergence to a flat minimum and a certain separation between SGD and averaged SGD. We consider a one-dimensional objective function $f : \mathbb { R } \to \mathbb { R }$ defined below: for $p , \delta > 0$ ,
|
| 495 |
+
|
| 496 |
+
$$
|
| 497 |
+
f ( w ) = \frac { 1 } { 2 } ( w - p ) ^ { 2 } + g _ { \delta } ( w ) ,
|
| 498 |
+
$$
|
| 499 |
+
|
| 500 |
+
where $g _ { \delta } : \mathbb { R } \mathbb { R }$ is a scaled mollifier:
|
| 501 |
+
|
| 502 |
+
$$
|
| 503 |
+
\begin{array} { r } { g _ { \delta } ( w ) = \left\{ \begin{array} { l l } { - p \delta \exp \left( 1 - \frac { 1 } { 1 - \left( \frac { w } { \delta } \right) ^ { 2 } } \right) } & { ( | w | < \delta ) , } \\ { 0 } & { ( | w | \geq \delta ) . } \end{array} \right. } \end{array}
|
| 504 |
+
$$
|
| 505 |
+
|
| 506 |
+
$g _ { \delta } ( w ) = \delta g _ { 1 } ( w / \delta )$ is a scaling of the well-known mollifier of $g _ { 1 }$ which is an infinitely differentiable function with a compact support. That is, $g _ { \delta }$ is a smooth function whose support is $[ - \delta , \delta ]$ . Because of the coefficient $p$ of $g _ { \delta }$ , the function $f ( w )$ has a local minimum in $[ - \delta , \delta ]$ , which can be the global minimum. See Figure 6 (right).
|
| 507 |
+
|
| 508 |
+
ximum values of the first and second derivatives of by $\frac { g _ { 1 } } { p }$ are bounded. Thus, we define constants $C _ { 1 } , C _ { 2 }$
|
| 509 |
+
|
| 510 |
+
$$
|
| 511 |
+
C _ { 1 } = \operatorname* { m a x } \left\{ 1 , \frac { 1 } { p } \operatorname* { m a x } _ { w } | g _ { 1 } ^ { \prime } ( w ) | \right\} , \ C _ { 2 } = \frac { 1 } { p } \operatorname* { m a x } _ { w } | g _ { 1 } ^ { \prime \prime } ( w ) | .
|
| 512 |
+
$$
|
| 513 |
+
|
| 514 |
+
Since $\begin{array} { r } { g _ { \delta } ^ { \prime \prime } ( w ) = \frac { 1 } { \delta } g _ { 1 } ^ { \prime \prime } ( w / \delta ) } \end{array}$ , we see the second derivative of $g _ { \delta }$ is bounded by $C _ { 2 } p \delta ^ { - 1 }$ . Hence, Lipschitz smoothness (boundedness of Hessian) $L$ of $f$ is $1 + C _ { 2 } p \delta ^ { - 1 }$ .
|
| 515 |
+
|
| 516 |
+
Next, we consider the uniform noise on the interval $\left[ - r , r \right]$ for $r > 0$ , i.e., $\epsilon \sim U [ - r , r ]$ and suppose $\epsilon ( w , z ) = \epsilon ( z ) ( = \epsilon ^ { \prime } ( v , z ) )$ where $\Omega \ni z \mapsto \epsilon ( w , z )$ is an explicit representation of the random noise. In other words, noise distribution does not change in $w$ . In this case, we see $\sigma _ { 1 } ^ { 2 } = \mathbb { E } [ \epsilon ^ { 2 } ] \le r ^ { 2 }$ and $\sigma _ { 2 } = 0$ . The smoothed objective $F$ with the noise $\epsilon ^ { \prime }$ and step-size $\eta$ is
|
| 517 |
+
|
| 518 |
+
$$
|
| 519 |
+
\begin{array} { l } { { \displaystyle F ( \boldsymbol { v } ) = \mathbb { E } [ f ( \boldsymbol { v } - \eta { \boldsymbol { \epsilon } } ^ { \prime } ) ] } } \\ { { \displaystyle \quad = \frac { 1 } { 2 } ( \boldsymbol { v } - { \boldsymbol { p } } ) ^ { 2 } + \eta ^ { 2 } \sigma _ { 1 } ^ { 2 } + \mathbb { E } [ g _ { \delta } ( \boldsymbol { v } - \eta { \boldsymbol { \epsilon } } ^ { \prime } ) ] } } \\ { { \displaystyle \quad \sim \frac { 1 } { 2 } ( \boldsymbol { v } - { \boldsymbol { p } } ) ^ { 2 } + \mathbb { E } [ g _ { \delta } ( \boldsymbol { v } - \eta { \boldsymbol { \epsilon } } ^ { \prime } ) ] . } } \end{array}
|
| 520 |
+
$$
|
| 521 |
+
|
| 522 |
+
We consider the following problem setup:
|
| 523 |
+
|
| 524 |
+
$$
|
| 525 |
+
\begin{array} { l } { \displaystyle { \delta < \frac { p } { 4 ( 1 + 2 C _ { 1 } ) } , } } \\ { \displaystyle { r > 2 C _ { 1 } ( \delta + C _ { 2 } p ) . } } \end{array}
|
| 526 |
+
$$
|
| 527 |
+
|
| 528 |
+
Note that we can choose arbitrarily small $\delta > 0$ and large $r$ which satisfy the above inequalities.
|
| 529 |
+
|
| 530 |
+
For appropriate smoothing, we choose the step size $\eta$ so that
|
| 531 |
+
|
| 532 |
+
$$
|
| 533 |
+
\frac { 2 C _ { 1 } \delta } { r } \leq \eta \leq \operatorname* { m i n } \left\{ \frac { p } { 4 r } - \frac { \delta } { r } , \frac { \delta } { \delta + C _ { 2 } p } \right\} .
|
| 534 |
+
$$
|
| 535 |
+
|
| 536 |
+
A step-size $\eta$ that satisfies the condition (10) exists and it also satisfies $\eta \le 1 / L = \delta / ( \delta + C _ { 2 } p )$ required in the theory.
|
| 537 |
+
|
| 538 |
+
# C. 2 CONVERGENCE OF SGD AND AVERAGED SGD
|
| 539 |
+
|
| 540 |
+
Under the above setup (8)–(10), we can estimate constants appearing in the convergence results of SGD and averaged SGD as follows (for the detail see the next subsection):
|
| 541 |
+
|
| 542 |
+
$$
|
| 543 |
+
\begin{array} { l } { { \displaystyle { \cal L } = \frac { \delta } { \delta + C _ { 2 } p } , \sigma _ { 1 } ^ { 2 } = r ^ { 2 } , \sigma _ { 2 } = 0 , } } \\ { { \displaystyle \mu = 1 , c = \frac { 1 } { 3 } , M = \frac { 8 } { 9 p } . } } \end{array}
|
| 544 |
+
$$
|
| 545 |
+
|
| 546 |
+
Moreover, the minimum of the smoothed objective is $v _ { * } = p$ , a sharp minimum $( \sim 0 )$ can be eliminated by smoothing.
|
| 547 |
+
|
| 548 |
+
Therefore, for SGD we obtain by Theorem 1,
|
| 549 |
+
|
| 550 |
+
$$
|
| 551 |
+
\begin{array} { r l r } & { } & { \displaystyle \frac { 1 } { T + 1 } \sum _ { t = 0 } ^ { T } \mathbb { E } [ \| v _ { t } - v _ { * } \| ^ { 2 } ] \leq { \cal O } \left( T ^ { - 1 } \right) + \frac { 2 \eta \sigma _ { 1 } ^ { 2 } } { c } + \frac { 8 \eta ^ { 2 } \sigma _ { 1 } ^ { 2 } L } { 3 c } \left( 1 + \frac { 2 \eta \sigma _ { 2 } ^ { 2 } } { c } \right) } \\ & { } & \\ & { } & { \leq { \cal O } \left( T ^ { - 1 } \right) + 6 \eta r ^ { 2 } + \frac { 8 \eta ^ { 2 } r ^ { 2 } \delta } { \delta + C _ { 2 } p } \left( 1 + 6 \eta r ^ { 2 } \right) . } \end{array}
|
| 552 |
+
$$
|
| 553 |
+
|
| 554 |
+
We see from this inequality, $\begin{array} { r } { \eta _ { * } = \frac { 2 C _ { 1 } \delta } { r } } \end{array}$ is the best choice of the step-size, resulting in
|
| 555 |
+
|
| 556 |
+
$$
|
| 557 |
+
\frac { 1 } { T + 1 } \sum _ { t = 0 } ^ { T } \mathbb { E } [ \| v _ { t } - v _ { * } \| ] \leq O \left( T ^ { - 1 / 2 } \right) + \sqrt { 1 2 C _ { 1 } \delta r + \frac { 3 2 C _ { 1 } ^ { 2 } \delta ^ { 3 } } { \delta + C _ { 2 } p } \left( 1 + 1 2 C _ { 1 } \delta r \right) } ,
|
| 558 |
+
$$
|
| 559 |
+
|
| 560 |
+
where we apply Jensen’s inequality to derive the bound on $L _ { 1 }$ -norm. This result means SGD avoids a sharp minimum (i.e., $v \sim 0$ under small $\delta > 0$ ) and converges to a flat minimum $v _ { * } = p$ , and a too large noise will affect the convergence to $v _ { * }$ based on our step-size policy.
|
| 561 |
+
|
| 562 |
+
Moreover, for averaged SGD we obtain by Theorem 2,
|
| 563 |
+
|
| 564 |
+
$$
|
| 565 |
+
\begin{array} { r l } & { \left\| \mathbb { E } [ \overline { { v } } _ { T } ] - v _ { * } \right\| \leq O \left( T ^ { - \frac { 1 } { 2 } } \right) + \frac { 4 \sigma _ { 1 } \sigma _ { 2 } \eta ^ { \frac { 3 } { 2 } } L ^ { \frac { 1 } { 2 } } } { \sqrt { 3 } \mu } + \frac { 2 \eta \sigma _ { 1 } ^ { 2 } M } { c \mu } + \frac { 8 \eta ^ { 2 } \sigma _ { 1 } ^ { 2 } L M } { 3 c \mu } \left( 1 + \frac { 2 \eta \sigma _ { 2 } ^ { 2 } } { c } \right) } \\ & { \qquad = O \left( T ^ { - \frac { 1 } { 2 } } \right) + \frac { 1 6 } { 9 p } \left( 3 \eta r ^ { 2 } + \frac { 4 \eta ^ { 2 } r ^ { 2 } \delta } { \delta + C _ { 2 } p } \left( 1 + 6 \eta r ^ { 2 } \right) \right) } \end{array}
|
| 566 |
+
$$
|
| 567 |
+
|
| 568 |
+

|
| 569 |
+
Figure 7: The figures plot the convergent points of SGD and averaged SGD for problems with $\delta = 0 . 1$ and $\delta = 0 . 5$ .
|
| 570 |
+
|
| 571 |
+
Hence, for $\begin{array} { r } { \eta _ { * } = \frac { 2 C _ { 1 } \delta } { r } } \end{array}$ we obtain
|
| 572 |
+
|
| 573 |
+
$$
|
| 574 |
+
\left. \mathbb { E } [ \overline { { v } } _ { T } ] - v _ { * } \right. \leq O \left( T ^ { - \frac { 1 } { 2 } } \right) + \frac { 3 2 } { 9 p } \left( 3 C _ { 1 } \delta r + \frac { 8 C _ { 1 } ^ { 2 } \delta ^ { 3 } } { \delta + C _ { 2 } p } \left( 1 + 1 2 C _ { 1 } \delta r \right) \right) .
|
| 575 |
+
$$
|
| 576 |
+
|
| 577 |
+
This bound means averaged SGD will get closer to $v _ { * } = p$ as long as SGD approaches a neighborhood of $v _ { * }$
|
| 578 |
+
|
| 579 |
+
According to the above results, both SGD and averaged SGD converge to a flat region when $\delta$ is small, and averaged SGD converges even when $\delta$ is relatively large.
|
| 580 |
+
|
| 581 |
+
We empirically observed this phenomenon in Figure 7 in which we run SGD and averaged SGD for problems with small $\delta = 0 . 1$ and relatively large $\delta = 0 . 5$ .
|
| 582 |
+
|
| 583 |
+
# C. 3 ESTIMATION OF CONSTANTS
|
| 584 |
+
|
| 585 |
+
We verify the estimations of constants in (11). $L , \sigma _ { 1 } ^ { 2 }$ , and $\sigma _ { 2 }$ are already obtained, thus, $m u , c ,$ , and $M$ remain.
|
| 586 |
+
|
| 587 |
+
Minimum and estimation of $\mu$ . We first see that under our problem setting, the local minimum around the origin is eliminated and $p$ is the optimal solution of $F$ , i.e., $v _ { * } = p$ .
|
| 588 |
+
|
| 589 |
+
The smoothed function $G _ { \delta } ( v ) \stackrel { \mathrm { d e f } } { = } \mathbb { E } [ g _ { \delta } ( v - \eta \epsilon ^ { \prime } ) ]$ and its derivative $G _ { \delta } ^ { \prime } ( v )$ are calculated as follows:
|
| 590 |
+
|
| 591 |
+
$$
|
| 592 |
+
\begin{array} { l } { { \displaystyle G _ { \delta } ( \boldsymbol { v } ) = \int _ { - r } ^ { r } g _ { \delta } ( \boldsymbol { v } - \eta t ) \frac { 1 } { 2 r } \mathrm { d } t } , } \\ { { \displaystyle G _ { \delta } ^ { \prime } ( \boldsymbol { v } ) = \int _ { - r } ^ { r } g _ { \delta } ^ { \prime } ( \boldsymbol { v } - \eta t ) \frac { 1 } { 2 r } \mathrm { d } t } . } \end{array}
|
| 593 |
+
$$
|
| 594 |
+
|
| 595 |
+
By taking into account $\operatorname { s u p p } ( g _ { \delta } ) = [ - \delta , \delta ]$ , the smoothed objective $G _ { \delta } ( \boldsymbol { v } )$ is constant on $\{ | \boldsymbol { v } | \le \eta r -$ $\delta \} \cup \{ | v | \geq \eta r + \delta \}$ , and thus, $G _ { \delta } ^ { \prime }$ is non-zero only on $\mathrm { . s u p p } ( G _ { \delta } ^ { \prime } ) = [ - \eta r - \delta , - \eta r + \delta ] \cup [ \eta r - \delta , \eta r + \delta ]$ . See Figure 6 (left). Since $\eta r + \bar { \delta } < p / 4 < p$ under (10), $v = p$ is still a local minimum of $F$ .
|
| 596 |
+
|
| 597 |
+
We evaluate the bound on $G _ { \delta } ^ { \prime }$ on $\operatorname { s u p p } ( G _ { \delta } ^ { \prime } )$ below. for $v \in [ \eta r - \delta , \eta r + \delta ]$ the support of $g _ { \delta } ^ { \prime } ( v - \eta t )$ in $t \in \mathbb { R }$ is $[ ( v - \delta ) / \eta , ( v + \check { \delta } ) / \eta ]$ , we get
|
| 598 |
+
|
| 599 |
+
$$
|
| 600 |
+
\begin{array} { l } { \displaystyle 0 \le G _ { \delta } ^ { \prime } ( v ) = \int _ { - r } ^ { r } g _ { \delta } ^ { \prime } ( v - \eta t ) \frac 1 { 2 r } \mathrm { d } t } \\ { \displaystyle \le \int _ { \frac { v - \delta } { \eta } } ^ { \frac { v + \delta } { \eta } } | g _ { \delta } ^ { \prime } ( v - \eta t ) | \frac 1 { 2 r } \mathrm { d } t } \\ { \displaystyle \le p C _ { 1 } \int _ { \frac { v - \delta } { \eta } } ^ { \frac { v + \delta } { \eta } } \frac 1 { 2 r } \mathrm { d } t = \frac { p C _ { 1 } \delta } { \eta r } , } \end{array}
|
| 601 |
+
$$
|
| 602 |
+
|
| 603 |
+
where we used $| g _ { \delta } ^ { \prime } ( v ) | = | g _ { 1 } ^ { \prime } ( v / \delta ) | \le p C _ { 1 }$ . A bound on $[ - \eta r - \delta , - \eta r + \delta ]$ is also obtained in the same way. Thus, we see
|
| 604 |
+
|
| 605 |
+
$$
|
| 606 |
+
\left\{ \begin{array} { l l } { - \frac { p C _ { 1 } \delta } { \eta r } \leq G _ { \delta } ^ { \prime } ( v ) \leq 0 } & { ( v \in [ - \eta r - \delta , - \eta r + \delta ] ) , } \\ { 0 \leq G _ { \delta } ^ { \prime } ( v ) \leq \frac { p C _ { 1 } \delta } { \eta r } } & { ( v \in [ \eta r - \delta , \eta r + \delta ] ) , } \\ { G _ { \delta } ^ { \prime } ( v ) = 0 } & { ( \mathrm { e l s e } ) . } \end{array} \right.
|
| 607 |
+
$$
|
| 608 |
+
|
| 609 |
+
If there are additional stationary points of $F$ , they should exist in $[ \eta r - \delta , \eta r + \delta ] = \operatorname { s u p p } ( G _ { \delta } ^ { \prime } ) \backslash [ - \eta r -$ $\delta , - \eta r + \delta ]$ because of the sign of $G _ { \delta } ^ { \prime }$ and $\mathrm { s u p p } ( G _ { \delta } ^ { \prime } ) \subset ( - \infty , \stackrel { . . } { p / 4 } )$ . However, since $\eta r + \delta \leq p / 4$ and pC1δ $\frac { p C _ { 1 } \delta } { \eta r } \le p / 2$ under (10), we see
|
| 610 |
+
|
| 611 |
+
$$
|
| 612 |
+
\operatorname* { m a x } _ { v \in [ \eta r - \delta , \eta r + \delta ] } F ^ { \prime } ( v ) \le ( \eta r + \delta ) - p + \frac { p C _ { 1 } \delta } { \eta r } \le \frac { p } { 4 } - p + \frac { p } { 2 } = - \frac { p } { 4 } .
|
| 613 |
+
$$
|
| 614 |
+
|
| 615 |
+
Hence, $v _ { * } = p$ is the unique local minimum (i.e., optimal solution) of $F$ and we can conclude $\mu = 1$
|
| 616 |
+
|
| 617 |
+
Estimation of $c$ . From the above argument, we get
|
| 618 |
+
|
| 619 |
+
$$
|
| 620 |
+
\begin{array} { r l } & { F ^ { \prime } ( v ) ( v - p ) = ( v - p ) ^ { 2 } + G _ { \delta } ^ { \prime } ( v ) ( v - p ) } \\ & { \qquad \geq \left\{ \begin{array} { l l } { ( v - p ) ^ { 2 } } & { ( v \in [ - \eta r - \delta , - \eta r + \delta ] ) , } \\ { ( v - p ) ^ { 2 } + \frac { p C _ { 1 } \delta } { \eta r } ( v - p ) \geq ( v - p ) ^ { 2 } + \frac { p } { 2 } ( v - p ) } & { ( v \in [ \eta r - \delta , \eta r + \delta ] ) , } \\ { ( v - p ) ^ { 2 } } & { ( \mathrm { e l s e } ) . } \end{array} \right. } \end{array}
|
| 621 |
+
$$
|
| 622 |
+
|
| 623 |
+
Clearly, $p / 2 \ \leq \ 2 ( p - v ) / 3$ for $v \ \leq \ \eta r + \delta \ \leq \ p / 4$ . Thus, $F ^ { \prime } ( v ) ( v \mathrm { ~ - ~ } p ) \geq ( v \mathrm { ~ - ~ } p ) ^ { 2 } / 3$ on $v \in [ \eta r - \delta , \eta r + \delta ]$ and we conclude $c = 1 / 3$ .
|
| 624 |
+
|
| 625 |
+
Estimation of $M$ . Noting $v _ { * } = p$ and $F ^ { \prime \prime } ( p ) = 1$ , we have
|
| 626 |
+
|
| 627 |
+
$$
|
| 628 |
+
| F ^ { \prime } ( v ) - F ^ { \prime \prime } ( v _ { * } ) ( v - v _ { * } ) | = | ( v - p ) + G _ { \delta } ^ { \prime } ( v ) - ( v - p ) | = | G _ { \delta } ^ { \prime } ( v ) | .
|
| 629 |
+
$$
|
| 630 |
+
|
| 631 |
+
Because of the problem setup, it is enough to verify $\begin{array} { r } { M = \frac { 8 } { 9 p } } \end{array}$ satisfies $| G _ { \delta } ^ { \prime } ( v ) | \le M | v - p | ^ { 2 }$ on $v \in [ \eta r - \delta , \eta r + \delta ]$ . Since $| G _ { \delta } ^ { \prime } ( v ) | \le p / 2$ and $v \leq p / 4$ for $v$ in this interval, we have
|
| 632 |
+
|
| 633 |
+
$$
|
| 634 |
+
| G _ { \delta } ^ { \prime } ( v ) | \leq \frac { p } { 2 } \leq M \frac { 9 p ^ { 2 } } { 1 6 } \leq M ( v - p ) ^ { 2 } .
|
| 635 |
+
$$
|
| 636 |
+
|
| 637 |
+
This concludes $\begin{array} { r } { M = \frac { 8 } { 9 p } } \end{array}$ .
|
md/dev/sMNvG2UMd_l/sMNvG2UMd_l.md
ADDED
|
@@ -0,0 +1,320 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MEAN-SHIFTED CONTRASTIVE LOSS FOR ANOMALY DETECTION
|
| 2 |
+
|
| 3 |
+
Anonymous authors Paper under double-blind review
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Deep anomaly detection methods learn representations that separate between normal and anomalous samples. It was previously shown that the most accurate anomaly detectors can be obtained when powerful externally trained feature extractors (e.g. ResNets pre-trained on ImageNet) are fine-tuned on the training data which consists of normal samples and no anomalies. Although contrastive learning is currently the state-of-the-art in self-supervised anomaly detection, we show that it achieves poor results when used to fine-tune pre-trained feature extractors. We investigate the reason for this collapse, and find that pre-trained feature initialization causes poor conditioning for standard contrastive objectives, resulting in bad optimization dynamics. Based on our analysis, we provide a modified contrastive objective named the Mean-Shifted Contrastive Loss. Our method is highly effective and achieves a new state-of-the-art anomaly detection performance on multiple benchmarks including $9 7 . 2 \%$ ROC-AUC on the CIFAR-10 dataset.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Anomaly detection is a fundamental task for intelligent agents that aims to detect if an observed pattern is normal or anomalous (unusual or unlikely). Anomaly detection has broad applications in scientific and industrial tasks such as detecting new supernovae or genetic mutations, as well as production line inspection and video surveillance. Due to the significance of the task, many efforts have been focused on automatic anomaly detection, particularly on statistical and machine learning methods. A common paradigm used by many anomaly detection methods is measuring the probability of samples and assigning high-probability samples as normal and low-probability samples as anomalous. The quality of the density estimators is closely related to the quality of features used to represent the data. Classical methods used statistical estimators such as K-means, K nearest-neighbors (kNN) or Gaussian mixture models (GMMs) on raw features, however this often results in sub-optimal results on high-dimensional data such as images.
|
| 12 |
+
|
| 13 |
+
Anomaly detection on high-dimensional data requires high quality features. Many recent methods learn features in a self-supervised way and use them in order to detect anomalies. Unfortunately, anomaly detection datasets are typically small and do not include anomalous samples, resulting in weak features. An alternative is transferring features learned from auxiliary tasks on large-scale external datasets such as ImageNet classification. It was found that fine-tuning the pre-trained features on the normal training data can result in significant performance improvements. Although it may appear natural that this can simply be done by initializing standard anomaly detection techniques with the pre-trained features, it is quite challenging. Reiss et al. (2021) proposed PANDA that combined the DeepSVDD objective (Ruff et al., 2018) with pre-trained features. As the top self-supervised anomaly detection methods use contrastive learning rather than DeepSVDD, we hypothesize that combining pre-trained feature with contrastive methods would achieve the best of both worlds.
|
| 14 |
+
|
| 15 |
+
We begin with the surprising result that standard contrastive methods, initialized with pre-trained weights, do not improve anomaly detection accuracy at all. An analysis of the learning dynamics reveals that this occurs due to the fact that the standard contrastive loss is poorly suited for data that are concentrated in a compact subspace (which the normal data under strong pre-trained features are). We propose an alternative objective, the mean-shifted contrastive (MSC) loss. The MSC loss is found to achieve better One-Class Classification (OCC) performance than the center-loss (used in DeepSVDD and PANDA), and sets a new anomaly detection state-of-the-art.
|
| 16 |
+
|
| 17 |
+
# Our contributions:
|
| 18 |
+
|
| 19 |
+
1. We analyze the standard contrastive loss for fine-tuning pre-trained representations for OCC and show that it is poorly initialized and achieves poor performance. 2. Proposing an alternative objective, named the Mean-Shifted Contrastive Loss and providing analysis that it is crucial for achieving strong performance for adapting features for OCC. 3. Extensive experiments demonstrating that our method is able to outperform the state-of-theart anomaly detection performance (e.g. $9 7 . 2 \%$ ROC-AUC on CIFAR-10).
|
| 20 |
+
|
| 21 |
+
# 2 RELATED WORK
|
| 22 |
+
|
| 23 |
+
Classical anomaly detection methods: Detecting anomalies in images has been researched for several decades. The methods follow three main paradigms: i) Reconstruction - characterizing the normal data by a set of basis functions and then attempts to reconstruct a new example using these basis functions (with sparsity or norm constraints). Anomalies typically have High reconstruction errors. Notable methods include: principal component analysis (Jolliffe, 2011) and K nearest neighbors (kNN) (Eskin et al., 2002). ii) Density estimation - test samples are denoted as anomalous if their estimated density is low. Methods include Ensembles of Gaussian Mixture Models (EGMM) (Glodek et al., 2013), and kernel density estimation (Latecki et al., 2007). iii) OCC - fitting a classifier to discriminate between normal samples and all others. It is then used to classify new samples as normal or anomalous. Such methods include one-class support vector machine (OCSVM) (Scholkopf et al., 2000) and support vector data description (SVDD) (Tax & Duin, 2004).
|
| 24 |
+
|
| 25 |
+
Self-supervised deep learning methods: Instead of using supervision for learning deep representations, self-supervised methods train neural networks to solve an auxiliary task for which obtaining data is free or at least very inexpensive. Auxiliary tasks for learning high-quality image features include: video frame prediction (Mathieu et al., 2016), image colorization (Zhang et al., 2016; Larsson et al., 2016) and puzzle solving (Noroozi & Favaro, 2016). RotNet (Gidaris et al., 2018) used a set of image processing rotations around the image axis, and predicted the true image orientation to learn high-quality image features. Golan & El-Yaniv (2018) have used similar image-processing task prediction for detecting anomalies in images. This method was improved by Hendrycks et al. (2019), and extended to tabular data by Bergman & Hoshen (2020). Another commonly used self-supervised paradigm is contrastive learning (Chen et al., 2020a), which learns representations by distinguishing similar views of the same samples from other data samples. Recently, variants of contrastive learning were also introduced to OCC. CSI (Tack et al., 2020) treats augmented input as positive samples and the distributionally-shifted input as negative samples. DROC (Sohn et al., 2020) shares a similar technical formulation as CSI without any test-time augmentation nor ensemble of models.
|
| 26 |
+
|
| 27 |
+
Feature adaptation for one-class classification: Similarly to previous work in multi-class image classification, these OCC methods are first initialized using pre-trained features. Features are then adapted on OCC objectives to improve their accuracy. DeepSVDD (Ruff et al., 2018) suggested to first train an auto-encoder on the normal training data, and then using the encoder as the initial feature extractor. Moreover, since the features of the encoder are not specifically fitted to anomaly detection, DeepSVDD adapts on the encoder training data. However, this naive training procedure leads to catastrophic collapse. An alternative direction, is to use features learned from auxiliary tasks on large-scale external datasets such as ImageNet classification. Deep features representations trained on the ImageNet dataset have been shown by Huh et al. (2016) to significantly boost performance on other datasets that are only vaguely related to some of the ImageNet classes. Transferring ImageNet pre-trained features for out-of-distribution detection has been proposed by Hendrycks et al. (2019). Analogous pre-training for OCC has been proposed by Perera & Patel (2019), where they jointly train anomaly detection with the original task, which achieves only limited adaptation success. PANDA (Reiss et al., 2021) proposed techniques based on early stopping and EWC (Kirkpatrick et al., 2017), a continual learning method, to mitigate catastrophic collapse.
|
| 28 |
+
|
| 29 |
+
# 3 BACKGROUND: LEARNING REPRESENTATIONS FOR ONE-CLASS CLASSIFICATION
|
| 30 |
+
|
| 31 |
+
# 3.1 PRELIMINARIES
|
| 32 |
+
|
| 33 |
+
In the one-class classification task, we are given a set of training samples $x _ { 1 } , x _ { 2 } . . x _ { N } \in \mathcal { X } _ { t r a i n }$ that are all normal (and contain no anomalies). The objective is to classify a new sample $x$ as being normal or anomalous. The methods considered here learn a deep representation of a sample parametrized by the neural network function $\phi : \mathcal { X } \mathbb { R } ^ { d }$ , where $d \in \mathbb { N }$ is the feature dimension. In several methods, $\phi$ is initialized by pre-trained weights $\phi _ { 0 }$ , which can be learned either using external datasets (e.g. ImageNet classification) or using self-supervised tasks on the training set. The representation is further tuned on the training data to form the final representation $\phi$ . Finally, an anomaly scoring function $s ( \phi ( x ) )$ determines the anomaly score of sample $x$ . The binary anomaly classification can be predicted by applying a threshold on $s ( x )$ . In Sec. 3.2 and Sec. 3.3, we review the most relevant methods for learning the representation $\phi$ .
|
| 34 |
+
|
| 35 |
+
# 3.2 SELF-SUPERVISED OBJECTIVES FOR ANOMALY DETECTION
|
| 36 |
+
|
| 37 |
+
We review two deep self-supervised objectives relevant to this work:
|
| 38 |
+
|
| 39 |
+
Center Loss: This loss uses the simple idea, that features should be learned so that normal data lie within a compact region of feature space, whereas anomalous data lie outside it. As we focus on the OCC setting, there are no examples of anomalies in training. Instead, the center loss encourages the features of the normal samples to lie as near as possible to a predetermined center. Specifically, the center loss for an input sample $x \in \mathcal { X } _ { t r a i n }$ can be written as follows:
|
| 40 |
+
|
| 41 |
+
$$
|
| 42 |
+
\mathcal { L } _ { c e n t e r } ( x ) = \| \phi ( x ) - c \| ^ { 2 }
|
| 43 |
+
$$
|
| 44 |
+
|
| 45 |
+
This objective suffers from a trivial solution - the features $\phi ( x )$ collapse to a singular point $c$ for all samples, normal and anomalous. This is often called "catastrophic collapse". Such a collapsed representation cannot, of course, discriminate between normal and anomalous samples.
|
| 46 |
+
|
| 47 |
+
Contrastive Loss: Recently, contrastive learning was responsible for much progress in selfsupervised representation learning (Chen et al., 2020a). In the contrastive training procedure a mini-batch of size $B$ is randomly sampled and the contrastive prediction task is defined on pairs of augmented examples derived from the mini-batch, resulting in $2 B$ data points. For anomaly detection in the one-class classification setting, the contrastive objective simply states that: i) the angular distance between the features of any positive pair $( x _ { i } ^ { \prime } , x _ { i } ^ { \prime \prime } )$ should be small ii) the distance between the features of a normal sample $x _ { i }$ and other normal samples $x _ { m }$ should be large. The typical contrastive loss for a positive pair $( x _ { i } ^ { \prime } , x _ { i } ^ { \prime \prime } )$ , where $\boldsymbol { x } _ { i } ^ { \prime }$ and $x _ { i } ^ { \prime \prime }$ are augmentations of $x _ { i } \in \mathcal { X } _ { t r a i n }$ , is written below:
|
| 48 |
+
|
| 49 |
+
$$
|
| 50 |
+
\mathcal { L } _ { c o n } ( x _ { i } ^ { \prime } , x _ { i } ^ { \prime \prime } ) = - \log \frac { \exp ( s i m ( \phi ( x _ { i } ^ { \prime } ) , \phi ( x _ { i } ^ { \prime \prime } ) ) / \tau ) } { \sum _ { m = 1 } ^ { 2 B } \mathbb { 1 } [ i ^ { \prime } \neq m ^ { \prime } ] \cdot \exp ( s i m ( \phi ( x _ { i } ^ { \prime } ) , \phi ( x _ { m } ^ { \prime } ) ) / \tau ) }
|
| 51 |
+
$$
|
| 52 |
+
|
| 53 |
+
where $\forall m \in [ 2 B ] : x _ { m } ^ { \prime }$ is an augmented view of some $x _ { m } \in \mathcal { X } _ { t r a i n }$ , $\tau$ denotes a temperature hyper-parameter and sim is the cosine similarity. Augmentations include crops, flips, color jitter, grayscale and Gaussian blurs. Contrastive methods currently achieve the top performance for anomaly detection without utilization of externally trained network weights.
|
| 54 |
+
|
| 55 |
+
# 3.3 INITIALIZATION WITH PRE-TRAINED WEIGHTS
|
| 56 |
+
|
| 57 |
+
Self-supervised representation learning methods have high sample complexity and in many cases do not outperform supervised representation learning methods. It is common practice in deep learning to transfer the weights of classifiers pre-trained on large, some-what related, labeled datasets to the task of interest. Previous methods used pre-trained weights for anomaly detection (Perera & Patel, 2019; Reiss et al., 2021). It was found that fine-tuning the pre-trained weights of $\phi _ { 0 }$ on the normal data, results in a stronger feature extractor $\phi$ . The latest approach, PANDA, simply used the center loss (Eq. 1) for fine-tuning the pre-trained weights. Several attractive properties of methods based on ImageNet pre-trained features were established: i) they outperform self-supervised anomaly detection methods by a wide margin, without using any labeled examples of anomalies or outlier exposure. ii) they generalize to datasets that are very different from ImageNet including aerial and medical images.
|
| 58 |
+
|
| 59 |
+

|
| 60 |
+
Figure 1: CIFAR-10 "Airplane" class. Average cosine similarity between features on training set vs. training epoch. (a) Similarity between pairs of images. Similarity between images and their augmentation for $( b )$ Contrastive objective (c) Mean-shifted contrastive objective.
|
| 61 |
+
|
| 62 |
+
As contrastive objectives typically perform better than the center loss, it is natural to assume that replacing PANDA’s center loss by the contrastive loss would be advantageous. Unfortunately, the representation collapses immediately and this modification achieves poor OCC results. In Sec. 4 we will analyze this phenomenon and present an alternative objective which overcomes this issue.
|
| 63 |
+
|
| 64 |
+
# 4 MODIFYING THE CONTRASTIVE LOSS FOR ANOMALY DETECTION
|
| 65 |
+
|
| 66 |
+
In this section, we introduce our new approach for OCC feature adaptation. In Sec 4.1 we analyze the mechanism that prevents standard contrastive objectives from benefiting from pre-trained weights for OCC. In Sec 4.2 we present our new objective function, the mean-shifted contrastive (MSC) loss. In Sec 4.3 we analyze the the proposed mean-shifted contrastive loss for OCC transfer learning.
|
| 67 |
+
|
| 68 |
+
# 4.1 ADAPTATION FAILURE OF THE ONE-CLASS CLASSIFICATION CONTRASTIVE LOSS
|
| 69 |
+
|
| 70 |
+
While contrastive methods have achieved state-of-the-art performance on visual recognition tasks, they are not apriori designed for feature adaptation for OCC. In this section, we analyze the following phenomenon: when optimizing a contrastive objective for the OCC setting of anomaly detection with ImageNet pre-trained features, the representations do not only fail to improve, but degrade quickly.
|
| 71 |
+
|
| 72 |
+
To understand this phenomenon, we present in Fig. 1 plots of two metrics as a function of training epoch: i) uniformity: the average cosine similarity between the features of pairs of examples in the training set (more uniform $=$ close to zero) ii) augmentation distance: the average cosine similarity between features of train samples and their augmentation (higher generally means better ordering of feature space). Wang $\&$ Isola (2020) showed the contrastive loss optimizes two properties i) uniform distribution of $\{ \phi ( x ) \} _ { x \in \mathcal { X } _ { t r a i n } }$ across the unit sphere. ii) different augmentations of the same images mapping to the same representation. We can see that in our OCC setting, contrastive training significantly improved the uniformity of the distribution of training images but failed to increase the similarity between the features of images and their augmentation. Results for other temperature values is presented in Appendix A.3. This shows that contrastive training in this case did not make features more discriminative, suggesting the training objective is not well specified.
|
| 73 |
+
|
| 74 |
+
We provide an intuitive explanation for the empirical observation. It is common that the normal data occupy a compact region in the ImageNet pre-trained feature space. When viewed in the spherical coordinate system having its center at the origin, normal images span only a small, bounded region of the sphere. As one of the objectives of contrastive learning is to have features that occupy the entire sphere, the optimization would be focused on changing the features accordingly, putting far less emphasis on improving the features so that they are invariant to augmentations. This is not good for anomaly detection as this uniformity actually makes anomalies harder to detect (as they become less likely to occupy a sparse region of the feature space). Additionally, such drastic changes of the features cause the loss of the useful properties of the ImageNet pre-trained feature space. This is counter to the objective of transferring strong auxiliary features.
|
| 75 |
+
|
| 76 |
+
# 4.2 THE MEAN-SHIFTED CONTRASTIVE LOSS FOR BETTER ADAPTATION
|
| 77 |
+
|
| 78 |
+
To overcome the limitations of contrastive learning explained above, we propose a simple modification of its objective for OCC feature adaptation. In our modified objective, we compute the angles between the features of images with respect to the center of the normal features rather than the (Wang &
|
| 79 |
+
|
| 80 |
+

|
| 81 |
+
Figure 2: Top: The angular representation in relation to the origin. $\mathcal { L } _ { c o n }$ enlarging the angles between positive and negative samples, thus increasing their Euclidean distance to $c$ . Bottom: The meanshifted representation. $\mathcal { L } _ { m s c }$ does not affect the Euclidean distance between $c$ and the mean-shifted representations while maximizes the angles between the negative pairs.
|
| 82 |
+
|
| 83 |
+
Isola, 2020) (as done in the original contrastive loss). Although this can be seen as a simple shift of the original objective, we will show that it resolves the critical issues highlighted above and allows contrastive learning to benefit from the powerful, pre-trained feature initialization (See Sec. 4.3). We name this new objective, the Mean-Shifted Contrastive (MSC) loss.
|
| 84 |
+
|
| 85 |
+
Let us denote the center of the normalized feature representations of the training set by $c$ :
|
| 86 |
+
|
| 87 |
+
$$
|
| 88 |
+
c = \mathbb { E } _ { x \in \mathcal { X } _ { t r a i n } } [ \frac { \phi _ { 0 } ( x ) } { \lVert \phi _ { 0 } ( x ) \rVert } ]
|
| 89 |
+
$$
|
| 90 |
+
|
| 91 |
+
where $\phi _ { 0 }$ is the initialized pre-trained model. For each image $x$ , we create two different augmentations of the image, denoted $x ^ { \prime } , x ^ { \prime \prime }$ . All the augmented images are first passed through a feature extractor $\phi$ . They are then scaled to the unit sphere by $\ell _ { 2 }$ normalization (see Sec. 5.2 for the motivation of using $\ell _ { 2 }$ normalization). We mean-shift each representation, by subtracting the center $c$ from each normalized feature representation. The mean-shifted contrastive loss for two augmentations $x _ { i } ^ { \prime } , x _ { i } ^ { \prime \prime }$ of image $x _ { i }$ from an augmented mini-batch of size $2 B$ is defined as follows:
|
| 92 |
+
|
| 93 |
+
$$
|
| 94 |
+
\mathcal { L } _ { m s c } ( x _ { i } ^ { \prime } , x _ { i } ^ { \prime \prime } ) = - \log \frac { \exp ( s i m ( \frac { \phi ( x _ { i } ^ { \prime } ) } { \| \phi ( x _ { i } ^ { \prime } ) \| } - c , \frac { \phi ( x _ { i } ^ { \prime \prime } ) } { \| \phi ( x _ { i } ^ { \prime \prime } ) \| } - c ) ) / \tau ) } { \sum _ { i = 1 } ^ { 2 B } \mathbb { 1 } [ i ^ { \prime } \neq m ^ { \prime } ] \cdot \exp ( s i m ( \frac { \phi ( x _ { i } ^ { \prime } ) } { \| \phi ( x _ { i } ^ { \prime } ) \| } - c , \frac { \phi ( x _ { m } ^ { \prime } ) } { \| \phi ( x _ { m } ^ { \prime } ) \| } - c ) ) / \tau ) }
|
| 95 |
+
$$
|
| 96 |
+
|
| 97 |
+
where $\tau$ denotes a temperature hyper-parameter and $s i m$ is the cosine similarity.
|
| 98 |
+
|
| 99 |
+
Anomaly criterion: To classify a sample as normal or anomalous, we use the cosine similarity from a set of $K$ suitably selected training exemplars $N _ { k } ( x )$ . The set $N _ { k } ( x )$ can be selected by K nearest-neighbors (more accurate) or $\mathbf { K }$ -means (faster). We compute the cosine similarity between the features of the target image $x$ and the K exemplars $N _ { k } ( x )$ . The anomaly score is given by:
|
| 100 |
+
|
| 101 |
+
$$
|
| 102 |
+
s ( x ) = \sum _ { \phi ( y ) \in N _ { k } ( x ) } 1 - s i m ( \phi ( x ) , \phi ( y ) )
|
| 103 |
+
$$
|
| 104 |
+
|
| 105 |
+
where sim is the cosine similarity. By checking if the anomaly score $s ( x )$ is larger than a threshold, we determine if the image $x$ is normal or anomalous. A comparison between the different exemplar selection methods is presented in Sec. 5.2.
|
| 106 |
+
|
| 107 |
+
# 4.3 UNDERSTANDING THE MEAN-SHIFTED CONTRASTIVE LOSS
|
| 108 |
+
|
| 109 |
+
Here, we compare the mean-shifted contrastive loss and the standard contrastive loss.
|
| 110 |
+
|
| 111 |
+
Uniformity: Optimizing pre-trained weights with the standard contrastive loss focuses on optimizing uniformity around the origin-centered sphere but hurts feature semantic similarity (Sec. 4.1). The mean-shifted loss proposes a simple but very effective solution - evaluating uniformity in the coordinate frame around the data-center. In this frame the features are already roughly uniform, making the optimization focus on improving the semantic similarity of features. In Fig.1 we see that the features are uniform right from initialization according to our objective (low cosine similarity between normal examples). The optimization can thus focuses on improving the features.
|
| 112 |
+
|
| 113 |
+

|
| 114 |
+
Figure 3: An illustration of our feature adaptation. $( a )$ The initialized feature space derived by $\phi _ { 0 }$ . $( b )$ $\mathcal { L } _ { c o n }$ forces $\{ \phi ( x ) \} _ { x \in \mathcal { X } _ { t r a i n } }$ to be equally distributed across the unit sphere, resulting: i) the loss of the useful properties of the pre-trained model features space. ii) that every anomalous sample $\hat { x } \notin \mathcal { X } _ { t r a i n }$ will have a nearby normal sample (c) $\mathcal { L } _ { m s c }$ operates in the space of angles around the center in which the features are scattered across the unit sphere surrounding the center, thus focusing on improving the features. $( d )$ Projecting the mean-shifted features to the unit sphere after optimizing ${ \mathcal { L } } _ { m s c }$ yields an informative compact representation of normal samples features around the center.
|
| 115 |
+
|
| 116 |
+
Compactness around center: The standard contrastive loss maximizes the angles between representations of negative pairs even when they are both normal training images. By maximizing these angles, the distance to the center increases as well, as illustrated in Fig. 2 (top). This behaviour is in contrast to the optimization of the center loss (Eq. 1), which learns representations by minimizing the Euclidean distance between normal representations and the center. Reiss et al. (2021) showed that optimizing the center loss results in high anomaly detection performance. Our proposed loss does not suffer from this issue. Instead of measuring the angular distance between samples in relation to the origin, we measure the angular distance in relation to the center of the normal features. As can be seen in Fig. 2 (bottom), our proposed mean-shifted contrastive loss maximizes the angles between the negative pairs while preserving their distance to the center.
|
| 117 |
+
|
| 118 |
+
A further illustration of the above analysis is presented in Fig. 3. We can see that contrastive learning forces normal features further away from the center and makes them uniform around the origin. This in fact increases the overlap between normal and anomalous samples. On the other hand, with our mean-shifted contrastive, the normal features are encouraged to lie in a compact region around the center rather than around the origin. This makes the normal features lie in a more compact region and decreases the overlap between normal and anomalous samples.
|
| 119 |
+
|
| 120 |
+
# 5 EXPERIMENTS
|
| 121 |
+
|
| 122 |
+
In this section, we extensively evaluate our method and demonstrate that it outperforms the state-ofthe-art. In Sec. 5.1, we report our OCC results with a comparison to previous works on the standard benchmark datasets. In Sec.5.2 we further analyze our objective and we present an ablation study.
|
| 123 |
+
|
| 124 |
+
Building up on the framework suggested in (Reiss et al., 2021), we use ResNet152 pre-trained on ImageNet classification task as $\phi _ { 0 }$ , and adding an additional final $\ell _ { 2 }$ normalization layer - this is our initialized feature extractor $\phi$ . By default, we fine-tune our model with $\mathcal { L } _ { m s c }$ (as in Eq. 4). For inference we use the criterion described in Sec. 4.2. We adopt the ROC-AUC metric as detection performance score. Full training and implementation details are in Appendix A.1
|
| 125 |
+
|
| 126 |
+
# 5.1 MAIN RESULTS
|
| 127 |
+
|
| 128 |
+
We evaluated our approach on a wide range of anomaly detection benchmarks. Following (Golan & El-Yaniv, 2018; Hendrycks et al., 2019) we run our experiments on commonly used datasets: CIFAR-10 (Krizhevsky et al., 2009), CIFAR-100 coarse-grained version that consists of 20 classes (Krizhevsky et al., 2009), and CatsVsDogs (Elson et al., 2007). Following standard protocol, multiclass dataset are converted to anomaly detection by setting a class as normal and all other classes as anomalies. This is performed for all classes, in practice turning a single dataset with $C$ classes into $C$ datasets. Full dataset descriptions are in Appendix A.1.1 We compare our approach with the top current self-supervised and pre-trained feature adaptation methods (Ruff et al., 2018; Hendrycks et al., 2019; Tack et al., 2020; Sohn et al., 2020; Reiss et al., 2021). Results that were reported in the original papers were copied. When the results were not reported, we ran the experiments ourselves.
|
| 129 |
+
|
| 130 |
+
Table 1: Anomaly detection performance (mean ROC-AUC $\%$ , ours is averaged over five runs)
|
| 131 |
+
|
| 132 |
+
<table><tr><td>Dataset</td><td colspan="4">Self-supervised</td><td colspan="2">Pre-trained</td></tr><tr><td></td><td>DeepSVDD</td><td>MHRot</td><td>DROC</td><td>CSI</td><td>PANDA</td><td>Ours</td></tr><tr><td>CIFAR-10</td><td>64.8</td><td>90.1</td><td>92.5</td><td>94.3</td><td>96.2</td><td>97.2±0.1</td></tr><tr><td>CIFAR-100</td><td>67.0</td><td>80.1</td><td>86.5</td><td>89.6</td><td>94.1</td><td>96.4±0.1</td></tr><tr><td>CatsVsDogs</td><td>50.5</td><td>86.0</td><td>89.6</td><td>86.3</td><td>97.3</td><td>99.3±0.0</td></tr></table>
|
| 133 |
+
|
| 134 |
+
Tab. 1 shows that our proposed approach surpasses the previous state-of-the-art on the common OCC benchmarks. This establishes the superiority of our approach, resulted by our new objective, over previous self-supervised and pre-trained methods. Full class-wise results are in Appendix A.1.5.
|
| 135 |
+
|
| 136 |
+
Table 2: Anomaly detection accuracy (mean ROC-AUC $\%$ ) on small dataset. Self-supervised methods fail while adapting pre-trained features achieves strong results. Bold denotes the best results.
|
| 137 |
+
|
| 138 |
+
<table><tr><td></td><td>DIOR</td><td>MvTec</td><td>CIFAR-10 (200 Train samples)</td><td>CIFAR-10 (500 Train samples)</td></tr><tr><td>CSI</td><td>78.5</td><td>63.6</td><td>81.8</td><td>88.1</td></tr><tr><td>PANDA</td><td>94.3</td><td>86.5</td><td>95.4</td><td>95.6</td></tr><tr><td>Ours</td><td>97.2</td><td>87.2</td><td>96.5</td><td>96.7</td></tr></table>
|
| 139 |
+
|
| 140 |
+
# 5.2 FURTHER ANALYSIS & ABLATION STUDY
|
| 141 |
+
|
| 142 |
+
Small datasets. In order to demonstrate different challenges in image anomaly detection, we further extend our results on small datasets following the standard protocol. We tested our method on: MVTec (Bergmann et al., 2019) and DIOR (Li et al., 2020). Furthermore, we used the CIFAR-10 dataset with different amount of training data. In Tab. 2 we present a comparison between (i) top self-supervised contrastive-learning based method - CSI (ii) top OCC feature adaptation method - PANDA (iii) our method. We see that the self-supervised method does not perform well on such small datasets, whereas our method achieves very strong performance. The reason for the poor performance of self-supervised methods on small datasets, is due to the fact that the only training data they see is the small dataset, and they cannot learn strong features using such a small amount of data. This is particularly severe for contrastive methods (but is also the case for all other self-supervised methods). As pre-trained methods transfer features from external datasets, they do not have this failure mode.
|
| 143 |
+
|
| 144 |
+
Optimization from scratch. The mean-shifted objective assumes that relative distance to the center of the features is correlated with high detection performance. When initializing the center as a random Gaussian vector we lose this strong prior, as a result, the detection capabilities are drastically degraded. Therefore when training a model from scratch without any strong initialization that comes from a pre-trained model, our objective does not improve over standard contrastive losses. The mean-shited contrastive loss is therefore a directed contribution to anomaly detection from pre-trained features.
|
| 145 |
+
|
| 146 |
+
Does the superiority of pre-trained features extend to very different domains? It has already been established in Reiss et al. (2021) that anomaly detection methods based on ImageNet pre-trained features perform very well on distant domains (medical, aerial, industrial datasets). Our results on DIOR and MVTec that are significantly different from ImageNet provide further evidence.
|
| 147 |
+
|
| 148 |
+
Catastrophic collapse & Early Stopping. Similarly to other OCC pre-trained feature adaptation methods (e.g. PANDA), our method suffers from catastrophic collapse for a very large number of training epochs. However, our method is less sensitive than PANDA, as we dominate PANDA at any point in the curve and collapse much more slowly.See Appendix A.2 for more details.
|
| 149 |
+
|
| 150 |
+

|
| 151 |
+
Figure 4: Sensitivity of the mean-shifted loss to class confidence. (a): The angular representation in relation to the origin without confidence normalization. (b): The mean-shifted representation enlarges the angle between the positive samples. (c): The angular representation after confidence normalization. (d): The angle between the positive samples is approximately preserved after mean-shifting.
|
| 152 |
+
|
| 153 |
+
Why do self-supervised OCC models not suffer from catastrophic collapse? pre-trained methods start from highly discriminative features and can therefore lose accuracy whereas self-supervised features start from random features and therefore have nothing to forget. Another way of looking at it, is that pre-trained initialization creates a useful inductive bias that may erode as a function of training. But this useful bias is only present for pre-trained and not for self-supervised methods.
|
| 154 |
+
|
| 155 |
+
The Angular Representation. Our initial feature extractor $\phi _ { 0 }$ is pre-trained on a classification task (specifically ImageNet classification). To obtain class probabilities from the features $\phi _ { 0 } ( x )$ , which are subsequently multiplied by classifier matrix $C$ and passed through a softmax layer. The logits are therefore given by $C \phi _ { 0 } \bar { ( x ) }$ . As softmax is a monotonic function, scaling of the logits does not change the order of probabilities. However, scaling does determine the degree of confidence in the decision. We propose to disambiguate the representation $\phi _ { 0 } ( x )$ into two components: i) the semantic class $\frac { \phi _ { 0 } ( x ) } { \| \phi _ { 0 } ( x ) \| }$ and the confidence $\| \phi _ { 0 } ( x ) \|$ . The confidence acts as a per-sample temperature that determines how confident the discrimination between the classes is. A thorough investigation that we conducted, showed that the confidence of an ImageNet pre-trained feature representation did not help the anomaly detection performance. In Fig. 5, we compare the histogram of confidence values between the normal and anomalous values on a particular class of the CIFAR-10 dataset ("Bird"). We observe that confidence does not discriminate between normal and anomalous images in this dataset. In Fig. 4 we demonstrate the sensitivity of the mean-shifted representation to the class confidence. This emphasizes the importance of confidence normalization for the mean-shifted contrastive optimization.
|
| 156 |
+
|
| 157 |
+

|
| 158 |
+
Figure 5: Confidence histogram of CIFAR-10 "Bird" class. The $\ell _ { 2 }$ norm confidence of the extracted features derived by $\phi$ does not differentiate between normal and anomalous samples.
|
| 159 |
+
|
| 160 |
+
We thus propose to use the angular center loss. The angular center loss encourages the angular distance between each sample and the center to be minimal. This contrasts with the standard center loss (used by PANDA and DeepSVDD), which uses the Euclidean distance. Although a simple change, the angular center loss achieves much better results than the regular center loss (see Tab. 3).
|
| 161 |
+
|
| 162 |
+
$$
|
| 163 |
+
{ \mathcal { L } } _ { a n g u l a r } = - \phi ( x ) \cdot c
|
| 164 |
+
$$
|
| 165 |
+
|
| 166 |
+
Rotation-prediction methods do not benefit from pre-trained features. Self-supervised contrastive methods use rotation-prediction as a way to address the uniformity issue highlighted here (Tack et al., 2020; Sohn et al., 2020). Although it may appear that using pre-trained features might improve OCC methods that rely on rotation-prediction, this is in fact not the case. The reason is that features that generalize better, achieve better performance on rotation-prediction for both normal and anomalous data. Pre-training therefore decreases the gap between the performance of normal and anomalous images on rotation prediction than randomly-initialized networks. This gap is used for discriminating between normal and anomalous samples, and its decrease leads to degraded anomaly detection performance. Specifically, we found that CSI with ImageNet pre-trained features achieves $8 9 . 5 \%$ average result on CIFAR-10 compared to the standard version which results with $9 4 . 3 \%$ .
|
| 167 |
+
|
| 168 |
+
Table 3: Training objective ablation study (CIFAR-10, mean ROC-AUC %).
|
| 169 |
+
|
| 170 |
+
<table><tr><td>Dataset</td><td colspan="2">DN2</td><td colspan="2">PANDA</td><td>Lmsc</td><td>Lmsc +Langular</td></tr><tr><td></td><td>Raw</td><td>Angular</td><td>Lcenter</td><td>Langular</td><td></td><td></td></tr><tr><td>CIFAR-10</td><td>92.5</td><td>95.8</td><td>96.2</td><td>96.8</td><td>97.2</td><td>97.5</td></tr></table>
|
| 171 |
+
|
| 172 |
+
Self-supervised methods do not benefit from large architectures. Pre-trained models can use large deep networks, a quality that OCC self-supervised methods lack. Since OCC benchmarks are not large, self-supervised methods do not benefit from bigger networks. We tested this by evaluating CSI with different ResNet backbone sizes (ResNet18, ResNet50, ResNet152). The CSI results were the same for all backbones sizes $9 4 . 3 \%$ ROC-AUC on CIFAR-10. This is in contrast to the effect of pre-trained feature adaptation in our method which benefits from bigger pre-trained models.
|
| 173 |
+
|
| 174 |
+
Training objective. An ablation of the objectives and of DN2 (kNN on unadapted ImageNet pretrained ResNet features) is presented in Tab. 3. Note that both the confidence-invariant form of DN2 and PANDA outperform their Euclidean versions. We further notice that the mean-shifted loss outperforms the rest, and combining it with the angular center loss results in further improvements.
|
| 175 |
+
|
| 176 |
+
Multi-Modal Anomaly Detection. We evaluate the setting where all classes are designated as normal apart from a single class that is taken as anomalous. Note that we do not provide the class labels of the different classes that compose the normal class, rather we consider them to be a single multi-modal class. This setting is more challenging than the standard uni-modal setting as the normal class is complex and consists of many different unlabeled types of data. For each experiment, we denoted a single CIFAR-10 class as anomalous and all nine other CIFAR-10 classes as normal. We report the mean ROC-AUC $\%$ over the 10 experiments in Tab. 4. In this case PANDA does not improve results over the DN2 (with cosine distance) as its uni-modal assumption is no longer satisfied. This is because the normal set contains nine classes rather than one. On the other hand, our mean-shifted contrastive loss does not rely on the uni-modal assumption to the same extent leading to much better results. Moreover, self-supervised methods do not preserve their performance on a multi-modal distribution, and are outperformed by pre-trained deep features.
|
| 177 |
+
|
| 178 |
+
Table 4: Multi-Modal Anomaly detection accuracy (mean ROC-AUC $\%$ ).
|
| 179 |
+
|
| 180 |
+
<table><tr><td>Dataset</td><td colspan="2">DN2</td><td colspan="2">PANDA</td><td colspan="2">Self-Supervised</td><td>Ours</td></tr><tr><td></td><td>Raw</td><td>Angular</td><td>Lcenter</td><td>Langular</td><td>MHRot</td><td>CSI</td><td>Lmsc</td></tr><tr><td>CIFAR-10</td><td>76.2</td><td>80.4</td><td>78.5</td><td>78.0</td><td>76.7</td><td>79.0</td><td>85.3</td></tr></table>
|
| 181 |
+
|
| 182 |
+
Detection scoring functions. kNN has well established approximations that mitigate its inference time complexity. A simple, but effective solution is reducing the set of gallery samples via $\mathbf { k }$ -means. In Tab. 5 we present a comparison of performance of our method and its K-means approximations with the features of the normal training images compressed using different numbers of means (k). We use the sum of the distances to the nearest neighbor means as the anomaly score. We can see that significant inference time improvement can be achieved for a small loss in accuracy.
|
| 183 |
+
|
| 184 |
+
Table 5: CIFAR-10 Anomaly detection accuracy with K-means (mean ROC-AUC $\%$ )
|
| 185 |
+
|
| 186 |
+
<table><tr><td>k=1</td><td>k=5</td><td>k=10</td><td>k =100</td><td>Full train set</td></tr><tr><td>94.2</td><td>95.8</td><td>96.1</td><td>97.0</td><td>97.2</td></tr></table>
|
| 187 |
+
|
| 188 |
+
# 6 CONCLUSION
|
| 189 |
+
|
| 190 |
+
We presented a novel feature adaptation approach for deep anomaly detection. First, we conducted a thorough analysis of the standard contrastive loss and showed that it poorly initialized for OCC feature adaptation. Second, we introduced an alternative objective, the Mean-Shifted Contrastive Loss, that overcomes the limitations of the standard contrastive loss. Finally, we performed extensive experiments demonstrating that our method achieves the top anomaly detection performance.
|
| 191 |
+
|
| 192 |
+
# REFERENCES
|
| 193 |
+
|
| 194 |
+
Liron Bergman and Yedid Hoshen. Classification-based anomaly detection for general data. In ICLR, 2020.
|
| 195 |
+
|
| 196 |
+
Paul Bergmann, Michael Fauser, David Sattlegger, and Carsten Steger. Mvtec ad–a comprehensive real-world dataset for unsupervised anomaly detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 9592–9600, 2019.
|
| 197 |
+
|
| 198 |
+
Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. arXiv preprint arXiv:2002.05709, 2020a.
|
| 199 |
+
|
| 200 |
+
Xinlei Chen and Kaiming He. Exploring simple siamese representation learning. arXiv preprint arXiv:2011.10566, 2020.
|
| 201 |
+
|
| 202 |
+
Xinlei Chen, Haoqi Fan, Ross Girshick, and Kaiming He. Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297, 2020b.
|
| 203 |
+
|
| 204 |
+
Jeremy Elson, John R Douceur, Jon Howell, and Jared Saul. Asirra: a captcha that exploits interestaligned manual image categorization. In ACM Conference on Computer and Communications Security, volume 7, pp. 366–374, 2007.
|
| 205 |
+
|
| 206 |
+
Eleazar Eskin, Andrew Arnold, Michael Prerau, Leonid Portnoy, and Sal Stolfo. A geometric framework for unsupervised anomaly detection. In Applications of data mining in computer security, pp. 77–101. Springer, 2002.
|
| 207 |
+
|
| 208 |
+
Spyros Gidaris, Praveer Singh, and Nikos Komodakis. Unsupervised representation learning by predicting image rotations. arXiv preprint arXiv:1803.07728, 2018.
|
| 209 |
+
|
| 210 |
+
Michael Glodek, Martin Schels, and Friedhelm Schwenker. Ensemble gaussian mixture models for probability density estimation. Computational Statistics, 28(1):127–138, 2013.
|
| 211 |
+
|
| 212 |
+
Izhak Golan and Ran El-Yaniv. Deep anomaly detection using geometric transformations. In NeurIPS, 2018.
|
| 213 |
+
|
| 214 |
+
Jean-Bastien Grill, Florian Strub, Florent Altché, Corentin Tallec, Pierre H Richemond, Elena Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Daniel Guo, Mohammad Gheshlaghi Azar, et al. Bootstrap your own latent: A new approach to self-supervised learning. arXiv preprint arXiv:2006.07733, 2020.
|
| 215 |
+
|
| 216 |
+
Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. arXiv preprint arXiv:1911.05722, 2019.
|
| 217 |
+
|
| 218 |
+
Dan Hendrycks, Mantas Mazeika, Saurav Kadavath, and Dawn Song. Using self-supervised learning can improve model robustness and uncertainty. In NeurIPS, 2019.
|
| 219 |
+
|
| 220 |
+
Minyoung Huh, Pulkit Agrawal, and Alexei A Efros. What makes imagenet good for transfer learning? arXiv preprint arXiv:1608.08614, 2016.
|
| 221 |
+
|
| 222 |
+
Ian Jolliffe. Principal component analysis. Springer, 2011.
|
| 223 |
+
|
| 224 |
+
James Kirkpatrick, Razvan Pascanu, Neil Rabinowitz, Joel Veness, Guillaume Desjardins, Andrei A Rusu, Kieran Milan, John Quan, Tiago Ramalho, Agnieszka Grabska-Barwinska, et al. Overcoming catastrophic forgetting in neural networks. Proceedings of the national academy of sciences, 114 (13):3521–3526, 2017.
|
| 225 |
+
|
| 226 |
+
Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009.
|
| 227 |
+
|
| 228 |
+
Gustav Larsson, Michael Maire, and Gregory Shakhnarovich. Learning representations for automatic colorization. In ECCV, 2016.
|
| 229 |
+
|
| 230 |
+
Longin Jan Latecki, Aleksandar Lazarevic, and Dragoljub Pokrajac. Outlier detection with kernel density functions. In International Workshop on Machine Learning and Data Mining in Pattern Recognition, pp. 61–75. Springer, 2007.
|
| 231 |
+
|
| 232 |
+
Ke Li, Gang Wan, Gong Cheng, Liqiu Meng, and Junwei Han. Object detection in optical remote sensing images: A survey and a new benchmark. ISPRS Journal of Photogrammetry and Remote Sensing, 159:296–307, 2020.
|
| 233 |
+
|
| 234 |
+
Michael Mathieu, Camille Couprie, and Yann LeCun. Deep multi-scale video prediction beyond mean square error. ICLR, 2016.
|
| 235 |
+
|
| 236 |
+
Mehdi Noroozi and Paolo Favaro. Unsupervised learning of visual representations by solving jigsaw puzzles. In ECCV, 2016.
|
| 237 |
+
|
| 238 |
+
Pramuditha Perera and Vishal M Patel. Learning deep features for one-class classification. IEEE Transactions on Image Processing, 28(11):5450–5463, 2019.
|
| 239 |
+
|
| 240 |
+
Tal Reiss, Niv Cohen, Liron Bergman, and Yedid Hoshen. Panda: Adapting pretrained features for anomaly detection and segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2806–2814, 2021.
|
| 241 |
+
|
| 242 |
+
Lukas Ruff, Nico Gornitz, Lucas Deecke, Shoaib Ahmed Siddiqui, Robert Vandermeulen, Alexander Binder, Emmanuel Müller, and Marius Kloft. Deep one-class classification. In ICML, 2018.
|
| 243 |
+
|
| 244 |
+
Bernhard Scholkopf, Robert C Williamson, Alex J Smola, John Shawe-Taylor, and John C Platt. Support vector method for novelty detection. In NIPS, 2000.
|
| 245 |
+
|
| 246 |
+
Kihyuk Sohn, Chun-Liang Li, Jinsung Yoon, Minho Jin, and Tomas Pfister. Learning and evaluating representations for deep one-class classification. arXiv preprint arXiv:2011.02578, 2020.
|
| 247 |
+
|
| 248 |
+
Jihoon Tack, Sangwoo Mo, Jongheon Jeong, and Jinwoo Shin. Csi: Novelty detection via contrastive learning on distributionally shifted instances. arXiv preprint arXiv:2007.08176, 2020.
|
| 249 |
+
|
| 250 |
+
David MJ Tax and Robert PW Duin. Support vector data description. Machine learning, 2004.
|
| 251 |
+
|
| 252 |
+
Feng Wang and Huaping Liu. Understanding the behaviour of contrastive loss. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2495–2504, 2021.
|
| 253 |
+
|
| 254 |
+
Tongzhou Wang and Phillip Isola. Understanding contrastive representation learning through alignment and uniformity on the hypersphere. In International Conference on Machine Learning, pp. 9929–9939. PMLR, 2020.
|
| 255 |
+
|
| 256 |
+
Richard Zhang, Phillip Isola, and Alexei A Efros. Colorful image colorization. In ECCV, 2016.
|
| 257 |
+
|
| 258 |
+
# A APPENDIX
|
| 259 |
+
|
| 260 |
+
A.1 EXPERIMENTAL DETAILS
|
| 261 |
+
|
| 262 |
+
A.1.1 DATASET DESCRIPTIONS
|
| 263 |
+
|
| 264 |
+
Standard datasets: We evaluate our method on a set of commonly used datasets: CIFAR-10 (Krizhevsky et al., 2009): Consists of RGB images of 10 object classes. CIFAR-100 (Krizhevsky et al., 2009): We use the coarse-grained version that consists of 20 classes. DogsVsCats: High resolution color images of two classes: cats and dogs. The data were extracted from the ASIRRA dataset (Elson et al., 2007), we split each class to the first 10,000 images as train and the last 2,500 as test.
|
| 265 |
+
|
| 266 |
+
Small datasets: To further extend our results, we compared the methods on a number of small datasets from different domains. MvTec (Bergmann et al., 2019): This dataset contains 15 different industrial products, with normal images of proper products for train and $1 - 9$ types of manufacturing errors as anomalies. The anomalies in MvTec are in-class i.e. the anomalous images come from the same class of normal images with subtle variations. DIOR (Li et al., 2020): We pre-processed the DIOR aerial image dataset by taking the segmented object in classes that have more than 50 images with size larger than $1 2 0 \times 1 2 0$ pixels.
|
| 267 |
+
|
| 268 |
+
# A.1.2 BASELINES
|
| 269 |
+
|
| 270 |
+
DROC (Sohn et al., 2020): We used the numbers reported in the paper.
|
| 271 |
+
|
| 272 |
+
For the evaluation of the other competing method, we trained using the official repositories of their authors and make an effort to select the best configurations available.
|
| 273 |
+
|
| 274 |
+
DeepSVDD (Ruff et al., 2018): We resize all the images to $3 2 \times 3 2$ pixels and use the official pyTorch implementation with the CIFAR-10 configuration.
|
| 275 |
+
|
| 276 |
+
MHRot (Hendrycks et al., 2019): An improved version of the original RotNet approach. For high-resolution images we used the current GitHub implementation. For low resolution images, we modified the code to the architecture described in the paper, replicating the numbers in the paper on CIFAR-10.
|
| 277 |
+
|
| 278 |
+
CSI (Tack et al., 2020), PANDA (Reiss et al., 2021): We run the code and used the exact protocol as described in the official repositories.
|
| 279 |
+
|
| 280 |
+
# A.1.3 IMPLEMENTATION DETAILS
|
| 281 |
+
|
| 282 |
+
We fine-tune the two last blocks of an ImageNet pre-trained ResNet152 with an additional $\ell _ { 2 }$ normalization layer for 25 epochs by minimizing $\mathcal { L } _ { m s c }$ where the temperature $\tau$ is set as 0.25. We use SGD optimizer with weight decay of $w = 5 \cdot 1 0 ^ { - 5 }$ , and no momentum. The size of the mini-batches is set to be 64. We adopt the data augmentation module proposed by Chen et al. (2020b); we sequentially apply a $2 2 4 \times 2 2 4$ -pixel crop from a randomly resized image, random color jittering, random grayscale conversion, random Gaussian blur and random horizontal flip. Finally, for anomaly scoring we use kNN with $k = 2$ nearest neighbours.
|
| 283 |
+
|
| 284 |
+
# A.1.4 TRAINING RESOURCES
|
| 285 |
+
|
| 286 |
+
Training each dataset class presented in this paper takes approximately 3 hours on a single NVIDIA RTX-2080 TI.
|
| 287 |
+
|
| 288 |
+
# A.1.5 PER-CLASS RESULTS
|
| 289 |
+
|
| 290 |
+
In Tab. 6, Tab. 7, Tab.8 we present the per-class results of CIFAR-10, CIFAR-100, CatsVsDogs respectively.
|
| 291 |
+
|
| 292 |
+
Table 6: CIFAR-10 anomaly detection performance (mean ROC-AUC $\%$ ). Bold denotes the best results.
|
| 293 |
+
|
| 294 |
+
<table><tr><td></td><td>DeepSVDD</td><td>MHRot</td><td>DROC</td><td>CSI</td><td>PANDA</td><td>Ours</td></tr><tr><td>0</td><td>61.7</td><td>77.5</td><td>90.9</td><td>89.9</td><td>97.4</td><td>97.0</td></tr><tr><td>1</td><td>65.9</td><td>96.9</td><td>98.9</td><td>99.1</td><td>98.4</td><td>98.7</td></tr><tr><td>2</td><td>50.8</td><td>87.3</td><td>88.1</td><td>93.1</td><td>93.9</td><td>94.8</td></tr><tr><td>3</td><td>59.1</td><td>80.9</td><td>83.1</td><td>86.4</td><td>90.6</td><td>94.3</td></tr><tr><td>4</td><td>60.9</td><td>92.7</td><td>89.9</td><td>93.9</td><td>97.5</td><td>96.9</td></tr><tr><td>5</td><td>65.7</td><td>90.2</td><td>90.3</td><td>93.2</td><td>94.4</td><td>97.2</td></tr><tr><td>6</td><td>67.7</td><td>90.9</td><td>93.5</td><td>95.1</td><td>97.5</td><td>98.2</td></tr><tr><td>7</td><td>67.3</td><td>96.5</td><td>98.2</td><td>98.7</td><td>97.5</td><td>98.3</td></tr><tr><td>8</td><td>75.9</td><td>95.2</td><td>96.5</td><td>97.9</td><td>97.6</td><td>98.5</td></tr><tr><td>9</td><td>73.1</td><td>93.3</td><td>95.2</td><td>95.5</td><td>97.4</td><td>98.3</td></tr><tr><td>Mean</td><td>64.8</td><td>90.1</td><td>92.5</td><td>94.3</td><td>96.2</td><td>97.2</td></tr></table>
|
| 295 |
+
|
| 296 |
+
Table 7: CIFAR-100 coarse-grained version anomaly detection performance (mean ROC-AUC $\%$ ). Bold denotes the best results.
|
| 297 |
+
|
| 298 |
+
<table><tr><td></td><td>DeepSVDD</td><td>MHRot</td><td>DROC</td><td>CSI</td><td>PANDA</td><td>Ours</td></tr><tr><td>0</td><td>66.0</td><td>77.6</td><td>82.9</td><td>86.3</td><td>91.5</td><td>96.0</td></tr><tr><td>1</td><td>60.1</td><td>72.8</td><td>84.3</td><td>84.8</td><td>92.6</td><td>95.3</td></tr><tr><td>2</td><td>59.2</td><td>71.9</td><td>88.6</td><td>88.9</td><td>98.3</td><td>98.1</td></tr><tr><td>3</td><td>58.7</td><td>81.0</td><td>86.4</td><td>85.7</td><td>96.6</td><td>97.9</td></tr><tr><td>4</td><td>60.9</td><td>81.1</td><td>92.6</td><td>93.7</td><td>96.3</td><td>97.6</td></tr><tr><td>5</td><td>54.2</td><td>66.7</td><td>84.5</td><td>81.9</td><td>94.1</td><td>96.8</td></tr><tr><td>6</td><td>63.7</td><td>87.9</td><td>73.4</td><td>91.8</td><td>96.4</td><td>98.5</td></tr><tr><td>7</td><td>66.1</td><td>69.4</td><td>84.2</td><td>83.9</td><td>91.2</td><td>93.4</td></tr><tr><td>8</td><td>74.8</td><td>86.8</td><td>87.7</td><td>91.6</td><td>94.7</td><td>97.2</td></tr><tr><td>9</td><td>78.3</td><td>91.7</td><td>94.1</td><td>95.0</td><td>94.0</td><td>96.2</td></tr><tr><td>10</td><td>80.4</td><td>87.3</td><td>85.2</td><td>94.0</td><td>96.4</td><td>97.1</td></tr><tr><td>11</td><td>68.3</td><td>85.4</td><td>87.8</td><td>90.1</td><td>92.6</td><td>96.4</td></tr><tr><td>12</td><td>75.6</td><td>85.1</td><td>82.0</td><td>90.3</td><td>93.1</td><td>95.8</td></tr><tr><td>13</td><td>61.0</td><td>60.3</td><td>82.7</td><td>81.5</td><td>89.4</td><td>92.6</td></tr><tr><td>14</td><td>64.3</td><td>92.7</td><td>93.4</td><td>94.4</td><td>98.0</td><td>99.0</td></tr><tr><td>15</td><td>66.3</td><td>70.4</td><td>75.8</td><td>85.6</td><td>89.7</td><td>92.5</td></tr><tr><td>16</td><td>72.0</td><td>78.3</td><td>80.3</td><td>83.0</td><td>92.1</td><td>95.2</td></tr><tr><td>17</td><td>75.9</td><td>93.5</td><td>97.5</td><td>97.5</td><td>97.7</td><td>98.4</td></tr><tr><td>18</td><td>67.4</td><td>89.6</td><td>94.4</td><td>95.9</td><td>94.7</td><td>97.6</td></tr><tr><td>19</td><td>65.8</td><td>88.1</td><td>92.4</td><td>95.2</td><td>92.7</td><td>97.0</td></tr><tr><td>Mean</td><td>67.0</td><td>80.1</td><td>86.5</td><td>89.6</td><td>94.1</td><td>96.4</td></tr></table>
|
| 299 |
+
|
| 300 |
+
Table 8: CatsVsDogs anomaly detection performance (mean ROC-AUC $\%$ ). Bold denotes the best results.
|
| 301 |
+
|
| 302 |
+
<table><tr><td></td><td>DeepSVDD</td><td>MHRot</td><td>DROC</td><td>CSI</td><td>PANDA</td><td>Ours</td></tr><tr><td>Cat</td><td>49.2</td><td>87.7</td><td>91.7</td><td>85.7</td><td>99.2</td><td>99.4</td></tr><tr><td>Dog</td><td>51.8</td><td>84.2</td><td>87.5</td><td>86.9</td><td>95.4</td><td>99.2</td></tr><tr><td>Mean</td><td>50.5</td><td>86.0</td><td>89.6</td><td>86.3</td><td>97.3</td><td>99.3</td></tr></table>
|
| 303 |
+
|
| 304 |
+

|
| 305 |
+
Figure 6: CIFAR-10 Mean ROC-AUC $\%$ . Catastrophic collapse of various objective functions.
|
| 306 |
+
|
| 307 |
+
# A.2 CATASTROPHIC COLLAPSE
|
| 308 |
+
|
| 309 |
+
In Fig. 6, we evaluated the collapse of different training objectives averaged on all CIFAR-10 classes. We notice that the contrastive loss is unsuitable for OCC feature adaptation as it results in very fast catastrophic collapse. PANDA-ES (early-stopping) results in initial improvement in accuracy, but after few epochs the features degrade and become uninformative. PANDA-EWC postpones the collapse, but does not prevent it. Finally, we see that the mean-shifted contrastive loss dominates PANDA at any point in the curve and collapses much more slowly. We find that early stopping after 25 iterations typically gets very close to the optimal accuracy.
|
| 310 |
+
|
| 311 |
+
# A.3 THE TEMPERATURE PARAMETER AND UNIFORMITY
|
| 312 |
+
|
| 313 |
+
The temperature $\tau$ has an important role in the contrastive objective. It was previously shown by Wang & Liu (2021) that it influences both the uniformity of sample distribution on the hypersphere and the weight given to hard negative samples. When the temperature approaches infinity, the model pays equal attention to the negative samples and when it approaches zero, the model ignores all the negative samples but the one with the maximum similarity. Based on this analysis, as the temperature increases, the feature space distribution tends to be less uniform, and when $\tau$ is small, the feature space distribution is closer to a uniform distribution. This suggests that using a small temperature parameter while optimizing the standard contrastive objective would solve the optimization dynamics failure that the above suffers from. This in fact not the case, in Fig. 7.a we present an ablation study of different temperature parameters while optimizing the standard contrastive loss. We observe that using a smaller $\tau$ slightly helps uniformity but not enough to make the optimization focus on improving the features so that they are invariant to augmentations, as catastrophic collapse still occurs (Fig. 7.b).
|
| 314 |
+
|
| 315 |
+
# A.4 NEGATIVE SAMPLES
|
| 316 |
+
|
| 317 |
+
In additional to contrastive self-supervised learning methods such as SimCLR (Chen et al., 2020a) and MoCo (He et al., 2019), other non-contrastive methods have been proposed (e.g. BYOL (Grill et al., 2020) and Sim-Siam (Chen & He, 2020)) which only use positive pairs but no negative pairs. We evaluated our method with Sim-Siam (using the mean-shifted representations), which is the same as using our loss without negative examples. We found that the method experiences an immediate catastrophic collapse. This indicates that negative examples are necessary for good performance when using mean-shifted representations. To give some intuition, note that the Sim-Siam objective (with or without mean-shifted representations), can in fact be optimized by having all representations mapped to a constant value. Although it does not happen when Sim-Siam is initialized from scratch, it appears that in the OCC case, it does degrade to the trivial solution. This establishes the need for a contrastive approach.
|
| 318 |
+
|
| 319 |
+

|
| 320 |
+
Figure 7: CIFAR-10 "Airplane" class. Ablation study of different temperature parameters while optimizing standard contrastive loss and mean-shifted contrastive loss with $\tau = 0 . 2 5$ . $( a )$ Similarity between pairs of images. $( b )$ The standard contrastive objective is unsuitable for OCC feature adaptation as it results in very fast catastrophic collapse independently of the chosen $\tau$ .
|
md/dev/taQ64d2KBX/taQ64d2KBX.md
ADDED
|
@@ -0,0 +1,530 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Learning Dynamical Systems from Noisy Data with Inverse-Explicit Integrators
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 We introduce the mean inverse integrator (MII), a novel approach to increase the
|
| 11 |
+
2 accuracy when training neural networks to approximate vector fields of dynamical
|
| 12 |
+
3 systems from noisy data. This method can be used to average multiple trajectories
|
| 13 |
+
4 obtained by numerical integrators such as Runge–Kutta methods. We show that the
|
| 14 |
+
5 class of mono-implicit Runge–Kutta methods (MIRK) has particular advantages
|
| 15 |
+
6 when used in connection with MII. When training vector field approximations,
|
| 16 |
+
7 explicit expressions for the loss functions are obtained when inserting the training
|
| 17 |
+
8 data in the MIRK formulae, unlocking symmetric and high order integrators that
|
| 18 |
+
9 would otherwise be implicit for initial value problems. The combined approach
|
| 19 |
+
10 of applying MIRK within MII yields a significantly lower error compared to the
|
| 20 |
+
11 plain use of the numerical integrator without averaging the trajectories. This is
|
| 21 |
+
12 demonstrated with experiments using data from several (chaotic) Hamiltonian
|
| 22 |
+
13 systems. Additionally, we perform a sensitivity analysis of the loss functions under
|
| 23 |
+
14 normally distributed perturbations, supporting the favourable performance of MII.
|
| 24 |
+
|
| 25 |
+
# 15 1 Introduction
|
| 26 |
+
|
| 27 |
+
16 Recently, many deep learning methodologies have been introduced to increase the efficiency and
|
| 28 |
+
17 quality of scientific computations [1, 2, 3, 4]. In physics-informed machine learning, deep neural
|
| 29 |
+
18 networks are purposely built so to enforce physical laws. As an example, Hamiltonian neural networks
|
| 30 |
+
19 (HNNs) [5] aim at learning the Hamiltonian function from temporal observations. The Hamiltonian
|
| 31 |
+
20 formalism was derived within classical mechanics for modelling a wide variety of physical systems.
|
| 32 |
+
21 The temporal evolution of such systems is fully determined when the Hamiltonian function is known,
|
| 33 |
+
22 and it is characterized by geometric properties such as the preservation of energy, the symplectic
|
| 34 |
+
23 structure and the time-reversal symmetry of the flow [6, 7].
|
| 35 |
+
24 Numerical integrators that compute solutions preserving such properties are studied in the field of
|
| 36 |
+
25 geometric numerical integration $\boxed { 7 } \boxed { 8 } \boxed { }$ . Thus, deep learning, classical mechanics and geometric
|
| 37 |
+
26 numerical integration are all relevant to the development of HNNs. In this work, we try to identify
|
| 38 |
+
27 the optimal strategy for using numerical integrators when constructing loss functions for HNNs that
|
| 39 |
+
28 are trained on noisy and sparse data.
|
| 40 |
+
29 Generally, we aim at learning autonomous systems of first-order ordinary differential equations
|
| 41 |
+
30 (ODE)
|
| 42 |
+
|
| 43 |
+
$$
|
| 44 |
+
{ \frac { d } { d t } } y = f ( y ( t ) ) , \quad y : [ 0 , T ] \to \mathbb { R } ^ { n } .
|
| 45 |
+
$$
|
| 46 |
+
|
| 47 |
+
31 In the traditional setting, solving an initial value problem (IVP) means computing approximated
|
| 48 |
+
32 solutions $y _ { n } \approx y ( t _ { n } )$ when the vector field $f ( y )$ and an initial value $y ( t _ { 0 } ) \stackrel { = } { = } y _ { 0 }$ are known. The
|
| 49 |
+
33 focus of our study is the corresponding inverse problem; assuming knowledge of multiple noisy
|
| 50 |
+
34 samples of the solution, $S _ { N } = \{ \tilde { y } _ { n } \} _ { n = 0 } ^ { N }$ , the aim is to approximate the vector field $f$ with a neural
|
| 51 |
+
|
| 52 |
+
35 network model $f _ { \theta }$ . We will assume that the observations originate from a (canonical) Hamiltonian system, with a Hamiltonian 36 $H : \mathbb { R } ^ { 2 d } \mathbb { R }$ , where the vector field is given by
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
f ( y ) = J \nabla H ( y ( t ) ) , \quad J : = \left[ \begin{array} { l l } { 0 } & { I } \\ { - I } & { 0 } \end{array} \right] \in \mathbb { R } ^ { 2 d \times 2 d } .
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
37 This allows for learning the Hamiltonian function directly by setting $f _ { \theta } ( y ) = J \nabla H _ { \theta } ( y )$ , as proposed
|
| 59 |
+
38 initially in $ { \mathbb { I } } ^ { { \left[ 5 \right] } }$ .
|
| 60 |
+
39 Recently, many works highlight the benefit of using symplectic integrators when learning Hamiltonian
|
| 61 |
+
40 neural networks [9, 10, 11, 12]. Here, we study what happens if, instead of using symplectic methods,
|
| 62 |
+
41 efficient and higher-order MIRK methods are applied for inverse problems. We develop different
|
| 63 |
+
42 approaches and apply them to learn highly oscillatory and chaotic dynamical systems from noisy data.
|
| 64 |
+
43 The methods are general, they are not limited to separable Hamiltonian systems, and could indeed be
|
| 65 |
+
44 used to learn any first-order ODE. However we focus our study on Hamiltonian systems, in order to
|
| 66 |
+
45 build on the latest research on HNNs. Specifically, we compare our methods to the use of symplectic
|
| 67 |
+
46 integrators to train Hamiltonian neural networks. Our contributions can be summarized as follows:
|
| 68 |
+
|
| 69 |
+
• We introduce the mean inverse integrator (MII), which efficiently averages trajectories of MIRK methods in order to increase accuracy when learning vector fields from noisy data (Definition 5.1).
|
| 70 |
+
• We present an analysis of the sensitivity of the loss function to perturbations giving insight into when the MII method yields improvement over a standard one-step scheme (Theorem 5.2).
|
| 71 |
+
• We show that symplectic MIRK methods have at most order $p = 2$ (Theorem $\textcircled { 4 . 4 }$ . Particularly, the second-order implicit midpoint method is the symplectic MIRK method with minimal number of stages.
|
| 72 |
+
|
| 73 |
+
56 Finally, numerical experiments on several Hamiltonian systems benchmark MII against one-step
|
| 74 |
+
57 training and symplectic recurrent neural networks (SRNN) $\mathbb { \ m }$ , which rely on the Störmer–Verlet
|
| 75 |
+
58 integrator. The structural difference between these three approached is presented in Figure $\mathscr { L }$ Ad
|
| 76 |
+
59 ditionally, we demonstrate that substituting Störmer–Verlet with the classic Runge–Kutta method
|
| 77 |
+
60 (RK4) in the SRNN framework yields significant reduction in error and allows accurate learning of
|
| 78 |
+
61 non-separable Hamiltonian systems.
|
| 79 |
+
|
| 80 |
+
# 62 2 Related work
|
| 81 |
+
|
| 82 |
+
63 Hamiltonian neural networks was introduced in [5]. The numerical integration of Hamiltonian ODEs
|
| 83 |
+
64 and the preservation of the symplectic structure of the ODE flow under numerical discretization
|
| 84 |
+
65 have been widely studied over several decades [8, 7]. The symplecticity property is key and could
|
| 85 |
+
66 inform the neural network architecture $\mathbb { \lVert \lambda \rVert }$ or guide the choice of numerical integrator, yielding a
|
| 86 |
+
67 theoretical guarantee that the learning target is actually a (modified) Hamiltonian vector field [14, 9],
|
| 87 |
+
68 building on the backward error analysis framework $\pmb { \mathbb { B } } ] \mathbf { l }$ . Discrete gradients is an approach to numerical
|
| 88 |
+
69 integration that guarantees exact preservation of the (learned) Hamiltonian, and an algorithm for
|
| 89 |
+
70 training Hamiltonian neural networks using discrete gradient integrators is developed in $\mathbb { \lVert 1 5 \rVert }$ and
|
| 90 |
+
71 extended to higher order in $\mathbb { \left[ \left[ 1 6 \right] \right] }$ .
|
| 91 |
+
72 Since we for the inverse problem want to approximate the time-derivative of the solution, $f$ , using
|
| 92 |
+
73 only ${ \tilde { y } } _ { n }$ , we need to use a numerical integrator when specifying the neural network loss function.
|
| 93 |
+
74 For learning dynamical systems from data, explicit methods such as RK4 are much used $\boxed { 5 } \boxed { 1 7 } \boxed { 1 8 }$ .
|
| 94 |
+
75 However, explicit methods cannot in general preserve time-symmetry or symplecticity, and they often
|
| 95 |
+
76 have worse stability properties compared to implicit methods [19]. Assuming that the underlying
|
| 96 |
+
77 Hamiltonian is separable allows for explicit integration with the symplectic Störmer–Verlet method,
|
| 97 |
+
78 which is exploited in $\mathbb { n o , 2 o }$ . Symplecticity could be achieved without the limiting assumption
|
| 98 |
+
79 of separability by training using the implicit midpoint method $[ \mathbb { 1 2 } ]$ . As pointed out in $\mathbb { \lVert 1 2 \rVert }$ , this
|
| 99 |
+
80 integrator could be turned into an explicit method in training by inserting sequential training data ${ \tilde { y } } _ { n }$
|
| 100 |
+
81 and $\tilde { y } _ { n + 1 }$ . In fact, the MIRK class $\pm 2 1 1 2 2 1 1$ contains all Runge–Kutta (RK) methods (including the
|
| 101 |
+
82 midpoint method) that could be turned into explicit schemes when inserting the training data. This
|
| 102 |
+
83 is exploited in $\dot { \left[ \left| 2 3 \right| \right] }$ , where high-order MIRK methods are used to train HNNs, achieving accurate
|
| 103 |
+
84 interpolation and extrapolation of a single trajectory with large step size, few samples and assuming
|
| 104 |
+
85 zero noise.
|
| 105 |
+
86 The assumption of noise-free data limits the potential of learning from physical measurements
|
| 106 |
+
87 or applications on data sets from industry. This issue is addressed in $\mathbb { m }$ , presenting symplectic
|
| 107 |
+
88 recurrent neural networks (SRNN). Here, Störmer–Verlet is used to integrate multiple steps and is
|
| 108 |
+
89 combined with initial state optimization (ISO) before computing the loss. ISO is applied after training
|
| 109 |
+
90 $f _ { \theta }$ a given number of epochs and aims at finding the optimal initial value $\hat { y } _ { 0 }$ , such that the distance
|
| 110 |
+
91 to the subsequent observed points $\tilde { y } _ { 1 } , \dots , \tilde { y } _ { N }$ is minimized when integrating over $f _ { \theta }$ . While $\mathbb { \ m }$ i s
|
| 111 |
+
92 limited by only considering separable systems, $\mathbb { \left[ \left[ 2 4 \right] \right] }$ aims at identifying the optimal combination of
|
| 112 |
+
93 third order polynomial basis functions to approximate a cubic non-separable Hamiltonian from noisy
|
| 113 |
+
94 data, using a Bayesian framework.
|
| 114 |
+
|
| 115 |
+
# 95 3 Background on numerical integration
|
| 116 |
+
|
| 117 |
+
96 Some necessary and fundamental concepts on numerical integration and the geometry of Hamiltonian
|
| 118 |
+
97 systems are presented below to inform the discussion on which integrators to use in inverse problems.
|
| 119 |
+
98 Further details could be found in Appendix C.
|
| 120 |
+
99 Fundamental concepts: An important subclass of the general first-order ODEs $( 1 )$ is the class of
|
| 121 |
+
100 Hamiltonian systems, as given by $( 2 )$ . Often, the solution is partitioned into the coordinates $y ( t ) =$
|
| 122 |
+
101 $[ q ( t ) , p ( t ) ] ^ { T }$ , with $q ( t ) , p ( t ) \in { \mathbb { R } } ^ { d }$ . A separable Hamiltonian system is one where the Hamiltonian
|
| 123 |
+
102 could be written as the sum of two scalar functions, often representing the kinetic and potential
|
| 124 |
+
103 energy, that depend only on $q$ and $p$ respectively, this means we have $H ( q , p ) = H _ { 1 } ( q ) + H _ { 2 } ( p )$ .
|
| 125 |
+
|
| 126 |
+
The 104 $h$ flow of an ODE is a map $\varphi _ { h , f } : \mathbb { R } ^ { n } \mathbb { R } ^ { n }$ sending an initial value $y ( t _ { 0 } )$ to the solution 105 of the ODE at time $t _ { 0 } + h$ , given by $\varphi _ { h , f } ( y ( t _ { 0 } ) ) : = y ( t _ { 0 } + h )$ . A numerical integration method 106 $\Phi _ { h , f } : \mathbb { R } ^ { n } \mathbb { R } ^ { n }$ is a map approximating the exact flow of the ODE, so that
|
| 127 |
+
|
| 128 |
+
$$
|
| 129 |
+
y ( t _ { 1 } ) \approx y _ { 1 } = \Phi _ { h , f } ( y _ { 0 } ) .
|
| 130 |
+
$$
|
| 131 |
+
|
| 132 |
+
107 Here, $y ( t _ { n } )$ represents the exact solution and we denote with $y _ { n }$ the approximation at time $t _ { n } =$
|
| 133 |
+
108 $t _ { 0 } + n h$ . It should be noted that the flow map satisfies the following group property:
|
| 134 |
+
|
| 135 |
+
$$
|
| 136 |
+
\begin{array} { r } { \varphi _ { h _ { 1 } , f } \circ \varphi _ { h _ { 2 } , f } \bigl ( y ( t _ { 0 } ) \bigr ) = \varphi _ { h _ { 1 } , f } \bigl ( y ( t _ { 0 } + h _ { 2 } ) \bigr ) = \varphi _ { h _ { 1 } + h _ { 2 } , f } \bigl ( y ( t _ { 0 } ) \bigr ) . } \end{array}
|
| 137 |
+
$$
|
| 138 |
+
|
| 139 |
+
109 In other words, a composition of two flows with step sizes $h _ { 1 } , h _ { 2 }$ is equivalent to the flow map over $f$
|
| 140 |
+
110 with step size $h _ { 1 } + h _ { 2 }$ . This property is not shared by numerical integrators for general vector fields.
|
| 141 |
+
111 The order of a numerical integrator $\Phi _ { h , f }$ characterizes how the error after one step depends on the
|
| 142 |
+
112 step size $h$ and is given by the integer $p$ such that the following holds:
|
| 143 |
+
|
| 144 |
+
$$
|
| 145 |
+
\left\| y _ { 1 } - y ( t _ { 0 } + h ) \right\| = \| \Phi _ { h , f } ( y _ { 0 } ) - \varphi _ { h , f } ( y ( t _ { 0 } ) ) \| = \mathcal { O } ( h ^ { p + 1 } ) .
|
| 146 |
+
$$
|
| 147 |
+
|
| 148 |
+
113 Mono-implicit Runge–Kutta methods: Given vectors $b , v \in \mathbb { R } ^ { s }$ and a strictly lower triangular
|
| 149 |
+
114 matrix $D \in \mathbb { R } ^ { s \times s }$ , a MIRK method is a Runge–Kutta method where $A = D + v \dot { b } ^ { T } \mathbb { \lVert } 2 5 \mathbb { , } \mathbb { \lVert } 2 6 \rVert$ and we
|
| 150 |
+
115 assume that $[ A ] _ { i j } = a _ { i j }$ is the stage-coefficient matrix. This implies that the MIRK method can be
|
| 151 |
+
116 written on the form
|
| 152 |
+
|
| 153 |
+
$$
|
| 154 |
+
\begin{array} { c } { { y _ { n + 1 } = y _ { n } + h \displaystyle \sum _ { i = 1 } ^ { s } b _ { i } k _ { i } , } } \\ { { { } } } \\ { { k _ { i } = f \big ( y _ { n } + v _ { i } ( y _ { n + 1 } - y _ { n } ) + h \displaystyle \sum _ { j = 1 } ^ { s } d _ { i j } k _ { j } \big ) . } } \end{array}
|
| 155 |
+
$$
|
| 156 |
+
|
| 157 |
+
117 Specific MIRK methods and further details on Runge–Kutta schemes is discussed in Appendix C.2.
|
| 158 |
+
|
| 159 |
+
118 Symplectic methods: The flow map of a Hamiltonian system is symplectic, meaning that its Jacobian
|
| 160 |
+
119 $\begin{array} { r } { \dot { \Upsilon _ { \varphi } } : = \frac { \partial } { \partial y } \varphi _ { h , f } ( y ) } \end{array}$ satisfies $\Upsilon _ { \varphi } ^ { T } J \Upsilon _ { \varphi } = J$ , where $J$ is the same matrix as in $\textcircled { 2 }$ . As explained in $\mathbb { B } ,$ Ch.
|
| 161 |
+
120 VI.2], this is equivalent to the preservation of a projected area in the phase space of $[ q , p ] ^ { T }$ . Similarly,
|
| 162 |
+
121 a numerical integrator is symplectic if its Jacobian ⌥ := @@yn $\begin{array} { r } { \Upsilon _ { \Phi } : = \frac { \partial } { \partial y _ { n } } \Phi _ { h , f } ( y _ { n } ) } \end{array}$ satisfies $\Upsilon _ { \Phi } ^ { T } J \Upsilon _ { \Phi } = J$ . It is
|
| 163 |
+
122 possible to prove $\mathbb { B } ,$ Ch. VI.4] that a Runge–Kutta method is symplectic if and only if the coeffients
|
| 164 |
+
123 satisfy
|
| 165 |
+
|
| 166 |
+
$$
|
| 167 |
+
b _ { i } a _ { i j } + b _ { j } a _ { j i } - b _ { i } b _ { j } = 0 , \quad i , j = 1 , \ldots , s .
|
| 168 |
+
$$
|
| 169 |
+
|
| 170 |
+
125 We will now consider different ways to use numerical integrators when training Hamiltonian neural
|
| 171 |
+
126 networks and present important properties of MIRK methods, a key component of the MII that is
|
| 172 |
+
127 presented in Chapter 5.
|
| 173 |
+
128 Inverse ODE problems in Hamiltonian form: We assume to have potentially noisy samples
|
| 174 |
+
129 $S _ { N } = \{ \tilde { y } \} _ { n = 0 } ^ { N }$ of the solution of an ODE with vector field $f$ . The inverse problem can be formulated
|
| 175 |
+
130 as the following optimization problem:
|
| 176 |
+
|
| 177 |
+
$$
|
| 178 |
+
\underset { \theta } { \arg \operatorname* { m i n } } \sum _ { n = 0 } ^ { N - 1 } \bigg \| \tilde { y } _ { n + 1 } - \Phi _ { h , f _ { \theta } } ( \tilde { y } _ { n } ) \bigg \| ,
|
| 179 |
+
$$
|
| 180 |
+
|
| 181 |
+
131 where $\begin{array} { r l r } { f _ { \theta } } & { { } = } & { J \nabla H _ { \theta } } \end{array}$ is a neural network approximation with parameters $\theta$ of a Hamiltonian vector field 132 $f$ , and $\Phi _ { h , f _ { \theta } }$ is a one-step integration method with step length $h$
|
| 182 |
+
|
| 183 |
+
133 In the setting of inverse ODE problems, the availabil
|
| 184 |
+
134 ity of sequential points $S _ { N }$ could be exploited when
|
| 185 |
+
135 a numerical method is used to form interpolation
|
| 186 |
+
136 conditions, for $f _ { \theta } \approx f$ for each $n$ in the optimiza
|
| 187 |
+
137 tion problem $\textcircled{6}$ . For example, ${ \tilde { y } } _ { n }$ and $\tilde { y } _ { n + 1 }$ could
|
| 188 |
+
138 be inserted in the implicit midpoint method, turning
|
| 189 |
+
139 a method that is implicit for IVPs into an explicit
|
| 190 |
+
140 method for inverse problems:
|
| 191 |
+
|
| 192 |
+
$$
|
| 193 |
+
\Phi _ { h , f _ { \theta } } ( \tilde { y } _ { n } , \tilde { y } _ { n + 1 } ) = \tilde { y } _ { n } + h f _ { \theta } \big ( \frac { \tilde { y } _ { n } + \tilde { y } _ { n + 1 } } { 2 } \big ) .
|
| 194 |
+
$$
|
| 195 |
+
|
| 196 |
+
141 We denote this as the inverse injection, which defines
|
| 197 |
+
142 an inverse explicit property for numerical integrators.
|
| 198 |
+
|
| 199 |
+
Definition 4.1 (Inverse injection). Assume that $\tilde { y } _ { n } , \tilde { y } _ { n + 1 } \in \ S _ { N }$ . Let the inverse injection for the integrator $\Phi _ { h , f } \mathopen { } \mathclose \bgroup \left( y _ { n } , y _ { n + 1 } \aftergroup \egroup \right)$ be given by the substitution $( { \tilde { y } } _ { n } , { \tilde { y } } _ { n + 1 } ) ( y _ { n } , y _ { n + 1 } )$ such that
|
| 200 |
+
|
| 201 |
+

|
| 202 |
+
Figure 1: Venn diagram of Runge–Kutta (RK) subclasses: explicit RK (ERK), symplectic RK (SympRK), mono-implicit RK (MIRK) and symmetric RK (SymRK).
|
| 203 |
+
|
| 204 |
+
$$
|
| 205 |
+
\hat { y } _ { n + 1 } = \Phi _ { h , f } ( \tilde { y } _ { n } , \tilde { y } _ { n + 1 } ) .
|
| 206 |
+
$$
|
| 207 |
+
|
| 208 |
+
143 Definition 4.2 (Inverse explicit). A numerical one-step method $\Phi$ is called inverse explicit if it is
|
| 209 |
+
144 explicit under the inverse injection.
|
| 210 |
+
145 This procedure is utilized successfully by several authors when learning dynamical systems from
|
| 211 |
+
146 data, see e.g. $\mathbb { \oplus 1 2 , \bigstar \bigstar }$ . However, this work is the first attempt at systematically exploring numerical
|
| 212 |
+
147 integrators under the inverse injection, by identifying the MIRK methods as the class consisting of
|
| 213 |
+
148 inverse explicit Runge–Kutta methods.
|
| 214 |
+
|
| 215 |
+
149 Proposition 4.3. MIRK-methods are inverse explicit.
|
| 216 |
+
|
| 217 |
+
150 Proof. Since the matrix $D$ in $( 4 )$ is strictly lower triangular, the stages are given by
|
| 218 |
+
|
| 219 |
+
$$
|
| 220 |
+
\begin{array} { l } { { k _ { 1 } = f \big ( y _ { n } + v _ { i } \big ( y _ { n + 1 } - y _ { n } \big ) \big ) } } \\ { { k _ { 2 } = f \big ( y _ { n } + v _ { i } \big ( y _ { n + 1 } - y _ { n } \big ) + h d _ { 2 1 } k _ { 1 } \big ) } } \\ { { \ } } \\ { { \quad \vdots } } \\ { { k _ { s } = f \big ( y _ { n } + v _ { i } \big ( y _ { n + 1 } - y _ { n } \big ) + h \displaystyle \sum _ { j = 1 } ^ { s - 1 } d _ { s j } k _ { j } \big ) } } \end{array}
|
| 221 |
+
$$
|
| 222 |
+
|
| 223 |
+
meaning that if 151 $y _ { n }$ and $y _ { n + 1 }$ are known, all stages, and thus the next step $\begin{array} { r } { \hat { y } _ { n + 1 } = y _ { n } + h \sum _ { i = 1 } ^ { s } b _ { i } k _ { i } } \end{array}$ , 152 could be computed explicitly. □
|
| 224 |
+
|
| 225 |
+
153 Because of their explicit nature when applied to inverse ODE problems, MIRK methods are an
|
| 226 |
+
154 attractive alternative to explicit Runge–Kutta methods; in contrast to explicit RK methods, they
|
| 227 |
+
155 can be symplectic or symmetric, or both, without requiring the solution of systems of nonlinear
|
| 228 |
+
156 equations, even when the Hamiltonian is non-separable. Figure $^ 1$ illustrates the relation between
|
| 229 |
+
157 various subclasses and the specific methods are described in Table $\perp$ in Appendix $\boxed { \mathbf { C } }$ In addition,
|
| 230 |
+
158 for $s$ -stage MIRK methods, it is possible to construct methods of order $p = s + 1 \ P \ 2 \|$ . This is
|
| 231 |
+
159 in general higher order than what is possible to obtain with $s$ -stage explicit Runge–Kutta methods.
|
| 232 |
+
160 Further computational gains could also be made by reusing evaluations of the vector field between
|
| 233 |
+
161 multiple steps, which using MIRK methods allow for, as explained in Appendix $\mathrm { I } .$ The dependency
|
| 234 |
+
162 structure on the data $S _ { N }$ of explicit RK (ERK) methods, MIRK methods and the SRNN method $\bar { \mathbb { m } }$
|
| 235 |
+
163 is illustrated in Figure 2.
|
| 236 |
+
164 Maximal order of symplectic MIRK methods: From the preceding discussion, it is clear that
|
| 237 |
+
165 symplectic MIRK methods are of interest when learning Hamiltonian systems from data, since they
|
| 238 |
+
166 combine computational efficiency with the ability to preserve useful, geometric properties. Indeed,
|
| 239 |
+
167 symplectic integrators in the training of HNNs have been considered in [9, 10, 11, 12, 13]. The
|
| 240 |
+
168 subclass of symplectic MIRK methods is represented by the middle, dark blue field in the Venn
|
| 241 |
+
169 diagram of Figure $\bigstar$ The next result gives an order barrier for symplectic MIRK methods that was, to
|
| 242 |
+
170 the best of our knowledge, not known up to this point.
|
| 243 |
+
|
| 244 |
+

|
| 245 |
+
Figure 2: Differences of observation dependency, assuming $N = 2$ for explicit and mono-implicit one-step training, and explicit multi-step training with initial state optimization (green node $\hat { y } _ { 0 }$ ).
|
| 246 |
+
|
| 247 |
+
Theorem 4.4. The maximum order of a symplectic MIRK method is $p = 2$ .
|
| 248 |
+
|
| 249 |
+
172 Proof. This is a shortened version of the full proof, which can be found in Appendix $\mathrm { F } .$ A MIRK
|
| 250 |
+
173 method is a Runge–Kutta method with coefficients $a _ { i j } = d _ { i j } + v _ { i } b _ { j }$ . Requiring $d _ { i j } , { \overline { { b _ { i } } } }$ and $v _ { i }$ to
|
| 251 |
+
174 satisfy the symplecticity conditions of $( 5 )$ in addition to $D$ being strictly lower triangular, yields the
|
| 252 |
+
175 following restrictions
|
| 253 |
+
|
| 254 |
+
$$
|
| 255 |
+
\begin{array} { r } { b _ { i } d _ { i j } + b _ { i } b _ { j } ( v _ { j } + v _ { i } - 1 ) = 0 , \quad \mathrm { i f ~ } i \neq j , } \\ { b _ { i } = 0 \mathrm { o r } v _ { i } = \cfrac { 1 } { 2 } , \quad \mathrm { i f ~ } i = j , } \\ { d _ { i j } = 0 , \quad \mathrm { i f ~ } i > j . } \end{array}
|
| 256 |
+
$$
|
| 257 |
+
|
| 258 |
+
176 These restrictions result in an RK method that could be reduced to choosing a coefficient vector
|
| 259 |
+
177 $b \in \mathbb { R } ^ { s }$ and choosing stages on the form $\begin{array} { r } { k _ { i } = f \big ( y _ { n } + \frac { h } { 2 } \sum _ { j } ^ { s } b _ { j } k _ { j } \big ) } \end{array}$ for $i = 1 , \dots , s$ . It is then trivial
|
| 260 |
+
178 to check that this method can only be of up to order $p = 2$ . Note that for $s = 1$ and $b _ { 1 } = 1$ we get the
|
| 261 |
+
179 midpoint method. □
|
| 262 |
+
180 Numerical integrators outside the RK class: While this paper is mainly concerned with MIRK
|
| 263 |
+
181 methods, several other types of numerical integrators could be of interest for inverse problems.
|
| 264 |
+
182 Partitioned Runge–Kutta methods are an extension and not a subclass of RK methods, and can
|
| 265 |
+
183 be symplectic and symmetric, while also being explicit for separable Hamiltonian systems. The
|
| 266 |
+
184 Störmer–Verlet integrator of order $p = 2$ is one example. Higher order methods of this type are
|
| 267 |
+
185 derived in $\lVert \rVert$ and used for learning Hamiltonian systems in [29, 30]. Discrete gradient methods
|
| 268 |
+
186 [31, $\textcircled { 3 2 } \textcircled { }$ are inverse explicit and well suited to train Hamiltonian neural networks using a modified
|
| 269 |
+
187 automatic differentiation algorithm $\mathbb { \left. \boldsymbol { \cdot } \boldsymbol { \cdot } \right. }$ . This method could be extended to higher order methods as
|
| 270 |
+
188 shown in $\mathbb { \lVert 1 6 \rVert }$ . In contrast to symplectic methods, discrete gradient methods preserve the Hamiltonian
|
| 271 |
+
189 exactly up to machine precision. A third option is elementary differential Runge–Kutta methods $\pmb { \Vert 3 3 } \Vert$ ,
|
| 272 |
+
190 where for instance $\bar { \big \| } \bar { 3 4 } \bar { \big \| }$ show how to use backward error analysis to construct higher order methods
|
| 273 |
+
191 from modifications to the midpoint method. This topic is discussed further in Appendix $\mathbb { H } ,$ where we
|
| 274 |
+
192 also present a novel, symmetric discrete gradient method of order $p = 4$ .
|
| 275 |
+
|
| 276 |
+
# 5 Mean inverse integrator for handling noisy data
|
| 277 |
+
|
| 278 |
+
94 Noisy ODE sample: It is often the case that the samples $S _ { N }$ are not exact measurements of the
|
| 279 |
+
95 system, but perturbed by noise. In this paper, we model the noise as independent, normally distributed
|
| 280 |
+
|
| 281 |
+
$$
|
| 282 |
+
\tilde { y } _ { n } = y ( t _ { n } ) + \delta _ { n } , \quad \delta _ { n } \sim \mathcal { N } ( 0 , \sigma ^ { 2 } I ) ,
|
| 283 |
+
$$
|
| 284 |
+
|
| 285 |
+
197 where ${ \mathcal { N } } ( 0 , \sigma ^ { 2 } I )$ represents the multivariate normal distribution. With this assumption, a standard
|
| 286 |
+
198 result from statistics tells us that the variance of a sample-mean estimator with $N$ samples converges
|
| 287 |
+
199 to zero at the rate of $\textstyle { \frac { 1 } { N } }$ . That is, assuming that we have $N$ samples $\tilde { y } _ { n } ^ { ( 1 ) } , \dots , \tilde { y } _ { n } ^ { ( N ) }$ , then
|
| 288 |
+
|
| 289 |
+
$$
|
| 290 |
+
\mathrm { V a r } [ \overline { { y } } _ { n } ] = \mathrm { V a r } \bigg [ \frac { 1 } { N } \sum _ { j = 1 } ^ { N } \tilde { y } _ { n } ^ { ( j ) } \bigg ] = \frac { \sigma ^ { 2 } } { N } .
|
| 291 |
+
$$
|
| 292 |
+
|
| 293 |
+
200 Using the inverse injection with the midpoint method, the vector field is evaluated in the average of
|
| 294 |
+
201 ${ \tilde { y } } _ { n }$ and $\tilde { y } _ { n + 1 }$ , reducing the variance of the perturbation by a factor of two, compared to evaluating the
|
| 295 |
+
202 vector field in ${ \tilde { y } } _ { n }$ , as is done in all explicit RK methods. Furthermore, considering the whole data
|
| 296 |
+
203 trajectory $S _ { N }$ , multiple independent approximations to the same point $y ( t _ { n } )$ can enable an even more
|
| 297 |
+
204 accurate estimate. This is demonstrated in the analysis presented in Theorem $\underline { { \boldsymbol { \mathsf { F } } . 2 } }$ and in Figure 4.
|
| 298 |
+
205 Averaging multiple trajectories: In the inverse ODE problem, we assume that there exists an exact
|
| 299 |
+
206 vector field $f$ whose flow interpolates the discrete trajectories $S _ { N }$ , and the flow of this vector field
|
| 300 |
+
207 satisfies the group property $( 3 )$ . The numerical flow $\Phi _ { h , f }$ for a method of order $p$ satisfies this
|
| 301 |
+
208 property only up to an error $\mathcal { O } ( h ^ { p + 1 } )$ over one step. In the presence of noisy data, compositions of
|
| 302 |
+
209 one-step methods can be used to obtain multiple different approximations to the same point $y ( t _ { n } )$ ,
|
| 303 |
+
210 by following the numerical flow from different nearby initial values ${ \tilde { y } } _ { j } , j \neq n$ , and thus reduce the
|
| 304 |
+
211 noise by averaging over these multiple approximations. Accumulation of the local truncation error is
|
| 305 |
+
212 expected when relying on points further away from $t _ { n }$ . However, for sufficiently small step sizes $h$
|
| 306 |
+
213 compared to the size of the noise $\sigma$ , one can expect increased accuracy when averaging over multiple
|
| 307 |
+
214 noisy samples.
|
| 308 |
+
215 As an example, assume that we know the points $\{ \tilde { y } _ { 0 } , \tilde { y } _ { 1 } , \tilde { y } _ { 2 } , \tilde { y } _ { 3 } \}$ . Then $y ( t _ { 2 } )$ can be approximated by
|
| 309 |
+
216 computing the mean of the numerical flows $\Phi _ { h , f }$ starting from different initial values:
|
| 310 |
+
|
| 311 |
+
$$
|
| 312 |
+
\begin{array} { r l r } { { \overline { { y } } _ { 2 } = \frac { 1 } { 3 } \big ( \Phi _ { h , f } ( \tilde { y } _ { 1 } ) + \Phi _ { h , f } \circ \Phi _ { h , f } ( \tilde { y } _ { 0 } ) + \Phi _ { - h , f } ^ { * } ( \tilde { y } _ { 3 } ) \big ) } } \\ & { } & { \approx \frac { 1 } { 3 } \big ( \tilde { y } _ { 0 } + \tilde { y } _ { 1 } + \tilde { y } _ { 3 } + h ( \Psi _ { 0 , 1 } + 2 \Psi _ { 1 , 2 } - \Psi _ { 2 , 3 } ) \big ) , } \end{array}
|
| 313 |
+
$$
|
| 314 |
+
|
| 315 |
+
where we by 217 $\Phi ^ { * }$ mean the adjoint method of $\Phi$ , as defined in $\pmb { \Vert 8 }$ Ch. V], and we let $\Psi _ { n , n + 1 }$ be the 218 increment of an inverse-explicit numerical integrator, so that
|
| 316 |
+
|
| 317 |
+
$$
|
| 318 |
+
\Phi _ { h , f } ( \tilde { y } _ { n } , \tilde { y } _ { n + 1 } ) = \tilde { y } _ { n } + h \Psi _ { n , n + 1 } .
|
| 319 |
+
$$
|
| 320 |
+
|
| 321 |
+
219 For example, for the midpoint method, we have that $\begin{array} { r } { \Psi _ { n , n + 1 } = f ( \frac { \tilde { y } _ { n } + \tilde { y } _ { n + 1 } } { 2 } ) } \end{array}$ . When stepping in
|
| 322 |
+
220 negative time in $( 1 0 )$ , we use the adjoint method in order to minimize the number of vector field
|
| 323 |
+
221 evaluations, also when non-symmetric methods are used (which implies that we always use e.g. $\Psi _ { 1 , 2 }$
|
| 324 |
+
222 and not $\Psi _ { 2 , 1 } )$ . Note that in order to derive the approximation in $\mathbf { \bar { \rho } } ( 1 0 )$ , repeated use of the inverse
|
| 325 |
+
223 injection allows the known points ${ \tilde { y } } _ { n }$ to form an explicit integration procedure, where composition
|
| 326 |
+
224 of integration steps are approximated by summation over increments $\Psi _ { n , n + 1 }$ . This approximation
|
| 327 |
+
225 procedure is presented in greater detail in Appendix D.
|
| 328 |
+
226 Mean inverse integrator: The mean approximation over the whole trajectory ${ \overline { { y } } } _ { n }$ , for $n = 0 , \ldots , N$ ,
|
| 329 |
+
227 could be computed simultaneously, reusing multiple vector field evaluations in an efficient manner.
|
| 330 |
+
228 This leads to what we call the mean inverse integrator. For example, when $N = 3$ we get
|
| 331 |
+
|
| 332 |
+
$$
|
| 333 |
+
\left[ \begin{array} { c } { \overline { { y } } _ { 0 } } \\ { \overline { { y } } _ { 1 } } \\ { \overline { { y } } _ { 2 } } \\ { \overline { { y } } _ { 3 } } \end{array} \right] = \frac { 1 } { 3 } \left[ \begin{array} { c c c c } { 0 } & { 1 } & { 1 } & { 1 } \\ { 1 } & { 0 } & { 1 } & { 1 } \\ { 1 } & { 1 } & { 0 } & { 1 } \\ { 1 } & { 1 } & { 1 } & { 0 } \end{array} \right] \left[ \begin{array} { c } { \widetilde { y } _ { 0 } } \\ { \widetilde { y } _ { 1 } } \\ { \widetilde { y } _ { 2 } } \\ { \widetilde { y } _ { 3 } } \end{array} \right] + \frac { h } { 3 } \left[ \begin{array} { c c c c } { - 3 } & { - 2 } & { - 1 } \\ { 1 } & { - 2 } & { - 1 } \\ { 1 } & { 2 } & { - 1 } \\ { 1 } & { 2 } & { 3 } \end{array} \right] \left[ \begin{array} { c } { \Psi _ { 0 , 1 } } \\ { \Psi _ { 1 , 2 } } \\ { \Psi _ { 2 , 3 } } \end{array} \right] ,
|
| 334 |
+
$$
|
| 335 |
+
|
| 336 |
+
229 and the same structure is illustrated in Figure 3.
|
| 337 |
+
|
| 338 |
+
230 Definition 5.1 (Mean inverse integrator). For a sample $S _ { N }$ and an inverse-explicit integrator $\Psi _ { n , n + 1 }$ ,
|
| 339 |
+
231 the mean inverse integrator is given by
|
| 340 |
+
|
| 341 |
+
$$
|
| 342 |
+
\overline { { Y } } = \frac { 1 } { N } \bigg ( U \tilde { Y } + h W \Psi \bigg )
|
| 343 |
+
$$
|
| 344 |
+
|
| 345 |
+
$$
|
| 346 |
+
\tilde { Y } : = [ \tilde { y } _ { 0 } , \dotsc , \tilde { y } _ { N } ] ^ { T } \in \mathbb { R } ^ { ( N + 1 ) \times m } , \Psi : = [ \Psi _ { 0 , 1 } , \dotsc , \Psi _ { N - 1 , N } ] ^ { T } \in \mathbb { R } ^ { N \times m } .
|
| 347 |
+
$$
|
| 348 |
+
|
| 349 |
+
Finally, 233 $U \in \mathbb { R } ^ { ( N + 1 ) \times ( N + 1 ) }$ and $W \in \mathbb { R } ^ { ( N + 1 ) \times N }$ are given by
|
| 350 |
+
|
| 351 |
+
$$
|
| 352 |
+
[ U ] _ { i j } : = \left\{ \begin{array} { l l } { 0 } & { \mathrm { i f } \quad i = j } \\ { 1 } & { \mathrm { e l s e } } \end{array} \right. \qquad \mathrm { a n d } \qquad [ W ] _ { i j } : = \left\{ \begin{array} { l l } { j - 1 - N } & { \mathrm { i f } \quad j \geq i } \\ { j } & { \mathrm { e l s e } } \end{array} \right. .
|
| 353 |
+
$$
|
| 354 |
+
|
| 355 |
+
234 By substituting the known vector field $f$ with a neural network $f _ { \theta }$ and denoting the matrix containing
|
| 356 |
+
235 vector field evaluations by $\Psi _ { \theta }$ such that $\begin{array} { r } { \overline { { Y } } _ { \theta } : = \frac { 1 } { N } ( U \tilde { Y } + h W \Psi _ { \theta } ) } \end{array}$ , we can formulate an analogue to
|
| 357 |
+
236 the inverse problem $( 6 )$ by
|
| 358 |
+
|
| 359 |
+
$$
|
| 360 |
+
\operatorname { a r g m i n } _ { \theta } { \big \| } { \tilde { Y } } - { \overline { { Y } } } _ { \theta } { \big \| } .
|
| 361 |
+
$$
|
| 362 |
+
|
| 363 |
+
237 Analysis of sensitivity to noise: Consider the optimiza
|
| 364 |
+
238 tion problems using integrators either as one-step methods
|
| 365 |
+
239 or MII by $( 6 )$ resp. $( 1 \bar { 2 } )$ . We want to investigate how
|
| 366 |
+
240 uncertainty in the data ${ \tilde { y } } _ { n }$ introduces uncertainty in the op
|
| 367 |
+
241 timization problem. Assume, for the purpose of analysis,
|
| 368 |
+
242 that the underlying vector field $f ( y )$ is known. Let
|
| 369 |
+
|
| 370 |
+
$$
|
| 371 |
+
\begin{array} { r l } & { \mathcal { T } _ { n } ^ { \mathrm { O S } } : = \tilde { y } _ { n } - \Phi _ { h , f } ( \tilde { y } _ { n - 1 } , \tilde { y } _ { n } ) , } \\ & { \mathcal { T } _ { n } ^ { \mathrm { M I I } } : = \tilde { y } _ { n } - [ \overline { { Y } } ] _ { n } } \end{array}
|
| 372 |
+
$$
|
| 373 |
+
|
| 374 |
+
243 be the optimization target or the expression one aims to
|
| 375 |
+
244 minimize using a one-step method (OS) and the MII,
|
| 376 |
+
245 where $\overline { { Y } }$ is given by Definition $\boxed { 5 . 1 }$ For a matrix $A$
|
| 377 |
+
246 with eigenvalues $\lambda _ { i } ( A )$ , the spectral radius is given by
|
| 378 |
+
|
| 379 |
+

|
| 380 |
+
Figure 3: Illustration of the structure of the mean inverse integrator for $N = 3$ .
|
| 381 |
+
|
| 382 |
+
$\rho ( A ) : = \operatorname* { m a x } _ { i } | \lambda _ { i } ( A ) |$ . An analytic expression that approximates $\rho ( \mathcal { T } _ { n } ^ { \mathrm { o s } } )$ and $\rho ( \mathcal { T } _ { n } ^ { \mathrm { M I I } } )$ by linearization of $f$ for a general MIRK method is provided below.
|
| 383 |
+
|
| 384 |
+
249 Theorem 5.2. Let $S _ { N } = \{ \tilde { y } _ { n } \} _ { n = 0 } ^ { N }$ be a set of noisy samples, equidistant in time with step size $h$
|
| 385 |
+
250 with Gaussian perturbations as defined by $\textcircled { 9 }$ with variance $\sigma ^ { 2 }$ . Assume that a MIRK integrator
|
| 386 |
+
251 $\Phi _ { h , f }$ is used as a one-step method. Then the spectral radius is approximated by
|
| 387 |
+
|
| 388 |
+
$$
|
| 389 |
+
\begin{array} { r l } & { \rho _ { n } ^ { o s } : = \rho \bigg ( V a r \big [ \mathcal { T } _ { n } ^ { o s } \big ] \bigg ) \approx \sigma ^ { 2 } \bigg \| 2 I + h b ^ { T } \big ( \mathbb { 1 } - 2 v \big ) \big ( f ^ { \prime } + f ^ { \prime T } \big ) + h ^ { 2 } Q ^ { o s } \bigg \| _ { 2 } , } \\ & { \rho _ { n } ^ { M I I } : = \rho \bigg ( V a r \big [ \mathcal { T } _ { n } ^ { M I I } \big ] \bigg ) \approx \frac { \sigma ^ { 2 } } { N } \bigg \| ( 1 + N ) I + h P _ { n n } + \frac { h } { N } \displaystyle \sum _ { j = 0 } ^ { s } P _ { n j } + \frac { h ^ { 2 } } { N } Q ^ { M I I } \bigg \| _ { 2 } , } \end{array}
|
| 390 |
+
$$
|
| 391 |
+
|
| 392 |
+
where 252 $f ^ { \prime } : = f ^ { \prime } ( y _ { n } )$ and $P _ { n j } , Q ^ { o s }$ and $Q ^ { M I I }$ (defined in (24) in Appendix G) are matrices independent 253 of the step size $h$ .
|
| 393 |
+
|
| 394 |
+
254 The proof is found in Appendix $\boxed { \mathbf { G } }$ Let $\alpha : = b ^ { T } ( \mathbb { 1 } ^ { } -$
|
| 395 |
+
255 $2 v$ ) denote the coefficients of the first order term in $h$
|
| 396 |
+
256 of Equation $\textcircled { 1 3 }$ . For any explicit RK method we have
|
| 397 |
+
257 that $v = 0$ and since $b ^ { T } \bar { 1 } = \bar { 1 }$ (method of at least order
|
| 398 |
+
258 one) we find that $\alpha _ { \mathrm { E R K } } = 1$ . Considering the Butcher
|
| 399 |
+
259 tableau of MIRK4 in Figure $9$ we find that $\alpha _ { \mathrm { M I R K 4 } } = 0$
|
| 400 |
+
260 Thus, as $h 0$ we would expect quadratic convergence
|
| 401 |
+
261 !of MIRK4 and linear convergence of RK4 for $\rho _ { n } ^ { \mathrm { { O S } } }$ to $2 \sigma ^ { 2 }$
|
| 402 |
+
262 Considering MII $( 1 4 )$ one would expect linear convergence
|
| 403 |
+
263 for $\rho _ { n } ^ { \mathrm { M I I } }$ to $\bar { \sigma } ^ { 2 }$ if $N$ is large, as $h 0$ .
|
| 404 |
+
64 A numerical approximation of $\rho _ { n } ^ { \mathrm { { O S } } }$ and $\rho _ { n } ^ { \mathrm { M I I } }$ could be real
|
| 405 |
+
65 ized by a Monte-Carlo estimate. We compute the spectral
|
| 406 |
+
66 67 ${ \mathcal { T } } _ { n } ^ { \mathrm { M I I } }$ s b $\hat { \rho } _ { n }$ of the eampling $5 { \cdot } \mathrm { \dot { 1 } 0 ^ { 3 } }$ cal covariance matrix of normally distributed pert $\mathcal { T } _ { n } ^ { \mathrm { { 0 s } } }$ andtions
|
| 407 |
+
268 $\delta _ { n }$ with $\sigma ^ { 2 } = 2 { \bar { . } } 5 \cdot 1 0 ^ { - 3 }$ to each point $y _ { n }$ in a trajectory
|
| 408 |
+
69 of $N + 1$ points and step size $h$ . We then compute the
|
| 409 |
+
270 trajectory average $\begin{array} { r } { \overline { { \rho } } = \frac { 1 } { N + 1 } \sum _ { n = 0 } ^ { N } \hat { \rho } _ { n } } \end{array}$ , fix the end time $T = 2 . 4$ , repeat the approximations for
|
| 410 |
+
271 decreasing step sizes $h$ and increasing $N$ and compute the average of $\overline { \rho }$ for 10 randomly sampled
|
| 411 |
+
272 trajectories $S _ { N }$ from the double pendulum system. The plot in Figure $^ 4$ corresponds well with what
|
| 412 |
+
273 one would expect from Theorem $5 . 2$ and confirms that first MIRK (with $v \neq 0$ ) and secondly MII
|
| 413 |
+
274 reduces the sensitivity to noise in the optimization target.
|
| 414 |
+
|
| 415 |
+

|
| 416 |
+
Figure 4: Average of $\overline { { \rho } }$ over 10 trajectories. Shaded area represent one standard deviation.
|
| 417 |
+
|
| 418 |
+
# 6 Experiments
|
| 419 |
+
|
| 420 |
+
Methods and test problems: We train HNNs using different integrators and methods in the inverse problem $\textcircled{6}$ . We use MIRK4 together with the MII method and compare to the implicit midpoint method, RK4 and MIRK4 applied as one-step methods, as well as ISO followed by Störmer–Verlet and RK4 integrated over multiple time-steps. The latter strategy, illustrated in Figure $\bigtriangledown ,$ was suggested in [10], where Störmer–Verlet is used. Separable networks $H _ { \theta } ( q , p ) = H _ { 1 , \theta } ( q ) + H _ { 2 , \theta } ( p )$ are trained on data from the Fermi–Pasta–Ulam–Tsingou (FPUT) problem and the Hénon–Heiles system. For the double pendulum, which is non-separable, a fully connected Flow roll-out H´enon-Hnetwork is used for all methods except Störmer– Flow roll-out H´enon-Heiles h = 0.1, FVerlet, which requires separability in order to be explicit. The Hamiltonians are described in Appendix 0.2 0.0A and all systems have solutions $y ( t ) \not \in \mathbb { R } ^ { 4 }$ .
|
| 421 |
+
|
| 422 |
+
0.2 0.0 0.0After using the specified integrators in training, a
|
| 423 |
+
294 0.0 0.2proximated solutions are computed for each learned
|
| 424 |
+
295 vector field $f _ { \theta }$ 0.2 0.4using the Scikit-learn implementation
|
| 425 |
+
296 0.2 0.6of DOP853 [35], which is also used to generate
|
| 426 |
+
297 0.0 2.5 5.0 7.5 training data. The error is averaged over $M = { \mathfrak { M } } =$
|
| 427 |
+
298 0.0 2.5 5.0 7.5 10.0 12.5 15.0 17points and we find what we call the flow error by
|
| 428 |
+
|
| 429 |
+

|
| 430 |
+
|
| 431 |
+

|
| 432 |
+
Flow roll-out Double pendulum $h = 0 . 1 .$ , $\sigma = 0 . 0 5$
|
| 433 |
+
|
| 434 |
+
ISO RK4 MII MIRK4 Given datagure 5: Roll-out in time obtained by inteMIRK4MII MIRK4 Exact flowrating over the learned vector fields when Exact flow.0 12.5 15.0 17.5 20.0training on data from the double pendulum .0 17.5 20.05.0 7.5 10.0 tHamiltonian.
|
| 435 |
+
|
| 436 |
+
$$
|
| 437 |
+
\begin{array} { l } { \displaystyle { e \big ( f _ { \theta } \big ) = \frac { 1 } { M } \sum _ { n = 1 } ^ { M } \| \hat { y } _ { n } - y ( t _ { n } ) \| _ { 2 } , \quad y ( t _ { n } ) \in S _ { M } ^ { \mathrm { t e s t } } , } } \\ { \displaystyle { \hat { y } _ { n + 1 } = \Phi _ { h , f _ { \theta } } \big ( y _ { n } \big ) } . } \end{array}
|
| 438 |
+
$$
|
| 439 |
+
|
| 440 |
+
299 Trathat 300 g data is g. The data $N _ { 2 } = 3 0 0$ random initial values nd by integrating the $y _ { 0 }$ requiringtial values
|
| 441 |
+
$0 . 3 \leq \| y _ { 0 } \| _ { 2 } \leq 0 . 6 .$ $S _ { N _ { 1 } , N _ { 2 } } = \bar { \{ y _ { n } ^ { ( j ) } \} } _ { n = 0 , j = 0 } ^ { N _ { 1 } , N _ { 2 } }$
|
| 442 |
+
301 with DOP853 with a tolerance of $1 0 ^ { - 1 5 }$ for the following step sizes and number of steps: $\left( h , N _ { 1 } \right) =$
|
| 443 |
+
302 (0.4, 4), (0.2, 8), (0.1, 16). The points in the flow are perturbed by noise where $\sigma \in \{ 0 , 0 . 0 5 \}$ . Error
|
| 444 |
+
303 is measured in $M = 1 0$ random points in the flow, within the same domain as the initial values.
|
| 445 |
+
304 Furthermore, experiments are repeated with a new random seed for the generation of data and
|
| 446 |
+
305 initialization of neural network parameters five times in order to compute the standard deviation of
|
| 447 |
+
306 the flow error. The flow error is shown in Figure $6 .$ Additional results are presented in Appendix B.
|
| 448 |
+
|
| 449 |
+
Neural network architecture and optimization: For all test problems, the neural networks have 3 layers with a width of 200 neurons and tanh(·) as the activation function. The algorithms are implemented using PyTorch $\pmb { \mathbb { B } } 6 \|$ and the code for performing ISO is a modification of the implementation by $\mathbb { \underline { { \sf { I I O } } } } ! .$ Training is done using the quasi-Newton L-BFGS algorithm $\textcircled { 1 3 7 }$ for 20 epochs without batching. This optimization algorithm is often used to train physics-informed neural networks [1] and in this setting it proved to yield superior results in comparison to the often used Adam optimizer. Further details are provided in Appendix E.
|
| 450 |
+
|
| 451 |
+
Results: As observed in Figure $\boxed { 6 }$ and supported by the analytical result illustrated in Figure $\boxed { 4 }$ the MII approach facilitates more accurate training from from noisy data than one-step methods. However, training with multiple integration steps in combination with ISO yields lower error when RK4 is used for the Hénon–Heiles problem and similar performance as MII on the double pendulum. We notice that the SRNN approach, i.e. ISO with Störmer–Verlet, is improved when switching to RK4, which means sacrificing symplecticity to achieve higher order. The results for FPUT stand out in Figure $6 ,$ since both ISO methods have large errors here. The roll-out in time of the learned vector fields is presented in Figure $8$ in Appendix $\boxed { \mathbf { B } }$ where the same can be observed. As also could be seen here, the FPUT Hamiltonian gives rise to highly oscillatory trajectories, and the errors observed in Figure 6 might indicate that ISO is ill-suited for this kind of dynamical systems.
|
| 452 |
+
|
| 453 |
+

|
| 454 |
+
Figure 6: The flow error when learning vector fields using one-step methods directly (Midpoint, RK4 and MIRK4), ISO and multiple time-steps (ISO Störmer and ISO RK4) and MII (MII MIRK4). The error bars display the standard deviation after rerunning 5 experiments on data with $\sigma = 0 . 0 5$ . The right subplot shows the computational time used in training against the flow error.
|
| 455 |
+
|
| 456 |
+
Two observations could be made regarding the one-step methods without averaging or ISO. First, it is likely that the midpoint method has weaker performance for large step sizes due to its lower order, compared to both RK4 and MIRK4, despite the fact that it is a symplectic method. The same is clear from Figure $\perp$ in Appendix $\bigstar _ { \mathbf { B } } \bigstar _ { \mathbf { \theta } }$ which display the flow error when training on data without noise. Secondly, building on the sensitivity analysis, we observe that MIRK4 consistently attains higher accuracy than RK4, as expected from the Monte-Carlo simulation found in Figure 4.
|
| 457 |
+
|
| 458 |
+
# 7 Conclusion
|
| 459 |
+
|
| 460 |
+
In this work we present the mean inverse integrator, which allows both chaotic and oscillatory dynamical systems to be learned with high accuracy from noisy data. Within this method, integrators of the MIRK class are a key component. To analyse how noise is propagated when training with MII and MIRK, compared to much used explicit methods such as RK4, we developed a sensitivity analysis that is verified both by a Monte-Carlo approximation and reflected in the error of the learned vector fields. Finally, we build on the SRNN $\mathbb { m }$ by replacing Störmer–Verlet with RK4, and observer increased performance. When also considering the weak performance of the implicit midpoint method, this tells us that order might be of greater importance than preserving the symplectic structure when training HNNs. Both the MIRK methods, the mean inverse integrator and initial state optimization form building blocks that could be combined to form novel approaches for solving inverse problems and learning from noisy data.
|
| 461 |
+
|
| 462 |
+
Limitations: The experiments presented here assume that both the generalized coordinates $q _ { n }$ and the generalized momenta $p _ { n }$ could be observed. In a setting where HNNs are to model real and not simulated data, the observations might lack generalized momenta $\left[ \left[ 3 8 \right] \right]$ or follow Cartesian coordinates, requiring the enforcement of constraints $\boxed { 1 7 } \boxed { 3 9 }$ . Combining approaches that are suitable for data that is both noisy and follow less trivial coordinate systems is a subject for future research.
|
| 463 |
+
|
| 464 |
+
References
|
| 465 |
+
[1] Maziar Raissi, Paris Perdikaris, and George E Karniadakis. Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations. Journal of Computational physics, 378:686–707, 2019.
|
| 466 |
+
[2] Christopher Rackauckas, Yingbo Ma, Julius Martensen, Collin Warner, Kirill Zubov, Rohit Supekar, Dominic Skinner, Ali Ramadhan, and Alan Edelman. Universal differential equations for scientific machine learning. Aug 2020.
|
| 467 |
+
[3] Ricky TQ Chen, Yulia Rubanova, Jesse Bettencourt, and David K Duvenaud. Neural ordinary differential equations. Advances in neural information processing systems, 31, 2018.
|
| 468 |
+
[4] Zongyi Li, Nikola Kovachki, Kamyar Azizzadenesheli, Burigede Liu, Kaushik Bhattacharya, Andrew Stuart, and Anima Anandkumar. Fourier neural operator for parametric partial differential equations. arXiv preprint arXiv:2010.08895, 2020.
|
| 469 |
+
[5] Sam Greydanus, Misko Dzamba, and Jason Yosinski. Hamiltonian neural networks. CoRR, abs/1906.01563, 2019.
|
| 470 |
+
[6] Herbert Goldstein, Charles Poole, and John Safko. Classical Mechanics. Addison Wesley, 3 edition, 2001.
|
| 471 |
+
[7] Benedict Leimkuhler and Sebastian Reich. Simulating Hamiltonian Dynamics. Cambridge Monographs on Applied and Computational Mathematics. Cambridge University Press, 2005.
|
| 472 |
+
[8] Ernst Hairer, Christian Lubich, and Gerhard Wanner. Geometric Numerical Integration: Structure-Preserving Algorithms for Ordinary Differential Equations; 2nd ed. Springer, Dordrecht, 2006.
|
| 473 |
+
[9] Christian Offen and Sina Ober-Blöbaum. Symplectic integration of learned Hamiltonian systems. Chaos: An Interdisciplinary Journal of Nonlinear Science, 32(1):013122, 2022.
|
| 474 |
+
[10] Zhengdao Chen, Jianyu Zhang, Martin Arjovsky, and Léon Bottou. Symplectic recurrent neural networks. In International Conference on Learning Representations, 2020.
|
| 475 |
+
[11] Aiqing Zhu, Pengzhan Jin, and Yifa Tang. Deep Hamiltonian networks based on symplectic integrators. arXiv preprint arXiv:2004.13830, 2020.
|
| 476 |
+
[12] Marco David and Florian Méhats. Symplectic learning for Hamiltonian neural networks. arXiv preprint arXiv:2106.11753, 2021.
|
| 477 |
+
[13] Pengzhan Jin, Zhen Zhang, Aiqing Zhu, Yifa Tang, and George Em Karniadakis. SympNets: Intrinsic structure-preserving symplectic networks for identifying Hamiltonian systems. Neural Networks, 132:166–179, 2020.
|
| 478 |
+
[14] Aiqing Zhu, Pengzhan Jin, Beibei Zhu, and Yifa Tang. Inverse modified differential equations for discovery of dynamics. arXiv preprint arXiv:2009.01058, 2020.
|
| 479 |
+
[15] Takashi Matsubara, Ai Ishikawa, and Takaharu Yaguchi. Deep energy-based modeling of discrete-time physics. Advances in Neural Information Processing Systems, 33:13100–13111, 2020.
|
| 480 |
+
[16] Sølve Eidnes. Order theory for discrete gradient methods. BIT, 62(4):1207–1255, 2022.
|
| 481 |
+
[17] Elena Celledoni, Andrea Leone, Davide Murari, and Brynjulf Owren. Learning Hamiltonians of constrained mechanical systems. J. Comput. Appl. Math., 417:Paper No. 114608, 12, 2023.
|
| 482 |
+
[18] Alvaro Sanchez-Gonzalez, Victor Bapst, Kyle Cranmer, and Peter Battaglia. Hamiltonian Graph Networks with ODE Integrators.
|
| 483 |
+
[19] Gerhard Wanner and Ernst Hairer. Solving ordinary differential equations II, volume 375. Springer Berlin Heidelberg, 1996.
|
| 484 |
+
[20] Senwei Liang, Zhongzhan Huang, and Hong Zhang. Stiffness-aware neural network for learning Hamiltonian systems. 2022.
|
| 485 |
+
[21] Jeff R Cash. A class of implicit Runge–Kutta methods for the numerical integration of stiff ordinary differential equations. Journal of the ACM (JACM), 22(4):504–511, 1975.
|
| 486 |
+
[22] K Burrage, FH Chipman, and Paul H Muir. Order results for mono-implicit Runge–Kutta methods. SIAM journal on numerical analysis, 31(3):876–891, 1994.
|
| 487 |
+
[23] Håkon Noren. Learning Hamiltonian systems with mono-implicit Runge–Kutta methods. arXiv preprint, arXiv:2303.03769, 2023.
|
| 488 |
+
[24] Harsh Sharma, Nicholas Galioto, Alex A Gorodetsky, and Boris Kramer. Bayesian identification of nonseparable Hamiltonian systems using stochastic dynamic models. In 2022 IEEE 61st Conference on Decision and Control (CDC), pages 6742–6749. IEEE, 2022.
|
| 489 |
+
[25] W. M. G. van Bokhoven. Efficient higher order implicit one-step methods for integration of stiff differential equations. BIT, 20(1):34–43, 1980.
|
| 490 |
+
[26] J. R. Cash and A. Singhal. Mono-implicit Runge–Kutta formulae for the numerical integration of stiff differential systems. IMA J. Numer. Anal., 2(2):211–227, 1982.
|
| 491 |
+
[27] Sølve Eidnes, Alexander J Stasik, Camilla Sterud, Eivind Bøhn, and Signe Riemer-Sørensen. Pseudo-Hamiltonian neural networks with state-dependent external forces. arXiv preprint, arXiv:2206.02660, 2022.
|
| 492 |
+
[28] Haruo Yoshida. Construction of higher order symplectic integrators. Physics letters A, 150(5- 7):262–268, 1990.
|
| 493 |
+
[29] Shaan A Desai, Marios Mattheakis, and Stephen J Roberts. Variational integrator graph networks for learning energy-conserving dynamical systems. Physical Review E, 104(3):035310, 2021.
|
| 494 |
+
[30] Daniel DiPietro, Shiying Xiong, and Bo Zhu. Sparse symplectically integrated neural networks. Advances in Neural Information Processing Systems, 33:6074–6085, 2020.
|
| 495 |
+
[31] GRW Quispel and Grant S Turner. Discrete gradient methods for solving ODEs numerically while preserving a first integral. Journal of Physics A: Mathematical and General, 29(13):L341, 1996.
|
| 496 |
+
[32] Robert I McLachlan, G Reinout W Quispel, and Nicolas Robidoux. Geometric integration using discrete gradients. Philosophical Transactions of the Royal Society of London. Series A: Mathematical, Physical and Engineering Sciences, 357(1754):1021–1045, 1999.
|
| 497 |
+
[33] Ander Murua. Métodos simplécticos desarrollables en $P$ -series. PhD thesis, PhD thesis. Valladolid: Universidad de Valladolid, 1995.
|
| 498 |
+
[34] Philippe Chartier, Ernst Hairer, and Gilles Vilmart. Numerical integrators based on modified differential equations. Mathematics of Computation, 76(260):1941–1953, October 2007.
|
| 499 |
+
[35] J.R. Dormand and P.J. Prince. A family of embedded Runge–Kutta formulae. Journal of Computational and Applied Mathematics, 6(1):19–26, 1980.
|
| 500 |
+
[36] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, et al. PyTorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems, 32:8026–8037, 2019.
|
| 501 |
+
[37] Jorge Nocedal and Stephen J Wright. Numerical optimization. Springer, 1999.
|
| 502 |
+
[38] Yuhan Chen, Takashi Matsubara, and Takaharu Yaguchi. Neural symplectic form: learning hamiltonian equations on general coordinate systems. Advances in Neural Information Processing Systems, 34:16659–16670, 2021.
|
| 503 |
+
[39] Marc Finzi, Ke Alexander Wang, and Andrew Gordon Wilson. Simplifying Hamiltonian and Lagrangian neural networks via explicit constraints. arXiv preprint arXiv:2010.13581, 2020.
|
| 504 |
+
[40] Enrico Fermi, P Pasta, Stanislaw Ulam, and Mary Tsingou. Studies of the nonlinear problems. Technical report, Los Alamos National Lab.(LANL), Los Alamos, NM (United States), 1955.
|
| 505 |
+
|
| 506 |
+
439 [41] E. Hairer, S. P. Nørsett, and G. Wanner. Solving ordinary differential equations. I, volume 8 of
|
| 507 |
+
440 Springer Series in Computational Mathematics. Springer-Verlag, Berlin, second edition, 1993.
|
| 508 |
+
441 Nonstiff problems.
|
| 509 |
+
442 [42] P. H. Muir. Optimal discrete and continuous mono-implicit Runge-Kutta schemes for BVODEs.
|
| 510 |
+
443 Adv. Comput. Math., 10(2):135–167, 1999.
|
| 511 |
+
444 [43] J. R. Cash and D. R. Moore. A high order method for the numerical solution of two-point
|
| 512 |
+
445 boundary value problems. BIT, 20(1):44–52, 1980.
|
| 513 |
+
446 [44] Philippe Chartier. Symmetric Methods. In Björn Engquist, editor, Encyclopedia of Applied and
|
| 514 |
+
447 Computational Mathematics, pages 1439–1448. Springer, Berlin, Heidelberg, 2015.
|
| 515 |
+
448 [45] J. R. Cash and A. Singhal. High order methods for the numerical solution of two-point boundary
|
| 516 |
+
449 value problems. BIT, 22(2):184–199, 1982.
|
| 517 |
+
450 [46] Pauli Virtanen, Ralf Gommers, Travis E. Oliphant, Matt Haberland, Tyler Reddy, David
|
| 518 |
+
451 Cournapeau, Evgeni Burovski, Pearu Peterson, Warren Weckesser, Jonathan Bright, Stéfan J.
|
| 519 |
+
452 van der Walt, Matthew Brett, Joshua Wilson, K. Jarrod Millman, Nikolay Mayorov, Andrew
|
| 520 |
+
453 R. J. Nelson, Eric Jones, Robert Kern, Eric Larson, C J Carey, ˙ Ilhan Polat, Yu Feng, Eric W.
|
| 521 |
+
454 Moore, Jake VanderPlas, Denis Laxalde, Josef Perktold, Robert Cimrman, Ian Henriksen, E. A.
|
| 522 |
+
455 Quintero, Charles R. Harris, Anne M. Archibald, Antônio H. Ribeiro, Fabian Pedregosa, Paul
|
| 523 |
+
456 van Mulbregt, and SciPy 1.0 Contributors. SciPy 1.0: Fundamental Algorithms for Scientific
|
| 524 |
+
457 Computing in Python. Nature Methods, 17:261–272, 2020.
|
| 525 |
+
458 [47] Philippe Chartier, Ernst Hairer, and Gilles Vilmart. Numerical integrators based on modified
|
| 526 |
+
459 differential equations. Math. Comp., 76(260):1941–1953, 2007.
|
| 527 |
+
460 [48] Ge Zhong and Jerrold E. Marsden. Lie-Poisson Hamilton-Jacobi theory and Lie-Poisson
|
| 528 |
+
461 integrators. Phys. Lett. A, 133(3):134–139, 1988.
|
| 529 |
+
462 [49] Takashi Matsubara and Takaharu Yaguchi. FINDE: Neural differential equations for finding
|
| 530 |
+
463 and preserving invariant quantities. arXiv preprint, arXiv:2210.00272, 2022.
|
md/dev/vbPsD-BhOZ/vbPsD-BhOZ.md
ADDED
|
@@ -0,0 +1,388 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Neural Sheaf Diffusion: A Topological Perspective on Heterophily and Oversmoothing in GNNs
|
| 2 |
+
|
| 3 |
+
Cristian Bodnar∗ University of Cambridge cristian.bodnar@cl.cam.ac.uk
|
| 4 |
+
|
| 5 |
+
Francesco Di Giovanni† Twitter fdigiovanni@twitter.com
|
| 6 |
+
|
| 7 |
+
Benjamin P. Chamberlain Twitter
|
| 8 |
+
|
| 9 |
+
Pietro Liò University of Cambridge
|
| 10 |
+
|
| 11 |
+
Michael Bronstein University of Oxford & Twitter
|
| 12 |
+
|
| 13 |
+
# Abstract
|
| 14 |
+
|
| 15 |
+
Cellular sheaves equip graphs with a “geometrical” structure by assigning vector spaces and linear maps to nodes and edges. Graph Neural Networks (GNNs) implicitly assume a graph with a trivial underlying sheaf. This choice is reflected in the structure of the graph Laplacian operator, the properties of the associated diffusion equation, and the characteristics of the convolutional models that discretise this equation. In this paper, we use cellular sheaf theory to show that the underlying geometry of the graph is deeply linked with the performance of GNNs in heterophilic settings and their oversmoothing behaviour. By considering a hierarchy of increasingly general sheaves, we study how the ability of the sheaf diffusion process to achieve linear separation of the classes in the infinite time limit expands. At the same time, we prove that when the sheaf is non-trivial, discretised parametric diffusion processes have greater control than GNNs over their asymptotic behaviour. On the practical side, we study how sheaves can be learned from data. The resulting sheaf diffusion models have many desirable properties that address the limitations of classical graph diffusion equations (and corresponding GNN models) and obtain competitive results in heterophilic settings. Overall, our work provides new connections between GNNs and algebraic topology and would be of interest to both fields.
|
| 16 |
+
|
| 17 |
+

|
| 18 |
+
Figure 1: A sheaf $( G , { \mathcal { F } } )$ shown for a single edge of the graph. The stalks are isomorphic to $\mathbf { \bar { \mathbb { R } } ^ { 2 } }$ . The restriction maps $\mathcal { F } _ { v \le e }$ , $\mathcal { F } _ { u \leq e }$ and their adjoints move the vector features between these spaces. In practice, we learn the sheaf (i.e. the restrictions maps) from data via a parametric function $\Phi$ .
|
| 19 |
+
|
| 20 |
+

|
| 21 |
+
Figure 2: Analogy between parallel transport on a sphere and transport on a discrete vector bundle (cellular sheaf). A tangent vector is moved from ${ \mathcal { F } } ( w ) \to { \mathcal { F } } ( v ) \ { \overset { } { \to } } \ F ( u )$ and back. Because the vector returns in a different position, the transport is not pathindependent.
|
| 22 |
+
|
| 23 |
+
# 1 Introduction
|
| 24 |
+
|
| 25 |
+
Graph Neural Networks (GNNs) [12, 20, 27–29, 39, 58, 64] have recently become very popular in the ML community as a model of choice to deal with relational and interaction data due to their multiple successful applications in domains ranging from social science and particle physics to structural biology and drug design. In this work, we focus on two main problems often observed in GNNs: their poor performance in heterophilic graphs [75] and their oversmoothing behaviour [48, 50]. The former arises from the fact that many GNNs are built on the strong assumption of homophily, i.e., that nodes tend to connect to other similar nodes. The latter refers to a phenomenon of some deeper GNNs producing features that are too smooth to be useful.
|
| 26 |
+
|
| 27 |
+
Contributions. We show that these two fundamental problems are linked by a common cause: the underlying “geometry” of the graph (used here in a very loose sense). When this geometry is trivial, as is typically the case, the two phenomena described above emerge. We make these statements precise through the lens of (cellular) sheaf theory [10, 18, 26, 44, 56, 62], a subfield of algebraic topology and geometry. Intuitively, a cellular sheaf associates a vector space to each node and edge of a graph, and a linear map between these spaces for each incident node-edge pair (Figure 1).
|
| 28 |
+
|
| 29 |
+
In Section 3, we analyse how by considering a hierarchy of increasingly general sheaves, starting from a trivial one, a diffusion equation based on the sheaf Laplacian [34] can solve increasingly more complicated node-classification tasks in the infinite time limit. In this regime, we show that oversmoothing and problems due to heterophily can be avoided by equipping the graph with the right sheaf structure for the task. In Section 4, we study the behaviour of a non-linear, parametric, and discrete version of this process. This results in a Sheaf Convolutional Network [32] that generalises Graph Convolutional Networks [39]. We prove that this discrete diffusion process is more flexible and has greater control over its asymptotic behaviour than GCNs [13, 51]. All these results are based on the properties of the harmonic space of the sheaf Laplacian, which we study from a spectral perspective in Section 3.1. We provide a new Cheeger-type inequality for the spectral gap of the sheaf Laplacian and note that these results might be of independent interest for spectral sheaf theory [34]. Finally, in Section 5, we apply our theory to designing simple and practical GNN models. We describe how to construct Sheaf Neural Networks by learning sheaves from data, thus making these types of models applicable beyond the toy experimental setting where they were originally introduced [32]. The resulting models obtain competitive results both in heterophilic and homophilic graphs.
|
| 30 |
+
|
| 31 |
+
# 2 Background
|
| 32 |
+
|
| 33 |
+
Cellular Sheaves. A cellular sheaf [18, 62] over a graph (Figure 1) is a mathematical object associating a vector space to each node and edge in the graph and a map between these spaces for each incident node-edge pair. We define this formally below:
|
| 34 |
+
|
| 35 |
+
Definition 1. A cellular sheaf $( G , { \mathcal { F } } )$ on an undirected graph $G = ( V , E )$ consists of:
|
| 36 |
+
|
| 37 |
+
• A vector space $\mathcal { F } ( v )$ for each $v \in V$ .
|
| 38 |
+
• A vector space $\mathcal { F } ( e )$ for each $e \in E$ .
|
| 39 |
+
• A linear map $\mathcal { F } _ { v \le e } : \mathcal { F } ( v ) \to \mathcal { F } ( e )$ for each incident $v \leq e$ node-edge pair.
|
| 40 |
+
|
| 41 |
+
The vector spaces of the nodes and edges are called stalks, while the linear maps are referred to as restriction maps. The space formed by all the spaces associated with the nodes of the graph is called the space of 0-cochains $C ^ { 0 } ( G ; \mathcal { F } ) : = \mathsf { \bar { Q } } _ { v \in V } \mathcal { \bar { F } } ( v )$ , where $\oplus$ denotes the direct sum of vector spaces. For a 0-cochain $\mathbf { x } \in C ^ { 0 } ( G ; { \mathcal { F } } )$ , we use $\mathbf { x } _ { v }$ to refer to the vector in $\mathcal { F } ( v )$ of node $v$ . Hansen and Ghrist [35] have constructed a convenient mental model for these objects based on opinion dynamics. In this context, $\mathbf { x } _ { v }$ is the ‘private opinion’ of node $v$ , while $\mathcal { F } _ { v \leq e } \mathbf { x } _ { v }$ expresses how that opinion manifests publicly in a ‘discourse space’ formed by $\mathcal { F } ( e )$ . A particularly important subspace of $C ^ { 0 } ( G ; { \mathcal { F } } )$ is the space of global sections $H ^ { 0 } ( G ; { \mathcal { F } } ) : = \{ \dot { \mathbf { x } } \in C ^ { 0 } ( G ; { \mathcal { F } } ) : { \dot { \mathcal { F } } } _ { v \exists e } { \dot { \mathbf { x } } } _ { v } = { \mathcal { F } } _ { u \exists e } { \dot { \mathbf { x } } } _ { u } \}$ containing those private opinions $\mathbf { x }$ for which all neighbours $( v , u )$ agree with each other in the discourse space. Given a cellular sheaf $( G , { \mathcal { F } } )$ , we can define a sheaf Laplacian operator [34] measuring the aggregated ‘disagreement of opinions’ at each node:
|
| 42 |
+
|
| 43 |
+
Definition 2. The sheaf Laplacian of a sheaf $( G , { \mathcal { F } } )$ is a linear map $L _ { { \mathcal { F } } } : C ^ { 0 } ( G , { \mathcal { F } } ) \to C ^ { 0 } ( G , { \mathcal { F } } )$ defined node-wise as $\begin{array} { r } { L _ { \mathcal { F } } ( \mathbf { x } ) _ { v } : = \sum _ { v , u \leq e } \mathcal { F } _ { v \leq e } ^ { \top } ( \mathcal { F } _ { v \leq e } \mathbf { x } _ { v } - \mathcal { F } _ { u \leq e } \mathbf { x } _ { u } ) } \end{array}$ .
|
| 44 |
+
|
| 45 |
+

|
| 46 |
+
Figure 3: A graph (left), the Laplacian matrix of a sheaf with $d$ -dimensional stalks over the graph (middle) , and a 0-cochain $\mathbf { x }$ represented as a block-vector stacking the vectors of all nodes $( r i g h t )$ .
|
| 47 |
+
|
| 48 |
+
The sheaf Laplacian is a positive semi-definite block matrix (Figure 3). The diagonal blocks are $\begin{array} { r } { L _ { \mathcal { F } v v } = \sum _ { v \preceq e } \mathcal { F } _ { v \preceq e } ^ { \top } \mathcal { F } _ { v \preceq e } \widehat { } } \end{array}$ , while the non-diagonal blocks $L _ { \mathcal { F } v u } = - \mathcal { F } _ { v \leq e } ^ { \top } \mathcal { F } _ { u \leq e }$ . Denoting by $D$ the block-diagonal of $L _ { \mathcal { F } }$ , the normalised sheaf Laplacian is given by $\Delta _ { \mathcal { F } } \overset { - } { : = } D ^ { - 1 / 2 } L _ { \mathcal { F } } D ^ { - 1 / 2 }$ . For simplicity, we assume that all the stalks have a fixed dimension $d$ . In that case, the sheaf Laplacian is a $n d \times n d$ real matrix, where $n$ is the number of nodes of $G$ . When the vector spaces are set to $\mathbb { R }$ (i.e., $d = 1$ ) and the linear maps to the identity map over $\mathbb { R }$ , the underlying sheaf is trivial and one recovers the well-known $n \times n$ graph Laplacian matrix and its normalised version $\Delta _ { 0 }$ . In general, $\Delta { _ { \mathcal { F } } }$ is preferred to $L _ { \mathcal { F } }$ for most practical purposes due to its bounded spectrum and, therefore, we focus on the former. A cochain $\mathbf { x }$ is called harmonic if $L _ { \mathcal { F } } \mathbf { x } = 0$ or, equivalently, if $\mathbf { x } \in \ker ( L _ { \mathcal { F } } )$ . This means harmonic cochains are characterised by zero disagreements along all the edges of the graph, and it is not difficult to see that, in fact, $H ^ { 0 } ( G ; { \mathcal { F } } )$ and $\ker ( L _ { \mathcal { F } } )$ are isomorphic as vector spaces [35].
|
| 49 |
+
|
| 50 |
+
The sheaves with orthogonal maps (i.e. ${ \mathcal { F } } _ { v \leq e } \in O ( d )$ the Lie group of $d \times d$ orthogonal matrices) provide a more geometric interpretation of sheaves and play an important role in our analysis. Such sheaves are called discrete $O ( d )$ bundles and can be seen as a discrete version of vector bundles [24, 60, 73] from differential geometry [67]. Intuitively, these objects describe vector spaces attached to the points of a manifold. In our discrete case, the role of the manifold is played by the graph, and the sheaf Laplacian describes how the elements of a vector space are transported via rotations in another neighbouring vector space similarly to how tangent vectors are moved across a manifold via parallel transport (connection; see Figure 2). Due to this analogy, the sheaf Laplacian on $O ( d )$ bundles is also referred to as connection Laplacian [63].
|
| 51 |
+
|
| 52 |
+
Heat Diffusion and GCNs. Consider a graph with adjacency matrix $\mathbf { A }$ , diagonal degree matrix $\mathbf { D }$ , normalised graph Laplacian $\Delta _ { 0 } : = \mathbf { I } - \mathbf { D } ^ { - 1 / 2 } \mathbf { A } \mathbf { D } ^ { - 1 / 2 }$ , and an $n \times f$ feature matrix $\mathbf { X }$ . We can define the heat diffusion equation and its Euler discretisation with a unit step as follows:
|
| 53 |
+
|
| 54 |
+
$$
|
| 55 |
+
\dot { \mathbf { X } } ( t ) = - \Delta _ { 0 } \mathbf { X } ( t ) \ \longleftrightarrow \ \mathbf { X } ( t + 1 ) = \mathbf { X } ( t ) - \Delta _ { 0 } \mathbf { X } ( t ) = ( \mathbf { I } - \Delta _ { 0 } ) \mathbf { X } ( t ) .
|
| 56 |
+
$$
|
| 57 |
+
|
| 58 |
+
Comparing this with the Graph Convolutional Network [39] model, we observe that GCN is an augmented heat diffusion process with an additional $f \times f$ weight matrix W and a nonlinearity $\sigma$ :
|
| 59 |
+
|
| 60 |
+
$$
|
| 61 |
+
\operatorname { G C N } ( \mathbf { X } , \mathbf { A } ) : = \sigma ( \mathbf { D } ^ { - 1 / 2 } \mathbf { A } \mathbf { D } ^ { - 1 / 2 } \mathbf { X } \mathbf { W } ) = \sigma ( ( \mathbf { I } - \Delta _ { 0 } ) \mathbf { X } \mathbf { W } ) .
|
| 62 |
+
$$
|
| 63 |
+
|
| 64 |
+
From this perspective, it is perhaps not surprising that GCN is particularly affected by heterophily and oversmoothing since heat diffusion makes the features of neighbouring nodes increasingly smooth. In what follows, we consider a much more general and powerful family of (sheaf) diffusion processes leading to more expressive sheaf convolutions.
|
| 65 |
+
|
| 66 |
+
# 3 The Expressive Power of Sheaf Diffusion
|
| 67 |
+
|
| 68 |
+
Preliminaries. Let us now assume $G$ to be a graph with $d$ -dimensional node feature vectors $\mathbf { x } _ { v } \in \mathcal { F } ( v )$ . The features of all nodes are represented as a single vector $\mathbf { x } \in C ^ { 0 } ( G ; { \mathcal { F } } )$ stacking all the individual $d$ -dimensional vectors (Figure 3). Additionally, if we allow for $f$ feature channels, everything can be represented as a matrix $\mathbf { X } \in \mathbb { R } ^ { ( n d ) \times f }$ , whose columns are vectors in $C ^ { 0 } ( G ; { \mathcal { F } } )$ We are interested in the spatially discretised sheaf diffusion process governed by the following PDE:
|
| 69 |
+
|
| 70 |
+
$$
|
| 71 |
+
\mathbf { X } ( 0 ) = \mathbf { X } , \quad \dot { \mathbf { X } } ( t ) = - \Delta \ v { \tau } _ { \mathcal { F } } \mathbf { X } ( t ) .
|
| 72 |
+
$$
|
| 73 |
+
|
| 74 |
+
It can be shown that in the time limit, each feature channel is projected into $\ker ( \Delta \tau )$ [34]. As described above (up to a $D ^ { - 1 / 2 }$ normalisation), this space contains the signals that agree with the restriction maps of the sheaf along all the edges. Thus, sheaf diffusion can be seen as a ‘synchronisation’ process over the graph, where all the private opinions converge towards global agreement.
|
| 75 |
+
|
| 76 |
+
In this section, we investigate the expressive power of this process within the infinite time limit. Because the asymptotic behaviour of sheaf diffusion is determined by the properties of $\ker ( \Delta _ { \mathcal { F } } )$ , in Section 3.1, we investigate when this subspace is non-trivial (i.e. it contains more than just the zero vector). In Section 3.2, we use this characterisation of the harmonic space to study what sort of sheaf diffusion processes will asymptotically produce projections into $\ker ( \Delta \tau )$ that can linearly separate the classes for various kinds of graphs and initial conditions. Since diffusion converges exponentially fast, the following results are also relevant for models with finite integration time or layers.
|
| 77 |
+
|
| 78 |
+
# 3.1 Harmonic Space of Sheaf Laplacians
|
| 79 |
+
|
| 80 |
+
A major role in the analysis below is played by discrete vector bundles, and we concentrate on this case. We note though that our results below generalise to the general linear group $\mathcal { F } _ { v \leq e } \in G L ( d )$ , the Lie group of $d \times d$ invertible matrices, provided we can also control the norm of the restriction maps from below. Given a discrete $O ( d )$ -bundle, $\mathcal { F } _ { v \le e } ^ { \top } \mathcal { F } _ { v \le e } = \mathbf { I } _ { d }$ and the block diagonal of $L _ { \mathcal { F } }$ has a diagonal structure since $\boldsymbol { L } _ { \mathcal { F } _ { v v } } = d _ { v } \mathbf { I } _ { d }$ , where √ $\bar { d } _ { v }$ is the degree of node $v$ . Accordingly, if a signal $\tilde { \mathbf { x } } \in \ker ( L _ { \mathcal { F } } )$ , then the signal $\mathbf { x } : v \mapsto \sqrt { d _ { v } } \tilde { \mathbf { x } } _ { v } \in \ker ( \bar { \Delta _ { \mathcal { F } } } )$ and similarly for the inverse transformation.
|
| 81 |
+
|
| 82 |
+
Key to our analysis is studying transport operators induced by the restriction maps of the sheaf. Given nodes $v , u \in V$ and a path $\gamma _ { v \to u } = ( v , v _ { 1 } , \ldots , v _ { \ell } , u )$ from $v$ to $u$ , we consider a notion of transport from the stalk $\mathcal { F } ( v )$ to the stalk $\mathcal { F } ( u )$ , constructed by composing restriction maps (and their transposes) along the edges:
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
\mathbf { P } _ { v u } ^ { \gamma } : = ( \mathcal { F } _ { u \leq e } ^ { \top } \mathcal { F } _ { v _ { \ell } \leq e } ) \ldots ( \mathcal { F } _ { v _ { 1 } \leq e } ^ { \top } \mathcal { F } _ { v \leq e } ) : \mathcal { F } ( v ) \mathcal { F } ( u ) .
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
For general sheaf structures, the graph transport is path dependent, meaning that how the vectors are transported across two nodes depends on the path between them (see Figure 2). In fact, we show that this property characterises the spectral gap of a sheaf Laplacian, i.e. the smallest eigenvalue of $\Delta { _ { \mathcal { F } } }$ .
|
| 89 |
+
|
| 90 |
+
Proposition 3. If $\mathcal { F }$ is $a$ discrete $O ( d )$ bundle over a connected graph and $r : = { \ o }$ $\begin{array} { r } { \operatorname* { m a x } _ { \gamma _ { v \to u } , \gamma _ { v \to u } ^ { \prime } } | | \mathbf { P } _ { v \to u } ^ { \gamma } - \mathbf { P } _ { v \to u } ^ { \gamma ^ { \prime } } | | } \end{array}$ , then we have $\lambda _ { 0 } ^ { \mathcal { F } } \le r ^ { 2 } / 2$ .
|
| 91 |
+
|
| 92 |
+
A consequence of this result is that there is always a non-trivial harmonic space (i.e. $\lambda _ { 0 } ^ { \mathcal { F } } = 0 \rangle$ ) if the transport maps generated by an orthogonal sheaf are path-independent (i.e. $r = 0$ ). Next, we address the opposite direction.
|
| 93 |
+
|
| 94 |
+
Proposition 4. If $\mathcal { F }$ is a discrete $O ( d )$ bundle over a connected graph and $\mathbf { x } \in H ^ { 0 } ( G , { \mathcal { F } } )$ , then for any cycle $\gamma$ based at $v \in V$ we have $\mathbf { x } _ { v } \in \ker ( \mathbf { P } _ { v v } ^ { \gamma } - \mathbf { I } )$ .
|
| 95 |
+
|
| 96 |
+
This proposition highlights the interplay between the graph and the sheaf structure. A simple consequence of this result is that for any cycle-free subset $S \subset V$ , we have that any sheaf (or connection-) Laplacian restricted to $S$ always admits a non-trivial harmonic space. A natural question connected to the previous result is whether a Cheeger-like inequality holds in the other direction. This turns out to be the case:
|
| 97 |
+
|
| 98 |
+
Proposition 5. Let $\mathcal { F }$ be a discrete $O ( d )$ bundle over a connected graph $G$ with n nodes and let $| | ( \bar { \mathbf { P } _ { v \to v } ^ { \gamma } } - \mathbf { I } ) \mathbf { x } _ { v } | | \geq \epsilon | | \mathbf { x } _ { v } | |$ for all cycles $\gamma _ { v v }$ . Then $\lambda _ { 0 } ^ { \mathcal { F } } \geq \epsilon ^ { 2 } ( 2 \mathrm { d i a m } ( \tilde { G } ) n d _ { m a x } ) ^ { - 1 }$ .
|
| 99 |
+
|
| 100 |
+
While the bound above is of little use in practice, it shows how the spectral gap of a sheaf Laplacian is indeed related to the deviation of the transport maps from being path-independent, as measured by $\epsilon$ . We note that the Cheeger-like inequality presented here is not unique, and other types of bounds on $\lambda _ { 0 } ^ { \mathcal { F } }$ have been derived [2]. We conclude this section by further analysing the dimensionality of the harmonic space of discrete $O ( d )$ -bundles:
|
| 101 |
+
|
| 102 |
+
Lemma 6. Let $\mathcal { F }$ be a discrete $O ( d )$ bundle over a connected graph $G$ . Then $\mathrm { d i m } ( H ^ { 0 } ) \leq d$ and $\mathrm { d i m } ( H ^ { 0 } ) = d$ if and only if the transport is path-independent.
|
| 103 |
+
|
| 104 |
+

|
| 105 |
+
Figure 4: Diffusion process on $O ( 2 )$ -bundles progressively separates the classes of the graph.
|
| 106 |
+
|
| 107 |
+
# 3.2 The Linear Separation Power of Sheaf Diffusion
|
| 108 |
+
|
| 109 |
+
In what follows, we use the results above to analyse the ability of certain classes of sheaves to linearly separate the features in the limit of the diffusion processes they induce. We utilise this as a proxy for the capacity of certain diffusion processes to avoid oversmoothing.
|
| 110 |
+
|
| 111 |
+
Definition 7. A hypothesis class of sheaves with $d$ -dimensional stalks $\mathcal { H } ^ { d }$ has linear separation power over a family of graphs $\mathcal { G }$ if for any labelled graph $G = ( V , E ) \in \mathcal { G }$ , there is a sheaf $( { \mathcal { F } } , G ) { \mathrm { { \bar { \in } } } } { \mathcal { H } } ^ { d }$ that can linearly separate the classes of $G$ in the time limit of Equation $^ 3$ for almost all initial conditions.
|
| 112 |
+
|
| 113 |
+
Note that the restriction to almost all initial conditions is necessary because, in the limit, diffusion behaves like a projection in the harmonic space and there will always be degenerate initial conditions (e.g. the zero matrix) that will yield a zero projection. We will now show how the choice of the sheaf impacts the behaviour of the diffusion process. For this purpose, we will consider a hierarchy of increasingly general classes of sheaves.
|
| 114 |
+
|
| 115 |
+
Symmetric invertible. $\mathcal { H } _ { \mathrm { s y m } } ^ { d } : = \{ ( \mathcal { F } , G ) : \mathcal { F } _ { v \leq e } = \mathcal { F } _ { u \leq e }$ , $\operatorname* { d e t } ( \mathcal { F } _ { v \leq e } ) \neq 0 \}$ . We note that for $d = 1$ , the sheaf Laplacians induced by this class of sheaves coincides with the set of the wellknown weighted graph Laplacians with strictly positive weights, which also includes the usual graph Laplacian (see proof in Appendix B). Therefore, this hypothesis class is of particular interest since it includes those graph Laplacians typically used by graph convolutional models such as GCN [39] and ChebNet [20]. We first show that this class of sheaf Laplacians can linearly separate the classes in binary classification settings under certain homophily assumptions:
|
| 116 |
+
|
| 117 |
+
Proposition 8. Let $\mathcal { G }$ be the set of connected graphs $G = ( V , E )$ with two classes $A , B \subset V$ such that for each $v \in A$ , there exists $u \in A$ and an edge $( v , u ) \in E$ . Then $\mathcal { H } _ { \mathrm { s y m } } ^ { 1 }$ has linear separation power over $\mathcal { G }$ .
|
| 118 |
+
|
| 119 |
+
In contrast, under certain heterophilic conditions, this hypothesis class is not powerful enough to linearly separate the two classes no matter what the initial conditions are:
|
| 120 |
+
|
| 121 |
+
Proposition 9. Let $\mathcal { G }$ be the set of connected bipartite graphs $G = ( A , B , E )$ , with partitions $A , B$ forming two classes and $| A | = | B |$ . Then $\mathcal { H } _ { \mathrm { s y m } } ^ { 1 }$ cannot linearly separate the classes of any graph in $\mathcal { G }$ for any initial conditions $\mathbf { X } ( 0 ) \in \mathbb { R } ^ { n \times f }$ .
|
| 122 |
+
|
| 123 |
+
Non-symmetric invertible. $\mathcal { H } ^ { d } : = \{ ( \mathcal { F } , G ) : \operatorname* { d e t } ( \mathcal { F } _ { v \leq e } ) \neq 0 \}$ . This larger hypothesis class addresses the above limitation by allowing non-symmetric relations:
|
| 124 |
+
|
| 125 |
+
Proposition 10. Let $\mathcal { G }$ contain all the connected graphs $G = ( V , E )$ with two classes $A , B \subseteq V$ . Consider a sheaf $( { \mathcal { F } } ; G ) \in { \mathcal { H } } ^ { 1 }$ with $\mathcal { F } _ { v \le e } = - \alpha _ { e }$ if $v \in A$ and $\mathcal { F } _ { u \leq e } = \alpha _ { e }$ if $u \in B$ with $\alpha _ { e } > 0$ for all $e \in E$ . Then the diffusion induced by $( { \mathcal { F } } ; G )$ can linearly separate the classes of $G$ for almost all initial conditions, and $\mathcal { H } ^ { 1 }$ has linear separation power over $\mathcal { G }$ .
|
| 126 |
+
|
| 127 |
+
Since $\mathcal { F } _ { v \le e } ^ { \top } \mathcal { F } _ { u \le e } = \pm \alpha _ { e } ^ { 2 }$ , the type of sheaf above can be interpreted as a discrete $O ( 1 )$ -bundle over a weighted graph with edge weights $\alpha _ { e } ^ { 2 }$ and transport maps $\mathcal { F } _ { v \leq e } ^ { \top } \mathcal { F } _ { u \leq e } = - 1$ for the inter-class edges and for the intra-class edges. Intuitively, this type of transport, which is path-independent, polarises the features of the two classes and forces them to take opposite signs in the infinite limit. This provides a sheaf-theoretic explanation for why negatively-weighted edges have been widely adopted in heterophilic settings [7, 17, 72].
|
| 128 |
+
|
| 129 |
+
So far we have only studied the effects of changing the type of sheaves in dimension one. We now consider the effects of adjusting the dimension of the stalks and begin by stating a fundamental limitation of (sheaf) diffusion when $d = 1$ .
|
| 130 |
+
|
| 131 |
+
Proposition 11. Let $G$ be a connected graph with $C \geq 3$ classes. Then, $\mathcal { H } ^ { 1 }$ cannot linearly separate the classes of $G$ for any initial conditions $\mathbf { X } ( 0 ) \in \mathbb { R } ^ { n \times f }$ .
|
| 132 |
+
|
| 133 |
+
This is essentially a consequence of $\mathrm { d i m } \big ( \mathrm { k e r } ( \Delta _ { \mathcal { F } } ) \big ) \leq 1$ in this case, by virtue of Lemma 6. From a GNN perspective, this means that in the infinite depth setting, sufficient stalk width (i.e., dimension $d )$ is needed in order to solve tasks involving more than two classes. Note that $d$ is different from the classical notion of feature channels $f$ . As the result above shows, the latter has no effect on the linear separability of the classes in $d = 1$ . Next, we will see that the former does.
|
| 134 |
+
|
| 135 |
+
Diagonal invertible. $\mathcal { H } ^ { d } : = \{ ( \mathcal { F } , G )$ : diagonal $\mathcal { F } _ { v \le e }$ , $\operatorname* { d e t } ( \mathcal { F } _ { v \leq e } ) \neq 0 \}$ . The sheaves in this class can be seen as $d$ independent sheaves from $\mathcal { H } ^ { 1 }$ encoded in the $d$ -dimensional diagonals of their restriction maps. This perspective allows us to generalise Proposition 10 to a multi-class setting:
|
| 136 |
+
|
| 137 |
+
Proposition 12. Let $\mathcal { G }$ be the set of connected graphs with nodes belonging to $C \geq 3$ classes. Then for $d \geq C$ , $\mathcal { H } _ { \mathrm { d i a g } } ^ { d }$ has linear separation power over $\mathcal { G }$ .
|
| 138 |
+
|
| 139 |
+
This result illustrates the benefits of using higher-dimensional stalks while maintaining a simple and computationally convenient class of diagonal restriction maps. Next, with more complex restriction maps, we can show that lower-dimensional stalks can be used to achieve linear separation in the presence of even more classes.
|
| 140 |
+
|
| 141 |
+
Orthogonal. $\mathcal { H } _ { \mathrm { o r t h } } ^ { d } : = \{ ( \mathcal { F } , G ) : \mathcal { F } _ { v \leq e } \in O ( d ) \}$ is the class of $O ( d )$ -bundles. Orthogonal maps are able to make more efficient use of the space available to them than diagonal restriction maps:
|
| 142 |
+
|
| 143 |
+
Proposition 13. Let $\mathcal { G }$ be the class of connected graphs with $C \leq 2 d$ classes. Then, for all $d \in \{ 2 , 4 \}$ , $\mathcal { H } _ { \mathrm { o r t h } } ^ { d }$ has linear separation power over $\mathcal { G }$ .
|
| 144 |
+
|
| 145 |
+
Figure 4 includes an example diffusion process over an $O ( 2 )$ -bundle.
|
| 146 |
+
|
| 147 |
+
Summary: Different sheaf classes give rise to different behaviours of the diffusion process and, consequently, to different separation capabilities. Taken together, these results show that solving any node classification task can be reduced to performing diffusion with the right sheaf.
|
| 148 |
+
|
| 149 |
+
# 4 Expressive Power of Sheaf Convolutions
|
| 150 |
+
|
| 151 |
+
Analogously to how GCN augments heat diffusion, we can construct a Sheaf Convolutional Network (SCN) augmenting the sheaf diffusion process. In this section, we analyse the capacity of SCNs to change, if necessary, their asymptotic behaviour compared to the base diffusion process. Since the sheaf structure will be ultimately learned from data, this is particularly important for the common setting when the learned sheaf is different from the “ground truth” sheaf for the task to be solved.
|
| 152 |
+
|
| 153 |
+
The continous diffusion process from Equation 3 has the Euler discretisation with unit step-size ${ \bf X } ( t + 1 ) = { \bf X } ( t ) - \Delta \mathcal { F } \bar { \bf X } ( t ) = ( { \bf I } _ { n d } - \bar { \Delta _ { \mathcal { F } } } ) { \bf X } ( t )$ . Assuming $\mathbf { X } \in \mathbb { R } ^ { n d \times f _ { 1 } }$ , we can equip the right side with weight matrices $\mathbf { W } _ { 1 } \in \mathbb { R } ^ { d \times d }$ , $\mathbf { W } _ { 2 } \in \mathbb { R } ^ { f _ { 1 } \times f _ { 2 } }$ and a non-linearity $\sigma$ to arrive at the following model originally proposed by Hansen and Gebhart [32]:
|
| 154 |
+
|
| 155 |
+
$$
|
| 156 |
+
\begin{array} { r } { \mathbf { Y } = \sigma \Big ( \big ( \mathbf { I } _ { n d } - \Delta _ { \mathcal { F } } \big ) ( \mathbf { I } _ { n } \otimes \mathbf { W } _ { 1 } ) \mathbf { X } \mathbf { W } _ { 2 } \Big ) \in \mathbb { R } ^ { n d \times f _ { 2 } } , } \end{array}
|
| 157 |
+
$$
|
| 158 |
+
|
| 159 |
+
where $f _ { 1 } , f _ { 2 }$ are the number of input and output feature channels, and $\otimes$ denotes the Kronecker product. Here, $\mathbf { W } _ { 1 }$ multiplies from the left the vector feature of all the nodes in all channels (i.e. $\mathbf { \bar { W } } _ { 1 } \mathbf { x } _ { v } ^ { i }$ for all $v$ and channels $i$ ), while $\mathbf { W } _ { 2 }$ multiplies the features from the right and can adjust the number of feature channels, just like in GCNs. As one would expect, when using a trivial sheaf, $\Delta _ { \mathcal { F } } = \Delta _ { 0 }$ , $\mathbf { W } _ { 1 }$ becomes a scalar and one recovers the GCN of Kipf and Welling [39]. To see how SCNs behave compared to their base diffusion process, we investigate how SCN layers affect the sheaf Dirichlet energy $E _ { \mathcal { F } } ( \mathbf { x } )$ , which sheaf diffusion is known to minimise over time.
|
| 160 |
+
|
| 161 |
+
$$
|
| 162 |
+
\begin{array} { r } { { E } _ { \mathcal { F } } ( \mathbf { x } ) : = \mathbf { x } ^ { \top } \Delta _ { \mathcal { F } } \mathbf { x } = \frac { 1 } { 2 } \sum _ { e : = ( v , u ) } \| \mathcal { F } _ { v \leq e } D _ { v } ^ { - 1 / 2 } \mathbf { x } _ { v } - \mathcal { F } _ { u \leq e } D _ { u } ^ { - 1 / 2 } \mathbf { x } _ { u } \| _ { 2 } ^ { 2 } } \end{array}
|
| 163 |
+
$$
|
| 164 |
+
|
| 165 |
+
Similarly, for multiple channels the energy is $E _ { \mathcal { F } } ( \mathbf { X } ) : = \operatorname { t r a c e } ( \mathbf { X } ^ { \top } \Delta _ { \mathcal { F } } \mathbf { X } )$ . This is a measure of how close a signal $\mathbf { x }$ is to $\ker ( \Delta _ { \mathcal { F } } )$ and it is easy to see that $\mathbf { x } \in \ker ( \Delta _ { \mathcal { F } } ) \Leftrightarrow E _ { \mathcal { F } } ( \mathbf { x } ) = 0$ . We begin by studying the sheaves for which the energy decreases and representations end up asymptotically in $\ker ( \Delta \tau )$ . Let $\begin{array} { r } { \lambda _ { * } : = \operatorname* { m a x } _ { i > 0 } \big ( \lambda _ { i } ^ { \mathcal { F } } - 1 \big ) ^ { 2 } \overset { \smile } { \le } 1 } \end{array}$ and denote by $\mathcal { \hat { H } } _ { + } ^ { 1 } : = \{ ( \mathcal { F } , G ) ~ | ~ \mathcal { F } _ { v \underline { { { \triangle } } } e } \mathcal { \bar { F } } _ { u \underline { { { \diamondsuit } } } e } > 0 \}$ .
|
| 166 |
+
|
| 167 |
+
Theorem 15. For $( { \mathcal { F } } , G ) \in { \mathcal { H } } _ { + } ^ { 1 }$ and $\sigma$ being (Leaky)ReLU, $E _ { \mathcal { F } } ( \mathbf { Y } ) \leq \lambda _ { * } \| \mathbf { W } _ { 1 } \| _ { 2 } ^ { 2 } \| \mathbf { W } _ { 2 } ^ { \top } \| _ { 2 } ^ { 2 } E _ { \mathcal { F } } ( \mathbf { X } )$ .
|
| 168 |
+
|
| 169 |
+
This generalises existent results for GCNs [13, 51] and proves that SCNs using this family of Laplacians, which includes all weighted graph Laplacians, exponentially converge to $\ker ( \Delta \dot { \mathcal { F } } )$ if $\lambda _ { * } \mathbf { \bar { \| } W _ { 1 } \| _ { 2 } ^ { 2 } } \| \mathbf { W } _ { 2 } ^ { \top } \| _ { 2 } ^ { 2 } < 1$ . In particular, if $E _ { \mathcal { F } } ( { \bf X } ) = 0$ , then $E _ { \mathcal { F } } ( \mathbf { Y } ) = 0$ and the representations remain trapped inside the kernel no matter what the norm of the weights is. Therefore, in settings as those described by Propositions 9 and 11, the linear separation capabilities of this class of models are severely limited (see Corollaries 36, 37 in Appendix B).
|
| 170 |
+
|
| 171 |
+
Finally, the Theorem also extends to bundles with symmetric maps, $\mathcal { H } _ { \mathrm { { o r t h , s y m } } } ^ { d } : = \mathcal { H } _ { \mathrm { { o r t h } } } ^ { d } \cap \mathcal { H } _ { \mathrm { { s y m } } } ^ { d }$
|
| 172 |
+
|
| 173 |
+
Theorem 16. If $( \mathcal { F } , G ) \in \mathcal { H } _ { \mathrm { o r t h , s y m } } ^ { d }$ and $\begin{array} { r } { \sigma = ( L e a k y ) R e L U , E _ { \mathcal { F } } ( \mathbf { Y } ) \leq \lambda _ { * } \| \mathbf { W } _ { 1 } \| _ { 2 } ^ { 2 } \| \mathbf { W } _ { 2 } ^ { \top } \| _ { 2 } ^ { 2 } E _ { \mathcal { F } } ( \mathbf { X } ) . } \end{array}$
|
| 174 |
+
|
| 175 |
+
In some sense, this is not surprising because, for this class, $\ker ( \Delta \tau )$ contains the same information as the kernel of the classical normalised graph Laplacian (see Proposition 29 in Appendix C).
|
| 176 |
+
|
| 177 |
+
More generally, SCNs with sheaves outside Dirichlet energy using an arbitrarily small $\mathcal { H } _ { \mathrm { s y m } } ^ { d }$ , are much mor transformation xible and can easily increase the: $\mathbf { W } _ { 1 }$
|
| 178 |
+
|
| 179 |
+
Proposition 17. For any connected graph $G$ and $\varepsilon > 0$ , there exist a sheaf $( G , { \mathcal { F } } ) \not \in { \mathcal { H } } _ { \mathrm { s y m } } ^ { d }$ , $\mathbf { W } _ { 1 }$ with $\| \mathbf { W } _ { 1 } \| _ { 2 } < \varepsilon$ and feature vector x such that $E _ { \mathcal { F } } ( ( \mathbf { I } \otimes \mathbf { W } _ { 1 } ) \mathbf { x } ) > E _ { \mathcal { F } } ( \mathbf { x } )$ .
|
| 180 |
+
|
| 181 |
+
Importantly, this proves that this family of SCNs can, if necessary, escape the kernel of the Laplacian.
|
| 182 |
+
|
| 183 |
+
Summary: Not only that sheaf diffusion is more expressive than heat diffusion as shown in Section 3.2, but SCNs are also more expressive than GCNs in the sense that they are generally not constrained to decrease the Dirichlet energy when using low-norm weights. This provides them with greater control than GCNs over their asymptotic behaviour.
|
| 184 |
+
|
| 185 |
+
# 5 Neural Sheaf Diffusion and Sheaf Learning
|
| 186 |
+
|
| 187 |
+
In the previous sections, we discussed the various advantages provided by sheaf diffusion and sheaf convolutions. However, in general, the ground truth sheaf is unknown or unspecified. Therefore, we aim to learn the underlying sheaf from data end-to-end, thus allowing the model to pick the right geometry for solving the task.
|
| 188 |
+
|
| 189 |
+
Neural Sheaf Diffusion. We propose the diffusion-type model from Equation 5. We note that by setting $\mathbf { W } _ { 1 } , \mathbf { W } _ { 2 }$ to identity and $\bar { \sigma ( \mathbf { x } ) } = \mathrm { E L U } ( \epsilon \mathbf { x } ) / \epsilon$ with $\epsilon > 0$ small enough or simply $\sigma = \mathrm { i d }$ , we recover (up to a scaling) the sheaf diffusion equation. Therefore, the model is at least as expressive as sheaf diffusion and benefits from all the positive properties outlined in Section 3.2.
|
| 190 |
+
|
| 191 |
+
$$
|
| 192 |
+
\begin{array} { r } { \dot { \mathbf { X } } ( t ) = - \sigma \Big ( \Delta _ { \mathcal { F } ( t ) } ( \mathbf { I } _ { n } \otimes \mathbf { W } _ { 1 } ) \mathbf { X } ( t ) \mathbf { W } _ { 2 } \Big ) , } \end{array}
|
| 193 |
+
$$
|
| 194 |
+
|
| 195 |
+
Crucially, the sheaf Laplacian $\Delta _ { \mathcal { F } ( t ) }$ is that of a sheaf $( G , { \mathcal { F } } ( t ) )$ that evolves over time. More specifically, the evolution of the sheaf structure is described by a learnable function of the data $( \mathbf { \bar { \boldsymbol { G } } } , \mathcal { F } ( t ) ) \stackrel { \cdot } { = } g ( \boldsymbol { G } , \mathbf { X } ( t ) ; \theta )$ . This allows the model to use the latest available features to manipulate the underlying geometry of the graph and, implicitly, the behaviour of the diffusion process. Additionally, We use an MLP followed by a reshaping to map the raw features of the dataset to a matrix $\mathbf { X } ( 0 )$ of shape $n d \times f$ and a final linear layer to perform the node classification.
|
| 196 |
+
|
| 197 |
+
In our experiments, we focus on the time-discretised version of this model from Equation 6, which allows us to use a new set of weights at each layer $t$ while maintaining the nice theoretical properties of the model above.
|
| 198 |
+
|
| 199 |
+
$$
|
| 200 |
+
\begin{array} { r } { \mathbf { X } _ { t + 1 } = \mathbf { X } _ { t } - \sigma \Big ( \Delta _ { \mathcal { F } ( t ) } ( \mathbf { I } \otimes \mathbf { W } _ { 1 } ^ { t } ) \mathbf { X } _ { t } \mathbf { W } _ { 2 } ^ { t } \Big ) } \end{array}
|
| 201 |
+
$$
|
| 202 |
+
|
| 203 |
+
We note that this model is different from the SCN model from Equation 4 in two major ways. First, Hansen and Gebhart [32] used a hand-crafted sheaf with $d = 1$ , constructed in a synthetic setting with full knowledge of the data-generating process. In contrast, we learn a sheaf, which makes our model applicable to any real-world graph dataset, even in the absence of a sheaf structure. Additionally, motivated by our theoretical results, we use the full generality of sheaves by using stalks with $d \geq 1$ and higher-dimensional maps. Second, our model uses a residual parametrisation of the discretised diffusion process, which empirically improves its performance.
|
| 204 |
+
|
| 205 |
+
Sheaf Learning. The restriction maps are learned using locally available information. Each $d \times d$ matrix $\mathcal { F } _ { v \le e }$ is learned via a parametric matrix-valued function $\Phi$ , with $\mathcal { F } _ { v \underline { { \sf { d e } } } : = ( v , u ) } = \Phi ( \mathbf { x } _ { v } , \mathbf { x } _ { u } )$
|
| 206 |
+
|
| 207 |
+

|
| 208 |
+
Figure 5: (Left) Train and (Middle) test accuracy as a function of diffusion time. (Right) Histogram of the learned scalar transport maps. The performance of the sheaf diffusion model is superior to that of weighted-graph diffusion and correctly learns to invert the features of the two classes.
|
| 209 |
+
|
| 210 |
+
This function must be non-symmetric to be able to learn asymmetric transport maps along each edge. In practice, we set $\Phi ( \mathbf { x } _ { v } , \mathbf { x } _ { u } ) = \sigma ( \mathbf { V } [ \mathbf { x } _ { v } | | \mathbf { x } _ { u } ] )$ followed by a reshaping of the output, where $\mathbf { V }$ is a weight matrix. For simplicity, the equations above use a single feature channel, but in practice, all channels are supplied as input. More generally, we can show that if the function $\Phi$ has enough capacity and the features are diverse enough, we can learn any sheaf over a graph.
|
| 211 |
+
|
| 212 |
+
Proposition 18. Let $G = ( V , E )$ be a finite graph with features X. Then, $i f \left( \mathbf { x } _ { v } , \mathbf { x } _ { u } \right) \neq \left( \mathbf { x } _ { w } , \mathbf { x } _ { z } \right)$ for any ${ \bf \bar { \Phi } } ( v , u ) \neq ( w , z ) \in E$ and $\Phi$ is an MLP with sufficient capacity, $\Phi$ can learn any sheaf $( { \mathcal { F } } ; G )$ .
|
| 213 |
+
|
| 214 |
+
First, this result formally motivates learning a sheaf at each layer since the model can learn to distinguish more nodes after each aggregation step. Second, this suggests that more expressive models (in the Weisfeiler-Lehman sense [8, 9, 46, 71]) could learn a more general family of sheaves. We leave a deeper investigation of these aspects for future work. In what follows, we distinguish between several types of functions $\Phi$ depending on the type of matrix they learn.
|
| 215 |
+
|
| 216 |
+
Diagonal. The main advantage of this parametrisation is that fewer parameters need to be learned per edge, and the sheaf Laplacian ends up being a matrix with diagonal blocks, which also results in fewer operations in sparse matrix multiplications. The main disadvantage is that the $d$ dimensions of the stalks interact only via the left $\mathbf { W } _ { 1 }$ multiplication.
|
| 217 |
+
|
| 218 |
+
Orthogonal. In this case, the model effectively learns a discrete vector bundle. Orthogonal matrices provide several advantages: (1) they can mix the various dimension of the stalks, (2) the orthogonality constraint prevents overfitting while reducing the number of parameters, (3) they have better understood theoretical properties, and (4) the resulting Laplacians are easier to normalise numerically since the diagonal entries correspond to the degrees of the nodes. In our model, we build orthogonal matrices from a composition of Householder reflections [45].
|
| 219 |
+
|
| 220 |
+
General. Finally, we consider the most general option of learning arbitrary matrices. The maximal flexibility these maps provide can be useful, but it also comes with the danger of overfitting. At the same time, the sheaf Laplacian is more challenging to normalise numerically since one has to compute $D ^ { - 1 / 2 }$ for a positive semi-definite matrix $D$ . To perform this at scale, one has to rely on SVD, whose gradients can be infinite if $D$ has repeated eigenvalues. Therefore, this model is more challenging to train.
|
| 221 |
+
|
| 222 |
+
Computational Complexity. The GCN from Equation 2 has complexity $O ( n c ^ { 2 } + m c )$ , where $c$ is the number of channels and $m$ the number of edges. Assume a sheaf diffusion model with stalk dimension $d$ and $f$ channels such that $d \times f = c$ (i.e. same representation size). Then, when the model uses diagonal maps, the complexity is $O ( n c ^ { 2 } + m d c )$ . When using orthogonal or general matrices, the complexity becomes $\mathcal { O } ( n ( c ^ { 2 } + d ^ { 3 } ) + m ( c d ^ { 2 } + d ^ { 3 } ) )$ (see Appendix E.1 for detailed derivations). In practice, we use $1 \leq d \leq 5$ , which effectively results in a constant overhead compared to GCN.
|
| 223 |
+
|
| 224 |
+
# 6 Experiments
|
| 225 |
+
|
| 226 |
+
Synthetic experiments. We consider a simple setup given by a connected bipartite graph with equally sized partitions. We sample the features from two overlapping isotropic Gaussian distributions to make the classes linearly non-separable at initialisation time. From Proposition 9, we know that diffusion models using symmetric restriction maps cannot separate the classes in the limit, while a diffusion process using negative transport maps can. Therefore, we use two vanilla sheaf diffusion processes by setting $d = 1$ , ${ \mathbf W } _ { 1 } = { \mathbf I } _ { d }$ , ${ \bf W } _ { 2 } = { \bf I } _ { f }$ and $\sigma = \mathrm { i d }$ in Equation 5. In both models, we learn a sheaf at $t = 0$ as a function of $\mathbf { X } ( 0 )$ , and we keep the sheaf constant over time. For the first model, we learn a sheaf with general maps $\mathcal { F } _ { v \le e } \in \mathbb { R }$ . For the second model, we use a similar layer but constraint $\mathcal { F } _ { v \le e } = \mathcal { F } _ { u \le e }$ , obtaining a weighted graph Laplacian.
|
| 227 |
+
|
| 228 |
+
Table 1: Results on node classification datasets sorted by their homophily level. Top three models are coloured by First, Second, Third. Our models are marked NSD.
|
| 229 |
+
|
| 230 |
+
<table><tr><td>Hom level</td><td>Texas 0.11</td><td>Wisconsin 0.21</td><td>Film 0.22</td><td>Squirrel 0.22</td><td>Chameleon 0.23</td><td>Cornell 0.30</td><td>Citeseer 0.74</td><td>Pubmed 0.80</td><td>Cora 0.81</td></tr><tr><td>#Nodes #Edges</td><td>183 295</td><td>251 466</td><td>7,600 26,752</td><td>5,201 198,493</td><td>2,277 31,421</td><td>183 280</td><td>3,327 4,676</td><td>18,717 44,327</td><td>2,708 5,278</td></tr><tr><td>#Classes</td><td>5</td><td>5</td><td>5</td><td>5</td><td>5</td><td>5</td><td>7</td><td>3</td><td>6</td></tr><tr><td>Diag-NSD</td><td>85.67±6.95</td><td>88.63±2.75</td><td>37.79±1.01</td><td>54.78±1.81</td><td>68.68±1.73</td><td>86.49±7.35</td><td>77.14±1.85</td><td>89.42±0.43</td><td>87.14±1.06</td></tr><tr><td>O(d)-NSD</td><td>85.95±5.51</td><td>89.41±4.74</td><td>37.81±1.15</td><td>56.34±1.32</td><td>68.04±1.58</td><td>84.86±4.71</td><td>76.70±1.57</td><td>89.49±0.40</td><td>86.90±1.13</td></tr><tr><td>Gen-NSD</td><td>82.97±5.13</td><td>89.21±3.84</td><td>37.80±1.22</td><td>53.17±1.31</td><td>67.93±1.58</td><td>85.68±6.51</td><td>76.32±1.65</td><td>89.33±0.35</td><td>87.30±1.15</td></tr><tr><td>GGCN</td><td>84.86±4.55</td><td>86.86±3.29</td><td>37.54±1.56</td><td>55.17±1.58</td><td>71.14±1.84</td><td>85.68±6.63</td><td>77.14±1.45</td><td>89.15±0.37</td><td>87.95±1.05</td></tr><tr><td>H2GCN</td><td>84.86±7.23</td><td>87.65±4.98</td><td>35.70±1.00</td><td>36.48±1.86</td><td>60.11±2.15</td><td>82.70±5.28</td><td>77.11±1.57</td><td>89.49±0.38</td><td>87.87±1.20</td></tr><tr><td>GPRGNN</td><td>78.38±4.36</td><td>82.94±4.21</td><td>34.63±1.22</td><td>31.61±1.24</td><td>46.58±1.71</td><td>80.27±8.11</td><td>77.13±1.67</td><td>87.54±0.38</td><td>87.95±1.18</td></tr><tr><td>FAGCN</td><td>82.43±6.89</td><td>82.94±7.95</td><td>34.87±1.25</td><td>42.59±0.79</td><td>55.22±3.19</td><td>79.19±9.79</td><td>N/A</td><td>N/A</td><td>N/A</td></tr><tr><td>MixHop</td><td>77.84±7.73</td><td>75.88±4.90</td><td>32.22±2.34</td><td>43.80±1.48</td><td>60.50±2.53</td><td>73.51±6.34</td><td>76.26±1.33</td><td>85.31±0.61</td><td>87.61±0.85</td></tr><tr><td>GCNII</td><td>77.57±3.83</td><td>80.39±3.40</td><td>37.44±1.30</td><td>38.47±1.58</td><td>63.86±3.04</td><td>77.86±3.79</td><td>77.33±1.48</td><td>90.15±0.43</td><td>88.37±1.25</td></tr><tr><td>Geom-GCN</td><td>66.76±2.72</td><td>64.51±3.66</td><td>31.59±1.15</td><td>38.15±0.92</td><td>60.00±2.81</td><td>60.54±3.67</td><td>78.02±1.15</td><td>89.95±0.47</td><td>85.35±1.57</td></tr><tr><td>PairNorm</td><td>60.27±4.34</td><td>48.43±6.14</td><td>27.40±1.24</td><td>50.44±2.04</td><td>62.74±2.82</td><td>58.92±3.15</td><td>73.59±1.47</td><td>87.53±0.44</td><td>85.79±1.01</td></tr><tr><td>GraphSAGE</td><td>82.43±6.14</td><td>81.18±5.56</td><td>34.23±0.99</td><td>41.61±0.74</td><td>58.73±1.68</td><td>75.95±5.01</td><td>76.04±1.30</td><td>88.45±0.50</td><td>86.90±1.04</td></tr><tr><td>GCN</td><td>55.14±5.16</td><td>51.76±3.06</td><td>27.32±1.10</td><td>53.43±2.01</td><td>64.82±2.24</td><td>60.54±5.30</td><td>76.50±1.36</td><td>88.42±0.50</td><td>86.98±1.27</td></tr><tr><td>GAT</td><td>52.16±6.63</td><td>49.41±4.09</td><td>27.44±0.89</td><td>40.72±1.55</td><td>60.26±2.50</td><td>61.89±5.05</td><td>76.55±1.23</td><td>87.30±1.10</td><td>86.33±0.48</td></tr><tr><td>MLP</td><td>80.81±4.75</td><td>85.29±3.31</td><td>36.53��0.70</td><td>28.77±1.56</td><td>46.21±2.99</td><td>81.89±6.40</td><td>74.02±1.90</td><td>87.16±0.37</td><td>75.69±2.00</td></tr></table>
|
| 231 |
+
|
| 232 |
+
Figure 5 presents the results across five seeds. As expected, for diffusion time zero (i.e. no diffusion), we see that a linear classifier cannot separate the classes. At later times, the diffusion process using symmetric maps cannot perfectly fit the data. In contrast, with the more general sheaf diffusion, as time increases and the signal approaches the harmonic space, the model gets better and the features become linearly separable. In the last subfigure, we take a closer look at the sheaf that the model learns in the time limit by plotting a histogram of all the transport (scalar) maps $\mathcal { F } _ { v \le { e } } ^ { \top } \mathcal { F } _ { u \le { e } }$ . In accordance with Proposition 10, the model learns a negative transport map for all edges. This shows that the model manages to avoid oversmoothing (see Appendix F for an experiment with $d > 1$ ).
|
| 233 |
+
|
| 234 |
+
Real-world experiments. We test our models on multiple real-world datasets [47, 53, 57, 61, 66] with an edge homophily coefficient $h$ ranging from $h = 0 . 1 1$ (very heterophilic) to $h = 0 . 8 1$ (very homophilic). Therefore, they offer a view of how a model performs over this entire spectrum. We evaluate our models on the 10 fixed splits provided by Pei et al. [53] and report the mean accuracy and standard deviation. Each split contains $4 8 \% / 3 2 \% / 2 \dot { 0 } \%$ of nodes per class for training, validation and testing, respectively. As baselines, we use an ample set of GNN models that can be placed in three categories: (1) classical: GCN [39], GAT [68], GraphSAGE [31]; (2) models specifically designed for heterophilic settings: GGCN [72], Geom-GCN [53], H2GCN [75], GPRGNN [17], FAGCN [7], MixHop [1]; (3) models addressing oversmoothing: GCNII [16], PairNorm [74]. All the results are taken from Yan et al. [72], except for FAGCN and MixHop, which come from Lingam et al. [41] and Zhu et al. [75], respectively. All of these were evaluated on the same set of splits as ours. In Appendix F we also include experiments with continuous GNN models.
|
| 235 |
+
|
| 236 |
+
Results. From Table 1 we see that our models are first in $5 / 6$ benchmarks with high heterophily $( h < 0 . 3 )$ and second-ranked on the remaining one (i.e. Chameleon). At the same time, NSD also shows strong performance on the homophilic graphs by being within approximately $1 \%$ of the top model. Overall, NSD models are among the top three models on $8 / 9$ datasets. The $O ( d )$ -bundle diffusion model performs best overall confirming the intuition that it can better avoid overfitting, while also transforming the vectors in sufficiently complex ways. We also remark on the strong performance of the model learning diagonals maps, despite the simpler functional form of the Laplacian.
|
| 237 |
+
|
| 238 |
+
# 7 Related Work, Discussion, and Conclusion
|
| 239 |
+
|
| 240 |
+
Sheaf Neural Networks & Sheaf Learning. Sheaf Neural Networks [32] with a hand-crafted sheaf Laplacian were originally introduced in a toy experimental setting. Since then, they have remained completely unexplored, and we hope this paper will fill this lacuna. In contrast to [32], we provide an ample theoretical analysis justifying the use of sheaves in Graph ML and study for the first time how sheaves can be learned from data using neural networks. Furthermore, we present the first successful application of Sheaf Neural Networks on real-world datasets. Hansen and Ghrist [33] have also considered learning a sheaf Laplacian by minimising directly in matrix space a regularised Dirichlet energy metric. Different from their approach, we learn the sheaf as part of an end-to-end model and use an efficient parametrisation that is independent of the size of the graph.
|
| 241 |
+
|
| 242 |
+
Follow-up works have also experimented with inferring a connection Laplacian directly from data at pre-processing time [3], combining sheaves with attention [4], and designing models based on the wave equation on sheaves [65]. Besides the sheaf Laplacians employed in all these works and ours, one can also use higher-order sheaf (connection) Laplacians that operate on higher-order tensors. These were shown to encode important information about the underlying symmetries in the data [55], which hints at the powerful data properties that Sheaf Neural Networks could potentially extract from these operators.
|
| 243 |
+
|
| 244 |
+
Heterophily and Oversmoothing. While good empirical designs jointly addressing these two problems have been proposed before [17, 72], Yan et al. [72] is the only other work connecting the two theoretically. Their analysis [72] is very different in terms of methods and assumptions and, therefore, their results are completely orthogonal. Concretely, the authors analyse the performance of linear SGCs [69] (i.e. GCN without nonlinearities) on random attributed graphs. In contrast, our analysis is not probabilistic, focuses on diffusion PDEs and also extends to GCNs in the non-linear regime. Furthermore, we employ a new set of mathematical tools from cellular sheaf theory, which brings a new language and new tools to analyse these problems. Perhaps the only commonality is that both works find evidence for the benefits of negatively signed edges in GNNs, although with different mathematical motivations. At the same time, other recent works [21, 42] have shown that GCNs with finite layers (typically one) can perform well in heterophilic graphs (including bipartite). This is in no contradiction with our results, which consider an infinite time/layer regime (i.e. not finite) and perfect linear separation (i.e. a model that cannot fit the data can still achieve high accuracy).
|
| 245 |
+
|
| 246 |
+
Category Theory and GNNs. From the perspective of category theory [43], cellular sheaves are a functor from a category describing the incidence structure of the graph to a category describing the data living on top of the graph. Informally, this says that the vertices and edges are mapped to some type of data (e.g. vector spaces) and the incidence relations between vertices and edges are mapped to some type of relation between the assigned data (e.g. linear maps between the vector spaces). The generality provided by this perspective could be used to extend the models described in this work to more exotic types of data such as lattices and their associated sheaf Laplacians [25]. At the same time, our work echoes other recent efforts to place GNNs on a categorical foundation [19, 22].
|
| 247 |
+
|
| 248 |
+
Message Passing Neural Networks. The layer from Equation 6 can be seen as a form of GNNFiLM layer [11, 54], where each node learns a linear message function conditioned on the features of the neighbours. Such models have been recently shown to perform well empirically in heterophilic settings [52]. At the same time, the model bares an algorithmic resemblance to GAT [68]. For a central node $v$ and a neighbouring node $u$ , GAT learns an attention coefficient $a _ { v u }$ , while our model learns a matrix given by the block $( v , u )$ of $\Delta { _ { \mathcal { F } } }$ . Finally, a message-passing procedure based on parallel transport has also been proposed by Haan et al. [30] in the context of geometric graphs (meshes). In the absence of a natural geometric structure on arbitrary graphs, in our case, the transport structure is learned from data end-to-end.
|
| 249 |
+
|
| 250 |
+
Limitations and societal impact. One of the main limitations of our theoretical analysis is that it does not address the generalisation properties of sheaves, but this remains a major impediment for the entire field of deep learning. Nonetheless, our setting was sufficient to produce many valuable insights about heterophily and oversmoothing and a basic understanding of what various types of sheaves can and cannot do. Much more work remains to be done in this direction, and we expect to see further cross-fertilization between ML and algebraic topology in the future. Finally, due to the theoretical nature of this work, we do not foresee any immediate negative societal impacts.
|
| 251 |
+
|
| 252 |
+
Conclusion. In this work, we used cellular sheaf theory to provide a novel topological perspective on heterophily and oversmoothing in GNNs. We showed that the underlying sheaf structure of the graph is intimately connected with both of these important factors affecting the performance of GNNs. To mitigate this, we proposed a new paradigm for graph representation learning where models not only evolve the features at each layer but also the underlying geometry of the graph. In practice, we demonstrated that this framework achieves competitive results in heterophilic settings.
|
| 253 |
+
|
| 254 |
+
# Acknowledgments and Disclosure of Funding
|
| 255 |
+
|
| 256 |
+
We are grateful to Iulia Duta, Dobrik Georgiev and Jacob Deasy for valuable comments on an earlier version of this manuscript. CB would also like to thank the Twitter Cortex team for making the research internship a fantastic experience. This research was supported in part by ERC Consolidator grant No. 724228 (LEMAN).
|
| 257 |
+
|
| 258 |
+
# References
|
| 259 |
+
|
| 260 |
+
[1] Sami Abu-El-Haija, Bryan Perozzi, Amol Kapoor, Hrayr Harutyunyan, Nazanin Alipourfard, Kristina Lerman, Greg Ver Steeg, and Aram Galstyan. Mixhop: Higher-order graph convolutional architectures via sparsified neighborhood mixing. In The Thirty-sixth International Conference on Machine Learning (ICML), 2019. URL http://proceedings.mlr.press/ v97/abu-el-haija19a/abu-el-haija19a.pdf.
|
| 261 |
+
[2] Afonso S Bandeira, Amit Singer, and Daniel A Spielman. A Cheeger inequality for the graph connection laplacian. SIAM Journal on Matrix Analysis and Applications, 34(4):1611–1630, 2013.
|
| 262 |
+
[3] Federico Barbero, Cristian Bodnar, Haitz Sáez de Ocáriz Borde, Michael Bronstein, Petar Velickovi ˇ c, and Pietro Liò. Sheaf neural networks with connection laplacians. In ´ ICML 2022 Workshop on Topology, Algebra, and Geometry in Machine Learning, 2022. [4] Federico Barbero, Cristian Bodnar, Haitz Sáez de Ocáriz Borde, and Pietro Lio. Sheaf attention networks. In NeurIPS 2022 Workshop on Symmetry and Geometry in Neural Representations, 2022.
|
| 263 |
+
[5] Lukas Biewald. Experiment tracking with weights and biases, 2020. URL https://www. wandb.com/. Software available from wandb.com.
|
| 264 |
+
[6] Christopher M. Bishop. Pattern Recognition and Machine Learning (Information Science and Statistics). Springer-Verlag, Berlin, Heidelberg, 2006. ISBN 0387310738.
|
| 265 |
+
[7] Deyu Bo, Xiao Wang, Chuan Shi, and Huawei Shen. Beyond low-frequency information in graph convolutional networks. In AAAI. AAAI Press, 2021.
|
| 266 |
+
[8] Cristian Bodnar, Fabrizio Frasca, Nina Otter, Yu Guang Wang, Pietro Liò, Guido Montúfar, and Michael Bronstein. Weisfeiler and Lehman Go Cellular: CW Networks. In NeurIPS, 2021.
|
| 267 |
+
[9] Cristian Bodnar, Fabrizio Frasca, Yuguang Wang, Nina Otter, Guido F Montufar, Pietro Lió, and Michael Bronstein. Weisfeiler and Lehman Go Topological: Message Passing Simplicial Networks. In ICML, 2021.
|
| 268 |
+
[10] Glen E Bredon. Sheaf theory, volume 170. Springer Science & Business Media, 2012.
|
| 269 |
+
[11] Marc Brockschmidt. Gnn-film: Graph neural networks with feature-wise linear modulation. In International Conference on Machine Learning, pages 1144–1152. PMLR, 2020.
|
| 270 |
+
[12] Joan Bruna, Wojciech Zaremba, Arthur Szlam, and Yann LeCun. Spectral networks and locally connected networks on graphs. In ICLR, 2014.
|
| 271 |
+
[13] Chen Cai and Yusu Wang. A note on over-smoothing for graph neural networks. arXiv:2006.13318, 2020.
|
| 272 |
+
[14] Benjamin Paul Chamberlain, James Rowbottom, Davide Eynard, Francesco Di Giovanni, Dong Xiaowen, and Michael M Bronstein. Beltrami flow and neural diffusion on graphs. In NeurIPS, 2021.
|
| 273 |
+
[15] Benjamin Paul Chamberlain, James Rowbottom, Maria Goronova, Stefan Webb, Emanuele Rossi, and Michael M Bronstein. Grand: Graph neural diffusion. In ICML, 2021.
|
| 274 |
+
|
| 275 |
+
[16] Ming Chen, Zhewei Wei, Zengfeng Huang, Bolin Ding, and Yaliang Li. Simple and deep graph convolutional networks. In Hal Daumé III and Aarti Singh, editors, Proceedings of the 37th International Conference on Machine Learning, volume 119 of Proceedings of Machine Learning Research, pages 1725–1735. PMLR, 13–18 Jul 2020. URL https://proceedings. mlr.press/v119/chen20v.html.
|
| 276 |
+
|
| 277 |
+
[17] Eli Chien, Jianhao Peng, Pan Li, and Olgica Milenkovic. Adaptive universal generalized pagerank graph neural network. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id=n6jl7fLxrP.
|
| 278 |
+
|
| 279 |
+
[18] Justin Michael Curry. Sheaves, cosheaves and applications. University of Pennsylvania, 2014.
|
| 280 |
+
|
| 281 |
+
[19] Pim de Haan, Taco Cohen, and Max Welling. Natural graph networks. In NeurIPS, 2020.
|
| 282 |
+
|
| 283 |
+
[20] Michaël Defferrard, Xavier Bresson, and Pierre Vandergheynst. Convolutional neural networks on graphs with fast localized spectral filtering. In NIPS, 2016.
|
| 284 |
+
|
| 285 |
+
[21] Lun Du, Xiaozhou Shi, Qiang Fu, Xiaojun Ma, Hengyu Liu, Shi Han, and Dongmei Zhang. Gbk-gnn: Gated bi-kernel graph neural networks for modeling both homophily and heterophily. In Proceedings of the ACM Web Conference 2022, pages 1550–1558, 2022.
|
| 286 |
+
|
| 287 |
+
[22] Andrew Dudzik and Petar Velickovi ˇ c. Graph neural networks are dynamic programmers. ´ arXiv preprint arXiv:2203.15544, 2022.
|
| 288 |
+
|
| 289 |
+
[23] Vijay Prakash Dwivedi, Chaitanya K Joshi, Thomas Laurent, Yoshua Bengio, and Xavier Bresson. Benchmarking graph neural networks. arXiv:2003.00982, 2020.
|
| 290 |
+
|
| 291 |
+
[24] Tingran Gao, Jacek Brodzki, and Sayan Mukherjee. The geometry of synchronization problems and learning group actions. Discrete & Computational Geometry, 65(1):150–211, 2021.
|
| 292 |
+
|
| 293 |
+
[25] Robert Ghrist and Hans Riess. Cellular sheaves of lattices and the tarski laplacian. arXiv:2007.04099, 2020.
|
| 294 |
+
|
| 295 |
+
[26] Robert W Ghrist. Elementary applied topology, volume 1. Createspace Seattle, 2014.
|
| 296 |
+
|
| 297 |
+
[27] Justin Gilmer, Samuel S Schoenholz, Patrick F Riley, Oriol Vinyals, and George E Dahl. Neural message passing for quantum chemistry. In ICML, 2017.
|
| 298 |
+
|
| 299 |
+
[28] Christoph Goller and Andreas Kuchler. Learning task-dependent distributed representations by backpropagation through structure. In ICNN, 1996.
|
| 300 |
+
|
| 301 |
+
[29] Marco Gori, Gabriele Monfardini, and Franco Scarselli. A new model for learning in graph domains. In IJCNN, 2005.
|
| 302 |
+
|
| 303 |
+
[30] Pim De Haan, Maurice Weiler, Taco Cohen, and Max Welling. Gauge equivariant mesh CNNs: Anisotropic convolutions on geometric graphs. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id $\equiv$ Jnspzp-oIZE.
|
| 304 |
+
|
| 305 |
+
[31] William L Hamilton, Rex Ying, and Jure Leskovec. Representation learning on graphs: Methods and applications. IEEE Data Engineering Bulletin, 2017.
|
| 306 |
+
|
| 307 |
+
[32] Jakob Hansen and Thomas Gebhart. Sheaf neural networks. In NeurIPS 2020 Workshop on Topological Data Analysis and Beyond, 2020.
|
| 308 |
+
|
| 309 |
+
[33] Jakob Hansen and Robert Ghrist. Learning sheaf laplacians from smooth signals. In ICASSP 2019-2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pages 5446–5450. IEEE, 2019.
|
| 310 |
+
|
| 311 |
+
[34] Jakob Hansen and Robert Ghrist. Toward a spectral theory of cellular sheaves. Journal of Applied and Computational Topology, 3(4):315–358, 2019.
|
| 312 |
+
|
| 313 |
+
[35] Jakob Hansen and Robert Ghrist. Opinion dynamics on discourse sheaves. SIAM Journal on Applied Mathematics, 81(5):2033–2060, 2021.
|
| 314 |
+
|
| 315 |
+
[36] Kurt Hornik. Approximation capabilities of multilayer feedforward networks. Neural networks, 4(2):251–257, 1991.
|
| 316 |
+
[37] Kurt Hornik, Maxwell Stinchcombe, and Halbert White. Multilayer feedforward networks are universal approximators. Neural networks, 2(5):359–366, 1989.
|
| 317 |
+
[38] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In ICLR, 2015.
|
| 318 |
+
[39] Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. In ICLR, 2017.
|
| 319 |
+
[40] Hyun Deok Lee. On some matrix inequalities. Korean Journal of Mathematics, 16(4):565–571, 2008.
|
| 320 |
+
[41] Vijay Lingam, Rahul Ragesh, Arun Iyer, and Sundararajan Sellamanickam. Simple truncated svd based model for node classification on heterophilic graphs. arXiv preprint arXiv:2106.12807, 2021.
|
| 321 |
+
[42] Sitao Luan, Chenqing Hua, Qincheng Lu, Jiaqi Zhu, Mingde Zhao, Shuyuan Zhang, Xiao-Wen Chang, and Doina Precup. Is heterophily a real nightmare for graph neural networks to do node classification? arXiv preprint arXiv:2109.05641, 2021.
|
| 322 |
+
[43] Saunders Mac Lane. Categories for the working mathematician, volume 5. Springer Science & Business Media, 2013.
|
| 323 |
+
[44] Saunders MacLane and Ieke Moerdijk. Sheaves in geometry and logic: A first introduction to topos theory. Springer Science & Business Media, 2012.
|
| 324 |
+
[45] Zakaria Mhammedi, Andrew Hellicar, Ashfaqur Rahman, and James Bailey. Efficient orthogonal parametrisation of recurrent neural networks using householder reflections. In International Conference on Machine Learning, pages 2401–2409. PMLR, 2017.
|
| 325 |
+
[46] Christopher Morris, Martin Ritzert, Matthias Fey, William L Hamilton, Jan Eric Lenssen, Gaurav Rattan, and Martin Grohe. Weisfeiler and Leman go neural: Higher-order graph neural networks. In AAAI, 2019.
|
| 326 |
+
[47] Galileo Namata, Ben London, Lise Getoor, Bert Huang, and U Edu. Query-driven active surveying for collective classification. In 10th International Workshop on Mining and Learning with Graphs, volume 8, page 1, 2012.
|
| 327 |
+
[48] H Nt and T Maehara. Revisiting graph neural networks: all we have is low pass filters. arXiv preprint arXiv:1812.08434v4, 2019.
|
| 328 |
+
[49] Anton Obukhov. Efficient householder transformation in pytorch, 2021. URL www.github. com/toshas/torch-householder. Version: 1.0.1, DOI: 10.5281/zenodo.5068733.
|
| 329 |
+
[50] K Oono and T Suzuki. Graph neural networks exponentially lose expressive power for node classification. In International Conference on Learning Representations, 2020.
|
| 330 |
+
[51] Kenta Oono and Taiji Suzuki. Graph neural networks exponentially lose expressive power for node classification. arXiv:1905.10947, 2019.
|
| 331 |
+
[52] John Palowitch, Anton Tsitsulin, Brandon Mayer, and Bryan Perozzi. Graphworld: Fake graphs bring real insights for gnns. arXiv preprint arXiv:2203.00112, 2022.
|
| 332 |
+
[53] Hongbin Pei, Bingzhe Wei, Kevin Chen-Chuan Chang, Yu Lei, and Bo Yang. Geom-gcn: Geometric graph convolutional networks. arXiv preprint arXiv:2002.05287, 2020.
|
| 333 |
+
[54] Ethan Perez, Florian Strub, Harm De Vries, Vincent Dumoulin, and Aaron Courville. Film: Visual reasoning with a general conditioning layer. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 32, 2018.
|
| 334 |
+
[55] David Pfau, Irina Higgins, Alex Botev, and Sébastien Racanière. Disentangling by subspace diffusion. Advances in Neural Information Processing Systems, 33:17403–17415, 2020.
|
| 335 |
+
[56] Daniel Rosiak. Sheaf theory through examples. MIT Press, 2022.
|
| 336 |
+
[57] Benedek Rozemberczki, Carl Allen, and Rik Sarkar. Multi-scale attributed node embedding. Journal of Complex Networks, 9(2):cnab014, 2021.
|
| 337 |
+
[58] Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE Trans. Neural Networks, 20(1):61–80, 2008.
|
| 338 |
+
[59] Richard D Schafer. An introduction to nonassociative algebras. Courier Dover Publications, 2017.
|
| 339 |
+
[60] Luis Scoccola and Jose A Perea. Approximate and discrete euclidean vector bundles. arXiv preprint arXiv:2104.07563, 2021.
|
| 340 |
+
[61] Prithviraj Sen, Galileo Namata, Mustafa Bilgic, Lise Getoor, Brian Galligher, and Tina EliassiRad. Collective classification in network data. AI magazine, 29(3):93–93, 2008.
|
| 341 |
+
[62] Allen Dudley Shepard. A cellular description of the derived category of a stratified space. PhD thesis, Brown University, 1985.
|
| 342 |
+
[63] Amit Singer and H-T Wu. Vector diffusion maps and the connection laplacian. Communications on pure and applied mathematics, 65(8):1067–1144, 2012.
|
| 343 |
+
[64] Alessandro Sperduti. Encoding labeled graphs by labeling RAAM. In NIPS, 1994.
|
| 344 |
+
[65] Julian Suk, Lorenzo Giusti, Tamir Hemo, Miguel Lopez, Konstantinos Barmpas, and Cristian Bodnar. Surfing on the neural sheaf. In NeurIPS 2022 Workshop on Symmetry and Geometry in Neural Representations, 2022.
|
| 345 |
+
[66] Jie Tang, Jimeng Sun, Chi Wang, and Zi Yang. Social influence analysis in large-scale networks. In Proceedings of the 15th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 807–816, 2009.
|
| 346 |
+
[67] Loring W Tu. Manifolds. In An Introduction to Manifolds, pages 47–83. Springer, 2011.
|
| 347 |
+
[68] Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Lio, and Yoshua ´ Bengio. Graph attention networks. In ICLR, 2018.
|
| 348 |
+
[69] Felix Wu, Tianyi Zhang, Amauri Holanda de Souza Jr, Christopher Fifty, Tao Yu, and Kilian Q Weinberger. Simplifying graph convolutional networks. In ICML, 2019.
|
| 349 |
+
[70] Louis-Pascal Xhonneux, Meng Qu, and Jian Tang. Continuous graph neural networks. In ICML, 2020.
|
| 350 |
+
[71] Keyulu Xu, Weihua Hu, Jure Leskovec, and Stefanie Jegelka. How powerful are graph neural networks? In ICLR, 2019.
|
| 351 |
+
[72] Yujun Yan, Milad Hashemi, Kevin Swersky, Yaoqing Yang, and Danai Koutra. Two sides of the same coin: Heterophily and oversmoothing in graph convolutional neural networks. arXiv:2102.06462, 2021.
|
| 352 |
+
[73] Fouad El Zein and Jawad Snoussi. Local systems and constructible sheaves. In Arrangements, local systems and singularities, pages 111–153. Springer, 2009.
|
| 353 |
+
[74] Lingxiao Zhao and Leman Akoglu. Pairnorm: Tackling oversmoothing in gnns. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum? id=rkecl1rtwB.
|
| 354 |
+
[75] Jiong Zhu, Yujun Yan, Lingxiao Zhao, Mark Heimann, Leman Akoglu, and Danai Koutra. Beyond homophily in graph neural networks: Current limitations and effective designs. Advances in Neural Information Processing Systems, 33, 2020.
|
| 355 |
+
|
| 356 |
+
# Checklist
|
| 357 |
+
|
| 358 |
+
1. For all authors...
|
| 359 |
+
|
| 360 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 361 |
+
(b) Did you describe the limitations of your work? [Yes]
|
| 362 |
+
(c) Did you discuss any potential negative societal impacts of your work? [Yes]
|
| 363 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 364 |
+
|
| 365 |
+
2. If you are including theoretical results...
|
| 366 |
+
|
| 367 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes] Proofs are included in the appendix
|
| 368 |
+
|
| 369 |
+
3. If you ran experiments...
|
| 370 |
+
|
| 371 |
+
(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] Our code is available at https://github.com/twitter-research/neural-sheaf-diffusion.
|
| 372 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] Section 6 and Appendix E
|
| 373 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
|
| 374 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] Appendix E
|
| 375 |
+
|
| 376 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 377 |
+
|
| 378 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 379 |
+
(b) Did you mention the license of the assets? [Yes] Appendix F
|
| 380 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] The code of our submission.
|
| 381 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 382 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 383 |
+
|
| 384 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 385 |
+
|
| 386 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 387 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 388 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/wlEOsQ917F/wlEOsQ917F.md
ADDED
|
@@ -0,0 +1,362 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# A framework for bilevel optimization that enables stochastic and global variance reduction algorithms
|
| 2 |
+
|
| 3 |
+
# Mathieu Dagréou
|
| 4 |
+
|
| 5 |
+
Inria, CEA Université Paris-Saclay Palaiseau, France mathieu.dagreou@inria.fr
|
| 6 |
+
|
| 7 |
+
Pierre Ablin CNRS Université Paris-Dauphine, PSL-University Paris, France pierre.ablin@cnrs.fr
|
| 8 |
+
|
| 9 |
+
# Samuel Vaiter
|
| 10 |
+
|
| 11 |
+
# Thomas Moreau
|
| 12 |
+
|
| 13 |
+
CNRS Université Côte d’Azur, LJAD Nice, France samuel.vaiter@cnrs.fr
|
| 14 |
+
|
| 15 |
+
Inria, CEA Université Paris-Saclay Palaiseau, France thomas.moreau@inria.fr
|
| 16 |
+
|
| 17 |
+
# Abstract
|
| 18 |
+
|
| 19 |
+
Bilevel optimization, the problem of minimizing a value function which involves the arg-minimum of another function, appears in many areas of machine learning. In a large scale empirical risk minimization setting where the number of samples is huge, it is crucial to develop stochastic methods, which only use a few samples at a time to progress. However, computing the gradient of the value function involves solving a linear system, which makes it difficult to derive unbiased stochastic estimates. To overcome this problem we introduce a novel framework, in which the solution of the inner problem, the solution of the linear system, and the main variable evolve at the same time. These directions are written as a sum, making it straightforward to derive unbiased estimates. The simplicity of our approach allows us to develop global variance reduction algorithms, where the dynamics of all variables is subject to variance reduction. We demonstrate that SABA, an adaptation of the celebrated SAGA algorithm in our framework, has $O \big ( \frac { 1 } { T } \big )$ convergence rate, and that it achieves linear convergence under Polyak-Łojasciewicz assumption. This is the first stochastic algorithm for bilevel optimization that verifies either of these properties. Numerical experiments validate the usefulness of our method.
|
| 20 |
+
|
| 21 |
+
# 1 Introduction
|
| 22 |
+
|
| 23 |
+
Bilevel optimization is attracting more and more attention in the machine learning community thanks to its wide range of applications. Typical examples are hyperparameters selection [5, 38, 17, 6], data augmentation [11, 42], implicit deep learning [3] or neural architecture search [33]. Bilevel optimization aims at minimizing a function whose value depends on the result of another optimization problem:
|
| 24 |
+
|
| 25 |
+
$$
|
| 26 |
+
\operatorname* { m i n } _ { x \in \mathbb { R } ^ { d } } h ( x ) = F ( z ^ { * } ( x ) , x ) , \quad \mathrm { s u c h t h a t } z ^ { * } ( x ) \in \arg \operatorname* { m i n } _ { z \in \mathbb { R } ^ { p } } G ( z , x ) ,
|
| 27 |
+
$$
|
| 28 |
+
|
| 29 |
+
where $F$ and $G$ are two real valued functions defined on $\mathbb { R } ^ { p } \times \mathbb { R } ^ { d }$ . $G$ is called the inner function, $F$ is the outer function and $h$ is the value function. Similarly, $z$ is the inner variable and $x$ is the outer variable. In most cases, the function $z ^ { * }$ can only be approximated by an optimization algorithm, which makes bilevel optimization problems challenging. Under appropriate hypotheses, the function $h$ is differentiable, and the chain rule and implicit function theorem give for any $\boldsymbol { x } \in \mathbb { R } ^ { d }$
|
| 30 |
+
|
| 31 |
+
$$
|
| 32 |
+
\nabla h ( x ) = \nabla _ { 2 } F ( z ^ { * } ( x ) , x ) + \nabla _ { 2 1 } ^ { 2 } G ( z ^ { * } ( x ) , x ) v ^ { * } ( x ) \ ,
|
| 33 |
+
$$
|
| 34 |
+
|
| 35 |
+
36th Conference on Neural Information Processing Systems (NeurIPS 2022).
|
| 36 |
+
|
| 37 |
+
where $v ^ { \ast } ( x ) \in \mathbb { R } ^ { p }$ is the solution of a linear system
|
| 38 |
+
|
| 39 |
+
$$
|
| 40 |
+
\boldsymbol { v } ^ { * } ( \boldsymbol { x } ) = - \left[ \nabla _ { 1 1 } ^ { 2 } G ( \boldsymbol { z } ^ { * } ( \boldsymbol { x } ) , \boldsymbol { x } ) \right] ^ { - 1 } \nabla _ { 1 } F ( \boldsymbol { z } ^ { * } ( \boldsymbol { x } ) , \boldsymbol { x } ) \ .
|
| 41 |
+
$$
|
| 42 |
+
|
| 43 |
+
In the light of (2) and (3), it turns out that the derivation of the gradient of $h$ at each iteration is cumbersome because it involves two subproblems: the resolution of the inner problem to find an approximation of $z ^ { * } ( x )$ and the resolution of a linear system to find an approximation of $v ^ { * } ( x )$ . It makes the practical implementation of first order methods like gradient descent for (1) challenging.
|
| 44 |
+
|
| 45 |
+
As is the case in many machine learning problems, we suppose in this paper that $F$ and $G$ are empirical means:
|
| 46 |
+
|
| 47 |
+
$$
|
| 48 |
+
F ( z , x ) = \frac { 1 } { m } \sum _ { j = 1 } ^ { m } F _ { j } ( z , x ) , \quad G ( z , x ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } G _ { i } ( z , x )
|
| 49 |
+
$$
|
| 50 |
+
|
| 51 |
+
This structure suggests the use of stochastic methods to solve (1). For single-level problems (that is, classical optimization problems where one function should be minimized), using Stochastic Gradient Descent (SGD; [41, 7]) and variants is natural because individual gradients are straightforward unbiased estimators of the gradient. In the bilevel framework, we want to develop algorithms that make progress on problem (1) by using only a few functions $F _ { j }$ and $G _ { i }$ at a time. However, since $\nabla h$ involves the inverse of the Hessian of $G$ , building such stochastic algorithms is quite challenging, one of the difficulties being that there is no straightforward unbiased estimator of $\nabla h$ . Still, in settings where $m$ or $n$ are large, where computing even a single evaluation of $F$ or $G$ is extremely expensive, stochastic methods are the only scalable algorithms.
|
| 52 |
+
|
| 53 |
+

|
| 54 |
+
Figure 1: Convergence curves of the two proposed methods on a toy problem. SABA is a stochastic method that achieves fast convergence on the value function.
|
| 55 |
+
|
| 56 |
+
Variance reduction [27, 13, 43, 15, 12] is a popular technique to obtain fast stochastic algorithms. In a single-level setting, these methods build an approximation of the gradient of the objective function using only stochastic gradients. Contrary to SGD, the variance of the approximation goes to 0 as the algorithm progresses, allowing for faster convergence. For instance, the SAGA method [13] achieves linear convergence if the objective function satisfies a Polyak-Łojasciewicz inequality, and $O ( { \textstyle { \frac { 1 } { T } } } )$ convergence rate on smooth non-convex functions [40]. The extension of these methods to bilevel optimization is a natural idea to develop faster algorithms. However, this idea is hard to implement because it is hard to derive unbiased estimators of $\nabla h$ , let alone variance reduction ones.
|
| 57 |
+
|
| 58 |
+
Contributions. We introduce a novel framework for bilevel optimization in Section 2, where the inner variable, the solution of the linear system (3) and the outer variable evolve jointly. The evolution directions are written as sums of derivatives of $F _ { j }$ and $G _ { i }$ , which allows us to derive simple unbiased stochastic estimators. In this framework, we propose SOBA, an extension of SGD (Section 2.1), and SABA (Section 2.2), an extension of the variance reduction algorithm SAGA [13]. In Section 3 we analyse the convergence of our methods. SOBA is shown to achieve $\begin{array} { r } { \operatorname* { i n f } _ { t \leq T } \mathbb { E } [ \| \nabla h ( x ^ { t } ) \| ^ { 2 } ] = O ( \log ( T ) T ^ { - \frac { 1 } { 2 } } ) } \end{array}$ with decreasing step sizes. We prove that SABA with fixed step sizes achieves $\begin{array} { r } { \frac { 1 } { T } \sum _ { t = 1 } ^ { T } \mathbb { E } [ \| \nabla h ( x ^ { t } ) \| ^ { 2 } ] = O ( \frac { 1 } { T } ) } \end{array}$ . SABA is therefore, to the best of our knowledge, the first stochastic bilevel algorithm that matches the convergence rate of gradient descent on $h$ . We also prove that SABA achieves linear convergence under the assumption that $h$ satisfies a Polyak-Łojasciewicz inequality. To the best of our knowledge, SABA is also the first stochastic bilevel algorithm to feature such a property. Importantly, these rates match the rates of the single level counterparts of each algorithm in non-convex setting (SGD for SOBA and SAGA for SABA). Finally, in Section 4, we provide an extensive benchmark of many stochastic bilevel methods on hyperparameters selection and data hyper-cleaning, and illustrate the usefulness of our approach.
|
| 59 |
+
|
| 60 |
+
Related work. The bilevel optimization problem has a strong history in the optimization community, taking root in game theory [45]. Gradient-based algorithms to solve (1) can be mainly classified in two different categories depending on how $\nabla h$ is computed, by automatic or implicit differentiation.
|
| 61 |
+
|
| 62 |
+
Since the solution of the inner problem $z ^ { * } ( x )$ is approximated by the output of an iterative algorithm, it is possible to use automatic differentiation [46, 31] to approximate $\nabla h ( x )$ . It consists in differentiating the different steps of the inner optimization algorithm – see [4] for a review – and has been applied successfully to several bilevel problems arising in machine learning [14, 16]. One of the main drawbacks of this approach is that it requires to store in memory each iterate of the inner optimization algorithm, although this problem can sometimes be overcome using invertible optimization algorithms [34] or truncated backpropagation [44].
|
| 63 |
+
|
| 64 |
+
The use of the implicit function theorem to obtain (2) and (3) is known as implicit differentiation [5]. While the cost of computing exactly (2) can be prohibitive for large scale problems, Pedregosa [38] showed that we can still converge to a stationary point of the problem by using approximate solutions of the inner problem and linear system (3), if the approximation error goes to 0 sufficiently quickly. The complexity of approximate implicit differentiation has been studied in [20]. Ramzi et al. [39] propose to reuse the computations done in the forward pass to approximate the solution of the linear system (3) when the inner problem is solved thanks to a quasi-Newton method.
|
| 65 |
+
|
| 66 |
+
In the last few years, several works have proposed different strategies to solve (1) in a stochastic fashion. A first set of methods relies on two nested loops: one inner loop to solve the inner problem with a stochastic method, and one outer loop to update the outer variable with an approximate gradient direction. In [19, 26, 9] the authors use several SGD iterations for the inner problem and then use stochastic Neumann approximations to get an estimate solution of the linear system, which provides them with an approximation of $\nabla h$ used to update $x$ . The analysis of this kind of method was refined by Chen et al. [9], allowing to achieve the same convergence rates as those of SGD. The convergence of the hypergradient when using stochastic solvers for the inner problem and the linear system has been studied in [21]. Arbel and Mairal [2] replace the Neumann approximation by SGD steps to estimate (3). Other authors have proposed single loop algorithms, alternating steps in the inner and the outer problem. Hong et al. [24] propose to perform Neumann approximations of the inverse Hessian and use a single SGD step for the inner problem. It was refined in [23] and [47] where the optimization procedure uses a momentum acceleration. Other variations around this idea include [25, 28, 10, 22, 30]. We refer to Table 1 in appendix for a detailed comparison of these methods.
|
| 67 |
+
|
| 68 |
+
Notation. The set of integers between 1 and $n$ (included) is denoted $[ n ]$ . For $f : \mathbb { R } ^ { p } \times \mathbb { R } ^ { d } \to \mathbb { R }$ we denote $\nabla _ { i } f ( z , x )$ its gradient w.r.t. the $i ^ { \mathrm { { t h } } }$ variable. The Hessian of $f$ with respect to the first variable is denoted $\nabla _ { 1 1 } ^ { 2 } f ( z , x ) \in \mathbb { R } ^ { p \times p }$ , and the cross-derivatives matrix is $\nabla _ { 2 1 } ^ { 2 } f ( z , x ) \in \mathbb { R } ^ { d \times p }$ . If $v$ is a vector, $\lVert v \rVert$ is its Euclidean norm. If $M$ is a matrix, $\lVert M \rVert$ is its spectral norm. A function is said to be $L$ -smooth, for $L > 0$ , if it is differentiable, and its gradient is $L$ -Lipschitz.
|
| 69 |
+
|
| 70 |
+
# 2 Proposed framework
|
| 71 |
+
|
| 72 |
+
In this section, we introduce our framework in which the solution of the inner problem, the solution of the linear system (3) and the outer variable all evolve at the same time, following directions that are written as a sum of derivatives of $F _ { j }$ and $G _ { i }$ . We define
|
| 73 |
+
|
| 74 |
+
# Algorithm 1 General framework
|
| 75 |
+
|
| 76 |
+
Input: initializations $z _ { 0 } \in \mathbb { R } ^ { p }$ , $\overline { { x _ { 0 } \in \mathbb { R } ^ { d } } }$ $v _ { 0 } \in \mathbb { R } ^ { p }$ , number of iterations $T$ , step size sequences $( \rho ^ { t } ) _ { t < T }$ and $( \gamma ^ { t } ) _ { t < T }$ .
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
D _ { z } ( z , v , x ) = \nabla _ { 1 } G ( z , x ) ,
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
$$
|
| 83 |
+
D _ { v } ( z , v , x ) = \nabla _ { 1 1 } ^ { 2 } G ( z , x ) v + \nabla _ { 1 } F ( z , x ) ,
|
| 84 |
+
$$
|
| 85 |
+
|
| 86 |
+
$$
|
| 87 |
+
D _ { x } ( z , v , x ) = \nabla _ { 2 1 } ^ { 2 } G ( z , x ) v + \nabla _ { 2 } F ( z , x ) .
|
| 88 |
+
$$
|
| 89 |
+
|
| 90 |
+
These directions are motivated by the fact that we have $\nabla h ( x ) ~ = ~ D _ { x } ( z ^ { * } ( x ) , v ^ { * } ( \bar { x } ) , x )$ , with $z ^ { * } ( x )$ the minimizer of $G ( \cdot , x )$ and $v ^ { * } ( x )$ the solution of $\nabla _ { 1 1 } ^ { 2 } G ( z ^ { * } ( x ) , x ) v \ : = \ : - \nabla _ { 1 } F ( z ^ { * } ( x ) , x )$ . When $x$ is
|
| 91 |
+
|
| 92 |
+
# end for
|
| 93 |
+
|
| 94 |
+
fixed, we approximate $z ^ { * }$ by doing a gradient descent on $G$ , following the direction $- D _ { z } ( z , v , x )$ . Finally, when $z$ and $x$ are fixed, we find $v ^ { * }$ by following the direction $- D _ { v } ( z , v , x )$ , which corresponds to a gradient descent on $\begin{array} { r } { v \mapsto \frac { 1 } { 2 } \langle \nabla _ { 1 1 } ^ { 2 } G ( z , x ) v , v \rangle + \langle \nabla _ { 1 } F ( z , x ) , v \rangle } \end{array}$ . The rest of the paper is devoted to the study of the global dynamics where the three variables $z , v$ and $x$ evolve at the same time, following stochastic approximations of $D _ { z } , D _ { v }$ and $D _ { x }$ . The next proposition motivates the choice of these directions.
|
| 95 |
+
|
| 96 |
+
Proposition 2.1. Assume that for all $x \in \mathbb { R } ^ { d } , G ( \cdot , x )$ is strongly convex. If $( z , v , x )$ is a zero of $( D _ { z } , D _ { v } , D _ { x } )$ , then $z = z ^ { * } ( x )$ , $v = v ^ { * } ( x )$ and $\nabla h ( x ) = ~ 0$ .
|
| 97 |
+
|
| 98 |
+
We also note that the computation of these directions does not require to compute the matrices $\nabla _ { 1 1 } ^ { 2 } G ( z , x )$ and $\nabla _ { 2 1 } ^ { 2 } G ( z , \bar { x } )$ : we only need to compute their product with a vector, which can be computed at a cost similar to that of computing a gradient.
|
| 99 |
+
|
| 100 |
+
The framework we propose is summarized in Algorithm 1. It consists in following a joint update rule in $( z , v , x )$ that follows directions $D _ { z } ^ { t } , D _ { v } ^ { t }$ and $D _ { x } ^ { t }$ that are unbiased estimators of $D _ { z } , D _ { v } , D _ { x }$ The first and most important remark is that whereas $\nabla h$ cannot be written as a sum over samples, the directions $D _ { z } , D _ { v }$ and $D _ { x }$ involve only simple sums, since their expressions are “linear” in $F$ and $G$ :
|
| 101 |
+
|
| 102 |
+
$$
|
| 103 |
+
\begin{array} { r l } & { D _ { z } ( z , v , x ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \nabla _ { 1 } G _ { i } ( z , x ) ~ , } \\ & { D _ { v } ( z , v , x ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \nabla _ { 1 1 } ^ { 2 } G _ { i } ( z , x ) v + \frac { 1 } { m } \sum _ { j = 1 } ^ { m } \nabla _ { 1 } F _ { j } ( z , x ) ~ , } \\ & { D _ { x } ( z , v , x ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \nabla _ { 2 1 } ^ { 2 } G _ { i } ( z , x ) v + \frac { 1 } { m } \sum _ { j = 1 } ^ { m } \nabla _ { 2 } F _ { j } ( z , x ) ~ . } \end{array}
|
| 104 |
+
$$
|
| 105 |
+
|
| 106 |
+
It is therefore straightforward to derive unbiased estimators of these directions. In [30], the authors considered one particular case of our framework, where each direction is estimated by using the STORM variance reduction technique (see [12]). Taking a step back by proposing the framework summarized in Algorithm 1 opens the way to potential new algorithms that implement other techniques that exist in stochastic single level optimization. In what follows, we study two of them.
|
| 107 |
+
|
| 108 |
+
# 2.1 First example: the SOBA algorithm
|
| 109 |
+
|
| 110 |
+
The simplest unbiased estimator is obtained by replacing each mean by one of its terms chosen uniformly at random, akin to what is done in classical single-level SGD. We call the resulting algorithm SOBA (StOchastic Bilevel Algorithm). To do so, we choose two independent random indices $i \in [ n ]$ and $j \in [ m ]$ uniformly and estimate each term coming from $G$ using $G _ { i }$ and each term coming from $F$ using $F _ { j }$ . This gives the unbiased SOBA directions
|
| 111 |
+
|
| 112 |
+
$$
|
| 113 |
+
\boxed { \begin{array} { r l } & { D _ { z } ^ { t } = \nabla _ { 1 } G _ { i } ( z ^ { t } , x ^ { t } ) ~ , } \\ & { D _ { v } ^ { t } = \nabla _ { 1 1 } ^ { 2 } G _ { i } ( z ^ { t } , x ^ { t } ) v ^ { t } + \nabla _ { 1 } F _ { j } ( z ^ { t } , x ^ { t } ) ~ , } \\ & { D _ { x } ^ { t } = \nabla _ { 2 1 } ^ { 2 } G _ { i } ( z ^ { t } , x ^ { t } ) v ^ { t } + \nabla _ { 2 } F _ { j } ( z ^ { t } , x ^ { t } ) ~ . } \end{array} }
|
| 114 |
+
$$
|
| 115 |
+
|
| 116 |
+
This provides us with a first algorithm, SOBA, where we plug Equations (10a) to (10c) in Algorithm 1. We defer its analysis to the next section. Importantly, we use different step sizes for the update in $( z , v )$ and for the update in $x$ . We use the same step size in $z$ and in $v$ since the inner problem and the linear system have similar conditioning, which is that of $\nabla _ { 1 1 } ^ { 2 } G ( z ^ { t } , x ^ { t } )$ . The need for a different step size for the outer and inner problem is clear: both problems can have a different conditioning.
|
| 117 |
+
|
| 118 |
+
An important remark for SOBA is that all the stochastic directions used are computed at the same point $\bar { z } ^ { t } , v ^ { t }$ and $x ^ { t }$ with the same indices $( i , j )$ . The update of $z$ , $v$ and $x$ can thus be performed in parallel instead of sequentially, benefiting from hardware parallelism. Moreover, this enables to share the computations between the different directions. This is the case in hyperparameters selection where $\begin{array} { r } { \bar { G } _ { i } ( z , x ) = \ell _ { i } ( \langle z , d _ { i } \rangle ) + \frac { x } { 2 } \| z \| ^ { 2 } } \end{array}$ , with $d _ { i }$ a training sample, and $\ell _ { i }$ that measures how good is the prediction $\langle z , d _ { i } \rangle$ . In this setting, we have $\nabla _ { 1 } G _ { i } ( z , x ) = \ell _ { i } ^ { \prime } ( \langle z , d _ { i } \rangle ) d _ { i } + x z$ and $\nabla _ { 1 1 } ^ { 2 } \bar { G } _ { i } ( z , x ) v \stackrel { - } { = } \ell _ { i } ^ { \prime \prime } ( \langle z , d _ { i } \rangle ) \langle v , d _ { i } \rangle d _ { i }$ . The prediction $\langle z , d _ { i } \rangle$ can thus be computed only once to obtain both quantities. For more complicated models, where automatic differentiation is used to compute the different derivatives and Jacobian-vector products, we can store the computational graph only once to compute at the same time $\nabla _ { 1 } G _ { i } ( z , x ) , \dot { \nabla _ { 1 1 } ^ { 2 } } G _ { i } ( z , x ) v$ and $\nabla _ { 2 1 } ^ { 2 } G _ { i } ( z , x ) \dot { v }$ , requiring only one backward pass, thanks to the $\mathcal { R }$ technique [37].
|
| 119 |
+
|
| 120 |
+
Finally, like all single loop bilevel algorithms, our method updates at the same time the inner and outer variable, avoiding unnecessary optimization of the inner problem when $x$ is far from the optimum.
|
| 121 |
+
|
| 122 |
+
# 2.2 Global variance reduction with the SABA algorithm
|
| 123 |
+
|
| 124 |
+
In classical optimization, SGD fails to reach optimal rates because of the variance of the gradient estimator. Variance reduction algorithms aim at reducing this variance, in order to follow directions that are closer to the true gradient, and to achieve superior practical and theoretical convergence.
|
| 125 |
+
|
| 126 |
+
In our framework, since the directions $D _ { z } , D _ { v }$ and $D _ { x }$ are all written as sums of derivatives of $F _ { j }$ and $G _ { i }$ , it is easy to adapt most classical variance reduction algorithms. We focus on the celebrated SAGA algorithm [13]. The extension we propose is called SABA (Stochastic Average Bilevel Algorithm). The general idea is to replace each sum in the directions $D$ by a sum over a memory, updating only one term at each iteration. To help the exposition, we denote $y = ( z , x , v )$ the vector of joint variables. Since we have sums over $i$ and over $j$ , we have two memories for each variable: $\boldsymbol { w } _ { i } ^ { t }$ for $i \in [ n ]$ and $\tilde { w } _ { j } ^ { t }$ for $j \in [ m ]$ , which keep track of the previous values of the variable $y$ .
|
| 127 |
+
|
| 128 |
+
At each iteration $t$ , we draw two random independent indices $i \in [ n ]$ and $j \in [ m ]$ uniformly and update the memories. To do so, we put $w _ { i } ^ { t + 1 } = y ^ { t }$ and $w _ { i ^ { \prime } } ^ { t + 1 } = w _ { i ^ { \prime } } ^ { t }$ for $i ^ { \prime } \neq i$ , and $\tilde { w } _ { j } ^ { t + 1 } = y ^ { t }$ and $\tilde { w } _ { j ^ { \prime } } ^ { t + 1 } = \tilde { w } _ { j ^ { \prime } } ^ { t }$ for $\boldsymbol { j ^ { \prime } } \neq \boldsymbol { j }$ . Each sum in the directions $D$ is then approximated using SAGA-like rules: given $n$ functions $\phi _ { i ^ { \prime } }$ for $i ^ { \prime } \in [ n ]$ , we define $\begin{array} { r } { S [ \phi , w ] _ { i } ^ { t } = \phi _ { i } ( w _ { i } ^ { t + 1 } ) - \phi _ { i } ( w _ { i } ^ { t } ) + \frac { 1 } { n } \sum _ { i ^ { \prime } = 1 } ^ { n } \phi _ { i ^ { \prime } } ( w _ { i ^ { \prime } } ^ { t } ) . } \end{array}$ This is an unbiased estimators of the average of the $\phi$ ’s since $\begin{array} { r } { \mathbb E _ { i } \Big [ S [ \phi , w ] _ { i } ^ { t } \Big ] = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \phi _ { i } ( y ^ { t } ) } \end{array}$ .
|
| 129 |
+
|
| 130 |
+
With a slight abuse of notation, we call $\nabla _ { 1 1 } ^ { 2 } G v$ the sequence of functions $( y \mapsto \nabla _ { 1 1 } ^ { 2 } G _ { i } ( z , x ) v ) _ { i \in [ n ] }$ and $\nabla _ { 2 1 } ^ { 2 } G v$ the sequence of functions $( y \mapsto \nabla _ { 2 1 } ^ { 2 } G _ { i } ( z , x ) v ) _ { i \in [ n ] }$ . We define the SABA directions as
|
| 131 |
+
|
| 132 |
+
$$
|
| 133 |
+
\begin{array} { r c l } { { } } & { { } } & { { D _ { z } ^ { t } = S [ \nabla _ { 1 } G , w ] _ { i } ^ { t } ~ , } } \\ { { } } & { { } } & { { D _ { v } ^ { t } = S [ \nabla _ { 1 1 } ^ { 2 } G v , w ] _ { i } ^ { t } + S [ \nabla _ { 1 } F , \tilde { w } ] _ { j } ^ { t } ~ , } } \\ { { } } & { { } } & { { D _ { x } ^ { t } = S [ \nabla _ { 2 1 } ^ { 2 } G v , w ] _ { i } ^ { t } + S [ \nabla _ { 2 } F , \tilde { w } ] _ { j } ^ { t } ~ . } } \end{array}
|
| 134 |
+
$$
|
| 135 |
+
|
| 136 |
+
These estimators are unbiased estimators of the directions $D _ { z } , D _ { v }$ and $D _ { x }$ . The SABA algorithm corresponds to Algorithm 1 where we use Equations (11a) to (11c) as update directions. When taking a step size $\gamma ^ { t } = \bar { 0 }$ in the outer problem, hereby stopping progress in $x$ , we recover the iterations of the SAGA algorithm on the inner problem. In practice, the sum in $S$ is computed by doing a rolling average (see Appendix B for precision), and the quantities $\phi _ { i } ( w _ { i } ^ { t } )$ are stored rather than recomputed: the cost of computing the SABA directions is the same as that of SGD. It requires an additional memory for the five quantities, of total size $n \times p + ( n + m ) \times ( p + d )$ floats that can be reduced by using larger batch sizes. Indeed, if $b _ { \mathrm { i n } }$ and $b _ { \mathrm { o u t } }$ are respectively the inner and the outer batch sizes, the memory load is reduced to nb × p + (nb + mb) × (p × d) with nb = ⌈ nbinn ⌉ and $\begin{array} { r } { m _ { b } = \left\lceil \frac { m } { b _ { \mathrm { o u t } } } \right\rceil } \end{array}$ which are smaller than the number of samples. This memory load can also be reduced in specific cases, for instance when $G$ and $F$ correspond to linear models, where the individual gradients and Hessian-vector products are proportional to the samples. In this case, we only store the proportionality ratio, reducing the memory load to $3 n + 2 m$ floats. Like for SOBA, the computations of the new quantities $\phi _ { i } ( w _ { i } ^ { t + 1 } )$ are done in parallel, thus benefiting from hardware acceleration and shared computations. Despite this memory load, using SAGA-like variance reduction instead of STORM as done in [30, 47, 28] has the advantage to bring the variance of the estimate directions to zero, enabling faster $O ( { \textstyle { \frac { 1 } { T } } } )$ convergence.
|
| 137 |
+
|
| 138 |
+
In the next section, we show that SABA is fast. It essentially has the same properties as SAGA: despite being stochastic, it converges with fixed step sizes, and reaches the same rate of convergence as gradient descent on $h$ .
|
| 139 |
+
|
| 140 |
+
# 3 Theoretical analysis
|
| 141 |
+
|
| 142 |
+
In this section, we provide convergence rates of SOBA and SABA under some classical assumptions. Note that, unlike most of the stochastic bilevel optimization papers, we work in finite sample setting rather than the more general expectation setting. Actually, SABA does not make any sense for functions that don’t have a finite sum structure. However, we stress that SOBA could be studied in a more general setting to obtain the same bounds as here. Also, the finite sum setting is still interesting since doing empirical risk minimization is very common in practice in machine learning. The proofs and the constants in big- $O$ are deferred in Appendix C.
|
| 143 |
+
|
| 144 |
+
# 3.1 Background and assumptions
|
| 145 |
+
|
| 146 |
+
We start by stating some regularity assumptions on the functions $F$ and $G$ .
|
| 147 |
+
|
| 148 |
+
Assumption 3.1. The function $F$ is twice differentiable. The derivatives $\nabla F$ and $\nabla ^ { 2 } F$ are Lipschitz continuous in $( z , x )$ with respective Lipschitz constants $L _ { 1 } ^ { F }$ and $L _ { 2 } ^ { F }$ .
|
| 149 |
+
|
| 150 |
+
Note that the above assumption is typically verified in the machine learning context, e.g., when $F$ is the ordinary least squares (OLS) loss or the logistic loss.
|
| 151 |
+
|
| 152 |
+
Assumption 3.2. The function $G$ is three times continuously differentiable on $\mathbb { R } ^ { p } \times \mathbb { R } ^ { d }$ . For any $x \in \mathbb { R } ^ { d } , G ( \cdot , x )$ is $\mu _ { G }$ -strongly convex. The derivatives $\overrightarrow { \nabla G }$ , $\nabla ^ { 2 } G$ and $\nabla ^ { 3 } G$ are Lipschitz continuous in $( z , x )$ with respective Lipschitz constants $L _ { 1 } ^ { G }$ , $L _ { 2 } ^ { G }$ and $L _ { 3 } ^ { G }$ .
|
| 153 |
+
|
| 154 |
+
Strong convexity and smoothness with respect to $z$ of $G$ are verified when $G$ is a regularized leastsquares/logistic regression with a full rank design matrix, when the data is not separable for the logistic regression. Moreover, the strong convexity ensures the existence and uniqueness of the inner optimization problem for any $x \in \mathbb { R } ^ { d }$ .
|
| 155 |
+
|
| 156 |
+
Assumption 3.3. There exists $C _ { F } ~ > ~ 0$ such that for any $x$ we have $\| \nabla _ { 1 } F ( z ^ { * } ( x ) , x ) \| \leq C _ { F } .$
|
| 157 |
+
|
| 158 |
+
This assumption, combined with the strong convexity of $G ( \cdot , x )$ , shows boundedness of $v ^ { * }$ . This assumption holds, for instance, in the case of hyperparameters selection for a Ridge regression problem. Note that in Assumptions 3.1 and 3.2, we assume more regularity of $F$ and $G$ than in stochastic bilevel optimization literature (see for instance [19, 24, 26, 2]). It is necessary to get the smoothness of $v ^ { * }$ which will allow to adapt the proof of Chen et al. [9] and get tight convergence rates. The following lemma gives us some smoothness properties of the considered directions that will be useful to derive convergence rates of our methods.
|
| 159 |
+
|
| 160 |
+
Lemma 3.4. Under the Assumptions 3.1 to 3.3, there exist constants $L _ { z }$ , $L _ { v }$ and $L _ { x }$ such that $\begin{array} { r } { \| D _ { z } ( z , v , x ) \| ^ { 2 } \leq L _ { z } ^ { 2 } \| z - z ^ { * } ( \hat { x } ) \| ^ { 2 } , \ \| D _ { v } ( z , v , x ) \| ^ { 2 } \leq L _ { v } ^ { 2 } ( \| z - z ^ { * } ( x ) \| ^ { 2 } + \| v - v ^ { * } ( x ) \| ^ { 2 } ) } \end{array}$ and $\| D _ { x } ( z , v , x ) - \nabla h ( x ) \| ^ { 2 } \leq L _ { x } ^ { 2 } ( \| z - z ^ { * } ( x ) \| ^ { 2 } + \| v - v ^ { * } ( x ) \| ^ { 2 } )$ .
|
| 161 |
+
|
| 162 |
+
In first order optimization, a fundamental assumption on the objective function is the smoothness assumption. In the case of vanilla gradient descent applied to a function $f$ , it allows to get a convergence rate of $\| \nabla f ( x ^ { t } ) \| ^ { 2 }$ in $O ( \bar { 1 } / T )$ , i.e. convergence to a stationary point [36]. The following lemma proved by Ghadimi and Wang [19, Lemma 2.2] ensures the smoothness of $h$ .
|
| 163 |
+
|
| 164 |
+
Lemma 3.5. Under the Assumptions 3.1 to 3.3, the function $h$ is $L ^ { h }$ -smooth for some $L ^ { h } > 0$ .
|
| 165 |
+
|
| 166 |
+
The constant $L ^ { h }$ is specified in Appendix C.3. As usual with the analysis of stochastic methods, we define the expected norms of the directions $V _ { z } ^ { t } = \mathbb { E } [ \| D _ { z } ^ { t } \| ^ { 2 } ]$ , $V _ { v } ^ { t } = \dot { \mathbb { E } } [ \| D _ { v } ^ { t } \| ^ { 2 } ]$ and $V _ { x } ^ { t } = \mathbb { E } [ \| D _ { x } ^ { t } \| ^ { 2 } ]$ , where the expectation is taken over the past. Thanks to variance-bias decomposition, they are the sum of the variance of the stochastic direction and the squared-norm of the unbiased direction. For SOBA, we use classical bounds on variances like those found for instance in [24]:
|
| 167 |
+
|
| 168 |
+
Assumption 3.6. There exists $B _ { z }$ , $B _ { v }$ and $B _ { x }$ such that for all $t$ , $\begin{array} { r l r } { \mathbb { E } _ { t } [ \| D _ { z } ^ { t } \| ^ { 2 } ] } & { { } \le } & { B _ { z } ^ { 2 } ( 1 + \| D _ { z } ( z ^ { t } , v ^ { t } , x ^ { t } ) \| ^ { 2 } ) } \end{array}$ and $\begin{array} { r } { \mathbb { E } _ { t } [ \| D _ { v } ^ { t } \| ^ { 2 } ] \ \leq \ B _ { v } ^ { 2 } ( 1 + \| D _ { v } ( z ^ { t } , v ^ { t } , x ^ { t } ) \| ^ { 2 } ) } \end{array}$ where $\mathbb { E } _ { t }$ denotes the expectation conditionally to $( z ^ { t } , v ^ { t } , \ddot { x } ^ { t } )$ .
|
| 169 |
+
|
| 170 |
+
For SOBA and SABA, we need to bound the expected norm of $D _ { x } ^ { t }$ . For SABA, this assumption allows to get a the same sample complexity as SAGA for single level problems.
|
| 171 |
+
|
| 172 |
+
Assumption 3.7. There exists $B _ { x }$ such that for all $t$ , $\mathbb { E } _ { t } [ \| D _ { x } ^ { t } \| ^ { 2 } ] \leq B _ { x } ^ { 2 }$ .
|
| 173 |
+
|
| 174 |
+
Assumptions 3.6 and 3.7 are verified for instance, if all the $G _ { i }$ and $\nabla _ { 1 } G _ { i }$ have at most quadratic growth, and if $F$ has bounded gradients. They are also verified if the iterates remain in a compact set. Note that we do not assume that $G$ has bounded gradients, as this would contradict its strong-convexity. Finally, for the analysis of SABA, we need regularity on each $G _ { i }$ and $F _ { j }$ :
|
| 175 |
+
|
| 176 |
+
Assumption 3.8. For all $i \in [ n ]$ and $j \in [ m ]$ , the functions $\nabla G _ { i }$ , $\nabla F _ { j }$ , $\nabla _ { 1 1 } ^ { 2 } G _ { i }$ and $\nabla _ { 2 1 } ^ { 2 } G _ { i }$ are Lipschitz continuous in $( z , x )$ .
|
| 177 |
+
|
| 178 |
+
# 3.2 Fundamental descent lemmas
|
| 179 |
+
|
| 180 |
+
Our analysis for SOBA and SABA is based on the control of both $\delta _ { z } ^ { t } = \mathbb { E } [ \| z ^ { t } - z ^ { * } ( x ^ { t } ) \| ^ { 2 } ]$ and $\delta _ { v } ^ { t } = \mathbb E [ | | \bar { v } ^ { t } - v ^ { * } ( x ^ { t } ) | | ^ { 2 } ]$ , Strong convexity of $G$ and smoothness of $z ^ { * } ( x )$ and $v ^ { * } ( x )$ allow to obtain the following lemma by adapting the proof of Chen et al. [9]. In what follows, we drop the dependency of the step sizes $\rho$ and $\gamma$ in $t$ for clarity.
|
| 181 |
+
|
| 182 |
+
Lemma 3.9. Assume that $\begin{array} { r } { \gamma ^ { 2 } \leq \operatorname* { m i n } \left( \frac { \mu _ { G } L _ { * } ^ { 2 } } { 4 B _ { x } ^ { 2 } L _ { z x } ^ { 2 } } , \frac { \mu _ { G } L _ { * } ^ { 2 } } { 8 B _ { x } ^ { 2 } L _ { v x } ^ { 2 } } \right) \rho } \end{array}$ . We have:
|
| 183 |
+
|
| 184 |
+
$$
|
| 185 |
+
\begin{array} { r l } & { \delta _ { z } ^ { t + 1 } \leq \left( 1 - \frac { \rho \mu _ { G } } { 4 } \right) \delta _ { z } ^ { t } + 2 \rho ^ { 2 } V _ { z } ^ { t } + \beta _ { z x } \gamma ^ { 2 } V _ { x } ^ { t } + \overline { { \beta } } _ { z x } \frac { \gamma ^ { 2 } } { \rho } \mathbb { E } [ \| D _ { x } ( z ^ { t } , v ^ { t } , x ^ { t } ) \| ^ { 2 } ] } \\ & { \delta _ { v } ^ { t + 1 } \leq \left( 1 - \frac { \rho \mu _ { G } } { 8 } \right) \delta _ { v } ^ { t } + \beta _ { v z } \rho \delta _ { z } ^ { t } + 2 \rho ^ { 2 } V _ { v } ^ { t } + \beta _ { v x } \gamma ^ { 2 } V _ { x } ^ { t } + \overline { { \beta } } _ { z x } \frac { \gamma ^ { 2 } } { \rho } \mathbb { E } [ \| D _ { x } ( z ^ { t } , v ^ { t } , x ^ { t } ) \| ^ { 2 } ] } \end{array}
|
| 186 |
+
$$
|
| 187 |
+
|
| 188 |
+
where $\beta _ { z x } = \beta _ { v x } = 3 L _ { * } ^ { 2 }$ , $\begin{array} { r } { \overline { { \beta } } _ { z x } \ : = \ : \frac { 8 L _ { * } ^ { 2 } } { \mu _ { G } } } \end{array}$ , $\begin{array} { r } { \overline { { \beta } } _ { v x } = { \frac { 1 6 L _ { * } ^ { 2 } } { \mu _ { G } } } } \end{array}$ , $L _ { * }$ is the maximum between the Lipschitz constants of and ∗ zx (see Lemma ), , , and are respectively $z ^ { * }$ $v ^ { * }$ $C . I$ $\begin{array} { r } { \beta _ { v z } = \frac { \mathrm { ~ i ~ } } { \mu _ { G } ^ { 3 } } ( L _ { 1 } ^ { F } \mu _ { G } + L _ { 2 } ^ { G } ) ^ { 2 } } \end{array}$ $L _ { z x }$ $L _ { v x }$ the smoothness constants of $z ^ { * }$ and $v ^ { * }$ .
|
| 189 |
+
|
| 190 |
+
We insist that this result is obtained in general for Algorithm 1 with arbitrary unbiased directions. We can therefore invoke this lemma for the analysis of both SOBA and SABA. We use the smoothness of $h$ to get the following lemma, which is similar to [9, Lemma 1].
|
| 191 |
+
|
| 192 |
+
Lemma 3.10. Let $h ^ { t } = \mathbb { E } [ h ( x ^ { t } ) ]$ and $g ^ { t } = \mathbb { E } [ \| \nabla h ( x ^ { t } ) \| ^ { 2 } ]$ . We have
|
| 193 |
+
|
| 194 |
+
$$
|
| 195 |
+
h ^ { t + 1 } \leq h ^ { t } - \frac { \gamma } { 2 } g ^ { t } - \frac { \gamma } { 2 } \mathbb { E } [ \| D _ { x } ( z ^ { t } , v ^ { t } , x ^ { t } ) \| ^ { 2 } ] + \frac { \gamma } { 2 } L _ { x } ^ { 2 } ( \delta _ { z } ^ { t } + \delta _ { v } ^ { t } ) + \frac { L ^ { h } } { 2 } \gamma ^ { 2 } V _ { x } ^ { t } ~ .
|
| 196 |
+
$$
|
| 197 |
+
|
| 198 |
+
If $z ^ { t } = z ^ { * } ( x ^ { t } )$ , $v ^ { t } = v ^ { * } ( x ^ { t } )$ , that is $\delta _ { z } , \delta _ { v }$ both cancel and $D _ { x } ( z ^ { t } , v ^ { t } , x ^ { t } ) = \nabla h ( x ^ { t } )$ , we get an inequality reminiscent of the smoothness inequality for SGD on $h$ .
|
| 199 |
+
|
| 200 |
+
# 3.3 Analysis of SOBA
|
| 201 |
+
|
| 202 |
+
The analysis of SOBA is based on Lemmas 3.5 and 3.9. We have the following theorem, with fixed step sizes depending on the number of iterations:
|
| 203 |
+
|
| 204 |
+
Theorem 1 (Convergence of SOBA, fixed step size). Fix an iteration $T > 1$ and assume that Assumptions 3.1 to 3.7 hold. We consider fixed steps $\begin{array} { r } { \rho ^ { t } = \frac { \overline { { \rho } } } { \sqrt { T } } } \end{array}$ and $\gamma ^ { t } = \xi \rho ^ { t }$ with $\overline { \rho }$ and $\xi$ precised in the appendix. Let $( x ^ { t } ) _ { t \geq 1 }$ the sequence of outer iterates for SOBA. Then,
|
| 205 |
+
|
| 206 |
+
$$
|
| 207 |
+
\frac { 1 } { T } \sum _ { t = 1 } ^ { T } \mathbb { E } [ \| \nabla h ( x ^ { t } ) \| ^ { 2 } ] = O ( T ^ { - \frac { 1 } { 2 } } ) \mathrm { ~ . ~ }
|
| 208 |
+
$$
|
| 209 |
+
|
| 210 |
+
As opposed to [24], we do not need that the ratio $\frac { \gamma } { \rho }$ goes to 0, which allows to get a complexity (that is, the number of call to oracles to have an $\epsilon$ -stationary solution) in $O ( \epsilon ^ { - 2 } )$ better than the $\tilde { O } ( \epsilon ^ { - \frac { 5 } { 2 } } )$ they have. Also, note that this rate is the same as the one of SGD for non-convex and smooth objective [18, 8]. We obtain a similar rate using decreasing step sizes:
|
| 211 |
+
|
| 212 |
+
Theorem 2 (Convergence of SOBA, decreasing step size). Assume that Assumptions 3.1 to 3.7 hold. We consider steps $\rho ^ { t } = \overline { { \rho } } t ^ { - \frac { 1 } { 2 } }$ and $\gamma ^ { t } = \xi \rho$ . Let $x ^ { t }$ the sequence of outer iterates for SOBA. Then,
|
| 213 |
+
|
| 214 |
+
$$
|
| 215 |
+
\operatorname* { i n f } _ { t \leq T } \mathbb { E } [ \| \nabla h ( x ^ { t } ) \| ^ { 2 } ] = O ( \log ( T ) T ^ { - { \frac { 1 } { 2 } } } ) \enspace .
|
| 216 |
+
$$
|
| 217 |
+
|
| 218 |
+
As for SGD, SOBA suffers from the need of decreasing step sizes to get actual convergence because of the variance of the estimation on each directions. On the other hand, the analysis of SABA leverages the dynamic of all three variables, resulting in fast convergence with fixed step sizes.
|
| 219 |
+
|
| 220 |
+
# 3.4 SABA: a stochastic method with optimal rates
|
| 221 |
+
|
| 222 |
+
In what follows, we denote $N = n + m$ the total number of samples. The following theorem shows $O ( N ^ { \frac { 2 } { 3 } } T ^ { - 1 } )$ convergence for the SABA algorithm in the general case where we only assume smoothness of $h$ . Our analysis of SABA is inspired by the analysis of single-level SAGA by Reddi et al. [40].
|
| 223 |
+
|
| 224 |
+
Theorem 3 (Convergence of SABA, smooth case). Assume that Assumptions 3.1 to 3.3 and 3.7 to 3.8 hold. We suppose $\rho = \rho ^ { \prime } N ^ { - \frac { 2 } { 3 } }$ and $\gamma = \xi \rho$ , where $\rho ^ { \prime }$ and $\xi$ depend only on $F$ and $G$ and are specified in appendix. Let $x ^ { t }$ the iterates of SABA. Then,
|
| 225 |
+
|
| 226 |
+
$$
|
| 227 |
+
\frac { 1 } { T } \sum _ { t = 1 } ^ { T } \mathbb { E } [ \| \nabla h ( x ^ { t } ) \| ^ { 2 } ] = O \left( N ^ { \frac { 2 } { 3 } } T ^ { - 1 } \right) \ .
|
| 228 |
+
$$
|
| 229 |
+
|
| 230 |
+
To prodefine $\begin{array} { r } { { S } ^ { t } = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \| y ^ { t } - w _ { i } ^ { t } \| ^ { 2 } + \frac { 1 } { m } \sum _ { j = 1 } ^ { m } \| y ^ { t } - \tilde { w } _ { j } ^ { t } \| ^ { 2 } } \end{array}$ m the memory to the current variables. We. In appendix, we show that we can find $\phi _ { s } , \phi _ { z } , \phi _ { v } > 0$ such that the quantity $\mathcal { L } ^ { t } = h ^ { t } + \phi _ { s } S ^ { t } + \phi _ { z } \delta _ { z } ^ { t } + \phi _ { v } \delta _ { v } ^ { t }$
|
| 231 |
+
Summing these inequalities for $t = 1 \dots T$ and using the fact that $\textstyle { \mathcal { L } } ^ { t }$ is lower bounded demonstrates
|
| 232 |
+
the theorem.
|
| 233 |
+
|
| 234 |
+
Note that the step sizes are constant with respect to the time, but they scale with $N ^ { - \frac { 2 } { 3 } }$ . As a consequence, the sample complexity is $O ( N ^ { \frac { 2 } { 3 } } \epsilon ^ { - 1 } )$ which is analogous of the one of SAGA for non-convex single level problems [40]. This is better than the sample complexity of Algorithm 1 with full batch directions, which is $O ( N \epsilon ^ { - 1 } )$ . Hence, with SABA, we get the best of both worlds: the stochasticity makes the scaling in $N$ of the sample complexity goes from $N$ in full batch mode to $N ^ { \frac { 2 } { 3 } }$ for SABA, and the variance reduction makes the scaling in $\epsilon$ goes from $\epsilon ^ { - 2 }$ for SOBA to $\epsilon ^ { - 1 }$ for SABA. Our experiments in Section 4 confirm this gain.
|
| 235 |
+
|
| 236 |
+
Furthermore, if we assume that $h$ satisfies a Polyak-Łojasiewicz (PL) inequality, we recover linear convergence. Recall that $h$ has the PL property if there exists $\mu _ { h } > 0$ such that for all $x \in \mathbb { R } ^ { d }$ $\begin{array} { r } { \frac { 1 } { 2 } \| \nabla h ( \bar { \boldsymbol { x } } ) \| ^ { 2 } \geq \mu _ { h } ( h ( \boldsymbol { x } ) - h ^ { * } ) } \end{array}$ with $h ^ { * }$ the minimum of $h$ .
|
| 237 |
+
|
| 238 |
+
Theorem 4 (Convergence of SABA, PL case). Assume that $h$ satisfies the PL inequality and that Assumptions 3.1 to 3.3 and 3.7 to 3.8 hold. We suppose $\rho = \rho ^ { \prime } N ^ { - \frac { 2 } { 3 } }$ and $\gamma = \xi \rho ^ { \prime } N ^ { - 1 }$ , where $\rho ^ { \prime }$ and $\xi$ depend only on $F$ and $G$ and are specified in appendix. Let $x ^ { t }$ the iterates of SABA and $\begin{array} { r } { c ^ { \prime } \triangleq \operatorname* { m i n } \left( \mu _ { h } , \frac { 1 } { 1 6 P ^ { \prime } } \right) } \end{array}$ with $P ^ { \prime }$ specified in the appendix. Then,
|
| 239 |
+
|
| 240 |
+
$$
|
| 241 |
+
\mathbb { E } [ h ^ { T } ] - h ^ { * } = ( 1 - c ^ { \prime } \gamma ) ^ { T } ( h ^ { 0 } - h ^ { * } + C ^ { 0 } )
|
| 242 |
+
$$
|
| 243 |
+
|
| 244 |
+
where $C ^ { 0 }$ is a constant specified in appendix that depends on the initialization of $z , v , x$ and memory.
|
| 245 |
+
|
| 246 |
+
The proof is similar to that of the previous theorem: we find coefficients $\phi _ { s } , \phi _ { z } , \phi _ { v }$ such that $\mathcal { L } ^ { t } \stackrel { } { = } h ^ { t } + \phi _ { s } S ^ { t } + \phi _ { z } \delta _ { z } ^ { t } + \phi _ { v } \delta _ { v } ^ { t }$ satisfies the inequality $\mathcal { L } ^ { t + 1 } \leq ( 1 - c ^ { \prime } \gamma ) \mathcal { L } ^ { t }$ , which is then unrolled. Note that in the case where we initialize $z$ and $v$ with $z ^ { 0 } = z ^ { * } ( x ^ { 0 } )$ , $v ^ { 0 } = v ^ { * } ( x ^ { 0 } )$ , and the memories $w _ { i } ^ { 0 } = w ^ { 0 }$ , $\tilde { w } _ { j } ^ { 0 } = w ^ { 0 }$ for all $i , j$ , the constant $C ^ { 0 }$ cancels and the bound simplifies to $\mathbb { E } [ h ( x ^ { T } ) ] - h ^ { * } \leq ( 1 - c ^ { \prime } \gamma ) ^ { T } ( h ( x ^ { 0 } ) - h ^ { * } )$ .
|
| 247 |
+
|
| 248 |
+
Just like classical variance reduction methods in single-level optimization, this theorem shows that our method achieves linear convergence under PL assumption on the value function. To the best of our knowledge, our method is the first stochastic bilevel optimization method that enjoys such property. We note that the PL hypothesis is more general than $\mu _ { h }$ -strong convexity of $h - \mathrm { i t }$ is a necessary condition for strong convexity.
|
| 249 |
+
|
| 250 |
+
We see here the importance of global variance reduction. Indeed, using variance reduction only on $z$ and SGD on $x$ would lead to sub-linear convergence in $x$ . This would be the case even with a perfect estimation of $z ^ { * } ( x )$ . Similarly, using variance reduction only on $x$ and SGD on $z$ would lead to sub-linear convergence in $z$ , and hence in $x$ . Using global variance reduction with respect to each variable as we propose here is the only way to achieve linear convergence. We now turn to experiments, where we find that our method is also promising from a practical point of view.
|
| 251 |
+
|
| 252 |
+
# 4 Experiments
|
| 253 |
+
|
| 254 |
+
Here we compare the performances of SOBA and SABA with competitor methods on different tasks. The different methods being compared are stocBiO [26], AmiGO [2], FSLA [30], MRBO [47], TTSA [24], BSA [19] and SUSTAIN [28]. A detailed account of the experiments is provided in Appendix B. 1
|
| 255 |
+
|
| 256 |
+
# 4.1 Hyperparameters selection
|
| 257 |
+
|
| 258 |
+
The first task we perform is hyperparameters selection to choose regularization parameters on $\ell ^ { 2 }$ logistic regression. Let us denote $( ( d _ { i } ^ { \mathrm { t r a i n } } , y _ { i } ^ { \mathrm { t r a i n } } ) ) _ { 1 \leq i \leq n }$ and $( ( d _ { i } ^ { \mathrm { v a l } } , y _ { i } ^ { \mathrm { v a l } } ) ) _ { 1 \leq i \leq m }$ the training and the validation sets. In this case, the inner variable $\bar { \theta }$ corresponds to the parameters of the model, and the outer variable $\lambda$ to the regularization. The functions $F$ and $G$ of the problem (1) are the logistic loss, with $\ell ^ { 2 }$ penalty for $G$ , that is to say $\begin{array} { r } { F ( \theta , \lambda ) = \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \varphi ( y _ { i } ^ { \mathrm { v a l } } \langle \bar { d } _ { i } ^ { \mathrm { v a l } } , \theta \rangle ) } \end{array}$ and $\begin{array} { r } { G ( \theta , \lambda ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } \varphi ( y _ { i } ^ { \mathrm { t r a i n } } \langle d _ { i } ^ { \mathrm { t r a i n } } , \theta \rangle ) + \frac { 1 } { 2 } \sum _ { k = 1 } ^ { p } e ^ { \lambda _ { k } } \theta _ { k } ^ { 2 } } \end{array}$ where $\varphi ( u ) = \log ( 1 + e ^ { - u } )$ . We fit a binary classification model on the IJCNN $1 ^ { 2 }$ dataset. Here, $n = 4 9 9 9 0$ , $m = 9 1 7 0 1$ and $p = 2 2$ .
|
| 259 |
+
|
| 260 |
+
The suboptimality gap is plotted in Figure $2 \mathrm { a }$ for each method. The lowest values are reached by SABA. Moreover, SABA is the only single-loop method that reaches a suboptimality below $1 0 ^ { - 5 }$ SOBA reaches a quite high final value but slightly better than TTSA and FSLA. The gap between
|
| 261 |
+
|
| 262 |
+

|
| 263 |
+
Figure 2: Comparison of SOBA and SABA with other stochastic bilevel optimization methods. For each algorithm, we plot the median performance over 10 runs. In both experiments, SABA achieves the best performance. The dashed lines are for one loop competitor methods, the dotted lines are for two loops methods and the solid lines are the proposed methods. Left: hyperparameter selection for $\ell ^ { 2 }$ penalized logistic regression on IJCNN1 dataset , Right: data hyper-cleaning on MNIST with $p = 0 . 5$ corruption rate.
|
| 264 |
+
|
| 265 |
+
SOBA and SABA highlights the benefits of variance reduction: it gives us a lower plateau and the fixed step sizes enable faster convergence.
|
| 266 |
+
|
| 267 |
+
# 4.2 Data hyper-cleaning
|
| 268 |
+
|
| 269 |
+
The second task we perform is data hyper-cleaning introduced in [16] on the $\mathsf { M N I S T } ^ { 3 }$ dataset. The data is patitioned into a training set $( d _ { i } ^ { \mathrm { t r a i \bar { n } } } , y _ { i } ^ { \mathrm { t r a i n } } )$ , a validation set $( d _ { i } ^ { \mathrm { v a l } } , y _ { i } ^ { \mathrm { v a l } } )$ , and a test set. The training set contains 20000 samples, the validation set 5000 samples and the test set 10000 samples. The targets $y$ take values in $\{ 0 , \ldots , 9 \}$ and the samples $x$ are in dimension 784. Each sample in the training set is corrupted with probability $p$ : a sample is corrupted when we replace its label $y _ { i }$ by a random label in $\{ 0 , \ldots , 9 \}$ . Samples in the validation and test sets are not corrupted. The goal of datacleaning is to train a multinomial logistic regression on the train set and learn a weight per training sample, that should go to 0 for corrupted samples. This is formalized by the bilevel optimization problem (1) with $\begin{array} { r } { F ( \mathbf { \Sigma } \breve { \theta , \lambda } ) = \frac { 1 } { m } \sum _ { i = 1 } ^ { m } \dot { \ell } ( \theta d _ { i } ^ { \mathrm { v a l } } , \dot { y _ { i } ^ { \mathrm { v a l } } } ) } \end{array}$ and $\begin{array} { r } { G ( \theta , \lambda ) = \frac { 1 } { n } \sum _ { i = 1 } ^ { n ^ { - } } \sigma ( \lambda _ { i } ) \ell ( \theta d _ { i } ^ { \mathrm { t r a i n } } , y _ { i } ^ { \mathrm { t r a i n } } ) \dot { + } C _ { r } \| \theta \| ^ { 2 } } \end{array}$ where $\ell$ is the cross entropy loss and $\sigma$ is the sigmoid function. The inner variable $\theta$ is a matrix of size $1 0 \times 7 8 4$ , and the outer variable $\lambda$ is a vector in dimension $n _ { \mathrm { t r a i n } } = 2 0 0 0 0$ .
|
| 270 |
+
|
| 271 |
+
For the estimated parameters $\theta$ during optimization, we report in Figure 2b the test error, i.e., the percent of wrong predictions on the testing data. We use for this experiment a corruption probability $p = 0 . 5$ . In general, the error decreases quickly until it reaches a final value. We observe that our method SABA outperforms all the other methods by reaching faster its smallest error, which is smaller than the ones of the other methods. For SOBA, it reaches a lower final error than stocBiO and BSA. In appendix, we provide other convergence curves, and find that for higher values of $p$ , SABA is still the fastest algorithm to reach its final accuracy. Overall, we find that among all methods, even those that implement variance reduction (that is FSLA, MRBO, SUSTAIN, SABA), SABA is the one that demonstrates the best empirical performance.
|
| 272 |
+
|
| 273 |
+
# 5 Conclusion
|
| 274 |
+
|
| 275 |
+
In this paper, we have presented a framework for bilevel optimization that enables the straightforward development of stochastic algorithms. The gist of our framework is that the directions in Equations (4) to (6) are all written as simple sums of samples derivatives. We leveraged this fact to propose SOBA, an extension of SGD to our framework, and SABA, an extension of SAGA to our framework, which both achieve similar convergence rates as their single level counterparts. Finally, we think that our framework opens a large panel of potential methods for stochastic bilevel optimization involving techniques of extrapolation, variance reduction, momentum and so on.
|
| 276 |
+
|
| 277 |
+
# Acknowledgments and Disclosure of Funding
|
| 278 |
+
|
| 279 |
+
We thank Othmane Sebbouh, Zaccharie Ramzi and Benoît Malézieux for their precious comments. The authors acknowledge the support of the ANER RAGA BFC. SV acknowledges the support of the ANR GraVa ANR-18-CE40-0005. This work is supported by a public grant overseen by the French National Research Agency (ANR) through the program UDOPIA, project funded by the ANR-20-THIA-0013-01 and DATAIA convergence institute (ANR-17-CONV-0003).
|
| 280 |
+
|
| 281 |
+
References
|
| 282 |
+
[1] Zeeshan Akhtar, Amrit Singh Bedi, Srujan Teja Thomdapu, and Ketan Rajawat. Projection-Free Algorithm for Stochastic Bi-level Optimization. preprint ArXiv 2110.11721, 2021.
|
| 283 |
+
[2] Michael Arbel and Julien Mairal. Amortized Implicit Differentiation for Stochastic Bilevel Optimization. In International Conference on Learning Representations (ICLR), 2022.
|
| 284 |
+
[3] Shaojie Bai, J. Zico Kolter, and Vladlen Koltun. Deep Equilibrium Models. In Advances in Neural Information Processing Systems (NeurIPS). Curran Associates, Inc., 2019.
|
| 285 |
+
[4] Atilim Gunes Baydin, Barak A. Pearlmutter, Alexey Andreyevich Radul, and Jeffrey Mark Siskind. Automatic differentiation in Machine Learning: A survey. Journal of Machine Learning Research, 18(153):1–43, 2018.
|
| 286 |
+
[5] Yoshua Bengio. Gradient-Based Optimization of Hyperparameters. Neural Computation, 12(8): 1889–1900, 2000.
|
| 287 |
+
[6] Quentin Bertrand, Quentin Klopfenstein, Mathieu Blondel, Samuel Vaiter, Alexandre Gramfort, and Joseph Salmon. Implicit differentiation of lasso-type models for hyperparameter optimization. In International Conference on Machine Learning (ICML), pages 810–821. PMLR, 2020.
|
| 288 |
+
[7] Léon Bottou. Large-Scale Machine Learning with Stochastic Gradient Descent. In Proceedings of COMPSTAT, pages 177–186. Physica-Verlag HD, Heidelberg, 2010.
|
| 289 |
+
[8] Léon Bottou, Frank E. Curtis, and Jorge Nocedal. Optimization methods for large-scale Machine Learning. Siam Reviews, 60(2):223–311, 2018.
|
| 290 |
+
[9] Tianyi Chen, Yuejiao Sun, and Wotao Yin. Closing the Gap: Tighter Analysis of Alternating Stochastic Gradient Methods for Bilevel Problems. In Advances in Neural Information Processing Systems (NeurIPS). Curran Associates, Inc., 2021.
|
| 291 |
+
[10] Tianyi Chen, Yuejiao Sun, and Wotao Yin. A Single-Timescale Stochastic Bilevel Optimization Method. In International Conference on Artificial Intelligence and Statistics (AISTATS), 2022.
|
| 292 |
+
[11] Ekin D. Cubuk, Barret Zoph, Dandelion Mane, Vijay Vasudevan, and Quoc V. Le. AutoAugment: Learning Augmentation Strategies From Data. In CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 113–123. IEEE, 2019.
|
| 293 |
+
[12] Ashok Cutkosky and Francesco Orabona. Momentum-based variance reduction in non-convex SGD. In Advances in Neural Information Processing Systems (NeurIPS). Curran Associates, Inc., 2019.
|
| 294 |
+
[13] Aaron Defazio, Francis Bach, and Simon Lacoste-Julien. SAGA: A Fast Incremental Gradient Method With Support for Non-Strongly Convex Composite Objectives. In Advances in Neural Information Processing Systems (NeurIPS), volume 28, pages 1646–1654, Montreal, QC, Canada, December 2014. Curran Associates, Inc.
|
| 295 |
+
[14] Justin Domke. Generic methods for optimization-based modeling. In International Conference on Artificial Intelligence and Statistics (AISTAT), volume 22, pages 318–326. PMLR, 2012.
|
| 296 |
+
[15] Cong Fang, Chris Junchi Li, Zhouchen Lin, and Tong Zhang. SPIDER: Near-Optimal NonConvex Optimization via Stochastic Path Integrated Differential Estimator. In Advances in Neural Information Processing Systems (NeurIPS), 2018.
|
| 297 |
+
[16] Luca Franceschi, Michele Donini, Paolo Frasconi, and Massimiliano Pontil. Forward and reverse gradient-based hyperparameter optimization. In International Conference on Machine Learning (ICML), pages 1165–1173. PMLR, 2017.
|
| 298 |
+
[17] Luca Franceschi, Paolo Frasconi, Saverio Salzo, Riccardo Grazzi, and Massimiliano Pontil. Bilevel programming for hyperparameter optimization and meta-learning. In International Conference on Machine Learning (ICML), pages 1568–1577. PMLR, 2018.
|
| 299 |
+
[18] Saeed Ghadimi and Guanghui Lan. Stochastic first- and zeroth-order methods for nonconvex stochastic programming. SIAM Journal on Optimization, 23(4):2341–2368, 2013. doi: 10.1137/ 120880811.
|
| 300 |
+
[19] Saeed Ghadimi and Mengdi Wang. Approximation Methods for Bilevel Programming. preprint ArXiv 1802.02246, 2018.
|
| 301 |
+
[20] Riccardo Grazzi, Luca Franceschi, Massimiliano Pontil, and Saverio Salzo. On the iteration complexity of hypergradient computation. In International Conference on Machine Learning (ICML), pages 3748–3758. PMLR, 2020.
|
| 302 |
+
[21] Riccardo Grazzi, Massimiliano Pontil, and Saverio Salzo. Convergence properties of stochastic hypergradients. In International Conference on Artificial Intelligence and Statistics (AISTAT), pages 3826–3834. PMLR, 2021.
|
| 303 |
+
[22] Zhishuai Guo, Quanqi Hu, Lijun Zhang, and Tianbao Yang. Randomized Stochastic VarianceReduced Methods for Multi-Task Stochastic Bilevel Optimization. preprint ArXiv 2105.02266, 2021.
|
| 304 |
+
[23] Zhishuai Guo, Yi Xu, Wotao Yin, Rong Jin, and Tianbao Yang. On Stochastic Moving-Average Estimators for Non-Convex Optimization. preprint ArXiv 2104.14840, 2021.
|
| 305 |
+
[24] Mingyi Hong, Hoi-To Wai, Zhaoran Wang, and Zhuoran Yang. A Two-Timescale Framework for Bilevel Optimization: Complexity Analysis and Application to Actor-Critic. preprint ArXiv 2007.05170, 2021.
|
| 306 |
+
[25] Feihu Huang and Heng Huang. BiAdam: Fast Adaptive Bilevel Optimization Methods. preprint ArXiv 2106.11396, 2021.
|
| 307 |
+
[26] Kaiyi Ji, Junjie Yang, and Yingbin Liang. Bilevel optimization: Convergence analysis and enhanced design. In International Conference on Machine Learning (ICML), pages 4882–4892. PMLR, 2021.
|
| 308 |
+
[27] Rie Johnson and Tong Zhang. Accelerating stochastic gradient descent using predictive variance reduction. In Advances in Neural Information Processing Systems (NeurIPS), volume 26. Curran Associates, Inc., 2013.
|
| 309 |
+
[28] Prashant Khanduri, Siliang Zeng, Mingyi Hong, Hoi-To Wai, Zhaoran Wang, and Zhuoran Yang. A Near-Optimal Algorithm for Stochastic Bilevel Optimization via Double-Momentum. In Advances in Neural Information Processing Systems (NeurIPS). Curran Associates, Inc., 2021.
|
| 310 |
+
[29] Siu Kwan Lam, Antoine Pitrou, and Stanley Seibert. Numba: A llvm-based python jit compiler. In Proceedings of the Second Workshop on the LLVM Compiler Infrastructure in HPC, pages 1–6, 2015.
|
| 311 |
+
[30] Junyi Li, Bin Gu, and Heng Huang. A Fully Single Loop Algorithm for Bilevel Optimization without Hessian Inverse. In Proceedings of the Thirty-sixth AAAI Conference on Artificial Intelligence, AAAI’22, 2022.
|
| 312 |
+
[31] Seppo Linnainmaa. Taylor expansion of the accumulated rounding error. BIT Numerical Mathematics, 16(2):146–160, 1976.
|
| 313 |
+
[32] Dong C. Liu and Jorge Nocedal. On the limited memory BFGS method for large scale optimization. Mathematical Programming, 45(1-3):503–528, 1989.
|
| 314 |
+
[33] Hanxiao Liu, Karen Simonyan, and Yiming Yang. Darts: Differentiable architecture search. In International Conference on Learning Representations (ICLR), 2018.
|
| 315 |
+
[34] Dougal Maclaurin, David Duvenaud, and Ryan Adams. Gradient-based hyperparameter optimization through reversible learning. In International Conference on machine learning (ICML), pages 2113–2122. PMLR, 2015.
|
| 316 |
+
[35] Thomas Moreau, Mathurin Massias, Alexandre Gramfort, Pierre Ablin, Pierre-Antoine Bannier Benjamin Charlier, Mathieu Dagréou, Tom Dupré la Tour, Ghislain Durif, Cassio F. Dantas, Quentin Klopfenstein, Johan Larsson, En Lai, Tanguy Lefort, Benoit Malézieux, Badr Moufad, Binh T. Nguyen, Alain Rakotomamonjy, Zaccharie Ramzi, Joseph Salmon, and Samuel Vaiter. Benchopt: Reproducible, efficient and collaborative optimization benchmarks. In Advances in Neural Information Processing Systems (NeurIPS), 2022.
|
| 317 |
+
[36] IU E. Nesterov. Introductory Lectures on Convex Optimization: A Basic Course. Number v. 87 in Applied Optimization. Kluwer Academic Publishers, Boston, 2004.
|
| 318 |
+
[37] Barak A Pearlmutter. Fast exact multiplication by the hessian. Neural computation, 6(1): 147–160, 1994.
|
| 319 |
+
[38] Fabian Pedregosa. Hyperparameter optimization with approximate gradient. In International Conference on Machine Learning (ICML), pages 737–746. PMLR, 2016.
|
| 320 |
+
[39] Zaccharie Ramzi, Florian Mannel, Shaojie Bai, Jean-Luc Starck, Philippe Ciuciu, and Thomas Moreau. SHINE: SHaring the INverse Estimate from the forward pass for bi-level optimization and implicit models. In International Conference on Learning Representations (ICLR), 2022.
|
| 321 |
+
[40] Sashank J. Reddi, Suvrit Sra, Barnabas Poczos, and Alex Smola. Fast Incremental Method for Nonconvex Optimization. In 2016 IEEE 55th Conference on Decision and Control (CDC), IEEE, pages 1971–1977, 2016.
|
| 322 |
+
[41] Herbert Robbins and Sutton Monro. A stochastic approximation method. The Annals of Mathematical Statistics, 22(3):400–407, 1951.
|
| 323 |
+
[42] Cédric Rommel, Thomas Moreau, Joseph Paillard, and Alexandre Gramfort. CADDA: Classwise Automatic Differentiable Data Augmentation for EEG Signals. In International Conference on Learning Representations (ICLR), 2022.
|
| 324 |
+
[43] Mark Schmidt, Nicolas Le Roux, and Francis Bach. Minimizing finite sums with the stochastic average gradient. Mathematical Programming, 162(1-2):83–112, 2017.
|
| 325 |
+
[44] Amirreza Shaban, Ching-An Cheng, Nathan Hatch, and Byron Boots. Truncated Backpropagation for Bilevel Optimization. In Artificial Intelligence and Statistics (AISTAT), pages 1723–1732, Okinawa, Japan, 2019.
|
| 326 |
+
[45] Heinrich von Stackelberg. Theory of the market economy. Oxford University Press, 1952.
|
| 327 |
+
[46] R. Wengert. A simple automatic derivative evaluation program. Communications of the ACM, 7 (8):463–464, 1964.
|
| 328 |
+
[47] Junjie Yang, Kaiyi Ji, and Yingbin Liang. Provably Faster Algorithms for Bilevel Optimization. In Advances in Neural Information Processing Systems (NeurIPS). Curran Associates, Inc., 2021.
|
| 329 |
+
|
| 330 |
+
# Checklist
|
| 331 |
+
|
| 332 |
+
1. For all authors...
|
| 333 |
+
|
| 334 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] See Section 3 and Section 4
|
| 335 |
+
(b) Did you describe the limitations of your work? [Yes]
|
| 336 |
+
(c) Did you discuss any potential negative societal impacts of your work? [N/A]
|
| 337 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 338 |
+
|
| 339 |
+
2. If you are including theoretical results...
|
| 340 |
+
|
| 341 |
+
(a) Did you state the full set of assumptions of all theoretical results? [Yes] See Section 3.1 (b) Did you include complete proofs of all theoretical results? [Yes] See Appendix C
|
| 342 |
+
|
| 343 |
+
3. If you ran experiments...
|
| 344 |
+
|
| 345 |
+
(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]
|
| 346 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Appendix B
|
| 347 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
|
| 348 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Appendix B
|
| 349 |
+
|
| 350 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 351 |
+
|
| 352 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes]
|
| 353 |
+
(b) Did you mention the license of the assets? [Yes]
|
| 354 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [Yes]
|
| 355 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 356 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 357 |
+
|
| 358 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 359 |
+
|
| 360 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 361 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 362 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/wv79UiY5U7/wv79UiY5U7.md
ADDED
|
@@ -0,0 +1,437 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Data Curation for Image Captioning with Text-to-Image Generative Models
|
| 2 |
+
|
| 3 |
+
Anonymous Author(s)
|
| 4 |
+
Affiliation
|
| 5 |
+
Address
|
| 6 |
+
email
|
| 7 |
+
|
| 8 |
+
# Abstract
|
| 9 |
+
|
| 10 |
+
1 Recent advances in image captioning are driven by increasingly larger-scale vision–
|
| 11 |
+
2 language pretraining, relying on massive computational resources and increasingly
|
| 12 |
+
3 large datasets. Instead of solely focusing on scaling pretraining, we ask whether
|
| 13 |
+
4 it is possible to improve performance by improving the quality of the samples in
|
| 14 |
+
5 existing datasets. We pursue this question through two approaches to data curation:
|
| 15 |
+
6 one that assumes that some examples should be avoided due to mismatches between
|
| 16 |
+
7 the image and caption, and one that assumes that the mismatch can be addressed by
|
| 17 |
+
8 replacing the image, for which we use the state-of-the-art Stable Diffusion model.
|
| 18 |
+
9 These approaches are evaluated using the BLIP model on the COCO and Flickr30K
|
| 19 |
+
10 datasets. Models trained with our data curation approaches consistently outperform
|
| 20 |
+
11 their baselines, indicating that better image captioning models can be trained by
|
| 21 |
+
12 curating existing resources. Finally, we conduct a human study to understand the
|
| 22 |
+
13 errors made by the Stable Diffusion model and highlight directions for future work
|
| 23 |
+
14 in text-to-image generation.
|
| 24 |
+
|
| 25 |
+
# 15 1 Introduction
|
| 26 |
+
|
| 27 |
+
16 Large-scale vision–language pretraining has been the driving force behind recent advances in image
|
| 28 |
+
17 captioning [14]. The amount of image–text data needed to pretrain recent generative language
|
| 29 |
+
18 models [28, 23, 53] has made it necessary to train on “noisy” samples harvested from the web
|
| 30 |
+
19 [46, 45], as opposed to crowdsourced captions [32]. This emerging reliance on harvested data has
|
| 31 |
+
20 made it important to perform additional filtering steps to remove low-quality data [28], in addition to
|
| 32 |
+
21 more resource-intensive pretraining. Given that computing resources are not equally distributed [21],
|
| 33 |
+
22 there is a need to also pursue less resource-intensive research directions.
|
| 34 |
+
23 We show how to improve image captioning by improving the quality of the downstream task data
|
| 35 |
+
24 through data curation: the process of dynamically updating the samples during training. We devise
|
| 36 |
+
25 three techniques for data curation that are designed to prevent the total size of the dataset from
|
| 37 |
+
26 increasing: the complete removal of an image–caption sample from a dataset; replacing a caption
|
| 38 |
+
27 with another caption; and replacing images using a text-to-image generation model [41]. These
|
| 39 |
+
28 curation techniques are used to update image–caption samples that have outlier losses, with respect
|
| 40 |
+
29 to the rest of a training dataset, under the current model parameters. In other words, the samples that
|
| 41 |
+
30 are proving difficult to model. Also, the synthesis of completely new images is radically different
|
| 42 |
+
31 from standard data augmentation techniques, such as random cropping or color manipulation [47], or
|
| 43 |
+
32 swapping and mask words in text [12].
|
| 44 |
+
33 We conduct experiments using BLIP [28], a strong image captioning model, on the Flickr30K [56]
|
| 45 |
+
34 and MS COCO datasets [32]. The results show that the sample removal and image replacement
|
| 46 |
+
35 techniques lead to consistent improvements of 1–3 CIDEr points compared to not curating the
|
| 47 |
+
36 dataset. Our analyses show that Flickr30K benefits from more curation than COCO due to differences
|
| 48 |
+
37 in the distribution of long captions in each dataset. Finally, we find that it is better to curate the
|
| 49 |
+
38 data dynamically while training instead of replacing images before starting to train the model.
|
| 50 |
+
39 Taken together, these findings show the promise of model-in-the-loop text-to-image generation for
|
| 51 |
+
40 multimodal learning, while highlighting that improvements in text-to-image generation are likely to
|
| 52 |
+
41 further enhance the effectiveness of data curation.
|
| 53 |
+
|
| 54 |
+

|
| 55 |
+
Figure 1: Overview of our data curation approaches. For dynamic removal or replacement of captions, high loss image-text pairs are either removed or the image is paired with an alternative caption in the following training epoch. For image replacement, captions of original images are used as prompts for text-to-image generation to synthesize new image–text pairs. We experiment with both options of replacing the image only, or pair another relevant caption to the synthesized image.
|
| 56 |
+
|
| 57 |
+
# 42 2 Related work
|
| 58 |
+
|
| 59 |
+
43 Image Captioning Image Captioning is the task of describing images with syntactically and
|
| 60 |
+
44 semantically sentences. Current deep learning-based image captioning models have evolved as
|
| 61 |
+
45 the encode-decoder frameworks with multi-modal connection [8, 9], attentive [24, 16] and fusion
|
| 62 |
+
46 strategies [58]. Standard captioning datasets contain Flickr30K [56] and the commonly used MS
|
| 63 |
+
47 COCO [32], which consisting of images with events, objects and scenes. Each image is paired with
|
| 64 |
+
48 five captions. Some works have demonstrated the benefits of training on synthetic captions [29, 3] or
|
| 65 |
+
49 datasets collected from other vision-and-language learning tasks [38, 7].
|
| 66 |
+
50 Data Augmentation Data augmentation [13] has achieved increasing attention in both natural
|
| 67 |
+
51 language processing [33] and vision-and-language learning [27]. Early methods generate augmented
|
| 68 |
+
52 examples in the model’s feature space [54] or interpolate the inputs and labels of few examples [57].
|
| 69 |
+
53 For downstream tasks in the text domain, Yang et al. [55] and Anaby-Tavor et al. [1] generate
|
| 70 |
+
54 synthetic text examples through state-of-the-art pretrained language models and show improved
|
| 71 |
+
55 performance on common-sense reasoning and text-classification. For image captioning, BERT [11]
|
| 72 |
+
56 has been used to generate additional captions to improve the diversity of the captioning datasets [3].
|
| 73 |
+
57 Hossain et al. [22] used GAN-synthesized images as additional augmentation training set to improve
|
| 74 |
+
58 image captioning models.
|
| 75 |
+
59 Diffusion Models and Application Diffusion models [49, 35] have grown rapidly and become
|
| 76 |
+
60 the powerful deep generative models. They have shown potential in a variety of applications,
|
| 77 |
+
61 including text-to-image generation [36, 15], image-to-image translation [42], as well as semantic
|
| 78 |
+
62 segmentation [26, 5] and video generation [20, 48, 52]. While recent large scale latent diffusion
|
| 79 |
+
63 models have shown strong capability in generating both artistic and photo-realistic high-resolution
|
| 80 |
+
64 images [41, 34, 39, 43], applying large-scale stable diffusion models in vision-language downstream
|
| 81 |
+
65 tasks remains under-explored. Concurrently, Azizi et al. [4] and Jain et al. [25] show that image
|
| 82 |
+
66 classifiers can be improved by learning from augmentation images generated by finetuned stable
|
| 83 |
+
67 diffusion models. To the best of our knowledge, we are the first to explore how image captioning
|
| 84 |
+
68 models can benefit from simple data curation without scaling up existing datasets, and how stable
|
| 85 |
+
69 diffusion text-to-image models can be applied and contribute in the process.
|
| 86 |
+
|
| 87 |
+
# 70 3 Data Curation for Captioning
|
| 88 |
+
|
| 89 |
+
71 Our goal is to improve image captioning models by preventing the model from training on difficult
|
| 90 |
+
72 samples. There are many reasons for the possible existence of these difficult samples, including
|
| 91 |
+
73 mismatches or inconsistencies between the image and caption [3]. More formally, given an image
|
| 92 |
+
74 captioning training dataset $\mathcal { D }$ with $K$ images, let $\mathrm { I } _ { k }$ be the $k$ -th image. Each image is paired with
|
| 93 |
+
75 $J$ captions; let $\mathrm { C } _ { k } ^ { j }$ be $j$ th caption of image $k$ , and thus, let $( \boldsymbol { \mathrm { I } } _ { k } , \boldsymbol { \mathrm { C } } _ { k } ^ { j } )$ be an image–caption sample in
|
| 94 |
+
76 the dataset. Assume the existence of model $\mathcal { M }$ , which is being trained on dataset $\mathcal { D }$ , from which we
|
| 95 |
+
77 can calculate the loss of each sample at each epoch $t$ : $\mathcal { L } _ { \mathcal { M } } ^ { t } ( \mathrm { I } _ { k } , \mathrm { C } _ { k } ^ { j } )$ , which can be used to track the
|
| 96 |
+
78 difficult samples. At the end of each epoch, the difficult samples are candidates for our data curation
|
| 97 |
+
79 techniques, resulting in dynamic updates to the training dataset $\mathcal { D } \to \mathcal { D } _ { 1 } \to \cdots \to \mathcal { D } _ { T }$ .
|
| 98 |
+
|
| 99 |
+
# 3.1 Identifying the difficult samples
|
| 100 |
+
|
| 101 |
+
81 Difficult training samples may contain mismatches or inconsis
|
| 102 |
+
82 tencies between the image and the caption [3]. We propose to
|
| 103 |
+
83 use the captioning model that is being trained to automatically
|
| 104 |
+
84 identify such samples. After each epoch, we compute the loss
|
| 105 |
+
85 of each sample in the current training dataset, given the current
|
| 106 |
+
86 model parameters. The highest loss samples are targets for our
|
| 107 |
+
87 data curation methods; more specifically, we focus on samples
|
| 108 |
+
88 with losses that are either two standard deviations from the mean,
|
| 109 |
+
89 or a fixed $X \%$ away e.g. $10 \%$ , $20 \%$ , etc. In this way, the training
|
| 110 |
+
90 dataset is dynamically updated at the end of each epoch according
|
| 111 |
+
91 to the model’s captioning capability. The adjacent figure shows
|
| 112 |
+
92 the empirical distribution of losses in the training samples of
|
| 113 |
+
93 the Flickr30K dataset. It is clear that, without data curation, the
|
| 114 |
+
94 high-loss samples remain high-loss during five epochs of training.
|
| 115 |
+
|
| 116 |
+

|
| 117 |
+
Figure 2: Distribution of persample losses in Flickr30K.
|
| 118 |
+
|
| 119 |
+
# 95 3.2 Sample Removal / Caption Replacement
|
| 120 |
+
|
| 121 |
+
The simplest approach to data curation is to remove or replace the high-loss samples. In REMOVE, the high-loss samples are completely removed from the remainder of the training process, reducing the total number of image–caption training samples. In REPLACECAP, we simply replace the caption in the image–caption sample with a different caption taken from the other captions that describe the image, effectively creating a duplicate. With the caption replacement method, the total number of samples used to train the model remains the same, as well as the total number of the unique images. This creates a clean control condition for the subsequent experiments.
|
| 122 |
+
|
| 123 |
+
# 103 3.3 Image Generation-based Replacement
|
| 124 |
+
|
| 125 |
+
An alternative to removing difficult samples or replacing captions is to pair an existing caption with a new image. This has the benefit of training the model on the same total number of samples while exposing it to more unique images. The new image could be found by humans, in a long-running human-in-the-loop cycle. Instead, we use a text-to-image generation model, in a rapid model-inthe-loop step, to synthesize images based on the other sentences that describe the image. Some representative examples of images generated using this technique can be seen in Figure 10.
|
| 126 |
+
|
| 127 |
+
Our methodology is based on the open source Stable Diffusion model [41], which can generate images given a textual prompt. 1 We integrate this into training as follows: Given an image $I _ { k }$ in the training data and its captions $\{ ( I _ { k } , C _ { k } ^ { 1 } ) , \ldots , ( I _ { k } , C _ { k } ^ { J } ) \}$ , we synthesize a new image $\hat { I } _ { k }$ without increasing the total number of samples in the original dataset. Instead, we replace the original image in the sample with the generated image. Specifically, for image $I _ { k }$ , we replace a high-loss sample $( I _ { k } , C _ { k } ^ { j } )$ with the synthesized image-text pair $( \hat { I } _ { k } , C _ { k } ^ { j } )$ .
|
| 128 |
+
|
| 129 |
+
# 116 Round-trip captioning evaluation
|
| 130 |
+
|
| 131 |
+
117 In order to effectively use a text-to-image generation model for data curation, we need an objec
|
| 132 |
+
118 tive measure that can estimate the expected quality of a generated image. Most previous work
|
| 133 |
+
119 uses image-oriented measures like FID [19] or CLIPScore [17] but these measures are claimed
|
| 134 |
+
120 to lack alignment with perceptual quality [44]. We also found they were not suitable for our
|
| 135 |
+
121 purpose, and that CLIPScore cannot distinguish between low- and high-loss samples in the cap
|
| 136 |
+
122 tioning model (Figure 9). Here, we propose an alternative that is directly related to our task: given
|
| 137 |
+
123 the generated image, measure the quality of the caption that can be generated by a fixed model.
|
| 138 |
+
124 Our assumption is that if the generated images
|
| 139 |
+
125 are of a similar quality to the original images,
|
| 140 |
+
126 the resulting captions should be similar to each
|
| 141 |
+
127 other. We call this a round-trip captioning evalu
|
| 142 |
+
128 ation, which comprises three steps illustrated in
|
| 143 |
+
129 Figure 3. In Step (1), we use the captions in the
|
| 144 |
+
130 validation set to generate images using a text-to
|
| 145 |
+
131 image generation model. In Step (2), we use an
|
| 146 |
+
132 existing image-captioning model to predict cap
|
| 147 |
+
133 tions for the generated images. Specifically, we
|
| 148 |
+
134 use BLIP fine-tuned on the COCO dataset but
|
| 149 |
+
135 any other strong captioning model could be used
|
| 150 |
+
136 instead. Finally, in Step (3), we compare the pre
|
| 151 |
+
137 dicted captions against the original captions. We
|
| 152 |
+
138 now discuss the the factors that we found make
|
| 153 |
+
139 a difference when generating images.
|
| 154 |
+
|
| 155 |
+

|
| 156 |
+
Figure 3: Round-trip captioning evaluation.
|
| 157 |
+
|
| 158 |
+
# 140 Prompt engineering matters
|
| 159 |
+
|
| 160 |
+
Recall that text-to-image generation models produce images based on a textual prompts. Given a set of five captions that describe an image, there are several options for how to prompt the image generation model. We experiment with three options:
|
| 161 |
+
|
| 162 |
+
• Single caption: Each caption is used in isolation to generate a new image. • Sentence-BERT selection: There is a lot of variety in how different captions describe the same image. Instead of using all captions, we can use a representative caption from the set. This is achieved using the Sentence-BERT [40] model to find the caption that is closest to the average embedding of all captions. • Concatenation: All five captions are concatenated as the text prompt for generation.
|
| 163 |
+
|
| 164 |
+
For all three approaches mentioned above, we can append an additional string to the prompt as a styler to force a specific style in the generated image $+ \cal S$ tyler). The styler used here is: "national geographic, high quality photography, Canon EOS R3, Flickr".2
|
| 165 |
+
|
| 166 |
+
# Finetuning improves image relevance
|
| 167 |
+
|
| 168 |
+
Table 1 shows the results of the round-trip captioning evaluation on the Flickr30K dataset using different textual prompts and whether or not to fine-tune the diffusion model. When we fine-tune StableDiffusion, we use the MS COCO [32] dataset with a prompt consisting of a concatenation of all 5 captions, for 15,000 steps with a constant learning rate of $1 e { - } 5$ and a batch size of 32. The best performance is clearly found by fine-tuning Stable Diffusion 1.5 and using a prompt with a concatenation of the captions and the styler. We use this configuration in the remainder of the paper.
|
| 169 |
+
|
| 170 |
+
Table 1: Round-trip captioning evaluation on Flickr30K with different Stable Diffusion models, prompts, and fine-tuning. BLEU, CIDEr, Meteor.
|
| 171 |
+
|
| 172 |
+
<table><tr><td>Model</td><td>FT</td><td>Prompt</td><td>B</td><td>C</td><td>M</td></tr><tr><td>Upper-bound</td><td></td><td></td><td>37.6</td><td>27.2</td><td>57.1</td></tr><tr><td>SD 1.5</td><td>=</td><td>concat</td><td>31.0</td><td>24.7</td><td>52.5</td></tr><tr><td>SD 1.5</td><td>-</td><td>+ styler</td><td>30.8</td><td>24.2</td><td>52.5</td></tr><tr><td>SD 1.5</td><td>F</td><td>+ styler</td><td>33.5</td><td>25.0</td><td>53.5</td></tr><tr><td>SD 1.5</td><td>F</td><td>SBERT + styler</td><td>30.6</td><td>24.1</td><td>52.0</td></tr><tr><td>SD 2.0</td><td>-</td><td>concat + styler</td><td>31.2</td><td>24.8</td><td>52.0</td></tr></table>
|
| 173 |
+
|
| 174 |
+

|
| 175 |
+
Figure 4: Qualitative examples from the COCO dataset of captions generated by the BLIP model (top), and the same model trained using our REPLACEIMG data curation (bottom). The errors made by the BLIP model (shown in red) are avoided by REPLACEIMG curation (shown in blue).
|
| 176 |
+
|
| 177 |
+
# 167 4 Experiments
|
| 178 |
+
|
| 179 |
+
168 We evaluate our data curation methods on the MS COCO and Flickr30K datasets when finetuning the
|
| 180 |
+
169 pretrained BLIP [28] model. We evaluate the captions using BLEU [37], METEOR [10], ROUGE
|
| 181 |
+
170 [31], CIDEr [51], SPICE [2], CLIPScore, and RefCLIPScore [18].
|
| 182 |
+
171 We use the ViT-based BLIP model [28] as our captioning model. We note that BLIP has a captioning
|
| 183 |
+
172 and filtering (CapFilt) data augmentation process during its pretraining, where both components were
|
| 184 |
+
173 finetuned on the COCO dataset. Therefore we use pretrained checkpoint $\mathrm { B L I P } _ { C a p F i l t }$ for Flick $3 0 \mathrm { k }$
|
| 185 |
+
174 and $\mathrm { B L I P } _ { b a s e }$ for COCO in our experiment, removing the effects from the CapFilt process. We
|
| 186 |
+
175 finetune BLIP using a batch size of 128 for 5 epochs on $4 \times$ A100 GPUs.
|
| 187 |
+
|
| 188 |
+
# 4.1 Results
|
| 189 |
+
|
| 190 |
+
Removal/Caption Replacement As shown in Table 2, dynamically removing mismatched imagetext pairs or replacing captions can effectively improve performance on both datasets over baselines on all metrics. For Flickr30K, the dynamic updates work best when apply to the top $1 \%$ of high-loss samples for REPLACECAP, and to samples whose loss are two standard deviations higher than the mean for REMOVE. For COCO, both REPLACECAP and REMOVE works best when curating the top $1 \%$ of high-loss samples. We repeat that during the curation process, no additional data samples or computation cost is introduced. We further study the effect of the amount of curation in Section 5.
|
| 191 |
+
|
| 192 |
+
184 Image Generation-based Replacement We evaluate Image Generation-based Replacement on
|
| 193 |
+
185 both the Flickr30K and COCO dataset. During finetuning, we replace images in the original text
|
| 194 |
+
186 image pairs with Stable Diffusion-synthesized images (ReplaceImg in Table 2). The results show
|
| 195 |
+
187 improvements compared to the baseline in every evaluation measure with best performance obtained
|
| 196 |
+
188 at replacement ratio of $40 \%$ for Flickr30K and at $10 \%$ for COCO. We show qualitative examples in
|
| 197 |
+
189 Figure 4, where models finetuned with our proposed curation method can generate better captions for
|
| 198 |
+
190 some scenes that may confuse the standard finetuned model. In Section 5.1, we analyze the effects of
|
| 199 |
+
191 varying the amount of synthetic images replaced, and in Section 5.2, we conduct a human study of
|
| 200 |
+
192 the types of errors found in the generated images.
|
| 201 |
+
|
| 202 |
+

|
| 203 |
+
Figure 5: Effects of the amount of data curated when finetuning the captioning model. We can observe that Flickr30K needs more curation $40 \%$ REPLACEIMG or 2 std REMOVE) than COCO ( $10 \%$ REPLACEIMG or $1 \%$ REPLACECAP). Flickr30K benefits more from removing high-loss training samples, indicating the original dataset may be noisier than MS COCO. For the 2 std approach, the number of samples curated is not fixed after each epoch and varies between $5 \%$ to $10 \%$ .
|
| 204 |
+
|
| 205 |
+
# 193 5 Analysis and Discussion
|
| 206 |
+
|
| 207 |
+
# 5.1 Data Curation: how much and when?
|
| 208 |
+
|
| 209 |
+
We analyze how the amount of curation affects image captioning performance. We examine different ratios of training samples that are removed, replaced with an alternative caption, or replaced with a synthesized image. For REMOVE and REPLACECAP, we consider curation ratio of $1 \%$ , $5 \%$ and $10 \%$ of high-loss samples. For REPLACEIMG, we consider $10 \% { - } 8 0 \%$ curation ratio. In addition to fixed $X \%$ ratios, we also intereven on samples that have losses two standard deviations worse than the mean.
|
| 210 |
+
|
| 211 |
+
201 Flickr30K needs more curation than COCO. The results of this analysis are shown in Figure 5.
|
| 212 |
+
202 The best improvement in performance for Flickr30K is achieved either through removing high loss
|
| 213 |
+
203 samples that are two standard deviations away, or replacing images for $40 \%$ of the high loss samples.
|
| 214 |
+
204 In the COCO dataset, replacing images for $10 \%$ of the
|
| 215 |
+
205 high loss samples gives the best improvement compared
|
| 216 |
+
206 to no data curation. The second best performing method
|
| 217 |
+
207 for COCO is removing or replacing captions of only $1 \%$
|
| 218 |
+
208 of the high loss samples. This indicates that Flickr30K
|
| 219 |
+
209 may contain more noisy samples than the MS COCO
|
| 220 |
+
210 dataset. Compared to MS COCO, Flickr30K contains
|
| 221 |
+
211 more samples with long captions (Figure 6), which may
|
| 222 |
+
212 include overly-specific details that are inconsistent with
|
| 223 |
+
213 other captions and are hard for the model to learn. See
|
| 224 |
+
214 more examples in our supplemental materials. Through
|
| 225 |
+
215 our curation-based finetuning, these samples can be effec
|
| 226 |
+
216 tively identified, removed or replaced, which indicates that
|
| 227 |
+
217 our method is efficient when training with noisy datasets. We note that curating more than $50 \%$ of
|
| 228 |
+
218 the data does not benefit training and actually harms performance.
|
| 229 |
+
219 Static image replacement versus dynamic replacement In REPLACEIMG (Section 3.3), we
|
| 230 |
+
220 dynamically replace images for the difficult training samples. Another static approach is to replace
|
| 231 |
+
221 the identical images, i.e. $I _ { k }$ in $\{ ( I _ { k } , C _ { k } ^ { 1 } ) , \ldots , ( I _ { k } , \check { C } _ { k } ^ { J } ) \}$ , with unique SD-synthesized images before
|
| 232 |
+
222 training, instead of updating the training samples while training. With static image replacement, for
|
| 233 |
+
223 each of the reference captions, we replace their original image with a SD-synthesized image. Static
|
| 234 |
+
224 replacement with $20 \% { - } 8 0 \%$ curation ratio corresponds to replacing images for one–four captions of
|
| 235 |
+
|
| 236 |
+

|
| 237 |
+
Figure 6: Distribution of caption lengths.
|
| 238 |
+
|
| 239 |
+

|
| 240 |
+
Figure 7: Dynamic image replacement against static replacement, as a function of the number of samples replaced.
|
| 241 |
+
|
| 242 |
+

|
| 243 |
+
Figure 8: Loss distribution of training samples across epochs with different curation methods.
|
| 244 |
+
|
| 245 |
+

|
| 246 |
+
(a) Distribution of text-to-image generation errors.
|
| 247 |
+
|
| 248 |
+

|
| 249 |
+
(b) Human evaluation versus CLIPScore.
|
| 250 |
+
|
| 251 |
+
Figure 9: Results of the human study of the errors made by the Stable Diffusion model in 100 images. The images used in the study were chosen to represent either low or high model loss. (a) Histogram of the number of errors annotated in each category. The most frequently occurring annotations concern weird deformations in the expected objects or humans. (b) Relationship between average number of identified errors by human annotations for each synthesized image and its captioning loss with regard to original captions. More errors are identified in images of higher loss. However, CLIPScore appears to fail in validating qualities of the synthesized images, as the score ranges are almost identical for samples that contain more errors.
|
| 252 |
+
|
| 253 |
+
225 the original five. The $50 \%$ replacement ratio mimics a fair coin-flip, where for each of the text-image
|
| 254 |
+
226 samples, there is $50 \%$ probability for the image to be replaced by a synthesized image.
|
| 255 |
+
227 We compare the efficacy of these two approaches in Figure 7. When evaluating on the original
|
| 256 |
+
228 1k validation set, we see that for both approaches, incorporating synthesized images of $20 \%$ or
|
| 257 |
+
229 $40 \%$ can assist finetuning and achieves higher BLEU4 and CIDEr scores. Nevertheless, dynamic
|
| 258 |
+
230 image replacement consistently performs better than the static method, showing focusing on the hard
|
| 259 |
+
231 samples is effective. For both replacement methods, performance starts to decrease when the curation
|
| 260 |
+
232 ratio is too high. This may indicate that when incorporating too many images from the synthetic
|
| 261 |
+
233 distribution, the gap increases between the training and evaluation sets.
|
| 262 |
+
234 Figure 8 shows the effect of the curation techniques in the training loss distributions across epochs.
|
| 263 |
+
235 For the REMOVE approach, training samples with loss that are two standard deviations worse than the
|
| 264 |
+
236 mean are dynamically removed during training, leading to the shrinking tail of the loss distribution.
|
| 265 |
+
237 SD-based image replacement gradually reduces losses through learning from a mixture of Gaussian
|
| 266 |
+
238 distribution from original image-text pairs and the ones contain synthesized images.
|
| 267 |
+
|
| 268 |
+
<table><tr><td>Image</td><td>Caption</td><td>CLIPScore Loss</td><td></td><td>Categorized Errors</td></tr><tr><td></td><td>A picture of two women with one in lacy white dress with handbag and leggings and the other with a tall red hat, black mid-dress,and frame like plastic dress on top.</td><td>84.1</td><td>181.0</td><td>type/color of clothing, color-clothing, weird-face</td></tr><tr><td></td><td>A pedicab driver waiting on his bike.</td><td>89.3</td><td>169.2</td><td>weird-main-object, weird-other-object, weird-body-parts, stance</td></tr><tr><td></td><td>A man in a black suit with tie and corsage smiles77.6 at a girl who smiles back,both are sitting at a tableat a semi formal event such as a wedding or reunion.</td><td></td><td>163.5</td><td>color-clothing, weird-body-parts, wrong-main-object, scene/event/location</td></tr><tr><td></td><td>Two men are playing guitars and one man is singing into a microphone on a stage with the spotlight on them.</td><td>74.7</td><td>26.0</td><td>weird-face, weird-body-parts, weird-main-object, weird-other-object</td></tr><tr><td></td><td>There a several people in a dark bar-type room,84.9 including one girl on a stool.</td><td></td><td>26.5</td><td>number, weird-face, weird-main-object, weird-body-parts</td></tr><tr><td></td><td>Many children are playing and swimming in the water.</td><td>78.2</td><td>26.9</td><td>weird-face, weird-body-parts</td></tr></table>
|
| 269 |
+
|
| 270 |
+
Figure 10: Examples of synthesized images that are of high losses (top) and examples of synthesized images that are of low losses (bottom). Human annotations show that consistent error types have been recognized for the high loss samples while CLIPScore fails to align with human judgement. The low loss synthesized images are visually less complicated than the higher loss ones, but can still often look weird and contain errors in color or objects.
|
| 271 |
+
|
| 272 |
+
# 239 5.2 Human Study: Errors made by SD models
|
| 273 |
+
|
| 274 |
+
Finally, we conduct a human study of the errors present in the SD-synthesized images. This will serve to better understand any shortcomings with this approach that is not captured by automatic evaluation measures.
|
| 275 |
+
|
| 276 |
+
243 We first ranked SD-synthesized images by model loss from the 1K images in the validation set. This
|
| 277 |
+
244 validation set of synthesized images was generated using the best performing configuration of the
|
| 278 |
+
245 Stable Diffusion model (see Section 3.3). We then sampled a subset for human annotation using the
|
| 279 |
+
246 top and bottom 50 images based on their loss using our fine-tuned captioning model. These images
|
| 280 |
+
247 are uniformly divided into 5 sets, each containing 20 images with equal number of the high loss
|
| 281 |
+
248 ones and the low loss ones. The data was annotated by 12 people, members of a university research
|
| 282 |
+
249 lab with a basic understanding of Stable Diffusion but no knowledge of the bi-modal distribution
|
| 283 |
+
250 of images. The annotators were asked to categorize the errors they observed in the synthesized
|
| 284 |
+
251 images, given both the image and the reference sentences that were used to generate the images. Each
|
| 285 |
+
252 participant annotated one set of 20 images.
|
| 286 |
+
253 Starting from the categories defined by van Miltenburg and Elliott [50], we predefined 25 categories
|
| 287 |
+
254 including general errors such as color, or number mismatches, and errors related to people and
|
| 288 |
+
255 objects in the images. Please see the user interface in supplemental materials. We analyze the human
|
| 289 |
+
256 judgements for the images that have at least three annotations, yielding 74 unique images.
|
| 290 |
+
257 As shown in Figure 9a, the most common problem of SD-synthesized images are that they often
|
| 291 |
+
258 generate weird face or body parts, which makes the images less natural or pleasant. The Stable
|
| 292 |
+
259 Diffusion model is also weak at generating the correct number of people or objects. From Figure 9b
|
| 293 |
+
260 we confirm the quality of our collected annotations that high loss figures often contain more errors
|
| 294 |
+
261 on average. Furthermore, we note that CLIPScore does not appear to align with human judgements,
|
| 295 |
+
262 indicating its weak capability of evaluating quality of generated images. Please see more concrete
|
| 296 |
+
263 examples in Figure 10.
|
| 297 |
+
|
| 298 |
+
# 264 6 Conclusion
|
| 299 |
+
|
| 300 |
+
65 In this paper, we have shown a simple, yet effective, data curation framework that can improve the
|
| 301 |
+
66 performance of image captioning models. We investigated three approaches to data curation that
|
| 302 |
+
67 dynamically update the training dataset based on high-loss image-caption samples. The methods
|
| 303 |
+
68 involved either removing a sample, replacing the caption in a sample, or generating a new image
|
| 304 |
+
69 from existing captions. Experimental results on the Flickr30K and MS COCO datasets show the
|
| 305 |
+
70 effectiveness of these approaches to data curation without increasing the total size of the training
|
| 306 |
+
71 dataset. A deeper analysis of the images synthesized by Stable Diffusion shows frequent errors on
|
| 307 |
+
72 generating objects of a certain amount or color, and struggles with human body features. A human
|
| 308 |
+
73 evaluation of the errors in those images shows a clear difference in images with high or low losses.
|
| 309 |
+
274 In the future, we expect that better text-to-image generation models will lead to further improvements
|
| 310 |
+
275 from using synthesized images for difficult captions in existing training datasets. We plan on
|
| 311 |
+
276 verifying whether these findings extend to other image captioning models, which was not possible
|
| 312 |
+
277 here due to computational issues. Finally, we are interested in applying the same framework to other
|
| 313 |
+
278 multimodal tasks, especially those with undercomplete datasets that cannot comprehensively cover
|
| 314 |
+
279 the distributional space due to the cost of crowdsourcing enough data, e.g. visual question answering,
|
| 315 |
+
280 or visually-grounded dialog.
|
| 316 |
+
|
| 317 |
+
# 281 Limitations
|
| 318 |
+
|
| 319 |
+
While our curation methods being effective on image-captioning in the finetuning and fewshotlearning settings, it is not clear if the same strategy can be scaled and adapted also to vision-language pretraining. Currently our data curation methods also rely on state-of-the art pretrained models for both image understanding and text-to-image generation. In pretraining, models will often be trained from scratch and pretraining data are often collected from multiple datasets and resources.
|
| 320 |
+
|
| 321 |
+
Moreover, while we take an online approach to data curation, our current approach is upper bounded in speed and performance of the text-to-image generation model. This might be a large bottle neck for adapting the strategy for more complicated vision-and-language tasks.
|
| 322 |
+
|
| 323 |
+
# 290 Ethics Statement
|
| 324 |
+
|
| 325 |
+
Text-to-image generation with Stable Diffusion is controversial in the broader AI and ethics community[6]. For example, it can generate images according to gender or racial stereotypes, which may prove harmful to members of those communities [30]. In this paper, we use Stable Diffusion to improve the quality of an image captioning model, given a specific set of crowdsourced captions. Those captions may themselves contain harmful stereotypes that would become more prevalent in our dynamically updated training datasets. As we dynamically update the model with new images based on loss values, we remove the water-marker in our generated images to prevent information leak to the model. Use of the synthesized images will strictly follow community guidelines.
|
| 326 |
+
|
| 327 |
+
# References
|
| 328 |
+
|
| 329 |
+
[1] Ateret Anaby-Tavor, Boaz Carmeli, Esther Goldbraich, Amir Kantor, George Kour, Segev Shlomov, Naama Tepper, and Naama Zwerdling. Do not have enough data? deep learning to the rescue! In AAAI, pages 7383–7390. AAAI Press, 2020. 2
|
| 330 |
+
|
| 331 |
+
304 [2] Peter Anderson, Basura Fernando, Mark Johnson, and Stephen Gould. Spice: Semantic
|
| 332 |
+
305 propositional image caption evaluation. In European conference on computer vision, pages
|
| 333 |
+
306 382–398. Springer, 2016. 5
|
| 334 |
+
307 [3] Viktar Atliha and Dmitrij Šešok. Text augmentation using bert for image captioning. Applied
|
| 335 |
+
308 Sciences, 2020. 2, 3
|
| 336 |
+
309 [4] Shekoofeh Azizi, Simon Kornblith, Chitwan Saharia, Mohammad Norouzi, and David J. Fleet.
|
| 337 |
+
310 Synthetic data from diffusion models improves imagenet classification, 2023. 2
|
| 338 |
+
311 [5] Dmitry Baranchuk, Andrey Voynov, Ivan Rubachev, Valentin Khrulkov, and Artem Babenko.
|
| 339 |
+
312 Label-efficient semantic segmentation with diffusion models. In International Conference on
|
| 340 |
+
313 Learning Representations, 2022. URL https://openreview.net/forum?id $\underset { . } { = }$ SlxSY2UZQT.
|
| 341 |
+
314 2
|
| 342 |
+
315 [6] Nicholas Carlini, Jamie Hayes, Milad Nasr, Matthew Jagielski, Vikash Sehwag, Florian Tramèr,
|
| 343 |
+
316 Borja Balle, Daphne Ippolito, and Eric Wallace. Extracting training data from diffusion models.
|
| 344 |
+
317 arXiv preprint arXiv:2301.13188, 2023. 9
|
| 345 |
+
318 [7] Soravit Changpinyo, Doron Kukliansy, Idan Szpektor, Xi Chen, Nan Ding, and Radu Sori
|
| 346 |
+
319 cut. All you may need for VQA are image captions. In Marine Carpuat, Marie-Catherine
|
| 347 |
+
320 de Marneffe, and Iván Vladimir Meza Ruíz, editors, NAACL, pages 1947–1963. Association for
|
| 348 |
+
321 Computational Linguistics, 2022. 2
|
| 349 |
+
322 [8] Fuhai Chen, Rongrong Ji, Jinsong Su, Yongjian Wu, and Yunsheng Wu. Structcap: Structured
|
| 350 |
+
323 semantic embedding for image captioning. In Qiong Liu, Rainer Lienhart, Haohong Wang,
|
| 351 |
+
324 Sheng-Wei "Kuan-Ta" Chen, Susanne Boll, Yi-Ping Phoebe Chen, Gerald Friedland, Jia Li, and
|
| 352 |
+
325 Shuicheng Yan, editors, MM, pages 46–54. ACM, 2017. 2
|
| 353 |
+
326 [9] Fuhai Chen, Rongrong Ji, Xiaoshuai Sun, Yongjian Wu, and Jinsong Su. Groupcap: Group
|
| 354 |
+
327 based image captioning with structured relevance and diversity constraints. In CVPR, pages
|
| 355 |
+
328 1345–1353. Computer Vision Foundation / IEEE Computer Society, 2018. 2
|
| 356 |
+
329 [10] Michael Denkowski and Alon Lavie. Meteor universal: Language specific translation evaluation
|
| 357 |
+
330 for any target language. In Proceedings of the ninth workshop on statistical machine translation,
|
| 358 |
+
331 pages 376–380, 2014. 5
|
| 359 |
+
332 [11] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of
|
| 360 |
+
333 deep bidirectional transformers for language understanding. In Proceedings of the 2019 Confer
|
| 361 |
+
334 ence of the North American Chapter of the Association for Computational Linguistics: Human
|
| 362 |
+
335 Language Technologies, Volume 1 (Long and Short Papers), pages 4171–4186, Minneapolis,
|
| 363 |
+
336 Minnesota, June 2019. Association for Computational Linguistics. doi: 10.18653/v1/N19-1423.
|
| 364 |
+
337 URL https://aclanthology.org/N19-1423. 2
|
| 365 |
+
338 [12] Steven Y. Feng, Varun Gangal, Jason Wei, Sarath Chandar, Soroush Vosoughi, Teruko Mitamura,
|
| 366 |
+
339 and Eduard Hovy. A survey of data augmentation approaches for NLP. In Findings of the
|
| 367 |
+
340 Association for Computational Linguistics: ACL-IJCNLP 2021, pages 968–988, Online, August
|
| 368 |
+
341 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.findings-acl.84. URL
|
| 369 |
+
342 https://aclanthology.org/2021.findings-acl.84. 1
|
| 370 |
+
343 [13] Steven Y. Feng, Varun Gangal, Jason Wei, Sarath Chandar, Soroush Vosoughi, Teruko Mitamura,
|
| 371 |
+
344 and Eduard H. Hovy. A survey of data augmentation approaches for NLP. In Chengqing Zong,
|
| 372 |
+
345 Fei Xia, Wenjie Li, and Roberto Navigli, editors, ACL, volume ACL/IJCNLP 2021 of Findings
|
| 373 |
+
346 of ACL, pages 968–988. Association for Computational Linguistics, 2021. 2
|
| 374 |
+
347 [14] Zhe Gan, Linjie Li, Chunyuan Li, Lijuan Wang, Zicheng Liu, and Jianfeng Gao. Vision-language
|
| 375 |
+
348 pre-training: Basics, recent advances, and future trends, 2022. 1
|
| 376 |
+
349 [15] Shuyang Gu, Dong Chen, Jianmin Bao, Fang Wen, Bo Zhang, Dongdong Chen, Lu Yuan, and
|
| 377 |
+
350 Baining Guo. Vector quantized diffusion model for text-to-image synthesis. In CVPR, pages
|
| 378 |
+
351 10686–10696. IEEE, 2022. 2
|
| 379 |
+
|
| 380 |
+
352 [16] Longteng Guo, Jing Liu, Xinxin Zhu, Peng Yao, Shichen Lu, and Hanqing Lu. Normalized and geometry-aware self-attention network for image captioning. In CVPR, pages 10324–10333. Computer Vision Foundation / IEEE, 2020. 2
|
| 381 |
+
355 [17] Jack Hessel, Ari Holtzman, Maxwell Forbes, Ronan Le Bras, and Yejin Choi. CLIPScore: a reference-free evaluation metric for image captioning. In EMNLP, 2021. 4 [18] Jack Hessel, Ari Holtzman, Maxwell Forbes, Ronan Le Bras, and Yejin Choi. CLIPScore: A reference-free evaluation metric for image captioning. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 7514–7528, Online and Punta Cana, Dominican Republic, November 2021. Association for Computational Linguistics. doi: 10. 18653/v1/2021.emnlp-main.595. URL https://aclanthology.org/2021.emnlp-main. 595. 5 [19] Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. In NIPS, 2017. 4
|
| 382 |
+
[20] Jonathan Ho, Tim Salimans, Alexey Gritsenko, William Chan, Mohammad Norouzi, and David J Fleet. Video diffusion models. arXiv:2204.03458, 2022. 2
|
| 383 |
+
368 [21] Sara Hooker. The hardware lottery, 2020. 1
|
| 384 |
+
369 [22] Md. Zakir Hossain, Ferdous Sohel, Mohd Fairuz Shiratuddin, Hamid Laga, and Mohammed Bennamoun. Text to image synthesis for improved image captioning. IEEE Access, 9:64918– 64928, 2021. doi: 10.1109/ACCESS.2021.3075579. 2 [23] Xiaowei Hu, Zhe Gan, Jianfeng Wang, Zhengyuan Yang, Zicheng Liu, Yumao Lu, and Lijuan Wang. Scaling up vision-language pre-training for image captioning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 17980–17989, 2022. 1 [24] Lun Huang, Wenmin Wang, Jie Chen, and Xiaoyong Wei. Attention on attention for image captioning. In ICCV, pages 4633–4642. IEEE, 2019. 2 [25] Saachi Jain, Hannah Lawrence, Ankur Moitra, and Aleksander Madry. Distilling model failures as directions in latent space. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id $\equiv$ 99RpBVpLiX. 2 [26] Peng Jiang, Fanglin Gu, Yunhai Wang, Changhe Tu, and Baoquan Chen. Difnet: Semantic segmentation by diffusion networks. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. CesaBianchi, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 31. Curran Associates, Inc., 2018. URL https://proceedings.neurips.cc/paper_files/ paper/2018/file/c2626d850c80ea07e7511bbae4c76f4b-Paper.pdf. 2
|
| 385 |
+
386 [27] Guodun Li, Yuchen Zhai, Zehao Lin, and Yin Zhang. Similar scenes arouse similar emotions: Parallel data augmentation for stylized image captioning. In Heng Tao Shen, Yueting Zhuang, John R. Smith, Yang Yang, Pablo César, Florian Metze, and Balakrishnan Prabhakaran, editors, MM, pages 5363–5372. ACM, 2021. 2 [28] Junnan Li, Dongxu Li, Caiming Xiong, and Steven Hoi. Blip: Bootstrapping language-image pre-training for unified vision-language understanding and generation. In ICML, 2022. 1, 5 [29] Junnan Li, Dongxu Li, Caiming Xiong, and Steven C. H. Hoi. BLIP: bootstrapping languageimage pre-training for unified vision-language understanding and generation. In Kamalika Chaudhuri, Stefanie Jegelka, Le Song, Csaba Szepesvári, Gang Niu, and Sivan Sabato, editors, ICML, volume 162 of Proceedings of Machine Learning Research, pages 12888–12900. PMLR, 2022. 2
|
| 386 |
+
397 [30] Minghui Li, Yan Wan, and Jinping Gao. What drives the ethical acceptance of deep synthesis applications? a fuzzy set qualitative comparative analysis. Computers in Human Behavior, 133: 107286, 2022. ISSN 0747-5632. doi: https://doi.org/10.1016/j.chb.2022.107286. 9
|
| 387 |
+
|
| 388 |
+
400 [31] Chin-Yew Lin. ROUGE: A package for automatic evaluation of summaries. In Text Summariza
|
| 389 |
+
401 tion Branches Out, pages 74–81, Barcelona, Spain, July 2004. Association for Computational
|
| 390 |
+
402 Linguistics. URL https://aclanthology.org/W04-1013. 5
|
| 391 |
+
403 [32] Tsung-Yi Lin, Michael Maire, Serge J. Belongie, Lubomir D. Bourdev, Ross B. Girshick, James
|
| 392 |
+
404 Hays, Pietro Perona, Deva Ramanan, Piotr Doll’a r, and C. Lawrence Zitnick. Microsoft COCO:
|
| 393 |
+
405 common objects in context. CoRR, abs/1405.0312, 2014. 1, 2, 4
|
| 394 |
+
406 [33] Ruibo Liu, Guangxuan Xu, Chenyan Jia, Weicheng Ma, Lili Wang, and Soroush Vosoughi. Data
|
| 395 |
+
407 boost: Text data augmentation through reinforcement learning guided conditional generation.
|
| 396 |
+
408 In Bonnie Webber, Trevor Cohn, Yulan He, and Yang Liu, editors, EMNLP, pages 9031–9041.
|
| 397 |
+
409 Association for Computational Linguistics, 2020. 2
|
| 398 |
+
410 [34] Alex Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin, Bob McGrew,
|
| 399 |
+
411 Ilya Sutskever, and Mark Chen. Glide: Towards photorealistic image generation and editing
|
| 400 |
+
412 with text-guided diffusion models, 2022. 2
|
| 401 |
+
413 [35] Alexander Quinn Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic
|
| 402 |
+
414 models. In Marina Meila and Tong Zhang, editors, ICML, volume 139, pages 8162–8171.
|
| 403 |
+
415 PMLR, 2021. 2
|
| 404 |
+
416 [36] Alexander Quinn Nichol, Prafulla Dhariwal, Aditya Ramesh, Pranav Shyam, Pamela Mishkin,
|
| 405 |
+
417 Bob McGrew, Ilya Sutskever, and Mark Chen. GLIDE: towards photorealistic image generation
|
| 406 |
+
418 and editing with text-guided diffusion models. In Kamalika Chaudhuri, Stefanie Jegelka,
|
| 407 |
+
419 Le Song, Csaba Szepesvári, Gang Niu, and Sivan Sabato, editors, ICML, volume 162, pages
|
| 408 |
+
420 16784–16804, 2022. 2
|
| 409 |
+
421 [37] Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. Bleu: a method for automatic
|
| 410 |
+
422 evaluation of machine translation. In Proceedings of the 40th annual meeting of the Association
|
| 411 |
+
423 for Computational Linguistics, pages 311–318, 2002. 5
|
| 412 |
+
424 [38] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agar
|
| 413 |
+
425 wal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya
|
| 414 |
+
426 Sutskever. Learning transferable visual models from natural language supervision. In Ma
|
| 415 |
+
427 rina Meila and Tong Zhang, editors, ICML, volume 139 of Proceedings of Machine Learning
|
| 416 |
+
428 Research, pages 8748–8763. PMLR, 2021. 2
|
| 417 |
+
429 [39] Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical
|
| 418 |
+
430 text-conditional image generation with clip latents, 2022. 2
|
| 419 |
+
431 [40] Nils Reimers and Iryna Gurevych. Sentence-BERT: Sentence embeddings using Siamese
|
| 420 |
+
432 BERT-networks. In Proceedings of the 2019 Conference on Empirical Methods in Nat
|
| 421 |
+
433 ural Language Processing and the 9th International Joint Conference on Natural Lan
|
| 422 |
+
434 guage Processing (EMNLP-IJCNLP), pages 3982–3992, Hong Kong, China, November
|
| 423 |
+
435 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1410. URL
|
| 424 |
+
436 https://aclanthology.org/D19-1410. 4
|
| 425 |
+
437 [41] Robin Rombach, A. Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High
|
| 426 |
+
438 resolution image synthesis with latent diffusion models. 2022 IEEE/CVF Conference on
|
| 427 |
+
439 Computer Vision and Pattern Recognition (CVPR), pages 10674–10685, 2022. 1, 2, 3
|
| 428 |
+
440 [42] Chitwan Saharia, William Chan, Huiwen Chang, Chris A. Lee, Jonathan Ho, Tim Salimans,
|
| 429 |
+
441 David J. Fleet, and Mohammad Norouzi. Palette: Image-to-image diffusion models. In
|
| 430 |
+
442 Munkhtsetseg Nandigjav, Niloy J. Mitra, and Aaron Hertzmann, editors, SIGGRAPH, pages
|
| 431 |
+
443 15:1–15:10. ACM, 2022. 2
|
| 432 |
+
444 [43] Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily Denton, Seyed
|
| 433 |
+
445 Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, S. Sara Mahdavi, Rapha Gontijo Lopes, Tim
|
| 434 |
+
446 Salimans, Jonathan Ho, David J Fleet, and Mohammad Norouzi. Photorealistic text-to-image
|
| 435 |
+
447 diffusion models with deep language understanding, 2022. 2
|
| 436 |
+
|
| 437 |
+
448 [44] Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily L. Denton, Seyed Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, Seyedeh Sara Mahdavi, Raphael Gontijo Lopes, Tim Salimans, Jonathan Ho, David J. Fleet, and Mohammad Norouzi. Photorealistic text-to-image diffusion models with deep language understanding. arXiv preprint, 2022. URL https://doi.org/10.48550/arXiv.2205.11487. 4 [45] Christoph Schuhmann, Richard Vencu, Romain Beaumont, Robert Kaczmarczyk, Clayton Mullis, Aarush Katta, Theo Coombes, Jenia Jitsev, and Aran Komatsuzaki. Laion- $. 4 0 0 \mathrm { m }$ : Open dataset of clip-filtered 400 million image-text pairs. arXiv preprint, 2021. URL https: //doi.org/10.48550/arXiv.2111.02114. 1 [46] Piyush Sharma, Nan Ding, Sebastian Goodman, and Radu Soricut. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 2556–2565, Melbourne, Australia, July 2018. Association for Computational Linguistics. doi: 10.18653/v1/P18-1238. URL https://aclanthology.org/P18-1238. 1 [47] Connor Shorten and Taghi M Khoshgoftaar. A survey on image data augmentation for deep learning. Journal of big data, 6(1):1–48, 2019. 1 [48] Uriel Singer, Adam Polyak, Thomas Hayes, Xi Yin, Jie An, Songyang Zhang, Qiyuan Hu, Harry Yang, Oron Ashual, Oran Gafni, Devi Parikh, Sonal Gupta, and Yaniv Taigman. Make-a-video: Text-to-video generation without text-video data, 2022. 2 [49] Yang Song, Jascha Sohl-Dickstein, Diederik P. Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In ICLR, 2021. 2 [50] Emiel van Miltenburg and Desmond Elliott. Room for improvement in automatic image description: an error analysis. CoRR, abs/1704.04198, 2017. 8 [51] Ramakrishna Vedantam, C Lawrence Zitnick, and Devi Parikh. Cider: Consensus-based image description evaluation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 4566–4575, 2015. 5 [52] Ruben Villegas, Mohammad Babaeizadeh, Pieter-Jan Kindermans, Hernan Moraldo, Han Zhang, Mohammad Taghi Saffar, Santiago Castro, Julius Kunze, and Dumitru Erhan. Phenaki: Variable length video generation from open domain textual description, 2022. 2 [53] Zirui Wang, Jiahui Yu, Adams Wei Yu, Zihang Dai, Yulia Tsvetkov, and Yuan Cao. Simvlm: Simple visual language model pretraining with weak supervision. Learning, 2021. 1 [54] Jason W. Wei and Kai Zou. EDA: easy data augmentation techniques for boosting performance on text classification tasks. In Kentaro Inui, Jing Jiang, Vincent $\mathrm { N g }$ , and Xiaojun Wan, editors, EMNLP-IJCNLP, pages 6381–6387. Association for Computational Linguistics, 2019. 2 [55] Yiben Yang, Chaitanya Malaviya, Jared Fernandez, Swabha Swayamdipta, Ronan Le Bras, Ji-Ping Wang, Chandra Bhagavatula, Yejin Choi, and Doug Downey. G-daug: Generative data augmentation for commonsense reasoning. In Trevor Cohn, Yulan He, and Yang Liu, editors, EMNLP, volume EMNLP 2020 of Findings of ACL, pages 1008–1025. Association for Computational Linguistics, 2020. 2 [56] Peter Young, Alice Lai, Micah Hodosh, and Julia Hockenmaier. From image descriptions to visual denotations: New similarity metrics for semantic inference over event descriptions. TACL, 2:67–78, 2014. 1, 2 [57] Hongyi Zhang, Moustapha Cissé, Yann N. Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. In ICLR. OpenReview.net, 2018. 2 [58] Luowei Zhou, Hamid Palangi, Lei Zhang, Houdong Hu, Jason J. Corso, and Jianfeng Gao. Unified vision-language pre-training for image captioning and VQA. In AAAI, pages 13041– 13049. AAAI Press, 2020. 2
|
md/dev/xm6YD62D1Ub/xm6YD62D1Ub.md
ADDED
|
@@ -0,0 +1,464 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# VICREG: VARIANCE-INVARIANCE-COVARIANCE REGULARIZATION FOR SELF-SUPERVISED LEARNING
|
| 2 |
+
|
| 3 |
+
# Adrien Bardes1,2
|
| 4 |
+
|
| 5 |
+
Jean Ponce2,4
|
| 6 |
+
|
| 7 |
+
Yann LeCun $^ { 1 , 3 , 4 }$
|
| 8 |
+
|
| 9 |
+
1Facebook AI Research
|
| 10 |
+
2Inria, École normale supérieure, CNRS, PSL Research University
|
| 11 |
+
3Courant Institute, New York University
|
| 12 |
+
4Center for Data Science, New York University
|
| 13 |
+
|
| 14 |
+
# ABSTRACT
|
| 15 |
+
|
| 16 |
+
Recent self-supervised methods for image representation learning maximize the agreement between embedding vectors produced by encoders fed with different views of the same image. The main challenge is to prevent a collapse in which the encoders produce constant or non-informative vectors. We introduce VICReg (Variance-Invariance-Covariance Regularization), a method that explicitly avoids the collapse problem with two regularizations terms applied to both embeddings separately: (1) a term that maintains the variance of each embedding dimension above a threshold, (2) a term that decorrelates each pair of variables. Unlike most other approaches to the same problem, VICReg does not require techniques such as: weight sharing between the branches, batch normalization, feature-wise normalization, output quantization, stop gradient, memory banks, etc., and achieves results on par with the state of the art on several downstream tasks. In addition, we show that our variance regularization term stabilizes the training of other methods and leads to performance improvements.
|
| 17 |
+
|
| 18 |
+
# 1 INTRODUCTION
|
| 19 |
+
|
| 20 |
+
Self-supervised representation learning has made significant progress over the last years, almost reaching the performance of supervised baselines on many downstream tasks Bachman et al. (2019); Misra & Maaten (2020); He et al. (2020); Tian et al. (2020); Caron et al. (2020); Grill et al. (2020); Chen & He (2020); Gidaris et al. (2021); Zbontar et al. (2021). Several recent approaches rely on a joint embedding architecture in which two networks are trained to produce similar embeddings for different views of the same image. A popular instance is the Siamese network architecture Bromley et al. (1994), where the two networks share the same weights. The main challenge with joint embedding architectures is to prevent a collapse in which the two branches ignore the inputs and produce identical and constant output vectors. There are two main approaches to preventing collapse: contrastive methods and information maximization methods. Contrastive Bromley et al. (1994); Chopra et al. (2005); He et al. (2020); Hjelm et al. (2019); Chen et al. (2020a) methods tend to be costly, require large batch sizes or memory banks, and use a loss that explicitly pushes the embeddings of dissimilar images away from each other. They often require a mining procedure to search for offending dissimilar samples from a memory bank He et al. (2020) or from the current batch Chen et al. (2020a). Quantization-based approaches Caron et al. (2020; 2018) force the embeddings of different samples to belong to different clusters on the unit sphere. Collapse is prevented by ensuring that the assignment of samples to clusters is as uniform as possible. A similarity term encourages the cluster assignment score vectors from the two branches to be similar. More recently, a few methods have appeared that do not rely on contrastive samples or vector quantization, yet produce high-quality representations, for example BYOL Grill et al. (2020) and SimSiam Chen & He (2020). They exploit several tricks: batch-wise or feature-wise normalization, a "momentum encoder" in which the parameter vector of one branch is a low-pass-filtered version of the parameter vector of the other branch Grill et al. (2020); Richemond et al. (2020), or a stop-gradient operation in one of the branches Chen & He (2020). The dynamics of learning in these methods, and how they avoid collapse, is not fully understood, although theoretical and empirical studies point to the crucial importance of batch-wise or feature-wise normalization Richemond et al. (2020); Tian et al. (2021). Finally, an alternative class of collapse prevention methods relies on maximizing the information content of the embedding Zbontar et al. (2021); Ermolov et al. (2021). These methods prevent informational collapse by decorrelating every pair of variables of the embedding vectors. This indirectly maximizes the information content of the embedding vectors. The Barlow Twins method drives the normalized cross-correlation matrix of the two embeddings towards the identity Zbontar et al. (2021), while the Whitening-MSE method whitens and spreads out the embedding vectors on the unit sphere Ermolov et al. (2021).
|
| 21 |
+
|
| 22 |
+

|
| 23 |
+
Figure 1: VICReg: joint embedding architecture with variance, invariance and covariance regularization. Given a batch of images $I$ , two batches of different views $X$ and $X ^ { \prime }$ are produced and are then encoded into representations $Y$ and $Y ^ { \prime }$ . The representations are fed to an expander producing the embeddings $Z$ and $Z ^ { \prime }$ . The distance between two embeddings from the same image is minimized, the variance of each embedding variable over a batch is maintained above a threshold, and the covariance between pairs of embedding variables over a batch are attracted to zero, decorrelating the variables from each other. Although the two branches do not require identical architectures nor share weights, in most of our experiments, they are Siamese with shared weights: the encoders are ResNet-50 backbones with output dimension 2048. The expanders have 3 fully-connected layers of size 8192.
|
| 24 |
+
|
| 25 |
+
# 2 VICREG: INTUITION
|
| 26 |
+
|
| 27 |
+
We introduce VICReg (Variance-Invariance-Covariance Regularization), a self-supervised method for training joint embedding architectures based on the principle of preserving the information content of the embeddings. The basic idea is to use a loss function with three terms:
|
| 28 |
+
|
| 29 |
+
• Invariance: the mean square distance between the embedding vectors.
|
| 30 |
+
• Variance: a hinge loss to maintain the standard deviation (over a batch) of each variable of the embedding above a given threshold. This term forces the embedding vectors of samples within a batch to be different.
|
| 31 |
+
• Covariance: a term that attracts the covariances (over a batch) between every pair of (centered) embedding variables towards zero. This term decorrelates the variables of each embedding and prevents an informational collapse in which the variables would vary together or be highly correlated.
|
| 32 |
+
|
| 33 |
+
Variance and Covariance terms are applied to both branches of the architecture separately, thereby preserving the information content of each embedding at a certain level and preventing informational collapse independently for the two branches. The main contribution of this paper is the Variance preservation term, which explicitly prevents a collapse due to a shrinkage of the embedding vectors towards zero. The Covariance criterion is borrowed from the Barlow Twins method and prevents informational collapse due to redundancy between the embedding variables Zbontar et al. (2021). VICReg is more generally applicable than most of the aforementioned methods because of fewer constraints on the architecture. In particular, VICReg:
|
| 34 |
+
|
| 35 |
+
• does not require that the weights of the two branches be shared, not that the architectures be identical, nor that the inputs be of the same nature;
|
| 36 |
+
|
| 37 |
+
• does not require a memory bank, nor contrastive samples, nor a large batch size; • does not require batch-wise nor feature-wise normalization; and • does not require vector quantization nor a predictor module.
|
| 38 |
+
|
| 39 |
+
Other methods require asymmetric stop gradient operations, as in SimSiam Chen & He (2020), weight sharing between the two branches as in classical Siamese nets, or weight sharing through exponential moving average dampening with stop gradient in one branch, as in BYOL and MoCo He et al. (2020); Grill et al. (2020); Chen et al. (2020c), large batches of contrastive samples, as in SimCLR Chen et al. (2020a), or batch-wise and/or feature-wise normalization Caron et al. (2020); Grill et al. (2020); Chen & He (2020); Zbontar et al. (2021); Ermolov et al. (2021). One of the most interesting feature of VICReg is the fact that the two branches are not required to share the same parameters, architecture, or input modality. This opens the door to the use of non-contrastive self-supervised joint-embedding for multi-modal signals, such as video and audio. We demonstrate the effectiveness of the proposed approach by evaluating the representations learned with VICReg on several downstream image recognition tasks including linear head and semi-supervised evaluation protocols for image classification on ImageNet Deng et al. (2009), and other classification, detection, instance segmentation, and retrieval tasks. Furthermore, we show that incorporating variance preservation into other self-supervised joint-embedding methods yields better training stability and performance improvement on downstream tasks. More generally, we show that VICReg is an explicit and effective, yet simple method for preventing collapse in self-supervised joint-embedding learning.
|
| 40 |
+
|
| 41 |
+
# 3 RELATED WORK
|
| 42 |
+
|
| 43 |
+
Contrastive learning. In contrastive SSL methods applied to joint embedding architectures, the output embeddings for a sample and its distorted version are brought close to each other, while other samples and their distortions are pushed away. The method is most often applied to Siamese architectures in which the two branches have identical architectures and share weights Misra & Maaten (2020); He et al. (2020); Bromley et al. (1994); Hjelm et al. (2019); Chen et al. (2020a;c); Hadsell et al. (2006); Ye et al. (2019); Wu et al. (2018); van den Oord et al. (2018); Chen et al. (2020b). Many authors use the InfoNCE loss van den Oord et al. (2018) in which the repulsive force is larger for contrastive samples that are closer to the reference. While these methods yield good performance, they require large amounts of contrastive pairs in order to work well. These contrastive pairs can be sampled from a memory bank as in MoCo He et al. (2020), or given by the current batch of data as in SimCLR Chen et al. (2020a), with a significant memory footprint. This downside of contrastive methods motivates a search for alternatives.
|
| 44 |
+
|
| 45 |
+
Clustering methods. Instead of viewing each sample as its own class, clustering-based methods group them into clusters based on some similarity measure Caron et al. (2020; 2018); Bautista et al. (2016); Yang et al. (2016); Xie et al. (2016); Huang et al. (2019); Zhuang et al. (2019); Caron et al. (2019); Asano et al. (2020); Yan et al. (2020). DeepCluster Caron et al. (2018) uses $k$ -means assignments of representations from previous iterations as pseudo-labels for the new representations, which requires an expensive clustering phase done asynchronously, and makes the method hard to scale up. SwAV Caron et al. (2020) mitigates this issue by learning the clusters online while maintaining a balanced partition of the assignments through the Sinkhorn-Knopp transform Cuturi (2013). These clustering approaches can be viewed as contrastive learning at the level of clusters which still requires a lot of negative comparisons to work well.
|
| 46 |
+
|
| 47 |
+
Distillation methods. Recent proposals such as BYOL, SimSiam, OBoW and variants Grill et al. (2020); Chen & He (2020); Gidaris et al. (2021); Richemond et al. (2020); Gidaris et al. (2020) have shown that collapse can be avoided by using architectural tricks inspired by knowledge distillation Hinton et al. (2015). These methods train a student network to predict the representations of a teacher network, for which the weights are a running average of the student network’s weights Grill et al. (2020), or are shared with the student network, but no gradient is back-propagated through the teacher Chen & He (2020). These methods are effective, but there is no clear understanding of why and how they avoid collapse. Alternatively, the images can be represented as bags of word over a dictionary of visual features, which effectively prevents collapse. In OBoW Gidaris et al. (2020) and Gidaris et al. (2021) the dictionary is obtained by off-line or on-line clustering. By contrast, our method explicitly prevents collapse in the two branches independently, which removes the requirement for shared weights and identical architecture, opening the door to the application of joint-embedding SSL to multi-modal signals.
|
| 48 |
+
|
| 49 |
+
Information maximization methods. A principle to prevent collapse is to maximize the information content of the embeddings. Two such methods were recently proposed: W-MSE Ermolov et al. (2021) and Barlow Twins Zbontar et al. (2021). In W-MSE, an extra module transforms the embeddings into the eigenspace of their covariance matrix (whitening or Karhunen-Loève transform), and forces the vectors thereby obtained to be uniformly distributed on the unit sphere. In Barlow Twins, a loss term attempts to make the normalized cross-correlation matrix of the embedding vectors from the two branches to be close to the identity. Both methods attempt to produce embedding variables that are decorrelated from each other, thus preventing an informational collapse in which the variables carry redundant information. Because all variables are normalized over a batch, there is no incentive for them to shrink nor expand. This seems to sufficient to prevent collapse. Our method borrows the decorrelation mechanism of Barlow Twins. But it includes an explicit variance-preservation term for each variable of the two embeddings and thus does not require any normalization.
|
| 50 |
+
|
| 51 |
+
# 4 VICREG: DETAILED DESCRIPTION
|
| 52 |
+
|
| 53 |
+
VICReg follows recent trends in self-supervised learning Caron et al. (2020); Grill et al. (2020); Chen & He (2020); Zbontar et al. (2021); Chen et al. (2020a) and is based on a joint embedding architecture. Contrary to many previous approaches, our architecture may be completely symmetric or completely asymmetric with no shared structure or parameters between the two branches. In most of our experiments, we use a Siamese net architecture in which the two branches are identical and share weights. Each branch consists of an encoder $f _ { \theta }$ that outputs the representations (used for downstream tasks), followed by an expander $h _ { \phi }$ that maps the representations into an embedding space where the loss function will be computed. The role of the expander is twofold: (1) eliminate the information by which the two representations differ, (2) expand the dimension in a non-linear fashion so that decorrelating the embedding variables will reduce the dependencies (not just the correlations) between the variables of the representation vector. The loss function uses a term $s$ that learns invariance to data transformations and is regularized with a variance term $v$ that prevents norm collapse and a covariance term $c$ that prevents informational collapse by decorrelating the different dimensions of the vectors. After pretraining, the expander is discarded and the representations of the encoder are used for downstream tasks.
|
| 54 |
+
|
| 55 |
+
# 4.1 METHOD
|
| 56 |
+
|
| 57 |
+
Given an image $i$ sampled from a dataset $\mathcal { D }$ , two transformations $t$ and $t ^ { \prime }$ are sampled from a distribution $\tau$ to produce two different views $x = t ( i )$ and $x ^ { \prime } = t ^ { \prime } ( i )$ of $i$ . These transformations are random crops of the image, followed by color distortions. The distribution $\tau$ is described in Appendix C. The views $x$ and $x ^ { \prime }$ are first encoded by $f _ { \theta }$ into their representations $y = f _ { \boldsymbol { \theta } } ( \boldsymbol { x } )$ and $\bar { y ^ { \prime } } \overset { - } { = } f _ { \theta } ( x ^ { \prime } )$ , which are then mapped by the expander $h _ { \phi }$ onto the embeddings $z = h _ { \phi } ( y )$ and $z ^ { \prime } = h _ { \phi } ( y ^ { \prime } )$ . The loss is computed at the embedding level on $z$ and $z ^ { \prime }$ .
|
| 58 |
+
|
| 59 |
+
We describe here the variance, invariance and covariance terms that compose our loss function. The images are processed in batches, and we denote $Z = [ z _ { 1 } , \dots , z _ { n } ]$ and $Z ^ { \prime } = [ z _ { 1 } ^ { \prime } , \dots , z _ { n } ^ { \prime } ]$ the two batches composed of $n$ vectors of dimension $d$ , of embeddings coming out of the two branches of the siamese architecture. We denote by $z ^ { j }$ the vector composed of each value at dimension $j$ in all vectors in $Z$ . We define the variance regularization term $v$ as a hinge function on the standard deviation of the embeddings along the batch dimension:
|
| 60 |
+
|
| 61 |
+
$$
|
| 62 |
+
v ( Z ) = \frac { 1 } { d } \sum _ { j = 1 } ^ { d } \operatorname* { m a x } ( 0 , \gamma - S ( z ^ { j } , \epsilon ) ) ,
|
| 63 |
+
$$
|
| 64 |
+
|
| 65 |
+
where $S$ is the regularized standard deviation defined by:
|
| 66 |
+
|
| 67 |
+
$$
|
| 68 |
+
S ( x , \epsilon ) = \sqrt { \mathrm { V a r } ( x ) + \epsilon } ,
|
| 69 |
+
$$
|
| 70 |
+
|
| 71 |
+
$\gamma$ is a constant target value for the standard deviation, fixed to 1 in our experiments, $\epsilon$ is a small scalar preventing numerical instabilities. This criterion encourages the variance inside the current batch to be equal to $\gamma$ along each dimension, preventing collapse with all the inputs mapped on the same vector. Using the standard deviation and not directly the variance is crucial. Indeed, if we take $S ( x ) = \mathrm { V a r } ( x )$ in the hinge function, the gradient of $S$ with respect to $x$ becomes close to 0 when $x$ is close to $\bar { x }$ . In this case, the gradient of $v$ also becomes close to 0 and the embeddings collapse. We define the covariance matrix of $Z$ as:
|
| 72 |
+
|
| 73 |
+
$$
|
| 74 |
+
C ( Z ) = \frac { 1 } { n - 1 } \sum _ { i = 1 } ^ { n } ( z _ { i } - \bar { z } ) ( z _ { i } - \bar { z } ) ^ { T } , \mathrm { w h e r e } \bar { z } = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } z _ { i } .
|
| 75 |
+
$$
|
| 76 |
+
|
| 77 |
+
Inspired by Barlow Twins Zbontar et al. (2021), we can then define the covariance regularization term $c$ as the sum of the squared off-diagonal coefficients of $C ( Z )$ , with a factor $1 / d$ that scales the criterion as a function of the dimension:
|
| 78 |
+
|
| 79 |
+
$$
|
| 80 |
+
c ( Z ) = \frac { 1 } { d } \sum _ { i \neq j } [ C ( Z ) ] _ { i , j } ^ { 2 } .
|
| 81 |
+
$$
|
| 82 |
+
|
| 83 |
+
This term encourages the off-diagonal coefficients of $C ( Z )$ to be close to 0, decorrelating the different dimensions of the embeddings and preventing them from encoding similar information. Decorrelation at the embedding level ultimately has a decorrelation effect at the representation level, which is a non trivial phenomenon that we study in Appendix D. We finally define the invariance criterion $s$ between $Z$ and $Z ^ { \prime }$ as the mean-squared euclidean distance between each pair of vectors, without any normalization:
|
| 84 |
+
|
| 85 |
+
$$
|
| 86 |
+
s ( Z , Z ^ { \prime } ) = \frac { 1 } { n } \sum _ { i } \| z _ { i } - z _ { i } ^ { \prime } \| _ { 2 } ^ { 2 } .
|
| 87 |
+
$$
|
| 88 |
+
|
| 89 |
+
The overall loss function is a weighted average of the invariance, variance and covariance terms:
|
| 90 |
+
|
| 91 |
+
$$
|
| 92 |
+
\ell ( Z , Z ^ { \prime } ) = \lambda s ( Z , Z ^ { \prime } ) + \mu [ v ( Z ) + v ( Z ^ { \prime } ) ] + \nu [ c ( Z ) + c ( Z ^ { \prime } ) ] ,
|
| 93 |
+
$$
|
| 94 |
+
|
| 95 |
+
where $\lambda , \mu$ and $\nu$ are hyper-parameters controlling the importance of each term in the loss. In our experiments, we set $\nu = 1$ and perform a grid search on the values of $\lambda$ and $\mu$ with the base condition $\lambda = \mu > 1$ . The overall objective function taken on all images over an unlabelled dataset $\mathcal { D }$ is given by:
|
| 96 |
+
|
| 97 |
+
$$
|
| 98 |
+
\mathcal { L } = \sum _ { I \in \mathcal { D } } \sum _ { t , t ^ { \prime } \sim \mathcal { T } } \ell ( Z ^ { I } , Z ^ { \prime I } ) ,
|
| 99 |
+
$$
|
| 100 |
+
|
| 101 |
+
where $Z ^ { I }$ and $Z ^ { \prime I }$ are the batches of embeddings corresponding to the batch of images $I$ transformed by $t$ and $t ^ { \prime }$ . The objective is minimized for several epochs, over the encoder parameters $\theta$ and expander parameters $\phi$ . We illustrate the architecture and loss function of VICReg in Figure 1.
|
| 102 |
+
|
| 103 |
+
# 4.2 IMPLEMENTATION DETAILS
|
| 104 |
+
|
| 105 |
+
Implementation details for pretraining with VICReg on the 1000-classes ImagetNet dataset without labels are as follows. Coefficients $\lambda$ and $\mu$ are 25 and $\nu$ is 1 in Eq. (6), and $\epsilon$ is 0.0001 in Eq. (1). We give more details on how we choose the coefficients of the loss function in Appendix D.4. The encoder network $f _ { \theta }$ is a standard ResNet-50 backbone He et al. (2016) with 2048 output units. The expander $h _ { \phi }$ is composed of two fully-connected layers with batch normalization (BN) Ioffe & Szegedy (2015) and ReLU, and a third linear layer. The sizes of all 3 layers were set to 8192. As with Barlow Twins, performance improves when the size of the expander layers is larger than the dimension of the representation. The impact of the expander dimension on performance is studied in Appendix D. The training protocol follows those of BYOL and Barlow Twins: LARS optimizer You et al. (2017); Goyal et al. (2017) run for 1000 epochs with a weight decay of $1 0 ^ { - 6 }$ and a learning rate $l r = b a t c h \_ s i z e / 2 5 6 \times b a s e \_ l r$ , where batch_size is set to 2048 by default and base_ $_ { . } l r$ is a base learning rate set to 0.2. The learning rate follows a cosine decay schedule Loshchilov & Hutter (2017), starting from 0 with 10 warmup epochs and with final value of 0.002.
|
| 106 |
+
|
| 107 |
+
# 5 RESULTS
|
| 108 |
+
|
| 109 |
+
In this section, we evaluate the representations obtained after self-supervised pretraining of a ResNet$5 0 \mathrm { H e }$ et al. (2016) backbone with VICReg during 1000 epochs, on the training set of ImageNet, using the training protocol described in section 4. We also pretrain on pairs of image and text data and evaluate on retrieval tasks on the MS-COCO dataset.
|
| 110 |
+
|
| 111 |
+
Table 1: Evaluation on ImageNet. Evaluation of the representations obtained with a ResNet-50 backbone pretrained with VICReg on: (1) linear classification on top of the frozen representations from ImageNet; (2) semi-supervised classification on top of the fine-tuned representations from $1 \%$ and $10 \%$ of ImageNet samples. We report Top-1 and Top-5 accuracies (in $\%$ ). Top-3 best self-supervised methods are underlined.
|
| 112 |
+
|
| 113 |
+
<table><tr><td rowspan="3">Method</td><td colspan="2">Linear</td><td colspan="4">Semi-supervised</td></tr><tr><td rowspan="2">Top-1</td><td rowspan="2">Top-5</td><td colspan="2">Top-1</td><td colspan="2">Top-5</td></tr><tr><td>1%</td><td>10%</td><td>1%</td><td>10%</td></tr><tr><td>Supervised</td><td>76.5</td><td></td><td>25.4</td><td>56.4</td><td>48.4</td><td>80.4</td></tr><tr><td>MoCo He et al. (2020)</td><td>60.6</td><td></td><td>=</td><td>1</td><td>1</td><td>-</td></tr><tr><td>PIRL Misra & Maaten (2020)</td><td>63.6</td><td>=</td><td></td><td>1</td><td>57.2</td><td>83.8</td></tr><tr><td>CPC v2 Hénaff et al. (2019)</td><td>63.8</td><td>=</td><td></td><td>=</td><td>-</td><td>1</td></tr><tr><td>CMC Tian et al. (2019)</td><td>66.2</td><td>=</td><td>=</td><td>=</td><td>=</td><td>=</td></tr><tr><td>SimCLR Chen et al. (2020a)</td><td>69.3</td><td>89.0</td><td>48.3</td><td>65.6</td><td>75.5</td><td>87.8</td></tr><tr><td>MoCo v2 Chen et al. (2020c)</td><td>71.1</td><td>1</td><td>-</td><td>1</td><td>1</td><td></td></tr><tr><td>SimSiam Chen&He (2020)</td><td>71.3</td><td>1</td><td></td><td>=</td><td>=</td><td>=</td></tr><tr><td>SwAV Caron et al. (2020)</td><td>71.8</td><td>-</td><td></td><td></td><td></td><td></td></tr><tr><td>InfoMin Aug Tian et al. (2020)</td><td>73.0</td><td>91.1</td><td></td><td></td><td>=</td><td></td></tr><tr><td>OBoW Gidaris et al. (2021)</td><td>73.8</td><td>1</td><td></td><td>=</td><td>82.9</td><td>90.7</td></tr><tr><td>BYOL Grill et al. (2020)</td><td>74.3</td><td>91.6</td><td>53.2</td><td>68.8</td><td>78.4</td><td>89.0</td></tr><tr><td>SwAV (w/ multi-crop) Caron et al. (2020)</td><td>75.3</td><td>=</td><td>53.9</td><td>70.2</td><td>78.5</td><td>89.9</td></tr><tr><td>Barlow Twins Zbontar et al. (2021)</td><td>73.2</td><td>91.0</td><td>55.0</td><td>69.7</td><td>79.2</td><td>89.3</td></tr><tr><td>VICReg (ours)</td><td>73.2</td><td>91.1</td><td>54.8</td><td>69.5</td><td>79.4</td><td>89.5</td></tr></table>
|
| 114 |
+
|
| 115 |
+
# 5.1 EVALUATION ON IMAGENET
|
| 116 |
+
|
| 117 |
+
Following the ImageNet Deng et al. (2009) linear evaluation protocol, we train a linear classifier on top of the frozen representations of the ResNet-50 backbone pretrained with VICReg. We also evaluate the performance of the backbone when fine-tuned with a linear classifier on a subset of ImageNet’s training set using $1 \%$ or $10 \%$ of the labels, using the split of Chen et al. (2020a). We give implementation details about the optimization procedure for these tasks in Appendix C. We have applied the training procedure described in section 4 with three different random initialization. The numbers reported in Table 1 for VICReg are the mean scores, and we have observed that the difference between worse and best run is lower than $0 . 1 \%$ accuracy for linear classification, which shows that VICReg is a very stable algorithm. Lack of time has prevented us from doing the same for the semi-supervised classification experiments, and the experiments of section 5.2 and 6, but we expect similar conclusion to hold. We compare in Table 1 our results on both tasks against other methods on the validation set of ImageNet. The performance of VICReg is on par with the state of the art without using the negative pairs of SimCLR, the clusters of SwAV, the bag-of-words representations of OBoW, or any asymmetric networks architectural tricks such as the momentum encoder of BYOL and the stop-gradient operation of SimSiam. The performance is comparable to that of Barlow Twins, which shows that VICReg’s more explicit way of constraining the variance and comparing views has the same power than maximizing cross-correlations between pairs of twin dimensions. The main advantage of VICReg is the modularity of its objective function and the applicability to multi-modal setups.
|
| 118 |
+
|
| 119 |
+
# 5.2 TRANSFER TO OTHER DOWNSTREAM TASKS
|
| 120 |
+
|
| 121 |
+
Following the setup from Misra & Maaten (2020), we train a linear classifier on top of the frozen representations learnt by our pretrained ResNet-50 backbone on a variety of different datasets: the Places205 Zhou et al. (2014) scene classification dataset, the VOC07 Everingham et al. (2010) multi-label image classification dataset and the iNaturalist2018 Horn et al. (2018) fine-grained image classification dataset. We then evaluate the quality of the representations by transferring to other vision tasks including $\mathrm { \ V O C { 0 7 + 1 2 } }$ Everingham et al. (2010) object detection using Faster R-CNN Ren et al. (2015) with a R50-C4 backbone, and COCO Lin et al. (2014) instance segmentation using Mask-R-CNN He et al. (2017) with a R50-FPN backbone. We report the performance in Table 2,
|
| 122 |
+
|
| 123 |
+
Table 2: Transfer learning on downstream tasks. Evaluation of the representations from a ResNet50 backbone pretrained with VICReg on: (1) linear classification tasks on top of frozen representations, we report Top-1 accuracy (in $\%$ ) for Places205 Zhou et al. (2014) and iNat18 Horn et al. (2018), and mAP for VOC07 Everingham et al. (2010); (2) object detection with fine-tunning, we report $\mathrm { { A P } _ { 5 0 } }$ for $\mathrm { \ V O C { 0 7 + 1 2 } }$ using Faster R-CNN with C4 backbone Ren et al. (2015); (3) object detection and instance segmentation, we report AP for COCO Lin et al. (2014) using Mask R-CNN with FPN backbone He et al. (2017). We use $\dagger$ to denote the experiments run by us. Top-3 best self-supervised methods are underlined.
|
| 124 |
+
|
| 125 |
+
<table><tr><td></td><td colspan="3">Linear Classification</td><td colspan="3">Object Detection</td></tr><tr><td>Method</td><td>Places205</td><td>VOC07 iNat18</td><td></td><td>VOC07+12(</td><td> COCO det COCO seg</td><td></td></tr><tr><td>Supervised</td><td>53.2</td><td>87.5</td><td>46.7</td><td>81.3</td><td>39.0</td><td>35.4</td></tr><tr><td>MoCo He et al. (2020)</td><td>46.9</td><td>79.8</td><td>31.5</td><td>=</td><td></td><td></td></tr><tr><td>PIRL Misra & Maaten (2020)</td><td>49.8</td><td>81.1</td><td>34.1</td><td>=</td><td>1</td><td>=</td></tr><tr><td>SimCLR Chen et al. (2020a)</td><td>52.5</td><td>85.5</td><td>37.2</td><td>1</td><td>-</td><td>1</td></tr><tr><td>MoCo v2 Chen et al. (2020c)</td><td>51.8</td><td>86.4</td><td>38.6</td><td>82.5</td><td>39.8</td><td>36.1</td></tr><tr><td>SimSiam Chen & He (2020)</td><td>1</td><td>1</td><td>1</td><td>82.4</td><td>-</td><td>-</td></tr><tr><td>BYOL Grill et al. (2020)</td><td>54.0</td><td>86.6</td><td>47.6</td><td>=</td><td>40.4†</td><td>37.0t</td></tr><tr><td>SwAV (m-c) Caron et al. (2020)</td><td>56.7</td><td>88.9</td><td>48.6</td><td>82.6</td><td>41.6</td><td>37.8</td></tr><tr><td>OBoW Gidaris et al. (2021)</td><td>56.8</td><td>89.3</td><td>1</td><td>82.9</td><td>1</td><td>=</td></tr><tr><td>Barlow Twins Grill et al. (2020)</td><td>54.1</td><td>86.2</td><td>46.5</td><td>82.6</td><td>40.0t</td><td>36.7†</td></tr><tr><td>VICReg (ours)</td><td>54.3</td><td>86.6</td><td>47.0</td><td>82.4</td><td>39.4</td><td>36.4</td></tr></table>
|
| 126 |
+
|
| 127 |
+
Table 3: Evaluation on MS-COCO 5K retrieval tasks. Comparison of VICReg with the contrastive loss of ${ \mathrm { V S E } } { + } { + }$ Faghri et al. (2018), and with Barlow Twins, pretrain on the training set of MS-COCO. In all settings, the encoder for text is a word embedding followed by a GRU layer, the encoder for images is a ResNet-152.
|
| 128 |
+
|
| 129 |
+
<table><tr><td>Method</td><td colspan="3">Image-to-text</td><td colspan="3">Text-to-Image</td></tr><tr><td></td><td>R@1</td><td>R@5</td><td>R@10</td><td>R@1</td><td>R@5</td><td>R@10</td></tr><tr><td>Contrastive (VSE++)</td><td>30.3</td><td>59.4</td><td>72.4</td><td>41.3</td><td>71.1</td><td>81.2</td></tr><tr><td>Barlow Twins</td><td>31.4</td><td>60,4</td><td>75.1</td><td>42.9</td><td>74.0</td><td>83.5</td></tr><tr><td>VICReg</td><td>33.6</td><td>62.7</td><td>77.9</td><td>45.2</td><td>76.1</td><td>84.2</td></tr></table>
|
| 130 |
+
|
| 131 |
+
VICReg performs on par with most concurrent methods, and better than Barlow Twins, across all classification tasks, but is slightly behind the top-3 on detection tasks.
|
| 132 |
+
|
| 133 |
+
# 5.3 MULTI-MODAL PRETRAINING ON MS-COCO
|
| 134 |
+
|
| 135 |
+
One fundamental difference of VICReg compared to Barlow Twins is the way the branches are regularized. In VICReg, both branches are regularized independently, as the covariance term is applied on each branch separately, which works better in the scenarios where the branches are completely different, have different types of architecture and process different types of data. Indeed, the statistics of the output of the two branches can be very different, and the amount of regularization required for each may vary a lot. In Barlow Twins, the regularization is applied on the cross-correlation matrix, which favors the scenarios where the branches produce outputs with similar statistics. We demonstrate the capabilities of VICReg in a multi-modal experiment where we pretrain on pairs of images and corresponding captions on the MS-COCO dataset. We regularize each branch with a different coefficient, which is not possible with Barlow Twins, and we show that VICReg outperforms Barlow Twins on image and text retrieval downstream tasks. Table 3 reports the performance of VICReg against the contrastive loss proposed by ${ \mathrm { V S E } } { + } { + }$ Faghri et al. (2018), and against Barlow Twins, in the identical setting proposed in Faghri et al. (2018). VICReg outperforms the two by a significant margin.
|
| 136 |
+
|
| 137 |
+
Table 4: Effect of incorporating variance and covariance regularization in different methods. Top-1 ImageNet accuracy with the linear evaluation protocol after 100 pretraining epochs. For all methods, pretraining follows the architecture, the optimization and the data augmentation protocol of the original method using our reimplementation. ME: Momentum Encoder. SG: stop-gradient. PR: predictor. BN: Batch normalization layers after input and inner linear layers in the expander. No Reg: No additional regularization. Var Reg: Variance regularization. Var/Cov Reg: Variance and Covariance regularization. Unmodified original setups are marked by a $\dagger$ .
|
| 138 |
+
|
| 139 |
+
<table><tr><td>Method</td><td>ME</td><td>SG</td><td>PR</td><td>BN</td><td>No Reg</td><td>Var Reg</td><td>Var/Cov Reg</td></tr><tr><td>BYOL</td><td>√</td><td>√</td><td>√</td><td>√</td><td>69.3†</td><td>70.2</td><td>69.5</td></tr><tr><td>SimSiam</td><td></td><td></td><td></td><td>√</td><td>67.9†</td><td>68.1</td><td>67.6</td></tr><tr><td>SimSiam</td><td></td><td></td><td>1</td><td></td><td>35.1</td><td>67.3</td><td>67.1</td></tr><tr><td>SimSiam</td><td></td><td><<></td><td></td><td></td><td>collapse</td><td>56.8</td><td>66.1</td></tr><tr><td>VICReg</td><td></td><td></td><td></td><td></td><td>collapse</td><td>56.2</td><td>67.3</td></tr><tr><td>VICReg</td><td></td><td></td><td>?</td><td></td><td>collapse</td><td>57.1</td><td>68.7</td></tr><tr><td>VICReg</td><td></td><td></td><td></td><td>V</td><td>collapse</td><td>57.5</td><td>68.6†</td></tr><tr><td>VICReg</td><td></td><td></td><td></td><td></td><td>collapse</td><td>56.5</td><td>67.4</td></tr></table>
|
| 140 |
+
|
| 141 |
+
# 6 ANALYSIS
|
| 142 |
+
|
| 143 |
+
In this section we study how the different components of our method contribute to its performance, as well as how they interact with components from other self-supervised methods. We also evaluate different scenarios where the branches have different weights and architecture. All reported results are obtained on the linear evaluation protocol, using a ResNet-50 backbone if not mentioned otherwise, and 100 epochs of pretraining, which gives results consistent with those obtained with 1000 epochs of pretraining. The optimization setting used for each experiment is described in Appendix C.
|
| 144 |
+
|
| 145 |
+
Asymmetric networks. We study the impact of different components used in asymmetric architectures and the effects of adding variance and covariance regularization, in terms of performance and training stability. Starting from a simple symmetric architecture with an encoder and an expander without batch normalization, which correspond to VICReg without batch normalization in the expander, we progressively add batch normalization in the inner layers of the expander, a predictor, a stop-gradient operation and a momentum encoder. We use the training protocol and architecture of SimSiam Chen & He (2020) when a stop-gradient is used and the training protocol and architecture of BYOL Grill et al. (2020) when a momentum encoder is used. The predictor as used in SimSiam and BYOL is a learnable module $g _ { \psi }$ that predicts the embedding of a view given the embedding of the other view of the same image. If $z$ and $z ^ { \prime }$ are the embeddings of two views of an image, then $p = g _ { \psi } ( z )$ and $p ^ { \prime } = g _ { \psi } ( z ^ { \prime } )$ are the predictions of each view. The invariance loss function of Eq. (5) is now computed between a batch of embeddings $Z = [ z _ { 1 } , \ldots , z _ { n } ]$ and the corresponding batch of predictions $P = [ p _ { 1 } ^ { \prime } , \ldots , p _ { n } ^ { \prime } ]$ , then symmetrized:
|
| 146 |
+
|
| 147 |
+
$$
|
| 148 |
+
s ( Z , Z ^ { \prime } , P , P ^ { \prime } ) = \frac { 1 } { 2 n } \sum _ { i } D ( z _ { i } - p _ { i } ^ { \prime } ) + \frac { 1 } { 2 n } \sum _ { i } D ( z _ { i } ^ { \prime } - p _ { i } ) ,
|
| 149 |
+
$$
|
| 150 |
+
|
| 151 |
+
where $D$ is a distance function that depends on the method used. BYOL uses the mean square error between $l _ { 2 }$ -normalized vectors, SimSiam uses the negative cosine similarity loss and VICReg uses the mean square error without $l _ { 2 }$ -normalization. The variance and covariance terms are regularizing the output $Z$ and $Z ^ { \prime }$ of the expander, which we empirically found to work better than regularizing the output of the predictor. We compare different settings in Table 4, based on the default data augmentation, optimization and architecture settings of the original BYOL, SimSiam and VICReg methods. In all settings, the absence of BN indicates that BN is also removed in the predictor when one is used.
|
| 152 |
+
|
| 153 |
+
We analyse first the impact of variance regularization (VR) in the different settings. When using VR, adding a predictor (PR) to VICReg does not lead to a significant change of the performance, which indicates that PR is redundant with VR. In comparison, without VR, the representations collapse, and both stop-gradient (SG) and PR are necessary. Batch normalization in the inner layers of the expander (BN) in VICReg leads to a $1 . 0 \%$ increase in the performance, which is not a big improvement considering that SG and PR without BN is performing very poorly at $3 5 . 1 \%$ .
|
| 154 |
+
|
| 155 |
+
Table 5: Impact of sharing weights or not between branches. Top-1 accuracy on linear classification with 100 pretraining epochs. The encoder and expander of both branches can share the same architecture and share their weights (SW), share the same architecture with different weights (DW), or have different architectures (DA). The encoders can be ResNet-50, ResNet-101 or ViT-S.
|
| 156 |
+
|
| 157 |
+
<table><tr><td></td><td>SW R50</td><td>DW R50</td><td>DA R50/R101</td><td>DA R50/ViT-S</td></tr><tr><td>BYOL</td><td>69.3</td><td>X</td><td>X</td><td>X</td></tr><tr><td>SimCLR</td><td>64.4</td><td>63.1</td><td>63.9</td><td>63.5</td></tr><tr><td>Barlow Twins</td><td>68.7</td><td>64.2</td><td>65.3</td><td>63.9</td></tr><tr><td>VICReg</td><td>68.6</td><td>66.5</td><td>68.1</td><td>66.2</td></tr></table>
|
| 158 |
+
|
| 159 |
+
Finally, incorporating VR with SG or ME further improves the performance by small margins of respectively $0 . 2 \%$ and $0 . 9 \%$ , which might be explained by the fact that these architectural tricks that prevent collapse are not perfectly maintaining the variance of the representations, i.e. very slow collapse is happening with these methods. We explain this intuition by studying the evolution of the standard deviation of the representations during pretraining for BYOL and SimSiam in Appendix D. We then analyse the impact of adding additional covariance regularization (CR) in the different settings, along with variance regularization. We found that optimization with SG and CR is hard, even if our analysis of the average correlation coefficient of the representations during pretraining in Appendix D shows that both fulfill the same objective.
|
| 160 |
+
|
| 161 |
+
The performance of BYOL and SimSiam slightly drops compared to VR only, except when PR is removed, where SG becomes useless. BN is still useful and improves the performance by $1 . 3 \%$ . Finally with CR, PR does not harm the performance and even improves it by a very small margin. VICReg+PR with 1000 epochs of pretraining exactly matches the score of VICReg $7 3 . 2 \%$ on linear classification).
|
| 162 |
+
|
| 163 |
+
Weight sharing. Contrary to most self-supervised learning approaches based on Siamese architectures, VICReg has several unique properties: (1) weights do not need to be shared between the branches, each branch’s weights are updated independently of the other branch’s weights; (2) the branches are regularized independently, the variance and covariance terms are computed on each branch individually; (3) no predictor is necessary unlike with methods where one branch predicts outputs of the other branch. We compare the robustness of VICReg against other methods in different scenarios where the weights of the branches can be shared (SW), not shared (DW), and where the encoders can have different architectures (DA). Among other self-supervised methods, SimCLR and Barlow Twins are the only ones that can handle these scenarios. The asymmetric methods that are based on a discrepancy between the branches requires either the architecture or the weights to be shared between the branches. The performance drops by $2 . 1 \%$ with VICReg and $4 . 5 \%$ with Barlow Twins, between the shared weights scenario (SW) and the different weight scenario (DW). The difference between VICReg and Barlow Twins is also significant in scenarios with different architectures, in particular VICReg performs better than Barlow Twins by $2 . 8 \%$ with ResNet-50/ResNet-101 and better by $2 . 3 \%$ with ResNet-50/ViT-S Dosovitskiy et al. (2021). This shows that VICReg is more robust than Barlow Twins in these kind of scenarios. The performance of SimCLR remains stable across scenarios, but is significantly worse than the performance of VICReg. Importantly, the ability of VICReg to function with different parameters, architectures, and input modalities for the branches widens the applicability to joint-embedding SSL to many applications, including multi-modal signals.
|
| 164 |
+
|
| 165 |
+
# 7 CONCLUSION
|
| 166 |
+
|
| 167 |
+
We introduced VICReg, a simple approach to self-supervised learning based on a triple objective: learning invariance to different views with a invariance term, avoiding collapse of the representations with a variance preservation term, and maximizing the information content of the representation with a covariance regularization term. VICReg achieves results on par with the state of the art on many downstream tasks, but is not subject to the same limitations as most other methods, particularly because it does not require the embedding branches to be identical or even similar.
|
| 168 |
+
|
| 169 |
+
Acknowledgement. Jean Ponce was supported in part by the French government under management of Agence Nationale de la Recherche as part of the ”Investissements d’avenir” program, reference ANR-19-P3IA-0001 (PRAIRIE 3IA Institute), the Louis Vuitton/ENS Chair in Artificial Intelligence and the Inria/NYU collaboration. Adrien Bardes was supported in part by a FAIR/Prairie CIFRE PhD Fellowship. The authors wish to thank Jure Zbontar for the BYOL implementation, Stéphane Deny for useful comments on the paper, and Li Jing, Yubei Chen, Mikael Henaff, Pascal Vincent and Geoffrey Zweig for useful discussions. We thank Quentin Duval and the VISSL team for help obtaining the results of table 2.
|
| 170 |
+
|
| 171 |
+
# REFERENCES
|
| 172 |
+
|
| 173 |
+
Yuki Markus Asano, Christian Rupprecht, and Andrea Vedaldi. Self-labelling via simultaneous clustering and representation learning. In ICLR, 2020. 3
|
| 174 |
+
|
| 175 |
+
Philip Bachman, R Devon Hjelm, and William Buchwalter. Learning representations by maximizing mutual information across views. In NeurIPS, 2019. 1
|
| 176 |
+
|
| 177 |
+
Miguel A. Bautista, Artsiom Sanakoyeu, Ekaterina Sutter, and Björn Ommer. Cliquecnn: Deep unsupervised exemplar learning. In NeurIPS, 2016. 3
|
| 178 |
+
|
| 179 |
+
Jane Bromley, Isabelle Guyon, Yann LeCun, Eduard Sackinger, and Roopak Shah. Signature verification using a “siamese” time delay neural network. In NeurIPS, 1994. 1, 3
|
| 180 |
+
|
| 181 |
+
Mathilde Caron, Piotr Bojanowski, Armand Joulin, and Matthijs Douze. Deep clustering for unsupervised learning. In ECCV, 2018. 1, 3
|
| 182 |
+
|
| 183 |
+
Mathilde Caron, Piotr Bojanowski, Julien Mairal, and Armand Joulin. Unsupervised pre-training of image features on non-curated data. In ICCV, 2019. 3
|
| 184 |
+
|
| 185 |
+
Mathilde Caron, Ishan Misra, Julien Mairal, Priya Goyal, Piotr Bojanowski, and Armand Joulin. Unsupervised learning of visual features by contrasting cluster assignments. In NeurIPS, 2020. 1, 3, 4, 6, 7, 14, 16, 17, 18, 20
|
| 186 |
+
|
| 187 |
+
Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey E. Hinton. A simple framework for contrastive learning of visual representations. In ICML, 2020a. 1, 3, 4, 6, 7, 14, 16, 17, 20, 21
|
| 188 |
+
|
| 189 |
+
Ting Chen, Simon Kornblith, Kevin Swersky, Mohammad Norouzi, and Geoffrey Hinton. Big self-supervised models are strong semi-supervised learners. In NeurIPS, 2020b. 3
|
| 190 |
+
|
| 191 |
+
Xinlei Chen and Kaiming He. Exploring simple siamese representation learning. In CVPR, 2020. 1, 3, 4, 6, 7, 8, 14, 16, 17, 21
|
| 192 |
+
|
| 193 |
+
Xinlei Chen, Haoqi Fan, Ross Girshick, and Kaiming He. Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297, 2020c. 3, 6, 7
|
| 194 |
+
|
| 195 |
+
Sumit Chopra, Raia Hadsell, and Yann LeCun. Learning a similarity metric discriminatively, with application to face verification. In CVPR, 2005. 1
|
| 196 |
+
|
| 197 |
+
Marco Cuturi. Sinkhorn distances: Lightspeed computation of optimal transport. In NeurIPS, 2013. 3
|
| 198 |
+
|
| 199 |
+
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, 2009. 3, 6
|
| 200 |
+
|
| 201 |
+
Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021. 9
|
| 202 |
+
|
| 203 |
+
Aleksandr Ermolov, Aliaksandr Siarohin, Enver Sangineto, and Nicu Sebe. Whitening for selfsupervised representation learning, 2021. 2, 3, 4, 14
|
| 204 |
+
|
| 205 |
+
Mark Everingham, Luc Van Gool, John Winn Christopher K. I. Williams, and Andrew Zisserman. The pascal visual object classes (voc) challenge. IJCV, 2010. 6, 7, 16
|
| 206 |
+
|
| 207 |
+
Fartash Faghri, David J. Fleet, Jamie Ryan Kiros, and Sanja Fidler. ${ \mathrm { V s e } } + +$ : Improving visual-semantic embeddings with hard negatives. In BMVC, 2018. 7
|
| 208 |
+
|
| 209 |
+
Rong-En Fan, Kai-Wei Chang, Cho-Jui Hsieh, Xiang-Rui Wang, and Chih-Jen Lin. Liblinear: A library for large linear classification. JMLR, 2008. 16
|
| 210 |
+
|
| 211 |
+
Spyros Gidaris, Andrei Bursuc, Nikos Komodakis, Patrick Pérez, and Matthieu Cord. Learning representations by predicting bags of visual words. In CVPR, 2020. 3
|
| 212 |
+
|
| 213 |
+
Spyros Gidaris, Andrei Bursuc, Gilles Puy, Nikos Komodakis, Matthieu Cord, and Patrick Pérez. Online bag-of-visual-words generation for unsupervised representation learning. In CVPR, 2021. 1, 3, 6, 7, 14
|
| 214 |
+
|
| 215 |
+
Priya Goyal, Piotr Dollár, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, Andrew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch sgd: Training imagenet in 1 hour. arXiv preprint arXiv:1706.02677, 2017. 5
|
| 216 |
+
|
| 217 |
+
Priya Goyal, Quentin Duval, Jeremy Reizenstein, Matthew Leavitt, Min Xu, Benjamin Lefaudeux, Mannat Singh, Vinicius Reis, Mathilde Caron, Piotr Bojanowski, Armand Joulin, and Ishan Misra. Vissl. https://github.com/facebookresearch/vissl, 2021. 16
|
| 218 |
+
|
| 219 |
+
Jean-Bastien Grill, Florian Strub, Florent Altché, Corentin Tallec, Pierre H. Richemond, Elena Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Daniel Guo, Mohammad Gheshlaghi Azar, Bilal Piot, Koray Kavukcuoglu, Rémi Munos, and Michal Valko. Bootstrap your own latent: A new approach to self-supervised learning. In NeurIPS, 2020. 1, 3, 4, 6, 7, 8, 14, 16, 17, 20, 21
|
| 220 |
+
|
| 221 |
+
Raia Hadsell, Sumit Chopra, and Yann LeCun. Dimensionality reduction by learning an invariant mapping. In CVPR, 2006. 3
|
| 222 |
+
|
| 223 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016. 5
|
| 224 |
+
|
| 225 |
+
Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask r-cnn. In ICCV, 2017. 6, 7
|
| 226 |
+
|
| 227 |
+
Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. In CVPR, 2020. 1, 3, 6, 7, 16
|
| 228 |
+
|
| 229 |
+
Geoffrey Hinton, Oriol Vinyals, and Jeffrey Dean. Distilling the knowledge in a neural network. In NIPS Deep Learning and Representation Learning Workshop, 2015. 3
|
| 230 |
+
|
| 231 |
+
R Devon Hjelm, Alex Fedorov, Samuel Lavoie-Marchildon, Karan Grewal, Adam Trischler, and Yoshua Bengio. Learning deep representations by mutual information estimation and maximization. In ICLR, 2019. 1, 3
|
| 232 |
+
|
| 233 |
+
Grant Van Horn, Oisin Mac Aodha, Yang Song, Yin Cui, Chen Sun, Alex Shepard, Hartwig Adam, Pietro Perona, and Serge Belongie. The inaturalist species classification and detection dataset. In CVPR, 2018. 6, 7, 16
|
| 234 |
+
|
| 235 |
+
Jiabo Huang, Qi Dong andShaogang Gong, and Xiatian Zhu. Unsupervised deep learning by neighbourhood discovery. In ICML, 2019. 3
|
| 236 |
+
|
| 237 |
+
Olivier J. Hénaff, Aravind Srinivas, Jeffrey De Fauw, Ali Razavi, Carl Doersch, S. M. Ali Eslami, and Aäron van den Oord. Data-efficient image recognition with contrastive predictive coding. In ICML, 2019. 6
|
| 238 |
+
|
| 239 |
+
Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015. 5
|
| 240 |
+
|
| 241 |
+
Junnan Li, Pan Zhou, Caiming Xiong, and Steven C.H. Hoi. Prototypical contrastive learning of unsupervised representations. In ICLR, 2021. 20
|
| 242 |
+
|
| 243 |
+
Tsung-Yi Lin, Michael Maire, Serge Belongie, Lubomir Bourdev, Ross Girshick, James Hays, Pietro Perona, Deva Ramanan, C. Lawrence Zitnick, and Piotr Dollár. Microsoft coco: Common objects in context. In ECCV, 2014. 6, 7
|
| 244 |
+
|
| 245 |
+
Ilya Loshchilov and Frank Hutter. Sgdr: stochastic gradient descent with warm restarts. In ICLR, 2017. 5
|
| 246 |
+
|
| 247 |
+
Ishan Misra and Laurens van der Maaten. Self-supervised learning of pretext-invariant representations. In CVPR, 2020. 1, 3, 6, 7, 16
|
| 248 |
+
|
| 249 |
+
Karol J. Piczak. ESC: Dataset for Environmental Sound Classification. In Proceedings of the 23rd Annual ACM Conference on Multimedia, 2015. 18
|
| 250 |
+
|
| 251 |
+
Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. In NeurIPS, 2015. 6, 7
|
| 252 |
+
|
| 253 |
+
Pierre H. Richemond, Jean-Bastien Grill, Florent Altché, Corentin Tallec, Florian Strub, Andrew Brock, Samuel Smith, Soham De, Razvan Pascanu, Bilal Piot, and Michal Valko. Byol works even without batch statistics. arXiv preprint arXiv:2010.10241, 2020. 1, 3
|
| 254 |
+
|
| 255 |
+
Yonglong Tian, Dilip Krishnan, , and Phillip Isola. Contrastive multiview coding. arXiv preprint arXiv:1906.05849v4, 2019. 6
|
| 256 |
+
|
| 257 |
+
Yonglong Tian, Chen Sun, Ben Poole, Dilip Krishnan, Cordelia Schmid, and Phillip Isola. What makes for good views for contrastive learning. In NeurIPS, 2020. 1, 6
|
| 258 |
+
|
| 259 |
+
Yuandong Tian, Xinlei Chen, and Surya Ganguli. Understanding self-supervised learning dynamics without contrastive pairs. arXiv preprint arXiv:2102.06810, 2021. 1
|
| 260 |
+
|
| 261 |
+
Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018. 3
|
| 262 |
+
|
| 263 |
+
Yuxin Wu, Alexander Kirillov, Francisco Massa, Wan-Yen Lo, and Ross Girshick. Detectron2. https://github.com/facebookresearch/detectron2, 2019. 16
|
| 264 |
+
|
| 265 |
+
Zhirong Wu, Yuanjun Xiong, Stella Yu, , and Dahua Lin. Unsupervised feature learning via nonparametric instance discrimination. In CVPR, 2018. 3, 18, 20
|
| 266 |
+
|
| 267 |
+
Junyuan Xie, Ross Girshick, and Ali Farhadi. Unsupervised deep embedding for clustering analysis. In ICML, 2016. 3
|
| 268 |
+
|
| 269 |
+
Saining Xie, Ross Girshick, Piotr Dollár, Zhuowen Tu, and Kaiming He. Aggregated residual transformations for deep neural networks. In CVPR, 2017. 17
|
| 270 |
+
|
| 271 |
+
Xueting Yan, Ishan Misra, Abhinav Gupta, Deepti Ghadiyaram, and Dhruv Mahajan. Clusterfit: Improving generalization of visual representations. In CVPR, 2020. 3
|
| 272 |
+
|
| 273 |
+
Jianwei Yang, Devi Parikh, and Dhruv Batra. Joint unsupervised learning of deep representations and image clusters. In CVPR, 2016. 3
|
| 274 |
+
|
| 275 |
+
Mang Ye, Xu Zhang, Pong C Yuen, and Shih-Fu Chang. Unsupervised embedding learning via invariant and spreading instance feature. In CVPR, 2019. 3
|
| 276 |
+
|
| 277 |
+
Yang You, Igor Gitman, and Boris Ginsburg. Large batch training of convolutional networks. arXiv preprint arXiv:1708.03888, 2017. 5, 17
|
| 278 |
+
|
| 279 |
+
Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016. 17
|
| 280 |
+
|
| 281 |
+
Jure Zbontar, Li Jing, Ishan Misra, Yann LeCun, and Stéphane Deny. Barlow twins: Self-supervised learning via redundancy reduction. arXiv preprint arxiv:2103.03230, 2021. 1, 2, 3, 4, 5, 6, 14, 16, 20, 21
|
| 282 |
+
|
| 283 |
+
Bolei Zhou, Agata Lapedriza, Jianxiong Xiao, Antonio Torralba, and Aude Oliva. Learning deep features for scene recognition using places database. In NeurIPS, 2014. 6, 7, 16
|
| 284 |
+
|
| 285 |
+
Chengxu Zhuang, Alex Lin Zhai, and Daniel Yamins. Local aggregation for unsupervised learning of visual embeddings. In ICCV, 2019. 3, 18, 20
|
| 286 |
+
|
| 287 |
+
Algorithm 1: VICReg pytorch pseudocode.
|
| 288 |
+
|
| 289 |
+
# f: encoder network, lambda, mu, nu: coefficients of the invariance, variance and covariance losses, N: batch size , D: dimension of the representations
|
| 290 |
+
# mse_loss: Mean square error loss function, off_diagonal: off-diagonal elements of a matrix, relu: ReLU activation function
|
| 291 |
+
|
| 292 |
+
for x in loader: # load a batch with N samples # two randomly augmented versions of x x_a, x_b $=$ augment(x)
|
| 293 |
+
|
| 294 |
+
# compute representations z_a = f(x_a) # N x D $\mathrm { ~ z ~ } \mathrm { ~ b ~ } = \mathrm { ~ f ~ } ( \mathrm { ~ x ~ } \mathrm { ~ b ~ } )$ # N x D
|
| 295 |
+
|
| 296 |
+
# invariance loss sim_loss $=$ mse_loss(z_a, z_b)
|
| 297 |
+
|
| 298 |
+
# # variance loss
|
| 299 |
+
|
| 300 |
+
std_z_a $=$ torch.sqrt(z_a.var(dim ${ \left. \sum \right. }$ ) $^ +$ 1e-04) std_z_b $=$ torch.sqrt(z_b.var(dim ${ \left. \sum \right. }$ ) $^ +$ 1e-04) std_loss $=$ torch.mean(relu(1 - std_z_a)) $^ +$ torch.mean( relu(1 - std_z_b))
|
| 301 |
+
|
| 302 |
+
# # covariance loss
|
| 303 |
+
|
| 304 |
+
z_a = z_a - z_a.mean(dim ${ } = 0$ )
|
| 305 |
+
$z \_ { \mathrm { ~ b ~ } } = \ \mathrm { ~ z \_ ~ } \mathrm { ~ k ~ }$ b - z_b.mean(dim ${ } = 0$ )
|
| 306 |
+
cov_z_a $=$ (z_a.T @ z_a) / (N - 1)
|
| 307 |
+
cov_z_b $=$ (z_b.T @ z_b) / (N - 1)
|
| 308 |
+
cov_loss $=$ off_diagonal(cov_z_a).pow_(2).sum() / D $^ +$ off_diagonal(cov_z_b).pow_(2).sum() / D
|
| 309 |
+
|
| 310 |
+
# # loss
|
| 311 |
+
|
| 312 |
+
loss $=$ lambda $\star$ sim_loss $^ +$ mu $\star$ std_loss $^ +$ nu $\star$ cov_loss
|
| 313 |
+
|
| 314 |
+
# optimization step loss.backward() optimizer.step()
|
| 315 |
+
|
| 316 |
+
# B RELATION TO OTHER SELF-SUPERVISED METHODS
|
| 317 |
+
|
| 318 |
+
We compare here VICReg with other methods in terms of methodology, and we discuss the mechanisms used by these methods to avoid collapse and to learn representations, and how they relate to VICReg. We synthesize and illustrate the differences between these methods in Figure 2.
|
| 319 |
+
|
| 320 |
+
Relation to Barlow Twins Zbontar et al. (2021). VICReg uses the same decorrelation mechanism as Barlow Twins, which consists in penalizing the off-diagonal terms of a covariance matrix computed on the embeddings. However, Barlow Twins uses the cross-correlation matrix where each entry in the matrix is a cross-correlation between two vectors $z ^ { i }$ and $z ^ { \prime } { \mathcal { I } }$ , from the two branches of the siamese architecture. Instead of using cross-correlations, we simply use the covariance matrix of each branch individually, and the variance term of VICReg allows us to get rid of standardization. Indeed, Barlow Twins forces the correlations between pairs of vectors $z ^ { i }$ and $z ^ { \prime i }$ from the same dimension $i$ to be 1. Without normalization, this target value of 1 becomes arbitrary and the vectors take values in a wider range. Moreover, there is an undesirable phenomenon happening in Barlow Twins, the embeddings before standardization can shrink and become constant to numerical precision, which could cause numerical instabilities. In practice, this is solved by adding a constant scalar in the denominator of standardization of the embeddings. Without normalization, VICReg naturally avoids this edge case.
|
| 321 |
+
|
| 322 |
+
Relation to W-MSE Ermolov et al. (2021). The whitening operation of W-MSE consists in computing the inverse covariance matrix of the embeddings and use its square root as a whitening operator on the embeddings. Using this operator has two downsides. First, matrix inversion is a very costly and potentially unstable operation. VICReg does not need to inverse the covariance matrix. Second, as mentioned in Ermolov et al. (2021) the whitening operator is constructed over several consecutive iteration batches and therefore might have a high variance, which biases the estimation of the meansquared error. This issue is overcome in practice by a batch slicing strategy, where the whitening operator is computed over randomly constructed sub-batches. VICReg does not apply any operator on the embeddings, but instead regularizes the variance and covariance of the embeddings using an additional constraint.
|
| 323 |
+
|
| 324 |
+
Relation to BYOL and SimSiam Grill et al. (2020); Chen & He (2020). The core components that avoid collapse in BYOL and SimSiam are the average moving weights and the stop-gradient operation on one side of their asymmetric architecture, which play the role of the repulsive term used in other methods. Our experiments in Appendix D.8 show that in addition to preventing collapse, these components also have a decorrelation effect. In addition, we have conducted the following experiment: We compute the correlation matrix of the final representations obtained with SimSiam, BYOL, VICReg and VICReg without covariance regularization. We measure the average correlation coefficient and observe that this coefficient is much smaller for SimSiam, BYOL and VICReg, compared to VICReg without covariance regularization. We observe in Figure 5 that even without covariance regularization, SimSiam and BYOL naturally minimize the average correlation coefficient of the representations. VICReg replaces the moving average weights and the stop-gradient operation, which are architectural trick that require some dependency between the branches, by an explicit constraint on the variance and the covariance of both embeddings separately, which achieves the same goal of decorrelating the representations and avoiding collapse, while being clearer, more interpretable, and working with independent branches.
|
| 325 |
+
|
| 326 |
+
Relation to SimCLR, SwAV and OBoW Caron et al. (2020); Chen et al. (2020a); Gidaris et al. (2021). Contrastive and clustering based self-supervised algorithms rely on direct comparisons between elements of negative pairs. In the case of SimCLR, the negative pairs involve embeddings mined from the current batch, and large batch sizes are required. Despite the fact that SwAV computes clusters using elements in the current batch, it does not seem to have the same dependency on batch size. However, it still requires a lot of prototype vectors for negative comparisons between embeddings and codes. VICReg eliminates the negative comparisons and replace them by an explicit constraint on the variance of the embeddings, which efficiently plays the role of a negative term between the vectors. SwAV can also be interpreted as a distillation method, where a teacher network produces quantized vectors, used as target for a student network. Ensuring an equal partition of the quantized vectors in different bins or clusters effectively prevents collapse. OBOW can also be interpreted under the same framework. The embeddings are bag-of-words over a vocabulary of visual features, and collapse is avoided by the underlying quantization operation.
|
| 327 |
+
|
| 328 |
+

|
| 329 |
+
Figure 2: Conceptual comparison between different self-supervised methods. The inputs $X$ and $X ^ { \prime }$ are fed to an encoder $f$ with weights $\theta$ . The representations $Y$ and $Y ^ { \prime }$ are further processed by a network $h$ with weights $\psi$ . $h$ can be a projector (narrowing trapeze) that reduces the dimensionality of the representations, or an expander (widening trapeze) that increases their dimensionality. A criterion is finally applied on the embeddings $Z$ and $Z ^ { \prime }$ . VICReg (a) works when both branches have encoders $f$ and $f ^ { \prime }$ with different architectures and sets of weights $\theta$ and $\theta ^ { \prime }$ . Each branch’s variance and covariance are regularized by regularizers $v$ and $c$ , and the distance between both branches is minimized with a mean-squared error loss $s$ . Barlow Twins (b) uses a loss $c$ to decorrelate pairs of different dimensions in the batch-wise normalized (B-Norm) embeddings, and learns invariance with a loss $i$ that makes similar dimensions highly correlated. W-MSE (c) uses a batch slicing operation that shuffles batches into small sub-batches, and apply PCA as a whitening operation on the featurewise normalized (F-Norm) embeddings of each sub-batch. BYOL (d) has an asymmetric architecture where the weights $\theta _ { m }$ of one encoder are an exponential moving average (ema) of the other encoder’s weights $\theta$ . A predictor $g$ with weights $\psi$ is used in the branch with learnable weights. SimSiam (e) uses a predictor on one branch and a stop-gradient operation (sg) on the other one. SimCLR (f) uses the InfoNCE contrastive loss where all the feature-wise normalized embeddings are compared between them inside a batch. Samples from distorted versions of the same input are brought close to each other, while other samples are pushed away. SwAV (g) quantizes the feature-wise normalized embeddings of a branch and use it as target for the other one. OBoW (h) uses bag-of-words (BoW) representations and a cross-entropy loss to compare the BoW generated by a teacher network from the feature maps $Y ^ { F }$ of the encoder, to the BoW predicted by a student network. Green blocks: parametric functions; yellow boxes: non-parametric functions; blue boxes: objective functions.
|
| 330 |
+
|
| 331 |
+
# C ADDITIONAL IMPLEMENTATION DETAILS
|
| 332 |
+
|
| 333 |
+
# C.1 DATA AUGMENTATION
|
| 334 |
+
|
| 335 |
+
We follow the image augmentation protocol first introduced in SimCLR Chen et al. (2020a) and now commonly used by similar approaches based on siamese networks Caron et al. (2020); Grill et al. (2020); Chen & He (2020); Zbontar et al. (2021). Two random crops from the input image are sampled and resized to $2 2 4 \times 2 2 4$ , followed by random horizontal flip, color jittering of brightness, contrast, saturation and hue, Gaussian blur and random grayscale. Each crop is normalized in each color channel using the ImageNet mean and standard deviation pixel values. In more details, the exact set of augmentations is based on BYOL Grill et al. (2020) data augmentation pipeline but is symmetrised. The following operations are performed sequentially to produce each view:
|
| 336 |
+
|
| 337 |
+
• Random cropping with an area uniformly sampled with size ratio between 0.08 to 1.0, followed by resizing to size $2 2 4 \times 2 2 4$ . RandomResizedCrop(224, $\mathsf { i c a l e } \mathsf { = } ( 0 . 0 8 $ , 0.1)) in PyTorch.
|
| 338 |
+
• Random horizontal flip with probability 0.5.
|
| 339 |
+
• Color jittering of brightness, contrast, saturation and hue, with probability 0.8. ColorJitter(0.4, 0.4, 0.2, 0.1) in PyTorch.
|
| 340 |
+
• Grayscale with probability 0.2.
|
| 341 |
+
• Gaussian blur with probability 0.5 and kernel size 23.
|
| 342 |
+
• Solarization with probability 0.1.
|
| 343 |
+
• color normalization with mean (0.485, 0.456, 0.406) and standard deviation (0.229, 0.224, 0.225).
|
| 344 |
+
|
| 345 |
+
# C.2 IMAGENET EVALUATION
|
| 346 |
+
|
| 347 |
+
Linear evaluation. We follow standard procedure and train a linear classifier on top of the frozen representations of a ResNet-50 pretrained with VICReg. We use the SGD optimizer with a learning rate of 0.02, a weight decay of $\bar { 1 0 } ^ { - 6 }$ , a batch size of 256, and train for 100 epochs. The learning rate follows a cosine decay. The training data augmentation pipeline is composed of random cropping and resize of ratio 0.2 to 1.0 with size $2 2 4 \times 2 2 4$ , and random horizontal flips. During evaluation the validation images are simply center cropped and resized to $2 2 4 \times 2 2 4$ .
|
| 348 |
+
|
| 349 |
+
Semi-supervised evaluation. We train a linear classifier and fine-tune the representations using 1 and $10 \%$ of the labels. We use the SGD optimizer with no weight decay and a batch size of 256, and train for 20 epochs. We perform a grid search on the values of the encoder and linear head learning rates. In the $10 \%$ of labels case, we use a learning rate of 0.01 for the encoder and 0.1 for the linear head. In the $1 \%$ of labels case we use 0.03 for the encoder and 0.08 for the linear head. The two learning rates follow a cosine decay schedule. The training data and validation augmentation pipelines are identical to the linear evaluation data augmentation pipelines.
|
| 350 |
+
|
| 351 |
+
# C.3 TRANSFER LEARNING
|
| 352 |
+
|
| 353 |
+
We use the VISSL library Goyal et al. (2021) for linear classification tasks and the detectron2 library Wu et al. (2019) for object detection and segmentation tasks.
|
| 354 |
+
|
| 355 |
+
Linear classification. We follow standard protocols Misra & Maaten (2020); Caron et al. (2020); Zbontar et al. (2021) and train linear models on top of the frozen representations. For VOC07 Everingham et al. (2010), we train a linear SVM with LIBLINEAR Fan et al. (2008). The images are center cropped and resized to $2 2 4 \times 2 2 4$ , and the C values are computed with cross-validation. For Places205 Zhou et al. (2014) we use SGD with a learning rate of 0.003, a weight decay of 0.0001, a momentum of 0.9 and a batch size of 256, for 28 epochs. The learning rate is divided by 10 at epochs 4, 8 and 12. For Inaturalist2018 Horn et al. (2018), we use SGD with a learning rate of 0.005, a weight decay of 0.0001, a momentum of 0.9 and a batch size of 256, for 84 epochs. The learning rate is divided by 10 at epochs 24, 48 and 72.
|
| 356 |
+
|
| 357 |
+
Object detection and instance segmentation. Following the setup of He et al. (2020); Zbontar et al. (2021), we use the trainval split of $\mathrm { v o c } 0 7 { + } 1 2$ with 16K images for training and a Faster
|
| 358 |
+
|
| 359 |
+
R-CNN C-4 backbone for 24K iterations with a batch size of 16. The backbone is initialized with our pretrained ResNet-50 backbone. We use a learning rate of 0.1, divided by 10 at iteration 18K and 22K, a linear warmup with slope of 0.333 for 1000 iterations, and a region proposal network loss weight of 0.2. For COCO we use Mask R-CNN FPN backbone for 90K iterations with a batch size of 16, a learning rate of 0.04, divided by 10 at iteration 60K and 80K and with 50 warmup iterations.
|
| 360 |
+
|
| 361 |
+
# C.4 ANALYSIS
|
| 362 |
+
|
| 363 |
+
We give here implementation details on the results of Table 4 with BYOL and SimSiam, as well as the default setup for VICReg with 100 epochs of pretraining, used in all our ablations included in Appendix D. For both BYOL and SimSiam experiments, the variance criterion has coefficient $\mu = 1$ and the covariance criterion has coefficient $\nu = 0 . 0 1$ , the data augmentation pipeline and the architectures of the expander and predictor exactly follow the pipeline and architectures described in their paper. The linear evaluation setup of each methods follows closely the setup described in the original papers.
|
| 364 |
+
|
| 365 |
+
BYOL setup. We use our own BYOL implementation in PyTorch, which outperforms the original implementation for 100 epochs of pretraining $( 6 9 . 3 \%$ accuracy on the linear evaluation protocol against $6 6 . 5 \%$ for the original implementation) and matches its performance for 1000 epochs of pretraining. We use the LARS optimizer You et al. (2017), with a learning rate of $b a s e \_ l r *$ batch_size/256 where base_ $l r = 0 . 4 5$ , and batch $\_ s i z e = 4 0 9 6$ , a weight decay of $1 0 ^ { - 6 }$ , an eta value of 0.001 and a momentum of 0.9, for 100 epoch of pretraining with 10 epochs of warmup. The learning rate follows a cosine decay schedule. The initial value of the exponential moving average factor is 0.99 and follows a cosine decay schedule.
|
| 366 |
+
|
| 367 |
+
SimSiam setup. We use our own implementation of SimSiam, which reproduces exactly the performance reported in the paper Chen & He (2020). We use SGD with a learning rate of base_lr batch_size/256 where base_ $l r = 0 . 0 5$ , batch_size = 2048, with a weight decay of 0.0001 and a momentum of 0.9 for 100 epochs of pretraining and 10 epochs of warmup. The learning rate of the encoder and the expander follow a cosine decay schedule while the learning rate of the predictor is kept fixed.
|
| 368 |
+
|
| 369 |
+
VICReg setup. The setting of VICReg’s experiments is identical to the setting described in section 4.2, except that the number of pretraining epochs is 100 and the base learning rate is 0.3. The base learning rates used for the batch size study are 0.8, 0.5 and 0.4 for batch size 128, 256 and 512 respectively, and 0.3 for all other batch sizes. When a predictor is used, it has a similar architecture as the expander described in section 4.2, but with 2 layers instead of 3, which gives better results in practice.
|
| 370 |
+
|
| 371 |
+
# D ADDITIONAL RESULTS
|
| 372 |
+
|
| 373 |
+
# D.1 OTHER RESNET ARCHITECTURES
|
| 374 |
+
|
| 375 |
+
Table 9 reports the performance of VICReg on linear classification with large ResNet architectures. We focus on the wider family of ResNet Zagoruyko & Komodakis (2016) and aggregated ResNet Xie et al. (2017), and we consider two ways of widening a standard ResNet. First, we follow standard practice in recent self-supervised learning work Caron et al. (2020); Grill et al. (2020); Chen et al. (2020a) and multiple by 2 or 4 the number of filters in every convolutional layer, which also has the effect of multiplying the dimensionality of the representations. Second, as originally proposed in Zagoruyko & Komodakis (2016), we only multiply the number of filters in the bottleneck layers, which does not increases the dimensionality of the representations. We call this architecture Narrow ResNet (with prefix N- in Table 9). The main observation we make is the dependency of VICReg on the dimensionality of the representation. Using the narrow architecture, the performance of VICReg, jumps from $7 3 . 2 \%$ top-1 accuracy on linear classification with a ResNet-50, to $7 4 . 7 \%$ with Narrow ResNet-50 $( \mathbf { x } 2 )$ , which is a $1 . 5 \%$ improvement and $7 6 . 0 \%$ with Narrow ResNet-50 (x4), which is a $2 . 8 \%$ improvement. We observe a similar trend going from ResNet-50 to ResNet-50 $( \mathbf { x } 2 )$ , which is a $2 . 3 \%$ improvement but the performance completely saturates with ResNet-50 (x4), which is a $0 . 1 \%$ improvement over ResNet-50 (x2). Table 10 reports the performance of VICReg on semi-supervised classification with large ResNet architectures. VICReg combined with a ResNet-50 (x2) outperforms the current state-of-the-art methods BYOL and SimCLR, using this encoder architecture. Our largest model ResNet-200 $( \mathbf { x } 2 )$ performs lower than BYOL when $1 \%$ of the labels are used but is on par with $10 \%$ of the labels. These results demonstrate the capabilities of VICReg to scale up when large architectures are used.
|
| 376 |
+
|
| 377 |
+
Table 6: Evaluation on ESC-50. Evaluation of the representations obtained with a ResNet-18 backbone pretrained with VICReg on ESC-50 Piczak (2015) by processing jointly a raw audio time-series and its corresponding time-frequency representation. The supervised baseline corresponds to a ResNet-18 trained on the time-frequency representation in a supervised way. We report Top-1 accuracy on the validation set (in $\%$ ).
|
| 378 |
+
|
| 379 |
+
<table><tr><td>Method</td><td>Top-1</td></tr><tr><td>Supervised baseline</td><td>72.7</td></tr><tr><td>Barlow Twins</td><td>75.4</td></tr><tr><td>VICReg</td><td>78.4</td></tr></table>
|
| 380 |
+
|
| 381 |
+
# D.2 PRETRAINING AND EVALUATION ON ESC-50 AUDIO CLASSIFICATION
|
| 382 |
+
|
| 383 |
+
We demonstrate the ability of VICReg to function in a setting where the branches have different architectures by pretraining on the ESC-50 audio dataset Piczak (2015), which is an environmental sound classification dataset with 50 classes. We jointly embedded a raw audio time-series representation on one branch, with its corresponding time-frequency representation on the other branch. We use the standard split of ESC-50 Piczak (2015), composed of 1600 training audio samples and 400 validation sample. The raw audio encoder is a 1-dimensional ResNet-18 with output dimension 384. The time-frequency image representation is the mel spectrogram with 1 channel of the raw audio, that we normalize between 0 and 1, and that is processed be a ResNet-18 with output dimension of 512. We use the AdamW optimizer with learning rate 0.0005 for 100 epochs of pretraining.
|
| 384 |
+
|
| 385 |
+
Table 6 reports the performance of a linear classifier trained one the frozen representations obtained with VICReg and Barlow Twins to a simple supervised baseline where we train a ResNet-18 on the time-frequency representation in a supervised way. VICReg performs better by $5 . 7 \%$ than our supervised baseline, and better by $3 . 0 \%$ than Barlow Twins. We give more details in Appendix ??. Current best approaches that report around $9 5 \%$ accuracy on this task uses tricks such as heavy data augmentation or pretraining on larger audio and video datasets. With this experiment, our purpose is not to push the state of the art on ESC-50, but merely to demonstrate the applicability of VICReg to settings with multiple architectures and input modalities.
|
| 386 |
+
|
| 387 |
+
# D.3 K-NEAREST-NEIGHBORS
|
| 388 |
+
|
| 389 |
+
Following recent protocols Caron et al. (2020); Wu et al. (2018); Zhuang et al. (2019), we evaluate the learnt representations using K-nearest-neighbors classifiers built on the training set of ImageNet and evaluated on the validation set of ImageNet. We report the results with $\mathrm { K } { = } 2 0$ and ${ \mathrm { K } } { = } 2 0 0$ in Table 11. VICReg performs slightly lower than other methods in the 20-NN case but remains competitive in the 200-NN case. These results with K-NN classifiers demonstrate the potential applicability of VICReg to downstream tasks based on nearest neighbors search, such as content retrieval in images or videos.
|
| 390 |
+
|
| 391 |
+
# D.4 LOSS FUNCTION COEFFICIENTS.
|
| 392 |
+
|
| 393 |
+
Table 7 reports the performance for various values of the loss term coefficients in Eq. (6). Without variance regularization the representations immediately collapse to a single vector and the covariance term, which has no repulsive effect preventing collapse, has no impact. The invariance term is absolutely necessary and without it the network can not learn any good representations. By simply using the invariance term and variance regularization, which is a very simple baseline, VICReg still reaches an accuracy of $5 7 . 5 \%$ . These results show that variance and covariance regularizations have complementary effects, and that both are required.
|
| 394 |
+
|
| 395 |
+
On ImageNet, we choose the final coefficients the following way. First, we have empirically found that using very different values for $\lambda$ and $\mu$ , or taking $\lambda = \mu$ with $\nu > \mu$ leads to unstable training. On the other hand taking $\lambda = \mu$ and picking $\nu < \mu$ leads to stable convergence, with the exact value picked for $m u$ having very limited influence on the final linear classification accuracy. We have found that setting $l a m b d a = m u = 2 5$ and $n u = 1$ works best (by a small margin) for Imagenet but we have also obtained excellent results on MNIST and Cifar-10 and 100 using these exact same values. We could easily have tuned these parameters by cross-validation on the validation sets of these two smaller datasets.
|
| 396 |
+
|
| 397 |
+
Table 7: Impact of variance-covariance regularization. Inv: a invariance loss is used, $\lambda > 0$ , Var: variance regularization, $\mu > 0$ , Cov: covariance regularization, $\nu > 0$ , in Eq. (6).
|
| 398 |
+
|
| 399 |
+
<table><tr><td>Method</td><td>入</td><td>μ</td><td>V</td><td>Top-1</td></tr><tr><td>Inv</td><td>1</td><td>0</td><td>0</td><td>collapse</td></tr><tr><td>Inv + Cov</td><td>25</td><td>0</td><td>1</td><td>collapse</td></tr><tr><td>Inv + Cov</td><td>0</td><td>25</td><td>1</td><td>collapse</td></tr><tr><td>Inv + Var</td><td>1</td><td>1</td><td>0</td><td>57.5</td></tr><tr><td>Inv + Var + Cov (VICReg)</td><td>1</td><td>1</td><td>1</td><td>collapse</td></tr><tr><td></td><td>1</td><td>10</td><td>1</td><td>collapse</td></tr><tr><td></td><td>10</td><td>1</td><td>1</td><td>collapse</td></tr><tr><td></td><td>5</td><td>5</td><td>1</td><td>68.1</td></tr><tr><td></td><td>10</td><td>10</td><td>1</td><td>68.2</td></tr><tr><td></td><td>25</td><td>25</td><td>1</td><td>68.6</td></tr><tr><td></td><td>50</td><td>50</td><td>1</td><td>68.3</td></tr></table>
|
| 400 |
+
|
| 401 |
+
Table 8: Impact of normalization. Std: variables are centered and divided by their standard deviation over the batch. This is applied or not to the embedding and the expander hidden layers. $l _ { 2 }$ : the embedding vectors are $l _ { 2 }$ -normalized.
|
| 402 |
+
|
| 403 |
+
<table><tr><td>Representation</td><td>Embedding</td><td>Top-1</td></tr><tr><td>Std</td><td>None</td><td>68.6</td></tr><tr><td>Std</td><td>Std</td><td>68.4</td></tr><tr><td>None</td><td>Std</td><td>67.4</td></tr><tr><td>Std</td><td>None</td><td>67.2</td></tr><tr><td>None</td><td>l2</td><td>65.1</td></tr></table>
|
| 404 |
+
|
| 405 |
+
# D.5 NORMALIZATIONS
|
| 406 |
+
|
| 407 |
+
VICReg is the first self-supervised method for joint-embedding architectures we are aware of that does not require normalization. Contrary to SimSiam, W-MSE, SwAV and BYOL, and others, the embedding vectors are not projected on the unit sphere. Contrary to Barlow Twins, they are not standardized (equivalent to batch normalization without the adaptive parameters). Table 8 shows that the best settings do not involve any normalization of the embeddings, whether it is batch-wise or feature-wise (as in $l _ { 2 }$ normalization). Whenever the embeddings are standardized (lines 3 and 5 in the table) the covariance matrix of Eq. (3) becomes the normalized auto-correlation matrix with coefficients between -1 and 1. This hurts the accuracy by $0 . 2 \%$ . We observe that when unconstrained, the coefficients in the covariance matrix take values in a wider range, which seems to facilitate the training process. Standardization is still an important component that helps stabilize the training when used in the hidden layers of the expander, and the performance drops by $1 . 2 \%$ when it is removed. Projecting the embeddings on the unit sphere implicitly constrains their standard deviation along the batch dimension to be $1 / { \sqrt { d } }$ , where $d$ is the dimension of the vectors. We change the invariance term of Eq. (5) to be the mean square error between $l _ { 2 }$ -normalized vectors, and the target $\gamma$ in the variance term of Eq. (1) is set to $1 / \sqrt { d }$ instead of 1, forcing the standard deviation to get closer to $1 / \sqrt { d }$ , and the vectors to be spread out on the unit sphere. This puts a lot more constraints on the network and the performance drops by $3 . 5 \%$ .
|
| 408 |
+
|
| 409 |
+
Table 9: Linear classification with large architectures. Top-1 accuracy comparison between different methods using various encoder architectures. For all VICReg results, the output dimensionality of the expander is 8192. N-R stands for Narrow ResNet, where only the bottleneck convolutional layers are widen.
|
| 410 |
+
|
| 411 |
+
<table><tr><td>Method</td><td>Arch.</td><td>Param.</td><td>Repr.</td><td>Top-1</td><td>Top-5</td></tr><tr><td>SimCLR Chen et al. (2020a)</td><td>R50 (x2) R50 (x4)</td><td>93M 375M</td><td>4096 8192</td><td>74.2 76.5</td><td>92.0 93.2</td></tr><tr><td>SwAV Caron et al. (2020)</td><td>R50 (x2) R50 (x4)</td><td>93M 375M</td><td>4096 8192</td><td>77.3 77.9</td><td>- =</td></tr><tr><td>BYOL Grill et al. (2020)</td><td>R50 (x5) R50 (x2) R50 (x4)</td><td>586M 93M 375M</td><td>10240 4096 8192</td><td>78.5 77.4 78.6</td><td>- 93.6 94.2</td></tr><tr><td>VICReg (ours)</td><td>R200 (x2) N-R50 (x2)</td><td>250M 66M</td><td>4096 2048</td><td>79.6 74.7</td><td>94.8 91.9</td></tr><tr><td></td><td>N-R50 (x4)</td><td>221M</td><td>2048</td><td>76.0</td><td>92.4</td></tr><tr><td></td><td>R50 (x2)</td><td></td><td></td><td></td><td></td></tr><tr><td></td><td></td><td>93M</td><td>4096</td><td>75.5</td><td>92.1</td></tr><tr><td></td><td>R50 (x4)</td><td>375M</td><td></td><td></td><td></td></tr><tr><td></td><td></td><td></td><td>8192</td><td>75.6</td><td>92.2</td></tr><tr><td></td><td>RNXT101-32-16</td><td>191M</td><td>2048</td><td>76.1</td><td>92.3</td></tr><tr><td></td><td>R200 (x2)</td><td>250M</td><td>4096</td><td>77.3</td><td>93.3</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
|
| 412 |
+
|
| 413 |
+
Table 10: Semi-supervised classification with large architectures. Top-1 accuracy comparison between different methods using various encoder architectures. For all VICReg results, the output dimensionality of the expander is 8192.
|
| 414 |
+
|
| 415 |
+
<table><tr><td>Method</td><td>Arch.</td><td>Param.</td><td>Repr.</td><td colspan="2">Top-1</td><td colspan="2">Top-5</td></tr><tr><td></td><td></td><td></td><td></td><td>1%</td><td>10%</td><td>1%</td><td>10%</td></tr><tr><td>SimCLR Chen et al. (2020a)</td><td>R50 (x2)</td><td>93M</td><td>4096</td><td>58.5</td><td>71.7</td><td>83.0</td><td>91.2</td></tr><tr><td></td><td>R50 (x4)</td><td>375M</td><td>8192</td><td>63.0</td><td>74.4</td><td>85.8</td><td>92.6</td></tr><tr><td>BYOL Grill et al. (2020)</td><td>R50 (x2)</td><td>93M</td><td>4096</td><td>62.2</td><td>73.5</td><td>84.1</td><td>91.7</td></tr><tr><td></td><td>R50 (x4)</td><td>375M</td><td>8192</td><td>69.1</td><td>75.7</td><td>87.9</td><td>92.5</td></tr><tr><td></td><td>R200 (x2)</td><td>250M</td><td>4096</td><td>71.2</td><td>77.7</td><td>89.5</td><td>93.7</td></tr><tr><td>VICReg (ours)</td><td>R50 (x2)</td><td>93M</td><td>4096</td><td>62.6</td><td>73.9</td><td>84.5</td><td>91.8</td></tr><tr><td></td><td>R200 (x2)</td><td>250M</td><td>4096</td><td>68.8</td><td>77.3</td><td>88.2</td><td>93.6</td></tr></table>
|
| 416 |
+
|
| 417 |
+
Table 11: K-NN classifiers on ImageNet. Top-1 accuracy with 20 and 200 nearest neighbors.
|
| 418 |
+
|
| 419 |
+
<table><tr><td>Method</td><td>20-NN</td><td>200-NN</td></tr><tr><td>NPID Wu et al. (2018)</td><td></td><td>46.5</td></tr><tr><td>LA Zhuang et al. (2019)</td><td></td><td>49.4</td></tr><tr><td>PCL Li et al. (2021)</td><td>54.5</td><td>1</td></tr><tr><td>BYOL Grill et al. (2020)</td><td>66.7</td><td>64.9</td></tr><tr><td>SwAV Caron et al. (2020)</td><td>65.7</td><td>62.7</td></tr><tr><td>Barlow Twins Zbontar et al. (2021)</td><td>64.8</td><td>62.9</td></tr><tr><td>VICReg</td><td>64.5</td><td>62.8</td></tr></table>
|
| 420 |
+
|
| 421 |
+
Table 12: Impact of expander dimensionality. Top-1 accuracy on the linear evaluation protocol with 100 pretraining epochs.
|
| 422 |
+
|
| 423 |
+
<table><tr><td>Dimensionality</td><td>256</td><td>512</td><td>1024</td><td>2048</td><td>4096</td><td>8192</td><td>16834</td></tr><tr><td>Top-1</td><td>55.9</td><td>59.2</td><td>62.4</td><td>65.1</td><td>67.3</td><td>68.6</td><td>68.8</td></tr></table>
|
| 424 |
+
|
| 425 |
+
Table 13: Impact of batch size. Top-1 accuracy on the linear evaluation protocol with 100 pretraining epochs.
|
| 426 |
+
|
| 427 |
+
<table><tr><td>Batch size</td><td>128</td><td>256</td><td>512</td><td>1024</td><td>2048</td><td>4096</td></tr><tr><td>Top-1</td><td>67.3</td><td>67.9</td><td>68.2</td><td>68.3</td><td>68.6</td><td>67.8</td></tr></table>
|
| 428 |
+
|
| 429 |
+
# D.6 EXPANDER NETWORK ARCHITECTURE
|
| 430 |
+
|
| 431 |
+
VICReg borrows the decorrelation mechanism of Barlow Twins Zbontar et al. (2021) and we observe that it therefore has the same dependency on the dimensionality of the expander network. Table 12 reports the impact of the width and depth of the expander network. The dimensionality corresponds the number of hidden and output units in the expander network during pretraining. As the dimensionality increases, the performance dramatically increases from $5 5 . 9 \%$ top-1 accuracy on linear evaluation with a dimensionality of 256, to $6 8 . 8 \%$ with dimensionality 16384. The performance tends to saturate as the difference between dimensionality 8192 and 16384 is only of $0 . 2 \%$ .
|
| 432 |
+
|
| 433 |
+
# D.7 BATCH SIZE
|
| 434 |
+
|
| 435 |
+
Contrastive methods suffer from the need of a lot of negative examples which can translate into the need for very large batch sizes Chen et al. (2020a). Table 13 reports the performance on linear classification when the size of the batch varies between 128 and 4096. For each value of batch size, we perform a grid search on the base learning rate described in Appendix C.4. We observe a $0 . 7 \%$ and $1 . 2 \%$ drop in accuracy with small batch size of 256 and 128 which is comparable with the robustness to batch size of Barlow Twins Zbontar et al. (2021) and SimSiam Chen & He (2020), and a $0 . 8 \%$ drop with a batch size of 4096, which is reasonable and allows our method to be very easily parallelized on multiple GPUs.
|
| 436 |
+
|
| 437 |
+
# D.8 COMBINATION WITH BYOL AND SIMSIAM
|
| 438 |
+
|
| 439 |
+
BYOL Grill et al. (2020) and SimSiam Chen & He (2020) rely on a effective but difficult to interpret mechanism for preventing collapse, which may lead to instabilities during the training. We incorporate our variance regularization loss into BYOL and SimSiam and show that it helps stabilize the training and offers a small performance improvement. For both methods, the results are obtained using our own implementation and the exact same data augmentation and optimization settings as in their original paper. The variance and covariance regularization losses are incorporated with a factor of $\mu = 1$ for variance and $\nu = 0 . 0 1$ for covariance. We report in Figure 3 the improvement obtained over these methods on the linear evaluation protocol for different number of pre-training epochs. For BYOL the improvement is of $0 . 9 \%$ with 100 epochs and becomes less significant as the number of pre-training epochs increases with a $0 . 2 \%$ improvement with 1000 epochs. This indicates that variance regularization makes BYOL converge faster. In SimSiam the improvement is not as significant. We plot in Figure 4 the evolution of the standard deviation computed along each dimension and averaged across the dimensions of the representation and the embeddings, during BYOL and SimSiam pretraining. For both methods, the standard deviation computed on the embeddings perfectly matches $1 / \sqrt { d }$ where $d$ is the dimension of the embeddings, which indicates that the embeddings are perfectly spread-out across the unit sphere. This translates in an increased standard deviation at the representation level, which seems to be correlated to the performance improvement. We finally study in Figure 5 the evolution of the average correlation coefficient, during pretraining of BYOL and SimSiam, with and without variance and covariance regularization. The average correlation coefficient is computed by averaging the off-diagonal coefficients of the
|
| 440 |
+
|
| 441 |
+

|
| 442 |
+
Figure 3: Incorporating variance regularization in BYOL and SimSiam. Top-1 accuracy on the linear evaluation protocol for different number of pretraining epochs. For both methods pre-training follows the optimization and data augmentation protocol of their original paper but is based on our implementation. Var indicates variance regularization
|
| 443 |
+
|
| 444 |
+
correlation matrix of the representations:
|
| 445 |
+
|
| 446 |
+
$$
|
| 447 |
+
\frac { 1 } { 2 d ( d - 1 ) } \sum _ { i \neq j } C ( \boldsymbol { Y } ) _ { i , j } ^ { 2 } + C ( \boldsymbol { Y } ^ { \prime } ) _ { i , j } ^ { 2 } ,
|
| 448 |
+
$$
|
| 449 |
+
|
| 450 |
+
where $Y$ and $Y ^ { \prime }$ are the standardized representations and $C$ is defined in Eq. (3). In BYOL this coefficient is much lower using covariance regularization, which translate in a small improvement of the performance, according to Table 4. We do not observe the same improvement in SimSiam, both in terms of correlation coefficient, and in terms of performance on linear classification. The average correlation coefficient is correlated with the performance, which motivates the fact that decorrelation and redundancy reduction are core mechanisms for learning self-supervised representations.
|
| 451 |
+
|
| 452 |
+
# E RUNNING TIME
|
| 453 |
+
|
| 454 |
+
We report in Table 14, the running time of VICReg in comparison with other methods. All methods are run by us on 32 Tesla V100 GPUs. Each method offers a different trade-off between running time, memory and performance. SwAV is a very fast algorithm which use less memory and run faster than the other methods but with a lower performance, multi-crop helps the performance at the cost of additional compute and memory usage. BYOL has the highest memory requirement, which is due to the need of storing the target network weights. Finally, Barlow Twins and VICReg offer an interesting trade-off, consuming less memory than BYOL and SwAV with multi-crop, and running faster than SwAV with multi-crop, but with a slightly worse performance. The difference of 1h running time between Barlow Twins and VICReg is probably due to implementation details not related to the method.
|
| 455 |
+
|
| 456 |
+
Table 14: Running time and peak memory. Comparison between different methods, the training is distributed on 32 Tesla V100 GPUs, the running time is measured over 100 epochs and the peak memory is measured on a single GPU. We report top-1 accuracy $( \% )$ on linear classification on top of the frozen representations.
|
| 457 |
+
|
| 458 |
+
<table><tr><td>Method</td><td>time /100 epochs</td><td>peak memory /GPU</td><td>Top-1 accuracy (%)</td></tr><tr><td>SwAV</td><td>9h</td><td>9.5G</td><td>71.8</td></tr><tr><td>SwAV (w/ multi-crop)</td><td>13h</td><td>12.9G</td><td>75.3</td></tr><tr><td>BYOL</td><td>10h</td><td>14.6G</td><td>74.3</td></tr><tr><td>Barlow Twins</td><td>12h</td><td>11.3G</td><td>73.2</td></tr><tr><td>VICReg</td><td>11h</td><td>11.3G</td><td>73.2</td></tr></table>
|
| 459 |
+
|
| 460 |
+

|
| 461 |
+
Figure 4: Standard deviation of the features during BYOL and SimSiam pretraining. Evolution of the average standard deviation of each dimension of the features with and without variance regularization (Var). left: the standard deviation is measured on the representations, right: the standard deviation is measured on the embeddings.
|
| 462 |
+
|
| 463 |
+

|
| 464 |
+
Figure 5: Average correlation coefficient of the features during BYOL and SimSiam pretraining. Evolution of the average correlation coefficient measured by averaging the off-diagonal terms of the correlation matrix of the representations with BYOL, BYOL with variance-covariance regularization (BYOL VarCov), SimSiam, and SimSiam with variance-covariance regularization (SimSiam VarCov).
|
md/dev/xpjsOQtKqx/xpjsOQtKqx.md
ADDED
|
@@ -0,0 +1,426 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# StableRep: Synthetic Images from Text-to-Image Models Make Strong Visual Representation Learners
|
| 2 |
+
|
| 3 |
+
Yonglong Tian1,∗ Lijie Fan1,2,∗ Phillip Isola2 Huiwen Chang1 Dilip Krishnan1
|
| 4 |
+
|
| 5 |
+
1Google Research, 2MIT CSAIL, ∗equal contribution Code: https://github.com/google-research/syn-rep-learn
|
| 6 |
+
|
| 7 |
+
# Abstract
|
| 8 |
+
|
| 9 |
+
We investigate the potential of learning visual representations using synthetic images generated by text-to-image models. This is a natural question in the light of the excellent performance of such models in generating high-quality images. We consider specifically the Stable Diffusion, one of the leading open source text-toimage models. We show that (1) when the generative model is configured with proper classifier-free guidance scale, training self-supervised methods on synthetic images can match or beat the real image counterpart; (2) by treating the multiple images generated from the same text prompt as positives for each other, we develop a multi-positive contrastive learning method, which we call StableRep. With solely synthetic images, the representations learned by StableRep surpass the performance of representations learned by SimCLR and CLIP using the same set of text prompts and corresponding real images, on large scale datasets. When we further add language supervision, StableRep trained with 20M synthetic images achieves better accuracy than CLIP trained with 50M real images.
|
| 10 |
+
|
| 11 |
+

|
| 12 |
+
Figure 1: Left: traditional visual representation learning relies on a dataset of real images to train an image embedding function. Right: we view generative models as datasets that allow us to sample images from the data distribution. In our study, we leverage text-to-image models (Stable Diffusion [61]) and treat multiple images synthesized from the same prompt as positives for contrastive representation learning.
|
| 13 |
+
|
| 14 |
+
# 1 Introduction
|
| 15 |
+
|
| 16 |
+
Data has assumed a paramount role as the key component for the success of modern machine learning systems. Such systems, especially foundation models in various domains, heavily rely on vast and diverse datasets to acquire knowledge, make accurate predictions, and generate content. The quality, quantity, and diversity of the data significantly impacts the performance and effectiveness of these models, as they learn from the collective information encapsulated within the data. In this data-centric era, a central question is: how can we collect such large amounts of varied data to train AI models?
|
| 17 |
+
|
| 18 |
+
As an example, suppose we are trying to solve a new computer vision problem, and need to collect data (images) for it. An ideal situation is to place a camera anywhere in the wold and capture whatever we need. But in reality, collecting data is historically not easy. In the 1990s, researchers needed to take photos by themselves to create datasets for objects [52] and faces [68, 24]. To collect data in the 2000s, people crawled the Internet [15]. Noisy, uncurated data collected in such a manner can exhibit domain gaps with the real world problem and reflect imbalances due to societal bias. Removing or reducing such imperfection in data of high volume by human labeling is costly and can be prohibitive.
|
| 19 |
+
|
| 20 |
+
However, what if data collection could be simplified to the utterance of a natural language command, specifying what you want? What if, for hardly any cost, you could take a photo every few milliseconds? This sounds fanciful, but modern text-to-image generative models are approaching this vision. It has long been a dream that someday we could use these as our data sources, rather than taking photos [75, 30, 35]. In this paper, we study if this is now a practical option in the context of large scale visual representation learning.
|
| 21 |
+
|
| 22 |
+
To achieve this, we choose to work with Stable Diffusion [61], one of the leading open source text-to-image models. We synthesize images by prompting Stable Diffusion with text from large scale image-text datasets, such as CC12M [9] and RedCaps [16]. Surprisingly, our investigation reveals that when the classifier-free guidance scale is properly configured for Stable Diffusion, it is able to synthesize images on which training self-supervised methods can perform at par with or better than training on real images of the same sample size. Inspired by the idea of contrastive self-supervised learning, which promotes intra-image invariance, we develop a representation learning approach that promotes intra-caption invariance. We achieve this by treating the multiple images generated from the same text prompt as positives for each other and use them in a multi-positive contrastive loss (see Figure 1). Despite training with solely synthetic images, this approach, called StableRep, even outperforms state-of-the-art methods such as CLIP [58] using the same text set, but with corresponding real images, on various representation evaluation benchmarks.
|
| 23 |
+
|
| 24 |
+
Intuitively, one reason that synthetic data can be better than real data is because we are able to achieve a greater degree of control in the sampling, such as via the guidance scale in Stable Diffusion, or via text prompts and latent noise variables. Furthermore, generative models have the potential to generalize beyond their training data and therefore provide a richer (synthetic) training set than the corresponding real data alone. Our key contributions are:
|
| 25 |
+
|
| 26 |
+
1. We discover that training modern self-supervised methods on synthetic images from Stable Diffusion can be surprisingly effective. The learned representations are often better than representations learned from real images of the same sample size.
|
| 27 |
+
2. We develop StableRep, a novel representation learning approach by capturing invariance between images generated from the same text prompt, and propose a multi-positive contrastive loss.
|
| 28 |
+
3. With StableRep, we are able to achieve $7 6 . 7 \%$ linear accuracy on ImageNet with ViT-B/16, using solely synthetic images.
|
| 29 |
+
4. When coupled with language supervision, our StableRep trained with 20M synthetic images (10M captions) achieves better accuracy than CLIP trained with 50M real images (50M captions).
|
| 30 |
+
|
| 31 |
+
# 2 Standard Self-supervised Learning on Synthetic Images
|
| 32 |
+
|
| 33 |
+
A typical visual representation learning algorithm takes an image dataset $\{ { \mathbf { x } } _ { i } \} _ { i = 1 } ^ { N }$ as input, and yields an image encoder , which embeds an image $\mathbf { x }$ into a vector $\mathbf { e }$ . In this paper, we instead try to produce a good $F$ by using a generative model $G$ rather than a real image dataset. Specifically, we focus on text-to-image generative models $G : ( { \bf t } , { \bf z } ) \to { \bf x }$ , which maps a pair of text t and latent noise $\mathbf { z }$ to an image $\mathbf { x }$ . While there are several top performing text-to-image models [59, 67, 88, 7, 36, 3], we conduct our exploration with the Stable Diffusion [61] since it is publicly available and widely used. The version we used is v1-5.
|
| 34 |
+
|
| 35 |
+
# 2.1 Synthetic images from Stable diffusion
|
| 36 |
+
|
| 37 |
+
Stable diffusion [61] is a denoising diffusion probabilistic model [73, 31] that runs the diffusion process in the latent space of an autoencoder. It improves the sample quality and text-image alignment
|
| 38 |
+
|
| 39 |
+

|
| 40 |
+
Figure 2: Performance of linear probes on ImageNet as a function of the guidance scale of Stable Diffusion generation. Left: using SimCLR as pre-training; Right: using MAE as pre-training. In both cases, we see pre-training on synthetic images that are generated by Stable Diffusion with a guidance scale between 6 and 8, gives a significant boost over training only on real images. We used the CC3M dataset for these experiments.
|
| 41 |
+
|
| 42 |
+
via classifier-free guidance [32], which linearly combines conditional score estimate $\epsilon ( \mathbf { t } , \mathbf { z } _ { \lambda } )$ and unconditional estimate $\epsilon ( \mathbf { z } _ { \lambda } )$ with the guidance scale $w$ at each step $\lambda$ :
|
| 43 |
+
|
| 44 |
+
$$
|
| 45 |
+
\tilde { \epsilon } ( \mathbf { t } , \mathbf { z } _ { \lambda } ) = w \epsilon ( \mathbf { t } , \mathbf { z } _ { \lambda } ) + ( 1 - w ) \epsilon ( \mathbf { z } _ { \lambda } )
|
| 46 |
+
$$
|
| 47 |
+
|
| 48 |
+
The Stable Diffusion model $G _ { s d }$ relies on text sources to generate images. Instead of collecting a corpus of captions from scratch, we use the text part of existing uncurated image-text pair datasets, such as CC3M [71] and CC12M [9]. Formally, given an image caption dataset $\{ \mathbf { t } _ { i } \} _ { i = 1 } ^ { N }$ , we generate one image per caption, forming a synthetic image dataset of the same size.
|
| 49 |
+
|
| 50 |
+
# 2.2 Self-supervised learning on synthetic images
|
| 51 |
+
|
| 52 |
+
Recent representative self-supervised learning algorithms are mostly from two families: (1) contrastive learning which encourages invariance between embeddings of different augmentations of the same image ; (2) masked image modeling where model uses unmasked patches to predict masked patches (although there are other methods that fall into neither category, such as BYOL [25] and DINO [6]). For our study, we choose SimCLR [10] from the former family and MAE [26] from the latter due to their simplicity and strong performance. We focus on the Vision Transformer architecture [18], and use captions from CC3M [71] except when noted.
|
| 53 |
+
|
| 54 |
+
SimCLR [10]. We directly train SimCLR with ViT-B/16 on the synthetic image dataset, and measure the representation quality by linear probing evaluation on ImageNet [15] 1. One factor to consider is the classifier-free guidance scale $w$ , as it trades off between diversity and quality of the synthesized images and thus can affect the learned representations. To study this, for each $w$ in the set $\{ 2 , 3 , 4 , 6 , 8 , 1 0 , 1 2 \}$ , we generate a copy of size $N$ (one image per caption) to train SimCLR. Figure 2(left) visualizes the influence of $w$ . The optimal $w$ is around 8 (both 8 and 10 give an accuracy of $6 2 . 0 \%$ ). This is different from the FID metric where $w = 2$ is the optimal.
|
| 55 |
+
|
| 56 |
+
The captions $\{ \mathbf { t } _ { i } \} _ { i = 1 } ^ { N }$ used to generate synthetic images are also paired with $N$ real images. We train a SimCLR model with these real images. This model achieves $6 0 . 4 \%$ accuracy, experiencing a $1 3 \%$ drop in linear accuracy compared to pre-training on ImageNet. Such gap has been generally observed for uncurated pre-training data [77]. However, both interestingly and surprisingly, synthetic images with $w = 8$ have $1 . 6 \%$ higher accuracy than real images $( 6 2 . 0 \%$ v.s. $6 0 . 4 \%$ ).
|
| 57 |
+
|
| 58 |
+
MAE [26]. Following the default hyperparameters in MAE [26], we train a ViT-B/16 model for each guidance scale $w$ . Figure 2(right) reports the linear probing results. The accuracy of synthetic images increases quickly with $w$ after 2, and gradually drops when $w$ is large, e.g., $w \geq 1 0$ . The optimal guidance scale for MAE is 6, and this is different from SimCLR where the accuracy peaks at 8 or 10. This suggests that different methods may require different $w$ . With $w = 6$ , synthetic images have a $4 . 2 \%$ better accuracy than real images.
|
| 59 |
+
|
| 60 |
+
While the linear probing accuracy of MAE is lower than that of contrastive methods, its effectiveness often comes with fine-tuning. When fine-tuning pre-trained MAE models on ImageNet, we found synthetic images are still able to outperform real images. For instance, synthetic images with $w = 6$ is $0 . 3 \%$ higher than real images $8 2 . 9 \%$ v.s. $8 2 . 6 \%$ ).
|
| 61 |
+
|
| 62 |
+

|
| 63 |
+
Figure 3: Training self-supervised methods on synthetic images can be better than, or on par with, real images of the same sample size. Left: CC3M dataset; Right: CC12M dataset
|
| 64 |
+
|
| 65 |
+

|
| 66 |
+
Figure 4: We compare our pipeline (C) to that of (A) SimCLR; (B) CLIP. In SimCLR, the real image is augmented to give two views which are contrasted against each other through the same encoder. For CLIP, a real image and corresponding real caption are passed into image and text encoder, the image is augmented (usually more weakly than for SimCLR) followed by a contrastive loss. In our pipeline, each real caption is passed into Stable Diffusion (SD) to generate a number of synthetic images. These synthetic images are then augmented as in SimCLR, and treated as positives for each other in a multi-positive contrastive loss.
|
| 67 |
+
|
| 68 |
+
Other SSL methods. To test if synthetic images can be generically applied to different self-supervised learning methods, we try three more representative approaches: BYOL [25], MoCo-v3 [11], and DINO [6]. We do not tune $w$ for each method, and instead apply the optimal $w$ $( = 8 )$ ) discovered for SimCLR. The results on CC3M and CC12M are visualized in Figure 3. Synthetic images significantly improve over real for MAE, DINO, and SimCLR, and performs on par with real for BYOL, and slightly worse for MoCo-v3 (which could be attributed to not tuning the guidance scale $w$ ).
|
| 69 |
+
|
| 70 |
+
# 3 Multi-Positive Contrastive Learning with Synthetic Images
|
| 71 |
+
|
| 72 |
+
Text-to-image generative models offer a new way to compose positive samples for contrastive learning. Given an image caption, we can create multiple diverse samples by starting the reverse diffusion process with different latent noise z. Since these images are produced using the same prompt, they possess similar visual semantics, making them suitable for use as multiple positive samples for each other in contrastive learning. This property is unique to generative models, since collecting multiple images for each caption in large scale is infeasible. Figure 4 compares our StableRep pipeline with that of SimCLR and CLIP.
|
| 73 |
+
|
| 74 |
+
Multi-positive contrastive loss. We describe multi-positive contrastive learning as a matching problem. Consider an encoded anchor sample $\textbf { \em a }$ , and a set of encoded candidates $\mathbf { \bar { \{ } } b _ { 1 } , b _ { 2 } , . . . , b _ { K } \bar \} $
|
| 75 |
+
|
| 76 |
+
We compute a contrastive categorical distribution q that describes how likely $^ { a }$ is to match each $^ { b }$ :
|
| 77 |
+
|
| 78 |
+
$$
|
| 79 |
+
\mathbf { q } _ { i } = \frac { \exp ( \pmb { a } \cdot \pmb { b } _ { i } / \tau ) } { \sum _ { j = 1 } ^ { K } \exp ( \pmb { a } \cdot \pmb { b } _ { j } / \tau ) }
|
| 80 |
+
$$
|
| 81 |
+
|
| 82 |
+
where $\tau \in \mathcal { R } _ { + }$ is the scalar temperature hyper-parameter, and $\textbf { \em a }$ and all $^ { b }$ have been $\ell _ { 2 }$ normalized. Intuitively, this is a $K$ -way softmax classification distribution over all encoded candidates. Assume there is at least one candidate that the anchor $\textbf { \em a }$ matches. Then we know the ground-truth categorical distribution $\mathbf { p }$ is:
|
| 83 |
+
|
| 84 |
+
$$
|
| 85 |
+
{ \bf p } _ { i } = \frac { \mathbb { 1 } _ { \mathrm { m a t c h } ( { \pmb a } , { \pmb b } _ { i } ) } } { \sum _ { j = 1 } ^ { K } \mathbb { 1 } _ { \mathrm { m a t c h } ( { \pmb a } , { \pmb b } _ { j } ) } }
|
| 86 |
+
$$
|
| 87 |
+
|
| 88 |
+
where the indicator function $\mathbb { 1 } _ { \mathrm { m a t c h } ( \cdot , \cdot ) }$ indicates whether the anchor and candiate match. Then the multi-positive contrastive loss is the cross-entropy between the ground-truth distribution $\mathbf { p }$ and the contrastive distribution q:
|
| 89 |
+
|
| 90 |
+
$$
|
| 91 |
+
\mathcal { L } = H ( \mathbf { p } , \mathbf { q } ) = - \sum _ { i = 1 } ^ { K } \mathbf { p } _ { i } \log \mathbf { q } _ { i }
|
| 92 |
+
$$
|
| 93 |
+
|
| 94 |
+
This is a generalized form of the widelyused single-positive contrastive loss [54], where p reduces to a one-hot vector. This loss is closely related to that in [39], but a key distinction here is that we have no image class labels, and only assume images generated from the same caption are matched.
|
| 95 |
+
|
| 96 |
+
The PyTorch-like pseudocode of the batched multi-positive contrastive learning algorithm is described in Algo. 1. Each batch consists of $n * m$ images, meaning that we sample $m$ images for each of the $n$ captions. Here we still apply data augmentation, even though images from the same caption are different. This is to reduce overfitting since we perform many epochs of training over pregenerated synthetic images. However, if in the future the image generator is capable of producing images fast enough, then we can draw batches online and data augmentation may not be necessary. The
|
| 97 |
+
|
| 98 |
+
# Algorithm 1 Multi-Pos CL: PyTorch-like Pseudocode
|
| 99 |
+
|
| 100 |
+

|
| 101 |
+
|
| 102 |
+
Notes: h.T is h’s transpose. The $\ell _ { 2 }$ normalization operator is included in the encoder f.
|
| 103 |
+
|
| 104 |
+
multi-positive contrastive learning algorithm is also generic such that SimCLR can also be described by it – we begin by randomly selecting a set of $n$ images and subsequently apply $m$ (set as 2) crops to each of the chosen images. However, in our StableRep we only utilize a single crop from each image.
|
| 105 |
+
|
| 106 |
+
# 4 Experiments
|
| 107 |
+
|
| 108 |
+
We perform StableRep pre-training on synthetic images synthesized from texts in the CC3M (2.7 million samples) [71], CC12M (10 million) [9], or RedCaps datasets (11.6 million) [16]. We then evaluate the frozen representations by (1) linear probing on ImageNet-1k and other smaller scale image classification benchmark, and (2) few-shot image recognition that measures the generalization ability of the representations.
|
| 109 |
+
|
| 110 |
+
Backbone. We use ViT models [18] as the backbone for our approach StableRep. On top of the CLS token, we apply a 3-layer MLP projection head with hidden layers of 4096 dimensions and an output of 256 dimensions. Batch Normalization [33] is used in this projection head.
|
| 111 |
+
|
| 112 |
+
Training. In most of our experiments, we adopt a batch size of 8192 images (i.e. $m * n = 8 1 9 2$ ). This way the computation of each batch is equivalent to SimCLR with a batch size of 4096, because each image in SimCLR has two crops. We use AdamW optimizer [46] with a learning rate of 0.0032 and weight decay of 0.1, and set $\beta _ { 1 } , \beta _ { 2 }$ as 0.9, 0.98 respectively. We pre-generate 10 images for each text prompt. In each iteration, we randomly sample 6 out of the 10 for each sampled caption to form the training batch, i.e., $m = 6$ in Algo. 1. Recall that for SimCLR $m = 2$ . As a result, one epoch training of StableRep is computationally equivalent to 3 epochs of SimCLR. To provide easy comparison, we report SimCLR-equivalent epochs for StableRep in all of our analysis.
|
| 113 |
+
|
| 114 |
+
# 4.1 Main results on CC12M and RedCaps
|
| 115 |
+
|
| 116 |
+
In this section, we perform StableRep on images synthesized by either CC12M or RedCaps. For StableRep, we first removed duplicate captions from each dataset, resulting in a reduced number of captions: from 10.0M to 8.3M for CC12M and from 11.7M to $1 0 . 5 \mathbf { M }$ for RedCaps. We compared StableRep to SimCLR, which was trained on either synthetic or original real images. We also included CLIP with a synthetic and a real version 2. For SimCLR and CLIP, we did not perform de-duplication for either real or synthetic setting. We train for 35 epochs for all methods using ViT-B/16 (for StableRep, this refers to 35 SimCLR-equivalent epochs). We observed that CLIP started to overfit around 30 epochs. But StableRep did not overfit with this schedule (see Table 6c for results with longer training). For StableRep, we additionally apply random downsample augmentation (see Appendix A.1 for details and how such downsample affects different methods).
|
| 117 |
+
|
| 118 |
+
ImageNet. Table 1 presents the results of linear probing on ImageNet. For StableRep, we prepend a BatchNorm layer without affine transformation to the linear classifier (see Appendix A.5 for more details). We observed that training SimCLR on synthetic images yields an improvement of $2 . 2 \%$ top-1 accuracy on CC12M and $1 . 0 \%$ on RedCaps when compared to real images. However, the accuracy of CLIP drops by $2 . 6 \%$ on CC12M and $2 . 7 \%$ on RedCaps when trained on synthetic images (see Section 5 for more discussion). On the other hand, our method StableRep outperforms CLIP trained on real images, with improvements of $3 . 2 \%$ and $2 . 6 \%$ for CC12M and RedCaps, respectively.
|
| 119 |
+
|
| 120 |
+
<table><tr><td rowspan="2"></td><td colspan="2">Real SimCLR</td><td rowspan="2">Syn</td><td colspan="2">StableRep</td><td colspan="2">Real CLIP</td><td colspan="2">Syn</td></tr><tr><td>CLIP</td><td>SimCLR</td><td>CLIP</td><td></td><td>SimCLR</td><td>SimCLR</td><td>CLIP</td><td>StableRep</td></tr><tr><td>acc.</td><td>61.5</td><td>70.3 63.7</td><td>67.8</td><td>73.5</td><td>acc.</td><td>61.8</td><td>71.9 (b) RedCaps</td><td>62.8 69.2</td><td>74.5</td></tr><tr><td colspan="10">(a) CC12M</td></tr></table>
|
| 121 |
+
|
| 122 |
+
Linear classification on more datasets. We followed the approach of SimCLR [10] and BYOL [25] to assess the generality of our learned representations across different image domains. Specifically, we performed linear classification on 11 image classification datasets introduced by [40]. The results are reported in Table 2, and the relative performance is consistent with that on ImageNet. Notably, our proposed method, StableRep, achieves the highest accuracy on all of the 11 datasets.
|
| 123 |
+
|
| 124 |
+
<table><tr><td colspan="8">Aircraft</td><td rowspan="2"></td><td rowspan="2">SUN397</td><td colspan="2">Caltech-101</td><td rowspan="2">VOC2007</td><td rowspan="2">Average</td></tr><tr><td></td><td></td><td>CIFAR-10</td><td>CIFAR-100</td><td>Cars</td><td>DTD</td><td>Flowers</td><td>Pets</td><td></td><td>Food-101</td></tr><tr><td rowspan="2">R</td><td>SimCLR CLIP</td><td>88.3</td><td>70.3</td><td>47.1</td><td>45.5</td><td>76.2</td><td>92.5</td><td>70.1</td><td>65.4</td><td>83.8</td><td>75.0</td><td>81.2</td><td>72.3</td></tr><tr><td></td><td>94.0</td><td>79.0</td><td>53.2</td><td>75.8</td><td>75.7</td><td>96.0</td><td>86.7</td><td>72.5</td><td>92.7</td><td>81.6</td><td>86.1</td><td>81.2</td></tr><tr><td rowspan="4">S</td><td>SimCLR</td><td>84.8</td><td>65.2</td><td>51.0</td><td>53.2</td><td>74.5</td><td>93.3</td><td>74.2</td><td>65.0</td><td>81.7</td><td>74.8</td><td>81.8</td><td>72.7</td></tr><tr><td>CLIP</td><td>87.3</td><td>69.5</td><td>53.5</td><td>79.5</td><td>75.8</td><td>95.4</td><td>85.8</td><td>69.2</td><td>90.9</td><td>78.3</td><td>84.5</td><td>79.1</td></tr><tr><td>StableRep</td><td>96.2</td><td>84.1</td><td>58.3</td><td>80.9</td><td>78.1</td><td>97.2</td><td>87.5</td><td>73.0</td><td>94.6</td><td>83.6</td><td>87.2</td><td>83.7</td></tr></table>
|
| 125 |
+
|
| 126 |
+
Table 2: Linear probing experiments on image datasets from various domains. Pre-training is conduceted on CC12M, with either synthetic or real images. Best results for each dataset are highlighted with bold.
|
| 127 |
+
|
| 128 |
+
<table><tr><td colspan="2"></td><td rowspan="2">CIFAR-10 CIFAR-100</td><td rowspan="2"></td><td rowspan="2">Cars</td><td rowspan="2"></td><td rowspan="2">DTD</td><td rowspan="2">Flowers</td><td rowspan="2">Pets</td><td rowspan="2">SUN397</td><td rowspan="2">Caltech-101</td><td rowspan="2">Food-101</td><td rowspan="2">Average</td></tr><tr><td></td><td>Aircraft</td></tr><tr><td rowspan="2">3</td><td>SimCLR CLIP</td><td>64.0</td><td>70.4</td><td>40.7</td><td>50.9</td><td>82.2</td><td>92.1</td><td>74.4</td><td>94.0</td><td>90.4</td><td>70.4</td><td>73.0</td></tr><tr><td></td><td>77.5</td><td>82.1</td><td>62.0</td><td>90.9</td><td>83.3</td><td>97.6</td><td>91.1</td><td>97.2</td><td>98.2</td><td>87.0</td><td>86.7</td></tr><tr><td rowspan="3">S</td><td>SimCLR</td><td>50.0</td><td>58.9</td><td>45.2</td><td>54.2</td><td>79.8</td><td>92.0</td><td>74.6</td><td>92.9</td><td>89.1</td><td>71.0</td><td>70.8</td></tr><tr><td>CLIP</td><td>63.1</td><td>73.5</td><td>61.3</td><td>92.5</td><td>81.7</td><td>96.9</td><td>91.5</td><td>96.7</td><td>96.8</td><td>82.5</td><td>83.7</td></tr><tr><td>StableRep</td><td>92.3</td><td>91.8</td><td>62.6</td><td>91.8</td><td>86.4</td><td>98.2</td><td>91.7</td><td>97.3</td><td>98.8</td><td>87.3</td><td>89.8</td></tr></table>
|
| 129 |
+
|
| 130 |
+
Table 3: Few-shot experiments. We report 5-way, 5-shot classification performance. Best results for each dataset are highlighted with bold.
|
| 131 |
+
|
| 132 |
+
Few-shot image classification. Prior work [80, 83, 17] has shown that representation learning is the key for few-shot image classification. A simple classifier on top of frozen representation is sufficient to achieve strong results. We perform 5-way, 5-shot classification following the setup in [83, 19]. As shown in Table 3, StableRep stands out on 9 out of the 10 datasets.
|
| 133 |
+
|
| 134 |
+
<table><tr><td rowspan="2"></td><td rowspan="2">MAE IN1k, Real</td><td colspan="4">StableRep</td></tr><tr><td>cc12m,35ep</td><td>cc12m,105ep</td><td>redcaps,35ep</td><td>redcaps,105ep</td></tr><tr><td>mIoU</td><td>48.1</td><td>48.8</td><td>49.4</td><td>47.3</td><td>48.4</td></tr></table>
|
| 135 |
+
|
| 136 |
+
Table 4: ADE20k semantic segmentation (mIoU) using UperNet. StableRep models are trained by 35 or 105 SimCLR-equivalent epochs.
|
| 137 |
+
|
| 138 |
+
Semantic segmentation. We fine-tune pre-trained StableRep models on ADE20k [91] using UperNet [86]. For this evaluation, StableRep is pre-trained for 35 or 105 epochs. Table 4 shows that StableRep trained on synthetic data is able to outperform MAE trained on the real ImageNet images, despite StableRep has no masked image modeling which benefits dense prediction tasks.
|
| 139 |
+
|
| 140 |
+
# 4.2 Ablation analysis
|
| 141 |
+
|
| 142 |
+
For simplicity, ablation studies in this section do not use the random downsample augmentation in pre-training or prepend an extra BatchNorm layer to the linear classifier.
|
| 143 |
+
|
| 144 |
+
The design choice of $m$ (number of synthetic images per caption) is one of the key design choices for our approach. Therefore we study the following two factors relevant to $m$ on CC3M captions (2.7 million after de-duplication).
|
| 145 |
+
|
| 146 |
+
$$
|
| 147 |
+
\frac { m } \mathrm { a c c . } \ \middle | \begin{array} { c c c c c c } { { 1 } } & { { 2 } } & { { 4 } } & { { 6 } } & { { 8 } } & { { 1 0 } } \\ { { 6 0 . 5 } } & { { 6 8 . 7 } } & { { 6 9 . 6 } } & { { 6 9 . 6 } } & { { 6 9 . 8 } } & { { 6 9 . 5 } } \end{array}
|
| 148 |
+
$$
|
| 149 |
+
|
| 150 |
+
(a) Given a generation budget $T$ , we use $T / l$ captions and generate $l$ images per caption. When $l = 1$ , we train a SimCLR model.
|
| 151 |
+
|
| 152 |
+
Table 5: Ablation experiments on CC3M. ImageNet linear probing results with design choices relevant to data generation parameter $l$ , and batch sampling parameter $m$ .
|
| 153 |
+
|
| 154 |
+
<table><tr><td>1</td><td>1</td><td>2</td><td>4</td><td>6</td><td>8</td><td>10</td></tr><tr><td>acc.</td><td>61.2</td><td>64.2</td><td>65.6</td><td>66.0</td><td>66.2</td><td>66.2</td></tr></table>
|
| 155 |
+
|
| 156 |
+
(b) Given a batch size of $C$ , we form each batch by sampling $C / m$ captions and $m$ images per caption. We “abuse” $m = 1$ to represent SimCLR.
|
| 157 |
+
|
| 158 |
+
Fixed generation budget. We first study the question: given a fixed value for the number of total synthetic images generated $( T )$ , should we generate more images per caption $( l )$ , and therefore use fewer captions $( T / l )$ or the reverse. We assume an image budget of $T = 2 . 7$ million. During training, we use the same total batch size (8192) for all $l$ , and set the sampling parameter $m$ as $l$ . Table 5a presents the results. There is a clear benefit of generating more than 1 image per caption, e.g., $l = 8$ improves over $l = 1$ by $4 . 8 \%$ . But this benefit saturates around $l = 1 0$ . We thus generate 10 images per caption for our final experiments.
|
| 159 |
+
|
| 160 |
+
How to form the batch. Suppose we have generated 10 images for each of the 2.7 million captions. Now given a fixed batch size, i.e., $n * m = C$ (recall that $n$ is the number of captions, $m$ is the number of images per caption, inside each batch), a larger $m$ encourages stronger invariance of images from the same caption, while larger $n$ incorporates more negatives and thus encourages better separability of representations. To study this trade-off, we vary the sampling parameter $m$ from 2 to 10 while keeping $n = C / m$ . As shown in Table 5b, The linear probing accuracy are similar between $m = 4$ and $m = 1 0$ (peak at $m = 8$ with $6 9 . 8 \%$ accuracy), showing the robustness of StableRep w.r.t. $m$ . We choose $m = 6$ as our default setup. We “abuse” $m = 1$ to represent SimCLR.
|
| 161 |
+
|
| 162 |
+

|
| 163 |
+
Figure 5: ImageNet zero-shot accuracy with different Stable Diffusion generation guidance scale $w$ , using CLIP as pre-training.
|
| 164 |
+
|
| 165 |
+

|
| 166 |
+
Figure 6: ImageNet linear probing accuracy comparison between StableRep $^ +$ on synthetic images and CLIP on real images on LAION subsets. For this experiment, only 2 images are generated for each caption.
|
| 167 |
+
|
| 168 |
+
After the above study, we continue to ablate the following factors on CC12M and RedCaps.
|
| 169 |
+
|
| 170 |
+
<table><tr><td>Case</td><td>IN</td><td>avg.</td></tr><tr><td>small</td><td>72.8</td><td>82.2</td></tr><tr><td>large</td><td>70.8</td><td>80.4</td></tr><tr><td>mixed</td><td>71.9</td><td>81.5</td></tr></table>
|
| 171 |
+
|
| 172 |
+
<table><tr><td>Size</td><td>IN</td><td>avg.</td></tr><tr><td>ViT-B/16</td><td>72.8</td><td>82.2</td></tr><tr><td>ViT-L/16</td><td>74.7</td><td>82.9</td></tr></table>
|
| 173 |
+
|
| 174 |
+
<table><tr><td>Epochs</td><td colspan="2">CC12MRedCaps</td></tr><tr><td>35</td><td>72.8</td><td>73.7</td></tr><tr><td>70</td><td>75.0</td><td>76.3</td></tr><tr><td>105</td><td>75.7</td><td>76.7</td></tr></table>
|
| 175 |
+
|
| 176 |
+
(a) Guidance scale $w$ . Smaller $w$ yields better linear accuracy.
|
| 177 |
+
|
| 178 |
+
(b) Model size. Our approach scales up with model size.
|
| 179 |
+
|
| 180 |
+
(c) Training epochs. Longer training further improves accuracy.
|
| 181 |
+
|
| 182 |
+
Table 6: Ablation experiments by pre-training on CC12M or RedCaps. We report linear probing accuracy on ImageNet (IN) and/or average accuracy over the 11 fine-grained classification datasets (avg.). The colored cell indicates the default setup on each dataset: ViT-B/16 trained for 35 epochs with small guidance scale $w$ .
|
| 183 |
+
|
| 184 |
+
Guidance score for training. We consider three configurations for the classifier free guidance scale $w$ : (1) large scale $- w \in \{ 8 , 1 0 \}$ ; (2) small scale – $\mathrm { ~ \bar { ~ } { ~ w ~ } \in ~ \{ 2 , 3 \} }$ ; (3) mixed scale – $w \in$ $\{ 2 , 3 , 4 , 5 , 6 , 8 , 1 0 , 1 2 \}$ . As shown in Table 6a, small scale gives the best linear transfer accuracy on ImageNet and fine-grained classification datasets. This is possibly because smaller $w$ leads to larger intra-caption variation between generated images, which enforces StableRep to learn stronger invariance. This is different from SimCLR which requires larger $w$ (recall Section 2.1), as SimCLR only models intra-image invariance and thus higher image quality (larger $w$ ) helps more.
|
| 185 |
+
|
| 186 |
+
Model scale. We switch the backbone architecture to ViT-L/16. Table 6b presents the results. The accuracy improves by $1 . 9 \%$ on ImageNet linear probing and $0 . 7 \%$ on the average over fine-grained classification datasets. We found that pre-training with ViT-L was unstable. The loss kept exploding to NaN, and we resumed from the checkpoint before NaN. But this led to a higher convergent loss than ViT-B (ViT-L loss is lower before exploding). This may partly be due to the usage of BatchNorm.
|
| 187 |
+
|
| 188 |
+
Longer training. To investigate the scaling behavior of StableRep w.r.t. training compute, we further increase the pre-training computation budget to $2 \mathbf { x }$ and $3 \mathbf { x }$ epochs, and report the linear probing accuracy on ImageNet in Table 6c. The results indicate that StableRep scales well with longer training, e.g., improving by 2.2 for $2 \mathbf { x }$ and 2.9 for $3 \mathbf { x }$ on CC12M pre-training, and by 2.6 for $2 \mathbf { x }$ and 3.0 for $3 \mathbf { x }$ on RedCaps pre-training.
|
| 189 |
+
|
| 190 |
+
# 5 Adding Language Supervision
|
| 191 |
+
|
| 192 |
+
How would training CLIP using synthetic images work? We study this question by generating a copy (one image per caption) for each guidance scale $w$ in $\{ 1 , 2 , 3 , 4 , 6 , 8 , 1 0 \}$ and training CLIP using each copy. Figure 5 plots the zero-shot ImageNet accuracy. Contrary to SSL methods, CLIP favors lower $w$ . With the optimal $w = 2$ , CLIP achieves $3 4 . 9 \%$ zero-shot accuracy. This is $5 . 4 \%$ lower than training on real images $( 4 0 . 2 \% )$ . Such gap may be explained by misalignment between the generated images and the input text, shown in Figure 7. This is especially true for fine-grained classes.
|
| 193 |
+
|
| 194 |
+

|
| 195 |
+
Figure 7: Examples of misalignment between input text and synthesized image, which can lead to suboptimal performance for CLIP trained on synthetic images. Upper: require headhammer shark but Stable Diffusion often generates sharks without headhammer; Lower: “Andrex Puppies” is a brand of toilet rolls.
|
| 196 |
+
|
| 197 |
+
We can add language supervision to StableRep by adding $0 . 5 * ( \mathcal { L } _ { i 2 t } + \mathcal { L } _ { t 2 i } )$ to StableRep loss, where $\mathcal { L } _ { i 2 t }$ , $\mathcal { L } _ { t 2 i }$ are image-to-text and text-to-image contrastive losses described by Eq. 4. Adding supervision improves StableRep from $7 2 . 8 \%$ to $7 4 . 4 \%$ on CC12M and from $7 3 . 7 \%$ to $7 5 . 4 \%$ on RedCaps for ImageNet linear probing. We term it as StableRep+. We then further scale StableRep+ to a randomly selected 50M subset of LAION-400M [70]. For this experiment, we only generate 2 images per caption with $w = 2$ , and train CLIP with real images and StableRep $^ +$ with synthetic images using different scales of random subsets of the 50M data. We plot the results in Figure 6. StableRep+ consistently achieves better accuracy than CLIP. Noteably, StableRep $^ +$ with 10M captions outperforms CLIP with 50M captions, yielding a $5 \mathbf { x }$ time caption efficiency ( $2 . 5 \mathrm { x }$ image efficiency).
|
| 198 |
+
|
| 199 |
+
# 5.1 Fairness and compositionality
|
| 200 |
+
|
| 201 |
+
We further study the fairness and compositional understanding of the learned models on FairFace [37] and ARO [89] benchmarks, respectively. The results are presented in Table 7.
|
| 202 |
+
|
| 203 |
+
Table 7: Results of fairness and compositionality evaluation.
|
| 204 |
+
|
| 205 |
+
<table><tr><td colspan="2"></td><td rowspan="2"></td><td colspan="3">FairFace</td><td rowspan="2">ARO relation acc.</td></tr><tr><td></td><td>pre-train data</td><td>mean acc.</td><td>best-class acc. worst-class acc.</td></tr><tr><td rowspan="3">GZem</td><td>CLIP</td><td>Real</td><td>28.2</td><td>60.2</td><td>0.3</td><td>46.4</td></tr><tr><td></td><td>Syn</td><td>30.4</td><td>64.0</td><td>3.1</td><td>50.0</td></tr><tr><td>StableRep+</td><td>Syn</td><td>37.2</td><td>74.9</td><td>10.0</td><td>47.3</td></tr><tr><td rowspan="3">eeeees</td><td>CLIP</td><td>Real</td><td>9.3</td><td>31.1</td><td>0.4</td><td>59.0</td></tr><tr><td></td><td>Syn</td><td>22.3</td><td>52.4</td><td>1.0</td><td>56.0</td></tr><tr><td>StableRep+</td><td>Syn</td><td>27.3</td><td>64.4</td><td>2.1</td><td>52.3</td></tr></table>
|
| 206 |
+
|
| 207 |
+
Fairness. We perform zero-shot classificaton on FairFace. We jointly classify both races and genders, e.g., treating Black male, Black female, Indian female, and so on as different classes at the same time. For $\operatorname { c c l } 2 \mathrm { m }$ models, CLIP with real data only achieved $0 . 3 \%$ accuracy with Southeast Asian male class, and CLIP wth synthetic data improves this class to $3 . 1 \%$ , while our StableRep $^ +$ furthers it to $2 7 . 2 \%$ . For redcaps models, real CLIP only has $0 . 4 \%$ accuracy for East Asian Male, while StableRep $^ +$ improves this class to $2 2 . 8 \%$ . In summary, training with synthetic data is able to improve the worst class accuracy. However, a obvious geographic bias still exists in all models.
|
| 208 |
+
|
| 209 |
+
Compositionality. The results of compositionality evaluation are less clear. While training with synthetic data on $\operatorname { c c l } 2 \mathrm { m }$ slightly improves the relational understanding, an accuracy drop is observed in models trained with synthetic data on redcaps. An in-depth investigation may be further needed.
|
| 210 |
+
|
| 211 |
+
# 6 Related Work
|
| 212 |
+
|
| 213 |
+
Text-to-Image generative models. Text-to-image models trained on large image and text pairs have recently enabled the creation of rich and diverse images encompassing many genres and themes [7, 61, 67, 88]. The resulting creations have become a sensation, with Stable Diffusion having millions of downloads and many tools for image manipulation built on top [66, 38, 90]. Most of these models are built on denoising diffusion models [31, 73] with some notable exceptions [8, 7]. In this paper, we leverage this latest generation of diffusion-based pre-trained generative models for the task of representation learning.
|
| 214 |
+
|
| 215 |
+
Visual representation learning. Early approaches for visual representation learning often relied on pretext tasks such as inpainting [56] to train image encoders. More recent advancements have shown that mask image modeling, a form of self-supervised training, can be highly effective. In particular, Masked Autoencoder (MAE) [26] has demonstrated significant improvements in downstream finetuning performance. Another line of research focuses on contrastive learning, which aims to learn visual representations by maximizing agreement between two augmented views of the same image while distinguishing it from negative examples [10, 78, 54, 84, 27, 79]. Meanwhile CLIP [58] and its subsequent works [51] leverage contrastive learning to train image representations using language supervision, leading to impressive transferability across various tasks.
|
| 216 |
+
|
| 217 |
+
Learning from synthetic data. It has been common to train machine learning models with synthetic data in different domains [72, 81, 14, 63, 44, 64, 50, 43, 76, 87, 29, 49]. In computer vision, synthetic images have been used as a source for training models, such as optical flow [48, 23], autonomous driving [1], semantic segmentation [12, 62], object detection [65, 57], human pose estimation [82, 34] or classification [2, 69, 28]. The closest set of work are the ones that conduct representation learning on synthetic images [60, 45, 4, 35]. In [60], a model is trained to perform multi-task learning on synthetic images. The main method in [45, 4, 35] is to manipulate the latent variable of deep generative models [45, 4, 35] or image generation procedures [4], to form meaningful synthetic images for their representation learning methods. Our method falls into this category, but we use text-to-image diffusion models, which have also been explored by [2, 28, 69]. The key difference is that they conducted supervised learning while we use synthetic data for pre-training representations.
|
| 218 |
+
|
| 219 |
+
# 7 Conclusion, Limitations and Broader Impact
|
| 220 |
+
|
| 221 |
+
We have shown that solely synthetic data generated from state of the art text-to-image models can be used to train powerful visual representations. By harnessing the stochastic nature of Stable Diffusion in combination with a multi-positive contrastive loss, our approach yields a representation that surpasses the performance achieved through training on real data alone. Through a series of experiments, we establish that pre-training with synthetic datasets of varying scales yields impressive results across different downstream tasks, including linear probing and few-shot classification. Interestingly, we discover that even vanilla self-supervised methods trained on synthetic data can either outperform or achieve comparable results to those trained on real data.
|
| 222 |
+
|
| 223 |
+
Despite demonstrating the potential of training with synthetic data, this paper acknowledges its limitations. Firstly, we have yet to comprehend the reasons behind the effectiveness of training self-supervised methods on synthetic images compared to an equal amount of real images. It is possible that this observation is confined to our particular evaluation methodology. Furthermore, the current image generation process remains slow, with approximately 0.8s per image on a A100 GPU or 2.2s per image on a V100 GPU while xFormers is enabled. Consequently, we are not able to train StableRep models with non-repetitive images synthesized online. Additionally, we have not addressed the issue of semantic mismatch between the input prompts and the generated images, which may impact the quality and usefulness of the synthetic data. Moreover, synthetic data has the potential to exacerbate biases due to mode collapse and a predisposition to output “prototypical” images. Lastly, image attribution becomes a challenge when working with synthetic data.
|
| 224 |
+
|
| 225 |
+
Broader impacts. This paper focuses on the fundamentals of visual representation learning, and we believe it will be beneficial to the practice of this field. Our method presents an immediate application by reducing the reliance on collecting a vast amount of real images for learning representations. This approach brings potential benefits in terms of cost-effectiveness and minimizing biases introduced through human collection and curation processes. However, it is important to acknowledge that our method relies on text-to-image generative models trained on large-scale, uncurated web data. Such data may conceal social biases and errors that would have been exposed through human curation. Additionally, we must recognize that the text prompts we employed are not completely bias-free; the selection of prompts influences the synthesized images. Thus, the choice of prompts assumes a role similar to the selection of real images for self-supervised visual representation learning.
|
| 226 |
+
|
| 227 |
+
# Acknowledgements
|
| 228 |
+
|
| 229 |
+
We would like to thank anonymous reviewers and Shumeet Baluja for reviewing our manuscript and providing many helpful comments and suggestions. We also appreciate the helpful discussions and the general supports from the VisCam teammates in Google Research.
|
| 230 |
+
|
| 231 |
+
# References
|
| 232 |
+
|
| 233 |
+
[1] Hassan Abu Alhaija, Siva Karthik Mustikovela, Lars Mescheder, Andreas Geiger, and Carsten Rother. Augmented reality meets computer vision: Efficient data generation for urban driving scenes. IJCV, 2018. 10 [2] Shekoofeh Azizi, Simon Kornblith, Chitwan Saharia, Mohammad Norouzi, and David J Fleet. Synthetic data from diffusion models improves imagenet classification. arXiv preprint arXiv:2304.08466, 2023. 10 [3] Yogesh Balaji, Seungjun Nah, Xun Huang, Arash Vahdat, Jiaming Song, Karsten Kreis, Miika Aittala, Timo Aila, Samuli Laine, Bryan Catanzaro, et al. ediffi: Text-to-image diffusion models with an ensemble of expert denoisers. arXiv preprint arXiv:2211.01324, 2022. 2 [4] Manel Baradad Jurjo, Jonas Wulff, Tongzhou Wang, Phillip Isola, and Antonio Torralba. Learning to see by looking at noise. In NeurIPS, 2021. 10 [5] Lukas Bossard, Matthieu Guillaumin, and Luc Van Gool. Food-101–mining discriminative components with random forests. In ECCV, 2014. 19 [6] Mathilde Caron, Hugo Touvron, Ishan Misra, Hervé Jégou, Julien Mairal, Piotr Bojanowski, and Armand Joulin. Emerging properties in self-supervised vision transformers. In ICCV, 2021.
|
| 234 |
+
3, 4, 16, 18 [7] Huiwen Chang, Han Zhang, Jarred Barber, AJ Maschinot, Jose Lezama, Lu Jiang, Ming-Hsuan Yang, Kevin Murphy, William T Freeman, Michael Rubinstein, et al. Muse: Text-to-image generation via masked generative transformers. arXiv preprint arXiv:2301.00704, 2023. 2, 9,
|
| 235 |
+
10 [8] Huiwen Chang, Han Zhang, Lu Jiang, Ce Liu, and William T Freeman. Maskgit: Masked generative image transformer. In CVPR, 2022. 10 [9] Soravit Changpinyo, Piyush Sharma, Nan Ding, and Radu Soricut. Conceptual 12m: Pushing web-scale image-text pre-training to recognize long-tail visual concepts. In CVPR, 2021. 2, 3,
|
| 236 |
+
5, 6 [10] Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In ICML, 2020. 3, 6, 10, 16, 17, 18 [11] Xinlei Chen, Saining Xie, and Kaiming He. An empirical study of training self-supervised vision transformers. In ICCV, 2021. 3, 4, 16, 18 [12] Yuhua Chen, Wen Li, Xiaoran Chen, and Luc Van Gool. Learning semantic segmentation from synthetic data: A geometrically guided input-output adaptation approach. In CVPR, 2019. 10 [13] Mircea Cimpoi, Subhransu Maji, Iasonas Kokkinos, Sammy Mohamed, and Andrea Vedaldi. Describing textures in the wild. In CVPR, 2014. 19 [14] Yabo Dan, Yong Zhao, Xiang Li, Shaobo Li, Ming Hu, and Jianjun Hu. Generative adversarial networks (gan) based efficient sampling of chemical composition space for inverse design of inorganic materials. NPJ Computational Materials, 2020. 10 [15] Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In CVPR, 2009. 2, 3, 6 [16] Karan Desai, Gaurav Kaul, Zubin Aysola, and Justin Johnson. Redcaps: Web-curated image-text data created by the people, for the people. arXiv preprint arXiv:2111.11431, 2021. 2, 5, 6 [17] Guneet S Dhillon, Pratik Chaudhari, Avinash Ravichandran, and Stefano Soatto. A baseline for few-shot image classification. arXiv preprint arXiv:1909.02729, 2019. 7 [18] 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. 3, 5, 6 [19] Mohamed El Banani, Karan Desai, and Justin Johnson. Learning visual representations via language-guided sampling. In CVPR, 2023. 7, 18 [20] Linus Ericsson, Henry Gouk, and Timothy M Hospedales. How well do self-supervised models transfer? In CVPR, 2021. 18 [21] Mark Everingham, Luc Van Gool, Christopher KI Williams, John Winn, and Andrew Zisserman. The pascal visual object classes (voc) challenge. IJCV, 2010. 19 [22] Li Fei-Fei, Robert Fergus, and Pietro Perona. One-shot learning of object categories. TPAMI,
|
| 237 |
+
2006. 19 [23] Philipp Fischer, Alexey Dosovitskiy, Eddy Ilg, Philip Häusser, Caner Hazırba¸s, Vladimir Golkov, Patrick Van der Smagt, Daniel Cremers, and Thomas Brox. Flownet: Learning optical flow with convolutional networks. arXiv preprint arXiv:1504.06852, 2015. 10 [24] Athinodoros S Georghiades, David J Kriegman, and PN Belhurneur. Illumination cones for recognition under variable lighting: Faces. In CVPR, 1998. 2 [25] Jean-Bastien Grill, Florian Strub, Florent Altché, Corentin Tallec, Pierre Richemond, Elena Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Guo, Mohammad Gheshlaghi Azar, et al. Bootstrap your own latent-a new approach to self-supervised learning. In NeurIPS, 2020.
|
| 238 |
+
3, 4, 6, 16, 17, 18 [26] Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollár, and Ross Girshick. Masked autoencoders are scalable vision learners. In CVPR, 2022. 3, 10 [27] Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. arXiv:1911.05722, 2019. 10 [28] Ruifei He, Shuyang Sun, Xin Yu, Chuhui Xue, Wenqing Zhang, Philip Torr, Song Bai, and Xiaojuan Qi. Is synthetic data from generative models ready for image recognition? arXiv preprint arXiv:2210.07574, 2022. 10 [29] Xuanli He, Islam Nassar, Jamie Kiros, Gholamreza Haffari, and Mohammad Norouzi. Generate, annotate, and learn: Nlp with synthetic text. TACL, 2022. 10 [30] Geoffrey E Hinton, Peter Dayan, Brendan J Frey, and Radford M Neal. The "wake-sleep" algorithm for unsupervised neural networks. Science, 1995. 2 [31] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. In NeurIPS, 2020. 2, 10 [32] Jonathan Ho and Tim Salimans. Classifier-free diffusion guidance. arXiv preprint arXiv:2207.12598, 2022. 3 [33] Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015. 5 [34] Catalin Ionescu, Dragos Papava, Vlad Olaru, and Cristian Sminchisescu. Human3. 6m: Large scale datasets and predictive methods for 3d human sensing in natural environments. TPAMI,
|
| 239 |
+
2013. 10 [35] Ali Jahanian, Xavier Puig, Yonglong Tian, and Phillip Isola. Generative models as a data source
|
| 240 |
+
|
| 241 |
+
for multiview representation learning. arXiv preprint arXiv:2106.05258, 2021. 2, 10 [36] Minguk Kang, Jun-Yan Zhu, Richard Zhang, Jaesik Park, Eli Shechtman, Sylvain Paris, and Taesung Park. Scaling up gans for text-to-image synthesis. arXiv preprint arXiv:2303.05511, 2023. 2
|
| 242 |
+
|
| 243 |
+
[37] Kimmo Kärkkäinen and Jungseock Joo. Fairface: Face attribute dataset for balanced race, gender, and age. arXiv preprint arXiv:1908.04913, 2019. 9
|
| 244 |
+
|
| 245 |
+
[38] 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. 10
|
| 246 |
+
|
| 247 |
+
[39] Prannay Khosla, Piotr Teterwak, Chen Wang, Aaron Sarna, Yonglong Tian, Phillip Isola, Aaron Maschinot, Ce Liu, and Dilip Krishnan. Supervised contrastive learning. arXiv:2004.11362, 2020. 5
|
| 248 |
+
|
| 249 |
+
[40] Simon Kornblith, Jonathon Shlens, and Quoc V Le. Do better imagenet models transfer better? In CVPR, 2019. 6
|
| 250 |
+
|
| 251 |
+
[41] Jonathan Krause, Michael Stark, Jia Deng, and Li Fei-Fei. 3d object representations for fine-grained categorization. In ICCV workshop, 2013. 19
|
| 252 |
+
|
| 253 |
+
[42] Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Tech Report, 2009. 19
|
| 254 |
+
|
| 255 |
+
[43] Varun Kumar, Ashutosh Choudhary, and Eunah Cho. Data augmentation using pre-trained transformer models. arXiv preprint arXiv:2003.02245, 2020. 10
|
| 256 |
+
|
| 257 |
+
[44] Jason Li, Ravi Gadde, Boris Ginsburg, and Vitaly Lavrukhin. Training neural speech recognition systems with synthetic speech augmentation. arXiv preprint arXiv:1811.00707, 2018. 10
|
| 258 |
+
|
| 259 |
+
[45] Hao Liu, Tom Zahavy, Volodymyr Mnih, and Satinder Singh. Palm up: Playing in the latent manifold for unsupervised pretraining. arXiv preprint arXiv:2210.10913, 2022. 10
|
| 260 |
+
|
| 261 |
+
[46] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017. 6
|
| 262 |
+
|
| 263 |
+
[47] Subhransu Maji, Esa Rahtu, Juho Kannala, Matthew Blaschko, and Andrea Vedaldi. Finegrained visual classification of aircraft. arXiv preprint arXiv:1306.5151, 2013. 19
|
| 264 |
+
|
| 265 |
+
[48] Nikolaus Mayer, Eddy Ilg, Philip Hausser, Philipp Fischer, Daniel Cremers, Alexey Dosovitskiy, and Thomas Brox. A large dataset to train convolutional networks for disparity, optical flow, and scene flow estimation. In CVPR, 2016. 10
|
| 266 |
+
|
| 267 |
+
[49] Yu Meng, Jiaxin Huang, Yu Zhang, and Jiawei Han. Generating training data with language models: Towards zero-shot language understanding. arXiv preprint arXiv:2202.04538, 2022. 10
|
| 268 |
+
|
| 269 |
+
[50] Masato Mimura, Sei Ueno, Hirofumi Inaguma, Shinsuke Sakai, and Tatsuya Kawahara. Leveraging sequence-to-sequence speech synthesis for enhancing acoustic-to-word speech recognition. In SLT, 2018. 10
|
| 270 |
+
|
| 271 |
+
[51] Norman Mu, Alexander Kirillov, David Wagner, and Saining Xie. Slip: Self-supervision meets language-image pre-training. In ECCV, 2022. 6, 10, 18
|
| 272 |
+
|
| 273 |
+
[52] Sameer A Nene, Shree K Nayar, Hiroshi Murase, et al. Columbia object image library (coil-20). Tech Report, 1996. 2
|
| 274 |
+
|
| 275 |
+
[53] Maria-Elena Nilsback and Andrew Zisserman. Automated flower classification over a large number of classes. In Indian Conference on Computer Vision, Graphics & Image Processing, 2008. 19
|
| 276 |
+
|
| 277 |
+
[54] Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018. 5, 10
|
| 278 |
+
|
| 279 |
+
[55] Omkar M Parkhi, Andrea Vedaldi, Andrew Zisserman, and CV Jawahar. Cats and dogs. In CVPR, 2012. 19
|
| 280 |
+
[56] Deepak Pathak, Philipp Krahenbuhl, Jeff Donahue, Trevor Darrell, and Alexei A Efros. Context encoders: Feature learning by inpainting. In CVPR, 2016. 10
|
| 281 |
+
[57] Xingchao Peng, Baochen Sun, Karim Ali, and Kate Saenko. Learning deep object detectors from 3d models. In CVPR, 2015. 10
|
| 282 |
+
[58] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In ICML, 2021. 2, 6, 10, 18, 19
|
| 283 |
+
[59] Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022. 2
|
| 284 |
+
[60] Zhongzheng Ren and Yong Jae Lee. Cross-domain self-supervised multi-task feature learning using synthetic imagery. In CVPR, 2018. 10
|
| 285 |
+
[61] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-resolution image synthesis with latent diffusion models. In CVPR, 2022. 1, 2, 9, 20
|
| 286 |
+
[62] German Ros, Laura Sellart, Joanna Materzynska, David Vazquez, and Antonio M Lopez. The synthia dataset: A large collection of synthetic images for semantic segmentation of urban scenes. In CVPR, 2016. 10
|
| 287 |
+
[63] Andrew Rosenberg, Yu Zhang, Bhuvana Ramabhadran, Ye Jia, Pedro Moreno, Yonghui Wu, and Zelin Wu. Speech recognition with augmented synthesized speech. In ASRU, 2019. 10
|
| 288 |
+
[64] Nick Rossenbach, Albert Zeyer, Ralf Schlüter, and Hermann Ney. Generating synthetic audio data for attention-based speech recognition systems. In ICASSP, 2020. 10
|
| 289 |
+
[65] Artem Rozantsev, Vincent Lepetit, and Pascal Fua. On rendering synthetic images for training an object detector. Computer Vision and Image Understanding, 2015. 10
|
| 290 |
+
[66] Nataniel Ruiz, Yuanzhen Li, Varun Jampani, Yael Pritch, Michael Rubinstein, and Kfir Aberman. Dreambooth: Fine tuning text-to-image diffusion models for subject-driven generation. arXiv preprint arXiv:2208.12242, 2022. 10
|
| 291 |
+
[67] Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily L Denton, Kamyar Ghasemipour, Raphael Gontijo Lopes, Burcu Karagol Ayan, Tim Salimans, et al. Photorealistic text-to-image diffusion models with deep language understanding. In NeurIPS, 2022. 2, 9
|
| 292 |
+
[68] Ferdinando S Samaria and Andy C Harter. Parameterisation of a stochastic model for human face identification. In IEEE workshop on applications of computer vision, 1994. 2
|
| 293 |
+
[69] Mert Bulent Sariyildiz, Karteek Alahari, Diane Larlus, and Yannis Kalantidis. Fake it till you make it: Learning transferable representations from synthetic imagenet clones. In CVPR, 2023. 10
|
| 294 |
+
[70] 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. 9
|
| 295 |
+
[71] Piyush Sharma, Nan Ding, Sebastian Goodman, and Radu Soricut. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In ACL, 2018. 3, 5
|
| 296 |
+
[72] David Silver, Julian Schrittwieser, Karen Simonyan, Ioannis Antonoglou, Aja Huang, Arthur Guez, Thomas Hubert, Lucas Baker, Matthew Lai, Adrian Bolton, et al. Mastering the game of go without human knowledge. Nature, 2017. 10
|
| 297 |
+
[73] Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In ICML, 2015. 2, 10
|
| 298 |
+
[74] Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. arXiv preprint arXiv:2010.02502, 2020. 20
|
| 299 |
+
[75] Richard S Sutton. Dyna, an integrated architecture for learning, planning, and reacting. ACM Sigart Bulletin, 1991. 2
|
| 300 |
+
[76] Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B Hashimoto. Alpaca: A strong, replicable instruction-following model. Stanford Center for Research on Foundation Models., 2023. 10
|
| 301 |
+
[77] Yonglong Tian, Olivier J Henaff, and Aäron van den Oord. Divide and contrast: Self-supervised learning from uncurated data. In ICCV, 2021. 3
|
| 302 |
+
[78] Yonglong Tian, Dilip Krishnan, and Phillip Isola. Contrastive multiview coding. arXiv:1906.05849, 2019. 10, 18
|
| 303 |
+
[79] Yonglong Tian, Chen Sun, Ben Poole, Dilip Krishnan, Cordelia Schmid, and Phillip Isola. What makes for good views for contrastive learning? In NeurIPS, 2020. 10
|
| 304 |
+
[80] Yonglong Tian, Yue Wang, Dilip Krishnan, Joshua B Tenenbaum, and Phillip Isola. Rethinking few-shot image classification: a good embedding is all you need? In ECCV, 2020. 7
|
| 305 |
+
[81] Allan Tucker, Zhenchen Wang, Ylenia Rotalinti, and Puja Myles. Generating high-fidelity synthetic patient data for assessing machine learning healthcare software. NPJ digital medicine, 2020. 10
|
| 306 |
+
[82] Gul Varol, Javier Romero, Xavier Martin, Naureen Mahmood, Michael J Black, Ivan Laptev, and Cordelia Schmid. Learning from synthetic humans. In CVPR, 2017. 10
|
| 307 |
+
[83] Yan Wang, Wei-Lun Chao, Kilian Q Weinberger, and Laurens van der Maaten. Simpleshot: Revisiting nearest-neighbor classification for few-shot learning. arXiv preprint arXiv:1911.04623, 2019. 7
|
| 308 |
+
[84] Zhirong Wu, Yuanjun Xiong, Stella X Yu, and Dahua Lin. Unsupervised feature learning via non-parametric instance discrimination. In CVPR, 2018. 10
|
| 309 |
+
[85] Jianxiong Xiao, James Hays, Krista A Ehinger, Aude Oliva, and Antonio Torralba. Sun database: Large-scale scene recognition from abbey to zoo. In CVPR, 2010. 19
|
| 310 |
+
[86] Tete Xiao, Yingcheng Liu, Bolei Zhou, Yuning Jiang, and Jian Sun. Unified perceptual parsing for scene understanding. In ECCV, 2018. 7
|
| 311 |
+
[87] Yiben Yang, Chaitanya Malaviya, Jared Fernandez, Swabha Swayamdipta, Ronan Le Bras, JiPing Wang, Chandra Bhagavatula, Yejin Choi, and Doug Downey. Generative data augmentation for commonsense reasoning. arXiv preprint arXiv:2004.11546, 2020. 10
|
| 312 |
+
[88] Jiahui Yu, Yuanzhong Xu, Jing Yu Koh, Thang Luong, Gunjan Baid, Zirui Wang, Vijay Vasudevan, Alexander Ku, Yinfei Yang, Burcu Karagol Ayan, et al. Scaling autoregressive models for content-rich text-to-image generation. arXiv preprint arXiv:2206.10789, 2022. 2, 9
|
| 313 |
+
[89] Mert Yuksekgonul, Federico Bianchi, Pratyusha Kalluri, Dan Jurafsky, and James Zou. When and why vision-language models behave like bags-of-words, and what to do about it? In ICLR, 2022. 9
|
| 314 |
+
[90] Lvmin Zhang and Maneesh Agrawala. Adding conditional control to text-to-image diffusion models. arXiv preprint arXiv:2302.05543, 2023. 10
|
| 315 |
+
[91] Bolei Zhou, Hang Zhao, Xavier Puig, Tete Xiao, Sanja Fidler, Adela Barriuso, and Antonio Torralba. Semantic understanding of scenes through the ade20k dataset. IJCV, 2019. 7
|
| 316 |
+
|
| 317 |
+
# A Implementation Details
|
| 318 |
+
|
| 319 |
+
# A.1 Downsample augmentation
|
| 320 |
+
|
| 321 |
+
Synthetic images have constant high resolutions (e.g., $5 1 2 \times 5 1 2$ for Stable Diffusion). We find this leads to a domain gap when transferring to situations involving low resolution images, such as CIFAR10 or CIFAR-100. To address this issue, we introduce Random Downsample augmentation, which randomly resizes images to a resolution of 64 or 128 (equally probable) and then resizes them back to 224. During pre-training, we apply this augmentation with a probability of 0.05 and prepend it to other augmentations.
|
| 322 |
+
|
| 323 |
+
In Table 8, we ablate the effects of applying this random downsample augmentation to different pretraining methods. This augmentation brings significant improvements on CIFAR-10 and CIFAR-100 datasets, while maintaining the performance on other datasets. On average this augmentation is more beneficial for pre-training with synthetic images than real ones.
|
| 324 |
+
|
| 325 |
+
<table><tr><td colspan="2"></td><td rowspan="2">CIAAIIIT</td><td rowspan="2"></td><td colspan="9"></td><td rowspan="2"></td><td rowspan="2">Vveee</td></tr><tr><td>aaesrg</td><td></td><td>CIIPPIPI0</td><td>Vrriet</td><td>8</td><td>0</td><td>Bonis</td><td>3</td><td>163105</td><td>GErreeaer</td><td>[01-p000 LOC7020</td></tr><tr><td rowspan="4">3</td><td>SimCLR</td><td></td><td>88.3</td><td>70.3</td><td>47.1</td><td>45.5</td><td>76.2</td><td>92.5</td><td>70.1</td><td>65.4</td><td>83.8</td><td>75.0</td><td>81.2</td><td>72.3</td></tr><tr><td>SimCLR</td><td>√</td><td>92.3</td><td>75.4</td><td>47.8</td><td>44.4</td><td>77.1</td><td>91.8</td><td>69.2</td><td>65.1</td><td>84.7</td><td>74.9</td><td>81.2</td><td>73.1 (+0.8)</td></tr><tr><td>CLIP</td><td></td><td>94.0 79.0</td><td>53.2</td><td></td><td>75.8</td><td>75.7</td><td>96.0</td><td>86.7</td><td>72.5</td><td>92.7</td><td>81.6</td><td>86.1</td><td>81.2</td></tr><tr><td>CLIP</td><td>√</td><td>95.8 82.9</td><td>51.5</td><td></td><td>76.5</td><td>74.7</td><td>95.3</td><td>87.2</td><td>72.5</td><td>92.7</td><td>81.7</td><td>86.2</td><td>81.5 (+0.3)</td></tr><tr><td rowspan="6">S</td><td>SimCLR</td><td>84.8</td><td>65.2</td><td></td><td>51.0</td><td>53.2</td><td>74.5</td><td>93.3</td><td>74.2</td><td>65.0</td><td>81.7</td><td>74.8</td><td>81.8</td><td>72.7</td></tr><tr><td>SimCLR √</td><td></td><td>92.6</td><td>76.2</td><td>50.4</td><td>53.2</td><td>74.7</td><td>93.3</td><td>74.7</td><td>64.8</td><td>86.0</td><td>74.7</td><td>81.2</td><td>74.7 (+2.0)</td></tr><tr><td>CLIP</td><td>87.3</td><td>69.5</td><td>53.5</td><td></td><td>79.5</td><td>75.8</td><td>95.4</td><td>85.8</td><td>69.2</td><td>90.9</td><td>78.3</td><td>84.5</td><td>79.1</td></tr><tr><td>CLIP 厂</td><td>93.4</td><td>78.8</td><td>52.4</td><td>79.6</td><td></td><td>75.1</td><td>95.0</td><td>85.0</td><td>69.5</td><td>90.9</td><td>78.4</td><td>84.7</td><td>80.3 (+1.2)</td></tr><tr><td>StableRep</td><td>90.7</td><td>74.4</td><td>57.6</td><td>80.3</td><td></td><td>79.0</td><td>96.7</td><td>87.1</td><td>73.2</td><td>94.0</td><td>83.5</td><td>87.2</td><td>82.2</td></tr><tr><td>StableRep√</td><td></td><td>96.2</td><td>84.1</td><td>58.3</td><td>80.9</td><td>78.1</td><td>97.2</td><td>87.5</td><td>73.0</td><td>94.6</td><td>83.6</td><td>87.2</td><td>83.7 (+1.5)</td></tr></table>
|
| 326 |
+
|
| 327 |
+
Table 8: We ablate the effects of Random Downsample augmentation on linear probing benchmarks from various domains. This augmentation brings significant improvements on CIFAR-10 and CIFAR-100 datasets, while maintaining the performance on other datasets.
|
| 328 |
+
|
| 329 |
+
# A.2 Standard self-supervised learning
|
| 330 |
+
|
| 331 |
+
We follow the default settings for standard self-supervised learning algorithms, and present the training details in Table 9 and Table 10. We use the linear $l r$ scaling rule: $l r = b a s e \_ l r \times b s z / 2 5 6$ . For BYOL [25], we did not follow the hyperparameters $( b l r = 1 . 0 e - 4$ , $w d = 0 . 0 3 )$ in [11], as we found our setting here yielded better accuracy. For DINO [6], we did not use the multi-crop strategy and only pre-trained the model with two $2 2 4 \times 2 2 4$ crops.
|
| 332 |
+
|
| 333 |
+
Table 9: Self-supervised pre-training settings. MAE and SimCLR.
|
| 334 |
+
|
| 335 |
+
<table><tr><td>config</td><td>MAE</td><td>SimCLR</td></tr><tr><td>optimizer</td><td>AdamW</td><td>AdamW</td></tr><tr><td>base learning rate</td><td>1.5e-4</td><td>2.0e-4</td></tr><tr><td>weight decay</td><td>0.05</td><td>0.1</td></tr><tr><td>optimizer momentum</td><td>β1, β2=0.9,0.95</td><td>β1, β2=0.9,0.98</td></tr><tr><td>batch size</td><td>4096</td><td>4096</td></tr><tr><td>learning rate schedule</td><td>cosine decay</td><td>cosine decay</td></tr><tr><td>epochs</td><td>300 (cc3m) /80 (cc12m)</td><td>100 (cc3m) /35 (cc12m)</td></tr><tr><td>warmup epochs</td><td>10 (cc3m) /4 (cc12m)</td><td>5 (cc3m) /1 (cc12m)</td></tr><tr><td>augmentation</td><td>RandomResizedCrop,Flip</td><td>SimCLR Aug. [10]</td></tr></table>
|
| 336 |
+
|
| 337 |
+
Table 10: Self-supervised pre-training settings. DINO, BYOL and MoCo v3.
|
| 338 |
+
|
| 339 |
+
<table><tr><td>config</td><td>DINO</td><td>BYOL/MoCo-v3</td></tr><tr><td>optimizer base learning rate</td><td>AdamW 5.0e-4</td><td>AdamW 1.5e-4</td></tr><tr><td>weight decay</td><td>0.04 to 0.4, cosine</td><td>0.1</td></tr><tr><td>optimizer momentum</td><td>β1, β2=0.9,0.999</td><td>β1,β2=0.9,0.95</td></tr><tr><td>batch size learning rate schedule</td><td>4096 cosine decay</td><td>4096</td></tr><tr><td>epochs warmup epochs</td><td>100 (cc3m) /35 (cc12m) 5 (cc3m)/2 (cc12m)</td><td>cosine decay 100 (cc3m) /35 (cc12m) 5 (cc3m)/2 (cc12m)</td></tr></table>
|
| 340 |
+
|
| 341 |
+
# A.3 StableRep pre-training
|
| 342 |
+
|
| 343 |
+
The hyperparameterss for StableRep is presented in Table 11. Indeed, they are the same as that in SimCLR. The difference is that the base_lr in StableRep is for 512 images while in SimCLR it is for 256 images, because each image in StableRep only has one single crop. We ended up using a batch size of 8256 images, since we trained our model with 32 GPUs and 8192 is not divisible over $3 2 \times 6$ . The computation for StableRep has been converted to SimCLR-equivalent epochs.
|
| 344 |
+
|
| 345 |
+
Table 11: StableRep pre-training settings.
|
| 346 |
+
|
| 347 |
+
<table><tr><td>config</td><td>StableRep</td></tr><tr><td>batch size</td><td>8256(m = 6,n = 1376)</td></tr><tr><td>optimizer</td><td>AdamW</td></tr><tr><td>base learning rate</td><td>2.0e-4</td></tr><tr><td>peak learning rate</td><td>base_lr × bsz/512</td></tr><tr><td>weight decay</td><td>0.1</td></tr><tr><td>optimizer momentum</td><td>β1,β2=0.9,0.98</td></tr><tr><td>learning rate schedule</td><td>cosine decay</td></tr><tr><td>epochs</td><td>35/70/105</td></tr><tr><td>warmup epochs</td><td>1.2 / 2.3 / 3.5</td></tr><tr><td>augmentation</td><td>Downsample Aug. + SimCLR Aug.[10]</td></tr></table>
|
| 348 |
+
|
| 349 |
+
# A.4 CLIP training
|
| 350 |
+
|
| 351 |
+
Table 12: CLIP training settings.
|
| 352 |
+
|
| 353 |
+
<table><tr><td>config</td><td>CLIP</td></tr><tr><td>batch size</td><td>8192</td></tr><tr><td>optimizer</td><td>AdamW</td></tr><tr><td>peak learning rate</td><td>1e-3</td></tr><tr><td>weight decay</td><td>0.5</td></tr><tr><td>optimizer momentum</td><td>β1,β2=0.9,0.98</td></tr><tr><td>learning rate schedule</td><td>cosine decay</td></tr><tr><td>epochs</td><td>35</td></tr><tr><td>warmup epochs</td><td>1</td></tr><tr><td>augmentation</td><td>RandomResizedCrop(scale=(0.5,1.0))</td></tr></table>
|
| 354 |
+
|
| 355 |
+
Table 13: CLIP encoder details.
|
| 356 |
+
|
| 357 |
+
<table><tr><td rowspan="2">Model</td><td rowspan="2">Patch size</td><td rowspan="2">Input resolution</td><td rowspan="2">Embedding dimension</td><td colspan="3">Vision Transformer</td><td rowspan="2"></td><td colspan="2">Text Transformer</td><td rowspan="2">Vocab size</td><td rowspan="2">Text length</td></tr><tr><td>Layers</td><td>Width</td><td>Heads Layers</td><td>Width</td><td>Heads</td></tr><tr><td>ViT-B/16</td><td>16</td><td>224</td><td>512</td><td>12</td><td>768</td><td>12</td><td>12</td><td>512</td><td>8</td><td>49,408</td><td>77</td></tr></table>
|
| 358 |
+
|
| 359 |
+
We follow the hyperparameter setting used in [51] since it is better than that from the original CLIP [58] paper. Table 12 summarizes the training details, and Table 13 presents the architecture of CLIP encoders. With this training setup, we are able to produce $4 0 . { \overset { - } { 2 } } \%$ ImageNet zero-shot accuracy when training CLIP on CC12M dataset. As a comparison, [51] reports ${ \bar { 3 } } 6 . 0 \%$ using the same architecutre.
|
| 360 |
+
|
| 361 |
+
# A.5 ImageNet linear probing
|
| 362 |
+
|
| 363 |
+
We follow prior work [11, 6] to train the linear classifier. It has been generally observed that regularization such as weight decay hurts the performance [78]. Following [78, 11], we set weight decay as 0, and only use RandomResizedCrop and RandomHorizontalFlip as data augmentation. We sweep the base_lr over $\{ 0 . 1 , 0 . 2 , 0 . 5 , 1 , 2 , 5 , 1 0 , 2 0 , 5 0 \} \times 1 0 ^ { - 2 }$ .
|
| 364 |
+
|
| 365 |
+
Table 14: ImageNet linear probing settings.
|
| 366 |
+
|
| 367 |
+
<table><tr><td>config</td><td>value</td></tr><tr><td>batch size</td><td>1024</td></tr><tr><td>optimizer</td><td>SGD</td></tr><tr><td>base learning rate</td><td>sweep</td></tr><tr><td>weight decay</td><td>0</td></tr><tr><td>optimizer momentum</td><td>0.9</td></tr><tr><td>learning rate schedule</td><td>cosine decay</td></tr><tr><td>epochs</td><td>90</td></tr><tr><td>augmentation</td><td>RandomResizedCrop,Flip</td></tr></table>
|
| 368 |
+
|
| 369 |
+
For StableRep trained with 35 epochs, we find that adding an extra BatchNorm layer without affine transformation improves and stablizes the linear probing results. However, this additional BatchNorm does not help when StableRep is trained with a longer schedule, e.g., 105 epochs. We conjecture that BatchNorm is helpful when StableRep is not convergent, and present the comparison in Table 15.
|
| 370 |
+
|
| 371 |
+
Table 15: ImageNet linear probing results w/ or w/o extra BatchNorm layer for the linear classifier.
|
| 372 |
+
|
| 373 |
+
<table><tr><td></td><td>w/BN</td><td>W/o BN</td></tr><tr><td>StableRep,35 epochs</td><td>73.5</td><td>71.4</td></tr><tr><td>StableRep,105 epochs</td><td>75.2</td><td>75.4</td></tr></table>
|
| 374 |
+
|
| 375 |
+
# A.6 Fine-grained linear classification
|
| 376 |
+
|
| 377 |
+
Following [10, 25, 20], we fit a regularized multinomial logistic regression model on top of the frozen CLS token. In training and testing, we do not perform any data augmentation; images are resized to 224 pixels along the shorter side using bicubic resampling, followed by a center crop of $2 2 4 \times 2 2 4$ . We minimize the cross-entropy objective using L-BFGS with $\ell _ { 2 }$ -regularization. We select this $\ell _ { 2 }$ -regularization constant on the validation set over 45 logarithmically spaced values between $1 0 ^ { - 6 }$ and $\mathrm { \bar { 1 0 ^ { 5 } } }$ . The maximum number of L-BFGS iterations is set to 500.
|
| 378 |
+
|
| 379 |
+
The details about the fine-grained classification datasets are presented in Table 16.
|
| 380 |
+
|
| 381 |
+
# A.7 Few-shot image classification
|
| 382 |
+
|
| 383 |
+
Following the settings in [20, 19], we evaluate the 5-way 5-shot performance on 10 different datasets. We do not use data augmentation; images are resized to 224 pixels along the shorter side using bicubic resampling, followed by a center crop of $2 2 4 \times 2 2 4$ . We report the mean accuracy of 600 randomly sampled tasks (also known as episodes). For each task, images are randomly sampled from the combination of training, validation and testing sets. We sample 15 query images for each class in every task for evaluation purpose.
|
| 384 |
+
|
| 385 |
+
<table><tr><td>Dataset</td><td>Metric</td><td>Categories</td><td>Train Size</td><td>Test Size</td></tr><tr><td>CIFAR-10 [42]</td><td>Accuracy</td><td>10</td><td>50.000</td><td>10,000</td></tr><tr><td>CIFAR-100 [42]</td><td>Accuracy</td><td>100</td><td>50,000</td><td>10,000</td></tr><tr><td>Aircraft [47]</td><td>Mean per class</td><td>100</td><td>6,667</td><td>3,333</td></tr><tr><td>Cars [41]</td><td>Accuracy</td><td>196</td><td>8,144</td><td>8,041</td></tr><tr><td>DTD [13]</td><td>Accuracy</td><td>47</td><td>3,760</td><td>1,880</td></tr><tr><td>Flowers [53]</td><td>Mean per class</td><td>102</td><td>2,040</td><td>6,149</td></tr><tr><td>Pets [55]</td><td>Mean per class</td><td>37</td><td>3,680</td><td>3,669</td></tr><tr><td>SUN397[85]</td><td>Accuracy</td><td>397</td><td>19,850</td><td>19,850</td></tr><tr><td>Caltech-101[22]</td><td>Mean per class</td><td>102</td><td>3,060</td><td>6,085</td></tr><tr><td>Food-101 [5]</td><td>Accuracy</td><td>101</td><td>75,750</td><td>25,250</td></tr><tr><td>VOC2007[21]</td><td>Mean per class</td><td>20</td><td>5,011</td><td>4,952</td></tr></table>
|
| 386 |
+
|
| 387 |
+
Table 16: Details of the fine-grained linear classification datasets.
|
| 388 |
+
|
| 389 |
+
# B Additional Results
|
| 390 |
+
|
| 391 |
+
# B.1 Fine-grained classification
|
| 392 |
+
|
| 393 |
+
Table 17: Linear transfer results on fine-grained datasets. All results are with ViT-B/16. Results of StableRep are marked . Upper: different methods pre-trained on RedCaps. Middle: StableRep with different training schedules. Lower: OpenAI’s CLIP trained on WIT-400M dataset. Our StableRep trained with synthetic images only is approaching the performance of CLIP trained with 400 millions of real images.
|
| 394 |
+
|
| 395 |
+
<table><tr><td colspan="10">CIFAR-10</td><td colspan="3">Caltech-101 Food-101</td><td rowspan="2">VOC2007</td><td rowspan="2">Average</td></tr><tr><td></td><td></td><td></td><td>CIFAR-100</td><td>Aircraft 46.8</td><td>Cars Pre-training on Redcaps for 35 epochs</td><td>DTD</td><td>Flowers</td><td>Pets</td><td>SUN397</td><td></td><td></td><td></td></tr><tr><td colspan="10">SimCLR 90.2</td><td>82.7</td><td></td><td>81.3</td><td>80.9</td><td>73.9</td></tr><tr><td rowspan="4">3 </td><td>CLIP</td><td>94.2</td><td>72.0 78.9</td><td>52.9</td><td>42.8 74.9</td><td>77.9 73.9</td><td>94.6 97.8</td><td>83.0 91.6</td><td>61.2 66.2</td><td>91.6</td><td>89.2</td><td>85.4</td><td>81.5</td></tr><tr><td>SimCLR CLIP</td><td>85.1</td><td>65.4</td><td>48.7</td><td>53.7</td><td>74.6</td><td>95.0</td><td>79.6</td><td>61.8</td><td>84.5</td><td>79.7</td><td>80.4</td><td>73.5</td></tr><tr><td></td><td>88.7</td><td>71.4</td><td>53.7</td><td>77.3</td><td>76.0</td><td>96.9</td><td>88.2</td><td>67.3</td><td>90.3</td><td>83.7</td><td>84.5</td><td>79.8</td></tr><tr><td>StableRep</td><td>96.7</td><td>84.6</td><td>57.2</td><td>78.8</td><td>79.0</td><td>98.4</td><td>90.9</td><td>70.7</td><td>94.9</td><td>88.1</td><td>86.6</td><td> 84.2</td></tr><tr><td colspan="10">Longer training for StableRep</td><td></td><td>94.6</td><td>83.6</td><td>87.2</td><td></td></tr><tr><td>ar</td><td>35 epochs 105 epochs</td><td>96.2 96.7</td><td>84.1 84.7</td><td>58.3 59.2</td><td>80.9 83.5</td><td>78.1 80.1</td><td>97.2 97.3</td><td>87.5 88.3</td><td>73.0 74.3</td><td>94.7</td><td>85.1</td><td>87.9</td><td></td><td>83.7 84.7</td></tr><tr><td rowspan="3">seese</td><td>35 epochs 105 epochs</td><td>96.7</td><td>84.6</td><td>57.2</td><td>78.8</td><td>79.0</td><td>98.4</td><td>90.9</td><td>70.7</td><td>94.9</td><td>88.1</td><td></td><td></td><td>84.2</td></tr><tr><td></td><td>96.9</td><td>85.6</td><td>60.2</td><td>83.9</td><td>80.0</td><td></td><td>91.7</td><td></td><td></td><td></td><td></td><td>86.6 87.8</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td>98.5</td><td></td><td>72.5</td><td>94.8</td><td>89.4</td><td></td><td></td><td>85.6</td></tr><tr><td colspan="10"></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td colspan="10">OpenAI's CLIP trained on WIT-400M (numbers copied from [</td><td></td><td></td><td>[58])</td><td></td><td></td><td></td></tr><tr><td></td><td>WIT- 400M</td><td>96.2</td><td>83.1</td><td>59.5</td><td>86.7</td><td>79.2</td><td>98.1</td><td></td><td>93.1</td><td>78.4</td><td>94.7</td><td>92.8</td><td>89.2</td><td>86.5</td></tr></table>
|
| 396 |
+
|
| 397 |
+
In Table 17, we further present the fine-grained linear classification results by models from RedCaps or models that are trained longer ( $2 \mathbf { x }$ or $3 \mathbf { x }$ longer). When pre-training on RedCaps, StableRep achieves the best average accuracy. Longer training of StableRep further improves transferability. Notably, our StableRep trained with synthetic images only is approaching the performance of OpenAI’s CLIP trained with 400 millions of real images.
|
| 398 |
+
|
| 399 |
+
# B.2 Few-shot image classification
|
| 400 |
+
|
| 401 |
+
We further summarizes the few-shot image classification results in Table 18. The $9 5 \%$ confidence interval is provided. StableRep stands out on the majority of the evaluated datasets.
|
| 402 |
+
|
| 403 |
+
<table><tr><td colspan="10"></td></tr><tr><td></td><td>CIFAR-10</td><td>CIFAR-100</td><td>Aircraft</td><td>Cars Pre-training on cc12m</td><td>DTD</td><td></td><td>Flowers</td><td>Pets</td><td>SUN397</td><td>Caltech-101</td><td>Food-101 Average</td></tr><tr><td></td><td></td></tr><tr><td>R</td><td>SimCLR CLIP</td><td></td><td></td><td></td><td>64.0±0.7 70.4±0.8 40.7±0.9 50.9±0.8 82.2±0.6 92.1±0.5 74.4±0.8 94.0±0.4 90.4±0.5 70.4±0.7 77.5±0.6 82.1±0.7 62.0±1.0 90.9±0.5 83.3±0.6 97.6±0.2 91.1±0.5 97.2±0.2 98.2±0.2 87.0±0.5</td><td></td><td></td><td></td><td></td><td></td><td>73.0</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>86.7</td></tr><tr><td>s</td><td>SimCLR</td><td></td><td></td><td></td><td>50.0±0.6 58.9±0.8 45.2±1.0 54.2±0.8 79.8±0.6 92.0±0.5 74.6±0.8 92.9±0.4 89.1±0.6 71.0±0.7</td><td></td><td></td><td></td><td></td><td></td><td>70.8</td></tr><tr><td>CLIP StableRep</td><td></td><td></td><td></td><td>63.1±0.6 73.5±0.7 61.3±1.0 92.5±0.4 81.7±0.6 96.9±0.3 91.5±0.5 96.7±0.2 96.8±0.3 82.5±0.6</td><td></td><td></td><td></td><td></td><td></td><td>92.3±0.3 91.8±0.5 62.6±1.0 91.8±0.5 86.4±0.5 98.2±0.2 91.7±0.5 97.3±0.2 98.8±0.2 87.3±0.5</td><td>83.7</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>89.8</td></tr><tr><td></td><td></td><td></td><td></td><td>Pre-training on redcaps</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>R</td><td>SimCLR CLIP</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>62.3±0.6 69.4±0.7 39.6±0.9 51.0±0.8 82.7±0.6 94.8±0.4 85.4±0.6 91.8±0.5 88.5±0.6 79.1±0.7 80.6±0.5 85.3±0.6 54.5±0.9 88.5±0.6 82.6±0.6 99.0±0.1 94.5±0.4 95.9±0.3 97.8±0.2 94.4±0.3</td><td>74.5</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>87.3</td></tr><tr><td>s</td><td>SimCLR CLIP</td><td></td><td></td><td></td><td></td><td>52.9±0.6 60.8±0.8 40.9±0.9 53.2±0.8 79.5±0.6 94.3±0.4 78.3±0.7 92.0±0.4 88.9±0.5 75.9±0.7</td><td></td><td></td><td></td><td></td><td>71.7</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>65.7±0.6 75.7±0.7 55.2±1.0 90.1±0.5 82.6±0.6 98.2±0.2 92.0±0.5 96.3±0.3 96.9±0.3 88.1±0.5</td><td>84.1</td></tr><tr><td></td><td>StableRep</td><td>92.7±0.3 92.9±0.4 57.3±1.0 89.4±0.6 86.2±0.5 99.2±0.1 94.5±0.4 96.8±0.3 98.9±0.2 91.8±0.4</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>90.0</td></tr></table>
|
| 404 |
+
|
| 405 |
+
Table 18: Few-shot image classification results with $9 5 \%$ confidence interval provided. All models here are trained for 35 epochs. Upper: pre-training on CC12M dataset. Upper: pre-training on RedCaps dataset.
|
| 406 |
+
|
| 407 |
+
# C Image Generation
|
| 408 |
+
|
| 409 |
+
# C.1 Implementation details
|
| 410 |
+
|
| 411 |
+
We use Stable Diffusion [61] v1.5. During sampling, we generate images by 50 DDIM [74] steps. To accelerate the generation process, we leverage xFormers library for efficient attention computation, which brings down the sampling time to ${ \sim } 0 . 8 s$ per image on a single A100 GPU and ${ \sim } 2 . 3 \mathrm { s }$ per image on a V100 GPU.
|
| 412 |
+
|
| 413 |
+
Image resolution. The image resolution may affect the quality of representations learned by selfsupervised learning algorithms. We try to make a relative fair comparison by storing all synthetic and real images in similar resolutions. The synthetic images generated by Stable Diffusion are $5 1 2 \times 5 1 2$ ; we resized them to $2 5 6 \times 2 5 6$ before storing them on the disk. The real images have various sizes, ranging from less than a hundred of pixels in shorter side to thousands of pixels; we resize the shorter side of all real images to 256.
|
| 414 |
+
|
| 415 |
+
# C.2 Generation examples
|
| 416 |
+
|
| 417 |
+
Some examples of synthetic images are visualized in Figure 8.
|
| 418 |
+
|
| 419 |
+
# D Computation
|
| 420 |
+
|
| 421 |
+
Synthesis. The slowest part of the StableRep pipeline is the image generation. We use 512 V100 GPUs to synthesize images, which takes ${ \sim } 1 3$ hours for every ten million images.
|
| 422 |
+
|
| 423 |
+
Pre-training. Each of our StableRep models with ViT-B/16 is trained on 4 nodes, each of which has 8 A100 GPUs and 96 CPU cores. It takes ${ \sim } 2 0$ hours to complete 35 SimCLR-equivalent epochs of training on CC12M and ${ \sim } 2 3$ hours on RedCaps. For ViT-L/16, we use 64 A100 80GB GPUs spread over 8 nodes.
|
| 424 |
+
|
| 425 |
+

|
| 426 |
+
Figure 8: Examples of synthetic images. We show examples for 4 different text prompts. For each prompt, we provide examples synthesized with different guidance scale $w$ , as well as the original real image.
|
md/dev/yhlMZ3iR7Pu/yhlMZ3iR7Pu.md
ADDED
|
@@ -0,0 +1,354 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Diffusion models as plug-and-play priors
|
| 2 |
+
|
| 3 |
+
Alexandros Graikos Stony Brook University Stony Brook, NY agraikos@cs.stonybrook.edu
|
| 4 |
+
|
| 5 |
+
Nikolay Malkin
|
| 6 |
+
Mila, Université de Montréal Montréal, QC, Canada
|
| 7 |
+
nikolay.malkin@mila.quebec
|
| 8 |
+
Nebojsa Jojic
|
| 9 |
+
Microsoft Research
|
| 10 |
+
Redmond, WA
|
| 11 |
+
jojic@microsoft.com
|
| 12 |
+
|
| 13 |
+
Dimitris Samaras Stony Brook University Stony Brook, NY samaras@cs.stonybrook.edu
|
| 14 |
+
|
| 15 |
+
# Abstract
|
| 16 |
+
|
| 17 |
+
We consider the problem of inferring high-dimensional data $\mathbf { x }$ in a model that consists of a prior $p ( \mathbf { x } )$ and an auxiliary differentiable constraint $c ( \mathbf { x } , \mathbf { y } )$ on $\mathbf { x }$ given some additional information $\mathbf { y }$ . In this paper, the prior is an independently trained denoising diffusion generative model. The auxiliary constraint is expected to have a differentiable form, but can come from diverse sources. The possibility of such inference turns diffusion models into plug-and-play modules, thereby allowing a range of potential applications in adapting models to new domains and tasks, such as conditional generation or image segmentation. The structure of diffusion models allows us to perform approximate inference by iterating differentiation through the fixed denoising network enriched with different amounts of noise at each step. Considering many noised versions of x in evaluation of its fitness is a novel search mechanism that may lead to new algorithms for solving combinatorial optimization problems. The code is available at https://github.com/AlexGraikos/diffusion_priors.
|
| 18 |
+
|
| 19 |
+
# 1 Introduction
|
| 20 |
+
|
| 21 |
+
Deep generative models, such as denoising diffusion probabilistic models [DDPMs; 39, 13] can capture the details of very complex distributions over high-dimensional continuous data $p ( \mathbf { x } )$ [30, 7, 1, 38, 43, 15]. The immense effective depth of DDPMs, sometimes with thousands of deep network evaluations in the generation process, is an apparent limitation on their use as off-the-shelf modules in hierarchical generative models, where models can be mixed and one model may serve as a prior for another conditional model. In this paper, we show that DDPMs trained on image data can be directly used as priors in systems that involve other differentiable constraints.
|
| 22 |
+
|
| 23 |
+
In our main problem setting, we assume that we have a prior $p ( \mathbf { x } )$ over high-dimensional data $\mathbf { x }$ and we wish to perform inference in a model that involves this prior and a constraint $c ( \mathbf { x } , \mathbf { y } )$ on $\mathbf { x }$ given some additional information y. That is, we want to find an approximation to the posterior distribution $p ( \mathbf x | \mathbf y ) \propto p ( \mathbf x ) c ( \mathbf x , \mathbf y )$ . In this paper, $p ( \mathbf { x } = \mathbf { x } _ { 0 } , \mathbf { h } = \{ \mathbf { x } _ { T } , . . . , \mathbf { x } _ { 1 } \} )$ is provided in the form of an independently trained DDPM over $\mathbf { x } _ { T } , \ldots , \mathbf { x } _ { 0 }$ (§2.2), making the DDPM a ‘plug-and-play’ prior.
|
| 24 |
+
|
| 25 |
+
Although the recent community interest in DDPMs has spurred progress in training algorithms and fast generation schedules [30, 37, 45], the possibility of their use as plug-and-play modules has not been explored. Furthermore, as opposed to existing work on plug-and-play models (starting from [29]), the algorithms we propose do not require additional training or finetuning of model components or inference networks.
|
| 26 |
+
|
| 27 |
+
One obvious application of plug-and-play priors is conditional image generation $( \ S 3 . 1 , \ S 3 . 2 )$ . For example, a denoising diffusion model trained on MNIST digit images might define $p ( \mathbf { x } )$ , while the constraint $c ( \mathbf { x } , \mathbf { y } )$ may be be the probability of digit class y under an off-the-shelf classifier. However, changing the semantics of $\mathbf { x }$ , we can also use such models for inference tasks where neural networks struggle with domain adaptation, such as image segmentation: $c ( \mathbf { x } , \mathbf { y } )$ constrains the segmentation $\mathbf { x }$ to match an appearance or a weak labeling y (§4). Finally, we describe a path towards using DDPM priors to solve continuous relaxations of combinatorial search problems by treating $\mathbf { y }$ as a latent variable with combinatorial structure that is deterministically encoded in $\mathbf { x }$ (§5).
|
| 28 |
+
|
| 29 |
+
# 1.1 Related work
|
| 30 |
+
|
| 31 |
+
Conditioning DDPMs. DDPMs have previously been used for conditional generation and image segmentation [36, 42, 1]. With few exceptions – such as [3], which uses a pretrained DDPM as a feature extractor – these algorithms assume access to paired data and conditioning information during training of the DDPM model. In [7], a classifier $p ( y \mid \mathbf { x } _ { t } )$ that guides the denoising model towards the desired subset of images with the attribute $y$ is trained in parallel with the denoiser. In [5], generation is conditioned on an auxiliary image by guiding the denoising process through correction steps that match the low-frequency components of the generated and conditioning images. In contrast, we aim to build models that combine an independently trained DDPM with an auxiliary constraint.
|
| 32 |
+
|
| 33 |
+
Our approach is also related to work on adversarial examples. Adversarial samples are produced by optimizing an image x to satisfy a desired constraint $c - { \mathrm { a } }$ classifier $p ( \mathbf { y } \vert \mathbf { x } )$ – without reference to the prior over data. As supervised learning algorithms can ignore the structure in data $\mathbf { x }$ , focusing only on the conditional distribution, it is possible to optimize for input $\mathbf { x }$ that provides the desired classification in various surprising ways [41]. In [31], a diffusion model is used to defend from adversarial samples by making images more likely under a DDPM $p ( \mathbf { x } )$ . We are instead interested in inference, where we seek samples $\mathbf { x }$ that satisfy both the classifier and the prior. (Our work may, however, have consequences for adversarial generation.)
|
| 34 |
+
|
| 35 |
+
Conditional generation from unconditional models. Works that preceded the recent popularity of DDPMs [29, 9] show how an unconditional generative model, such as a generative adversarial network [GAN; 11] or variational autoencoder [VAE; 21], can be combined with a constraint model to generate conditional samples. Regarding generative diffusion models, recent literature has focused on utilizing unconditional, pretrained DDPMs as priors to solve linear inverse imaging problems. Both in [40] and [20], the authors modify the DDPM sampling algorithm, with knowledge of the linear degradation operator, to reconstruct an image consistent with the learned prior and given measurements. A generalization of these methods in [18] shows how any pretrained denoising network can be used as the prior for solving linear inverse problems. We also clarify that although the term ‘plug-and-play’ is widely used in the inverse imaging literature we refer to it in the scope of in-domain generation under differentiable constraints, in the same sense as [29].
|
| 36 |
+
|
| 37 |
+
Latent vectors in DDPMs. Modeling the latent prior distribution in VAE-like models using a DDPM has been studied in [38, 43]. On the other hand, in $\ S 5$ , we perform inference in the lowdimensional latent space under a pretrained DDPM on a high-dimensional data space. Our approach to semantic segmentation $( \ S 4 )$ is also related to [34], where a prior $p ( \mathbf { z } )$ over latents is used to tune a posterior network $q ( \mathbf { z } | \mathbf { x } )$ . There, the priors are of relatively simple structure and are sample-specific, rather than global diffusion priors like in this paper.
|
| 38 |
+
|
| 39 |
+
# 2 Method
|
| 40 |
+
|
| 41 |
+
# 2.1 Problem setting
|
| 42 |
+
|
| 43 |
+
Recall that we want to find an approximation to the posterior distribution $p ( \mathbf { x } | \mathbf { y } ) \propto p ( \mathbf { x } ) c ( \mathbf { x } , \mathbf { y } )$ , where $p ( \mathbf { x } )$ is a fixed prior distribution. Fixing $\mathbf { y }$ and introducing an approximate variational posterior $q ( \mathbf { x } )$ , the free energy
|
| 44 |
+
|
| 45 |
+
$$
|
| 46 |
+
F = - \mathbb { E } _ { q ( \mathbf { x } ) } [ \log p ( \mathbf { x } ) + \log c ( \mathbf { x } , \mathbf { y } ) - \log q ( \mathbf { x } ) ]
|
| 47 |
+
$$
|
| 48 |
+
|
| 49 |
+
is minimized when $q ( \mathbf { x } )$ is closest to the true posterior, i.e., when $\mathrm { K L } ( q ( \mathbf { x } ) \| p ( \mathbf { x } | \mathbf { y } ) )$ is minimized. When $q ( \mathbf { x } )$ , and the learning algorithm used to fit it, are expressive enough to capture the true posterior, this minimization yields the exact posterior $p ( \mathbf { x } | \mathbf { y } )$ . Otherwise, $q$ will capture a ‘modeseeking’ approximation to the true posterior [27]; in particular, if $q ( \mathbf { y } )$ is a Dirac delta, it is optimal to concentrate $q$ at the mode of $p ( \mathbf { x } | \mathbf { y } )$ . When the prior involves latent variables $\mathbf { h }$ (i.e., $p ( \mathbf { x } ) =$ $\begin{array} { r l r } { \int _ { \mathbf { h } } p ( \mathbf { x } | \mathbf { h } ) p ( \mathbf { h } ) \bar { d } \mathbf { h } ) } \end{array}$ , the free energy is
|
| 50 |
+
|
| 51 |
+
$$
|
| 52 |
+
\begin{array} { r l } & { F = - \mathbb { E } _ { q ( \mathbf { x } ) q ( \mathbf { h } | \mathbf { x } ) } [ \log p ( \mathbf { x } , \mathbf { h } ) + \log c ( \mathbf { x } , \mathbf { y } ) - \log q ( \mathbf { x } ) q ( \mathbf { h } | \mathbf { x } ) ] } \\ & { \quad = - \mathbb { E } _ { q ( \mathbf { x } ) q ( \mathbf { h } | \mathbf { x } ) } [ \log p ( \mathbf { x } , \mathbf { h } ) - \log q ( \mathbf { x } ) q ( \mathbf { h } | \mathbf { x } ) ] - \mathbb { E } _ { q ( \mathbf { x } ) } [ \log c ( \mathbf { x } , \mathbf { y } ) ] . } \end{array}
|
| 53 |
+
$$
|
| 54 |
+
|
| 55 |
+
We are, in particular, interested in a general procedure for minimizing $F$ with respect to an approximate posterior $q ( \mathbf { x } )$ for any differentiable $c$ when $p$ is a DDPM $( \ S 2 . 2 )$ .
|
| 56 |
+
|
| 57 |
+
A free energy of the same structure was also studied in [43], where a DDPM $p ( \mathbf { z } )$ over a latent space is hybridized as a parent to a decoder $p ( \mathbf { x } | \mathbf { z } )$ , with an additional inference model $q ( \mathbf { z } | \mathbf { x } )$ trained jointly with both of these models. On the other hand, we aim to work with independently trained components that operate directly in the pixel space, e.g., an off-the-shelf diffusion model $p ( \mathbf { x } )$ trained on images of faces and an off-the-shelf face classifier $p ( \mathbf { y } \vert \mathbf { x } )$ , without training or finetuning them jointly (§3.2).
|
| 58 |
+
|
| 59 |
+
# 2.2 Denoising diffusion probabilistic models as priors
|
| 60 |
+
|
| 61 |
+
Denoising diffusion probabilistic models (DDPMs) [39, 13] generate samples $\mathbf { x } _ { \mathrm { 0 } }$ by reversing a (Gaussian) noising process. DDPMs are deep directed stochastic networks:
|
| 62 |
+
|
| 63 |
+
$$
|
| 64 |
+
\begin{array} { r l } { p ( { \mathbf x } _ { T } , { \mathbf x } _ { T - 1 } , . . . , { \mathbf x } _ { 0 } ) = p ( { \mathbf x } _ { T } ) \displaystyle \prod _ { t = 1 } ^ { T } p _ { \theta } ( { \mathbf x } _ { t - 1 } \mid { \mathbf x } _ { t } ) , } & { } \\ { p _ { \theta } ( { \mathbf x } _ { t - 1 } \mid { \mathbf x } _ { t } ) = \mathcal { N } ( { \mathbf x } _ { t - 1 } ; \mu _ { \theta } ( { \mathbf x } _ { t } , t ) , { \boldsymbol \Sigma } _ { \theta } ( { \mathbf x } _ { t } , t ) ) , \qquad } & { p ( { \mathbf x } _ { T } ) = \mathcal { N } ( \mathbf { 0 } , \mathbf { I } ) , } \end{array}
|
| 65 |
+
$$
|
| 66 |
+
|
| 67 |
+
where $\mu _ { \theta }$ and $\Sigma _ { \theta }$ are neural networks with learned parameters (often, as in this paper, $\Sigma _ { \theta }$ is fixed to a scalar diagonal matrix depending on $t$ ). The model starts with a sample from a unit Gaussian $\mathbf { x } _ { T }$ and successively transforms it with a nonlinear network $\mu _ { \theta } ( \mathbf { x } _ { t } , t )$ adding a small Gaussian innovation signal at each step according to a noise schedule. After $T$ steps, the sample $\mathbf { x } = \mathbf { x } _ { 0 }$ is obtained.
|
| 68 |
+
|
| 69 |
+
In general, using such a model as a prior over $\mathbf { x }$ would require an intractable integration over latent variables $\mathbf { h } = ( \mathbf { x } _ { T } , . . . , \mathbf { x } _ { 1 } )$ :
|
| 70 |
+
|
| 71 |
+
$$
|
| 72 |
+
p ( \mathbf { x } ) = \int _ { \mathbf { h } } p ( \mathbf { x } _ { T } , \mathbf { x } _ { T - 1 } , . . . , \mathbf { x } _ { 1 } , \mathbf { x } _ { 0 } = \mathbf { x } ) d \mathbf { x } _ { T } \cdot . . . d \mathbf { x } _ { 1 } .
|
| 73 |
+
$$
|
| 74 |
+
|
| 75 |
+
However, DDPMs are trained under the assumption that the posterior $q \big ( \mathbf { x } _ { t } | \mathbf { x } _ { t - 1 } \big )$ is a simple diffusion process that successively adds Gaussian noise according to a predefined schedule $\beta _ { t }$ :
|
| 76 |
+
|
| 77 |
+
$$
|
| 78 |
+
q ( \mathbf { x } _ { t } \mid \mathbf { x } _ { t - 1 } ) = { \mathcal { N } } ( \mathbf { x } _ { t } ; { \sqrt { 1 - { \beta _ { t } } } } \mathbf { x } _ { t - 1 } , \beta _ { t } \mathbf { I } ) , \quad t = 1 , \ldots , T .
|
| 79 |
+
$$
|
| 80 |
+
|
| 81 |
+
Therefore, if $p ( \mathbf { x } )$ is the likelihood (5) of $\mathbf { x }$ under a DDPM, then in the first expectation of (2) we should use $q ( \mathbf { h } = \{ \mathbf { x } _ { T } , . . . , \mathbf { x } _ { 1 } \} | \mathbf { x } _ { 0 } = \mathbf { x } ) = \prod _ { t = 1 } ^ { T } q ( \mathbf { x } _ { t } \mid \mathbf { x } _ { t - 1 } )$ . The simplest approximation to the posterior over $\mathbf { x } = \mathbf { x } _ { 0 }$ is a point estimate:
|
| 82 |
+
|
| 83 |
+
$$
|
| 84 |
+
q ( \mathbf { x } ) = \delta ( \mathbf { x } - \pmb { \eta } )
|
| 85 |
+
$$
|
| 86 |
+
|
| 87 |
+
where by $\delta$ we denote the Dirac delta function. Thus, we can sample $\mathbf { x } _ { t }$ at any arbitrary time step using the forward noising process as
|
| 88 |
+
|
| 89 |
+
$$
|
| 90 |
+
\begin{array} { r } { q ( \mathbf { x } _ { t } ) = \mathcal { N } ( \mathbf { x } _ { t } ; \sqrt { \bar { \alpha } _ { t } } \pmb { \eta } , ( 1 - \bar { \alpha } _ { t } ) \mathbf { I } ) } \end{array}
|
| 91 |
+
$$
|
| 92 |
+
|
| 93 |
+
where $\alpha _ { t } = 1 - \beta _ { t }$ and $\textstyle { \bar { \alpha } } _ { t } = \prod _ { i = 1 } ^ { t } \alpha _ { t }$ . Analogously to [13], we can also extract a conditional Gaussian $q ( \mathbf { x } _ { t - 1 } \mid \mathbf { x } _ { t } , \pmb { \eta } )$ and express the first expectation in (2) as
|
| 94 |
+
|
| 95 |
+
$$
|
| 96 |
+
- \mathbb { E } _ { q ( \mathbf { x } ) q ( \mathbf { h } \mid \mathbf { x } ) } [ \log p ( \mathbf { x } , \mathbf { h } ) - \log q ( \mathbf { x } ) q ( \mathbf { h } \mid \mathbf { x } ) ] = \sum _ { t } { \mathrm { K L } } ( q ( \mathbf { x } _ { t - 1 } \mid \mathbf { x } _ { t } , \eta ) \parallel p _ { \theta } ( \mathbf { x } _ { t - 1 } \mid \mathbf { x } _ { t } ) ) ,
|
| 97 |
+
$$
|
| 98 |
+
|
| 99 |
+
which after reparametrization [13] leads to
|
| 100 |
+
|
| 101 |
+
$$
|
| 102 |
+
\sum _ { t } w _ { t } ( \beta ) \mathbb { E } _ { \epsilon \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { I } ) } [ \| \epsilon - \epsilon _ { \theta } ( \mathbf { x } _ { t } , t ) \| _ { 2 } ^ { 2 } ] , \quad \mathbf { x } _ { t } = \sqrt { \bar { \alpha } _ { t } } \eta + \sqrt { 1 - \bar { \alpha } _ { t } } \epsilon ,
|
| 103 |
+
$$
|
| 104 |
+
|
| 105 |
+
Algorithm 1 Inferring a point estimate of $p ( \mathbf { x } | \mathbf { y } ) \approx \delta ( \mathbf { x } - \pmb { \eta } )$ , under a DDPM prior and constraint.
|
| 106 |
+
|
| 107 |
+
input pretrained DDPM $\epsilon _ { \theta }$ , auxiliary data $\mathbf { y }$ , constraint $c$ , time schedule $( t _ { i } ) _ { i = 1 } ^ { T }$ , learning rate $\lambda$ 1: Initialize $\mathbf { x } \sim \mathcal { N } ( \mathbf { 0 ; I } )$ .
|
| 108 |
+
|
| 109 |
+
2: for $i = T . . 1$ do
|
| 110 |
+
3: Sample $\mathbf { \epsilon } \epsilon \sim \mathcal { N } ( \mathbf { 0 ; I } )$
|
| 111 |
+
4: $\mathbf { x } _ { t _ { i } } = \sqrt { \bar { \alpha } _ { t _ { i } } } \mathbf { x } + \sqrt { 1 - \bar { \alpha } _ { t _ { i } } } \epsilon$
|
| 112 |
+
5: $\mathbf { x } \mathbf { x } - \lambda \nabla _ { \mathbf { x } } [ \| \epsilon - \epsilon _ { \theta } ( \mathbf { x } _ { t _ { i } } , t _ { i } ) \| _ { 2 } ^ { 2 } - \log c ( \mathbf { x } , \mathbf { y } ) ]$
|
| 113 |
+
6: end for
|
| 114 |
+
|
| 115 |
+
output $\mathbf { \eta } _ { \eta } = \mathbf { x }$
|
| 116 |
+
|
| 117 |
+
where the stage $t$ noise reconstruction $\epsilon _ { \theta } ( \mathbf { x } _ { t } , t )$ is a linear transformation of the model’s expectation $\mu _ { \theta } ( \mathbf { x } _ { t } , t )$ :
|
| 118 |
+
|
| 119 |
+
$$
|
| 120 |
+
{ \pmb \mu } _ { \theta } ( { \bf x } _ { t } , t ) = \frac { 1 } { \sqrt { \alpha _ { t } } } \left( { \bf x } _ { t } - \frac { \beta _ { t } } { \sqrt { 1 - \bar { \alpha } _ { t } } } { \pmb \epsilon } _ { \theta } ( { \bf x } _ { t } , t ) \right) .
|
| 121 |
+
$$
|
| 122 |
+
|
| 123 |
+
The weighting $w _ { t } ( \beta )$ is generally a function of the noise schedule, but in most pretrained diffusion models it is set to 1. Thus, the free energy in (2) reduces to
|
| 124 |
+
|
| 125 |
+
$$
|
| 126 |
+
\begin{array} { l } { F = \displaystyle \sum _ { t } \mathbb { E } _ { \epsilon \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { I } ) } [ \| \epsilon - \epsilon _ { \theta } ( \mathbf { x } _ { t } , t ) \| _ { 2 } ^ { 2 } ] - \mathbb { E } _ { q ( \mathbf { x } ) } [ \log c ( \mathbf { x } , \mathbf { y } ) ] } \\ { = \displaystyle \sum _ { t } \mathbb { E } _ { \epsilon \sim \mathcal { N } ( \mathbf { 0 } , \mathbf { I } ) } [ \| \epsilon - \epsilon _ { \theta } ( \mathbf { x } _ { t } , t ) \| _ { 2 } ^ { 2 } ] - \log c ( \eta , \mathbf { y } ) , \quad \mathbf { x } _ { t } = \sqrt { \bar { \alpha } _ { t } } \eta + \sqrt { 1 - \bar { \alpha } _ { t } } \epsilon . } \end{array}
|
| 127 |
+
$$
|
| 128 |
+
|
| 129 |
+
The first term is the cost usually used to learn the parameters $\theta$ of the diffusion model. To perform inference under an already trained model $\epsilon _ { \theta }$ , we instead minimize $F$ with respect to $\eta$ through sampling $\epsilon$ in the summands over $t$ .
|
| 130 |
+
|
| 131 |
+
A similar derivation applies if a Gaussian approximation to the posterior $q ( \mathbf { x } )$ is used (see $\ S \mathrm { A }$ ). Such an approximation allows to model not only a mode of the posterior, but the uncertainty in its vicinity.
|
| 132 |
+
|
| 133 |
+
We summarize the algorithm for a point estimate $q ( \mathbf { x } )$ as Algorithm 1. Variations on this algorithm are possible. Depending on how close to a good mode we can initialize $\eta$ , this optimization may involve summing only over $t \leq t _ { \operatorname* { m a x } } < T$ ; different time step schedules can be considered depending on the desired diversity in the estimated x. Note that optimization is stochastic and each time it is run it can produce different point estimates of $\mathbf { x }$ which are are both likely under the diffusion prior and satisfy the constraint as much as possible.
|
| 134 |
+
|
| 135 |
+
We observed that optimizing simultaneously for all $t$ makes it difficult to guide the sample towards a mode in image generation applications; therefore, we anneal $t$ from high to low values. Intuitively, the first few iterations of gradient descent should coarsely explore the search space, while later iterations gradually reduce the temperature to steadily reach a nearby local maximum of $p ( \mathbf { x } | \mathbf { y } )$ . Examples of annealing schedules designed for the tasks demonstrated in $\ S 3 , 4 , 5$ are presented in the Appendix (Fig. B.1).
|
| 136 |
+
|
| 137 |
+
Another interesting case is when $\mathbf { x }$ is parametrized through a latent variable (this can be seen as a case of a hard, non-differentiable constraint: if $\mathbf { x }$ is a deterministic function of $\mathbf { y }$ , $\mathbf { x } = f ( \mathbf { y } )$ , then $c ( \mathbf { x } , \mathbf { y } )$ is supported on the corresponding manifold). Then the procedure in Algorithm 1 can be performed with gradient descent steps with respect to $\mathbf { y }$ on
|
| 138 |
+
|
| 139 |
+
$$
|
| 140 |
+
\| \epsilon - \epsilon _ { \theta } \big ( \sqrt { \bar { \alpha } _ { t _ { i } } } f ( \mathbf { y } ) + \sqrt { 1 - \bar { \alpha } _ { t _ { i } } } \epsilon , t _ { i } \big ) \| _ { 2 } ^ { 2 }
|
| 141 |
+
$$
|
| 142 |
+
|
| 143 |
+
instead of steps 4 and 5. (For some semantics of the latent representation, one may wish to make the prior on $\mathbf { x }$ the pushforward by $f$ of a known prior on the latent $\mathbf { y }$ . In this case, (13) must be weighted by the Jacobian of $f$ at y.)
|
| 144 |
+
|
| 145 |
+
# 3 Experiments: Conditional image generation
|
| 146 |
+
|
| 147 |
+
# 3.1 Simple illustration on MNIST
|
| 148 |
+
|
| 149 |
+
We first explore the idea of generating conditional samples from an unconditional diffusion model on MNIST. We train the DDPM model of [7] on MNIST digits and experiment with different sets of constraints $\log c ( \mathbf { x } , \mathbf { y } )$ to generate samples with specific attributes. The examples in Fig. 1 showcase such generated samples. For the digit in (a) we set the constraint $\log c$ to be the unnormalized score of ‘thin’ digits, computed as negative of the average image intensity, whereas in (b) we invert that and generate a ‘thick’ digit with high mean intensity. Similarly, in (c) and (d) we hand-craft a score that penalizes the vertical and horizontal symmetry respectively, by computing the $L ^ { 2 }$ distance between the two folds (vertical/horizontal) of the digit $\mathbf { x }$ , which leads to the generation of skewed, non-symmetric samples.
|
| 150 |
+
|
| 151 |
+

|
| 152 |
+
Figure 1: Inferred MNIST samples under different conditions $c ( \mathbf { x } , \mathbf { y } )$ .
|
| 153 |
+
|
| 154 |
+
We also showcase how the auxiliary constraint $c ( \mathbf { x } , \mathbf { y } )$ can be modeled by a different, independently trained network. The digit in Fig. 1 (e) is generated by constraining the DDPM with a classifier network that is separately trained to distinguish between the digit class $\mathbf y = 3$ and all other digits. The auxiliary constraint in this case is the likelihood of the inferred digit, as it is estimated by the classifier. Finally, for (f) we multiply horizontal symmetry and digit classifier constraints, prompting the inference procedure to generate a perfectly centered and symmetric digit. Details of model training and inference can be found in the Appendix $( \ S \mathbf { B } . 1 )$ .
|
| 155 |
+
|
| 156 |
+
# 3.2 Using off-the-shelf components for conditional generation of faces
|
| 157 |
+
|
| 158 |
+
We consider the generation of natural images with a pretrained DDPM prior and a learned constraint. We utilize the pretrained DDPM network on FFHQ-256 [19] from [3] and a pretrained ResNet-18 face attribute classifier on CelebA [25]. The attribute classifier computes the likelihood of presence of various facial features $y$ in a given image x, as they are defined by the CelebA dataset. Examples of such features are no beard, smiling, blond hair and male. To generate a conditional sample from the unconditional DDPM network we select a subset of these and enforce their presence or absence using the classifier predicted likelihoods as our constraint $c$ . If $\mathbf { y }$ is a set of attributes we wish to be present, the constraint $\log c ( \mathbf { x } , \mathbf { y } )$ can be expressed as
|
| 159 |
+
|
| 160 |
+
$$
|
| 161 |
+
\log c ( \mathbf { x } , \mathbf { y } ) = \sum _ { y \in \mathbf { y } } \log p ( y \mid \mathbf { x } )
|
| 162 |
+
$$
|
| 163 |
+
|
| 164 |
+
We only strictly enforce a small subset of facial attributes and therefore $\mathbf { x }$ is allowed to converge towards different modes that correspond to samples that exhibit, in varying levels, the desired features.
|
| 165 |
+
|
| 166 |
+
In Fig. 2 we demonstrate our ability to infer conditional samples $\mathbf { x }$ with desired attributes y, using only the unconditional diffusion model and the classifier $p ( \mathbf { y } \mid \mathbf { x } )$ . In the first row, we show the results of the optimization procedure of Algorithm 1 for various attributes. The classifier objective $c ( \mathbf { x } , \mathbf { y } )$ manipulates the image with the goal of making the classifier network produce the desired attribute predictions, whereas the diffusion objective attempts to pull the sample $x$ towards the learned distribution $p ( \mathbf { x } )$ . If we ignored the denoising loss, the result would be some adversarial noise that fools the classifier network. The DDPM prior, however, is strong enough to guide the process towards realistic-looking images that simultaneously satisfy the classifier constraint set.
|
| 167 |
+
|
| 168 |
+
We notice that the generated samples $\mathbf { x }$ , although having converged towards a correct mode of $p ( \mathbf { x } )$ , still exhibit a noticeable amount of noise related to the optimization of classifier objective. To address that, inspired by [31], we simply denoise the image using the DDPM model alone, starting from the low noise level $t = 2 0 0$ so as to retain the overall structure. The results of this denoising are shown in the second row of Fig. 2.
|
| 169 |
+
|
| 170 |
+
In Fig. 3 we showcase the intermediate steps of the optimization process for inference with the conditions blond hair+smiling+not male, thus solving a problem like that studied in [8] using only independently trained attribute classifiers and an unconditional generative model of faces. The sample $x$ is initialized with Gaussian noise $\mathcal { N } ( \mathbf { 0 } , \mathbf { I } )$ , and as we perform gradient steps with decreasing values of $t$ , we observe facial features being added in a coarse-to-fine manner.
|
| 171 |
+
|
| 172 |
+

|
| 173 |
+
Figure 2: First row: Conditional FFHQ samples $\mathbf { x }$ for constraints $c ( \mathbf { x } , \mathbf { y } )$ with various attribute sets y. Second row: denoising as in [31] to remove artifacts that appear when optimizing with a classifier network enforcing the constraint.
|
| 174 |
+
|
| 175 |
+

|
| 176 |
+
Figure 3: FFHQ conditional generation for $\mathbf { y } = \{ B l o n d e , S m i l i n g , F e m a l e \}$ . The last step performs denoising as in [31] to remove artifacts that appear when training on a classifier as a constraint.
|
| 177 |
+
|
| 178 |
+
In the Appendix $( \ S \mathbf { B } . 2 )$ we provide additional samples and further discuss the sample quality in comparison to unconditional generation. We also present results on inference with conflicting attributes as well as common failure cases.
|
| 179 |
+
|
| 180 |
+
# 4 Experiments: Semantic image segmentation
|
| 181 |
+
|
| 182 |
+
We test the applicability of diffusion priors in discrete tasks, such as inferring semantic segmentations from images. For this purpose, we use the EnviroAtlas dataset [32] which is composed of 5-class, 1m-resolution land cover labels from four geographically diverse cities across the US; Pittsburgh, PA, Durham, NC, Austin, TX and Phoenix, AZ. We only have access to the high resolution labels from Pittsburgh, and the task is to infer the land cover labels in the other three cities, given only probabilistic weak labels $\ell _ { \mathrm { w e a k } }$ derived from coarse auxiliary data [34]. We use Algorithm 1 to perform an inference procedure that does not directly take imagery as input, but uses constraints derived from unsupervised color clustering. We use only cluster indices in inference, making the algorithm dependent on image structure, but not color. Local cluster indices as a representation have a promise of extreme domain transferability, but they require a form of a combinatorial search which matches local cluster indices to semantic labels so that the created shapes resemble previously observed land cover, as captured by a denoising diffusion model of semantic segmentations.
|
| 183 |
+
|
| 184 |
+
DDPM on semantic pixel labels. We train a DDPM model on the $\textstyle { \frac { 1 } { 4 } }$ -resolution one-hot representations of the land cover labels, using the U-Net diffusion model architecture from [7]. To convert the one-hot diffusion samples to probabilities we follow [15] and assume that for any pixel $i$ in the inferred sample x, the distribution over the label $\ell$ is, $\begin{array} { r } { p ( \ell _ { i } ) \propto \int _ { 0 . 5 } ^ { 1 . 5 } \mathcal { N } ( x _ { i } ^ { \ell } \mid \eta _ { i } , \sigma ) } \end{array}$ , where $\sigma$ is user-defined a parameter. We chose this approach for its simplicity and ease to apply in our inference setting of Algorithm 1. Alternatively, we could use diffusion models for categorical data [14] with the appropriate modifications to our inference procedure. Samples drawn from the learned distribution are presented in Fig 4.
|
| 185 |
+
|
| 186 |
+
Inferring semantic segmentations. In order to infer the segmentation of a single image, under the diffusion prior, we directly apply Algorithm 1 with a hand-crafted constraint $c$ which provides structural and label guidance. To construct $c$ , we first compute a local color clustering $\mathbf { z }$ of input the image ( $\Re \mathrm { B } . 3$ in the Appendix). In addition, we utilize the available weak labels $\ell _ { \mathrm { w e a k } }$ [34] and force the predicted segments’ distribution to match the weak label distribution when averaged in non-overlapping blocks. We combine the two objectives in a single constraint $c ( { \bf x } , { \bf z } , \ell _ { \mathrm { w e a k } } )$ by (i) computing the mutual information between the color clustering $\mathbf { z }$ and the predicted labels $\mathbf { x }$ , transformed into a valid probability distribution from the inferred one-hot vectors, in overlapping image patches and (ii) computing the negative KL divergence between the average predicted distribution and the distribution given by the weak labels in non-overlapping blocks
|
| 187 |
+
|
| 188 |
+

|
| 189 |
+
Figure 4: Unconditional samples from the DDPM trained on land cover segmentations (cf. Fig. 5).
|
| 190 |
+
|
| 191 |
+

|
| 192 |
+
Figure 5: Segmentation inference results. The inferred segmentation $\mathbf { x }$ is initialized with the weak labels to reduce the number of steps needed. The samples are chosen from (top to bottom) Durham, NC, Austin, TX and Phoenix, AZ. Although AZ has a vastly different joint distribution of colors and labels, the inferred segmentation still captures the overall structure. Note that the inference algorithm does not use the pixel intensities in the input image, only an unsupervised color clustering.
|
| 193 |
+
|
| 194 |
+
$$
|
| 195 |
+
\begin{array} { r } { \log c ( \mathbf { x } , \mathbf { z } , \boldsymbol { \ell } _ { \mathrm { w e a k } } ) = \mathrm { M I } ( \mathbf { x } , \mathbf { z } ) - \mathrm { K L } ( \mathbf { x } \parallel \boldsymbol { \ell } _ { \mathrm { w e a k } } ) . } \end{array}
|
| 196 |
+
$$
|
| 197 |
+
|
| 198 |
+
Empirically, we find that we can reduce the number of optimization steps needed to perform inference by initializing the sample $\mathbf { x }$ with the weak labels $\ell _ { \mathrm { w e a k } }$ instead of random noise, allowing us to start from a smaller $t _ { i }$ . Examples of images and their inferred segmentations are shown in Fig. 5.
|
| 199 |
+
|
| 200 |
+
Domain transfer with inferred samples. The above inference procedure is agnostic to colors by design, and we expect it to have a greater ability to perform in new areas than the approach in [34], which still finetunes networks that take raw images as input. We also investigate domain transfer approaches where patches segmented using the the diffusion prior are used to train neural networks for fast inference. We pretrain a standard U-Net inference network $p ( \mathbf { x } \mid I )$ solely on $2 0 \mathrm { k }$ batches of 16 randomly sampled $6 4 \times 6 4$ image patches in PA. We randomly sample 640 images in each of the other geographies and generate semantic segmentations using our inference procedure, then finetune the inference network on these segmentations. This network is then evaluated on the entire target geography.
|
| 201 |
+
|
| 202 |
+
Table 1: Accuracies and class mean intersection-over-union scores on the EnviroAtlas dataset in various geographic domains. The model in the second-to-last row was pretrained in a supervised way on labels in the Pittsburgh, PA, region.
|
| 203 |
+
|
| 204 |
+
<table><tr><td rowspan="2">Algorithm</td><td colspan="2">Durham, NC</td><td colspan="2">Austin, TX</td><td colspan="2">Phoenix, AZ</td></tr><tr><td>Acc %</td><td>IoU %</td><td>Acc %</td><td>IoU %</td><td>Acc %</td><td>IoU %</td></tr><tr><td>PA supervised</td><td>74.2</td><td>35.9</td><td>71.9</td><td>36.8</td><td>6.7</td><td>13.4</td></tr><tr><td>PA supervised + weak</td><td>78.9</td><td>47.9</td><td>77.2</td><td>50.5</td><td>62.8</td><td>24.2</td></tr><tr><td>Implicit posterior [34]</td><td>79.0</td><td>48.4</td><td>76.6</td><td>49.5</td><td>76.2</td><td>46.0</td></tr><tr><td>Ours s (from scratch)</td><td>76.0</td><td>39.9</td><td>74.8</td><td>39.4</td><td>69.5</td><td>31.6</td></tr><tr><td>Ours (fine-tuned)</td><td>79.8</td><td>46.4</td><td>79.5</td><td>45.4</td><td>69.6</td><td>32.4</td></tr><tr><td>Full US supervised [33]</td><td>77.0</td><td>49.6</td><td>76.5</td><td>51.8</td><td>24.7</td><td>23.6</td></tr></table>
|
| 205 |
+
|
| 206 |
+
The results in Table 1 demonstrate that this approach to domain transfer is comparable with the state-of-the-art work of [34] for weakly-supervised training. The naïve approach of training a U-Net only on the available high-resolution PA data (PA supervised) fails to generalize to the geographically different location of Phoenix, AZ. Similarly, the model of [33], which is a US-wide high-resolution land cover model trained on imagery and labels, and multi-resolution auxiliary data over the entire contiguous US also suffers. When the weak labels are provided as input (PA supervised $^ +$ weak) the results can improve significantly.
|
| 207 |
+
|
| 208 |
+
# 5 Experiments: Continuous relaxation of combinatorial problems
|
| 209 |
+
|
| 210 |
+
So far, we have considered inference under a DDPM prior and a differentiable constraint $c ( \mathbf { x } , \mathbf { y } )$ . We consider the case of a ‘hard’ constraint, where $\mathbf { y }$ is a latent vector deterministically encoded in an image x $( \mathbf { x } = f ( \mathbf { y } ) )$ and we have a DDPM prior over images $p _ { \mathrm { D D P M } } ( \mathbf { x } )$ . We will use the variation of Algorithm 1 described at the end of $\ S 2 . 2$ to obtain a point estimate of the distribution over $y$ $p ( \mathbf { y } ) \overset { - } { \propto } p _ { \mathrm { D D P M } } ( f ( \mathbf { y } ) )$ .
|
| 211 |
+
|
| 212 |
+
We illustrate this in the setting of a well-known combinatorial problem, the traveling salesman problem (TSP). Recall that a Euclidean traveling salesman problem on the plane is described by $N$ points $\boldsymbol { v } _ { 1 } , \ldots , \boldsymbol { v } _ { N } \in \mathbb { R } ^ { 2 }$ , which form the vertex set of a complete weighted graph $G$ , where the weight of the edge from $v _ { i }$ to $v _ { j }$ is the Euclidean distance $\| v _ { i } - v _ { j } \|$ . A tour of $G$ is a connected subgraph in which every vertex has degree 2. The TSP is the optimization problem of finding the tour with minimal total weight of the edges, or, equivalently, a permutation $\sigma$ of $\{ 1 , 2 , \ldots , N \}$ that minimizes
|
| 213 |
+
|
| 214 |
+
$$
|
| 215 |
+
\| v _ { \sigma ( 1 ) } - v _ { \sigma ( 2 ) } \| + \| v _ { \sigma ( 2 ) } - v _ { \sigma ( 3 ) } \| + \cdots + \| v _ { \sigma ( N - 1 ) } - v _ { \sigma ( N ) } \| + \| v _ { \sigma ( N ) } - v _ { \sigma ( 1 ) } \| .
|
| 216 |
+
$$
|
| 217 |
+
|
| 218 |
+
Although the general form of the TSP is NP-hard, a polynomial-time approximation scheme is known to exist in the Euclidean case [2, 28] and can yield proofs of tour optimality for small problems.
|
| 219 |
+
|
| 220 |
+
Humans have been shown to have a natural propensity for solving the Euclidean TSP (see [26] for a survey). Humans construct a tour by processing an image representation of the points $v _ { 1 } , \ldots , v _ { N }$ through their visual system. However, the optimization algorithms in common use for solving the TSP do not use a vision inductive bias, instead falling into two broad categories:
|
| 221 |
+
|
| 222 |
+
• Discrete combinatorial optimization algorithms and efficient integer programming solvers, studied for decades in the optimization literature [24, 12, 10];
|
| 223 |
+
• More recently, there has been work on neural nets, trained by reinforcement learning or imitation learning, that build tours sequentially or learn heuristics for their (discrete) iterative refinement. Successful recent approaches [6, 23, 16, 17, 4] have used Transformer [44] and graph neural network [22] architectures.
|
| 224 |
+
|
| 225 |
+
The algorithm we propose using DDPMs is a hybrid of these categories: it reasons over a continuous relaxation of the problem, but exploits the learning of generalizable structure in example solutions by a neural model. In addition, ours is the first TSP algorithm to mimic the convolutional inductive bias of the visual system.
|
| 226 |
+
|
| 227 |
+

|
| 228 |
+
Figure 7: The procedure for solving the Euclidean TSP with a DDPM: Gradient descent is performed on a latent adjacency matrix $A$ to minimize a stochastic denoising loss on an image representation $f ( A )$ with steadily decreasing amounts of noise (here, 256 steps). In the process, pieces of the tour are ‘burned in’ and later recombined in creative ways. Finally, a tour is extracted from the inferred adjacency matrix and refined by uncrossing moves. For both problems shown, the length of the inferred tour is within $1 \%$ of the optimum.
|
| 229 |
+
|
| 230 |
+
Encoding function. Fix a set of points $v _ { 1 } , \ldots , v _ { N } \in [ 0 , 1 ] \times [ 0 , 1 ]$ . We encode an symmetric $N \times N$ matrix with 0 diagonal $A$ as a $6 4 \times 6 4$ greyscale image $f ( A )$ by superimposing: (i) raster images of line segments from $v _ { i }$ to $v _ { j }$ with intensity value $A _ { i j }$ for every pair $( i , j )$ , and (ii) raster images of small black dots placed at $v _ { i }$ for each $i$ . For example, if $A$ is the adjacency matrix of a tour, then $f ( A )$ is a visualization of this tour as a $6 4 \times 6 4$ image.
|
| 231 |
+
|
| 232 |
+
Diffusion model training. We use a dataset of Euclidean TSPs, with ground truth tours obtained by a state-of-the-art TSP solver [10], from [23] (we consider two variants of the dataset, each with ${ \sim } 1 . 5 \mathrm { m }$ training graphs: with 50 vertices in each graph and with a varying number from 20 to 50 vertices in each graph). Each training tour is represented via its adjacency matrix $A$ and encoded as an image $f ( A )$ . We then train a DDPM with the U-Net architecture from [7] on all of such encoded image. Model and training details can be found in the Appendix $( \ S \mathbf { B } . 4 )$ . Some unconditional samples from the trained DDPM are shown in Fig. 6; most samples indeed resemble image representations of tours.
|
| 233 |
+
|
| 234 |
+
Solving new TSPs. Suppose we are given a new set of points $v _ { 1 } , \ldots , v _ { N }$ . Solving the TSP requires finding the adjacency matrix $A$ of a tour of minimal length. As a differentiable relaxation, we set $A = \check { S } + S ^ { \top }$ , where $S$ is a stochastic $N \times N$ matrix with zero diagonal (parametrized via softmax of a matrix of parameters over rows). We run the inference procedure using the trained DDPM $p _ { \mathrm { D D P M } } ( f ( \bar { A } ) )$ as a prior to estimate $A$ The hyperparameters and noise schedule are described in $\ S _ { \mathrm { B } . 4 }$ . Examples of the optimization are shown in Fig. 7.
|
| 235 |
+
|
| 236 |
+
Although the inferred $A$ is usually sharp (i.e., all
|
| 237 |
+
|
| 238 |
+

|
| 239 |
+
Figure 6: Two unconditional samples from the diffusion model trained on images of solved TSPs.
|
| 240 |
+
|
| 241 |
+
entries close to 0 or 1), rounding $A$ to 0 or 1 does not always give the adjacency matrix of a tour (see, for example, the top row of Fig. 7; other common incorrect outputs include pairs of disjoint tours). To extract a tour from the inferred $A$ , we greedily insert edges to form an initial proposal, then refine it using a standard and lightweight combinatorial procedure, the 2-opt heuristic [24] (amounting to iteratively uncrossing pairs of edges that intersect). The entire procedure is shown in Fig. 7, and full details can be found in the Appendix $( \ S \mathbf { B } . 4 )$ .
|
| 242 |
+
|
| 243 |
+
Results. We evaluate the trained models on test sets of 1280 graphs each with $N = 5 0$ and $N = 1 0 0$ vertices. We report the average length of the inferred tour and the gap (discrepancy from the length of the ground truth tour) in Table 2 (left), from which we make several observations.
|
| 244 |
+
|
| 245 |
+
Table 2: Left: Mean tour length and optimality gap on Euclidean TSP test sets. The baseline results from [23, 16, 4] are taken from the respective papers. The two DDPMs were trained on $1 . 5 \mathrm { m }$ images of solved TSP instances (with different numbers of vertices) and used to infer latent adjacency matrices in the test set. Right: Performance of the DDPM trained on images of 50-vertex TSP instances with different numbers of inference steps (see the Appendix $( \ S \mathbf { B } . 4 )$ for time schedule details). We also show the mean number of 2-opt (uncrossing) steps per instance, suggesting that the DDPM prior assigns high likelihood to adjacency matrices that are in less need of refinement.
|
| 246 |
+
|
| 247 |
+
<table><tr><td rowspan="2">Algorithm</td><td colspan="2">N=50</td><td colspan="2">N=100</td></tr><tr><td>Obj</td><td>Gap%</td><td>Obj</td><td>Gap%</td></tr><tr><td>Oracle (Concorde [10])</td><td>5.69</td><td>0.00</td><td>7.759</td><td>0.00</td></tr><tr><td>2-opt [24]</td><td>5.86</td><td>2.95</td><td>8.03</td><td>3.54</td></tr><tr><td>Transformer [23]</td><td>5.80</td><td>1.76</td><td>8.12</td><td>4.53</td></tr><tr><td>GNN [16]</td><td>5.87</td><td>3.10</td><td>8.41</td><td>8.38</td></tr><tr><td>Transformer [4]</td><td>5.71</td><td>0.31</td><td>7.88</td><td>1.42</td></tr><tr><td>Diffusion 20-50</td><td>5.76</td><td>1.23</td><td>7.92</td><td>2.11</td></tr><tr><td>Diffusion 50</td><td>5.76</td><td>1.28</td><td>7.93</td><td>2.19</td></tr></table>
|
| 248 |
+
|
| 249 |
+
<table><tr><td></td><td colspan="3">N=50</td><td colspan="3">N=100</td></tr><tr><td>Diff. steps</td><td>Obj</td><td>Gap %</td><td>Steps</td><td>Obj</td><td>Gap%</td><td>Steps</td></tr><tr><td>256</td><td>5.763</td><td>1.28</td><td>11.6</td><td>7.930</td><td>2.19</td><td>50.6</td></tr><tr><td>64</td><td>5.780</td><td>2.60</td><td>14.3</td><td>7.942</td><td>2.35</td><td>45.7</td></tr><tr><td>16</td><td>5.858</td><td>2.98</td><td>25.9</td><td>8.052</td><td>3.78</td><td>58.6</td></tr><tr><td>4</td><td>5.851</td><td>2.86</td><td>23.9</td><td>8.031</td><td>3.50</td><td>52.8</td></tr><tr><td>2-opt</td><td>5.856</td><td>2.95</td><td>24.4</td><td>8.034</td><td>3.54</td><td>53.0</td></tr></table>
|
| 250 |
+
|
| 251 |
+
• The right side of Table 2 shows the number of 2-opt (edge uncrossing) steps performed in the refinement step of the algorithm when the inference algorithm is run for varying numbers of steps. Running the inference with more steps results in extracted tours that are closer to local minima with respect to the 2-opt neighbourhood, indicating that the DDPM encodes meaningful information about the shape of tours.
|
| 252 |
+
|
| 253 |
+
• The DDPM inference is competitive with recent baseline algorithms that do not use beam search in generation of the tour (those shown in the table). These baseline algorithms improve when beam search decoding with very large beam size is used, but encounter diminishing returns as the computation cost grows. Our performance on the 100-vertex problems is similar to [23] with the largest beam size they report (5000), which has $2 . 1 8 \%$ gap, while having similar computation time.
|
| 254 |
+
|
| 255 |
+
• The model trained on problems with 50 nodes performs almost identically to the model trained on problems with 50 or fewer nodes, and both models generalize better than baseline methods from 50-node problems to the out-of-distribution 100-node problems.
|
| 256 |
+
|
| 257 |
+
We emphasize a unique feature of our algorithm: all ‘reasoning’ in our inference procedure happens via the image space. This property also leads to sublinear computation cost scaling with increasing size of the graph – as long as it can reasonably be represented in a $6 4 \times 6 4$ image – since most of the computation cost of inference is borne by running the denoiser on images of a fixed size. In the Appendix $( \ S \mathbf { B } . 4 )$ we explore the generalization of the model trained on 20- to 50-node TSP instances to problems with 200 nodes and discuss potential extensions.
|
| 258 |
+
|
| 259 |
+
# 6 Conclusion
|
| 260 |
+
|
| 261 |
+
We have shown how inference in denoising diffusion models can be performed under constraints in a variety of settings. Imposing constraints that arise from pretrained classifiers enables conditional generation, while common-sense conditions, such as mutual information with a clustering or divergence from weak labels, can lead to models that are less sensitive to domain shift in the distribution of conditioning data.
|
| 262 |
+
|
| 263 |
+
A notable limitation of DDPMs, which is inherited by our algorithms, is the high cost of inference, requiring a large number of passes through the denoising network to generate a sample. We expect that with further research on DDPMs for which inference procedures converge in fewer steps [37, 45], plug-and-play use of DDPMs will become more appealing in various applications.
|
| 264 |
+
|
| 265 |
+
Finally, our results on the traveling salesman problem illustrate the ability of DDPMs to reason over uncertain hypotheses in a manner that can mimic human ‘puzzle-solving’ behavior. These results open the door to future research on using DDPMs to efficiently generate candidates in combinatorial search problems.
|
| 266 |
+
|
| 267 |
+
# Acknowledgments
|
| 268 |
+
|
| 269 |
+
The authors thank the anonymous NeurIPS 2022 reviewers for their comments.
|
| 270 |
+
|
| 271 |
+
All authors are funded by their primary institutions. Partial support was provided by the NASA Biodiversity program (Award 80NSSC21K1027), NSF grants IIS-2123920 and IIS-2212046, and the Partner University Fund 4D Vision award.
|
| 272 |
+
|
| 273 |
+
# References
|
| 274 |
+
|
| 275 |
+
[1] Tomer Amit, Eliya Nachmani, Tal Shaharabany, and Lior Wolf. Segdiff: Image segmentation with diffusion probabilistic models. arXiv preprint 2112.00390, 2021.
|
| 276 |
+
[2] Sanjeev Arora. Polynomial time approximation schemes for euclidean traveling salesman and other geometric problems. Journal of the Association for Computing Machinery, 45(5):753–782, 09 1998.
|
| 277 |
+
[3] Dmitry Baranchuk, Andrey Voynov, Ivan Rubachev, Valentin Khrulkov, and Artem Babenko. Label-efficient semantic segmentation with diffusion models. International Conference on Learning Representations (ICLR), 2022.
|
| 278 |
+
[4] Xavier Bresson and Thomas Laurent. The transformer network for the traveling salesman problem. arXiv preprint 2103.03012, 2021.
|
| 279 |
+
[5] Jooyoung Choi, Sungwon Kim, Yonghyun Jeong, Youngjune Gwon, and Sungroh Yoon. ILVR: conditioning method for denoising diffusion probabilistic models. International Conference on Computer Vision (ICCV), 2021.
|
| 280 |
+
[6] Michel Deudon, Pierre Cournut, Alexandre Lacoste, Yossiri Adulyasak, and Louis-Martin Rousseau. Learning heuristics for the TSP by policy gradient. In Integration of Constraint Programming, Artificial Intelligence, and Operations Research, pages 170–181. Springer International Publishing, 2018.
|
| 281 |
+
[7] Prafulla Dhariwal and Alexander Quinn Nichol. Diffusion models beat GANs on image synthesis. Neural Information Processing Systems (NeurIPS), 2021.
|
| 282 |
+
[8] Yilun Du, Shuang Li, and Igor Mordatch. Compositional visual generation with energy based models. Neural Information Processing Systems (NeurIPS), 2020.
|
| 283 |
+
[9] Jesse H. Engel, Matthew D. Hoffman, and Adam Roberts. Latent constraints: Learning to generate conditionally from unconditional generative models. International Conference on Learning Representations (ICLR), 2018.
|
| 284 |
+
[10] David Applegate et al. Concorde TSP solver. http://www.math.uwaterloo.ca/tsp/ concorde, 1997-2003.
|
| 285 |
+
[11] Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. Neural Information Processing Systems (NeurIPS), 2014.
|
| 286 |
+
[12] Keld Helsgaun. An effective implementation of the Lin–Kernighan traveling salesman heuristic. European Journal of Operational Research, 126(1):106–130, 2000.
|
| 287 |
+
[13] Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Neural Information Processing Systems (NeurIPS), 2020.
|
| 288 |
+
[14] Emiel Hoogeboom, Didrik Nielsen, Priyank Jaini, Patrick Forré, and Max Welling. Argmax flows and multinomial diffusion: Learning categorical distributions. Neural Information Processing Systems (NeurIPS), 2021.
|
| 289 |
+
[15] Emiel Hoogeboom, Victor Garcia Satorras, Clément Vignac, and Max Welling. Equivariant diffusion for molecule generation in 3D. arXiv preprint 2203.17003, 2022.
|
| 290 |
+
[16] Chaitanya K Joshi, Thomas Laurent, and Xavier Bresson. An efficient graph convolutional network technique for the travelling salesman problem. arXiv preprint 1906.01227, 2019.
|
| 291 |
+
[17] Chaitanya K Joshi, Quentin Cappart, Louis-Martin Rousseau, and Thomas Laurent. Learning tsp requires rethinking generalization. International Conference on Principles and Practice of Constraint Programming, 2021.
|
| 292 |
+
[18] Zahra Kadkhodaie and Eero Simoncelli. Stochastic solutions for linear inverse problems using the prior implicit in a denoiser. Neural Information Processing Systems (NeurIPS), 2021.
|
| 293 |
+
[19] Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. Computer Vision and Pattern Recognition (CVPR), 2019.
|
| 294 |
+
[20] Bahjat Kawar, Gregory Vaksman, and Michael Elad. SNIPS: Solving noisy inverse problems stochastically. Neural Information Processing Systems (NeurIPS), 2021.
|
| 295 |
+
[21] Diederik P. Kingma and Max Welling. Auto-encoding variational bayes. International Conference on Learning Representations (ICLR), 2014.
|
| 296 |
+
[22] Thomas Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. International Conference on Learning Representations (ICLR), 2017.
|
| 297 |
+
[23] Wouter Kool, Herke van Hoof, and Max Welling. Attention, learn to solve routing problems! International Conference on Learning Representations (ICLR), 2019.
|
| 298 |
+
[24] Shen Lin and Brian Kernighan. An effective heuristic algorithm for the traveling-salesman problem. Operations Research, 21(2):498–516, 1973.
|
| 299 |
+
[25] Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. International Conference on Computer Vision (ICCV), 2015.
|
| 300 |
+
[26] James MacGregor and Yun Chu. Human performance on the traveling salesman and related problems: A review. The Journal of Problem Solving, 3, 02 2011.
|
| 301 |
+
[27] Tom Minka. Divergence measures and message passing. Microsoft Research Technical Report, 2005.
|
| 302 |
+
[28] Joseph S. B. Mitchell. Guillotine subdivisions approximate polygonal subdivisions: A simple polynomial-time approximation scheme for geometric tsp, k-mst, and related problems. SIAM Journal on Computing, 28(4):1298–1309, 1999.
|
| 303 |
+
[29] Anh Nguyen, Jeff Clune, Yoshua Bengio, Alexey Dosovitskiy, and Jason Yosinski. Plug & play generative networks: Conditional iterative generation of images in latent space. Computer Vision and Pattern Recognition (CVPR), 2017.
|
| 304 |
+
[30] Alex Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. International Conference on Machine Learning (ICML), 2021.
|
| 305 |
+
[31] Weili Nie, Brandon Guo, Yujia Huang, Chaowei Xiao, Arash Vahdat, and Anima Anandkumar. Diffusion models for adversarial purification. International Conference on Machine Learning (ICML), 2022. To appear; arXiv preprint 2205.07460.
|
| 306 |
+
[32] Brian R. Pickard, Jessica Daniel, Megan Mehaffey, Laura E. Jackson, and Anne Neale. Enviroatlas: A new geospatial tool to foster ecosystem services science and resource management. Ecosystem Services, 14(C):45–55, 2015. URL https://EconPapers.repec.org/RePEc: eee:ecoser:v:14:y:2015:i:c:p:45-55.
|
| 307 |
+
[33] Caleb Robinson, Le Hou, Nikolay Malkin, Rachel Soobitsky, Jacob Czawlytko, Bistra Dilkina, and Nebojsa Jojic. Large scale high-resolution land cover mapping with multi-resolution data. Computer Vision and Pattern Recognition (CVPR), 2019.
|
| 308 |
+
[34] Esther Rolf, Nikolay Malkin, Alexandros Graikos, Ana Jojic, Caleb Robinson, and Nebojsa Jojic. Resolving label uncertainty with implicit posterior models. Uncertainty in Artificial Intelligence (UAI), 2022. To appear; arXiv preprint 2202.14000.
|
| 309 |
+
[35] Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. Medical Image Computing and Computer-Assisted Intervention (MICCAI), 2015.
|
| 310 |
+
[36] Chitwan Saharia, Jonathan Ho, William Chan, Tim Salimans, David J. Fleet, and Mohammad Norouzi. Image super-resolution via iterative refinement. arXiv preprint 2104.07636, 2021.
|
| 311 |
+
[37] Tim Salimans and Jonathan Ho. Progressive distillation for fast sampling of diffusion models. International Conference on Learning Representations (ICLR), 2022.
|
| 312 |
+
[38] Abhishek Sinha, Jiaming Song, Chenlin Meng, and Stefano Ermon. D2C: diffusion-decoding models for few-shot conditional generation. Neural Information Processing Systems (NeurIPS), 2021.
|
| 313 |
+
[39] Jascha Sohl-Dickstein, Eric A. Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. International Conference on Machine Learning (ICML), 2015.
|
| 314 |
+
[40] 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 (ICLR), 2021.
|
| 315 |
+
[41] Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian Goodfellow, , and Rob Fergus. Intriguing properties of neural networks. International Conference on Learning Representations (ICLR), 2014.
|
| 316 |
+
[42] Yusuke Tashiro, Jiaming Song, Yang Song, and Stefano Ermon. CSDI: conditional scorebased diffusion models for probabilistic time series imputation. Neural Information Processing Systems (NeurIPS), 2021.
|
| 317 |
+
[43] Arash Vahdat, Karsten Kreis, and Jan Kautz. Score-based generative modeling in latent space. Neural Information Processing Systems (NeurIPS), 2021.
|
| 318 |
+
[44] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. Neural Information Processing Systems (NIPS), 2017.
|
| 319 |
+
[45] Zhisheng Xiao, Karsten Kreis, and Arash Vahdat. Tackling the generative learning trilemma with denoising diffusion GANs. International Conference on Learning Representations (ICLR), 2022.
|
| 320 |
+
|
| 321 |
+
# Checklist
|
| 322 |
+
|
| 323 |
+
1. For all authors...
|
| 324 |
+
|
| 325 |
+
(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
|
| 326 |
+
(b) Did you describe the limitations of your work? [Yes] See the conclusion and discussion throughout the paper.
|
| 327 |
+
(c) Did you discuss any potential negative societal impacts of your work? [N/A] Although no immediate negative societal impacts are expected, researchers should bear in mind the risks of flexible conditional generation of images, e.g., for creating ‘deep fakes’.
|
| 328 |
+
(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
|
| 329 |
+
|
| 330 |
+
2. If you are including theoretical results...
|
| 331 |
+
|
| 332 |
+
(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]
|
| 333 |
+
|
| 334 |
+
3. If you ran experiments...
|
| 335 |
+
|
| 336 |
+
(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] For most experiments; see the Appendix.
|
| 337 |
+
|
| 338 |
+
(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See the Appendix and relevant experiment sections.
|
| 339 |
+
(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] Main experiments were run one time.
|
| 340 |
+
(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See the Appendix.
|
| 341 |
+
|
| 342 |
+
4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
|
| 343 |
+
|
| 344 |
+
(a) If your work uses existing assets, did you cite the creators? [Yes] See the relevant experiment sections.
|
| 345 |
+
(b) Did you mention the license of the assets? [No] But all datasets used are free to use for research purposes; see the relevant citations.
|
| 346 |
+
(c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
|
| 347 |
+
(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
|
| 348 |
+
(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
|
| 349 |
+
|
| 350 |
+
5. If you used crowdsourcing or conducted research with human subjects...
|
| 351 |
+
|
| 352 |
+
(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
|
| 353 |
+
(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
|
| 354 |
+
(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
|
md/dev/zf_Ll3HZWgy/zf_Ll3HZWgy.md
ADDED
|
@@ -0,0 +1,396 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# HOW MUCH CAN CLIP BENEFIT VISION-ANDLANGUAGE TASKS?
|
| 2 |
+
|
| 3 |
+
Sheng Shen∗†, Liunian Harold $\mathbf { L i } ^ { * \dagger }$ , Hao $\mathbf { T a n } ^ { \circ }$ , Mohit Bansal◦, Anna Rohrbach†, Kai-Wei Chang‡, Zhewei Yao† and Kurt Keutzer† †University of California, Berkeley, ‡University of California, Los Angeles ◦University of North Carolina at Chapel Hill {sheng.s, anna.rohrbach, zheweiy, keutzer}@berkeley.edu, {liunian.harold.li, kwchang}@cs.ucla.edu, {haotan, mbansal}@cs.unc.edu
|
| 4 |
+
|
| 5 |
+
# ABSTRACT
|
| 6 |
+
|
| 7 |
+
Most existing Vision-and-Language (V&L) models rely on pre-trained visual encoders, using a relatively small set of manually-annotated data (as compared to web-crawled data), to perceive the visual world. However, it has been observed that large-scale pre-training usually can result in better generalization performance, e.g., CLIP (Contrastive Language-Image Pre-training), trained on a massive amount of image-caption pairs, has shown a strong zero-shot capability on various vision tasks. To further study the advantage brought by CLIP, we propose to use CLIP as the visual encoder in various V&L models in two typical scenarios: 1) plugging CLIP into task-specific fine-tuning; 2) combining CLIP with V&L pre-training and transferring to downstream tasks. We show that CLIP significantly outperforms widely-used visual encoders trained with in-domain annotated data, such as BottomUp-TopDown. We achieve competitive or better results on diverse V&L tasks, while establishing new state-of-the-art results on Visual Question Answering, Visual Entailment, and V&L Navigation tasks.
|
| 8 |
+
|
| 9 |
+
# 1 INTRODUCTION
|
| 10 |
+
|
| 11 |
+
Vision-and-Language (V&L) tasks such as VQA (Antol et al., 2015) test a system’s ability to understand and reason about the semantics of the visual world with the help of natural language. Most V&L models rely on a visual encoder to perceive the visual world, which translates the raw pixels into vectors from a representation space. Recent work (Anderson et al., 2018a; Jiang et al., 2020; Zhang et al., 2021) observes that the visual representation has become the performance bottleneck of V&L models and stress the importance of learning a powerful visual encoder. These high-performing visual encoders are trained on manually-annotated data with class labels (e.g., ImageNet) (Russakovsky et al., 2015) or bounding boxes (e.g., Visual Genome) (Krishna et al., 2017). However, such detection or image classification data is costly to collect, and the visual representation is limited by the predefined class labels. Thus, there is a need for a visual encoder that is trained on more diverse and large-scale data sources, unbounded by a fixed set of labels, and with generalization ability to unseen objects and concepts.
|
| 12 |
+
|
| 13 |
+
Recently, CLIP (Radford et al., 2021) has been proposed to learn visual concepts with language supervision. CLIP consists of a visual encoder and a text encoder. It is trained on 400M noisy image-text pairs crawled from the Internet. The data collection process is scalable and requires little human annotation. CLIP has shown strong zero-shot capabilities on benchmarks such as ImageNet classification. We hypothesize that it also bears great potential for the V&L tasks. However, directly applying CLIP as a zero-shot model to V&L tasks proves to be difficult (Section 5 and Kim et al. (2021)), as many V&L tasks require complex multi-modal reasoning. Thus, we propose to integrate CLIP with existing V&L models by replacing their visual encoder with CLIP’s visual encoder.1
|
| 14 |
+
|
| 15 |
+

|
| 16 |
+
Figure 1: The training process of a V&L model typically consists of three steps: 1) visual encoder pre-training, 2) vision-and-language pre-training (optional), and 3) task-specific fine-tuning. In previous V&L models, visual encoder pre-training requires human annotated vision datasets, which is hard to scale up. Our CLIP-ViL proposes to use CLIP, which is trained on image-text pairs crawled from the Internet, as the visual encoder for V&L models. This reduces the need for human annotated in the pipeline and greatly improves model performance.
|
| 17 |
+
|
| 18 |
+
We present an empirical study on using CLIP as the visual encoder for diverse V&L tasks. We consider two typical scenarios: 1) we use CLIP in direct task-specific fine-tuning (Section 3); 2) we integrate CLIP with $\mathrm { v } \& \mathrm { L }$ pre-training on image-text pairs and transfer to downstream tasks (Section 4).2 For clarity, we denote the models used in these two scenarios as CLIP-ViL (without V&L pre-training) and $\mathbf { C L I P - V i L _ { p } }$ (with V&L pre-training).
|
| 19 |
+
|
| 20 |
+
In direct task-specific fine-tuning, we consider three widely-adopted tasks: Visual Question Answering (Antol et al., 2015), Image Captioning (Chen et al., 2015), and Vision-and-Language Navigation (Anderson et al., 2018b). On all three tasks, CLIP-ViL brings sizable improvement over strong baselines, $1 . 4 \%$ accuracy on VQA v2.0, 6.5 CIDEr on COCO Captioning, and $4 . 0 \%$ success rate on Room-to-Room navigation.
|
| 21 |
+
|
| 22 |
+
In V&L pre-training, we replace the conventionally used region-based representation (Anderson et al., 2018a) with CLIP. CLIP- $\mathrm { V i L } _ { \mathrm { p } }$ performs exceptionally well on three benchmarks, including VQA v2.0, SNLI-VE (Xie et al., 2019), and GQA (Hudson and Manning, 2019), setting a new state-of-the-art (SotA) on VQA $7 6 . 7 0 \%$ on test-std), and SNLI-VE $8 0 . 2 0 \%$ on test). CLIP- $\mathrm { V i L } _ { \mathrm { p } }$ with CLIP-Res50 outperforms models based on the widely used region-based encoder, BottomUp-TopDown (BUTD) ResNet101 (Anderson et al., 2018a). Moreover, ${ \mathrm { C L I P } } { \mathrm { - V i L } } _ { \mathrm { p } }$ with CLIP-Res50x4 surpasses VinVLResNeXt152 (Zhang et al., 2021), which is an extreme scale-up attempt of the region-based encoder with human-annotated data.
|
| 23 |
+
|
| 24 |
+
# 2 BACKGROUND AND MOTIVATION
|
| 25 |
+
|
| 26 |
+
Vision-and-Language (V&L) models. V&L tasks require a model to understand the visual world and to ground natural language to the visual observations. Prominent tasks include visual question answering (Antol et al., 2015), image captioning (Chen et al., 2015), vision-language navigation (Anderson et al., 2018a), image-text retrieval (Wang et al., 2016) and so on. V&L models designed for these tasks often consist of a visual encoder, a text encoder, and a cross-modal interaction module (Kim et al., 2021).
|
| 27 |
+
|
| 28 |
+
We illustrate the three typical training stages in Figure 1: 1) the visual encoder is trained on annotated vision datasets (Russakovsky et al., 2015; Krishna et al., 2017) (denoted as visual encoder pretraining); 2) (optionally) pre-training on paired image-caption data with a reconstructive objective and an image-text matching objective (denoted as vision-and-language pre-training) (Lu et al., 2019); 3) fine-tuning on task-specific data (denoted as task-specific fine-tuning).
|
| 29 |
+
|
| 30 |
+

|
| 31 |
+
Figure 2: CLIP versus other visual encoders. Region-based methods (Anderson et al., 2018a) are trained on object detection data. For grid-based methods, previous work use either image classification (He et al., 2016) or detection data (Jiang et al., 2020). However, CLIP requires only aligned text.
|
| 32 |
+
|
| 33 |
+
Visual encoders in V&L models. Different models employ different visual encoders, we illustrate their architectures and pre-training processes in Figure 2. The encoders can be categorized as follows: 1) region-based models such as BUTD object detector (Anderson et al., 2018a; Kamath et al., 2021); 2) grid-based models such as Jiang et al. (2020) that directly extract grid-like feature maps from the visual backbone (He et al., 2016; Dosovitskiy et al., 2020).
|
| 34 |
+
|
| 35 |
+
The encoder is first pre-trained on human-annotated vision datasets. Region-based encoders are pre-trained with detection data such as Visual Genome (Krishna et al., 2017). Grid-based encoders are pre-trained with image classification data such as ImageNet (Russakovsky et al., 2015) or detection data (Jiang et al., 2020). However, these manually labeled datasets are expensive to construct and hard to scale up. They only provide supervision for a limited number of predetermined visual concepts. This motivates us to use CLIP as the visual encoder.
|
| 36 |
+
|
| 37 |
+
CLIP. CLIP (Contrastive Language-Image Pre-training) (Radford et al., $2 0 2 1 ) ^ { 3 }$ falls into the line of research that learns visual representations from natural language supervision (Desai and Johnson, 2020; Sariyildiz et al., 2020; Jia et al., 2021). CLIP follows a “shallow-interaction design”, where a visual encoder and a text encoder encode an input image and text independently, and the dot-product between the two encoder’s output is used as the similarity score between the input image and text. It is pre-trained with a contrastive loss where the model needs to distinguish aligned pairs from randomly sampled pairs. CLIP leverages an abundantly available source of supervision without human annotation: 400M image-text pairs found across the Internet. As a result, CLIP achieves SotA performance in a range of image classification and image-text retrieval tasks in a zero-shot setting.
|
| 38 |
+
|
| 39 |
+
# 2.1 MOTIVATION
|
| 40 |
+
|
| 41 |
+
Despite the strong zero-shot capability of CLIP on vision tasks, CLIP does not exhibit the same level of performance on certain V&L downstream tasks. For instance, if we cast VQA 2.0 (Goyal et al., 2017) into a zero-shot image-to-text retrieval task, we only observe chance performance (Section 5). Thus, we propose to integrate CLIP’s visual encoder with previous V&L models (Figure 1). We consider the following CLIP variants with different visual backbones (He et al., 2016; Dosovitskiy et al., 2020) (CLIP-ResNet denoted as CLIP-Res): CLIP-Res50, CLIP-Res101, CLIP-Res50x4, CLIP-ViT-B/16 and CLIP-ViT-B/32. We next describe our methods in two scenarios: 1) direct task-specific fine-tuning (Section 3) and 2) V&L pre-training (Section 4).
|
| 42 |
+
|
| 43 |
+
# 3 CLIP-VIL
|
| 44 |
+
|
| 45 |
+
In this section, we directly use CLIP as the visual encoder in task-specific models (referred as CLIPViL) and fine-tune on three representative tasks including Visual Question Answering (Section 3.1), Image Captioning (Section 3.2), and Vision-Language Navigation (Section 3.3).
|
| 46 |
+
|
| 47 |
+
# 3.1 VISUAL QUESTION ANSWERING
|
| 48 |
+
|
| 49 |
+
The task of Visual Question Answering (VQA) (Antol et al., 2015) is to provide the answer given an image and a related question. Various methods have been introduced (Fukui et al., 2016; Yang et al., 2016; Anderson et al., 2018a; Jiang et al., 2018; Gao et al., 2019; Jiang et al., 2020). Here, we select two representative approaches (i.e., Pythia (Jiang et al., 2018) and MCAN (Yu et al., 2019)) to study the impact of the CLIP visual encoders in VQA.
|
| 50 |
+
|
| 51 |
+
Table 1: Results on VQA v2.0. “†” marks results from (Jiang et al., 2020). CLIP visual encoders outperform all baselines, including strong visual encoders pre-trained with in-domain detection data (VG-\* and BUTD-\*).
|
| 52 |
+
|
| 53 |
+
<table><tr><td rowspan=1 colspan=5>ResultVQA Model Visual EncoderTest-dev Test-std</td></tr><tr><td rowspan=1 colspan=5>ImageNet-Res50+ 63.21BiTm-Res50 63.48 63.84BiTm-Res101 63.82 64.11VG-ResNeXt-101t 67.76 1Pythia BUTD-ResNeXt-101† 68.21 -</td></tr><tr><td rowspan=1 colspan=5>CLIP-ViT-B/32 59.14 59.56</td></tr><tr><td rowspan=1 colspan=5>CLIP-ViT-B/16 62.72 62.86</td></tr><tr><td rowspan=1 colspan=5>CLIP-Res50 65.55 65.78</td></tr><tr><td rowspan=1 colspan=2></td><td rowspan=1 colspan=2></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=4></td><td rowspan=1 colspan=1>CLIP-Res50x4</td></tr><tr><td rowspan=1 colspan=4></td><td rowspan=1 colspan=1>ImageNet-ResNet50</td></tr><tr><td rowspan=2 colspan=4></td><td></td></tr><tr><td rowspan=3 colspan=4>ImageNet-ResNet50 67.23 67.46BUTD-ResNeXt-101t 72.01 1VG-ResNeXt-101+ 72.59 -</td></tr><tr><td rowspan=2 colspan=3>MCAN</td></tr><tr><td rowspan=1 colspan=4>CLIP-ViT-B/32 65.40 65.54</td></tr><tr><td rowspan=1 colspan=3></td><td rowspan=1 colspan=2>CLIP-Res50 71.49 71.72</td></tr><tr><td rowspan=1 colspan=5>CLIP-Res101 72.77 73.19CLIP-Res50x4 74.01 74.17</td></tr></table>
|
| 54 |
+
|
| 55 |
+
Experimental Setup. We evaluate on VQA $\mathrm { v } 2 . 0$ (Goyal et al., 2017) and follow Jiang et al. $( 2 0 2 0 ) ^ { 4 }$ for grid feature extraction. Details of Pythia and MCAN as well as full implementation details are included in the Appendix.
|
| 56 |
+
|
| 57 |
+
Experimental Results. We report results on the VQA $\mathrm { v } 2 . 0$ Test-dev / Test-std set in Table 1. We compare with the following visual encoders:
|
| 58 |
+
|
| 59 |
+
• Standard ImageNet pre-trained visual encoders (ImageNet-\*);
|
| 60 |
+
• Visual encoders with SotA performance on ImageNet $( \mathbf { B i T _ { M } } \mathbf { \ast } ^ { \ast }$ ) (Kolesnikov et al., 2020);
|
| 61 |
+
• Visual encoders pre-trained with detection data (VG-\* and BUTD- $^ { \ast }$ ) (Anderson et al., 2018a; Jiang et al., 2020).
|
| 62 |
+
|
| 63 |
+
Compared to the baselines, CLIP visual encoders demonstrate improvement. We especially note that $\mathrm { V G } \ast$ and BUTD-\* models are pre-trained on in-domain detection data, Visual Genome, which contain the sames images as VQA data. Thus, they significantly outperform baselines without such detection data (ImageNet-\* and $\mathrm { B i T _ { M } \mathrm { - } ^ { \ast } }$ ). However, CLIP-\* models without in-domain detection data can outperform VG-\* and BUTD-\*. Detection data are hard to scale up and contain limited object categories, while our results suggest training visual encoders on noisy image-text data as in CLIP is promising and scalable.
|
| 64 |
+
|
| 65 |
+
# 3.2 IMAGE CAPTIONING
|
| 66 |
+
|
| 67 |
+
Image captioning aims at generating a natural language description for an image. Various methods have been proposed for image captioning (Karpathy and Fei-Fei, 2015; Rennie et al., 2017; Anderson et al., 2018a; Luo et al., 2018; Luo, 2020). We investigate the effectiveness of the CLIP model for this popular task combined with the method proposed in Luo (2020).
|
| 68 |
+
|
| 69 |
+
Experimental Setup. We experiment with the basic Transformer model adapted from Vaswani et al. (2017) in Luo (2020). Grid feature maps are extracted for each image. We evaluate our model on COCO dataset (Chen et al., 2015). We use the standard automatic evaluation metrics including CIDEr (Anderson et al., 2016), BLEU (Papineni et al., 2002), METEOR (Lavie and Agarwal, 2007), and SPICE (Anderson et al., 2016). The scores are obtained on Karparthy test split (Karpathy and Fei-Fei, 2015) with beam search of 5 beams. Details are given in Appendix.
|
| 70 |
+
|
| 71 |
+
Table 2: Image Captioning results. B@4, M, C, and S are BLUE-4, METEOR, CIDEr and SPICE metric, respectively. “\*” marks results from Luo (2020). CLIP-Res models outperform ImageNet pre-trained alternatives for both ResNet50 and ResNet101, as well as the strong in-domain region-based features from BUTD.
|
| 72 |
+
|
| 73 |
+
<table><tr><td>Model BUTD (Anderson et al., 2018a)</td><td>B@4 M 36.3 27.7</td><td>C 120.1</td><td></td><td>S 21.4</td></tr><tr><td>VLP (Zhou et al., 2020) AoANet (Huang et al.,2019b) Oscarbase (Li et al.,2020) VinVLbase (Zhang et al., 2021)</td><td>39.5 38.9 40.5</td><td>29.3 29.2 29.7 137.6 22.8 40.9 30.9 140.4 25.1</td><td>129.8 129.8</td><td>22.4 22.4</td></tr><tr><td>BUTDransformer*(Luo,2020) ImageNet-Res5OTransformer BiTM-Res5OTransformer</td><td>37.4</td><td>28.1</td><td>127.7 22.5 36.2 27.6 118.8 21.2 122.7 22.1</td><td></td></tr><tr><td>CLIP-Res50Transformer CLIP-Res10lTransformer CLIP-Res50x4Transformer</td><td>38.6 39.2</td><td>28.8 29.1</td><td>127.9 130.3 23.0 29.7</td><td>22.7 134.21 23.8</td></tr></table>
|
| 74 |
+
|
| 75 |
+
Table 3: Unseen test results for Room-to-Room (R2R) dataset. ‘SR’ and ‘SPL’ are Success Rate and Success rate normalized by Path Length. ‘Pre-Training’ methods are mostly in-domain pre-trained on the Matterport3D (Chang et al., 2017) environments.
|
| 76 |
+
|
| 77 |
+
<table><tr><td rowspan="2">Method</td><td colspan="2">Unseen Test</td></tr><tr><td>SR</td><td>SPL</td></tr><tr><td>No Pre-Training</td><td></td><td></td></tr><tr><td>R2R (Anderson et al.,2018b)</td><td>20</td><td>18</td></tr><tr><td>RPA(Wang et al.,2018)</td><td>25</td><td>23</td></tr><tr><td>S-Follower (Fried et al.,2018)</td><td>35</td><td>28</td></tr><tr><td>RCM(Wang et al.,2019)</td><td>43</td><td>38</td></tr><tr><td>SMNA (Ma et al.,2019a)</td><td>48</td><td>35</td></tr><tr><td>Regretful (Ma et al.,2019b)</td><td>48</td><td>40</td></tr><tr><td>FAST-Short (Ke et al.,2019)</td><td>54</td><td>41</td></tr><tr><td>EnvDrop (Tan et al.,2019)</td><td>51</td><td>47</td></tr><tr><td>PRESS (Li et al.,2019b)</td><td>49</td><td>45</td></tr><tr><td>ALTR (Huang et al., 2019a)</td><td>48</td><td>45</td></tr><tr><td>CG (Anderson et al., 2019)</td><td>33</td><td>30</td></tr><tr><td>RelGraph (Hong et al., 2020)</td><td>55</td><td>52</td></tr><tr><td>EnvDrop + CLIP-ViL</td><td>59</td><td>53</td></tr><tr><td>Pre-Training</td><td></td><td></td></tr><tr><td>AuxRN (Zhu et al., 2020)</td><td>55</td><td>50</td></tr><tr><td>PREVALENT (Hao et al.,2020)</td><td>54</td><td>51</td></tr><tr><td>VLN-BERT(Hong et al., 2021)+OSCAR</td><td>57</td><td>53</td></tr><tr><td>VLN-BERT(Hong et al., 2021)</td><td>63</td><td>57</td></tr></table>
|
| 78 |
+
|
| 79 |
+
Experimental Results. We report Image Captioning results with different models in Table 2. Using the Transformer architecture from (Luo, 2020), we see that CLIP-Res models outperform ImageNet pre-trained alternatives for both ResNet50 $( + 9 . 1 \ / + 1 . 5 $ in CIDEr / SPICE) and ResNet101 $( + 9 . 2 / $ $+ 1 . 5$ in CIDEr / SPICE). It even surpasses the strong in-domain region-based feature from BUTD and grid-based feature from BiT. As the model size grows in CLIP-ViL, the results also improve and the largest CLIP-Res50x4 achieves the best performance, although there still remains a gap to the pre-trained models that have interactive image-text pre-training phase like $\mathrm { O s c a r } _ { \mathrm { b a s e } }$ and ${ \mathrm { V i n V L } } _ { \mathrm { b a s e } }$ Again, CLIP-ViT variant leads to worse performance compared to other visual modules, that we will discuss in Section 5.
|
| 80 |
+
|
| 81 |
+
# 3.3 VISION-AND-LANGUAGE NAVIGATION
|
| 82 |
+
|
| 83 |
+
Vision-and-language navigation tests the agent’s ability to take action according to human instructions, which recently gains popularity in embodied AI (Anderson et al., 2018b; Chen et al., 2019; Jain et al., 2019; Chen et al., 2019; Qi et al., 2020b; Krantz et al., 2020; Nguyen and Daumé III, 2019; Ku et al., 2020). Specifically, the agent is put at a location in the environment (Chang et al., 2017) and asked to reach a target by following the language instructions. Here, we investigate the impact of the CLIP visual encoder on this new task.
|
| 84 |
+
|
| 85 |
+
Model Architecture. We experiment with the basic attentive neural agent as in Fried et al. (2018) (please refer to the original paper for implementation details). At each time step, the agent attends to the panoramic views and the instruction to make an action. We replace the pre-trained visual encoder from ImageNet pre-trained ResNet to the pre-trained CLIP visual encoders. Different from the VQA task that uses a feature map to include detailed information, we use a single-vector output for the entire image following previous works (Fried et al., 2018). For CLIP-ViT-B/32 models, we take the output of the [CLS] token. For CLIP-ResNet models, we take the attentive pooled feature (Radford et al., 2021) of the feature map. These features are also linearly projected and L2-normalized as in the CLIP model.
|
| 86 |
+
|
| 87 |
+
Table 4: Results of Room-to-Room (R2R) and Room-across-Room (RxR) datasets with original ResNet features and CLIP feature variants. ‘BT-Agent’ is the agent trained with back translation (BT). ‘SR’ is Success Rate. ‘SPL’ and ‘nDTW’ are the main metrics for R2R and RxR, respectively. The best results are bold. CLIP-ViL shows clear improvements over the previous ImageNet-trained ResNet model.
|
| 88 |
+
|
| 89 |
+
<table><tr><td>Features</td><td colspan="4">Room-to-Room</td><td colspan="8">Room-across-Room</td></tr><tr><td></td><td colspan="2">Agent</td><td colspan="2">BT-Agent</td><td colspan="2">English</td><td colspan="2">Hindi</td><td colspan="2">Telugu</td><td colspan="2">Average</td></tr><tr><td></td><td>SR</td><td>SPL</td><td>SR</td><td>SPL</td><td>SR</td><td>nDTW</td><td>SR</td><td>nDTW</td><td>SR</td><td>nDTW</td><td>SR</td><td>nDTW</td></tr><tr><td>ImageNet-Res152</td><td>48.2</td><td>44.4</td><td>53.5</td><td>48.8</td><td>35.3</td><td>50.6</td><td>37.9</td><td>51.9</td><td>37.1</td><td>52.0</td><td>36.8</td><td>51.5</td></tr><tr><td>CLIP-Res50</td><td>52.6</td><td>47.4</td><td>56.2</td><td>49.7</td><td>38.8</td><td>53.3</td><td>44.1</td><td>55.7</td><td>43.5</td><td>55.5</td><td>42.1</td><td>54.8</td></tr><tr><td>CLIP-ViT-B/32</td><td>52.5</td><td>47.7</td><td>57.4</td><td>51.3</td><td>40.2</td><td>52.5</td><td>44.3</td><td>55.0</td><td>42.1</td><td>54.6</td><td>42.2</td><td>54.0</td></tr><tr><td>CLIP-Res101</td><td>53.6</td><td>47.5</td><td>56.7</td><td>49.5</td><td>41.0</td><td>54.6</td><td>44.9</td><td>56.9</td><td>42.2</td><td>55.3</td><td>42.7</td><td>55.6</td></tr><tr><td>CLIP-Res50x4</td><td>54.7</td><td>48.7</td><td>59.2</td><td>52.9</td><td>40.8</td><td>54.7</td><td>44.5</td><td>56.5</td><td>42.4</td><td>56.0</td><td>42.6</td><td>55.7</td></tr></table>
|
| 90 |
+
|
| 91 |
+
Experimental Setup. We apply our model to two vision-and-language navigation datasets: Room-toRoom (R2R, Anderson et al. (2018b)) and Room-across-Room (RxR, Ku et al. (2020)). R2R is built on the indoor environments from the MatterPort3D dataset (Chang et al., 2017). The environments are split into training, unseen validation, and unseen test. RxR extends the R2R dataset to multiple languages and follows the environment split. For R2R dataset, we follow the hyperparameter of the publicly available implementation5 R2R-EnvDrop (Tan et al., 2019) and replace the input features6 with the CLIP features. For RxR dataset, we change the path length and instruction length; details are given in Appendix.
|
| 92 |
+
|
| 93 |
+
Table 5: Unseen test results for Room-across-Room $( \mathrm { R x R } )$ dataset under mono-lingual setup. ‘SR’ and ‘nDTW’ are Success Rate and normalized Dynamic Time Warping.
|
| 94 |
+
|
| 95 |
+
<table><tr><td rowspan="2">Method</td><td colspan="2">Unseen Test</td></tr><tr><td>SR</td><td>nDTW</td></tr><tr><td>Random-Baseline (Ku et al., 2020)</td><td>7.5</td><td>15.4</td></tr><tr><td>Mono-Baseline (Ku et al., 2020)</td><td>25.4</td><td>41.1</td></tr><tr><td>SAA (Li et al., 2021a)</td><td>35.4</td><td>46.8</td></tr><tr><td>EnvDrop + CLIP-ViL</td><td>38.3</td><td>51.1</td></tr></table>
|
| 96 |
+
|
| 97 |
+
Experimental Results. We show the testunseen results of our best model (CLIPRes50x4) and the comparison to the previous methods. On R2R dataset (in Table 3), CLIPViL reaches $8 \%$ higher in SR (success rate) and $6 \%$ higher in SPL (Success Rate normalized by Path Length) than our baseline, EnvDrop. CLIP-ViL outperforms previous nonpre-training agents and shows competitive results to VLN-specific pre-trained models. On RxR dataset (Table 5), CLIP-ViL achieves the best success rate and nDTW (normalized Dynamic Time Warping) under the mono-lingual setup (Ku et al., 2020) and is $4 . 3 \%$ better then the previous results for nDTW.
|
| 98 |
+
|
| 99 |
+
In Table 4, we compare different CLIP variants with the previous standard ResNet-152 feature extractors. These extractors are pre-trained on ImageNet and use the mean-pooled features as the representation for the image. CLIP-Res50 shows a clear improvement over the IN alternative (‘ImageNet-Res152’). With larger models (i.e., ‘CLIP-Res101’ and ‘CLIP-Res50x4’), the agent performance scales well on both R2R and RxR. Lastly, we find that the CLIP ViT model (‘CLIP-ViTB/32’) has similar results as CLIP-Res50 model. ViT also shows a relatively better result when back translation (BT) is applied. The success of ViT model in VLN is possibly due to the use of [CLS] feature instead of the feature map.
|
| 100 |
+
|
| 101 |
+
# 4 VISION-AND-LANGUAGE PRE-TRAINING
|
| 102 |
+
|
| 103 |
+
Recently, V&L pre-training has been proposed as an effective technique to improve the performance on various V&L tasks (Lu et al., 2019; Tan and Bansal, 2019; Li et al., 2019a; Su et al., 2019; Chen et al., 2020; Zhou et al., 2020; Huang et al., 2020; Li et al., 2020; Zhang et al., 2021; Li et al., 2021b). Before task-specific fine-tuning, the model is pre-trained on aligned image-text data with a reconstructive objective and an image-text matching objective. We seek to test the potential of combining CLIP pre-training and V&L pre-training. We introduce CLiP- $\mathrm { . V i L _ { p } }$ , a vision-and-language model pre-trained on image-text data with CLIP visual encoder as its visual backbone. In the following, we introduce the model architecture and pre-training process of ${ \mathrm { C L i P – V i L } } _ { \mathrm { p } }$ in detail.
|
| 104 |
+
|
| 105 |
+
Table 6: Evaluation results on three vision-and-language tasks. Our model with CLIP-Res50 outperforms most BUTD-based models. Our model with CLIP-Res50x4 sets a new state-of-the-art on VQA and SNLI-VE. It surpasses VinVL, which is a scaled-up version of BUTD and undergoes more intensive V&L pre-training than ours.
|
| 106 |
+
|
| 107 |
+
<table><tr><td rowspan="2">Model</td><td rowspan="2">VisualEncoder</td><td colspan="2">V&LPretrain</td><td colspan="2">VQA</td><td colspan="2">SNLI-VE</td><td colspan="2">GQA</td></tr><tr><td>Data</td><td>Epoch</td><td>Test-Dev</td><td>Test-Std</td><td>Dev</td><td>Test-P</td><td>Test-Dev</td><td>Test-Std</td></tr><tr><td>PixelBERT</td><td>ImageNet-Res50</td><td>5.5M</td><td>40</td><td>71.35</td><td>71.42</td><td>:</td><td>-</td><td>-</td><td>-</td></tr><tr><td>PixelBERT</td><td>ImageNet-ResX152</td><td>5.5M</td><td>40</td><td>74.45</td><td>74.55</td><td>-</td><td>-</td><td>-</td><td>-</td></tr><tr><td>LXMERT</td><td>BUTD-Res101</td><td>9.2M</td><td>20</td><td>72.42</td><td>72.54</td><td>-</td><td>-</td><td>60.00</td><td>60.30</td></tr><tr><td>UNITER</td><td>BUTD-Res101</td><td>6.5M</td><td>-</td><td>72.70</td><td>72.91</td><td>78.59</td><td>78.28</td><td>-</td><td>-</td></tr><tr><td>Oscar</td><td>BUTD-Res101</td><td>6.5M</td><td>118</td><td>73.16</td><td>73.44</td><td>-</td><td>-</td><td>61.19</td><td>61.23</td></tr><tr><td>VinVL</td><td>VinVL-ResX152</td><td>8.9M</td><td>116</td><td>75.95</td><td>76.12</td><td>1</td><td>-</td><td>65.05</td><td>65.65</td></tr><tr><td> CLiP-ViLp</td><td>CLIP-Res50</td><td>9.2M</td><td>20</td><td>73.92</td><td>74.09</td><td>78.64</td><td>78.97</td><td>59.79</td><td>60.55</td></tr><tr><td></td><td>CLIP-Res50x4</td><td>9.2M</td><td>20</td><td>76.48</td><td>76.70</td><td>80.61</td><td>80.20</td><td>61.42</td><td>62.93</td></tr></table>
|
| 108 |
+
|
| 109 |
+
# 4.1 CLIP-VILP
|
| 110 |
+
|
| 111 |
+
Model Architecture. ${ \mathrm { C L i P – V i L } } _ { \mathrm { p } }$ assumes a text segment $T$ and an image $I$ as input. As in BERT, the text is tokenized into a sequence of subwords $\bar { \{ } w _ { 1 } , w _ { 2 } , . . . , w _ { k } \}$ . Every subword is embedded as the sum of its token, position, and segment embeddings (Devlin et al., 2019) and thus the text is embedded as a sequence of word embeddings $\{ w _ { 1 } , w _ { 2 } , . . . , w _ { n } \}$ . The image is embedded as a set of visual vectors $\{ v _ { 1 } , v _ { 2 } , . . . , v _ { m } \}$ from the grid-like feature map. The text and visual input are then concatanated into a sequence, $\{ w _ { 1 } , w _ { 2 } , . . . , w _ { n } , v _ { 1 } , v _ { 2 } , . . . , v _ { m } \}$ , and processed by a single Transformer. In most region-based models, the visual backbone is frozen as fine-tuning the object detector along with the Transformer remains an open problem (Su et al., 2019). In CLiP- $\mathrm { . V i L _ { p } }$ , the CLIP backbone is trained during both V&L pre-training and task-specific fine-tuning (see discussion in Section 5).
|
| 112 |
+
|
| 113 |
+
Pre-training on Image-Text Data. To learn unified representations for both vision and language, we follow prior work and pre-train the model on image-text pairs. We consider three pre-training objectives from LXMERT (Tan and Bansal, 2019): 1) grounded masked language modeling, where we randomly mask out $15 \%$ of words in the input sentence and train the model to reconstruct the masked words; 2) text-image matching, where the model is provided with a mismatched sentence with a probability of 0.5, and is trained to classify whether the text corresponds to the image; 3) visual question answering, where we train the model to predict the correct answer given a question.
|
| 114 |
+
|
| 115 |
+
# 4.2 EXPERIMENTS
|
| 116 |
+
|
| 117 |
+
Setup. We experiment with two variants of CLIP as the visual encoder, CLIP-Res50 and CLIPRes50x4. Following LXMERT, we use the same corpora aggregated from MS COCO Captions (Chen et al., 2015), Visual Genome Captions (Krishna et al., 2017), VQA (Antol et al., 2015), GQA (Hudson and Manning, 2019), and VG-QA (Zhu et al., 2016) for pre-training. We follow the same preprocessing procedure and exclude any test data from the pre-training dataset. This results in 9.18M image-text pairs.
|
| 118 |
+
|
| 119 |
+
For computational efficiency, we use a relatively small resolution for images. We resize the shorter edges of images to 384 and the longer edges to under 640 with preserved aspect ratios. During pre-training, as the number of image patches is large, we randomly sample 100 image patches for every image following PixelBERT (Huang et al., 2020). We pre-train the model for 20 epochs and unfreeze the CLIP backbone during pre-training and fine-tuning. For details see the Appendix.
|
| 120 |
+
|
| 121 |
+
Tasks. For evaluation, we fine-tune the pre-trained model on three V&L tasks: VQA v2.0 (Goyal et al., 2017), visual entailment SNLI-VE (Xie et al., 2019), and GQA (Hudson and Manning, 2019). We provide more details in the Appendix.
|
| 122 |
+
|
| 123 |
+
Table 7: Zero-shot performance of CLIP on VQA v2.0 mini-eval, “PE” denotes we follow similar prompt engineering as suggested in CLIP paper.
|
| 124 |
+
|
| 125 |
+
<table><tr><td rowspan="2">Model</td><td colspan="3">VQA Question Type</td></tr><tr><td>yes/no</td><td>number</td><td>other</td></tr><tr><td>CLIP-Res50</td><td>0.037</td><td>0.057</td><td>0.0</td></tr><tr><td>CLIP-ViT-B/32 PE</td><td>0.019</td><td>0.0</td><td>0.0</td></tr><tr><td>CLIP-Res50PE</td><td>0.055</td><td>0.057</td><td>0.0</td></tr><tr><td>CLIP-Res101pE</td><td>0.260</td><td>0.0</td><td>0.0</td></tr><tr><td>CLIP-Res50x4PE</td><td>0.446</td><td>0.118</td><td>0.034</td></tr></table>
|
| 126 |
+
|
| 127 |
+
Table 8: The importance of V&L pre-training (evaluated on VQA test-dev). All three models benefit from V&L pre-traibing significantly.
|
| 128 |
+
|
| 129 |
+
<table><tr><td>Feature</td><td>No Pre-train</td><td>Pre-train</td><td>Diff</td></tr><tr><td>CLIP-Res50</td><td>64.66</td><td>73.92</td><td>+9.26</td></tr><tr><td>CLIP-Res50x4</td><td>69.91</td><td>76.48</td><td>+6.57</td></tr><tr><td>BUTD-Res101</td><td>66.70</td><td>72.42</td><td>+5.72</td></tr></table>
|
| 130 |
+
|
| 131 |
+
Results. We report the results in Table 6. We include previous best pre-trained V&L models and their V&L pre-training data and epochs. As our model is based on $\mathbf { B E R T _ { B A S E } }$ , we compare only with models based on $\mathbf { B E R T _ { B A S E } }$ . The models are grouped by their visual encoder type. We first note that our two models perform competitively on all metrics. Especially, CLIP-ViL with CLIP-Res50x4 establishes a new SotA on VQA and SNLI-VE.
|
| 132 |
+
|
| 133 |
+
When comparing with the BUTD visual encoder trained on in-domain data (including LXMERT (Tan and Bansal, 2019), UNITER (Chen et al., 2020), and Oscar (Li et al., 2020)), our two models (CLIP-ViL with CLIP-Res50 and CLIP-Res50x4) significantly outperform most BUTD-Res101 based models. We especially note that LXMERT is trained on the same pre-training dataset and for the same number of epochs as our model, yet our CLiP- $\mathrm { V i L } _ { \mathrm { p } }$ with CLIP-Res50 outperforms LXMERT on VQA by 2.59.
|
| 134 |
+
|
| 135 |
+
VinVL (Li et al., 2020) is an extreme scale-up of the region-based paradigm, which is pre-trained on multiple object detection datasets, including MS COCO (Lin et al., 2014), OpenImages (Kuznetsova et al., 2020), Object365 (Shao et al., 2019), and Visual Genome (Krishna et al., 2017). Yet, our model with CLIP-Res50x4 outperforms VinVL on VQA, while requiring significantly less steps of V&L pre-training. On GQA, our model under-performs VinVL. The potential reason is that GQA is automatically constructed from object bounding box data, which may give region-based models trained on such object data a significant advantage.
|
| 136 |
+
|
| 137 |
+
Lastly, we compare to Pixel-BERT (Huang et al., 2020), which takes a similar design as our model, but with an ImageNet initialized ResNet. CLIP initialization clearly holds advantage over ImageNet initialization, as CLIP-Res50 significantly outperforms Pixel-BERT with ImageNet-Res50.
|
| 138 |
+
|
| 139 |
+
# 5 ANALYSIS
|
| 140 |
+
|
| 141 |
+
In this section, we provide detailed analyses on a few interesting phenomena we observe during our experiments, which may help guide future exploration. Quantitative and qualitative analysis are provided to support our findings.
|
| 142 |
+
|
| 143 |
+
Zero-Shot Performance of CLIP in VQA. In the original paper, CLIP is intended as a zero-shot model and shows strong performance on various vision and image retrieval tasks. We are thus curious if CLIP can also perform well as a zero-shot model on V&L tasks that may require complex reasoning. To conduct zero-shot image classification, CLIP (Radford et al., 2021) uses the names of all classes in the dataset as the set of candidate text and predict the most probable (image, text) pair. We thus experiment with a similar setting on VQA but modify the candidate text to be the concatenation of question and answer pair for each question. Moreover, Radford et al. (2021) find a result improvement from prompt engineering. We follow this design by constructing “question: [question text] answer: [answer text]” as the prompt template. The results on VQA v2.0 mini-eval are shown in Table 7. All CLIP variants perform at near-chance level in the zero-shot setting while prompt engineering helps only a little. CLIP models also perform worse when the question becomes harder (“other” vs. “yes/no”). All these results suggest the need of a deep interactive model and additional pre-training/fine-tuning.
|
| 144 |
+
|
| 145 |
+
Benefit of V&L Pre-training. In Table 8, we compare the performance of models with or without V&L pre-training. We find that V&L pre-training brings significant performance improvement for the three models we test.
|
| 146 |
+
|
| 147 |
+
Interestingly, we find that CLIP models benefit more from V&L pre-training. Our conjecture is that the additional benefit could come from unfreezing the visual backbone. Because of technical difficulty in fine-tuning the object detector, most V&L models rely on frozen region-based encoders (Lu et al., 2019). But for grid-features such as CLIP, we can easily fine-tune the visual backbone and could potentially aid CLIP to adapt to the pre-training task. We hope that our finding inspires future work to further explore unfreezing the visual backbone in V&L models when computational budget allows.
|
| 148 |
+
|
| 149 |
+

|
| 150 |
+
Figure 3: Grad-CAM Visualization of CLIP-ViT-B/32, CLIP-ViT-B/16, CLIP-Res50, CLIP-Res101 and CLIP-Res50x4 for the question “What color is the woman’s shirt on the left?”.
|
| 151 |
+
|
| 152 |
+
Qualitative Comparison of CLIP Variants. In our experiments, we find that ViT variants of CLIP under-perform their ResNet counterparts (Section 3.1). We perform Gradient-Based Localization (Grad-CAM) (Selvaraju et al., 2017) to visualize the salient regions idenfified CLIP variants. We find that qualitatively, ResNet variants of CLIP localize objects better than ViT variants. For example, in Figure 3, CLIP-ResNet variants localizes the sentence “What color is the woman’s shirt on the left?” better than CLIP-ViT variants without finetuning. This finding is inline with recent studies on vision transformers (Wang et al., 2021; Raghu et al., 2021; Dai et al., 2021). We provide more qualitative examples in the Appendix.
|
| 153 |
+
|
| 154 |
+
# 6 CONCLUSIONS
|
| 155 |
+
|
| 156 |
+
In this paper, we propose to leverage CLIP as the visual encoder for different V&L models across various tasks. We experiment with two approaches: in the first, we directly plug CLIP in task-specific fine-tuning; in the second, we integrate CLIP with V&L pre-training and fine-tune on downstream tasks afterwards. A variety of substantial experiments on different V&L tasks demonstrates that CLIP-ViL and CLIP- $\mathrm { . V i L _ { p } }$ can achieve competitive or better performance as compared to strong baselines. Analyses from different perspectives explain certain intriguing phenomena and offer new directions for future V&L research.
|
| 157 |
+
|
| 158 |
+
# REPRODUCIBILITY STATEMENT
|
| 159 |
+
|
| 160 |
+
We provide the code to reproduce the main results in this paper in the supplementary material, which contains comprehensive instructions to reproduce our results. The code and model checkpoints will be made public.
|
| 161 |
+
|
| 162 |
+
# ACKNOWLEDGEMENT
|
| 163 |
+
|
| 164 |
+
We thank anonymous reviewers for their comments and suggestions. SS and KK were supported by grants from Samsung, Facebook, and the Berkeley Deep Drive Consortium. LL and KC were supported in part by DARPA MCS program under Cooperative Agreement N66001-19-2-4032. We would like to acknowledge DARPA, IARPA, NSF, and ONR for providing partial support of this work. The views expressed are those of the authors and do not reflect the official policy or position of the Department of Defense or the U.S. Government.
|
| 165 |
+
|
| 166 |
+
# REFERENCES
|
| 167 |
+
|
| 168 |
+
Peter Anderson, Basura Fernando, Mark Johnson, and Stephen Gould. 2016. Spice: Semantic propositional image caption evaluation. In European conference on computer vision, pages 382–398. Springer.
|
| 169 |
+
|
| 170 |
+
Peter Anderson, Xiaodong He, Chris Buehler, Damien Teney, Mark Johnson, Stephen Gould, and Lei Zhang. 2018a. Bottom-up and top-down attention for image captioning and visual question answering. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 6077–6086.
|
| 171 |
+
|
| 172 |
+
Peter Anderson, Ayush Shrivastava, Devi Parikh, Dhruv Batra, and Stefan Lee. 2019. Chasing ghosts: Instruction following as bayesian state tracking. In NeurIPS.
|
| 173 |
+
|
| 174 |
+
Peter Anderson, Qi Wu, Damien Teney, Jake Bruce, Mark Johnson, Niko Sünderhauf, Ian Reid, Stephen Gould, and Anton Van Den Hengel. 2018b. Vision-and-language navigation: Interpreting visually-grounded navigation instructions in real environments. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 3674–3683.
|
| 175 |
+
|
| 176 |
+
Stanislaw Antol, Aishwarya Agrawal, Jiasen Lu, Margaret Mitchell, Dhruv Batra, C Lawrence Zitnick, and Devi Parikh. 2015. Vqa: Visual question answering. In Proceedings of the IEEE international conference on computer vision, pages 2425–2433.
|
| 177 |
+
|
| 178 |
+
Angel Chang, Angela Dai, Thomas Funkhouser, Maciej Halber, Matthias Niebner, Manolis Savva, Shuran Song, Andy Zeng, and Yinda Zhang. 2017. Matterport3d: Learning from rgb-d data in indoor environments. In 2017 International Conference on 3D Vision (3DV), pages 667–676. IEEE.
|
| 179 |
+
|
| 180 |
+
Howard Chen, Alane Suhr, Dipendra Misra, Noah Snavely, and Yoav Artzi. 2019. Touchdown: Natural language navigation and spatial reasoning in visual street environments. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 12538–12547.
|
| 181 |
+
|
| 182 |
+
Xinlei Chen, Hao Fang, Tsung-Yi Lin, Ramakrishna Vedantam, Saurabh Gupta, Piotr Dollár, and C Lawrence Zitnick. 2015. Microsoft COCO captions: Data collection and evaluation server. arXiv preprint arXiv:1504.00325.
|
| 183 |
+
|
| 184 |
+
Yen-Chun Chen, Linjie Li, Licheng Yu, Ahmed El Kholy, Faisal Ahmed, Zhe Gan, Yu Cheng, and Jingjing Liu. 2020. UNITER: Universal image-text representation learning. In ECCV. ECCV.
|
| 185 |
+
|
| 186 |
+
Junyoung Chung, Caglar Gulcehre, KyungHyun Cho, and Yoshua Bengio. 2014. Empirical evaluation of gated recurrent neural networks on sequence modeling. arXiv preprint arXiv:1412.3555.
|
| 187 |
+
|
| 188 |
+
Xiyang Dai, Yinpeng Chen, Bin Xiao, Dongdong Chen, Mengchen Liu, Lu Yuan, and Lei Zhang. 2021. Dynamic head: Unifying object detection heads with attentions. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 7373–7382.
|
| 189 |
+
|
| 190 |
+
Karan Desai and Justin Johnson. 2020. Virtex: Learning visual representations from textual annotations. arXiv preprint arXiv:2006.06666.
|
| 191 |
+
|
| 192 |
+
Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. 2019. BERT: pre-training of deep bidirectional transformers for language understanding. In NAACL-HLT.
|
| 193 |
+
|
| 194 |
+
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. 2020. An image is worth 16x16 words: Transformers for image recognition at scale.
|
| 195 |
+
|
| 196 |
+
Daniel Fried, Ronghang Hu, Volkan Cirik, Anna Rohrbach, Jacob Andreas, Louis-Philippe Morency, Taylor Berg-Kirkpatrick, Kate Saenko, Dan Klein, and Trevor Darrell. 2018. Speaker-follower models for vision-and-language navigation. In NeurIPS.
|
| 197 |
+
|
| 198 |
+
Akira Fukui, Dong Huk Park, Daylen Yang, Anna Rohrbach, Trevor Darrell, and Marcus Rohrbach. 2016. Multimodal compact bilinear pooling for visual question answering and visual grounding. In EMNLP.
|
| 199 |
+
|
| 200 |
+
Peng Gao, Zhengkai Jiang, Haoxuan You, Pan Lu, Steven CH Hoi, Xiaogang Wang, and Hongsheng Li. 2019. Dynamic fusion with intra-and inter-modality attention flow for visual question answering. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR).
|
| 201 |
+
|
| 202 |
+
Yash Goyal, Tejas Khot, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. 2017. Making the v in vqa matter: Elevating the role of image understanding in visual question answering. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 6904–6913.
|
| 203 |
+
|
| 204 |
+
Weituo Hao, Chunyuan Li, Xiujun Li, Lawrence Carin, and Jianfeng Gao. 2020. Towards learning a generic agent for vision-and-language navigation via pre-training. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 13137–13146.
|
| 205 |
+
|
| 206 |
+
Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. 2016. Deep residual learning for image recognition. In CVPR.
|
| 207 |
+
|
| 208 |
+
Sepp Hochreiter and Jürgen Schmidhuber. 1997. Long short-term memory. Neural computation, 9(8):1735–1780.
|
| 209 |
+
|
| 210 |
+
Yicong Hong, Cristian Rodriguez-Opazo, Yuankai Qi, Qi Wu, and Stephen Gould. 2020. Language and visual entity relationship graph for agent navigation. In NeurIPS.
|
| 211 |
+
|
| 212 |
+
Yicong Hong, Qi Wu, Yuankai Qi, Cristian Rodriguez-Opazo, and Stephen Gould. 2021. Vlnœ bert: A recurrent vision-and-language bert for navigation. In CVPR.
|
| 213 |
+
|
| 214 |
+
Haoshuo Huang, Vihan Jain, Harsh Mehta, Alexander Ku, Gabriel Magalhaes, Jason Baldridge, and Eugene Ie. 2019a. Transferable representation learning in vision-and-language navigation. In ICCV.
|
| 215 |
+
|
| 216 |
+
Lun Huang, Wenmin Wang, Jie Chen, and Xiao-Yong Wei. 2019b. Attention on attention for image captioning. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 4634–4643.
|
| 217 |
+
|
| 218 |
+
Zhicheng Huang, Zhaoyang Zeng, Bei Liu, Dongmei Fu, and Jianlong Fu. 2020. Pixel-bert: Aligning image pixels with text by deep multi-modal transformers. arXiv preprint arXiv:2004.00849.
|
| 219 |
+
|
| 220 |
+
Drew A Hudson and Christopher D Manning. 2019. GQA: A new dataset for real-world visual reasoning and compositional question answering. In CVPR.
|
| 221 |
+
|
| 222 |
+
Vihan Jain, Gabriel Magalhaes, Alexander Ku, Ashish Vaswani, Eugene Ie, and Jason Baldridge. 2019. Stay on the path: Instruction fidelity in vision-and-language navigation. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 1862–1872.
|
| 223 |
+
|
| 224 |
+
Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc V Le, Yunhsuan Sung, Zhen Li, and Tom Duerig. 2021. Scaling up visual and vision-language representation learning with noisy text supervision. arXiv preprint arXiv:2102.05918.
|
| 225 |
+
|
| 226 |
+
Huaizu Jiang, Ishan Misra, Marcus Rohrbach, Erik Learned-Miller, and Xinlei Chen. 2020. In defense of grid features for visual question answering. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10267–10276.
|
| 227 |
+
|
| 228 |
+
Yu Jiang, Vivek Natarajan, Xinlei Chen, Marcus Rohrbach, Dhruv Batra, and Devi Parikh. 2018. Pythia v0. 1: the winning entry to the vqa challenge 2018. arXiv preprint arXiv:1807.09956.
|
| 229 |
+
|
| 230 |
+
Aishwarya Kamath, Mannat Singh, Yann LeCun, Ishan Misra, Gabriel Synnaeve, and Nicolas Carion. 2021. Mdetr–modulated detection for end-to-end multi-modal understanding. arXiv preprint arXiv:2104.12763.
|
| 231 |
+
|
| 232 |
+
Andrej Karpathy and Li Fei-Fei. 2015. Deep visual-semantic alignments for generating image descriptions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 3128–3137.
|
| 233 |
+
|
| 234 |
+
Liyiming Ke, Xiujun Li, Yonatan Bisk, Ari Holtzman, Zhe Gan, Jingjing Liu, Jianfeng Gao, Yejin Choi, and Siddhartha Srinivasa. 2019. Tactical rewind: Self-correction via backtracking in visionand-language navigation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 6741–6749.
|
| 235 |
+
|
| 236 |
+
Wonjae Kim, Bokyung Son, and Ildoo Kim. 2021. Vilt: Vision-and-language transformer without convolution or region supervision. arXiv preprint arXiv:2102.03334.
|
| 237 |
+
|
| 238 |
+
Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, and Neil Houlsby. 2020. Big transfer (bit): General visual representation learning. In Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part V 16, pages 491–507. Springer.
|
| 239 |
+
|
| 240 |
+
Jacob Krantz, Erik Wijmans, Arjun Majumdar, Dhruv Batra, and Stefan Lee. 2020. Beyond the nav-graph: Vision-and-language navigation in continuous environments. In European Conference on Computer Vision, pages 104–120. Springer.
|
| 241 |
+
|
| 242 |
+
Ranjay Krishna, Yuke Zhu, Oliver Groth, Justin Johnson, Kenji Hata, Joshua Kravitz, Stephanie Chen, Yannis Kalantidis, Li-Jia Li, David A Shamma, et al. 2017. Visual genome: Connecting language and vision using crowdsourced dense image annotations. International journal of computer vision, 123(1):32–73.
|
| 243 |
+
|
| 244 |
+
Alexander Ku, Peter Anderson, Roma Patel, Eugene Ie, and Jason Baldridge. 2020. Room-acrossroom: Multilingual vision-and-language navigation with dense spatiotemporal grounding. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 4392–4412.
|
| 245 |
+
|
| 246 |
+
Alina Kuznetsova, Hassan Rom, Neil Alldrin, Jasper Uijlings, Ivan Krasin, Jordi Pont-Tuset, Shahab Kamali, Stefan Popov, Matteo Malloci, Alexander Kolesnikov, Tom Duerig, and Vittorio Ferrari. 2020. The open images dataset v4: Unified image classification, object detection, and visual relationship detection at scale. In International Journal of Computer Vision (IJCV).
|
| 247 |
+
|
| 248 |
+
Alon Lavie and Abhaya Agarwal. 2007. Meteor: An automatic metric for mt evaluation with high levels of correlation with human judgments. In Proceedings of the second workshop on statistical machine translation, pages 228–231.
|
| 249 |
+
|
| 250 |
+
Jialu Li, Hao Tan, and Mohit Bansal. 2021a. Improving cross-modal alignment in vision language navigation via syntactic information. arXiv preprint arXiv:2104.09580.
|
| 251 |
+
|
| 252 |
+
Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, and Kai-Wei Chang. 2019a. VisualBERT: A simple and performant baseline for vision and language. In Arxiv.
|
| 253 |
+
|
| 254 |
+
Liunian Harold Li, Haoxuan You, Zhecan Wang, Alireza Zareian, Shih-Fu Chang, and Kai-Wei Chang. 2021b. Unsupervised vision-and-language pre-training without parallel images and captions. In NAACL.
|
| 255 |
+
|
| 256 |
+
Xiujun Li, Chunyuan Li, Qiaolin Xia, Yonatan Bisk, Asli Celikyilmaz, Jianfeng Gao, Noah A Smith, and Yejin Choi. 2019b. Robust navigation with language pretraining and stochastic sampling. 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 1494–1499.
|
| 257 |
+
|
| 258 |
+
Xiujun Li, Xi Yin, Chunyuan Li, Pengchuan Zhang, Xiaowei Hu, Lei Zhang, Lijuan Wang, Houdong Hu, Li Dong, Furu Wei, et al. 2020. Oscar: Object-semantics aligned pre-training for visionlanguage tasks. In European Conference on Computer Vision, pages 121–137. Springer.
|
| 259 |
+
|
| 260 |
+
Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. 2014. Microsoft coco: Common objects in context. In European conference on computer vision, pages 740–755. Springer.
|
| 261 |
+
|
| 262 |
+
Ilya Loshchilov and Frank Hutter. 2017. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101.
|
| 263 |
+
|
| 264 |
+
Jiasen Lu, Batra Dhruv, Parikh Devi, and Lee Lee. 2019. ViLBERT: Pretraining task-agnostic visiolinguistic representations for vision-and-language tasks. arXiv preprint arXiv:1908.02265.
|
| 265 |
+
|
| 266 |
+
Ruotian Luo. 2020. A better variant of self-critical sequence training. arXiv preprint arXiv:2003.09971.
|
| 267 |
+
|
| 268 |
+
Ruotian Luo, Brian Price, Scott Cohen, and Gregory Shakhnarovich. 2018. Discriminability objective for training descriptive captions. arXiv preprint arXiv:1803.04376.
|
| 269 |
+
|
| 270 |
+
Chih-Yao Ma, Jiasen Lu, Zuxuan Wu, Ghassan AlRegib, Zsolt Kira, Richard Socher, and Caiming Xiong. 2019a. Self-monitoring navigation agent via auxiliary progress estimation. In ICLR.
|
| 271 |
+
|
| 272 |
+
Chih-Yao Ma, Zuxuan Wu, Ghassan AlRegib, Caiming Xiong, and Zsolt Kira. 2019b. The regretful agent: Heuristic-aided navigation through progress estimation. In CVPR.
|
| 273 |
+
|
| 274 |
+
Khanh Nguyen and Hal Daumé III. 2019. Help, anna! visual navigation with natural multimodal assistance via retrospective curiosity-encouraging imitation learning. 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 684–695.
|
| 275 |
+
|
| 276 |
+
Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing 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.
|
| 277 |
+
|
| 278 |
+
Peng Qi, Yuhao Zhang, Yuhui Zhang, Jason Bolton, and Christopher D Manning. 2020a. Stanza: A python natural language processing toolkit for many human languages. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics: System Demonstrations, pages 101–108.
|
| 279 |
+
|
| 280 |
+
Yuankai Qi, Qi Wu, Peter Anderson, Xin Wang, William Yang Wang, Chunhua Shen, and Anton van den Hengel. 2020b. Reverie: Remote embodied visual referring expression in real indoor environments. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9982–9991.
|
| 281 |
+
|
| 282 |
+
Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. 2021. Learning transferable visual models from natural language supervision. arXiv preprint arXiv:2103.00020.
|
| 283 |
+
|
| 284 |
+
Maithra Raghu, Thomas Unterthiner, Simon Kornblith, Chiyuan Zhang, and Alexey Dosovitskiy. 2021. Do vision transformers see like convolutional neural networks? In Thirty-Fifth Conference on Neural Information Processing Systems.
|
| 285 |
+
|
| 286 |
+
Steven J Rennie, Etienne Marcheret, Youssef Mroueh, Jerret Ross, and Vaibhava Goel. 2017. Selfcritical sequence training for image captioning. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 7008–7024.
|
| 287 |
+
|
| 288 |
+
Olga Russakovsky, Jia Deng, Hao Su, Jonathan Krause, Sanjeev Satheesh, Sean Ma, Zhiheng Huang, Andrej Karpathy, Aditya Khosla, Michael Bernstein, et al. 2015. Imagenet large scale visual recognition challenge. International journal of computer vision, 115(3):211–252.
|
| 289 |
+
|
| 290 |
+
Mert Bulent Sariyildiz, Julien Perez, and Diane Larlus. 2020. Learning visual representations with caption annotations. arXiv preprint arXiv:2008.01392.
|
| 291 |
+
|
| 292 |
+
Ramprasaath R Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra. 2017. Grad-cam: Visual explanations from deep networks via gradient-based localization. In Proceedings of the IEEE international conference on computer vision, pages 618–626.
|
| 293 |
+
|
| 294 |
+
Shuai Shao, Zeming Li, Tianyuan Zhang, Chao Peng, Gang Yu, Xiangyu Zhang, Jing Li, and Jian Sun. 2019. Objects365: A large-scale, high-quality dataset for object detection. In Proceedings of the IEEE/CVF International Conference on Computer Vision.
|
| 295 |
+
|
| 296 |
+
Weijie Su, Xizhou Zhu, Yue Cao, Bin Li, Lewei Lu, Furu Wei, and Jifeng Dai. 2019. VL-BERT: Pre-training of generic visual-linguistic representations. arXiv preprint arXiv:1908.08530.
|
| 297 |
+
|
| 298 |
+
Hao Tan and Mohit Bansal. 2019. Lxmert: Learning cross-modality encoder representations from transformers. arXiv preprint arXiv:1908.07490.
|
| 299 |
+
|
| 300 |
+
Hao Tan and Mohit Bansal. 2020. Vokenization: Improving language understanding with contextualized, visual-grounded supervision. In Proc. of the Conference on Empirical Methods for Natural Language Processing (EMNLP).
|
| 301 |
+
|
| 302 |
+
Hao Tan, Licheng Yu, and Mohit Bansal. 2019. Learning to navigate unseen environments: Back translation with environmental dropout. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 2610–2621.
|
| 303 |
+
|
| 304 |
+
Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Proceedings of the 31st International Conference on Neural Information Processing Systems, pages 6000–6010.
|
| 305 |
+
|
| 306 |
+
Ramakrishna Vedantam, C Lawrence Zitnick, and Devi Parikh. 2015. Cider: Consensus-based image description evaluation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 4566–4575.
|
| 307 |
+
|
| 308 |
+
Liwei Wang, Yin Li, and Svetlana Lazebnik. 2016. Learning deep structure-preserving image-text embeddings. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 5005–5013.
|
| 309 |
+
|
| 310 |
+
Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. 2021. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. arXiv preprint arXiv:2102.12122.
|
| 311 |
+
|
| 312 |
+
Xin Wang, Qiuyuan Huang, Asli Celikyilmaz, Jianfeng Gao, Dinghan Shen, Yuan-Fang Wang, William Yang Wang, and Lei Zhang. 2019. Reinforced cross-modal matching and self-supervised imitation learning for vision-language navigation. In CVPR.
|
| 313 |
+
|
| 314 |
+
Xin Wang, Wenhan Xiong, Hongmin Wang, and William Yang Wang. 2018. Look before you leap: Bridging model-free and model-based reinforcement learning for planned-ahead vision-andlanguage navigation. In ECCV.
|
| 315 |
+
|
| 316 |
+
Ronald J Williams. 1992. Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine learning, 8(3-4):229–256.
|
| 317 |
+
|
| 318 |
+
Ning Xie, Farley Lai, Derek Doran, and Asim Kadav. 2019. Visual entailment: A novel task for fine-grained image understanding. arXiv preprint arXiv:1901.06706.
|
| 319 |
+
|
| 320 |
+
Zichao Yang, Xiaodong He, Jianfeng Gao, Li Deng, and Alex Smola. 2016. Stacked attention networks for image question answering. In CVPR.
|
| 321 |
+
|
| 322 |
+
Zhou Yu, Jun Yu, Yuhao Cui, Dacheng Tao, and Qi Tian. 2019. Deep modular co-attention networks for visual question answering. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 6281–6290.
|
| 323 |
+
|
| 324 |
+
Pengchuan Zhang, Xiujun Li, Xiaowei Hu, Jianwei Yang, Lei Zhang, Lijuan Wang, Yejin Choi, and Jianfeng Gao. 2021. Vinvl: Revisiting visual representations in vision-language models. arXiv preprint arXiv:2101.00529.
|
| 325 |
+
|
| 326 |
+
Luowei Zhou, Hamid Palangi, Lei Zhang, Houdong Hu, Jason Corso, and Jianfeng Gao. 2020. Unified vision-language pre-training for image captioning and vqa. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 13041–13049.
|
| 327 |
+
|
| 328 |
+
Fengda Zhu, Yi Zhu, Xiaojun Chang, and Xiaodan Liang. 2020. Vision-language navigation with selfsupervised auxiliary reasoning tasks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10012–10022.
|
| 329 |
+
|
| 330 |
+
Yuke Zhu, Oliver Groth, Michael Bernstein, and Li Fei-Fei. 2016. Visual7w: Grounded question answering in images. In CVPR.
|
| 331 |
+
|
| 332 |
+
# A APPENDIX
|
| 333 |
+
|
| 334 |
+
# A.1 VISUAL QUESTION ANSWERING
|
| 335 |
+
|
| 336 |
+
Model Architecture Pythia encodes the question with an attention-based GRU (Chung et al., 2014) network and fuse the information with a multi-modal factorized bilinear pooling network. MCAN takes a LSTM (Hochreiter and Schmidhuber, 1997) as question encoder and an encoder-decoder based modular co-attention network for fusing multiple representations. Both models employ an output classifier on top of the fused representation to predict the final answer. To integrate CLIP for the VQA models, we extract grid features using CLIP. For CLIP-ViT-B/32 models, we reshape the patch representation from the final layer into grid features. For CLIP-ResNet models, we simply take the grid features from the last layer before the pooling.
|
| 337 |
+
|
| 338 |
+
Implementation Details We follow (Jiang et al., 2020) to resize all input images to have a maximum shorter side of 600 pixels (longest 1000) when keeping the aspect ratio fixed. For training the detector on the VG dataset, we replace the backbone with CLIP visual module using implementation of Faster R-CNN in Detectron27. For training VQA models, we use hyperparameters of the opensource implementation8 from (Jiang et al., 2020) for the large version of the MCAN and base version of Pythia.
|
| 339 |
+
|
| 340 |
+
# A.2 IMAGE CAPTIONING
|
| 341 |
+
|
| 342 |
+
Implementation Details For training, we follow the ‘long epoch’ hyperparameter of the publicly available implementation 9. During the self-critical stage, we sample 5 captions for each image as in Luo (2020). For training objective, we experiment with the Self-Critical Sequence Training (SCST) in Rennie et al. (2017), where CIDEr (Vedantam et al., 2015) metric is optimized using REINFORCE algorithm (Williams, 1992).
|
| 343 |
+
|
| 344 |
+
# A.3 VISION-AND-LANGUAGE NAVIGATION
|
| 345 |
+
|
| 346 |
+
Model For the model architecture, we experiment with the basic attentive neural agent as in Fried et al. (2018).
|
| 347 |
+
|
| 348 |
+
The agent model (i.e., another LSTM) then attends to the visual features and the language representations to predict the actions. At each time step $t$ , the agent attends to the panoramic views $\{ v _ { t , i } \} _ { i }$ and the instruction $\{ w _ { j } \}$ to make the action. The panoramic view is processed with a pre-trained
|
| 349 |
+
|
| 350 |
+
Table 9: Comparison between grid features, CLIP features, and ImageNet-trained features on the R2R dataset. ‘SR’ and ‘SPL’ are success rate and success rate weighted by path length.
|
| 351 |
+
|
| 352 |
+
<table><tr><td>Feature</td><td>Dimension</td><td>SR</td><td>SPL</td></tr><tr><td>ImageNet-Res152</td><td>2048</td><td>48.2</td><td>44.4</td></tr><tr><td>CLIP-Res50</td><td>1024</td><td>52.6</td><td>47.4</td></tr><tr><td>Grid-Res50</td><td>2048</td><td>47.6</td><td>44.7</td></tr><tr><td>Grid-ResX101</td><td>2048</td><td>46.5</td><td>43.2</td></tr><tr><td>Grid-ResX152</td><td>2048</td><td>47.8</td><td>44.6</td></tr></table>
|
| 353 |
+
|
| 354 |
+
visual encoder (e.g., ResNet) and the instructions are processed by a language LSTM (Hochreiter and Schmidhuber, 1997), denoted $\mathrm { L S T M _ { L } }$ . The agent model, $\mathrm { L S T M _ { A } }$ , then attends to the visual features and the language representations to predict the actions.
|
| 355 |
+
|
| 356 |
+
$$
|
| 357 |
+
\begin{array} { r l } & { ~ g _ { t , i } = \mathrm { R e s N e t } ( v _ { t , i } ) } \\ & { x _ { 1 } , \ldots , x _ { l } = \mathrm { L S T M } _ { \mathrm { L } } ( w _ { 1 } , \ldots , w _ { l } ) } \\ & { ~ i n p u t _ { t } = [ \mathrm { A t t n } ( h _ { t - 1 } , \{ g _ { t , i } \} ) , \mathrm { A t t n } ( h _ { t - 1 } , \{ x _ { j } \} ) ] } \\ & { ~ h _ { t } , c _ { t } = \mathrm { L S T M } _ { \mathrm { A } } ( i n p u t _ { t } , h _ { t - 1 } , c _ { t - 1 } ) } \end{array}
|
| 358 |
+
$$
|
| 359 |
+
|
| 360 |
+
where $h _ { t }$ and $c _ { t }$ are the hiddens and states of the action LSTM at time step $t$ , respectively. Please refer to Fried et al. (2018) for the implementation details.
|
| 361 |
+
|
| 362 |
+
Implementation Details We apply our model to two vision-and-language navigation datasets: Room-to-Room (R2R, Anderson et al. (2018b)) and Room-across-Room (RxR, $\mathbf { K } \mathbf { u }$ et al. (2020)). R2R is built on the indoor environments from the MatterPort3D dataset (Chang et al., 2017). The environments are split into training (61 environments), unseen validation (11 environments), and unseen test (18 environments). The agent is trained on the training environments (with 14,025 navigation instructions) and tested on separate sets of environments (2,349 in the unseen-validation and 4,173 in the unseen-test). RxR extends the R2R dataset with multiple languages and follow the environment split. Besides the multilingual nature, RxR is also more diverse in the navigation paths and richer in the present language. For R2R dataset, we follow the hyperparameter (e.g., batch size, learning rate, optimizer) of the publicly available implementation 10 R2R-EnvDrop (Tan et al., 2019) and replace the input features 11 with the CLIP features. To reduce the computational cost, the features are pre-extracted and frozen during the training of the navigational agent. For RxR dataset, we take the processed multilingual data provided in Li et al. (2021a) with Stanza tokenizers (Qi et al., 2020a). Since RxR dataset contains instructions longer than R2R, we change the maximum input length to 160 (from 80) and increase the imitation learning ratio from 0.2 to 0.4 to stabilize the training. Other training hyperparameters of $\mathbf { R x R }$ are the same as R2R. The models are trained on one RTX 2080 Ti GPU. It takes 1 days to converge in R2R and about 1.5 days to converge in RxR. We report two significant digits for R2R unseen test results following the leaderboard convention.
|
| 363 |
+
|
| 364 |
+
Results Comparison to Grid Features In the main paper, we compare the results regarding the ImageNet-pre-trained ResNet-152. We also report the comparison to grid features Jiang et al. (2020) that is trained with detection dataset. Jiang et al. (2020) showed that the results with these features are comparable to the original bottom-up attention with a heavy detection module. The same as the VQA task in Section 3.1, we test the performance of these detection-trained grid features on VLN tasks. Specifically, we use the mean pooling of the feature map as the representation of each view following previous works (Anderson et al., 2018b). As shown in Table 9, under the same ResNet50 backbone 12, we find that the detection-trained grid features are on par with the classification-trained grid features, still showing a gap to the contrastive-trained grid features. We hypothesize that the grid features inject regional knowledge into the dense feature map thus showing good results with grid-based modules (as shown in Section 3.1). However, pooling the feature map into a single feature vector (as in previous VLN works) leads to a loss of this dense information.
|
| 365 |
+
|
| 366 |
+
# A.4 DETAILS OF CLIP-VILP
|
| 367 |
+
|
| 368 |
+
Pre-training We pre-train with a batch size of 512. The Transformer is initialized from BERTBASE and optimized with an AdamW (Loshchilov and Hutter, 2017) optimizer. We use a linearly-decaying schedule and a peak learning rate of $1 \times 1 0 ^ { - 4 }$ for the model with CLIP-Res50 and $5 \times 1 \dot { 0 } ^ { - 5 }$ for the model with CLIP-Res50x4. The ResNet is initialized from CLIP and we use SGD with a learning rate of $3 \times 1 0 ^ { - 3 }$ . We decay the learning rate of SGD at epochs 12, 17 by a factor of 10. Per the suggestion of Tan and Bansal (2019), we only add the visual question answering loss during the later stage of the pre-training (the last 11 epochs) as the model is prone to overfit to the visual question answering loss. The model is trained on 8 Nvidia A100 GPUs and the pre-training takes around 5 days.
|
| 369 |
+
|
| 370 |
+

|
| 371 |
+
Figure 4: Grad-CAM Visualization of CLIP-ViT-B/32, CLIP-ViT-B/16, CLIP-Res50, CLIP-Res101 and CLIP-Res50x4 for the question “What color are her eyes?”.
|
| 372 |
+
|
| 373 |
+
Fine-tuning We fine-tune CLIP- $\mathrm { \cdot V i L _ { p } }$ on three tasks: VQA v2.0, SNLI-VE, and GQA. We introduce the task specifics and fine-tuning hyper-parameters in the following.
|
| 374 |
+
|
| 375 |
+
Every example in VQA consists of an image and a question, where the task is to predict the correct answer. We use the Karpathy split for training and validation (Karpathy and Fei-Fei, 2015). We fine-tune the model with the binary cross-entropy loss for 5 epoch with a batch size of 256. The Transformer is optimized with AdamW and a peak learning rate of $5 \times 1 0 ^ { - 5 }$ . The ResNet is optimized with SGD and an initial learning rate of $1 \times \bar { 1 } 0 ^ { - 3 }$ . We decay the learning rate of ResNet by a factor of 10 after epoch 3.
|
| 376 |
+
|
| 377 |
+
SNLI-VE is a three-way classification task, which involves determining the relation between an image and a sentence. The three possible relations include entailment, contradiction, and neutral. We fine-tune the model with the negative log-likelihood loss for 2 epoch with a batch size of 256. The Transformer is optimized with AdamW and a peak learning rate of $5 \times 1 0 ^ { - 5 }$ . The ResNet is optimized with SGD and an initial learning rate of $\bar { 1 \times 1 0 ^ { - 3 } }$ . We decay the learning rate of ResNet by a factor of 10 after epoch 1.
|
| 378 |
+
|
| 379 |
+
GQA follows the format of VQA but the questions and answers of GQA are automatically generated from ground-truth scene graphs. We use the same hyper-parameters as in VQA.
|
| 380 |
+
|
| 381 |
+

|
| 382 |
+
Figure 5: Grad-CAM Visualization of CLIP-ViT-B/32, CLIP-ViT-B/16, CLIP-Res50, CLIP-Res101 and CLIP-Res50x4 for the question “What is just above the plate?”.
|
| 383 |
+
|
| 384 |
+
Table 10: The performance of finetuned CLIP text encoder and visual encoder without VLP on VQA.
|
| 385 |
+
|
| 386 |
+
<table><tr><td>Image Encoder</td><td>Text Encoder</td><td>VQAmini-eval</td></tr><tr><td rowspan="3">CLIP-Res50</td><td>BERT-base</td><td>62.66</td></tr><tr><td>RoBERTa-base</td><td>62.85</td></tr><tr><td>CLIP-Res50-text</td><td>62.24</td></tr><tr><td rowspan="3">CLIP-ViT-B/32</td><td>BERT-base</td><td>61.51</td></tr><tr><td>RoBERTa-base</td><td>61.79</td></tr><tr><td>CLIP-ViT-B/32-text</td><td>61.12</td></tr></table>
|
| 387 |
+
|
| 388 |
+
# A.5 MORE QUALITATIVE EXAMPLES
|
| 389 |
+
|
| 390 |
+
Here we present more qualitative examples using (Grad-CAM) (Selvaraju et al., 2017) to visualize the salient regions of CLIP models. Figure 4 and Figure 5 suggest that CLIP-ResNet localizes the sentence better than CLIP-ViT variants.
|
| 391 |
+
|
| 392 |
+
# A.6 ANALYSIS ON THE CLIP TEXT ENCODER
|
| 393 |
+
|
| 394 |
+
We extended the experiments in Table 8 $\mathbf { ( V Q A _ { t e s t - d e v } ) }$ without pre-training while fine-tuning both visual encoder and text encoder on $\mathrm { V Q A } _ { \mathrm { m i n i - e v a l } }$ . The results suggest the CLIP text encoder consistently perform worse than BERT/RoBERTa counterparts even though CLIP is pre-trained with “in-domain” image-text pairs.
|
| 395 |
+
|
| 396 |
+
For directly analyzing the capability of the CLIP text encoder, we add experiments with fine-tuning CLIP text encoder on representative NLU tasks (GLUE). On the largest two tasks (QQP, MNLI), BERT-base (12 layer, 768 width) achieves $8 7 . 1 \pm 0 . 2$ on QQP and $7 7 . 9 \pm 0 . 3$ on MNLI. CLIP-Res50 text encoder (12 layer, 512 width) achieves $7 2 . 0 \pm 0 . 3$ and $5 1 . 6 \pm 0 . 4$ . CLIP-ViT-B/32 text encoder achieves similar performance as CLIP-Res50 with the same architecture. CLIP-Res50x4 text encoder (12 layer, 640 width) achieves $7 3 . 8 \pm 0 . 3$ and $5 3 . 8 \pm 0 . 3$ . We conduct the experiments with 32 batch size, 3 epochs, 3 random seeds and search the learning rate in $[ 1 \times 1 0 ^ { - 6 }$ , $1 \times 1 0 ^ { - 5 }$ , $3 \times 1 0 ^ { - 5 }$ , $5 \times 1 0 ^ { - 5 } ]$ . These results may directly reflect the inferior text encoder of CLIP which may be caused by the noisy and short text in the paired image-text data (Tan and Bansal, 2020).
|
md/dev/zq1iJkNk3uN/zq1iJkNk3uN.md
ADDED
|
@@ -0,0 +1,408 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# SUPERVISION EXISTS EVERYWHERE: A DATA EFFICIENT CONTRASTIVE LANGUAGE-IMAGE PRE-TRAINING PARADIGM
|
| 2 |
+
|
| 3 |
+
Yangguang $\mathbf { L i } ^ { * 1 , }$ ,, Feng Liang∗ 2, Lichen Zhao∗ 1, Yufeng $\mathbf { C } \mathbf { u } \mathbf { i }$ , Wanli Ouyang3, Jing Shao1, Fengwei ${ { \bf { Y } } { \bf { u } } ^ { 1 } }$ , Junjie Yan1
|
| 4 |
+
|
| 5 |
+
1SenseTime Research
|
| 6 |
+
2The University of Texas at Austin
|
| 7 |
+
3University of Sydney
|
| 8 |
+
{liyangguang,zhaolichen,cuiyufeng}@sensetime.com
|
| 9 |
+
jeffliang@utexas.edu
|
| 10 |
+
|
| 11 |
+
# ABSTRACT
|
| 12 |
+
|
| 13 |
+
Recently, large-scale Contrastive Language-Image Pre-training (CLIP) (Radford et al., 2021) has attracted unprecedented attention for its impressive zero-shot recognition ability and excellent transferability to downstream tasks. However, CLIP is quite data-hungry and requires 400M image-text pairs for pre-training, thereby restricting its adoption. This work proposes a novel training paradigm, Data efficient CLIP (DeCLIP), to alleviate this limitation. We demonstrate that by carefully utilizing the widespread supervision among the image-text pairs, our DeCLIP can learn generic visual features more efficiently. Instead of using the single image-text contrastive supervision, we fully exploit data potential through the use of (1) self-supervision within each modality; (2) multi-view supervision across modalities; (3) nearest-neighbor supervision from other similar pairs. Benefiting from these intrinsic supervision, our DeCLIP-ResNet50 can achieve $6 0 . 4 \%$ zeroshot top1 accuracy on ImageNet, which is $0 . 8 \%$ above the CLIP-ResNet50 while using $7 . 1 \times$ fewer data. Our DeCLIP-ResNet50 outperforms its counterpart in 8 out of 11 visual datasets when transferred to downstream tasks. Moreover, Scaling up the model and computing also works well in our framework. Our code, dataset and models are released at: https://github.com/Sense-GVT/DeCLIP
|
| 14 |
+
|
| 15 |
+
# 1 INTRODUCTION
|
| 16 |
+
|
| 17 |
+
Over the last few years, pre-trained models have greatly revolutionized computer vision (CV) and natural language processing (NLP). The first wave of exploring pre-trained models took place in the field of CV. Deep convolutional neural nets (Krizhevsky et al., 2012; Simonyan & Zisserman, 2014; He et al., 2016) are pre-trained on well-labeled ImageNet (Deng et al., 2009) and then transferred to downstream CV tasks (Girshick et al., 2014; Long et al., 2015; Vinyals et al., 2015). Standardly, CV models are pre-trained to predict a fixed set of pre-defined object categories, e.g., 1000 classes in ImageNet. However, this supervised pre-training is hard to scale since we need arduous human labeling to specify new visual concepts.
|
| 18 |
+
|
| 19 |
+
When pre-training meets NLP, the intrinsic supervision within the natural language makes the pretraining more scalable (Devlin et al., 2018; Radford et al., 2019; Brown et al., 2020). Witnessing the progress in NLP, researchers use natural language supervision to learn visual features. The language-image pre-training can scale up to a very large size, benefiting from abundant image-text pairs on the Internet. For instance, CLIP (Radford et al., 2021) and ALIGN (Jia et al., 2021) adopt the contrastive loss to push the embedding of matched image-text pairs together while pushing those of non-matched pairs apart. They achieve prestigious performance by learning from an enormous dataset that contains 400M/1B image-text pairs. However, these methods also require huge storage and computing resources, which is not affordable for most laboratories and companies. We argue that these prior arts only use the single image-text contrastive supervision while overlooking the widespread supervision within the pairs, thus is inefficient.
|
| 20 |
+
|
| 21 |
+

|
| 22 |
+
Figure 1: Zero-shot performance of CLIP- Figure 2: Transfer the DeCLIP-ResNet50 (abbr. ResNet50 and our DeCLIP-ResNet50 when us- as DeC) and CLIP-ResNet50 (abbr. as C) to 11 ing different amounts of data. (88M, $6 2 . 5 \% )$ ) de- downstream visual datasets using linear probe notes the use of 88M data with top-1 accuracy verification. Our DeCLIP achieves better results $6 2 . 5 \%$ on the ImageNet-1K validation dataset. in 8 out of 11 datasets. Our model has much better data efficiency.
|
| 23 |
+
|
| 24 |
+
Firstly, there underlies rich structural information within each modality itself (LeCun & Misra, 2021). We can tweak some words/pixels in a sentence/image while retaining a similar semantic meaning. This sort of self-supervision can be exploited to learn a more common-sense representation for each modality (Devlin et al., 2018; He et al., 2020; Chen et al., 2020a). Moreover, inspired by contrasting multi-crops in an image (Caron et al., 2020), we further extend the multi-view 1 supervision into our multi-modality setting. Specifically, each image is paired with multiple textual descriptions obtained via stochastic augmentations, vice versa. The benefit is intuitive: this auxiliary multi-view supervision brings more invariant and robust information.
|
| 25 |
+
|
| 26 |
+
Besides these overlooked supervision, we propose a novel nearest-neighbor (NN) supervision from other similar pairs. This NN supervision is mainly based on the intuition that one image is likely to have other similar text descriptions among the dataset. As shown in right figure, the image with the text ’going to see a lot of vintage tractors this week’ can also be described by ’vintage at tractors a gathering’. For this reason, we sample the NN in the embedding space and utilize them as additional supervisory signals. Aggregating these supervision leads to our novel training paradigm DeCLIP, which stands for Data efficient Contrastive Language-Image Pretraining.
|
| 27 |
+
|
| 28 |
+
Extensive experiments show the effectiveness and efficiency of our DeCLIP. As shown in Fig. 1, with a ResNet50 image encoder and a Transformer text encoder, our model can achieve $6 0 . 4 \%$ zero-shot top1 accuracy on ImageNet, which is $0 . 8 \%$ above the CLIPResNet50 while using $7 . 1 \times$ fewer data. Using only 88M image-text pairs, our best ResNet50/ViTB32 models boost the zero-shot performance to $6 2 . 5 \%$ and $6 6 . 2 \%$ , nearly $3 . 0 \%$ higher than the best number reported for these two architectures. We further verify the transferability of our models on downstream tasks. As indicated in Fig. 2, our DeCLIP-ResNet50 outperforms its counterpart in 8 out of 11 visual datasets. Moreover, Scaling up the model and computing also works well in our framework. Using $4 . 5 \times$ fewer data, our DeCLIP-RegNetY-64GF achieves $7 3 . 7 \%$ zero-shot ImageNet top1 accuracy, which is on-pair with CLIP- ${ \mathrm { R 5 0 } } \times 6 4$ . Pre-trained models, code, and datasets shall be released to the community. The contributions are summarized as follows:
|
| 29 |
+
|
| 30 |
+

|
| 31 |
+
Figure 3: Examples of Nearest Neighbor from Conceptual Captions dataset.
|
| 32 |
+
|
| 33 |
+
• To the best of our knowledge, this is the first work to study self-supervision and cross-modal multi-view supervision in the million-scale image-text pre-training task. Our work opens a new direction to fully exploit the intrinsic supervision within the multi-modal data instead of scaling up data naively.
|
| 34 |
+
|
| 35 |
+
• We propose novel cross-modal Nearest-Neighbor Supervision (NNS) to harness information from other similar pairs. The NNS can also be regarded as a semantic-level augmentation.
|
| 36 |
+
|
| 37 |
+
# 2 RELATED WORK
|
| 38 |
+
|
| 39 |
+
# 2.1 PRE-TRAINED MODELS
|
| 40 |
+
|
| 41 |
+
The critical idea of pre-training is to first extract general knowledge implicitly from the massive amount of data and then transfer the knowledge to versatile downstream tasks (Han et al., 2021). Big NLP models (Devlin et al., 2018; Brown et al., 2020) yield unprecedented performance via learning from tremendous language data over the Internet and labor-free supervision within the language itself. In the field of CV, supervised pre-training on ImageNet is still the standard practice. While achieving great success on downstream CV tasks (Girshick et al., 2014; Long et al., 2015; Vinyals et al., 2015) , this supervised manner is hard to scale. To address this challenge, our DeCLIP learns directly from image-text pairs that are abundant across the Internet. More importantly, by exploiting the widespread supervision within the pairs, our DeCLIP is more data-efficient than the prior art.
|
| 42 |
+
|
| 43 |
+
# 2.2 SUPERVISION WITHIN DATA
|
| 44 |
+
|
| 45 |
+
Language supervision Joulin et al. (2016); Gomez et al. (2017); Zhang et al. (2020); Sariyildiz et al. (2020); Desai & Johnson (2021) demonstrate the effectiveness of learning transferable visual features from language supervision. Pioneering work CLIP (Radford et al., 2021) and ALIGN (Jia et al., 2021) achieve prestigious performance via learning from 400M/1B image-text pairs. We are following these two works to improve their data efficiency.
|
| 46 |
+
|
| 47 |
+
Relevant concurrent work including: SLIP Mu et al. (2021) introduces self-supervision to CLIP. FILIP Yao et al. (2021) leverages the finer-grained alignment between image patches and textual words. OTTER Wu et al. (2021); Cheng et al. (2021) uses online entropic optimal transport to find a soft image-text match as labels to mitigate the noise within the dataset.
|
| 48 |
+
|
| 49 |
+
Visual self-supervision Our work is also highly related to self-supervised learning (SSL) (LeCun & Misra, 2021). Contrastive learning, as a pretext task of SSL, has achieved remarkable success in visual representation learning (He et al., 2020; Chen et al., 2020a; Caron et al., 2020; Grill et al., 2020; Chen et al., 2020a). Researchers also extend contrastive learning into multi-modal settings (Yuan et al., 2021). However, it is only limited to a small COCO dataset (Yuan et al., 2021).
|
| 50 |
+
|
| 51 |
+
Nearest-neighbor supervision Recently, researchers have exploited nearest-neighbor supervision to learn visual features (Dwibedi et al., 2021; Van Gansbeke et al., 2021). They find that using nearest-neighbor as positive samples in the contrastive loss improves the performances on multiple downstream tasks. However, they mainly focus on the single visual modality pretraining on relatively small datasets, such as ImageNet. We propose novel nearest-neighbor supervision for multi-modal learning to harness information from other similar pairs.
|
| 52 |
+
|
| 53 |
+
# 2.3 MULTI-MODAL LEARNING
|
| 54 |
+
|
| 55 |
+
Most vision-language models Chen et al. (2020b); Lu et al. (2019); Li et al. (2020) use a bunch of cross-modal transformers to fuse and align the information between text and image. These methods either need an off-the-shelf object detector to extract region features or dedicated cross-modal transformer layers, significantly hindering their scalability. Our DeCLIP, by contrast, uses a simple yet effective two-tower framework with multi-modal interaction only at the top. Moreover, this series of models (Radford et al., 2021; Jia et al., 2021; Huo et al., 2021) can perform zero-shot recognition, adapting to new categories with no seen labeled data. Shen et al. (2021) also shows that the pretrained CLIP model can significantly benefit the downstream VQA and image caption tasks. Our DeCLIP is supposed to be compatible with more modalities, e.g., acoustic signals (Akbari et al., 2021). More modalities included, more correlated supervision are expected to be exploited.
|
| 56 |
+
|
| 57 |
+

|
| 58 |
+
Figure 4: (a) CLIP and ALIGN jointly train an image encoder and a text encoder to predict the correct pairings of a batch of (image, text) training examples. (b) Our DeCLIP overview. $\textcircled{1}$ means Self-Supervision(SS). For image SS, we maximize the similarity between two augmented views of the same instance. For text SS, we leverage Masked Language Modeling(MLM) within a text sentence. $\textcircled{2}$ represents cross-modal Multi-View Supervision(MVS). We first have two augmented views of both image and text, then contrast the $2 \times 2$ image-text pairs. $\textcircled{3}$ indicates NearestNeighbor Supervision(NNS). We sample text NN in the embedding space to serve as additional supervision. The combination of the three supervision leads to efficient multi-modal learning.
|
| 59 |
+
|
| 60 |
+
# 3 APPROACH
|
| 61 |
+
|
| 62 |
+
In this section, we first revisit CLIP and denote some basic concepts, such as image-text contrastive supervision (i.e., the InfoNCE loss). Next, we present the overview of our DeCLIP framework. Then we introduce every auxiliary supervision: Self-Supervision(SS), Multi-View Supervision(MVS), and Nearest-Neighbor Supervision(NNS).
|
| 63 |
+
|
| 64 |
+
# 3.1 REVISITING CLIP
|
| 65 |
+
|
| 66 |
+
Contrastive Language-Image Pre-training (CLIP) (Radford et al., 2021) aims to learn directly from the raw text about images. They use a dual-encoder architecture as in Fig. 4(a). The model consists of an image encoder (e.g., CNN (He et al., 2016) or ViT (Dosovitskiy et al., 2020)) and a text encoder(e.g., Transformer (Vaswani et al., 2017) or its variants (Radford et al., 2019)), with a multimodal interaction at the top. The image and text features are projected to the same dimension and followed by L2 normalization before interaction. At the training phase, a contrastive objective pushes the embeddings of matched image-text pairs together while pushing those of non-matched pairs apart. In a batch of $N$ image-text pairs $\{ ( \pmb { x } _ { i } ^ { I } , \pmb { x } _ { i } ^ { T } ) \}$ , we denote $\bar { \mathbf { \boldsymbol { x } } } _ { i } ^ { I }$ and $\mathbf { \bar { \mathbf { x } } } _ { i } ^ { T }$ as image and text of the $i _ { t h }$ pair. Let $z _ { i } ^ { I }$ and $z _ { j } ^ { T }$ be the normalized embedding of the $i _ { t h }$ image and $j _ { t h }$ text, respectively. CLIP uses InfoNCE loss (Oord et al., 2018). The loss for the image encoder can be denoted as Eq. 1.
|
| 67 |
+
|
| 68 |
+
$$
|
| 69 |
+
L _ { I } = - \frac { 1 } { N } \sum _ { i = 1 } ^ { N } \log \frac { \exp ( \sin ( z _ { i } ^ { I } , z _ { i } ^ { T } ) / \tau ) } { \sum _ { j = 1 } ^ { N } \exp ( \sin ( z _ { i } ^ { I } , z _ { j } ^ { T } ) / \tau ) }
|
| 70 |
+
$$
|
| 71 |
+
|
| 72 |
+
Here, the similarity function $\mathrm { s i m } ( , )$ is measured by dot product, and $\tau$ is a learnable temperature variable to scale the logits. We have a symmetrical loss for image and text encoder, thus the overall loss function $L _ { C L I P }$ is the average of $L _ { I }$ and $L _ { T }$ .
|
| 73 |
+
|
| 74 |
+
At the test phase, the learned text encoder synthesizes a zero-shot linear classifier by embedding the arbitrary categories of the test dataset. Because it is rare in the dataset that image caption is just
|
| 75 |
+
|
| 76 |
+
a single word, CLIP uses prompts to make up the context of the category $\{ 1 \mathsf { a b e 1 } \}$ , such as $" a$ photo of $\mathrm { ~ a ~ } \left\{ 1 \mathrm { a b } { \in } 1 \right\} "$ . Unless otherwise specified, we use the same prompt engineering and ensembling techniques as CLIP. Details can be found in Appendix E.
|
| 77 |
+
|
| 78 |
+
# 3.2 OVERVIEW OF DECLIP
|
| 79 |
+
|
| 80 |
+
As shown in Fig. 4(b), our DeCLIP has three additional supervisory signals.
|
| 81 |
+
|
| 82 |
+
$\textcircled{1}$ We first use existing methods to exploit image and text Self-Supervision (SS) within its modality. For image SS, we adopt the simple yet effective SimSiam (Chen & He, 2021). The objective is to maximize the similarity between two augmented image features. For text SS, we adopt the most widely used Masked Language Modeling (MLM) (Devlin et al., 2018) as the pre-text task. We believe other kinds of self-supervised learning algorithms (e.g. MoCo (He et al., 2020), SimCSE (Gao et al., 2021) are orthogonal with our framework.
|
| 83 |
+
|
| 84 |
+
$\textcircled{2}$ While SS only focuses on a single modality, we further propose cross-modal Multi-View Supervision (MVS). We apply stochastic data augmentations for both images and texts, resulting in two correlated views1 of each example. Then, the image-text contrastive loss is calculated for all the $2 \times 2$ pairs. Worth mentioning, the original CLIP does not use text augmentations and only uses random square crop image augmentations, thereby is data-hungry. The extension is instinctive and straightforward. Specifically, we contrast the $2 \times 2$ pairs and resulting in $3 \times$ more additional supervision.
|
| 85 |
+
|
| 86 |
+
$\textcircled{3}$ We also propose novel Nearest-Neighbor Supervision (NNS) mined in embedding space to make better use of similar text descriptions among the dataset. In detail, we maintain a first-in-first-out feature queue that is representative of the whole data distribution. We use the nearest-neighbor search in embedding space to get the semantically similar text descriptions. Then we use the imagetext contrastive loss to get additional supervision.
|
| 87 |
+
|
| 88 |
+
# 3.3 SUPERVISION EXISTS EVERYWHERE
|
| 89 |
+
|
| 90 |
+
Self-Supervision within each modality Following SimSiam (Chen & He, 2021) (depicted in Fig 5(a)), we first have two augmented views $( x ^ { I } , \bar { \tilde { x } } ^ { I } )$ for each image. These two views are sent to the image encoder (weights are shared between views). We also use the popularized nonlinear predictor module, which is typically a 2-layer MLP, to improve the representation quality in the encoder (Chen et al., 2020a). The objective is to maximize the similarity between $\tilde { z } ^ { I }$ and $p ^ { I }$ , which is a negative cosine similarity in this paper. To avoid the trivial “collapsing” solution, we follow (Chen & He, 2021) to adopt a stop-grad technique.
|
| 91 |
+
|
| 92 |
+
As shown in Fig. 5(b), we follow the method in BERT (Devlin et al., 2018) for our text self-supervision. In detail, we first randomly choose $1 5 \%$ of all tokens in each sequence. Then the token is replaced with (1) the [mask] token $8 0 \%$ of the time (2) a random token $1 0 \%$ of the time (3) the unchanged token $1 0 \%$ of the time. Then, the output of the language module for the corresponding token is used to predict the original token with cross-entropy loss.
|
| 93 |
+
|
| 94 |
+

|
| 95 |
+
Figure 5: Self-Supervision with each modality. We adopt SimSiam and MLM for image and text SS.
|
| 96 |
+
|
| 97 |
+
Multi-View Supervision The authors only contrast the original text (w/o augmentation) with a single ‘global view’ of the image in the original CLIP. However, the text annotation of the image might not describe the whole picture, instead depicts a small local view of this image. For instance, as shown in the image with the text "a cute white cat" in Fig. 4, the central concept (cat) only occupies a small part of the picture. To mitigate this discrepancy, we get a closer look at the local region and utilize it as our auxiliary supervision, as shown in the augmented view in Fig. 4(b). This intuitive idea is akin to the successful Multi-crop transformation (Caron et al., 2020; Van Gansbeke et al., 2021) in image SSL. We further extend it into the multi-modal setting. More specifically, we reuse the two image views introduced in SS, which contains the RandomResizedCrop policy to obtain a small local view. For text, as our goal is to understand the overall semantic meaning of a sentence, we adopt text classification augmentation EDA (Wei & Zou, 2019) to generate two text views. Besides the original contrastive loss between $( z ^ { I } , \dot { z } ^ { T } )$ , we can contrast $( \breve { z } ^ { I } , \tilde { z } ^ { T } )$ , $( \tilde { z } ^ { I } , z ^ { T } )$ and $( \tilde { z } ^ { I } , \tilde { z } ^ { T } )$ , leading to $3 \times$ diverse and high-quality additional supervision. More conveniently, they are naturally compatible with the image-text contrastive loss as denoted in Eq. 1.
|
| 98 |
+
|
| 99 |
+
Nearest-Neighbor Supervision As shown in Fig 3, one image is likely to have other similar text descriptions among the dataset. To harness the information from other pairs and go beyond single pairs, we propose using nearest-neighbor (NN) to obtain more diverse supervision. More formally, we aim to find the NN feature $z ^ { T ^ { \prime } }$ of text feature $z ^ { T }$ in the embedding space. The distance between two features could be measured by a simple cosine similarity. It is infeasible to search NN in the whole million-scale dataset. Thus, we maintain a FIFO queue $Q$ to simulate the whole data distribution. The size of $Q$ is 64K in our implementation. As shown in Fig. 6, we further get the contrastive loss between $( z ^ { I } , z ^ { T ^ { \prime } } )$ . Since there are two augmented image features, we also calculate the contrastive loss between $( \tilde { z } ^ { I } , z ^ { T ^ { \prime } } )$ . Fortunately, NNS is also compatible with Eq. 1.
|
| 100 |
+
|
| 101 |
+
In summary, we denote $L _ { I S S }$ and $L _ { T S S }$ as the loss function of image SS and text SS, respectively. ${ \cal L } _ { M V S }$ is multi-view loss, and $L _ { N N S }$ is nearest-neighbor loss. We have the overall loss function of our DeCLIP as in Eq. 2.
|
| 102 |
+
|
| 103 |
+

|
| 104 |
+
Figure 6: Nearest-Neighbor Supervision. $z ^ { T ^ { \prime } }$ is the NN of feature $z ^ { T }$ in the embedding space. $z ^ { T ^ { \prime } }$ will serve as an additional objective for $z ^ { I }$ . We use the feature-level nearest neighbor for the text descriptions as the supervision.
|
| 105 |
+
|
| 106 |
+
$$
|
| 107 |
+
L _ { D e C L I P } = ( 1 - \alpha - \beta - \gamma ) L _ { C L I P } + \alpha ( L _ { I S S } + L _ { T S S } ) + \beta L _ { M V S } + \gamma L _ { N N S }
|
| 108 |
+
$$
|
| 109 |
+
|
| 110 |
+
# 4 EXPERIMENTS
|
| 111 |
+
|
| 112 |
+
# 4.1 DATASETS
|
| 113 |
+
|
| 114 |
+
Pre-training datasets We summarize our pre-training dataset as in Tab. 1. Our DeCLIP full data consists of two parts: open-source data and web-crawled data. The open-source data comes from three different datasets: Conceptual Captions (CC3M) (Sharma et al., 2018), Conceptual 12M (CC12M) (Changpinyo et al., 2021), and YFCC (Thomee et al., 2016). Worth mentioning, due to the download failure or nonEnglish caption, we do not obtain the complete data for these datasets. We further use the YFCC15M query to crawl about 59M filtered
|
| 115 |
+
|
| 116 |
+
Table 1: Details of DeCLIP pre-training datasets.
|
| 117 |
+
|
| 118 |
+
<table><tr><td>DATASET</td><td>TRAINING SIZE</td></tr><tr><td>CLIP (RADFORD ET AL.,2021)</td><td>400M</td></tr><tr><td>ALIGN (JIA ET AL., 2021)</td><td>1.8B</td></tr><tr><td>CC (SHARMA ET AL., 2018)</td><td>3M</td></tr><tr><td>CC-12M(CHANGPINYO ET AL.,2021)</td><td>11M</td></tr><tr><td>YFCC (THOMEE ET AL.,2016)</td><td>15M</td></tr><tr><td>DECLIP OPEN-SOURCE DATA</td><td>29M</td></tr><tr><td>DECLIP WEB-CRAWLED DATA</td><td>59M</td></tr><tr><td>DECLIP FULL DATA</td><td>88M</td></tr></table>
|
| 119 |
+
|
| 120 |
+
web data on the Internet, together with open-source data to form the 88M DeCLIP full pre-training dataset. More details can be seen in Appendix C.
|
| 121 |
+
|
| 122 |
+
Downstream datasets We assess our model performances in a wider variety of distributions and tasks. Following the CLIP (Radford et al., 2021), we evaluate the image encoder transferability on 11 widely used downstream datasets, such as Food-101, CIFAR-10, etc. To conduct a fair comparison, the metric and division for each dataset that can be collected are consistent with those of CLIP. More details of downstream datasets can be found in Tabel 6 of Appendix D.
|
| 123 |
+
|
| 124 |
+
Table 2: Zero-shot top1 accuracy on ImageNet. Our DeCLIP shows great data-efficency.
|
| 125 |
+
|
| 126 |
+
<table><tr><td>METHOD</td><td>IMAGE ENCODER</td><td>#PARAMS</td><td>TRAINING SIZE</td><td>ZERO-SHOT TOP1 ACC.</td></tr><tr><td>CLIP+</td><td>REsNET50</td><td>24M</td><td>88M</td><td>56.9</td></tr><tr><td>CLIP</td><td>REsNET50</td><td>24M</td><td>400M</td><td>59.6</td></tr><tr><td>DECLIP</td><td>REsNET50</td><td>24M</td><td>88M(↓4.5×)</td><td>62.5(个 +2.9)</td></tr><tr><td>CLIP</td><td>REsNET101</td><td>42M</td><td>400M</td><td>62.2</td></tr><tr><td>CLIP†</td><td>VIT-B/32</td><td>88M</td><td>88M</td><td>57.4</td></tr><tr><td>CLIP</td><td>VIT-B/32</td><td>88M</td><td>400M</td><td>63.2</td></tr><tr><td>DECLIP</td><td>VIT-B/32</td><td>88M</td><td>88M(↓4.5×)</td><td>66.2(↑ +3.0)</td></tr><tr><td>CLIP</td><td>ResNET50×64</td><td>291M</td><td>400M</td><td>73.6</td></tr><tr><td>DECLIP</td><td>REGNETY-64GF</td><td>276M</td><td>88M(↓4.5×)</td><td>73.7(个 +0.1)</td></tr></table>
|
| 127 |
+
|
| 128 |
+
† OUR REIMPLEMENTATION.
|
| 129 |
+
|
| 130 |
+
# 4.2 EXPERIMENTS SETUP
|
| 131 |
+
|
| 132 |
+
Network architectures Following CLIP, we first consider two different architectures for the image encoder: a modified version of ResNet50 (Radford et al., 2021) and ViT-B/32 (Dosovitskiy et al., 2020). The text encoder is a Transformer (Vaswani et al., 2017) with the architecture modifications described in Radford et al. (2019). The image and text features are projected to the same 1024 dimension, followed by L2 normalization before interaction. Benefiting from the rapid progress of large CV models, we further scale up our model. Our largest model is a RegNetY-64GF (Radosavovic et al., 2020; Goyal et al., 2021) image encoder with a BERT (Devlin et al., 2018) text encoder, which is on-pair with the largest CLIP- $. { \mathrm { R 5 0 } } { \times } 6 4$ model.
|
| 133 |
+
|
| 134 |
+
Pre-training setup For a fair comparison with CLIP, we train our DeCLIP-ResNet50 and DeCLIP-ViT-B/32 from scratch for 32 epochs. Unless otherwise specified, we use full data, i.e., 88M image-text pairs, to obtain the best performance. The input resolution of the image encoder is $2 2 4 \times 2 2 4$ , and the maximum context length of the text encoder is 76. The learnable temperature parameter $\tau$ is initialized to 0.07. The loss weights of additional supervision $\alpha$ , $\beta$ and $\gamma$ are all set to 0.2. More details can be found in Appendix C.
|
| 135 |
+
|
| 136 |
+
Downstream evaluation setup We evaluate our model transferability by performing linear classification on frozen features, i.e., the pre-trained image encoder is fixed and serves as a feature extractor. After feature extraction, we train the linear classifier with the L-BFGS optimizer as the same in Radford et al. (2021).
|
| 137 |
+
|
| 138 |
+
# 4.3 MAIN RESULTS
|
| 139 |
+
|
| 140 |
+
Zero-shot recognition on ImageNet After pre-training, we use natural language to refer to visual concepts enabling the zero-shot ability of our model. As shown in Fig. 1, our DeCLIP-ResNet50 consistently outperforms the CLIP-ResNet50 across all dataset sizes. When the data amount reaches 56M (29M open-source $\mathbf { + \ 2 7 M }$ web-crawled), our model can achieve $6 0 . 4 \%$ accuracy, $0 . 8 \%$ above the CLIP-ResNet50, while using $7 . 1 \times$ fewer data. As described in Tab. 2, with our full data, our best ResNet50/ViT-B32 models boost the zero-shot performance to $6 2 . 5 \%$ and $6 6 . 2 \%$ , nearly $3 . 0 \%$ higher than the best number reported for these two architectures. Moreover, our DeCLIP-ResNet50 is even $0 . 3 \%$ better than CLIP-ResNet101, revealing the effectiveness and efficiency of our framework. Scaling up model capacity works in our framework as well. Our biggest DeCLIP-RegNetY64GF achieves $7 3 . 7 \%$ accuracy, which is $0 . 1 \%$ above CLIP ResNet $5 0 \times 6 4$ with fewer parameters.
|
| 141 |
+
|
| 142 |
+
Downstream evaluation results We report our linear probe performance on 11 downstream datasets in Tab. 3. Our DeCLIP-ResNet50 outperforms its CLIP counterpart in 8 out of 11 datasets, with a $0 . 8 \%$ average improvement. There are some datasets that our models perform worse than CLIP models, such as SUN and Food101. We conjecture that this is caused by the different distribution of the pre-trained dataset. Interestingly, our ResNet50 and ViT-B/32 models might have distinct performance on several datasets, such as Pets and Aircraft. We infer that these two types of neural networks might have different data preferences, i.e., different feature extraction capacities when they meet the same data.
|
| 143 |
+
|
| 144 |
+
Table 3: Linear probe performance on 11 downstream datasets. There are some abbreviations. C10/100 is CIFAR10/100. F101 is Food101. Flow is Flowers. Cal is Caltech. Air is Aircraft. IN is ImageNet. Our DeCLIP models achieve higher average accuracy over 11 datasets.
|
| 145 |
+
|
| 146 |
+
<table><tr><td>MODEL</td><td></td><td>50</td><td></td><td></td><td>10</td><td>MOTI</td><td></td><td></td><td>美</td><td></td><td>N</td><td>U</td></tr><tr><td>CLIP-RESNET50+ CLIP-RESNET50</td><td>85.1 88.2</td><td>87.3</td><td>65.0 70.3</td><td>71.3 73.3</td><td>80.8 86.4</td><td>98.2 96.1</td><td>77.2 78.3</td><td>89.6 89.6</td><td>44.8 49.1</td><td>71.0 76.4</td><td>70.8 73.3</td><td>76.5 79.1</td></tr><tr><td>DECLIP-RESNET50</td><td>88.7</td><td>88.7 89.8</td><td>71.2</td><td>72.8</td><td>82.7</td><td>99.2</td><td>81.7</td><td>93.9</td><td>48.4</td><td>76.8</td><td>74.0</td><td>79.9(个 +0.8)</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>CLIP-VIT-B/32+</td><td>85.3 90.0</td><td>91.6</td><td>74.2 80.5</td><td>72.3 76.6</td><td>80.8 88.8</td><td>97.9 96.9</td><td>77.6 81.8</td><td>93.2 93.0</td><td>47.0 52.0</td><td>72.5 76.5</td><td>70.3 76.1</td><td>78.4 82.5</td></tr><tr><td>CLIP-VIT-B/32</td><td></td><td>95.1</td><td></td><td></td><td></td><td>99.1</td><td></td><td>94.8</td><td></td><td></td><td></td><td></td></tr><tr><td>DECLIP-VIT-B/32</td><td>89.2</td><td>96.5</td><td>84.7</td><td>75.0</td><td>85.0</td><td></td><td>81.6</td><td></td><td>53.5</td><td>78.5</td><td>75.3</td><td>83.0 (个 +0.5)</td></tr></table>
|
| 147 |
+
|
| 148 |
+
† OUR REIMPLEMENTATED CLIP MODEL TRAINED ON 88M DATA.
|
| 149 |
+
|
| 150 |
+
Table 4: Ablation on additional supervision. SS/MVS/NNS denotes Self-Supervision, Multi-View Supervision and NearestNeighbor Supervision, respectively.
|
| 151 |
+
|
| 152 |
+
<table><tr><td>CLIP</td><td>MVS</td><td>Ss</td><td>NNS</td><td>ZERO-SHOT</td></tr><tr><td>广</td><td>×</td><td>×</td><td>×</td><td>20.6</td></tr><tr><td></td><td>√</td><td>×</td><td>×</td><td>24.8(个 +4.2)</td></tr><tr><td>√</td><td>广</td><td></td><td>×</td><td>25.4(个 +4.8)</td></tr><tr><td>√</td><td></td><td><</td><td>√</td><td>27.2(个 +6.6)</td></tr></table>
|
| 153 |
+
|
| 154 |
+

|
| 155 |
+
Figure 7: Ablation on pre-training cost on CC3M dataset. The proposed method performs better with less training time.
|
| 156 |
+
|
| 157 |
+
# 4.4 ABLATION STUDY
|
| 158 |
+
|
| 159 |
+
Ablation on additional supervision In order to understand the effectiveness of each additional supervision, we conduct an ablation study as indicated in Tab. 4. We follow the DeCLIP-ResNet50 protocol in the pre-training setup except for a smaller 1024 batch size on a smaller CC3M dataset. The single image-text contrastive supervision (CLIP) results in $2 0 . 6 \%$ zero-shot top1 accuracy on ImageNet. We can observe that MVS boost amazing $4 . 2 \%$ improvement over the original CLIP. As discussed in Sec. 3.3, the benefits might come from two sides: 1). the MVS can look at a small local view of an image which might be a better fit with the text description. 2). $2 \times 2$ augmented views can provide $3 \times$ diverse and high-quality additional supervision, thus leading to more robust representations. SS can further contribute an additional $0 . 6 \%$ improvement on the basis of MVS. We believe SS could bring more improvements with proper dedicated SSL methods. NNS further brings $1 . 8 \%$ improvement on the high basis of SS. We will discuss more about NNS at Sec. 4.5. On the YFCC15M dataset, our DeCLIP using full additional supervision gets significant effect improvement, Appendix F shows the details.
|
| 160 |
+
|
| 161 |
+
Ablation on training cost Since we need to encode twice for each image-text pair, we admit our DeCLIP needs a higher training cost than CLIP. Regarding the training time, one DeCLIP iteration equals $1 . 5 \times$ CLIP iteration. In this ablation, we train the original CLIP-ResNet50 longer than our DeCLIP-ResNet50. As shown in Fig. 7, longer 64 epochs training can bring about $1 . 1 \%$ improvement. However, our model has $2 7 . 2 \%$ top1 accuracy, which is still $5 . 3 \%$ higher than the time-equivalent CLIP. It reveals that our framework can extract richer and more representative features through our proposed supervision. We also include memory usage ablation in Appendix F.
|
| 162 |
+
|
| 163 |
+
# 4.5 ANALYSIS
|
| 164 |
+
|
| 165 |
+
Class activation maps We try to understand what renders our DeCLIP effective. As shown in Fig. 8, we visualize the class activation maps (CAM) (Zhou et al., 2016) of different models trained on the YFCC dataset. The results validate that the proposed method learns more representative features with the aid of multiple supervision.
|
| 166 |
+
|
| 167 |
+

|
| 168 |
+
Figure 8: Class activation maps (CAM) for the CLIP vs. our DeCLIP model trained on the YFCC dataset. The CAMs of our model segment the complete object, while the CLIP model only looks at a few components.
|
| 169 |
+
|
| 170 |
+

|
| 171 |
+
Figure 9: Nearest neighbor samples from different datasets. As we can see, the NN pair is very similar to the original pair, thus it can provide high-quality supervision.
|
| 172 |
+
|
| 173 |
+
Nearest neighbor samples In Fig 9, we show some nearest neighbor (NN) samples from different datasets. The first row is the original image-text pair, while the second row is the NN pair. In general, we can see that the texts have similar intellectual meanings. Therefore, the NN pair can provide high-quality supervision. When taking datasets into consideration, the matching performs very well in well-filtered datasets, such as CC3M and CC12M. This matching might be a little worse in more noisy datasets, such as YFCC and web-crawled, but it can still provide some beneficial guidance.
|
| 174 |
+
|
| 175 |
+
# 5 CONCLUSION
|
| 176 |
+
|
| 177 |
+
This paper introduces DeCLIP, a Data efficient Contrastive Language-Image Pre-training paradigm. Our goal is to learn visual representations through the use of broader and scalable supervision. Specifically, instead of using the single image-text contrastive supervision, we fully exploit data potential through the use of (1) self-supervision within each modality; (2) multi-view supervision across modalities; (3) nearest-neighbor supervision from other similar pairs. Experimentally, DeCLIP shows superior effectiveness and efficiency with different types of neural nets(CNN and ViT) and different amounts of data. We hope our work could bring insights about exploiting the multimodal data.
|
| 178 |
+
|
| 179 |
+
# REFERENCES
|
| 180 |
+
|
| 181 |
+
Hassan Akbari, Linagzhe 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.
|
| 182 |
+
|
| 183 |
+
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.
|
| 184 |
+
|
| 185 |
+
Mathilde Caron, Ishan Misra, Julien Mairal, Priya Goyal, Piotr Bojanowski, and Armand Joulin. Unsupervised learning of visual features by contrasting cluster assignments. arXiv preprint arXiv:2006.09882, 2020.
|
| 186 |
+
|
| 187 |
+
Soravit Changpinyo, Piyush Sharma, Nan Ding, and Radu Soricut. Conceptual $1 2 \mathrm { m }$ : Pushing web-scale image-text pre-training to recognize long-tail visual concepts. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3558–3568, 2021.
|
| 188 |
+
|
| 189 |
+
Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In International conference on machine learning, pp. 1597–1607. PMLR, 2020a.
|
| 190 |
+
|
| 191 |
+
Xinlei Chen and Kaiming He. Exploring simple siamese representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 15750–15758, 2021.
|
| 192 |
+
|
| 193 |
+
Yen-Chun Chen, Linjie Li, Licheng Yu, Ahmed El Kholy, Faisal Ahmed, Zhe Gan, Yu Cheng, and Jingjing Liu. Uniter: Universal image-text representation learning, 2020b.
|
| 194 |
+
|
| 195 |
+
Ruizhe Cheng, Bichen Wu, Peizhao Zhang, Peter Vajda, and Joseph E Gonzalez. Data-efficient language-supervised zero-shot learning with self-distillation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3119–3124, 2021.
|
| 196 |
+
|
| 197 |
+
Jia Deng, Wei Dong, Richard Socher, Li-Jia Li, Kai Li, and Li Fei-Fei. Imagenet: A large-scale hierarchical image database. In 2009 IEEE conference on computer vision and pattern recognition, pp. 248–255. Ieee, 2009.
|
| 198 |
+
|
| 199 |
+
Karan Desai and Justin Johnson. Virtex: Learning visual representations from textual annotations. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11162–11173, 2021.
|
| 200 |
+
|
| 201 |
+
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.
|
| 202 |
+
|
| 203 |
+
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.
|
| 204 |
+
|
| 205 |
+
Debidatta Dwibedi, Yusuf Aytar, Jonathan Tompson, Pierre Sermanet, and Andrew Zisserman. With a little help from my friends: Nearest-neighbor contrastive learning of visual representations. arXiv preprint arXiv:2104.14548, 2021.
|
| 206 |
+
|
| 207 |
+
Tianyu Gao, Xingcheng Yao, and Danqi Chen. Simcse: Simple contrastive learning of sentence embeddings. arXiv preprint arXiv:2104.08821, 2021.
|
| 208 |
+
|
| 209 |
+
Ross Girshick, Jeff Donahue, Trevor Darrell, and Jitendra Malik. Rich feature hierarchies for accurate object detection and semantic segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 580–587, 2014.
|
| 210 |
+
|
| 211 |
+
Lluis Gomez, Yash Patel, Marc¸al Rusinol, Dimosthenis Karatzas, and CV Jawahar. Self-supervised ˜ learning of visual features through embedding images into text topic spaces. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 4230–4239, 2017.
|
| 212 |
+
|
| 213 |
+
Priya Goyal, Mathilde Caron, Benjamin Lefaudeux, Min Xu, Pengchao Wang, Vivek Pai, Mannat Singh, Vitaliy Liptchinsky, Ishan Misra, Armand Joulin, et al. Self-supervised pretraining of visual features in the wild. arXiv preprint arXiv:2103.01988, 2021.
|
| 214 |
+
|
| 215 |
+
Jean-Bastien Grill, Florian Strub, Florent Altche, Corentin Tallec, Pierre H Richemond, Elena ´ Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Daniel Guo, Mohammad Gheshlaghi Azar, et al. Bootstrap your own latent: A new approach to self-supervised learning. arXiv preprint arXiv:2006.07733, 2020.
|
| 216 |
+
|
| 217 |
+
Xu Han, Zhengyan Zhang, Ning Ding, Yuxian Gu, Xiao Liu, Yuqi Huo, Jiezhong Qiu, Liang Zhang, Wentao Han, Minlie Huang, et al. Pre-trained models: Past, present and future. AI Open, 2021.
|
| 218 |
+
|
| 219 |
+
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.
|
| 220 |
+
|
| 221 |
+
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.
|
| 222 |
+
|
| 223 |
+
Yuqi Huo, Manli Zhang, Guangzhen Liu, Haoyu Lu, Yizhao Gao, Guoxing Yang, Jingyuan Wen, Heng Zhang, Baogui Xu, Weihao Zheng, et al. Wenlan: Bridging vision and language by largescale multi-modal pre-training. arXiv preprint arXiv:2103.06561, 2021.
|
| 224 |
+
|
| 225 |
+
Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc V Le, Yunhsuan Sung, Zhen Li, and Tom Duerig. Scaling up visual and vision-language representation learning with noisy text supervision. arXiv preprint arXiv:2102.05918, 2021.
|
| 226 |
+
|
| 227 |
+
Armand Joulin, Laurens Van Der Maaten, Allan Jabri, and Nicolas Vasilache. Learning visual features from large weakly supervised data. In European Conference on Computer Vision, pp. 67–84. Springer, 2016.
|
| 228 |
+
|
| 229 |
+
Simon Kornblith, Jonathon Shlens, and Quoc V Le. Do better imagenet models transfer better? In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2661–2671, 2019.
|
| 230 |
+
|
| 231 |
+
Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. Advances in neural information processing systems, 25:1097–1105, 2012.
|
| 232 |
+
|
| 233 |
+
Y LeCun and I Misra. Self-supervised learning: The dark matter of intelligence, 2021.
|
| 234 |
+
|
| 235 |
+
Xiujun Li, Xi Yin, Chunyuan Li, Pengchuan Zhang, Xiaowei Hu, Lei Zhang, Lijuan Wang, Houdong Hu, Li Dong, Furu Wei, et al. Oscar: Object-semantics aligned pre-training for vision-language tasks. In European Conference on Computer Vision, pp. 121–137. Springer, 2020.
|
| 236 |
+
|
| 237 |
+
Jonathan Long, Evan Shelhamer, and Trevor Darrell. Fully convolutional networks for semantic segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3431–3440, 2015.
|
| 238 |
+
|
| 239 |
+
Jiasen Lu, Dhruv Batra, Devi Parikh, and Stefan Lee. Vilbert: Pretraining task-agnostic visiolinguistic representations for vision-and-language tasks. arXiv preprint arXiv:1908.02265, 2019.
|
| 240 |
+
|
| 241 |
+
George A Miller. Wordnet: a lexical database for english. Communications of the ACM, 38(11): 39–41, 1995.
|
| 242 |
+
|
| 243 |
+
Norman Mu, Alexander Kirillov, David Wagner, and Saining Xie. Slip: Self-supervision meets language-image pre-training. arXiv preprint arXiv:2112.12750, 2021.
|
| 244 |
+
|
| 245 |
+
Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
|
| 246 |
+
|
| 247 |
+
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.
|
| 248 |
+
|
| 249 |
+
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.
|
| 250 |
+
|
| 251 |
+
Ilija Radosavovic, Raj Prateek Kosaraju, Ross Girshick, Kaiming He, and Piotr Dollar. Designing ´ network design spaces. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10428–10436, 2020.
|
| 252 |
+
|
| 253 |
+
Mert Bulent Sariyildiz, Julien Perez, and Diane Larlus. Learning visual representations with caption annotations. In Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part VIII 16, pp. 153–170. Springer, 2020.
|
| 254 |
+
|
| 255 |
+
Piyush Sharma, Nan Ding, Sebastian Goodman, and Radu Soricut. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In Proceedings of ACL, 2018.
|
| 256 |
+
|
| 257 |
+
Sheng Shen, Liunian Harold Li, Hao Tan, Mohit Bansal, Anna Rohrbach, Kai-Wei Chang, Zhewei Yao, and Kurt Keutzer. How much can clip benefit vision-and-language tasks? arXiv preprint arXiv:2107.06383, 2021.
|
| 258 |
+
|
| 259 |
+
Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
|
| 260 |
+
|
| 261 |
+
Bart Thomee, David A Shamma, Gerald Friedland, Benjamin Elizalde, Karl Ni, Douglas Poland, Damian Borth, and Li-Jia Li. Yfcc100m: The new data in multimedia research. Communications of the ACM, 59(2):64–73, 2016.
|
| 262 |
+
|
| 263 |
+
Wouter Van Gansbeke, Simon Vandenhende, Stamatios Georgoulis, and Luc Van Gool. Revisiting contrastive methods for unsupervised learning of visual representations. arXiv preprint arXiv:2106.05967, 2021.
|
| 264 |
+
|
| 265 |
+
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.
|
| 266 |
+
|
| 267 |
+
Oriol Vinyals, Alexander Toshev, Samy Bengio, and Dumitru Erhan. Show and tell: A neural image caption generator. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3156–3164, 2015.
|
| 268 |
+
|
| 269 |
+
Jason Wei and Kai Zou. Eda: Easy data augmentation techniques for boosting performance on text classification tasks. arXiv preprint arXiv:1901.11196, 2019.
|
| 270 |
+
|
| 271 |
+
Bichen Wu, Ruizhe Cheng, Peizhao Zhang, Peter Vajda, and Joseph E Gonzalez. Data efficient language-supervised zero-shot recognition with optimal transport distillation. arXiv preprint arXiv:2112.09445, 2021.
|
| 272 |
+
|
| 273 |
+
Zhirong Wu, Yuanjun Xiong, Stella X Yu, and Dahua Lin. Unsupervised feature learning via nonparametric instance discrimination. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3733–3742, 2018.
|
| 274 |
+
|
| 275 |
+
Lewei Yao, Runhui Huang, Lu Hou, Guansong Lu, Minzhe Niu, Hang Xu, Xiaodan Liang, Zhenguo Li, Xin Jiang, and Chunjing Xu. Filip: Fine-grained interactive language-image pre-training. arXiv preprint arXiv:2111.07783, 2021.
|
| 276 |
+
|
| 277 |
+
Xin Yuan, Zhe Lin, Jason Kuen, Jianming Zhang, Yilin Wang, Michael Maire, Ajinkya Kale, and Baldo Faieta. Multimodal contrastive training for visual representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6995–7004, 2021.
|
| 278 |
+
|
| 279 |
+
Yuhao Zhang, Hang Jiang, Yasuhide Miura, Christopher D Manning, and Curtis P Langlotz. Contrastive learning of medical visual representations from paired images and text. arXiv preprint arXiv:2010.00747, 2020.
|
| 280 |
+
|
| 281 |
+
Bolei Zhou, Aditya Khosla, Agata Lapedriza, Aude Oliva, and Antonio Torralba. Learning deep features for discriminative localization. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2921–2929, 2016.
|
| 282 |
+
|
| 283 |
+
# A PSEUDO CODE OF DECLIP
|
| 284 |
+
|
| 285 |
+
The training pseudo code of DeCLIP is as follows:
|
| 286 |
+
|
| 287 |
+
# Algorithm 1 DeCLIP
|
| 288 |
+
|
| 289 |
+
Input: $I , \tilde { I } , T , \tilde { T }$ , image encoder, text encoder, F eature Queue
|
| 290 |
+
1: function BATCH-UPDATING(I, ˜I, T , T˜)
|
| 291 |
+
2: # Get The Features of The Current Batch.
|
| 292 |
+
3: $I _ { f } , \tilde { I } _ { f } \gets i m a g e \_ e n c o d e r ( I )$ , image encoder( ˜I)
|
| 293 |
+
4: $T _ { f } , \tilde { T } _ { f } \gets t e x t . e n c o d e r ( T )$ , text encoder $( \tilde { T } )$
|
| 294 |
+
5: TNN ← NEAREST-NEIGHBOR(F eature Queue, Tf )
|
| 295 |
+
6:
|
| 296 |
+
7: # Calculate The losses.
|
| 297 |
+
8: $L _ { C L I P } \gets \mathrm { I N F O N C E - L O S S } ( I _ { f } , T _ { f } )$
|
| 298 |
+
9: $L _ { S S } \gets \mathrm { I M A G E - S S - L O s s } ( I _ { f } , I _ { f } ) + \mathrm { T E X T - S S - L O s s } ( T _ { f } )$
|
| 299 |
+
10: ${ \cal L } _ { M V S } \gets \mathrm { I N F O N C E - L O s s } ( I _ { f } , \bar { T } _ { f } ) + \mathrm { I N F O N C E - L O s s } ( \bar { I } _ { f } , T _ { f } ) + \mathrm { I N F O N C E - L O s s } ( \bar { I } _ { f } , \bar { T } _ { f } )$
|
| 300 |
+
11: $L _ { N N S } \gets \mathrm { I N F O N C E - L O s s } ( \bar { I } _ { f } , \bar { T } _ { N N } )$
|
| 301 |
+
12: $L _ { D e C L I P } \gets ( 1 - \alpha - \beta - \gamma ) L _ { C L I P } + \alpha L _ { S S } + \beta L _ { M V S } + \gamma L _ { N N S }$
|
| 302 |
+
13:
|
| 303 |
+
14: # Update The Network.
|
| 304 |
+
15: image encoder $\gets$ BACKWARD-UPDATE(image encoder, LDeCLIP )
|
| 305 |
+
16: text encoder $\gets$ BACKWARD-UPDATE(text encoder, LDeCLIP )
|
| 306 |
+
17: F eature Queue FIFO-UPDATE(F eature Queue, $T _ { f }$ )
|
| 307 |
+
18: end function
|
| 308 |
+
19:
|
| 309 |
+
20: function IMAGE-SS-LOSS(If , ˜If )
|
| 310 |
+
21: $z , \tilde { z } \gets$ image encoder.proj $\left( I _ { f } \right)$ , image encoder.proj( ˜If )
|
| 311 |
+
22: p, p˜ ← image encoder.pred(z), image encoder.pred(˜z)
|
| 312 |
+
23: $z , \tilde { z } \gets z . d e t a c h ( ) , \tilde { z } . d e t a c h ( )$
|
| 313 |
+
24: # Calculate the Negative Cosine Similarity loss.
|
| 314 |
+
25: $L _ { I m a g e - S S } N C S ( p , \tilde { z } ) / 2 + N C S ( \tilde { p } , z ) / 2$
|
| 315 |
+
26: return LImage−SS
|
| 316 |
+
27: end function
|
| 317 |
+
28:
|
| 318 |
+
29: function TEXT-SS-LOSS $( T _ { f } )$ )
|
| 319 |
+
30: # Get The Masking GT when performing the text-encoder.
|
| 320 |
+
31: Wf $, W _ { g t } \gets T _ { f }$ .word feat, $T _ { f }$ .mask id
|
| 321 |
+
32: $W _ { p r e d } t e x t . e n c o d e r . p r e d ( W _ { f } )$
|
| 322 |
+
33: # Calculate the Cross-Entropy loss.
|
| 323 |
+
34: $L _ { T e x t - S S } \gets C E ( W _ { g t } , W _ { p r e d } )$
|
| 324 |
+
35: return LT ext−SS
|
| 325 |
+
36: end function
|
| 326 |
+
|
| 327 |
+
# B DATA AUGMENTATION
|
| 328 |
+
|
| 329 |
+
Details of SS The image SS uses SimSiam (Chen & He, 2021) method as the image selfsupervision. The prediction module is a 2-layer MLP, in which the hidden dimensions are 512 and output dimensions are 1024, the projection module is a 3-layer MLP, in which the hidden and output dimensions are both 1024. The text SS uses the Masked Language Model (Devlin et al., 2018) as the pretext task. In detail, we first randomly choose $1 5 \%$ of all tokens in each sequence. Then the token is replaced with (1) the [mask] token $8 0 \%$ of the time (2) a random token $\bar { 1 } 0 \%$ of the time (3) the unchanged token $1 0 \%$ of the time.
|
| 330 |
+
|
| 331 |
+
Image augmentations The augmentation policy includes: RandomResizedCrop with scale in [0.2,1.0] (Wu et al., 2018), ColorJitter containing $\{$ {brightness, contrast, saturation, hue} strength of $\{ 0 . 4 , 0 . 4 , 0 . 4 , 0 . 1 \}$ with an applying probability of 0.8, RandomGrayscale with an applying probability of 0.2. Blurring augmentation (Chen et al., 2020a) has a Gaussian kernel with std in [0.1, 2.0], and RandomHorizontalFlip.
|
| 332 |
+
|
| 333 |
+
Text augmentations We use the EDA (Wei & Zou, 2019) method as our text augmentation strategy, which contains three types of text augmentation strategies: synonym replacement, random swap, and random deletion. Each text will randomly select one of these three types for text augmentation.
|
| 334 |
+
|
| 335 |
+
# C PRE-TRAINING DATASETS & IMPLEMENTATION DETAILS
|
| 336 |
+
|
| 337 |
+
Open-source data. Conceptual Captions (Sharma et al., 2018) is a $3 . 3 \ \mathrm { M }$ image caption opensource data. Due to the failure of the download link, we only download about 3M data(CC3M). Conceptual 12M (Sharma et al., 2018) contains approximately 12M of image-text pairs(CC12M), which is larger than the CC3M and covers a more diverse set of visual concepts. Also, due to the failure of the download link, we only download about 11M data. YFCC (Thomee et al., 2016), the Yahoo Flickr Creative Commons 100M data, is a dataset for vision language tasks. We download about $8 6 . 5 \mathrm { M }$ data from the YFCC website and use four filtering rules to filter the DeCLIP YFCC15M dataset to benchmark against CLIP YFCC15M. The four rules are: filtering data with damaged images, filtering data without the caption, filtering data with a caption English word ratio less than 0.8, filtering data with a caption only including one part of speech.
|
| 338 |
+
|
| 339 |
+
Web-crawled data. We use the user tags and machine tags of YFCC15M to form a tag list, and use WordNet (Miller, 1995) to find synonyms for each tag in the tag list to form a synonym tag list. The tag list and synonym tag list form a query list. Then we use the query list to crawl images from the Internet, after filtering data with smaller images, filtering data with damaged images, filtering data without the caption, and filtering data with Chinese in the caption, we collect 59M web crawled data. Tabel 5 shows the source link of pre-training datasets, and Figure 10 shows some cases random sampled from each dataset.
|
| 340 |
+
|
| 341 |
+
Table 5: The source link of DeCLIP pre-training datasets.
|
| 342 |
+
|
| 343 |
+
<table><tr><td>DATASET</td><td>DATASET API</td></tr><tr><td>CONCEPTUALCAPTIONS</td><td>HTTPS://AI.GOOGLE.COM/RESEARCH/CONCEPTUALCAPTIONS</td></tr><tr><td>CONCEPTUAL12M</td><td>HTTPS://GITHUB.COM/GOOGLE-RESEARCH-DATASETS/CONCEPTUAL-12M</td></tr><tr><td>YFCC</td><td>HTTP://PROJECTS.DFKI.UNI-KL.DE/YFCC100M</td></tr><tr><td>GOOGLE</td><td>HTTPS://WWW.GOOGLE.COM.HK</td></tr></table>
|
| 344 |
+
|
| 345 |
+
Implementation details We train DeCLIP-ResNet50 (abbr. as R50) and DeCLIP-ViT-B/32 (abbr. as V-B32) from scratch for 32 epochs. For R50, we use the FP16-SGD optimizer with the batch size of 10,240 $( 1 2 8 \times 8 0 )$ ). Starting with an 0.01 learning rate (lr), we first linearly increasing the lr to 0.2 (a.k.a warm-up) in one epoch. Then we use cosine anneal lr decay to decrease the lr. The weight decay is set to 0.0001. For V-B32, we use a hybrid FP16-AdamW-SGD optimizer with bacth size $1 0 , 2 4 0 ( 1 2 8 \times 8 0 )$ ). For the ViT image encoder, we use AdamW optimizer with the lr warming up from 1e-4 to 1e-3 in one epoch. The weight decay is set to 0.05. For the text encoder, we use the SGD optimizer with the lr warming up from 1e-3 to 0.02 in one epoch. The weight decay is set to 1e-4.
|
| 346 |
+
|
| 347 |
+
Pre-training cost Our R50 and V-B32 took 8/10 days to train on 80 V100 GPUs, respectively. Our largest DeCLIP-RegNetY-64GF took 21 days on 160 V100 GPUs, while the largest CLIP- ${ \mathrm { R 5 0 } } \times 6 4$ from (Radford et al., 2021) spent 18 days on 592 V100 GPUs.
|
| 348 |
+
|
| 349 |
+

|
| 350 |
+
Figure 10: Example image-text pairs randomly sampled from the training dataset. (a) Conceptual Captions, (b) YFCC, (c) Conceptual 12M, (d) Web-crawled.
|
| 351 |
+
|
| 352 |
+
# D DOWNSTREAM DATASETS & IMPLEMENTATION DETAILS
|
| 353 |
+
|
| 354 |
+
Downstream data. We begin with the 12 datasets from the well-studied evaluation suite introduced by Kornblith et al. (2019). Within these 12 datasets, Birdsnap can not be downloaded, and PASCAL VOC 2007 classification is replaced by more challenging ImageNet-1K, resulting in our 11 datasets. They are: Food-101, CIFAR-10, CIFAR-100, SUN397, Stanford Cars, FGVC Aircraft, Describable Textures, Oxford-IIIT Pets, Caltech-101, Oxford Flowers 102. Tab. 6 is the detailed information of these datasets.
|
| 355 |
+
|
| 356 |
+
Table 6: Details of DeCLIP downstream datasets.
|
| 357 |
+
|
| 358 |
+
<table><tr><td>DATASET</td><td>CLASSES</td><td>TRAIN SIZE</td><td>TEST SIZE</td><td>EVALUATIONMETRIC</td></tr><tr><td>CIFAR10</td><td>10</td><td>50,000</td><td>10,000</td><td>ACCURACY</td></tr><tr><td>CIFAR100</td><td>100</td><td>50.000</td><td>10,000</td><td>ACCURACY</td></tr><tr><td>F00D-101</td><td>101</td><td>75,750</td><td>25,250</td><td>ACCURACY</td></tr><tr><td>OXFORDIIIT-PETS</td><td>37</td><td>3,680</td><td>3,669</td><td>MEAN PER CLASS</td></tr><tr><td>OXFORD 102 FLOWERS</td><td>102</td><td>2.040</td><td>6,149</td><td>MEAN PER CLASS</td></tr><tr><td>SUN</td><td>397</td><td>19,850</td><td>19,850</td><td>ACCURACY</td></tr><tr><td>STANFORD CARS</td><td>196</td><td>8,144</td><td>8,041</td><td>ACCURACY</td></tr><tr><td>DTD</td><td>47</td><td>3,760</td><td>1,880</td><td>ACCURACY</td></tr><tr><td>CALTECH-101</td><td>102</td><td>3,060</td><td>6,085</td><td>MEAN PER</td></tr><tr><td>FGVC AIRCRAFT</td><td>100</td><td>6,667</td><td>3,333</td><td>MEAN PER CLASS</td></tr><tr><td>IMAGENET1K</td><td>1000</td><td>1,281,167</td><td>50,000</td><td>ACCURACY</td></tr></table>
|
| 359 |
+
|
| 360 |
+
Implementation details We follow CLIP (Radford et al., 2021) to train a logistic regression classifier using L-BFGS, with maximum 1,000 iterations, and report the corresponding metric for each dataset. We determine the L2 regularization strength $\lambda$ using a hyperparameter sweep on the validation sets over the range between $1 0 ^ { - 6 }$ and $1 0 ^ { 6 }$ , with 96 logarithmically spaced steps. To save compute required for the sweeps, we perform a parametric binary search that starts with $\lambda = [ 1 0 ^ { - 6 }$ , $1 0 ^ { - \dot { 4 } }$ , $1 0 ^ { - 2 }$ , 1, $1 0 ^ { 2 }$ , $1 0 ^ { 4 }$ , $1 0 ^ { 6 } ]$ and iteratively halves the interval around the peak until it reaches a resolution of 8 steps per decade. The hyperparameter sweeps are performed on a validation split of each dataset. For the datasets that contains a validation split in addition to from the test split, we use the provided validation set to perform the hyperparameter search, and for the datasets that do not provide a validation split or have not published labels for the test data, we split the training dataset to perform the hyperparameter search and report the performance on the validation data.
|
| 361 |
+
|
| 362 |
+
# E PROMPT ENGINEERING
|
| 363 |
+
|
| 364 |
+
Due to the reason that it’s relatively rare in the dataset for the text to be a single word, we use prompts such as $" a$ photo of a $\{ \mathrm { 1 a b e 1 } \} "$ for zero-shot classification. For a fair comparison, we use the same prompts as proposed in Radford et al. (2021) for the ImageNet dataset. As shown in Fig 11, the prompts reduce the domain gap between the training dataset and testset, and fully consider the different situations for the picture.
|
| 365 |
+
|
| 366 |
+
a bad photo of a {label}.
|
| 367 |
+
a photo of many {label}.
|
| 368 |
+
a sculpture of a {label}.
|
| 369 |
+
a photo of the hard to see {label}.
|
| 370 |
+
a low resolution photo of the {label}.
|
| 371 |
+
a rendering of a {label}.
|
| 372 |
+
graffiti of a {label}.
|
| 373 |
+
a bad photo of the {label}.
|
| 374 |
+
a cropped photo of the {label}.
|
| 375 |
+
a tattoo of a {label}.
|
| 376 |
+
the embroidered {label}.
|
| 377 |
+
a photo of a hard to see {label}.
|
| 378 |
+
a bright photo of a {label}.
|
| 379 |
+
a photo of a clean {label}.
|
| 380 |
+
a photo of a dirty {label}.
|
| 381 |
+
a dark photo of the {label}.
|
| 382 |
+
a drawing of a {label}.
|
| 383 |
+
a photo of my {label}.
|
| 384 |
+
the plastic {label}.
|
| 385 |
+
a photo of the cool {label}.
|
| 386 |
+
|
| 387 |
+

|
| 388 |
+
Figure 11: The prompts for zero-shot testing.
|
| 389 |
+
|
| 390 |
+
# F ADDITIONAL STUDY
|
| 391 |
+
|
| 392 |
+
Table 7: DeCLIP zero-shot performance of ImageNet top1 on different training datasets.
|
| 393 |
+
|
| 394 |
+
<table><tr><td>BACKBONE</td><td>DATASET</td><td>DATA SIZE</td><td>BATCH SIZE</td><td>ZERO-SHOT</td></tr><tr><td>REsNET50</td><td>CONCEPTUALCAPTIONS</td><td>3M</td><td>2,048</td><td>27.8</td></tr><tr><td>REsNET50</td><td>CONCEPTUAL12M</td><td>11M</td><td>4,096</td><td>41.0</td></tr><tr><td>RESNET50</td><td>YFCC</td><td>15M</td><td>4,096</td><td>41.9</td></tr><tr><td>REsNET50</td><td>DECLIP OPEN-SOURCE DATA</td><td>29M</td><td>6,144</td><td>49.3</td></tr></table>
|
| 395 |
+
|
| 396 |
+
Different Pre-training Datasets Data is critical for language-image pre-training task. As shown in Tab. 7, we evaluate our DeCLIP on different sources of datasets. Combining Tab.7 and Fig.1, we can see that when the amount of training data continues to scale up, the zero-shot recognition ability continues to improve as well. In addition, we can see that the open source data has high quality. The 29M open source data can achieve $4 9 . 3 \%$ zero-shot top1 accuracy on ImageNet through the DeCLIP training paradigm. Our open-source data is an affordable benchmark, which would be beneficial for explorations.
|
| 397 |
+
|
| 398 |
+
Our YFCC re-implementation Although we use the same number of image-text pairs as the CLIP YFCC-15M, our YFCC data is different from CLIP. We also reproduce the naive CLIP on our YFCC-15M data, which results in $3 5 . 9 \%$ zero-shot top1 accuracy on ImageNet-1K (see Fig. 8). It is relatively higher than the number in CLIP paper $( 3 1 . 1 \% )$ . We conjecture the improvements might be caused by the different data cleaning strategies. However, our DeCLIP can achieve $4 1 . 9 \%$ zero-shot accuracy which is also $6 . 0 \%$ higher than our CLIP re-implementation.
|
| 399 |
+
|
| 400 |
+
Table 8: DeCLIP zero-shot performance of ImageNet top1 on YFCC datasets. Although we use the same amount of data, our YFCC is different with CLIP YFCC due to the different data cleaning strategies.
|
| 401 |
+
|
| 402 |
+
<table><tr><td>MODEL</td><td>BACKBONE</td><td>DATASET</td><td>DATA SIZE</td><td>BATCH SIZE</td><td>ZERO-SHOT</td></tr><tr><td>CLIP</td><td>REsNET50</td><td>YFCC</td><td>15M</td><td></td><td>31.3</td></tr><tr><td>CLIP (OUR REIMP.)</td><td>REsNET50</td><td>YFCC*</td><td>15M</td><td>4,096</td><td>35.9</td></tr><tr><td>DECLIP</td><td>REsNET50</td><td>YFCC*</td><td>15M</td><td>4,096</td><td>41.9(↑+6.0)</td></tr></table>
|
| 403 |
+
|
| 404 |
+
Memory usage Because of the additional views, our DeCLIP is more memory-consuming. Thanks to the ICLR anonymous review comments: a fairer comparison might be doubling the batch size of CLIP. Flowing the ablation study in Fig. 7, we double the batch size and train CLIP-ResNet50 for 64 epochs. The final result is $2 2 . 3 \%$ which is still $4 . 9 \%$ lower than our DeCLIP model. We summarize the memory usage, training cost, and the final accuracy as below. All experiments are conducted on CC-3M with 16 V100 GPUs.
|
| 405 |
+
|
| 406 |
+
Table 9: Ablation on Memory usage.
|
| 407 |
+
|
| 408 |
+
<table><tr><td>MODEL</td><td>BATCH SIZE PER GPU</td><td>MEMORY (GB)</td><td>EPOCHS</td><td>COST (GPU HOURS)</td><td>ZERO-SHOT</td></tr><tr><td>CLIP-RESNET50</td><td>128</td><td>15.8</td><td>64</td><td>416</td><td>21.7</td></tr><tr><td>CLIP-RESNET50</td><td>256</td><td>24.0</td><td>64</td><td>399</td><td>22.3</td></tr><tr><td>DECLIP-RESNET50</td><td>128</td><td>22.7</td><td>32</td><td>304</td><td>27.2</td></tr></table>
|